@aeternity/aepp-sdk 10.0.0 → 11.0.0
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.
- package/README.md +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -27
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/account/{base.js → base.mjs} +20 -10
- package/es/account/base.mjs.map +1 -0
- package/es/account/{memory.js → memory.mjs} +29 -14
- package/es/account/memory.mjs.map +1 -0
- package/es/account/{multiple.js → multiple.mjs} +10 -9
- package/es/account/multiple.mjs.map +1 -0
- package/es/ae/{aens.js → aens.mjs} +18 -22
- package/es/ae/aens.mjs.map +1 -0
- package/es/ae/{aepp.js → aepp.mjs} +9 -9
- package/es/ae/aepp.mjs.map +1 -0
- package/es/ae/contract.mjs +159 -0
- package/es/ae/contract.mjs.map +1 -0
- package/es/ae/{index.js → index.mjs} +8 -7
- package/es/ae/index.mjs.map +1 -0
- package/es/ae/{oracle.js → oracle.mjs} +33 -16
- package/es/ae/oracle.mjs.map +1 -0
- package/es/ae/{universal.js → universal.mjs} +10 -10
- package/es/ae/universal.mjs.map +1 -0
- package/es/ae/{wallet.js → wallet.mjs} +10 -10
- package/es/ae/wallet.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +74 -0
- package/es/bignumber.d.ts +1 -7
- package/es/chain/{index.js → index.mjs} +20 -4
- package/es/chain/index.mjs.map +1 -0
- package/es/chain/{node.js → node.mjs} +121 -73
- package/es/chain/node.mjs.map +1 -0
- package/es/channel/{handlers.js → handlers.mjs} +18 -20
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/{index.js → index.mjs} +7 -7
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/{internal.js → internal.mjs} +49 -32
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/aci.mjs +477 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/compiler.mjs +115 -0
- package/es/contract/compiler.mjs.map +1 -0
- package/es/contract/ga/helpers.mjs +30 -0
- package/es/contract/ga/helpers.mjs.map +1 -0
- package/es/contract/ga/{index.js → index.mjs} +36 -28
- package/es/contract/ga/index.mjs.map +1 -0
- package/es/errors.d.ts +284 -0
- package/es/index.mjs +57 -0
- package/es/index.mjs.map +1 -0
- package/es/node-pool/{index.js → index.mjs} +11 -10
- package/es/node-pool/index.mjs.map +1 -0
- package/es/{node.js → node.mjs} +9 -8
- package/es/node.mjs.map +1 -0
- package/es/tx/builder/field-types.mjs +74 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/{helpers.js → helpers.mjs} +114 -56
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/{index.js → index.mjs} +79 -68
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/{schema.js → schema.mjs} +11 -65
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/{index.js → index.mjs} +5 -2
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/{tx-object.js → tx-object.mjs} +22 -15
- package/es/tx/tx-object.mjs.map +1 -0
- package/es/tx/{tx.js → tx.mjs} +15 -14
- package/es/tx/tx.mjs.map +1 -0
- package/es/tx/{validator.js → validator.mjs} +72 -33
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
- package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +7 -6
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{browser-window-message.js → browser-window-message.mjs} +10 -11
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +5 -2
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +6 -5
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{helpers.js → helpers.mjs} +3 -14
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{aepp-rpc.js → aepp-rpc.mjs} +113 -67
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{rpc-client.js → rpc-client.mjs} +14 -9
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/{wallet-rpc.js → wallet-rpc.mjs} +71 -63
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
- package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{wallet-detector.js → wallet-detector.mjs} +6 -5
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/utils/{amount-formatter.js → amount-formatter.mjs} +14 -7
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/{async-init.js → async-init.mjs} +8 -11
- package/es/utils/async-init.mjs.map +1 -0
- package/es/utils/{bignumber.js → bignumber.mjs} +2 -9
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/utils/{bytes.js → bytes.mjs} +16 -8
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
- package/es/utils/crypto-ts.mjs.map +1 -0
- package/es/utils/{crypto.js → crypto.mjs} +40 -105
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/errors.mjs +689 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/{hd-wallet.js → hd-wallet.mjs} +33 -34
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/{json-big.js → json-big.mjs} +1 -1
- package/es/utils/{json-big.js.map → json-big.mjs.map} +1 -1
- package/es/utils/{keystore.js → keystore.mjs} +63 -51
- package/es/utils/keystore.mjs.map +1 -0
- package/es/utils/{mptree.js → mptree.mjs} +21 -12
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/{other.js → other.mjs} +2 -2
- package/es/utils/other.mjs.map +1 -0
- package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
- package/es/utils/{semver-satisfies.js.map → semver-satisfies.mjs.map} +1 -1
- package/es/utils/{string.js → string.mjs} +1 -1
- package/es/utils/{string.js.map → string.mjs.map} +1 -1
- package/es/utils/{swagger.js → swagger.mjs} +46 -14
- package/es/utils/swagger.mjs.map +1 -0
- package/package.json +46 -55
- package/src/account/memory.js +13 -8
- package/src/account/multiple.js +12 -4
- package/src/ae/aens.js +12 -17
- package/src/ae/aepp.js +2 -2
- package/src/ae/contract.js +15 -152
- package/src/ae/index.js +2 -1
- package/src/ae/oracle.js +25 -10
- package/src/ae/universal.js +2 -2
- package/src/ae/wallet.js +2 -2
- package/src/chain/index.js +21 -2
- package/src/chain/node.js +80 -53
- package/src/channel/handlers.js +20 -17
- package/src/channel/internal.js +30 -24
- package/src/contract/{aci/index.js → aci.js} +152 -93
- package/src/contract/compiler.js +22 -117
- package/src/contract/ga/helpers.js +7 -5
- package/src/contract/ga/index.js +27 -24
- package/src/index.js +7 -8
- package/src/node-pool/index.js +9 -8
- package/src/node.js +5 -7
- package/src/tx/builder/field-types.js +61 -0
- package/src/tx/builder/helpers.js +113 -58
- package/src/tx/builder/index.js +39 -34
- package/src/tx/builder/schema.js +11 -25
- package/src/tx/tx-object.js +10 -9
- package/src/tx/tx.js +17 -8
- package/src/tx/validator.js +25 -5
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +8 -3
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +10 -6
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +5 -4
- package/src/utils/aepp-wallet-communication/helpers.js +2 -12
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +81 -55
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +15 -6
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +60 -49
- package/src/utils/aepp-wallet-communication/schema.ts +80 -0
- package/src/utils/aepp-wallet-communication/wallet-detector.js +3 -2
- package/src/utils/amount-formatter.ts +4 -3
- package/src/utils/async-init.js +10 -6
- package/src/utils/bignumber.ts +1 -9
- package/src/utils/bytes.ts +3 -2
- package/src/utils/crypto-ts.ts +2 -2
- package/src/utils/crypto.js +9 -92
- package/src/utils/errors.ts +683 -0
- package/src/utils/hd-wallet.js +11 -26
- package/src/utils/keystore.js +47 -51
- package/src/utils/mptree.ts +12 -6
- package/src/utils/swagger.js +67 -44
- package/CHANGELOG.md +0 -1603
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -312
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js.map +0 -1
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -361
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -66
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -244
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -22
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -162
- package/es/contract/index.js.map +0 -1
- package/es/index.js +0 -57
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js.map +0 -1
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -107
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js.map +0 -1
- package/es/utils/swagger.js.map +0 -1
- package/src/contract/aci/transformation.js +0 -72
- package/src/contract/index.js +0 -163
- package/src/utils/aepp-wallet-communication/schema.js +0 -108
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/mptree.ts"],"names":["hash","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownPathNibbleError","UnknownNodeLengthError","NodeType","MPTree","nodeHash","node","from","rlpEncode","toString","constructor","binary","rootHash","nodes","Object","fromEntries","map","undefined","entries","forEach","key","type","payload","parseNode","Branch","slice","filter","n","length","Extension","isEqual","tree","path","nibble","parseInt","Leaf","includes","serialize","mptHash","value","get","searchFrom","substr"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,iBAAoC,KAApC;;;;SAESA,I;SAEPC,2B,EACAC,sB,EACAC,sB,EACAC,sB;IAGGC,Q;;WAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAQL,eAAe,MAAMC,MAAN,CAAa;AAIH,SAARC,QAAQ,CAAEC,IAAF,EAAuB;AAC5C,WAAO,QAAOC,IAAP,CAAYT,IAAI,CAACU,SAAS,CAACF,IAAD,CAAV,CAAhB,EAAmCG,QAAnC,CAA4C,KAA5C,CAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACEC,EAAAA,WAAW,CAAEC,MAAF,EAAwB;AACjC,SAAKC,QAAL,GAAgBD,MAAM,CAAC,CAAD,CAAN,CAAUF,QAAV,CAAmB,KAAnB,CAAhB;AACA,SAAKI,KAAL,GAAaC,MAAM,CAACC,WAAP,CACXJ,MAAM,CAAC,CAAD,CAAN,CAAUK,GAAV,CAAeV,IAAD,IAAU,CAACA,IAAI,CAAC,CAAD,CAAJ,CAAQG,QAAR,CAAiB,KAAjB,CAAD,EAA0BH,IAAI,CAAC,CAAD,CAA9B,CAAxB,CADW,CAAb;AAIA,QAAI,KAAKO,KAAL,CAAW,KAAKD,QAAhB,MAA8BK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A;;;AACEC,EAAAA,GAAG,CAAEpB,GAAF,EAAmC;AACpC,QAAIqB,UAAU,GAAG,KAAK7B,QAAtB;;AACA,WAAO,IAAP,EAAa;AACX,YAAM;AAAES,QAAAA,IAAF;AAAQC,QAAAA,OAAR;AAAiBU,QAAAA;AAAjB,UAA0B5B,MAAM,CAACmB,SAAP,CAAiB,KAAKV,KAAL,CAAW4B,UAAX,CAAjB,CAAhC;;AACA,cAAQpB,IAAR;AACE,aAAKlB,QAAQ,CAACqB,MAAd;AACE,cAAIJ,GAAG,CAACQ,MAAJ,KAAe,CAAnB,EAAsB,OAAON,OAAO,CAAC,EAAD,CAAd;AACtBmB,UAAAA,UAAU,GAAGnB,OAAO,CAACY,QAAQ,CAACd,GAAG,CAAC,CAAD,CAAJ,EAAS,EAAT,CAAT,CAAP,CAA8BX,QAA9B,CAAuC,KAAvC,CAAb;AACAW,UAAAA,GAAG,GAAGA,GAAG,CAACsB,MAAJ,CAAW,CAAX,CAAN;AACA;;AACF,aAAKvC,QAAQ,CAAC0B,SAAd;AACE,cAAIT,GAAG,CAACsB,MAAJ,CAAW,CAAX,EAAcV,IAAd,aAAcA,IAAd,uBAAcA,IAAI,CAAEJ,MAApB,MAAgCI,IAApC,EAA0C,OAAOf,SAAP;AAC1CwB,UAAAA,UAAU,GAAGnB,OAAO,CAAC,CAAD,CAAP,CAAWb,QAAX,CAAoB,KAApB,CAAb;AACAW,UAAAA,GAAG,GAAGA,GAAG,CAACsB,MAAJ,CAAWV,IAAI,CAACJ,MAAhB,CAAN;AACA;;AACF,aAAKzB,QAAQ,CAACgC,IAAd;AACE,cAAIH,IAAI,KAAKZ,GAAb,EAAkB,OAAOH,SAAP;AAClB,iBAAOK,OAAO,CAAC,CAAD,CAAd;AAbJ;AAeD;AACF;;AAzGyB","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport { encode as rlpEncode } from 'rlp'\nimport type { Input } from 'rlp'\nimport { hash } from './crypto-ts'\nimport {\n MerkleTreeHashMismatchError,\n MissingNodeInTreeError,\n UnknownPathNibbleError,\n UnknownNodeLengthError\n} from './errors'\n\nenum NodeType {\n Branch,\n Extension,\n Leaf\n}\n\nexport type MPTreeBinary = [Buffer, Array<[Buffer, Buffer[]]>]\n\nexport default class MPTree {\n private readonly rootHash: string\n private readonly nodes: { [key: string]: Buffer[] }\n\n private static nodeHash (node: Input): string {\n return Buffer.from(hash(rlpEncode(node))).toString('hex')\n }\n\n /**\n * Deserialize Merkle Patricia Tree\n * @rtype (binary: Array) => MPTree\n * @param {Array} binary - Binary\n * @return {MPTree} Merkle Patricia Tree\n */\n constructor (binary: MPTreeBinary) {\n this.rootHash = binary[0].toString('hex')\n this.nodes = Object.fromEntries(\n binary[1].map((node) => [node[0].toString('hex'), node[1]])\n )\n\n if (this.nodes[this.rootHash] === undefined) throw new MissingNodeInTreeError('Can\\'t find a node by root hash')\n Object.entries(this.nodes).forEach(([key, node]) => {\n if (MPTree.nodeHash(node) !== key) throw new MerkleTreeHashMismatchError()\n const { type, payload } = MPTree.parseNode(node)\n switch (type) {\n case NodeType.Branch:\n payload\n .slice(0, 16)\n .filter(n => n.length)\n .forEach((n) => {\n if (this.nodes[n.toString('hex')] === undefined) {\n throw new MissingNodeInTreeError('Can\\'t find a node by hash in branch node')\n }\n })\n break\n case NodeType.Extension:\n if (this.nodes[payload[0].toString('hex')] === undefined) {\n throw new MissingNodeInTreeError('Can\\'t find a node by hash in extension node')\n }\n }\n })\n }\n\n isEqual (tree: MPTree): boolean {\n return this.rootHash === tree.rootHash\n }\n\n private static parseNode (node: Buffer[]): { type: NodeType, payload: Buffer[], path: string | null } {\n switch (node.length) {\n case 17:\n return { type: NodeType.Branch, payload: node, path: null }\n case 2: {\n const path = node[0].toString('hex')\n const nibble = parseInt(path[0], 16)\n if (nibble > 3) throw new UnknownPathNibbleError(nibble)\n const type = nibble <= 1 ? NodeType.Extension : NodeType.Leaf\n const slice = [0, 2].includes(nibble) ? 2 : 1\n return { type, payload: [node[1]], path: path.slice(slice) }\n }\n default:\n throw new UnknownNodeLengthError(node.length)\n }\n }\n\n /**\n * Serialize Merkle Patricia Tree\n * @rtype () => Array\n * @return {Array} Binary\n */\n serialize (): MPTreeBinary {\n return [\n Buffer.from(this.rootHash, 'hex'),\n Object.entries(this.nodes).map(([mptHash, value]) => ([\n Buffer.from(mptHash, 'hex'),\n value\n ]))\n ]\n }\n\n /**\n * Retrieve value from Merkle Patricia Tree\n * @rtype (key: String) => Buffer\n * @param {String} key - The key of the element to retrieve\n * @return {Buffer} Value associated to the specified key\n */\n get (key: string): Buffer | undefined {\n let searchFrom = this.rootHash\n while (true) {\n const { type, payload, path } = MPTree.parseNode(this.nodes[searchFrom])\n switch (type) {\n case NodeType.Branch:\n if (key.length === 0) return payload[16]\n searchFrom = payload[parseInt(key[0], 16)].toString('hex')\n key = key.substr(1)\n break\n case NodeType.Extension:\n if (key.substr(0, path?.length) !== path) return undefined\n searchFrom = payload[0].toString('hex')\n key = key.substr(path.length)\n break\n case NodeType.Leaf:\n if (path !== key) return undefined\n return payload[0]\n }\n }\n }\n}\n"],"file":"mptree.mjs"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { snakeToPascal, pascalToSnake } from
|
|
1
|
+
import { snakeToPascal, pascalToSnake } from "./string.mjs";
|
|
2
2
|
export const pause = async duration => await new Promise(resolve => setTimeout(resolve, duration));
|
|
3
3
|
export const mapObject = (object, fn) => Object.fromEntries(Object.entries(object).map(fn));
|
|
4
4
|
export const filterObject = (object, fn) => Object.fromEntries(Object.entries(object).filter(fn));
|
|
@@ -40,4 +40,4 @@ export const snakizeKeys = traverseKeys.bind(null, pascalToSnake);
|
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
export const pascalizeKeys = traverseKeys.bind(null, snakeToPascal);
|
|
43
|
-
//# sourceMappingURL=other.
|
|
43
|
+
//# sourceMappingURL=other.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/other.ts"],"names":["snakeToPascal","pascalToSnake","pause","duration","Promise","resolve","setTimeout","mapObject","object","fn","Object","fromEntries","entries","map","filterObject","filter","traverseKeys","Array","isArray","i","key","value","snakizeKeys","bind","pascalizeKeys"],"mappings":"SAASA,a,EAAeC,a;AAExB,OAAO,MAAMC,KAAK,GAAG,MAAOC,QAAP,IACnB,MAAM,IAAIC,OAAJ,CAAYC,OAAO,IAAIC,UAAU,CAACD,OAAD,EAAUF,QAAV,CAAjC,CADD;AAGP,OAAO,MAAMI,SAAS,GAAG,CACvBC,MADuB,EAEvBC,EAFuB,KAGZC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBK,GAAvB,CAA2BJ,EAA3B,CAAnB,CAHN;AAKP,OAAO,MAAMK,YAAY,GAAG,CAC1BN,MAD0B,EAE1BC,EAF0B,KAGfC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBO,MAAvB,CAA8BN,EAA9B,CAAnB,CAHN;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMO,YAAY,GAAG,CAACP,EAAD,EAAeD,MAAf,KAAoC;AAC9D,MAAI,OAAOA,MAAP,KAAkB,QAAlB,IAA8BA,MAAM,KAAK,IAA7C,EAAmD,OAAOA,MAAP;AACnD,MAAIS,KAAK,CAACC,OAAN,CAAcV,MAAd,CAAJ,EAA2B,OAAOA,MAAM,CAACK,GAAP,CAAWM,CAAC,IAAIH,YAAY,CAACP,EAAD,EAAKU,CAAL,CAA5B,CAAP;AAC3B,SAAOZ,SAAS,CAACC,MAAD,EAAS;AAAA,QAAC,CAACY,GAAD,EAAMC,KAAN,CAAD;AAAA,WAAiC,CACxDZ,EAAE,CAACW,GAAD,CADsD,EAC/CJ,YAAY,CAACP,EAAD,EAAKY,KAAL,CADmC,CAAjC;AAAA,GAAT,CAAhB;AAGD,CANM;AAQP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAGN,YAAY,CAACO,IAAb,CAAkB,IAAlB,EAAwBtB,aAAxB,CAApB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMuB,aAAa,GAAGR,YAAY,CAACO,IAAb,CAAkB,IAAlB,EAAwBvB,aAAxB,CAAtB","sourcesContent":["import { snakeToPascal, pascalToSnake } from './string'\n\nexport const pause = async (duration: number): Promise<void> =>\n await new Promise(resolve => setTimeout(resolve, duration))\n\nexport const mapObject = (\n object: object,\n fn: (value: [string, any], index: number, array: Array<[string, any]>) => Array<[string, any]>\n): object => Object.fromEntries(Object.entries(object).map(fn))\n\nexport const filterObject = (\n object: object,\n fn: (value: [string, any], index: number, array: Array<[string, any]>) => boolean\n): object => Object.fromEntries(Object.entries(object).filter(fn))\n\n/**\n * Key traversal metafunction\n * @static\n * @function\n * @rtype (fn: (s: String) => String) => (o: Object) => Object\n * @param {Function} fn - Key transformation function\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n */\nexport const traverseKeys = (fn: Function, object: any): any => {\n if (typeof object !== 'object' || object === null) return object\n if (Array.isArray(object)) return object.map(i => traverseKeys(fn, i))\n return mapObject(object, ([key, value]: [string, any]) => [\n fn(key), traverseKeys(fn, value)\n ])\n}\n\n/**\n * snake_case key traversal\n * @static\n * @rtype (o: Object) => Object\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n * @see pascalToSnake\n */\nexport const snakizeKeys = traverseKeys.bind(null, pascalToSnake)\n\n/**\n * PascalCase key traversal\n * @static\n * @rtype (o: Object) => Object\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n * @see snakeToPascal\n */\nexport const pascalizeKeys = traverseKeys.bind(null, snakeToPascal)\n"],"file":"other.mjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/semver-satisfies.ts"],"names":["version","geVersion","ltVersion","getComponents","v","split","map","i","versionComponents","geComponents","ltComponents","base","Math","max","componentsToNumber","components","reverse","reduce","acc","n","idx","pow","vNumber","geNumber","ltNumber"],"mappings":"AAAA,eAAe,UAAUA,OAAV,EAA2BC,SAA3B,EAA8CC,SAA9C,EAA0E;AACvF,QAAMC,aAAa,GAAIC,CAAD,IAAyBA,CAAC,CAC7CC,KAD4C,CACtC,MADsC,EAC9B,CAD8B,EAC3BA,KAD2B,CACrB,GADqB,EAChBC,GADgB,CACZC,CAAC,IAAI,CAACA,CADM,CAA/C;;AAGA,QAAMC,iBAAiB,GAAGL,aAAa,CAACH,OAAD,CAAvC;AACA,QAAMS,YAAY,GAAGN,aAAa,CAACF,SAAD,CAAlC;AACA,QAAMS,YAAY,GAAGP,aAAa,CAACD,SAAD,CAAlC;AAEA,QAAMS,IAAI,GAAGC,IAAI,CAACC,GAAL,CAAS,GAAGL,iBAAZ,EAA+B,GAAGC,YAAlC,EAAgD,GAAGC,YAAnD,IAAmE,CAAhF;;AACA,QAAMI,kBAAkB,GAAIC,UAAD,IAAkCA,UAAU,CAACC,OAAX,GAC1DC,MAD0D,CACnD,CAACC,GAAD,EAAMC,CAAN,EAASC,GAAT,KAAiBF,GAAG,GAAGC,CAAC,GAAGP,IAAI,CAACS,GAAL,CAASV,IAAT,EAAeS,GAAf,CADwB,EACH,CADG,CAA7D;;AAGA,QAAME,OAAO,GAAGR,kBAAkB,CAACN,iBAAD,CAAlC;AACA,QAAMe,QAAQ,GAAGT,kBAAkB,CAACL,YAAD,CAAnC;AACA,QAAMe,QAAQ,GAAGV,kBAAkB,CAACJ,YAAD,CAAnC;AACA,SAAOY,OAAO,IAAIC,QAAX,IAAuBD,OAAO,GAAGE,QAAxC;AACD","sourcesContent":["export default function (version: string, geVersion: string, ltVersion: string): boolean {\n const getComponents = (v: string): number[] => v\n .split(/[-+]/)[0].split('.').map(i => +i)\n\n const versionComponents = getComponents(version)\n const geComponents = getComponents(geVersion)\n const ltComponents = getComponents(ltVersion)\n\n const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1\n const componentsToNumber = (components: number[]): number => components.reverse()\n .reduce((acc, n, idx) => acc + n * Math.pow(base, idx), 0)\n\n const vNumber = componentsToNumber(versionComponents)\n const geNumber = componentsToNumber(geComponents)\n const ltNumber = componentsToNumber(ltComponents)\n return vNumber >= geNumber && vNumber < ltNumber\n}\n"],"file":"semver-satisfies.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/semver-satisfies.ts"],"names":["version","geVersion","ltVersion","getComponents","v","split","map","i","versionComponents","geComponents","ltComponents","base","Math","max","componentsToNumber","components","reverse","reduce","acc","n","idx","pow","vNumber","geNumber","ltNumber"],"mappings":"AAAA,eAAe,UAAUA,OAAV,EAA2BC,SAA3B,EAA8CC,SAA9C,EAA0E;AACvF,QAAMC,aAAa,GAAIC,CAAD,IAAyBA,CAAC,CAC7CC,KAD4C,CACtC,MADsC,EAC9B,CAD8B,EAC3BA,KAD2B,CACrB,GADqB,EAChBC,GADgB,CACZC,CAAC,IAAI,CAACA,CADM,CAA/C;;AAGA,QAAMC,iBAAiB,GAAGL,aAAa,CAACH,OAAD,CAAvC;AACA,QAAMS,YAAY,GAAGN,aAAa,CAACF,SAAD,CAAlC;AACA,QAAMS,YAAY,GAAGP,aAAa,CAACD,SAAD,CAAlC;AAEA,QAAMS,IAAI,GAAGC,IAAI,CAACC,GAAL,CAAS,GAAGL,iBAAZ,EAA+B,GAAGC,YAAlC,EAAgD,GAAGC,YAAnD,IAAmE,CAAhF;;AACA,QAAMI,kBAAkB,GAAIC,UAAD,IAAkCA,UAAU,CAACC,OAAX,GAC1DC,MAD0D,CACnD,CAACC,GAAD,EAAMC,CAAN,EAASC,GAAT,KAAiBF,GAAG,GAAGC,CAAC,GAAGP,IAAI,CAACS,GAAL,CAASV,IAAT,EAAeS,GAAf,CADwB,EACH,CADG,CAA7D;;AAGA,QAAME,OAAO,GAAGR,kBAAkB,CAACN,iBAAD,CAAlC;AACA,QAAMe,QAAQ,GAAGT,kBAAkB,CAACL,YAAD,CAAnC;AACA,QAAMe,QAAQ,GAAGV,kBAAkB,CAACJ,YAAD,CAAnC;AACA,SAAOY,OAAO,IAAIC,QAAX,IAAuBD,OAAO,GAAGE,QAAxC;AACD","sourcesContent":["export default function (version: string, geVersion: string, ltVersion: string): boolean {\n const getComponents = (v: string): number[] => v\n .split(/[-+]/)[0].split('.').map(i => +i)\n\n const versionComponents = getComponents(version)\n const geComponents = getComponents(geVersion)\n const ltComponents = getComponents(ltVersion)\n\n const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1\n const componentsToNumber = (components: number[]): number => components.reverse()\n .reduce((acc, n, idx) => acc + n * Math.pow(base, idx), 0)\n\n const vNumber = componentsToNumber(versionComponents)\n const geNumber = componentsToNumber(geComponents)\n const ltNumber = componentsToNumber(ltComponents)\n return vNumber >= geNumber && vNumber < ltNumber\n}\n"],"file":"semver-satisfies.mjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/string.ts"],"names":["snakeToPascal","s","replace","match","toUpperCase","pascalToSnake","toLowerCase","isHex","str","length","test","isBase64","index","indexOf","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,KAAV,EAAiBC,KAAK,IAAIA,KAAK,CAAC,CAAD,CAAL,CAASC,WAAT,EAA1B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBJ,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,QAAV,EAAoBC,KAAK,IAAK,IAAGA,KAAK,CAACG,WAAN,EAAoB,EAArD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,GAAhB,EAAsC;AAC3C,SAAOA,GAAG,CAACC,MAAJ,GAAa,CAAb,KAAmB,CAAnB,IAAwB,eAAeC,IAAf,CAAoBF,GAApB,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,QAAT,CAAmBH,GAAnB,EAAyC;AAC9C,MAAIA,GAAG,CAACC,MAAJ,GAAa,CAAb,GAAiB,CAAjB,IAAsB,gBAAgBC,IAAhB,CAAqBF,GAArB,CAA1B,EAAqD,OAAO,KAAP;AACrD,QAAMI,KAAK,GAAGJ,GAAG,CAACK,OAAJ,CAAY,GAAZ,CAAd;AACA,SAAOD,KAAK,KAAK,CAAC,CAAX,IAAgB,SAASF,IAAT,CAAcF,GAAG,CAACM,KAAJ,CAAUF,KAAV,CAAd,CAAvB;AACD","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Convert string from snake_case to PascalCase\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function snakeToPascal (s: string): string {\n return s.replace(/_./g, match => match[1].toUpperCase())\n}\n\n/**\n * Convert string from PascalCase to snake_case\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function pascalToSnake (s: string): string {\n return s.replace(/[A-Z]/g, match => `_${match.toLowerCase()}`)\n}\n\n/**\n * Check whether a string is valid hex.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid hex, false otherwise.\n */\nexport function isHex (str: string): boolean {\n return str.length % 2 === 0 && /^[0-9a-f]+$/i.test(str)\n}\n\n/**\n * Check whether a string is valid base-64.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid base-64, false otherwise.\n */\nexport function isBase64 (str: string): boolean {\n if (str.length % 4 > 0 || /[^0-9a-z+/=]/i.test(str)) return false\n const index = str.indexOf('=')\n return index === -1 || /={1,2}/.test(str.slice(index))\n}\n"],"file":"string.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/string.ts"],"names":["snakeToPascal","s","replace","match","toUpperCase","pascalToSnake","toLowerCase","isHex","str","length","test","isBase64","index","indexOf","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,KAAV,EAAiBC,KAAK,IAAIA,KAAK,CAAC,CAAD,CAAL,CAASC,WAAT,EAA1B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBJ,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,QAAV,EAAoBC,KAAK,IAAK,IAAGA,KAAK,CAACG,WAAN,EAAoB,EAArD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,GAAhB,EAAsC;AAC3C,SAAOA,GAAG,CAACC,MAAJ,GAAa,CAAb,KAAmB,CAAnB,IAAwB,eAAeC,IAAf,CAAoBF,GAApB,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,QAAT,CAAmBH,GAAnB,EAAyC;AAC9C,MAAIA,GAAG,CAACC,MAAJ,GAAa,CAAb,GAAiB,CAAjB,IAAsB,gBAAgBC,IAAhB,CAAqBF,GAArB,CAA1B,EAAqD,OAAO,KAAP;AACrD,QAAMI,KAAK,GAAGJ,GAAG,CAACK,OAAJ,CAAY,GAAZ,CAAd;AACA,SAAOD,KAAK,KAAK,CAAC,CAAX,IAAgB,SAASF,IAAT,CAAcF,GAAG,CAACM,KAAJ,CAAUF,KAAV,CAAd,CAAvB;AACD","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Convert string from snake_case to PascalCase\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function snakeToPascal (s: string): string {\n return s.replace(/_./g, match => match[1].toUpperCase())\n}\n\n/**\n * Convert string from PascalCase to snake_case\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function pascalToSnake (s: string): string {\n return s.replace(/[A-Z]/g, match => `_${match.toLowerCase()}`)\n}\n\n/**\n * Check whether a string is valid hex.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid hex, false otherwise.\n */\nexport function isHex (str: string): boolean {\n return str.length % 2 === 0 && /^[0-9a-f]+$/i.test(str)\n}\n\n/**\n * Check whether a string is valid base-64.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid base-64, false otherwise.\n */\nexport function isBase64 (str: string): boolean {\n if (str.length % 4 > 0 || /[^0-9a-z+/=]/i.test(str)) return false\n const index = str.indexOf('=')\n return index === -1 || /={1,2}/.test(str.slice(index))\n}\n"],"file":"string.mjs"}
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import SwaggerClient from 'swagger-client';
|
|
24
24
|
import fetch from 'cross-fetch';
|
|
25
|
-
import JsonBig from
|
|
26
|
-
import { snakizeKeys, pascalizeKeys, mapObject, filterObject } from
|
|
25
|
+
import JsonBig from "./json-big.mjs";
|
|
26
|
+
import { snakizeKeys, pascalizeKeys, mapObject, filterObject } from "./other.mjs";
|
|
27
|
+
import { ArgumentCountMismatchError } from "./errors.mjs";
|
|
28
|
+
import { snakeToPascal } from "./string.mjs";
|
|
27
29
|
let warnedAboutInternalApiUsage = false;
|
|
28
30
|
/**
|
|
29
31
|
* Generator of Swagger client
|
|
@@ -51,16 +53,31 @@ export default (async function (specUrl) {
|
|
|
51
53
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
54
|
spec = spec || (await (await fetch(specUrl)).json());
|
|
53
55
|
const jsonImp = disableBigNumbers ? JSON : JsonBig;
|
|
54
|
-
|
|
55
|
-
if (['https://compiler.aepps.com', 'https://latest.compiler.aepps.com'].includes(new URL(specUrl).origin) || new URL(specUrl).origin.includes('https://')) {
|
|
56
|
-
spec.schemes = ['https'];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
56
|
const [external, internal] = await Promise.all([specUrl, internalUrl].map(url => {
|
|
60
57
|
if (!url) return null;
|
|
58
|
+
const pendingGetRequests = {};
|
|
61
59
|
return SwaggerClient({
|
|
62
60
|
url,
|
|
63
61
|
spec,
|
|
62
|
+
requestInterceptor: request => {
|
|
63
|
+
if (request.method !== 'GET') return;
|
|
64
|
+
return { ...request,
|
|
65
|
+
userFetch: async (url, request) => {
|
|
66
|
+
var _pendingGetRequests$k;
|
|
67
|
+
|
|
68
|
+
const key = JSON.stringify({ ...request,
|
|
69
|
+
url
|
|
70
|
+
});
|
|
71
|
+
(_pendingGetRequests$k = pendingGetRequests[key]) !== null && _pendingGetRequests$k !== void 0 ? _pendingGetRequests$k : pendingGetRequests[key] = fetch(url, request);
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
return (await pendingGetRequests[key]).clone();
|
|
75
|
+
} finally {
|
|
76
|
+
delete pendingGetRequests[key];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
},
|
|
64
81
|
responseInterceptor: response => {
|
|
65
82
|
var _response$text;
|
|
66
83
|
|
|
@@ -73,7 +90,7 @@ export default (async function (specUrl) {
|
|
|
73
90
|
}
|
|
74
91
|
});
|
|
75
92
|
}));
|
|
76
|
-
const combinedApi = [
|
|
93
|
+
const combinedApi = Object.assign({}, ...(external.apis.external ? [external.apis.external] : Object.values(external.apis)), mapObject((internal === null || internal === void 0 ? void 0 : internal.apis.internal) || {}, _ref => {
|
|
77
94
|
let [key, handler] = _ref;
|
|
78
95
|
return [key, function () {
|
|
79
96
|
if (!warnedAboutInternalApiUsage) {
|
|
@@ -83,15 +100,17 @@ export default (async function (specUrl) {
|
|
|
83
100
|
|
|
84
101
|
return handler(...arguments);
|
|
85
102
|
}];
|
|
86
|
-
})].reduce((acc, n) => ({ ...acc,
|
|
87
|
-
...n
|
|
88
103
|
}));
|
|
89
104
|
const opSpecs = Object.values(spec.paths).map(paths => Object.values(paths)).flat().reduce((acc, n) => ({ ...acc,
|
|
90
105
|
[n.operationId]: n
|
|
91
106
|
}), {});
|
|
107
|
+
const requestQueues = {};
|
|
92
108
|
const api = mapObject(combinedApi, _ref2 => {
|
|
93
109
|
let [opId, handler] = _ref2;
|
|
94
|
-
|
|
110
|
+
const functionName = opId.slice(0, 1).toLowerCase() + snakeToPascal(opId.slice(1));
|
|
111
|
+
return [functionName, async function () {
|
|
112
|
+
var _requestQueues$__queu;
|
|
113
|
+
|
|
95
114
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
96
115
|
args[_key] = arguments[_key];
|
|
97
116
|
}
|
|
@@ -103,12 +122,17 @@ export default (async function (specUrl) {
|
|
|
103
122
|
name: '__requestBody'
|
|
104
123
|
}] : [])];
|
|
105
124
|
const required = parameters.filter(param => param.required).map(p => p.name);
|
|
106
|
-
|
|
125
|
+
|
|
126
|
+
if (![0, 1].includes(args.length - required.length)) {
|
|
127
|
+
throw new ArgumentCountMismatchError(functionName, required.length, args.length);
|
|
128
|
+
}
|
|
129
|
+
|
|
107
130
|
const values = required.reduce((acc, req, idx) => ({ ...acc,
|
|
108
131
|
[req]: args[idx]
|
|
109
132
|
}), args[required.length] || {});
|
|
110
133
|
const {
|
|
111
134
|
__requestBody,
|
|
135
|
+
__queue,
|
|
112
136
|
...stringified
|
|
113
137
|
} = mapObject(values, _ref3 => {
|
|
114
138
|
let [param, value] = _ref3;
|
|
@@ -120,13 +144,21 @@ export default (async function (specUrl) {
|
|
|
120
144
|
});
|
|
121
145
|
return [param, jsonImp.stringify(filteredValue)];
|
|
122
146
|
});
|
|
123
|
-
|
|
147
|
+
|
|
148
|
+
const request = async () => (await handler(stringified, {
|
|
124
149
|
requestBody: __requestBody
|
|
125
150
|
})).body;
|
|
151
|
+
|
|
152
|
+
if (!__queue) return request();
|
|
153
|
+
const res = ((_requestQueues$__queu = requestQueues[__queue]) !== null && _requestQueues$__queu !== void 0 ? _requestQueues$__queu : Promise.resolve()).then(request, request); // TODO: remove after fixing https://github.com/aeternity/aeternity/issues/3803
|
|
154
|
+
// gap to ensure that node won't reject the nonce
|
|
155
|
+
|
|
156
|
+
requestQueues[__queue] = res.then(() => new Promise(resolve => setTimeout(resolve, 750)));
|
|
157
|
+
return res;
|
|
126
158
|
}];
|
|
127
159
|
});
|
|
128
160
|
return Object.assign(external, {
|
|
129
161
|
api
|
|
130
162
|
});
|
|
131
163
|
});
|
|
132
|
-
//# sourceMappingURL=swagger.
|
|
164
|
+
//# sourceMappingURL=swagger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/swagger.js"],"names":["SwaggerClient","fetch","JsonBig","snakizeKeys","pascalizeKeys","mapObject","filterObject","ArgumentCountMismatchError","snakeToPascal","warnedAboutInternalApiUsage","specUrl","spec","internalUrl","disableBigNumbers","disableCaseConversion","responseInterceptor","json","jsonImp","JSON","external","internal","Promise","all","map","url","pendingGetRequests","requestInterceptor","request","method","userFetch","key","stringify","clone","response","text","size","body","parse","Object","assign","combinedApi","apis","values","handler","console","warn","opSpecs","paths","flat","reduce","acc","n","operationId","requestQueues","api","opId","functionName","slice","toLowerCase","args","opSpec","parameters","requestBody","required","schema","content","name","filter","param","p","includes","length","req","idx","__requestBody","__queue","stringified","value","rootKeys","keys","find","properties","filteredValue","res","resolve","then","setTimeout"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAEA,OAAOA,aAAP,MAA0B,gBAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;OACOC,O;SACEC,W,EAAaC,a,EAAeC,S,EAAWC,Y;SACvCC,0B;SACAC,a;AAET,IAAIC,2BAA2B,GAAG,KAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,gBAAe,gBACbC,OADa,EAGV;AAAA,MADH;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,WAAR;AAAqBC,IAAAA,iBAArB;AAAwCC,IAAAA,qBAAxC;AAA+DC,IAAAA;AAA/D,GACG,uEADoF,EACpF;AACHJ,EAAAA,IAAI,GAAGA,IAAI,KAAI,MAAM,CAAC,MAAMV,KAAK,CAACS,OAAD,CAAZ,EAAuBM,IAAvB,EAAV,CAAX;AACA,QAAMC,OAAO,GAAGJ,iBAAiB,GAAGK,IAAH,GAAUhB,OAA3C;AAEA,QAAM,CAACiB,QAAD,EAAWC,QAAX,IAAuB,MAAMC,OAAO,CAACC,GAAR,CAAY,CAACZ,OAAD,EAAUE,WAAV,EAAuBW,GAAvB,CAA4BC,GAAD,IAAS;AACjF,QAAI,CAACA,GAAL,EAAU,OAAO,IAAP;AACV,UAAMC,kBAAkB,GAAG,EAA3B;AACA,WAAOzB,aAAa,CAAC;AACnBwB,MAAAA,GADmB;AAEnBb,MAAAA,IAFmB;AAGnBe,MAAAA,kBAAkB,EAAEC,OAAO,IAAI;AAC7B,YAAIA,OAAO,CAACC,MAAR,KAAmB,KAAvB,EAA8B;AAC9B,eAAO,EACL,GAAGD,OADE;AAELE,UAAAA,SAAS,EAAE,OAAOL,GAAP,EAAYG,OAAZ,KAAwB;AAAA;;AACjC,kB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AAWE,KAAhC,EAAuCJ,MAAvC,CAA8CiB,UAA1D,CAAjB;AACA,cAAMC,aAAa,GAAG5E,YAAY,CAChCQ,qBAAqB,GAAG+D,KAAH,GAAW1E,WAAW,CAAC0E,KAAD,CADX,EAEhC;AAAA,cAAC,CAAC/C,GAAD,CAAD;AAAA,iBAAWgD,QAAQ,CAACR,QAAT,CAAkBxC,GAAlB,CAAX;AAAA,SAFgC,CAAlC;AAIA,eAAO,CAACsC,KAAD,EAAQnD,OAAO,CAACc,SAAR,CAAkBmD,aAAlB,CAAR,CAAP;AACD,OAR2D,CAA5D;;AAUA,YAAMvD,OAAO,GAAG,YAAY,CAAC,MAAMgB,OAAO,CAACiC,WAAD,EAAc;AAAEd,QAAAA,WAAW,EAAEY;AAAf,OAAd,CAAd,EACzBtC,IADH;;AAEA,UAAI,CAACuC,OAAL,EAAc,OAAOhD,OAAO,EAAd;AACd,YAAMwD,GAAG,GAAG,0BAAC9B,aAAa,CAACsB,OAAD,CAAd,yEAA2BtD,OAAO,CAAC+D,OAAR,EAA3B,EAA8CC,IAA9C,CAAmD1D,OAAnD,EAA4DA,OAA5D,CAAZ,CAjCiB,CAkCjB;AACA;;AACA0B,MAAAA,aAAa,CAACsB,OAAD,CAAb,GAAyBQ,GAAG,CAACE,IAAJ,CAAS,MAAM,IAAIhE,OAAJ,CAAY+D,OAAO,IAAIE,UAAU,CAACF,OAAD,EAAU,GAAV,CAAjC,CAAf,CAAzB;AACA,aAAOD,GAAP;AACD,KAxCI,CAAP;AA0CD,GA5CoB,CAArB;AA8CA,SAAO7C,MAAM,CAACC,MAAP,CAAcpB,QAAd,EAAwB;AAAEmC,IAAAA;AAAF,GAAxB,CAAP;AACD,CA5GD","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generator of Swagger client module\n * @module @aeternity/aepp-sdk/es/utils/swagger\n * @export genSwaggerClient\n */\n\nimport SwaggerClient from 'swagger-client'\nimport fetch from 'cross-fetch'\nimport JsonBig from './json-big'\nimport { snakizeKeys, pascalizeKeys, mapObject, filterObject } from './other'\nimport { ArgumentCountMismatchError } from './errors'\nimport { snakeToPascal } from './string'\n\nlet warnedAboutInternalApiUsage = false\n\n/**\n * Generator of Swagger client\n * @function\n * @alias module:@aeternity/aepp-sdk/es/utils/swagger\n * @rtype Object\n * @param {String} specUrl - Swagger specification URL on external node host\n * @param {Object} options\n * @param {String} [options.spec] - Override OpenAPI definition\n * @param {String} [options.internalUrl] - Node internal URL\n * @param {Boolean} [options.disableBigNumbers]\n * @param {Boolean} [options.disableCaseConversion]\n * @param {Function} [options.responseInterceptor]\n * @return {Object} Swagger client\n * @example (await genSwaggerClient('https://mainnet.aeternity.io/api')).getAccountByPubkey('ak_jupBUgZNbcC4krDLR3tAkw1iBZoBbkNeShAq4atBtpFWmz36r')\n */\nexport default async (\n specUrl,\n { spec, internalUrl, disableBigNumbers, disableCaseConversion, responseInterceptor } = {}\n) => {\n spec = spec || await (await fetch(specUrl)).json()\n const jsonImp = disableBigNumbers ? JSON : JsonBig\n\n const [external, internal] = await Promise.all([specUrl, internalUrl].map((url) => {\n if (!url) return null\n const pendingGetRequests = {}\n return SwaggerClient({\n url,\n spec,\n requestInterceptor: request => {\n if (request.method !== 'GET') return\n return {\n ...request,\n userFetch: async (url, request) => {\n const key = JSON.stringify({ ...request, url })\n pendingGetRequests[key] ??= fetch(url, request)\n try {\n return (await pendingGetRequests[key]).clone()\n } finally {\n delete pendingGetRequests[key]\n }\n }\n }\n },\n responseInterceptor: response => {\n if (response.text === '' || response.text?.size === 0) return response\n const body = jsonImp.parse(response.text)\n Object.assign(response, {\n body: disableCaseConversion ? body : pascalizeKeys(body)\n })\n return (responseInterceptor && responseInterceptor(response)) || response\n }\n })\n }))\n\n const combinedApi = Object.assign(\n {},\n ...external.apis.external ? [external.apis.external] : Object.values(external.apis),\n mapObject(internal?.apis.internal || {}, ([key, handler]) => [key, (...args) => {\n if (!warnedAboutInternalApiUsage) {\n console.warn(\n 'SDK\\'s wrapper of aeternity node internal API is deprecated, please use external ' +\n 'equivalent (for example, \"sdk.api.protectedDryRunTxs\" instead of \"sdk.api.dryRunTxs\") ' +\n 'or create a wrapper of internal API by yourself (using \"genSwaggerClient\")'\n )\n warnedAboutInternalApiUsage = true\n }\n return handler(...args)\n }])\n )\n\n const opSpecs = Object.values(spec.paths)\n .map(paths => Object.values(paths))\n .flat()\n .reduce((acc, n) => ({ ...acc, [n.operationId]: n }), {})\n\n const requestQueues = {}\n const api = mapObject(combinedApi, ([opId, handler]) => {\n const functionName = opId.slice(0, 1).toLowerCase() + snakeToPascal(opId.slice(1))\n return [\n functionName,\n async (...args) => {\n const opSpec = opSpecs[opId]\n const parameters = [\n ...opSpec.parameters,\n ...opSpec.requestBody\n ? [{\n required: opSpec.requestBody.required,\n schema: Object.values(opSpec.requestBody.content)[0].schema,\n name: '__requestBody'\n }]\n : []\n ]\n const required = parameters.filter(param => param.required).map(p => p.name)\n if (![0, 1].includes(args.length - required.length)) {\n throw new ArgumentCountMismatchError(functionName, required.length, args.length)\n }\n const values = required.reduce(\n (acc, req, idx) => ({ ...acc, [req]: args[idx] }),\n args[required.length] || {}\n )\n const { __requestBody, __queue, ...stringified } = mapObject(values, ([param, value]) => {\n if (typeof value !== 'object') return [param, value]\n const rootKeys = Object.keys(parameters.find(p => p.name === param).schema.properties)\n const filteredValue = filterObject(\n disableCaseConversion ? value : snakizeKeys(value),\n ([key]) => rootKeys.includes(key)\n )\n return [param, jsonImp.stringify(filteredValue)]\n })\n\n const request = async () => (await handler(stringified, { requestBody: __requestBody }))\n .body\n if (!__queue) return request()\n const res = (requestQueues[__queue] ?? Promise.resolve()).then(request, request)\n // TODO: remove after fixing https://github.com/aeternity/aeternity/issues/3803\n // gap to ensure that node won't reject the nonce\n requestQueues[__queue] = res.then(() => new Promise(resolve => setTimeout(resolve, 750)))\n return res\n }\n ]\n })\n\n return Object.assign(external, { api })\n}\n"],"file":"swagger.mjs"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeternity/aepp-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "SDK for the æternity blockchain",
|
|
5
5
|
"main": "dist/aepp-sdk.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
7
|
-
"module": "es/index.
|
|
7
|
+
"module": "es/index.mjs",
|
|
8
8
|
"browser": {
|
|
9
9
|
"dist/aepp-sdk.js": "./dist/aepp-sdk.browser.js"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions
|
|
13
|
+
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
|
|
14
14
|
"build": "webpack --mode=production && npm run build:es",
|
|
15
15
|
"build:dev": "webpack --mode=development && npm run build:es",
|
|
16
16
|
"docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.js",
|
|
17
17
|
"docs:api": "node apidoc.js",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"test": "nyc
|
|
21
|
-
"
|
|
22
|
-
"test:
|
|
23
|
-
"test:unit": "nyc --require @babel/register --require ts-node/register mocha './test/unit/*'",
|
|
24
|
-
"test:watch": "mocha --recursive --require @babel/register --require ts-node/register --watch --timeout 40s",
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"test": "nyc mocha './test/unit/' './test/integration/'",
|
|
20
|
+
"test:integration": "nyc mocha './test/integration/'",
|
|
21
|
+
"test:unit": "nyc mocha './test/unit/'",
|
|
22
|
+
"test:watch": "mocha './test/unit/' './test/integration/' --watch",
|
|
25
23
|
"prepare": "npm run build",
|
|
26
|
-
"prepublishOnly": "npm run docs:examples
|
|
24
|
+
"prepublishOnly": "npm run docs:examples",
|
|
27
25
|
"release": "standard-version --skip.tag"
|
|
28
26
|
},
|
|
29
27
|
"license": "ISC",
|
|
@@ -34,32 +32,27 @@
|
|
|
34
32
|
"SDK"
|
|
35
33
|
],
|
|
36
34
|
"dependencies": {
|
|
37
|
-
"@aeternity/aepp-calldata": "^1.
|
|
38
|
-
"@aeternity/
|
|
35
|
+
"@aeternity/aepp-calldata": "^1.1.1",
|
|
36
|
+
"@aeternity/argon2-browser": "^0.1.2",
|
|
37
|
+
"@aeternity/blakejs": "^1.1.2",
|
|
39
38
|
"@aeternity/json-bigint": "^0.3.1",
|
|
40
|
-
"@
|
|
39
|
+
"@aeternity/uuid": "^0.0.1",
|
|
40
|
+
"@babel/runtime-corejs3": "^7.17.2",
|
|
41
41
|
"@stamp/it": "^1.1.0",
|
|
42
42
|
"@stamp/required": "^1.0.1",
|
|
43
43
|
"aes-js": "^3.1.2",
|
|
44
|
-
"bignumber.js": "^9.0.
|
|
44
|
+
"bignumber.js": "^9.0.2",
|
|
45
45
|
"bip32-path": "^0.4.2",
|
|
46
|
-
"
|
|
47
|
-
"bs58check": "^2.1.2",
|
|
46
|
+
"bs58": "^4.0.1",
|
|
48
47
|
"buffer": "^6.0.3",
|
|
49
|
-
"cross-fetch": "^3.1.
|
|
50
|
-
"crypto-browserify": "^3.12.0",
|
|
48
|
+
"cross-fetch": "^3.1.5",
|
|
51
49
|
"events": "^3.3.0",
|
|
52
|
-
"libsodium-wrappers-sumo": "^0.7.9",
|
|
53
|
-
"path-browserify": "^1.0.1",
|
|
54
50
|
"process": "^0.11.10",
|
|
55
|
-
"
|
|
56
|
-
"rlp": "^2.2.7",
|
|
51
|
+
"rlp": "^3.0.0",
|
|
57
52
|
"sha.js": "^2.4.11",
|
|
58
|
-
"
|
|
59
|
-
"swagger-client": "^3.17.0",
|
|
53
|
+
"swagger-client": "^3.18.4",
|
|
60
54
|
"tweetnacl": "^1.0.3",
|
|
61
55
|
"tweetnacl-auth": "^1.0.1",
|
|
62
|
-
"uuid": "^8.3.2",
|
|
63
56
|
"websocket": "^1.0.34"
|
|
64
57
|
},
|
|
65
58
|
"repository": {
|
|
@@ -67,42 +60,40 @@
|
|
|
67
60
|
"url": "https://github.com/aeternity/aepp-sdk-js"
|
|
68
61
|
},
|
|
69
62
|
"devDependencies": {
|
|
70
|
-
"@babel/cli": "^7.
|
|
71
|
-
"@babel/core": "^7.
|
|
72
|
-
"@babel/node": "^7.16.
|
|
73
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
74
|
-
"@babel/preset-env": "^7.16.
|
|
75
|
-
"@babel/preset-typescript": "^7.16.
|
|
76
|
-
"@babel/register": "^7.
|
|
77
|
-
"@commitlint/cli": "^
|
|
78
|
-
"@commitlint/config-conventional": "^
|
|
63
|
+
"@babel/cli": "^7.17.0",
|
|
64
|
+
"@babel/core": "^7.17.2",
|
|
65
|
+
"@babel/node": "^7.16.8",
|
|
66
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
67
|
+
"@babel/preset-env": "^7.16.11",
|
|
68
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
69
|
+
"@babel/register": "^7.17.0",
|
|
70
|
+
"@commitlint/cli": "^16.1.0",
|
|
71
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
79
72
|
"@types/bn.js": "^5.1.0",
|
|
80
|
-
"@types/chai": "^4.
|
|
81
|
-
"@types/mocha": "^9.
|
|
82
|
-
"@types/node": "^
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
84
|
-
"@typescript-eslint/parser": "^5.
|
|
73
|
+
"@types/chai": "^4.3.0",
|
|
74
|
+
"@types/mocha": "^9.1.0",
|
|
75
|
+
"@types/node": "^17.0.17",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
77
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
85
78
|
"babel-loader": "^8.2.3",
|
|
86
|
-
"babel-plugin-
|
|
87
|
-
"
|
|
79
|
+
"babel-plugin-add-import-extension": "^1.6.0",
|
|
80
|
+
"babel-plugin-import-globals": "^2.0.0",
|
|
81
|
+
"babel-plugin-transform-default-named-imports": "^1.2.2",
|
|
82
|
+
"chai": "^4.3.6",
|
|
88
83
|
"chai-as-promised": "^7.1.1",
|
|
89
|
-
"
|
|
90
|
-
"eslint": "^
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"eslint-plugin-node": "^11.1.0",
|
|
94
|
-
"eslint-plugin-promise": "^5.1.1",
|
|
95
|
-
"jsdoc-to-markdown": "^7.1.0",
|
|
96
|
-
"mocha": "^9.1.3",
|
|
84
|
+
"eslint": "^8.8.0",
|
|
85
|
+
"eslint-config-standard": "^17.0.0-1",
|
|
86
|
+
"jsdoc-to-markdown": "^7.1.1",
|
|
87
|
+
"mocha": "^9.2.0",
|
|
97
88
|
"nyc": "^15.1.0",
|
|
98
|
-
"sinon": "^
|
|
89
|
+
"sinon": "^13.0.1",
|
|
99
90
|
"source-map": "^0.7.3",
|
|
100
91
|
"standard-version": "^9.3.2",
|
|
101
|
-
"ts-node": "^10.
|
|
102
|
-
"typescript": "^4.5.
|
|
103
|
-
"webpack": "^5.
|
|
92
|
+
"ts-node": "^10.5.0",
|
|
93
|
+
"typescript": "^4.5.5",
|
|
94
|
+
"webpack": "^5.68.0",
|
|
104
95
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
105
|
-
"webpack-cli": "^4.9.
|
|
96
|
+
"webpack-cli": "^4.9.2"
|
|
106
97
|
},
|
|
107
98
|
"files": [
|
|
108
99
|
"dist",
|
package/src/account/memory.js
CHANGED
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import AccountBase from './base'
|
|
26
|
-
import { sign,
|
|
26
|
+
import { sign, isValidKeypair } from '../utils/crypto'
|
|
27
27
|
import { isHex } from '../utils/string'
|
|
28
28
|
import { decode } from '../tx/builder/helpers'
|
|
29
|
+
import { InvalidKeypairError } from '../utils/errors'
|
|
29
30
|
|
|
30
31
|
const secrets = new WeakMap()
|
|
31
32
|
|
|
@@ -44,21 +45,25 @@ export default AccountBase.compose({
|
|
|
44
45
|
init ({ keypair, gaId }) {
|
|
45
46
|
this.isGa = !!gaId
|
|
46
47
|
if (gaId) {
|
|
47
|
-
|
|
48
|
+
decode(gaId)
|
|
48
49
|
secrets.set(this, { publicKey: gaId })
|
|
49
50
|
return
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
if (!keypair || typeof keypair !== 'object') throw new
|
|
53
|
-
if (!keypair.secretKey || !keypair.publicKey)
|
|
54
|
-
|
|
53
|
+
if (!keypair || typeof keypair !== 'object') throw new InvalidKeypairError('KeyPair must be an object')
|
|
54
|
+
if (!keypair.secretKey || !keypair.publicKey) {
|
|
55
|
+
throw new InvalidKeypairError('KeyPair must must have "secretKey", "publicKey" properties')
|
|
56
|
+
}
|
|
57
|
+
if (typeof keypair.publicKey !== 'string' || keypair.publicKey.indexOf('ak_') === -1) {
|
|
58
|
+
throw new InvalidKeypairError('Public Key must be a base58c string with "ak_" prefix')
|
|
59
|
+
}
|
|
55
60
|
if (
|
|
56
61
|
!Buffer.isBuffer(keypair.secretKey) &&
|
|
57
62
|
(typeof keypair.secretKey === 'string' && !isHex(keypair.secretKey))
|
|
58
|
-
) throw new
|
|
63
|
+
) throw new InvalidKeypairError('Secret key must be hex string or Buffer')
|
|
59
64
|
|
|
60
65
|
const pubBuffer = Buffer.from(decode(keypair.publicKey, 'ak'))
|
|
61
|
-
if (!isValidKeypair(Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new
|
|
66
|
+
if (!isValidKeypair(Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new InvalidKeypairError('Invalid Key Pair')
|
|
62
67
|
|
|
63
68
|
secrets.set(this, {
|
|
64
69
|
secretKey: Buffer.isBuffer(keypair.secretKey) ? keypair.secretKey : Buffer.from(keypair.secretKey, 'hex'),
|
|
@@ -68,7 +73,7 @@ export default AccountBase.compose({
|
|
|
68
73
|
props: { isGa: false },
|
|
69
74
|
methods: {
|
|
70
75
|
sign (data) {
|
|
71
|
-
if (this.isGa) throw new
|
|
76
|
+
if (this.isGa) throw new InvalidKeypairError('You are trying to sign data using generalized account without keypair')
|
|
72
77
|
return Promise.resolve(sign(data, secrets.get(this).secretKey))
|
|
73
78
|
},
|
|
74
79
|
address () {
|
package/src/account/multiple.js
CHANGED
|
@@ -25,6 +25,10 @@ import AsyncInit from '../utils/async-init'
|
|
|
25
25
|
import MemoryAccount from './memory'
|
|
26
26
|
import { decode } from '../tx/builder/helpers'
|
|
27
27
|
import AccountBase, { isAccountBase } from './base'
|
|
28
|
+
import {
|
|
29
|
+
UnavailableAccountError,
|
|
30
|
+
TypeError
|
|
31
|
+
} from '../utils/errors'
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
34
|
* AccountMultiple stamp
|
|
@@ -125,7 +129,7 @@ export default AccountBase.compose(AsyncInit, {
|
|
|
125
129
|
*/
|
|
126
130
|
selectAccount (address) {
|
|
127
131
|
decode(address, 'ak')
|
|
128
|
-
if (!this.accounts[address]) throw new
|
|
132
|
+
if (!this.accounts[address]) throw new UnavailableAccountError(address)
|
|
129
133
|
this.selectedAddress = address
|
|
130
134
|
},
|
|
131
135
|
/**
|
|
@@ -136,17 +140,21 @@ export default AccountBase.compose(AsyncInit, {
|
|
|
136
140
|
*/
|
|
137
141
|
_resolveAccount (account) {
|
|
138
142
|
if (account === null) {
|
|
139
|
-
throw new
|
|
143
|
+
throw new TypeError(
|
|
144
|
+
'Account should be an address (ak-prefixed string), ' +
|
|
145
|
+
'keypair, or instance of account base, got null instead')
|
|
140
146
|
} else {
|
|
141
147
|
switch (typeof account) {
|
|
142
148
|
case 'string':
|
|
143
149
|
decode(account, 'ak')
|
|
144
|
-
if (!this.accounts[account]) throw new
|
|
150
|
+
if (!this.accounts[account]) throw new UnavailableAccountError(account)
|
|
145
151
|
return this.accounts[account]
|
|
146
152
|
case 'object':
|
|
147
153
|
return isAccountBase(account) ? account : MemoryAccount({ keypair: account })
|
|
148
154
|
default:
|
|
149
|
-
throw new
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
'Account should be an address (ak-prefixed string), ' +
|
|
157
|
+
`keypair, or instance of account base, got ${account} instead`)
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
160
|
}
|
package/src/ae/aens.js
CHANGED
|
@@ -27,11 +27,10 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import { salt } from '../utils/crypto'
|
|
30
|
-
import {
|
|
31
|
-
commitmentHash, ensureNameValid, getMinimumNameFee, isAuctionName, encode, produceNameId
|
|
32
|
-
} from '../tx/builder/helpers'
|
|
30
|
+
import { commitmentHash, ensureNameValid, isAuctionName } from '../tx/builder/helpers'
|
|
33
31
|
import Ae from './'
|
|
34
|
-
import { CLIENT_TTL,
|
|
32
|
+
import { CLIENT_TTL, NAME_TTL } from '../tx/builder/schema'
|
|
33
|
+
import { ArgumentError } from '../utils/errors'
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* Revoke a name
|
|
@@ -61,7 +60,7 @@ async function revoke (name, options = {}) {
|
|
|
61
60
|
|
|
62
61
|
const nameRevokeTx = await this.nameRevokeTx({
|
|
63
62
|
...opt,
|
|
64
|
-
nameId:
|
|
63
|
+
nameId: name,
|
|
65
64
|
accountId: await this.address(opt)
|
|
66
65
|
})
|
|
67
66
|
|
|
@@ -111,7 +110,7 @@ async function update (name, pointers = {}, options = {}) {
|
|
|
111
110
|
|
|
112
111
|
const nameUpdateTx = await this.nameUpdateTx({
|
|
113
112
|
...opt,
|
|
114
|
-
nameId:
|
|
113
|
+
nameId: name,
|
|
115
114
|
accountId: await this.address(opt),
|
|
116
115
|
pointers: Object.entries(allPointers).map(([key, id]) => ({ key, id }))
|
|
117
116
|
})
|
|
@@ -149,7 +148,7 @@ async function transfer (name, account, options = {}) {
|
|
|
149
148
|
|
|
150
149
|
const nameTransferTx = await this.nameTransferTx({
|
|
151
150
|
...opt,
|
|
152
|
-
nameId:
|
|
151
|
+
nameId: name,
|
|
153
152
|
accountId: await this.address(opt),
|
|
154
153
|
recipientId: account
|
|
155
154
|
})
|
|
@@ -199,7 +198,9 @@ async function query (name, opt = {}) {
|
|
|
199
198
|
},
|
|
200
199
|
revoke: async (options = {}) => this.aensRevoke(name, { ...opt, ...options }),
|
|
201
200
|
extendTtl: async (nameTtl = NAME_TTL, options = {}) => {
|
|
202
|
-
if (
|
|
201
|
+
if (typeof nameTtl !== 'number' || nameTtl > NAME_TTL || nameTtl <= 0) {
|
|
202
|
+
throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, nameTtl)
|
|
203
|
+
}
|
|
203
204
|
|
|
204
205
|
return {
|
|
205
206
|
...await this.aensUpdate(name, {}, { ...opt, ...options, nameTtl, extendPointers: true }),
|
|
@@ -236,16 +237,11 @@ async function claim (name, salt, options) {
|
|
|
236
237
|
ensureNameValid(name)
|
|
237
238
|
const opt = { ...this.Ae.defaults, ...options }
|
|
238
239
|
|
|
239
|
-
const minNameFee = getMinimumNameFee(name)
|
|
240
|
-
if (opt.nameFee !== this.Ae.defaults.nameFee && minNameFee.gt(opt.nameFee)) {
|
|
241
|
-
throw new Error(`the provided fee ${opt.nameFee} is not enough to execute the claim, required: ${minNameFee}`)
|
|
242
|
-
}
|
|
243
|
-
opt.nameFee = opt.nameFee !== this.Ae.defaults.nameFee ? opt.nameFee : minNameFee
|
|
244
240
|
const claimTx = await this.nameClaimTx({
|
|
245
241
|
...opt,
|
|
246
242
|
accountId: await this.address(opt),
|
|
247
243
|
nameSalt: salt,
|
|
248
|
-
name
|
|
244
|
+
name
|
|
249
245
|
})
|
|
250
246
|
|
|
251
247
|
const result = await this.send(claimTx, opt)
|
|
@@ -327,7 +323,7 @@ async function preclaim (name, options = {}) {
|
|
|
327
323
|
*
|
|
328
324
|
* await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
|
|
329
325
|
*/
|
|
330
|
-
async function bid (name, nameFee
|
|
326
|
+
async function bid (name, nameFee, options = {}) {
|
|
331
327
|
return this.aensClaim(name, 0, { ...options, nameFee, vsn: 2 })
|
|
332
328
|
}
|
|
333
329
|
|
|
@@ -356,8 +352,7 @@ const Aens = Ae.compose({
|
|
|
356
352
|
Ae: {
|
|
357
353
|
defaults: {
|
|
358
354
|
clientTtl: CLIENT_TTL,
|
|
359
|
-
nameTtl: NAME_TTL
|
|
360
|
-
nameFee: NAME_FEE
|
|
355
|
+
nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000
|
|
361
356
|
}
|
|
362
357
|
}
|
|
363
358
|
}
|
package/src/ae/aepp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ISC License (ISC)
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2021 aeternity developers
|
|
4
4
|
*
|
|
5
5
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
6
|
* purpose with or without fee is hereby granted, provided that the above
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import Ae from './'
|
|
26
26
|
import Aens from './aens'
|
|
27
|
-
import
|
|
27
|
+
import Contract from './contract'
|
|
28
28
|
import AeppRpc from '../utils/aepp-wallet-communication/rpc/aepp-rpc'
|
|
29
29
|
import Chain from '../chain/node'
|
|
30
30
|
import Tx from '../tx/tx'
|