@leofcoin/chain 1.1.11 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/{dist/workers/block-worker.js → block-worker.js} +0 -0
  2. package/demo/chain.browser.js +50 -51
  3. package/demo/node.browser.js +6 -13
  4. package/demo/pako.browser.js +670 -501
  5. package/demo/peernet-swarm.browser.js +8 -12
  6. package/demo/workers/block-worker.js +1 -2
  7. package/demo/workers/machine-worker.js +2 -4
  8. package/demo/workers/pool-worker.js +1 -2
  9. package/demo/workers/transaction-worker.js +1 -2
  10. package/dist/browser/workers/block-worker.js +1 -2
  11. package/dist/browser/workers/machine-worker.js +2 -4
  12. package/dist/browser/workers/pool-worker.js +1 -2
  13. package/dist/browser/workers/transaction-worker.js +1 -2
  14. package/dist/chain.browser.js +50 -51
  15. package/dist/chain.js +49 -49
  16. package/dist/module/chain.js +49 -49
  17. package/dist/module/workers/machine-worker.js +2 -2
  18. package/dist/node.browser.js +6 -13
  19. package/dist/pako.browser.js +670 -501
  20. package/dist/peernet-swarm.browser.js +8 -12
  21. package/dist/workers/machine-worker.js +1 -1
  22. package/package.json +4 -2
  23. package/rollup.config.js +1 -1
  24. package/src/chain.js +42 -46
  25. package/src/machine.js +6 -2
  26. package/test/chain.js +33 -18
  27. package/demo/865.machine-worker.js +0 -10
  28. package/demo/chain.js +0 -1209
  29. package/demo/machine-worker.js +0 -17624
  30. package/demo/node.js +0 -1
  31. package/demo/workers/workers/865.js +0 -10
  32. package/demo/workers/workers/block-worker.js +0 -13200
  33. package/demo/workers/workers/machine-worker.js +0 -13904
  34. package/demo/workers/workers/pool-worker.js +0 -8504
  35. package/demo/workers/workers/transaction-worker.js +0 -8496
package/demo/node.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("@leofcoin/peernet"),r=require("@leofcoin/codec-format-interface");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=a(e);class ContractMessage extends r.FormatInterface{get keys(){return["creator","contract","constructorParameters"]}get messageName(){return"ContractMessage"}constructor(e){super(e,"\nmessage ContractMessage {\n required string creator = 1;\n required bytes contract = 2;\n repeated string constructorParameters = 3;\n}\n",{name:"contract-message"})}}class TransactionMessage extends r.FormatInterface{get keys(){return["timestamp","from","to","nonce","method","params","signature"]}get messageName(){return"TransactionMessage"}constructor(e){super(e,"\n\nmessage TransactionMessage {\n required uint64 timestamp = 1;\n required string from = 2;\n required string to = 3;\n required uint64 nonce = 4;\n required string method = 5;\n repeated string params = 6;\n required string signature = 7;\n}\n",{name:"transaction-message"})}}class BlockMessage extends r.FormatInterface{get keys(){return["index","previousHash","timestamp","reward","fees","transactions","validators"]}get messageName(){return"BlockMessage"}constructor(e){super(e,"\nmessage ValidatorMessage {\n required string address = 1;\n required string reward = 2;\n}\n\nmessage Transaction {\n required string hash = 1;\n required uint64 timestamp = 2;\n required string from = 3;\n required string to = 4;\n required uint64 nonce = 5;\n required string method = 6;\n repeated string params = 7;\n}\n\nmessage BlockMessage {\n required uint64 index = 1;\n required string previousHash = 3;\n required uint64 timestamp = 4;\n required uint64 reward = 5;\n required string fees = 6;\n repeated Transaction transactions = 7;\n repeated ValidatorMessage validators = 8;\n}\n",{name:"block-message"})}}class BWMessage extends r.FormatInterface{get keys(){return["up","down"]}get messageName(){return"BWMessage"}constructor(e){super(e,"\n\nmessage BWMessage {\n required uint64 up = 1;\n required uint64 down = 2;\n}\n",{name:"bw-message"})}}class BWRequestMessage extends r.FormatInterface{get keys(){return[]}get messageName(){return"BWRequestMessage"}constructor(e){super(e,"\n\nmessage BWRequestMessage {\n}\n",{name:"bw-request-message"})}}module.exports=class Node{constructor(){return this._init()}async _init(e={network:"leofcoin:mandarine",networkName:"leofcoin:mandarine",networkVersion:"v0.1.0"}){return globalThis.Peernet?await new globalThis.Peernet(e):await new t.default(e),await(async(e={network:"leofcoin:mandarine",networkName:"leofcoin:mandarine",networkVersion:"v0.1.0"})=>{await peernet.addProto("contract-message",ContractMessage),await peernet.addProto("transaction-message",TransactionMessage),await peernet.addProto("block-message",BlockMessage),await peernet.addProto("bw-message",BWMessage),await peernet.addProto("bw-request-message",BWRequestMessage),await peernet.addCodec("contract-message",{codec:parseInt("63636d",16),hashAlg:"keccak-256"}),await peernet.addCodec("transaction-message",{codec:parseInt("746d",16),hashAlg:"keccak-256"}),await peernet.addCodec("block-message",{codec:parseInt("626d",16),hashAlg:"keccak-256"}),await peernet.addCodec("bw-message",{codec:parseInt("62776d",16),hashAlg:"keccak-256"}),await peernet.addCodec("bw-request-message",{codec:parseInt("6277726d",16),hashAlg:"keccak-256"});let r=`.${e.network}`;const a=e.network.split(":");a[1]&&(r=`.${a[0]}/${a[1]}`),await peernet.addStore("contract","lfc",r,!1),await peernet.addStore("accounts","lfc",r,!1),await peernet.addStore("transactionPool","lfc",r,!1)})(),this}};
@@ -1,10 +0,0 @@
1
- (self["webpackChunk_leofcoin_chain"] = self["webpackChunk_leofcoin_chain"] || []).push([[865],{
2
-
3
- /***/ 865:
4
- /***/ (function() {
5
-
6
- /* (ignored) */
7
-
8
- /***/ })
9
-
10
- }])