@aeternity/aepp-sdk 11.0.0 → 12.1.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/LICENSE +1 -1
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -22
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +2 -1
- package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +20764 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +37 -0
- package/es/AeSdk.mjs +81 -0
- package/es/AeSdk.mjs.map +1 -0
- package/es/AeSdkAepp.d.ts +70 -0
- package/es/AeSdkAepp.mjs +176 -0
- package/es/AeSdkAepp.mjs.map +1 -0
- package/es/AeSdkBase.d.ts +213 -0
- package/es/AeSdkBase.mjs +314 -0
- package/es/AeSdkBase.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +104 -0
- package/es/AeSdkWallet.mjs +326 -0
- package/es/AeSdkWallet.mjs.map +1 -0
- package/es/Node.d.ts +41 -0
- package/es/Node.mjs +147 -0
- package/es/Node.mjs.map +1 -0
- package/es/account/Base.d.ts +68 -0
- package/es/account/Base.mjs +123 -0
- package/es/account/Base.mjs.map +1 -0
- package/es/account/Memory.d.ts +26 -0
- package/es/account/Memory.mjs +103 -0
- package/es/account/Memory.mjs.map +1 -0
- package/es/account/Rpc.d.ts +27 -0
- package/es/account/Rpc.mjs +80 -0
- package/es/account/Rpc.mjs.map +1 -0
- package/es/aens.d.ts +222 -0
- package/es/aens.mjs +338 -0
- package/es/aens.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs +73 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +58 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +146 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +16 -11
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
- package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +105 -46
- package/es/aepp-wallet-communication/schema.mjs +251 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs +62 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/apis/compiler/compiler.d.ts +92 -0
- package/es/apis/compiler/compiler.mjs +576 -0
- package/es/apis/compiler/compiler.mjs.map +1 -0
- package/es/apis/compiler/index.d.ts +2 -0
- package/es/apis/compiler/index.mjs +3 -0
- package/es/apis/compiler/index.mjs.map +1 -0
- package/es/apis/compiler/models/index.d.ts +248 -0
- package/es/apis/compiler/models/index.mjs +48 -0
- package/es/apis/compiler/models/index.mjs.map +1 -0
- package/es/apis/compiler/models/mappers.d.ts +23 -0
- package/es/apis/compiler/models/mappers.mjs +585 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -0
- package/es/apis/compiler/models/parameters.d.ts +13 -0
- package/es/apis/compiler/models/parameters.mjs +71 -0
- package/es/apis/compiler/models/parameters.mjs.map +1 -0
- package/es/apis/node/index.d.ts +2 -0
- package/es/apis/node/index.mjs +3 -0
- package/es/apis/node/index.mjs.map +1 -0
- package/es/apis/node/models/index.d.ts +1065 -0
- package/es/apis/node/models/index.mjs +2 -0
- package/es/apis/node/models/index.mjs.map +1 -0
- package/es/apis/node/models/mappers.d.ts +95 -0
- package/es/apis/node/models/mappers.mjs +4166 -0
- package/es/apis/node/models/mappers.mjs.map +1 -0
- package/es/apis/node/models/parameters.d.ts +17 -0
- package/es/apis/node/models/parameters.mjs +165 -0
- package/es/apis/node/models/parameters.mjs.map +1 -0
- package/es/apis/node/node.d.ts +215 -0
- package/es/apis/node/node.mjs +1165 -0
- package/es/apis/node/node.mjs.map +1 -0
- package/es/chain.d.ts +248 -0
- package/es/chain.mjs +560 -0
- package/es/chain.mjs.map +1 -0
- package/es/channel/handlers.d.ts +34 -0
- package/es/channel/handlers.mjs +164 -131
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/index.d.ts +625 -0
- package/es/channel/index.mjs +897 -902
- package/es/channel/index.mjs.map +1 -1
- package/es/channel/internal.d.ts +101 -0
- package/es/channel/internal.mjs +138 -88
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Compiler.d.ts +18 -0
- package/es/contract/Compiler.mjs +68 -0
- package/es/contract/Compiler.mjs.map +1 -0
- package/es/contract/aci.d.ts +127 -0
- package/es/contract/aci.mjs +225 -193
- package/es/contract/aci.mjs.map +1 -1
- package/es/contract/ga.d.ts +69 -0
- package/es/contract/ga.mjs +195 -0
- package/es/contract/ga.mjs.map +1 -0
- package/es/contract/methods.d.ts +71 -0
- package/es/contract/methods.mjs +104 -0
- package/es/contract/methods.mjs.map +1 -0
- package/es/deprecated/index.d.ts +143 -0
- package/es/deprecated/index.mjs +162 -0
- package/es/deprecated/index.mjs.map +1 -0
- package/es/deprecated/methods.d.ts +18 -0
- package/es/deprecated/methods.mjs +26 -0
- package/es/deprecated/methods.mjs.map +1 -0
- package/es/index.d.ts +35 -0
- package/es/index.mjs +35 -40
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +161 -0
- package/es/oracle.mjs +306 -0
- package/es/oracle.mjs.map +1 -0
- package/es/spend.d.ts +62 -0
- package/es/spend.mjs +111 -0
- package/es/spend.mjs.map +1 -0
- package/es/tx/builder/address.d.ts +25 -0
- package/es/tx/builder/address.mjs +45 -0
- package/es/tx/builder/address.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +70 -0
- package/es/tx/builder/constants.mjs +122 -0
- package/es/tx/builder/constants.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
- package/es/tx/builder/field-types/coin-amount.mjs +26 -0
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +15 -0
- package/es/tx/builder/field-types/deposit.mjs +19 -0
- package/es/tx/builder/field-types/deposit.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +25 -0
- package/es/tx/builder/field-types/fee.mjs +150 -0
- package/es/tx/builder/field-types/fee.mjs.map +1 -0
- package/es/tx/builder/field-types/field.d.ts +6 -0
- package/es/tx/builder/field-types/field.mjs +15 -0
- package/es/tx/builder/field-types/field.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/es/tx/builder/field-types/gas-limit.mjs +33 -0
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-price.d.ts +8 -0
- package/es/tx/builder/field-types/gas-price.mjs +18 -0
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
- package/es/tx/builder/field-types/index.d.ts +70 -0
- package/es/tx/builder/field-types/index.mjs +25 -0
- package/es/tx/builder/field-types/index.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +20 -0
- package/es/tx/builder/field-types/name-fee.mjs +24 -0
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/name-id.d.ts +14 -0
- package/es/tx/builder/field-types/name-id.mjs +19 -0
- package/es/tx/builder/field-types/name-id.mjs.map +1 -0
- package/es/tx/builder/field-types/name.d.ts +13 -0
- package/es/tx/builder/field-types/name.mjs +18 -0
- package/es/tx/builder/field-types/name.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/es/tx/builder/field-types/short-u-int.mjs +12 -0
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +8 -0
- package/es/tx/builder/field-types/u-int.mjs +14 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -0
- package/es/tx/builder/helpers.d.ts +125 -0
- package/es/tx/builder/helpers.mjs +94 -240
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +88 -0
- package/es/tx/builder/index.mjs +167 -358
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +1201 -0
- package/es/tx/builder/schema.mjs +175 -664
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +64 -0
- package/es/tx/index.mjs +151 -265
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +20 -0
- package/es/tx/validator.mjs +104 -124
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
- package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
- package/es/typings/bip32-path/index.d.mjs +2 -0
- package/es/typings/bip32-path/index.d.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs.map +1 -1
- package/es/typings/sha-js/index.d.mjs +2 -0
- package/es/typings/sha-js/index.d.mjs.map +1 -0
- package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.d.ts +42 -0
- package/es/utils/amount-formatter.mjs +36 -49
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +6 -0
- package/es/utils/autorest.mjs +97 -0
- package/es/utils/autorest.mjs.map +1 -0
- package/es/utils/bignumber.d.ts +13 -0
- package/es/utils/bignumber.mjs +11 -8
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
- package/es/utils/bytes.mjs +11 -15
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +88 -0
- package/es/utils/crypto.mjs +64 -108
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +61 -0
- package/es/utils/encoder-types.mjs +36 -0
- package/es/utils/encoder-types.mjs.map +1 -0
- package/es/utils/encoder.d.ts +25 -0
- package/es/utils/encoder.mjs +118 -0
- package/es/utils/encoder.mjs.map +1 -0
- package/es/{errors.d.ts → utils/errors.d.ts} +246 -59
- package/es/utils/errors.mjs +313 -136
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +50 -0
- package/es/utils/hd-wallet.mjs +86 -45
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.d.ts +5 -0
- package/es/utils/json-big.mjs +12 -16
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +51 -0
- package/es/utils/keystore.mjs +101 -194
- package/es/utils/keystore.mjs.map +1 -1
- package/es/{mptree.d.ts → utils/mptree.d.ts} +6 -9
- package/es/utils/mptree.mjs +22 -18
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +20 -0
- package/es/utils/other.mjs +32 -35
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.d.ts +1 -0
- package/es/utils/semver-satisfies.mjs +2 -2
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +24 -0
- package/es/utils/string.mjs +8 -10
- package/es/utils/string.mjs.map +1 -1
- package/package.json +56 -42
- package/src/AeSdk.ts +68 -0
- package/src/AeSdkAepp.ts +176 -0
- package/src/AeSdkBase.ts +338 -0
- package/src/AeSdkWallet.ts +348 -0
- package/src/Node.ts +173 -0
- package/src/account/Base.ts +124 -0
- package/src/account/Memory.ts +98 -0
- package/src/account/Rpc.ts +69 -0
- package/src/aens.ts +407 -0
- package/src/aepp-wallet-communication/connection/Browser.ts +71 -0
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +59 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +122 -0
- package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +18 -18
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +143 -0
- package/src/aepp-wallet-communication/rpc/types.ts +66 -0
- package/src/aepp-wallet-communication/schema.ts +224 -0
- package/src/aepp-wallet-communication/wallet-detector.ts +72 -0
- package/src/apis/compiler/code-model-v4.yaml +2649 -0
- package/src/apis/compiler/compiler.ts +585 -0
- package/src/apis/compiler/index.ts +2 -0
- package/src/apis/compiler/models/index.ts +301 -0
- package/src/apis/compiler/models/mappers.ts +583 -0
- package/src/apis/compiler/models/parameters.ts +93 -0
- package/src/apis/node/code-model-v4.yaml +10080 -0
- package/src/apis/node/index.ts +2 -0
- package/src/apis/node/models/index.ts +1257 -0
- package/src/apis/node/models/mappers.ts +4280 -0
- package/src/apis/node/models/parameters.ts +188 -0
- package/src/apis/node/node.ts +1299 -0
- package/src/chain.ts +502 -0
- package/src/channel/handlers.ts +817 -0
- package/src/channel/index.ts +1025 -0
- package/src/channel/internal.ts +361 -0
- package/src/contract/Compiler.ts +67 -0
- package/src/contract/aci.ts +538 -0
- package/src/contract/ga.ts +199 -0
- package/src/contract/methods.ts +123 -0
- package/src/deprecated/index.ts +170 -0
- package/src/deprecated/methods.ts +25 -0
- package/src/index.ts +56 -0
- package/src/oracle.ts +364 -0
- package/src/spend.ts +164 -0
- package/src/tx/builder/address.ts +50 -0
- package/src/tx/builder/constants.ts +126 -0
- package/src/tx/builder/field-types/coin-amount.ts +27 -0
- package/src/tx/builder/field-types/deposit.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +143 -0
- package/src/tx/builder/field-types/field.ts +9 -0
- package/src/tx/builder/field-types/gas-limit.ts +41 -0
- package/src/tx/builder/field-types/gas-price.ts +16 -0
- package/src/tx/builder/field-types/index.ts +45 -0
- package/src/tx/builder/field-types/name-fee.ts +32 -0
- package/src/tx/builder/field-types/name-id.ts +20 -0
- package/src/tx/builder/field-types/name.ts +18 -0
- package/src/tx/builder/field-types/short-u-int.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +16 -0
- package/src/tx/builder/helpers.ts +248 -0
- package/src/tx/builder/index.ts +400 -0
- package/src/tx/builder/schema.ts +727 -0
- package/src/tx/index.ts +192 -0
- package/src/tx/validator.ts +230 -0
- package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
- package/src/typings/@aeternity__uuid/index.d.ts +5 -0
- package/src/typings/bip32-path/index.d.ts +33 -0
- package/src/typings/blakejs/index.d.ts +4 -32
- package/src/typings/sha-js/index.d.ts +5 -0
- package/src/typings/tweetnacl-auth/index.d.ts +14 -0
- package/src/utils/amount-formatter.ts +56 -69
- package/src/utils/autorest.ts +93 -0
- package/src/utils/bignumber.ts +11 -12
- package/src/utils/bytes.ts +29 -31
- package/src/utils/crypto.ts +205 -0
- package/src/utils/encoder-types.ts +63 -0
- package/src/utils/encoder.ts +146 -0
- package/src/utils/errors.ts +482 -366
- package/src/utils/hd-wallet.ts +166 -0
- package/src/utils/json-big.ts +27 -0
- package/src/utils/keystore.ts +182 -0
- package/src/utils/mptree.ts +64 -61
- package/src/utils/other.ts +34 -41
- package/src/utils/semver-satisfies.ts +15 -11
- package/src/utils/string.ts +18 -20
- package/es/account/base.mjs +0 -179
- package/es/account/base.mjs.map +0 -1
- package/es/account/memory.mjs +0 -99
- package/es/account/memory.mjs.map +0 -1
- package/es/account/multiple.mjs +0 -179
- package/es/account/multiple.mjs.map +0 -1
- package/es/ae/aens.mjs +0 -404
- package/es/ae/aens.mjs.map +0 -1
- package/es/ae/aepp.mjs +0 -45
- package/es/ae/aepp.mjs.map +0 -1
- package/es/ae/contract.mjs +0 -159
- package/es/ae/contract.mjs.map +0 -1
- package/es/ae/index.mjs +0 -207
- package/es/ae/index.mjs.map +0 -1
- package/es/ae/oracle.mjs +0 -339
- package/es/ae/oracle.mjs.map +0 -1
- package/es/ae/universal.mjs +0 -45
- package/es/ae/universal.mjs.map +0 -1
- package/es/ae/wallet.mjs +0 -50
- package/es/ae/wallet.mjs.map +0 -1
- package/es/amount-formatter.d.ts +0 -58
- package/es/bignumber.d.ts +0 -18
- package/es/chain/index.mjs +0 -272
- package/es/chain/index.mjs.map +0 -1
- package/es/chain/node.mjs +0 -442
- package/es/chain/node.mjs.map +0 -1
- package/es/contract/compiler.mjs +0 -115
- package/es/contract/compiler.mjs.map +0 -1
- package/es/contract/ga/helpers.mjs +0 -30
- package/es/contract/ga/helpers.mjs.map +0 -1
- package/es/contract/ga/index.mjs +0 -178
- package/es/contract/ga/index.mjs.map +0 -1
- package/es/crypto-ts.d.ts +0 -9
- package/es/node-pool/index.mjs +0 -188
- package/es/node-pool/index.mjs.map +0 -1
- package/es/node.mjs +0 -133
- package/es/node.mjs.map +0 -1
- package/es/other.d.ts +0 -31
- package/es/semver-satisfies.d.ts +0 -1
- package/es/string.d.ts +0 -26
- package/es/tx/builder/field-types.mjs +0 -74
- package/es/tx/builder/field-types.mjs.map +0 -1
- package/es/tx/tx-object.mjs +0 -283
- package/es/tx/tx-object.mjs.map +0 -1
- package/es/tx/tx.mjs +0 -938
- package/es/tx/tx.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
- package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
- package/es/utils/async-init.mjs +0 -64
- package/es/utils/async-init.mjs.map +0 -1
- package/es/utils/crypto-ts.mjs.map +0 -1
- package/es/utils/swagger.mjs +0 -164
- package/es/utils/swagger.mjs.map +0 -1
- package/src/account/base.js +0 -153
- package/src/account/memory.js +0 -83
- package/src/account/multiple.js +0 -162
- package/src/ae/aens.js +0 -361
- package/src/ae/aepp.js +0 -45
- package/src/ae/contract.js +0 -148
- package/src/ae/index.js +0 -168
- package/src/ae/oracle.js +0 -311
- package/src/ae/universal.js +0 -47
- package/src/ae/wallet.js +0 -50
- package/src/chain/index.js +0 -269
- package/src/chain/node.js +0 -320
- package/src/channel/handlers.js +0 -673
- package/src/channel/index.js +0 -898
- package/src/channel/internal.js +0 -237
- package/src/contract/aci.js +0 -376
- package/src/contract/compiler.js +0 -100
- package/src/contract/ga/helpers.js +0 -19
- package/src/contract/ga/index.js +0 -150
- package/src/index.js +0 -89
- package/src/node-pool/index.js +0 -172
- package/src/node.js +0 -116
- package/src/tx/builder/field-types.js +0 -61
- package/src/tx/builder/helpers.js +0 -380
- package/src/tx/builder/index.js +0 -465
- package/src/tx/builder/schema.js +0 -1197
- package/src/tx/index.js +0 -301
- package/src/tx/tx-object.js +0 -187
- package/src/tx/tx.js +0 -631
- package/src/tx/validator.js +0 -181
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
- package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
- package/src/utils/aepp-wallet-communication/helpers.js +0 -60
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
- package/src/utils/aepp-wallet-communication/schema.ts +0 -80
- package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
- package/src/utils/async-init.js +0 -45
- package/src/utils/crypto.js +0 -229
- package/src/utils/hd-wallet.js +0 -100
- package/src/utils/json-big.js +0 -26
- package/src/utils/keystore.js +0 -219
- package/src/utils/swagger.js +0 -156
package/es/chain/node.mjs
DELETED
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2018 aeternity developers
|
|
4
|
-
*
|
|
5
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
* copyright notice and this permission notice appear in all copies.
|
|
8
|
-
*
|
|
9
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
*/
|
|
17
|
-
import Chain from "./index.mjs";
|
|
18
|
-
import { AE_AMOUNT_FORMATS, formatAmount } from "../utils/amount-formatter.mjs";
|
|
19
|
-
import verifyTransaction from "../tx/validator.mjs";
|
|
20
|
-
import NodePool from "../node-pool/index.mjs";
|
|
21
|
-
import { pause } from "../utils/other.mjs";
|
|
22
|
-
import { isNameValid, produceNameId, decode } from "../tx/builder/helpers.mjs";
|
|
23
|
-
import { DRY_RUN_ACCOUNT } from "../tx/builder/schema.mjs";
|
|
24
|
-
import { AensPointerContextError, DryRunError, InvalidAensNameError, InvalidTxError, RequestTimedOutError, TxTimedOutError, TxNotInChainError, ArgumentError } from "../utils/errors.mjs";
|
|
25
|
-
/**
|
|
26
|
-
* ChainNode module
|
|
27
|
-
*
|
|
28
|
-
* This is the complement to {@link module:@aeternity/aepp-sdk/es/chain}.
|
|
29
|
-
* @module @aeternity/aepp-sdk/es/chain/node
|
|
30
|
-
* @export ChainNode
|
|
31
|
-
* @example import { ChainNode } from '@aeternity/aepp-sdk'
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
async function sendTransaction(tx) {
|
|
35
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36
|
-
const opt = { ...this.Ae.defaults,
|
|
37
|
-
...options
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
if (opt.verify) {
|
|
41
|
-
const validation = await verifyTransaction(tx, this.selectedNode.instance);
|
|
42
|
-
|
|
43
|
-
if (validation.length) {
|
|
44
|
-
const message = 'Transaction verification errors: ' + validation.map(v => v.message).join(', ');
|
|
45
|
-
throw Object.assign(new InvalidTxError(message), {
|
|
46
|
-
code: 'TX_VERIFICATION_ERROR',
|
|
47
|
-
validation,
|
|
48
|
-
transaction: tx
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
var _this$address;
|
|
55
|
-
|
|
56
|
-
const {
|
|
57
|
-
txHash
|
|
58
|
-
} = await this.api.postTransaction({
|
|
59
|
-
tx
|
|
60
|
-
}, {
|
|
61
|
-
__queue: `tx-${await ((_this$address = this.address) === null || _this$address === void 0 ? void 0 : _this$address.call(this, options).catch(() => ''))}`
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (opt.waitMined) {
|
|
65
|
-
const txData = { ...(await this.poll(txHash, options)),
|
|
66
|
-
rawTx: tx
|
|
67
|
-
}; // wait for transaction confirmation
|
|
68
|
-
|
|
69
|
-
if (options.confirm) {
|
|
70
|
-
return { ...txData,
|
|
71
|
-
confirmationHeight: await this.waitForTxConfirm(txHash, options)
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return txData;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
hash: txHash,
|
|
80
|
-
rawTx: tx
|
|
81
|
-
};
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw Object.assign(error, {
|
|
84
|
-
rawTx: tx,
|
|
85
|
-
verifyTx: () => verifyTransaction(tx, this.selectedNode.instance)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async function waitForTxConfirm(txHash) {
|
|
91
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
92
|
-
confirm: 3
|
|
93
|
-
};
|
|
94
|
-
options.confirm = options.confirm === true ? 3 : options.confirm;
|
|
95
|
-
const {
|
|
96
|
-
blockHeight
|
|
97
|
-
} = await this.api.getTransactionByHash(txHash);
|
|
98
|
-
const height = await this.awaitHeight(blockHeight + options.confirm, options);
|
|
99
|
-
const {
|
|
100
|
-
blockHeight: newBlockHeight
|
|
101
|
-
} = await this.api.getTransactionByHash(txHash);
|
|
102
|
-
|
|
103
|
-
switch (newBlockHeight) {
|
|
104
|
-
case -1:
|
|
105
|
-
throw new TxNotInChainError(txHash);
|
|
106
|
-
|
|
107
|
-
case blockHeight:
|
|
108
|
-
return height;
|
|
109
|
-
|
|
110
|
-
default:
|
|
111
|
-
return waitForTxConfirm(txHash, options);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async function getAccount(address) {
|
|
116
|
-
let {
|
|
117
|
-
height,
|
|
118
|
-
hash
|
|
119
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
120
|
-
if (height) return this.api.getAccountByPubkeyAndHeight(address, height);
|
|
121
|
-
if (hash) return this.api.getAccountByPubkeyAndHash(address, hash);
|
|
122
|
-
return this.api.getAccountByPubkey(address);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @function
|
|
126
|
-
* @deprecated
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
async function balance(address) {
|
|
131
|
-
let {
|
|
132
|
-
height,
|
|
133
|
-
hash,
|
|
134
|
-
format = AE_AMOUNT_FORMATS.AETTOS
|
|
135
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
136
|
-
const {
|
|
137
|
-
balance
|
|
138
|
-
} = await this.getAccount(address, {
|
|
139
|
-
hash,
|
|
140
|
-
height
|
|
141
|
-
});
|
|
142
|
-
return formatAmount(balance, {
|
|
143
|
-
targetDenomination: format
|
|
144
|
-
}).toString();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function getBalance(address) {
|
|
148
|
-
let {
|
|
149
|
-
height,
|
|
150
|
-
hash,
|
|
151
|
-
format = AE_AMOUNT_FORMATS.AETTOS
|
|
152
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
153
|
-
const {
|
|
154
|
-
balance
|
|
155
|
-
} = await this.getAccount(address, {
|
|
156
|
-
hash,
|
|
157
|
-
height
|
|
158
|
-
}).catch(_ => ({
|
|
159
|
-
balance: 0
|
|
160
|
-
}));
|
|
161
|
-
return formatAmount(balance, {
|
|
162
|
-
targetDenomination: format
|
|
163
|
-
}).toString();
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated use `sdk.api.getTransactionByHash/getTransactionInfoByHash` instead
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
async function tx(hash) {
|
|
171
|
-
let info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
172
|
-
const tx = await this.api.getTransactionByHash(hash);
|
|
173
|
-
|
|
174
|
-
if (['ContractCreateTx', 'ContractCallTx', 'ChannelForceProgressTx'].includes(tx.tx.type) && info && tx.blockHeight !== -1) {
|
|
175
|
-
try {
|
|
176
|
-
return { ...tx,
|
|
177
|
-
...(await this.getTxInfo(hash))
|
|
178
|
-
};
|
|
179
|
-
} catch (e) {}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return tx;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async function height() {
|
|
186
|
-
return (await this.api.getCurrentKeyBlockHeight()).height;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
async function awaitHeight(height) {
|
|
190
|
-
let {
|
|
191
|
-
interval = this._getPollInterval('block'),
|
|
192
|
-
attempts = 20
|
|
193
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
194
|
-
let currentHeight;
|
|
195
|
-
|
|
196
|
-
for (let i = 0; i < attempts; i++) {
|
|
197
|
-
if (i) await pause(interval);
|
|
198
|
-
currentHeight = await this.height();
|
|
199
|
-
if (currentHeight >= height) return currentHeight;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
throw new RequestTimedOutError((attempts - 1) * interval, currentHeight, height);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
async function poll(th) {
|
|
206
|
-
let {
|
|
207
|
-
blocks = 10,
|
|
208
|
-
interval = this._getPollInterval('microblock')
|
|
209
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
210
|
-
const max = (await this.height()) + blocks;
|
|
211
|
-
|
|
212
|
-
do {
|
|
213
|
-
const tx = await this.api.getTransactionByHash(th);
|
|
214
|
-
if (tx.blockHeight !== -1) return tx;
|
|
215
|
-
await pause(interval);
|
|
216
|
-
} while ((await this.height()) < max);
|
|
217
|
-
|
|
218
|
-
const status = this.api.getCheckTxInPool && (await this.api.getCheckTxInPool(th)).status;
|
|
219
|
-
throw new TxTimedOutError(blocks, th, status);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @deprecated use `sdk.api.getTransactionInfoByHash` instead
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
async function getTxInfo(hash) {
|
|
227
|
-
const result = await this.api.getTransactionInfoByHash(hash);
|
|
228
|
-
return result.callInfo || result;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async function mempool() {
|
|
232
|
-
return this.api.getPendingTransactions();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
async function getCurrentGeneration() {
|
|
236
|
-
return this.api.getCurrentGeneration();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async function getGeneration(hashOrHeight) {
|
|
240
|
-
if (typeof hashOrHeight === 'string') return this.api.getGenerationByHash(hashOrHeight);
|
|
241
|
-
if (typeof hashOrHeight === 'number') return this.api.getGenerationByHeight(hashOrHeight);
|
|
242
|
-
throw new ArgumentError('hashOrHeight', 'a string or number', hashOrHeight);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async function getMicroBlockTransactions(hash) {
|
|
246
|
-
return (await this.api.getMicroBlockTransactionsByHash(hash)).transactions;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
async function getKeyBlock(hashOrHeight) {
|
|
250
|
-
if (typeof hashOrHeight === 'string') return this.api.getKeyBlockByHash(hashOrHeight);
|
|
251
|
-
if (typeof hashOrHeight === 'number') return this.api.getKeyBlockByHeight(hashOrHeight);
|
|
252
|
-
throw new ArgumentError('hashOrHeight', 'a string or number', hashOrHeight);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async function getMicroBlockHeader(hash) {
|
|
256
|
-
return this.api.getMicroBlockHeaderByHash(hash);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
async function txDryRunHandler(key) {
|
|
260
|
-
const rs = this._txDryRun[key];
|
|
261
|
-
delete this._txDryRun[key];
|
|
262
|
-
let dryRunRes;
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
dryRunRes = await this.api.protectedDryRunTxs({
|
|
266
|
-
top: rs[0].top,
|
|
267
|
-
txEvents: rs[0].txEvents,
|
|
268
|
-
txs: rs.map(req => ({
|
|
269
|
-
tx: req.tx
|
|
270
|
-
})),
|
|
271
|
-
accounts: Array.from(new Set(rs.map(req => req.accountAddress))).map(pubKey => ({
|
|
272
|
-
pubKey,
|
|
273
|
-
amount: DRY_RUN_ACCOUNT.amount
|
|
274
|
-
}))
|
|
275
|
-
});
|
|
276
|
-
} catch (error) {
|
|
277
|
-
rs.forEach(_ref => {
|
|
278
|
-
let {
|
|
279
|
-
reject
|
|
280
|
-
} = _ref;
|
|
281
|
-
return reject(error);
|
|
282
|
-
});
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const {
|
|
287
|
-
results,
|
|
288
|
-
txEvents
|
|
289
|
-
} = dryRunRes;
|
|
290
|
-
results.forEach((_ref2, idx) => {
|
|
291
|
-
let {
|
|
292
|
-
result,
|
|
293
|
-
reason,
|
|
294
|
-
...resultPayload
|
|
295
|
-
} = _ref2;
|
|
296
|
-
const {
|
|
297
|
-
resolve,
|
|
298
|
-
reject,
|
|
299
|
-
tx,
|
|
300
|
-
options,
|
|
301
|
-
accountAddress
|
|
302
|
-
} = rs[idx];
|
|
303
|
-
if (result === 'ok') return resolve({ ...resultPayload,
|
|
304
|
-
txEvents
|
|
305
|
-
});
|
|
306
|
-
reject(Object.assign(new DryRunError(reason), {
|
|
307
|
-
tx,
|
|
308
|
-
accountAddress,
|
|
309
|
-
options
|
|
310
|
-
}));
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
async function txDryRun(tx, accountAddress, _ref3) {
|
|
315
|
-
var _this$_txDryRun, _this$_txDryRun2, _this$_txDryRun2$key;
|
|
316
|
-
|
|
317
|
-
let {
|
|
318
|
-
top,
|
|
319
|
-
txEvents,
|
|
320
|
-
combine
|
|
321
|
-
} = _ref3;
|
|
322
|
-
const key = combine ? [top, txEvents].join() : 'immediate';
|
|
323
|
-
(_this$_txDryRun = this._txDryRun) !== null && _this$_txDryRun !== void 0 ? _this$_txDryRun : this._txDryRun = {};
|
|
324
|
-
(_this$_txDryRun2$key = (_this$_txDryRun2 = this._txDryRun)[key]) !== null && _this$_txDryRun2$key !== void 0 ? _this$_txDryRun2$key : _this$_txDryRun2[key] = [];
|
|
325
|
-
return new Promise((resolve, reject) => {
|
|
326
|
-
var _this$_txDryRun$key, _this$_txDryRun$key$t;
|
|
327
|
-
|
|
328
|
-
this._txDryRun[key].push({
|
|
329
|
-
tx,
|
|
330
|
-
accountAddress,
|
|
331
|
-
top,
|
|
332
|
-
txEvents,
|
|
333
|
-
resolve,
|
|
334
|
-
reject
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
if (!combine) {
|
|
338
|
-
txDryRunHandler.call(this, key);
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
(_this$_txDryRun$key$t = (_this$_txDryRun$key = this._txDryRun[key]).timeout) !== null && _this$_txDryRun$key$t !== void 0 ? _this$_txDryRun$key$t : _this$_txDryRun$key.timeout = setTimeout(txDryRunHandler.bind(this, key));
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
async function getContractByteCode(contractId) {
|
|
347
|
-
return this.api.getContractCode(contractId);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
async function getContract(contractId) {
|
|
351
|
-
return this.api.getContract(contractId);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
async function getName(name) {
|
|
355
|
-
return this.api.getNameEntryByName(name);
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Resolve AENS name and return name hash
|
|
359
|
-
* @param {String} nameOrId
|
|
360
|
-
* @param {String} key in AENS pointers record
|
|
361
|
-
* @param {Object} [options]
|
|
362
|
-
* @param {Boolean} [options.verify] To ensure that name exist and have a corresponding pointer
|
|
363
|
-
* // TODO: avoid that to don't trust to current api gateway
|
|
364
|
-
* @param {Boolean} [options.resolveByNode] Enables pointer resolving using node
|
|
365
|
-
* @return {String} Address or AENS name hash
|
|
366
|
-
*/
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
async function resolveName(nameOrId, key) {
|
|
370
|
-
let {
|
|
371
|
-
verify,
|
|
372
|
-
resolveByNode
|
|
373
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
374
|
-
|
|
375
|
-
if (!nameOrId || typeof nameOrId !== 'string') {
|
|
376
|
-
throw new InvalidAensNameError(`Name or address should be a string: ${nameOrId}`);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
try {
|
|
380
|
-
decode(nameOrId);
|
|
381
|
-
return nameOrId;
|
|
382
|
-
} catch (error) {}
|
|
383
|
-
|
|
384
|
-
if (isNameValid(nameOrId)) {
|
|
385
|
-
if (verify || resolveByNode) {
|
|
386
|
-
const name = await this.api.getNameEntryByName(nameOrId);
|
|
387
|
-
const pointer = name.pointers.find(pointer => pointer.key === key);
|
|
388
|
-
|
|
389
|
-
if (!pointer) {
|
|
390
|
-
throw new AensPointerContextError(`Name ${nameOrId} don't have pointers for ${key}`);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (resolveByNode) return pointer.id;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return produceNameId(nameOrId);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
throw new InvalidAensNameError(`Invalid name or address: ${nameOrId}`);
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* ChainNode Stamp
|
|
403
|
-
*
|
|
404
|
-
* This is implementation of {@link module:@aeternity/aepp-sdk/es/chain--Chain}
|
|
405
|
-
* composed with {@link module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI} and
|
|
406
|
-
* {@link module:@aeternity/aepp-sdk/es/oracle/node--OracleNodeAPI}
|
|
407
|
-
* @function
|
|
408
|
-
* @alias module:@aeternity/aepp-sdk/es/chain/node
|
|
409
|
-
* @rtype Stamp
|
|
410
|
-
* @param {Object} [options={}] - Initializer object
|
|
411
|
-
* @return {Object} ChainNode instance
|
|
412
|
-
* @example ChainNode({url: 'https://testnet.aeternity.io/'})
|
|
413
|
-
*/
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
const ChainNode = Chain.compose(NodePool, {
|
|
417
|
-
methods: {
|
|
418
|
-
sendTransaction,
|
|
419
|
-
balance,
|
|
420
|
-
getBalance,
|
|
421
|
-
getAccount,
|
|
422
|
-
tx,
|
|
423
|
-
height,
|
|
424
|
-
awaitHeight,
|
|
425
|
-
poll,
|
|
426
|
-
getTxInfo,
|
|
427
|
-
mempool,
|
|
428
|
-
getCurrentGeneration,
|
|
429
|
-
getGeneration,
|
|
430
|
-
getMicroBlockHeader,
|
|
431
|
-
getMicroBlockTransactions,
|
|
432
|
-
getKeyBlock,
|
|
433
|
-
txDryRun,
|
|
434
|
-
getContractByteCode,
|
|
435
|
-
getContract,
|
|
436
|
-
getName,
|
|
437
|
-
waitForTxConfirm,
|
|
438
|
-
resolveName
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
export default ChainNode;
|
|
442
|
-
//# sourceMappingURL=node.mjs.map
|
package/es/chain/node.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/chain/node.js"],"names":["Chain","AE_AMOUNT_FORMATS","formatAmount","verifyTransaction","NodePool","pause","isNameValid","produceNameId","decode","DRY_RUN_ACCOUNT","AensPointerContextError","DryRunError","InvalidAensNameError","InvalidTxError","RequestTimedOutError","TxTimedOutError","TxNotInChainError","ArgumentError","sendTransaction","tx","options","opt","Ae","defaults","verify","validation","selectedNode","instance","length","message","map","v","join","Object","assign","code","transaction","txHash","api","postTransaction","__queue","address","catch","waitMined","txData","poll","rawTx","confirm","confirmationHeight","waitForTxConfirm","hash","error","verifyTx","blockHeight","getTransactionByHash","height","awaitHeight","newBlockHeight","getAccount","getAccountByPubkeyAndHeight","getAccountByPubkeyAndHash","getAccountByPubkey","balance","format","AETTOS","targetDenomination","toString","getBalance","_","info","includes","type","getTxInfo","e","getCurrentKeyBlockHeight","interval","_getPollInterval","attempts","currentHeight","i","th","blocks","max","status","getCheckTxInPool","result","getTransactionInfoByHash","callInfo","mempool","getPendingTransactions","getCurrentGeneration","getGeneration","hashOrHeight","getGenerationByHash","getGenerationByHeight","getMicroBlockTransactions","getMicroBlockTransactionsByHash","transactions","getKeyBlock","getKeyBlockByHash","getKeyBlockByHeight","getMicroBlockHeader","getMicroBlockHeaderByHash","txDryRunHandler","key","rs","_txDryRun","dryRunRes","protectedDryRunTxs","top","txEvents","txs","req","accounts","Array","from","Set","accountAddress","pubKey","amount","forEach","reject","results","idx","reason","resultPayload","resolve","txDryRun","combine","Promise","push","call","timeout","setTimeout","bind","getContractByteCode","contractId","getContractCode","getContract","getName","name","getNameEntryByName","resolveName","nameOrId","resolveByNode","pointer","pointers","find","id","ChainNode","compose","methods"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;OACOA,K;SACEC,iB,EAAmBC,Y;OACrBC,iB;OACAC,Q;SACEC,K;SACAC,W,EAAaC,a,EAAeC,M;SAC5BC,e;SAEPC,uB,EACAC,W,EACAC,oB,EACAC,c,EACAC,oB,EACAC,e,EACAC,iB,EACAC,a;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAeC,eAAf,CAAgCC,EAAhC,EAAkD;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AAChD,QAAMC,GAAG,GAAG,EAAE,GAAG,KAAKC,EAAL,CAAQC,QAAb;AAAuB,OAAGH;AAA1B,GAAZ;;AACA,MAAIC,GAAG,CAACG,MAAR,EAAgB;AACd,UAAMC,UAAU,GAAG,MAAMtB,iBAAiB,CAACgB,EAAD,EAAK,KAAKO,YAAL,CAAkBC,QAAvB,CAA1C;;AACA,QAAIF,UAAU,CAACG,MAAf,EAAuB;AACrB,YAAMC,OAAO,GAAG,sCACdJ,UAAU,CAACK,GAAX,CAAeC,CAAC,IAAIA,CAAC,CAACF,OAAtB,EAA+BG,IAA/B,CAAoC,IAApC,CADF;AAEA,YAAMC,MAAM,CAACC,MAAP,CAAc,IAAIrB,cAAJ,CAAmBgB,OAAnB,CAAd,EAA2C;AAC/CM,QAAAA,IAAI,EAAE,uBADyC;AAE/CV,QAAAA,UAF+C;AAG/CW,QAAAA,WAAW,EAAEjB;AAHkC,OAA3C,CAAN;AAKD;AACF;;AAED,MAAI;AAAA;;AACF,UAAM;AAAEkB,MAAAA;AAAF,QAAa,MAAM,KAAKC,GAAL,CAASC,eAAT,CAAyB;AAAEpB,MAAAA;AAAF,KAAzB,EAAiC;AACxDqB,MAAAA,OAAO,EAAG,MAAK,wBAAM,KAAKC,OAAX,kDAAM,yBAAerB,OAAf,EAAwBsB,K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AIvI,uBAAJ,CAA6B,QAAOqI,QAAS,4BAA2BvC,GAAI,EAA5E,CAAN;AACD;;AACD,UAAIwC,aAAJ,EAAmB,OAAOC,OAAO,CAACG,EAAf;AACpB;;AACD,WAAO7I,aAAa,CAACwI,QAAD,CAApB;AACD;;AACD,QAAM,IAAInI,oBAAJ,CAA0B,4BAA2BmI,QAAS,EAA9D,CAAN;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMM,SAAS,GAAGrJ,KAAK,CAACsJ,OAAN,CAAclJ,QAAd,EAAwB;AACxCmJ,EAAAA,OAAO,EAAE;AACPrI,IAAAA,eADO;AAEP4C,IAAAA,OAFO;AAGPK,IAAAA,UAHO;AAIPT,IAAAA,UAJO;AAKPvC,IAAAA,EALO;AAMPoC,IAAAA,MANO;AAOPC,IAAAA,WAPO;AAQPX,IAAAA,IARO;AASP2B,IAAAA,SATO;AAUPgB,IAAAA,OAVO;AAWPE,IAAAA,oBAXO;AAYPC,IAAAA,aAZO;AAaPU,IAAAA,mBAbO;AAcPN,IAAAA,yBAdO;AAePG,IAAAA,WAfO;AAgBP6B,IAAAA,QAhBO;AAiBPQ,IAAAA,mBAjBO;AAkBPG,IAAAA,WAlBO;AAmBPC,IAAAA,OAnBO;AAoBP1F,IAAAA,gBApBO;AAqBP6F,IAAAA;AArBO;AAD+B,CAAxB,CAAlB;AA0BA,eAAeO,SAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 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 */\nimport Chain from './'\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../utils/amount-formatter'\nimport verifyTransaction from '../tx/validator'\nimport NodePool from '../node-pool'\nimport { pause } from '../utils/other'\nimport { isNameValid, produceNameId, decode } from '../tx/builder/helpers'\nimport { DRY_RUN_ACCOUNT } from '../tx/builder/schema'\nimport {\n AensPointerContextError,\n DryRunError,\n InvalidAensNameError,\n InvalidTxError,\n RequestTimedOutError,\n TxTimedOutError,\n TxNotInChainError,\n ArgumentError\n} from '../utils/errors'\n\n/**\n * ChainNode module\n *\n * This is the complement to {@link module:@aeternity/aepp-sdk/es/chain}.\n * @module @aeternity/aepp-sdk/es/chain/node\n * @export ChainNode\n * @example import { ChainNode } from '@aeternity/aepp-sdk'\n */\n\nasync function sendTransaction (tx, options = {}) {\n const opt = { ...this.Ae.defaults, ...options }\n if (opt.verify) {\n const validation = await verifyTransaction(tx, this.selectedNode.instance)\n if (validation.length) {\n const message = 'Transaction verification errors: ' +\n validation.map(v => v.message).join(', ')\n throw Object.assign(new InvalidTxError(message), {\n code: 'TX_VERIFICATION_ERROR',\n validation,\n transaction: tx\n })\n }\n }\n\n try {\n const { txHash } = await this.api.postTransaction({ tx }, {\n __queue: `tx-${await this.address?.(options).catch(() => '')}`\n })\n\n if (opt.waitMined) {\n const txData = { ...await this.poll(txHash, options), rawTx: tx }\n // wait for transaction confirmation\n if (options.confirm) {\n return { ...txData, confirmationHeight: await this.waitForTxConfirm(txHash, options) }\n }\n return txData\n }\n return { hash: txHash, rawTx: tx }\n } catch (error) {\n throw Object.assign(error, {\n rawTx: tx,\n verifyTx: () => verifyTransaction(tx, this.selectedNode.instance)\n })\n }\n}\n\nasync function waitForTxConfirm (txHash, options = { confirm: 3 }) {\n options.confirm = options.confirm === true ? 3 : options.confirm\n const { blockHeight } = await this.api.getTransactionByHash(txHash)\n const height = await this.awaitHeight(blockHeight + options.confirm, options)\n const { blockHeight: newBlockHeight } = await this.api.getTransactionByHash(txHash)\n switch (newBlockHeight) {\n case -1:\n throw new TxNotInChainError(txHash)\n case blockHeight:\n return height\n default:\n return waitForTxConfirm(txHash, options)\n }\n}\n\nasync function getAccount (address, { height, hash } = {}) {\n if (height) return this.api.getAccountByPubkeyAndHeight(address, height)\n if (hash) return this.api.getAccountByPubkeyAndHash(address, hash)\n return this.api.getAccountByPubkey(address)\n}\n\n/**\n * @function\n * @deprecated\n */\nasync function balance (address, { height, hash, format = AE_AMOUNT_FORMATS.AETTOS } = {}) {\n const { balance } = await this.getAccount(address, { hash, height })\n\n return formatAmount(balance, { targetDenomination: format }).toString()\n}\n\nasync function getBalance (address, { height, hash, format = AE_AMOUNT_FORMATS.AETTOS } = {}) {\n const { balance } = await this.getAccount(address, { hash, height }).catch(_ => ({ balance: 0 }))\n\n return formatAmount(balance, { targetDenomination: format }).toString()\n}\n\n/**\n * @deprecated use `sdk.api.getTransactionByHash/getTransactionInfoByHash` instead\n */\nasync function tx (hash, info = true) {\n const tx = await this.api.getTransactionByHash(hash)\n if (['ContractCreateTx', 'ContractCallTx', 'ChannelForceProgressTx'].includes(tx.tx.type) && info && tx.blockHeight !== -1) {\n try {\n return { ...tx, ...await this.getTxInfo(hash) }\n } catch (e) {}\n }\n return tx\n}\n\nasync function height () {\n return (await this.api.getCurrentKeyBlockHeight()).height\n}\n\nasync function awaitHeight (\n height,\n { interval = this._getPollInterval('block'), attempts = 20 } = {}\n) {\n let currentHeight\n for (let i = 0; i < attempts; i++) {\n if (i) await pause(interval)\n currentHeight = await this.height()\n if (currentHeight >= height) return currentHeight\n }\n throw new RequestTimedOutError((attempts - 1) * interval, currentHeight, height)\n}\n\nasync function poll (th, { blocks = 10, interval = this._getPollInterval('microblock') } = {}) {\n const max = await this.height() + blocks\n do {\n const tx = await this.api.getTransactionByHash(th)\n if (tx.blockHeight !== -1) return tx\n await pause(interval)\n } while (await this.height() < max)\n const status = this.api.getCheckTxInPool && (await this.api.getCheckTxInPool(th)).status\n throw new TxTimedOutError(blocks, th, status)\n}\n\n/**\n * @deprecated use `sdk.api.getTransactionInfoByHash` instead\n */\nasync function getTxInfo (hash) {\n const result = await this.api.getTransactionInfoByHash(hash)\n return result.callInfo || result\n}\n\nasync function mempool () {\n return this.api.getPendingTransactions()\n}\n\nasync function getCurrentGeneration () {\n return this.api.getCurrentGeneration()\n}\n\nasync function getGeneration (hashOrHeight) {\n if (typeof hashOrHeight === 'string') return this.api.getGenerationByHash(hashOrHeight)\n if (typeof hashOrHeight === 'number') return this.api.getGenerationByHeight(hashOrHeight)\n throw new ArgumentError('hashOrHeight', 'a string or number', hashOrHeight)\n}\n\nasync function getMicroBlockTransactions (hash) {\n return (await this.api.getMicroBlockTransactionsByHash(hash)).transactions\n}\n\nasync function getKeyBlock (hashOrHeight) {\n if (typeof hashOrHeight === 'string') return this.api.getKeyBlockByHash(hashOrHeight)\n if (typeof hashOrHeight === 'number') return this.api.getKeyBlockByHeight(hashOrHeight)\n throw new ArgumentError('hashOrHeight', 'a string or number', hashOrHeight)\n}\n\nasync function getMicroBlockHeader (hash) {\n return this.api.getMicroBlockHeaderByHash(hash)\n}\n\nasync function txDryRunHandler (key) {\n const rs = this._txDryRun[key]\n delete this._txDryRun[key]\n\n let dryRunRes\n try {\n dryRunRes = await this.api.protectedDryRunTxs({\n top: rs[0].top,\n txEvents: rs[0].txEvents,\n txs: rs.map(req => ({ tx: req.tx })),\n accounts: Array.from(new Set(rs.map(req => req.accountAddress)))\n .map(pubKey => ({ pubKey, amount: DRY_RUN_ACCOUNT.amount }))\n })\n } catch (error) {\n rs.forEach(({ reject }) => reject(error))\n return\n }\n\n const { results, txEvents } = dryRunRes\n results.forEach(({ result, reason, ...resultPayload }, idx) => {\n const { resolve, reject, tx, options, accountAddress } = rs[idx]\n if (result === 'ok') return resolve({ ...resultPayload, txEvents })\n reject(Object.assign(\n new DryRunError(reason), { tx, accountAddress, options }\n ))\n })\n}\n\nasync function txDryRun (tx, accountAddress, { top, txEvents, combine }) {\n const key = combine ? [top, txEvents].join() : 'immediate'\n this._txDryRun ??= {}\n this._txDryRun[key] ??= []\n return new Promise((resolve, reject) => {\n this._txDryRun[key].push({ tx, accountAddress, top, txEvents, resolve, reject })\n if (!combine) {\n txDryRunHandler.call(this, key)\n return\n }\n this._txDryRun[key].timeout ??= setTimeout(txDryRunHandler.bind(this, key))\n })\n}\n\nasync function getContractByteCode (contractId) {\n return this.api.getContractCode(contractId)\n}\n\nasync function getContract (contractId) {\n return this.api.getContract(contractId)\n}\n\nasync function getName (name) {\n return this.api.getNameEntryByName(name)\n}\n\n/**\n * Resolve AENS name and return name hash\n * @param {String} nameOrId\n * @param {String} key in AENS pointers record\n * @param {Object} [options]\n * @param {Boolean} [options.verify] To ensure that name exist and have a corresponding pointer\n * // TODO: avoid that to don't trust to current api gateway\n * @param {Boolean} [options.resolveByNode] Enables pointer resolving using node\n * @return {String} Address or AENS name hash\n */\nasync function resolveName (nameOrId, key, { verify, resolveByNode } = {}) {\n if (!nameOrId || typeof nameOrId !== 'string') {\n throw new InvalidAensNameError(`Name or address should be a string: ${nameOrId}`)\n }\n try {\n decode(nameOrId)\n return nameOrId\n } catch (error) {}\n if (isNameValid(nameOrId)) {\n if (verify || resolveByNode) {\n const name = await this.api.getNameEntryByName(nameOrId)\n const pointer = name.pointers.find(pointer => pointer.key === key)\n if (!pointer) {\n throw new AensPointerContextError(`Name ${nameOrId} don't have pointers for ${key}`)\n }\n if (resolveByNode) return pointer.id\n }\n return produceNameId(nameOrId)\n }\n throw new InvalidAensNameError(`Invalid name or address: ${nameOrId}`)\n}\n\n/**\n * ChainNode Stamp\n *\n * This is implementation of {@link module:@aeternity/aepp-sdk/es/chain--Chain}\n * composed with {@link module:@aeternity/aepp-sdk/es/contract/node--ContractNodeAPI} and\n * {@link module:@aeternity/aepp-sdk/es/oracle/node--OracleNodeAPI}\n * @function\n * @alias module:@aeternity/aepp-sdk/es/chain/node\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} ChainNode instance\n * @example ChainNode({url: 'https://testnet.aeternity.io/'})\n */\nconst ChainNode = Chain.compose(NodePool, {\n methods: {\n sendTransaction,\n balance,\n getBalance,\n getAccount,\n tx,\n height,\n awaitHeight,\n poll,\n getTxInfo,\n mempool,\n getCurrentGeneration,\n getGeneration,\n getMicroBlockHeader,\n getMicroBlockTransactions,\n getKeyBlock,\n txDryRun,\n getContractByteCode,\n getContract,\n getName,\n waitForTxConfirm,\n resolveName\n }\n})\n\nexport default ChainNode\n"],"file":"node.mjs"}
|
package/es/contract/compiler.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2021 aeternity developers
|
|
4
|
-
*
|
|
5
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
* copyright notice and this permission notice appear in all copies.
|
|
8
|
-
*
|
|
9
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* ContractCompilerHttp module
|
|
20
|
-
*
|
|
21
|
-
* @module @aeternity/aepp-sdk/es/contract/compiler
|
|
22
|
-
* @export ContractCompilerHttp
|
|
23
|
-
* @example import { ContractCompilerHttp } from '@aeternity/aepp-sdk'
|
|
24
|
-
*/
|
|
25
|
-
import semverSatisfies from "../utils/semver-satisfies.mjs";
|
|
26
|
-
import AsyncInit from "../utils/async-init.mjs";
|
|
27
|
-
import genSwaggerClient from "../utils/swagger.mjs";
|
|
28
|
-
import { MissingParamError, UnsupportedVersionError } from "../utils/errors.mjs";
|
|
29
|
-
import { mapObject } from "../utils/other.mjs";
|
|
30
|
-
/**
|
|
31
|
-
* Contract Compiler Stamp
|
|
32
|
-
*
|
|
33
|
-
* This stamp include api call's related to contract compiler functionality.
|
|
34
|
-
* @function
|
|
35
|
-
* @alias module:@aeternity/aepp-sdk/es/contract/compiler
|
|
36
|
-
* @rtype Stamp
|
|
37
|
-
* @param {Object} [options={}] - Initializer object
|
|
38
|
-
* @param {String} [options.compilerUrl] compilerUrl - Url for compiler API
|
|
39
|
-
* @return {Object} Contract compiler instance
|
|
40
|
-
* @example ContractCompilerHttp({ compilerUrl: 'COMPILER_URL' })
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export default AsyncInit.compose({
|
|
44
|
-
async init(_ref) {
|
|
45
|
-
let {
|
|
46
|
-
compilerUrl,
|
|
47
|
-
ignoreVersion
|
|
48
|
-
} = _ref;
|
|
49
|
-
if (!compilerUrl) return;
|
|
50
|
-
await this.setCompilerUrl(compilerUrl, {
|
|
51
|
-
ignoreVersion
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
methods: {
|
|
56
|
-
async setCompilerUrl(compilerUrl) {
|
|
57
|
-
let {
|
|
58
|
-
ignoreVersion = false
|
|
59
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
60
|
-
if (!compilerUrl) throw new MissingParamError('compilerUrl required');
|
|
61
|
-
compilerUrl = compilerUrl.replace(/\/$/, '');
|
|
62
|
-
const client = await genSwaggerClient(`${compilerUrl}/api`, {
|
|
63
|
-
disableBigNumbers: true,
|
|
64
|
-
disableCaseConversion: true,
|
|
65
|
-
responseInterceptor: response => {
|
|
66
|
-
if (response.ok) return;
|
|
67
|
-
let message = `${new URL(response.url).pathname.slice(1)} error`;
|
|
68
|
-
|
|
69
|
-
if (response.body.reason) {
|
|
70
|
-
message += ': ' + response.body.reason + (response.body.parameter ? ` in ${response.body.parameter}` : '') + ( // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78
|
|
71
|
-
response.body.info ? ` (${JSON.stringify(response.body.info)})` : '');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (Array.isArray(response.body)) {
|
|
75
|
-
message += ':\n' + response.body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context ? `(${e.context})` : ''}`).map(e => e.trim()) // TODO: remove after fixing https://github.com/aeternity/aesophia_http/issues/80
|
|
76
|
-
.join('\n');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
response.statusText = message;
|
|
80
|
-
return response;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
this.compilerVersion = client.spec.info.version;
|
|
84
|
-
this.compilerApi = mapObject(client.api, _ref2 => {
|
|
85
|
-
let [key, fn] = _ref2;
|
|
86
|
-
return [key, function () {
|
|
87
|
-
let {
|
|
88
|
-
options: {
|
|
89
|
-
filesystem,
|
|
90
|
-
...options
|
|
91
|
-
} = {},
|
|
92
|
-
...args
|
|
93
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
94
|
-
return fn({ ...args,
|
|
95
|
-
options: { ...options,
|
|
96
|
-
file_system: filesystem
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}];
|
|
100
|
-
});
|
|
101
|
-
if (ignoreVersion) return;
|
|
102
|
-
|
|
103
|
-
if (!semverSatisfies(this.compilerVersion, COMPILER_GE_VERSION, COMPILER_LT_VERSION)) {
|
|
104
|
-
throw new UnsupportedVersionError('compiler', this.compilerVersion, COMPILER_GE_VERSION, COMPILER_LT_VERSION);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
props: {
|
|
110
|
-
compilerVersion: null
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const COMPILER_GE_VERSION = '6.1.0';
|
|
114
|
-
const COMPILER_LT_VERSION = '7.0.0';
|
|
115
|
-
//# sourceMappingURL=compiler.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contract/compiler.js"],"names":["semverSatisfies","AsyncInit","genSwaggerClient","MissingParamError","UnsupportedVersionError","mapObject","compose","init","compilerUrl","ignoreVersion","setCompilerUrl","methods","replace","client","disableBigNumbers","disableCaseConversion","responseInterceptor","response","ok","message","URL","url","pathname","slice","body","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","trim","join","statusText","compilerVersion","spec","version","compilerApi","api","key","fn","options","filesystem","args","file_system","COMPILER_GE_VERSION","COMPILER_LT_VERSION","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;OAEOA,e;OACAC,S;OACAC,gB;SACEC,iB,EAAmBC,uB;SACnBC,S;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeJ,SAAS,CAACK,OAAV,CAAkB;AAC/B,QAAMC,IAAN,OAA4C;AAAA,QAAhC;AAAEC,MAAAA,WAAF;AAAeC,MAAAA;AAAf,KAAgC;AAC1C,QAAI,CAACD,WAAL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,EAC8BW,mBAD9B,EACmDC,mBADnD,CAAN;AAGD;AACF;;AA3CM,GALsB;AAkD/BC,EAAAA,KAAK,EAAE;AACLb,IAAAA,eAAe,EAAE;AADZ;AAlDwB,CAAlB,CAAf;AAuDA,MAAMW,mBAAmB,GAAG,OAA5B;AACA,MAAMC,mBAAmB,GAAG,OAA5B","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 * ContractCompilerHttp module\n *\n * @module @aeternity/aepp-sdk/es/contract/compiler\n * @export ContractCompilerHttp\n * @example import { ContractCompilerHttp } from '@aeternity/aepp-sdk'\n */\n\nimport semverSatisfies from '../utils/semver-satisfies'\nimport AsyncInit from '../utils/async-init'\nimport genSwaggerClient from '../utils/swagger'\nimport { MissingParamError, UnsupportedVersionError } from '../utils/errors'\nimport { mapObject } from '../utils/other'\n\n/**\n * Contract Compiler Stamp\n *\n * This stamp include api call's related to contract compiler functionality.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/contract/compiler\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {String} [options.compilerUrl] compilerUrl - Url for compiler API\n * @return {Object} Contract compiler instance\n * @example ContractCompilerHttp({ compilerUrl: 'COMPILER_URL' })\n */\nexport default AsyncInit.compose({\n async init ({ compilerUrl, ignoreVersion }) {\n if (!compilerUrl) return\n await this.setCompilerUrl(compilerUrl, { ignoreVersion })\n },\n methods: {\n async setCompilerUrl (compilerUrl, { ignoreVersion = false } = {}) {\n if (!compilerUrl) throw new MissingParamError('compilerUrl required')\n compilerUrl = compilerUrl.replace(/\\/$/, '')\n const client = await genSwaggerClient(`${compilerUrl}/api`, {\n disableBigNumbers: true,\n disableCaseConversion: true,\n responseInterceptor: response => {\n if (response.ok) return\n let message = `${new URL(response.url).pathname.slice(1)} error`\n if (response.body.reason) {\n message += ': ' + response.body.reason +\n (response.body.parameter ? ` in ${response.body.parameter}` : '') +\n // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78\n (response.body.info ? ` (${JSON.stringify(response.body.info)})` : '')\n }\n if (Array.isArray(response.body)) {\n message += ':\\n' + response.body\n .map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context ? `(${e.context})` : ''}`)\n .map(e => e.trim()) // TODO: remove after fixing https://github.com/aeternity/aesophia_http/issues/80\n .join('\\n')\n }\n response.statusText = message\n return response\n }\n })\n this.compilerVersion = client.spec.info.version\n this.compilerApi = mapObject(\n client.api,\n ([key, fn]) => [\n key,\n ({ options: { filesystem, ...options } = {}, ...args } = {}) => fn({\n ...args, options: { ...options, file_system: filesystem }\n })\n ]\n )\n\n if (ignoreVersion) return\n if (!semverSatisfies(this.compilerVersion, COMPILER_GE_VERSION, COMPILER_LT_VERSION)) {\n throw new UnsupportedVersionError(\n 'compiler', this.compilerVersion, COMPILER_GE_VERSION, COMPILER_LT_VERSION\n )\n }\n }\n },\n props: {\n compilerVersion: null\n }\n})\n\nconst COMPILER_GE_VERSION = '6.1.0'\nconst COMPILER_LT_VERSION = '7.0.0'\n"],"file":"compiler.mjs"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { MAX_AUTH_FUN_GAS } from "../../tx/builder/schema.mjs";
|
|
3
|
-
import { InvalidAuthDataError } from "../../utils/errors.mjs";
|
|
4
|
-
export const prepareGaParams = ins => async (authData, authFnName) => {
|
|
5
|
-
if (typeof authData !== 'object') throw new InvalidAuthDataError('AuthData must be an object');
|
|
6
|
-
|
|
7
|
-
if (authData.gas && BigNumber(authData.gas).gt(MAX_AUTH_FUN_GAS)) {
|
|
8
|
-
throw new InvalidAuthDataError(`the maximum gas value for ga authFun is ${MAX_AUTH_FUN_GAS}, got ${authData.gas}`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const gas = authData.gas || MAX_AUTH_FUN_GAS;
|
|
12
|
-
|
|
13
|
-
if (authData.callData) {
|
|
14
|
-
if (authData.callData.split('_')[0] !== 'cb') throw new InvalidAuthDataError('Auth data must be a string with "cb" prefix.');
|
|
15
|
-
return {
|
|
16
|
-
authCallData: authData.callData,
|
|
17
|
-
gas
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!authData.source || !authData.args) throw new InvalidAuthDataError('Auth data must contain source code and arguments.');
|
|
22
|
-
const contract = await ins.getContractInstance({
|
|
23
|
-
source: authData.source
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
authCallData: contract.calldata.encode(contract._name, authFnName, authData.args),
|
|
27
|
-
gas
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/contract/ga/helpers.js"],"names":["BigNumber","MAX_AUTH_FUN_GAS","InvalidAuthDataError","prepareGaParams","ins","authData","authFnName","gas","gt","callData","split","authCallData","source","args","contract","getContractInstance","calldata","encode","_name"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,gB;SACAC,oB;AAET,OAAO,MAAMC,eAAe,GAAIC,GAAD,IAAS,OA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port const prepareGaParams = (ins) => async (authData, authFnName) => {\n if (typeof authData !== 'object') throw new InvalidAuthDataError('AuthData must be an object')\n if (authData.gas && BigNumber(authData.gas).gt(MAX_AUTH_FUN_GAS)) { throw new InvalidAuthDataError(`the maximum gas value for ga authFun is ${MAX_AUTH_FUN_GAS}, got ${authData.gas}`) }\n const gas = authData.gas || MAX_AUTH_FUN_GAS\n if (authData.callData) {\n if (authData.callData.split('_')[0] !== 'cb') throw new InvalidAuthDataError('Auth data must be a string with \"cb\" prefix.')\n return { authCallData: authData.callData, gas }\n }\n if (!authData.source || !authData.args) throw new InvalidAuthDataError('Auth data must contain source code and arguments.')\n const contract = await ins.getContractInstance({ source: authData.source })\n return {\n authCallData: contract.calldata.encode(contract._name, authFnName, authData.args),\n gas\n }\n}\n"],"file":"helpers.mjs"}
|