@aeternity/aepp-sdk 11.0.1 → 12.1.1
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 +20765 -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 +136 -85
- 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 +61 -47
- package/es/tx/builder/constants.mjs.map +1 -1
- 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 -198
- 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 -561
- 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 -98
- 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 +71 -59
- package/es/utils/encoder.mjs.map +1 -1
- 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 +55 -43
- 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 +172 -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 +116 -71
- 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/encoder.d.ts +0 -26
- 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 -903
- package/src/channel/internal.js +0 -236
- 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/constants.js +0 -100
- package/src/tx/builder/field-types.js +0 -61
- package/src/tx/builder/helpers.js +0 -334
- package/src/tx/builder/index.js +0 -465
- package/src/tx/builder/schema.js +0 -1100
- 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 -219
- 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/contract/ga/index.mjs
DELETED
|
@@ -1,178 +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
|
-
* Generalized Account module - routines to use generalized account
|
|
20
|
-
*
|
|
21
|
-
* @module @aeternity/aepp-sdk/es/contract/ga
|
|
22
|
-
* @export GeneralizedAccount
|
|
23
|
-
* @example import { GeneralizedAccount } from '@aeternity/aepp-sdk'
|
|
24
|
-
*/
|
|
25
|
-
import Contract from "../../ae/contract.mjs";
|
|
26
|
-
import { TX_TYPE } from "../../tx/builder/schema.mjs";
|
|
27
|
-
import { buildTx, unpackTx } from "../../tx/builder/index.mjs";
|
|
28
|
-
import { prepareGaParams } from "./helpers.mjs";
|
|
29
|
-
import { hash } from "../../utils/crypto.mjs";
|
|
30
|
-
import { IllegalArgumentError, MissingParamError } from "../../utils/errors.mjs";
|
|
31
|
-
/**
|
|
32
|
-
* GeneralizedAccount Stamp
|
|
33
|
-
*
|
|
34
|
-
* Provide Generalized Account implementation
|
|
35
|
-
* {@link module:@aeternity/aepp-sdk/es/contract/ga} clients.
|
|
36
|
-
* @function
|
|
37
|
-
* @alias module:@aeternity/aepp-sdk/es/contract/ga
|
|
38
|
-
* @rtype Stamp
|
|
39
|
-
* @param {Object} [options={}] - Initializer object
|
|
40
|
-
* @return {Object} GeneralizedAccount instance
|
|
41
|
-
* @example
|
|
42
|
-
* const authContract = ``
|
|
43
|
-
* await aeSdk.createGeneralizedAccount(authFnName, authContract, [...authFnArguments]
|
|
44
|
-
* // Make spend using GA
|
|
45
|
-
* const callData = 'cb_...' // encoded call data for auth contract
|
|
46
|
-
* await aeSdk.spend(10000, receiverPub, { authData: { callData } })
|
|
47
|
-
* // or
|
|
48
|
-
* await aeSdk.spend(10000, receiverPub, {
|
|
49
|
-
* authData: { source: authContract, args: [...authContractArgs] }
|
|
50
|
-
* }) // sdk will prepare callData itself
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export const GeneralizedAccount = Contract.compose({
|
|
54
|
-
methods: {
|
|
55
|
-
createGeneralizedAccount,
|
|
56
|
-
createMetaTx,
|
|
57
|
-
isGA
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
export default GeneralizedAccount;
|
|
61
|
-
/**
|
|
62
|
-
* @alias module:@aeternity/aepp-sdk/es/contract/ga
|
|
63
|
-
* @function
|
|
64
|
-
* Check if account is GA
|
|
65
|
-
* @param {String} address - Account address
|
|
66
|
-
* @return {Boolean}
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
async function isGA(address) {
|
|
70
|
-
const {
|
|
71
|
-
contractId
|
|
72
|
-
} = await this.getAccount(address);
|
|
73
|
-
return !!contractId;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Convert current account to GA
|
|
77
|
-
* @alias module:@aeternity/aepp-sdk/es/contract/ga
|
|
78
|
-
* @function
|
|
79
|
-
* @param {String} authFnName - Authorization function name
|
|
80
|
-
* @param {String} source - Auth contract source code
|
|
81
|
-
* @param {Array} [args] - init arguments
|
|
82
|
-
* @param {Object} [options] - Options
|
|
83
|
-
* @return {Promise<Readonly<{
|
|
84
|
-
* result: *, owner: *, address, rawTx: *, transaction: *
|
|
85
|
-
* }>>}
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
async function createGeneralizedAccount(authFnName, source) {
|
|
90
|
-
var _opt$gas;
|
|
91
|
-
|
|
92
|
-
let args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
93
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
94
|
-
const opt = { ...this.Ae.defaults,
|
|
95
|
-
...options
|
|
96
|
-
};
|
|
97
|
-
const ownerId = await this.address(opt);
|
|
98
|
-
if (await this.isGA(ownerId)) throw new IllegalArgumentError(`Account ${ownerId} is already GA`);
|
|
99
|
-
const contract = await this.getContractInstance({
|
|
100
|
-
source
|
|
101
|
-
});
|
|
102
|
-
await contract.compile();
|
|
103
|
-
const {
|
|
104
|
-
tx,
|
|
105
|
-
contractId
|
|
106
|
-
} = await this.gaAttachTx({ ...opt,
|
|
107
|
-
gas: (_opt$gas = opt.gas) !== null && _opt$gas !== void 0 ? _opt$gas : await contract._estimateGas('init', args, opt),
|
|
108
|
-
ownerId,
|
|
109
|
-
code: contract.bytecode,
|
|
110
|
-
callData: contract.calldata.encode(contract._name, 'init', args),
|
|
111
|
-
authFun: hash(authFnName)
|
|
112
|
-
});
|
|
113
|
-
const {
|
|
114
|
-
hash: transaction,
|
|
115
|
-
rawTx
|
|
116
|
-
} = await this.send(tx, opt);
|
|
117
|
-
return Object.freeze({
|
|
118
|
-
owner: ownerId,
|
|
119
|
-
transaction,
|
|
120
|
-
rawTx,
|
|
121
|
-
gaContractId: contractId
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const wrapInEmptySignedTx = tx => buildTx({
|
|
126
|
-
encodedTx: tx,
|
|
127
|
-
signatures: []
|
|
128
|
-
}, TX_TYPE.signed);
|
|
129
|
-
/**
|
|
130
|
-
* Create a metaTx transaction
|
|
131
|
-
* @alias module:@aeternity/aepp-sdk/es/contract/ga
|
|
132
|
-
* @function
|
|
133
|
-
* @param {String} rawTransaction Inner transaction
|
|
134
|
-
* @param {Object} authData Object with gaMeta params
|
|
135
|
-
* @param {String} authFnName - Authorization function name
|
|
136
|
-
* @param {Object} options - Options
|
|
137
|
-
* @return {String}
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
async function createMetaTx(rawTransaction, authData, authFnName) {
|
|
142
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
143
|
-
if (!authData) throw new MissingParamError('authData is required'); // Check if authData is callData or if it's an object prepare a callData from source and args
|
|
144
|
-
|
|
145
|
-
const {
|
|
146
|
-
authCallData,
|
|
147
|
-
gas
|
|
148
|
-
} = await prepareGaParams(this)(authData, authFnName);
|
|
149
|
-
const opt = { ...this.Ae.defaults,
|
|
150
|
-
...options
|
|
151
|
-
};
|
|
152
|
-
const {
|
|
153
|
-
abiVersion
|
|
154
|
-
} = await this.getVmVersion(TX_TYPE.contractCall);
|
|
155
|
-
const wrappedTx = wrapInEmptySignedTx(unpackTx(rawTransaction));
|
|
156
|
-
const params = { ...opt,
|
|
157
|
-
tx: { ...wrappedTx,
|
|
158
|
-
tx: wrappedTx.txObject
|
|
159
|
-
},
|
|
160
|
-
gaId: await this.address(opt),
|
|
161
|
-
abiVersion,
|
|
162
|
-
authData: authCallData,
|
|
163
|
-
gas,
|
|
164
|
-
vsn: 2
|
|
165
|
-
};
|
|
166
|
-
const {
|
|
167
|
-
fee
|
|
168
|
-
} = await this.prepareTxParams(TX_TYPE.gaMeta, params);
|
|
169
|
-
const {
|
|
170
|
-
rlpEncoded: metaTxRlp
|
|
171
|
-
} = buildTx({ ...params,
|
|
172
|
-
fee: `${fee}`
|
|
173
|
-
}, TX_TYPE.gaMeta, {
|
|
174
|
-
vsn: 2
|
|
175
|
-
});
|
|
176
|
-
return wrapInEmptySignedTx(metaTxRlp).tx;
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/contract/ga/index.js"],"names":["Contract","TX_TYPE","buildTx","unpackTx","prepareGaParams","hash","IllegalArgumentError","MissingParamError","GeneralizedAccount","compose","methods","createGeneralizedAccount","createMetaTx","isGA","address","contractId","getAccount","authFnName","source","args","options","opt","Ae","defaults","ownerId","contract","getContractInstance","compile","tx","gaAttachTx","gas","_estimateGas","code","bytecode","callData","calldata","encode","_name","authFun","transaction","rawTx","send","Object","freeze","owner","gaContractId","wrapInEmptySignedTx","encodedTx","signatures","signed","rawTransaction","authData","authCallData","abiVersion","getVmVersion","contractCall","wrappedTx","params","txObject","gaId","vsn","fee","prepareTxParams","gaMeta","rlpEncoded","metaTxRlp"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;OACOA,Q;SACEC,O;SACAC,O,EAASC,Q;SACTC,e;SACAC,I;SACAC,oB,EAAsBC,iB;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,kBAAkB,GAAGR,QAAQ,CAACS,OAAT,CAAiB;AACjDC,EAAAA,OAAO,EAAE;AACPC,IAAAA,wBADO;AAEPC,IAAAA,YAFO;AAGPC,IAAAA;AAHO;AADwC,CAAjB,CAA3B;AAOP,eAAeL,kBAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeK,IAAf,CAAqBC,OAArB,EAA8B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAAiB,MAAM,KAAKC,UAAL,CAAgBF,OAAhB,CAA7B;AACA,SAAO,CAAC,CAACC,UAAT;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeJ,wBAAf,CAAyCM,UAAzC,EAAqDC,MAArD,EAAsF;AAAA;;AAAA,MAAzBC,IAAyB,uEAAlB,EAAkB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O,CAAC8D,MAA7B,EAAqCN,MAArC,CAAtB;AACA,QAAM;AAAEO,IAAAA,UAAU,EAAEC;AAAd,MAA4B/D,OAAO,CACvC,EAAE,GAAGuD,MAAL;AAAaI,IAAAA,GAAG,EAAG,GAAEA,GAAI;AAAzB,GADuC,EAEvC5D,OAAO,CAAC8D,MAF+B,EAGvC;AAAEH,IAAAA,GAAG,EAAE;AAAP,GAHuC,CAAzC;AAKA,SAAOd,mBAAmB,CAACmB,SAAD,CAAnB,CAA+BrC,EAAtC;AACD","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 * Generalized Account module - routines to use generalized account\n *\n * @module @aeternity/aepp-sdk/es/contract/ga\n * @export GeneralizedAccount\n * @example import { GeneralizedAccount } from '@aeternity/aepp-sdk'\n */\nimport Contract from '../../ae/contract'\nimport { TX_TYPE } from '../../tx/builder/schema'\nimport { buildTx, unpackTx } from '../../tx/builder'\nimport { prepareGaParams } from './helpers'\nimport { hash } from '../../utils/crypto'\nimport { IllegalArgumentError, MissingParamError } from '../../utils/errors'\n\n/**\n * GeneralizedAccount Stamp\n *\n * Provide Generalized Account implementation\n * {@link module:@aeternity/aepp-sdk/es/contract/ga} clients.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} GeneralizedAccount instance\n * @example\n * const authContract = ``\n * await aeSdk.createGeneralizedAccount(authFnName, authContract, [...authFnArguments]\n * // Make spend using GA\n * const callData = 'cb_...' // encoded call data for auth contract\n * await aeSdk.spend(10000, receiverPub, { authData: { callData } })\n * // or\n * await aeSdk.spend(10000, receiverPub, {\n * authData: { source: authContract, args: [...authContractArgs] }\n * }) // sdk will prepare callData itself\n */\nexport const GeneralizedAccount = Contract.compose({\n methods: {\n createGeneralizedAccount,\n createMetaTx,\n isGA\n }\n})\nexport default GeneralizedAccount\n\n/**\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * Check if account is GA\n * @param {String} address - Account address\n * @return {Boolean}\n */\nasync function isGA (address) {\n const { contractId } = await this.getAccount(address)\n return !!contractId\n}\n\n/**\n * Convert current account to GA\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * @param {String} authFnName - Authorization function name\n * @param {String} source - Auth contract source code\n * @param {Array} [args] - init arguments\n * @param {Object} [options] - Options\n * @return {Promise<Readonly<{\n * result: *, owner: *, address, rawTx: *, transaction: *\n * }>>}\n */\nasync function createGeneralizedAccount (authFnName, source, args = [], options = {}) {\n const opt = { ...this.Ae.defaults, ...options }\n const ownerId = await this.address(opt)\n if (await this.isGA(ownerId)) throw new IllegalArgumentError(`Account ${ownerId} is already GA`)\n\n const contract = await this.getContractInstance({ source })\n await contract.compile()\n const { tx, contractId } = await this.gaAttachTx({\n ...opt,\n gas: opt.gas ?? await contract._estimateGas('init', args, opt),\n ownerId,\n code: contract.bytecode,\n callData: contract.calldata.encode(contract._name, 'init', args),\n authFun: hash(authFnName)\n })\n\n const { hash: transaction, rawTx } = await this.send(tx, opt)\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId\n })\n}\n\nconst wrapInEmptySignedTx = (tx) => buildTx({ encodedTx: tx, signatures: [] }, TX_TYPE.signed)\n\n/**\n * Create a metaTx transaction\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * @param {String} rawTransaction Inner transaction\n * @param {Object} authData Object with gaMeta params\n * @param {String} authFnName - Authorization function name\n * @param {Object} options - Options\n * @return {String}\n */\nasync function createMetaTx (rawTransaction, authData, authFnName, options = {}) {\n if (!authData) throw new MissingParamError('authData is required')\n // Check if authData is callData or if it's an object prepare a callData from source and args\n const { authCallData, gas } = await prepareGaParams(this)(authData, authFnName)\n const opt = { ...this.Ae.defaults, ...options }\n const { abiVersion } = await this.getVmVersion(TX_TYPE.contractCall)\n const wrappedTx = wrapInEmptySignedTx(unpackTx(rawTransaction))\n const params = {\n ...opt,\n tx: {\n ...wrappedTx,\n tx: wrappedTx.txObject\n },\n gaId: await this.address(opt),\n abiVersion,\n authData: authCallData,\n gas,\n vsn: 2\n }\n const { fee } = await this.prepareTxParams(TX_TYPE.gaMeta, params)\n const { rlpEncoded: metaTxRlp } = buildTx(\n { ...params, fee: `${fee}` },\n TX_TYPE.gaMeta,\n { vsn: 2 }\n )\n return wrapInEmptySignedTx(metaTxRlp).tx\n}\n"],"file":"index.mjs"}
|
package/es/crypto-ts.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Data } from 'blakejs';
|
|
3
|
-
/**
|
|
4
|
-
* Calculate 256bits Blake2b hash of `input`
|
|
5
|
-
* @rtype (input: String) => hash: String
|
|
6
|
-
* @param {Data} input - Data to hash
|
|
7
|
-
* @return {Buffer} Hash
|
|
8
|
-
*/
|
|
9
|
-
export declare function hash(input: Data): Buffer;
|
package/es/encoder.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Calculate SHA256 hash of `input`
|
|
4
|
-
* @rtype (input: String) => hash: String
|
|
5
|
-
* @param {Buffer|String} input - Data to hash
|
|
6
|
-
* @return {String} Hash
|
|
7
|
-
*/
|
|
8
|
-
export declare function sha256hash(input: Buffer | string): Buffer;
|
|
9
|
-
/**
|
|
10
|
-
* Decode data using the default encoding/decoding algorithm
|
|
11
|
-
* @function
|
|
12
|
-
* @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers
|
|
13
|
-
* @param {string} data An Base58/64check encoded and prefixed string (ex tx_..., sg_..., ak_....)
|
|
14
|
-
* @param {string} [requiredPrefix] Ensure that data have this prefix
|
|
15
|
-
* @return {Buffer} Decoded data
|
|
16
|
-
*/
|
|
17
|
-
export declare function decode(data: string, requiredPrefix?: string): Buffer;
|
|
18
|
-
/**
|
|
19
|
-
* Encode data using the default encoding/decoding algorithm
|
|
20
|
-
* @function
|
|
21
|
-
* @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers
|
|
22
|
-
* @param {Buffer|String} data An decoded data
|
|
23
|
-
* @param {string} type Prefix of Transaction
|
|
24
|
-
* @return {String} Encoded string Base58check or Base64check data
|
|
25
|
-
*/
|
|
26
|
-
export declare function encode(data: Buffer | string, type: string): string;
|
package/es/node-pool/index.mjs
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodePool module
|
|
3
|
-
* @module @aeternity/aepp-sdk/es/node-pool
|
|
4
|
-
* @export NodePool
|
|
5
|
-
* @example import { NodePool } from '@aeternity/aepp-sdk'
|
|
6
|
-
*/
|
|
7
|
-
import stampit from '@stamp/it';
|
|
8
|
-
import { getNetworkId } from "../node.mjs";
|
|
9
|
-
import { DisconnectedError, DuplicateNodeError, NodeNotFoundError, TypeError } from "../utils/errors.mjs";
|
|
10
|
-
/**
|
|
11
|
-
* Node Pool Stamp
|
|
12
|
-
* This stamp allow you to make basic manipulation(add, remove, select) on list of nodes
|
|
13
|
-
* @function
|
|
14
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
15
|
-
* @rtype Stamp
|
|
16
|
-
* @param {Object} [options={}] - Initializer object
|
|
17
|
-
* @param {Array} [options.nodes] - Array with Node instances
|
|
18
|
-
* @return {Object} NodePool instance
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export default stampit({
|
|
22
|
-
init() {
|
|
23
|
-
let {
|
|
24
|
-
nodes = []
|
|
25
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
-
this.pool = new Map();
|
|
27
|
-
this.validateNodes(nodes);
|
|
28
|
-
nodes.forEach((node, i) => {
|
|
29
|
-
const {
|
|
30
|
-
name,
|
|
31
|
-
instance
|
|
32
|
-
} = node;
|
|
33
|
-
this.addNode(name, instance, i === 0);
|
|
34
|
-
});
|
|
35
|
-
if (nodes.length) this.selectNode(nodes[0].name);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
propertyDescriptors: {
|
|
39
|
-
api: {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: false,
|
|
42
|
-
|
|
43
|
-
get() {
|
|
44
|
-
if (!this.selectedNode || !this.selectedNode.instance) {
|
|
45
|
-
throw new NodeNotFoundError('You can\'t use Node API. Node is not connected or not defined!');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return this.selectedNode.instance.api;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
methods: {
|
|
54
|
-
/**
|
|
55
|
-
* Add Node
|
|
56
|
-
* @function
|
|
57
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
58
|
-
* @rtype (name: String, nodeInstance: Object, select: Boolean) => void
|
|
59
|
-
* @param {String} name - Node name
|
|
60
|
-
* @param {Object} node - Node instance
|
|
61
|
-
* @param {Boolean} select - Select this node as current
|
|
62
|
-
* @return {void}
|
|
63
|
-
* @example
|
|
64
|
-
* // add and select new node with name 'testNode'
|
|
65
|
-
* nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true)
|
|
66
|
-
*/
|
|
67
|
-
addNode(name, node) {
|
|
68
|
-
let select = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
69
|
-
if (this.pool.has(name)) throw new DuplicateNodeError(name);
|
|
70
|
-
this.validateNodes([{
|
|
71
|
-
name,
|
|
72
|
-
instance: node
|
|
73
|
-
}]);
|
|
74
|
-
this.pool.set(name, {
|
|
75
|
-
name,
|
|
76
|
-
instance: node,
|
|
77
|
-
url: node.url,
|
|
78
|
-
internalUrl: node.internalUrl,
|
|
79
|
-
networkId: node.nodeNetworkId,
|
|
80
|
-
version: node.version,
|
|
81
|
-
consensusProtocolVersion: node.consensusProtocolVersion
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
if (select || !this.selectedNode) {
|
|
85
|
-
this.selectNode(name);
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Select Node
|
|
91
|
-
* @function
|
|
92
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
93
|
-
* @rtype (name: String) => void
|
|
94
|
-
* @param {String} name - Node name
|
|
95
|
-
* @return {void}
|
|
96
|
-
* @example
|
|
97
|
-
* nodePool.selectNode('testNode')
|
|
98
|
-
*/
|
|
99
|
-
selectNode(name) {
|
|
100
|
-
if (!this.pool.has(name)) throw new NodeNotFoundError(`Node with name ${name} not in pool`);
|
|
101
|
-
this.selectedNode = this.pool.get(name);
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Get NetworkId of current Node
|
|
106
|
-
* @function
|
|
107
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
108
|
-
* @rtype () => String
|
|
109
|
-
* @return {String}
|
|
110
|
-
* @example
|
|
111
|
-
* nodePool.getNetworkId()
|
|
112
|
-
*/
|
|
113
|
-
getNetworkId,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Check if you have selected node
|
|
117
|
-
* @function
|
|
118
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
119
|
-
* @rtype () => Boolean
|
|
120
|
-
* @return {Boolean}
|
|
121
|
-
* @example
|
|
122
|
-
* nodePool.isNodeConnected()
|
|
123
|
-
*/
|
|
124
|
-
isNodeConnected() {
|
|
125
|
-
return !!this.selectedNode.instance;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Get information about node
|
|
130
|
-
* @function
|
|
131
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
132
|
-
* @rtype () => Object
|
|
133
|
-
* @return {Object}
|
|
134
|
-
* @example
|
|
135
|
-
* nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }
|
|
136
|
-
*/
|
|
137
|
-
getNodeInfo() {
|
|
138
|
-
if (!this.isNodeConnected()) throw new DisconnectedError();
|
|
139
|
-
return {
|
|
140
|
-
name: this.selectedNode.name,
|
|
141
|
-
...this.selectedNode.instance.getNodeInfo()
|
|
142
|
-
};
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Get array of available nodes
|
|
147
|
-
* @function
|
|
148
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
149
|
-
* @rtype () => Object[]
|
|
150
|
-
* @return {Object[]}
|
|
151
|
-
* @example
|
|
152
|
-
* nodePool.getNodesInPool()
|
|
153
|
-
*/
|
|
154
|
-
getNodesInPool() {
|
|
155
|
-
return Array.from(this.pool.entries()).map(_ref => {
|
|
156
|
-
let [name, node] = _ref;
|
|
157
|
-
return {
|
|
158
|
-
name,
|
|
159
|
-
...node.instance.getNodeInfo()
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
validateNodes(nodes) {
|
|
165
|
-
// TODO: validate it on TypeScript level instead
|
|
166
|
-
// (to speedup development, save runtime resources)
|
|
167
|
-
if (!Array.isArray(nodes)) throw new TypeError('"nodes" should be an array');
|
|
168
|
-
const notObject = nodes.map(n => typeof n).find(t => t !== 'object');
|
|
169
|
-
if (notObject) throw new TypeError(`Each node should be an object, got ${notObject} instead`);
|
|
170
|
-
const wrongFields = nodes.find(n => typeof n.name !== 'string' || typeof n.instance !== 'object');
|
|
171
|
-
|
|
172
|
-
if (notObject) {
|
|
173
|
-
throw new TypeError('Each node should have name (string), instance (object) ' + `fields, got ${JSON.stringify(wrongFields)} instead`);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const wrongInstanceFields = nodes.map(n => n.instance).find(i => typeof i.api !== 'object' || typeof i.genesisHash !== 'string' || typeof i.consensusProtocolVersion !== 'number');
|
|
177
|
-
|
|
178
|
-
if (wrongInstanceFields) {
|
|
179
|
-
throw new TypeError('Each node instance should have api (object), consensusProtocolVersion (number), ' + `genesisHash (string) fields, got ${JSON.stringify(wrongInstanceFields)} instead`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
props: {
|
|
185
|
-
selectedNode: {}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node-pool/index.js"],"names":["stampit","getNetworkId","DisconnectedError","DuplicateNodeError","NodeNotFoundError","TypeError","init","nodes","pool","Map","validateNodes","forEach","node","i","name","instance","addNode","length","selectNode","propertyDescriptors","api","enumerable","configurable","get","selectedNode","methods","select","has","set","url","internalUrl","networkId","nodeNetworkId","version","consensusProtocolVersion","isNodeConnected","getNodeInfo","getNodesInPool","Array","from","entries","map","isArray","notObject","n","find","t","wrongFields","JSON","stringify","wrongInstanceFields","genesisHash","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,OAAP,MAAoB,WAApB;SACSC,Y;SACAC,iB,EAAmBC,kB,EAAoBC,iB,EAAmBC,S;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeL,OAAO,CA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IAAI,OAAOA,CAAC,CAACO,GAAT,KAAiB,QAAjB,IAA6B,OAAOP,CAAC,CAACsC,WAAT,KAAyB,QAAtD,IACT,OAAOtC,CAAC,CAACqB,wBAAT,KAAsC,QAHd,CAA5B;;AAIA,UAAIgB,mBAAJ,EAAyB;AACvB,cAAM,IAAI7C,SAAJ,CACJ,qFACC,oCAAmC2C,IAAI,CAACC,SAAL,CAAeC,mBAAf,CAAoC,UAFpE,CAAN;AAID;AACF;;AA3HM,GAvBY;AAoJrBE,EAAAA,KAAK,EAAE;AACL5B,IAAAA,YAAY,EAAE;AADT;AApJc,CAAD,CAAtB","sourcesContent":["/**\n * NodePool module\n * @module @aeternity/aepp-sdk/es/node-pool\n * @export NodePool\n * @example import { NodePool } from '@aeternity/aepp-sdk'\n */\nimport stampit from '@stamp/it'\nimport { getNetworkId } from '../node'\nimport { DisconnectedError, DuplicateNodeError, NodeNotFoundError, TypeError } from '../utils/errors'\n\n/**\n * Node Pool Stamp\n * This stamp allow you to make basic manipulation(add, remove, select) on list of nodes\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {Array} [options.nodes] - Array with Node instances\n * @return {Object} NodePool instance\n */\nexport default stampit({\n init ({ nodes = [] } = {}) {\n this.pool = new Map()\n this.validateNodes(nodes)\n\n nodes.forEach((node, i) => {\n const { name, instance } = node\n this.addNode(name, instance, i === 0)\n })\n if (nodes.length) this.selectNode(nodes[0].name)\n },\n propertyDescriptors: {\n api: {\n enumerable: true,\n configurable: false,\n get () {\n if (!this.selectedNode || !this.selectedNode.instance) {\n throw new NodeNotFoundError('You can\\'t use Node API. Node is not connected or not defined!')\n }\n return this.selectedNode.instance.api\n }\n }\n },\n methods: {\n /**\n * Add Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype (name: String, nodeInstance: Object, select: Boolean) => void\n * @param {String} name - Node name\n * @param {Object} node - Node instance\n * @param {Boolean} select - Select this node as current\n * @return {void}\n * @example\n * // add and select new node with name 'testNode'\n * nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true)\n */\n addNode (name, node, select = false) {\n if (this.pool.has(name)) throw new DuplicateNodeError(name)\n\n this.validateNodes([{ name, instance: node }])\n\n this.pool.set(name, {\n name,\n instance: node,\n url: node.url,\n internalUrl: node.internalUrl,\n networkId: node.nodeNetworkId,\n version: node.version,\n consensusProtocolVersion: node.consensusProtocolVersion\n })\n if (select || !this.selectedNode) {\n this.selectNode(name)\n }\n },\n /**\n * Select Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype (name: String) => void\n * @param {String} name - Node name\n * @return {void}\n * @example\n * nodePool.selectNode('testNode')\n */\n selectNode (name) {\n if (!this.pool.has(name)) throw new NodeNotFoundError(`Node with name ${name} not in pool`)\n\n this.selectedNode = this.pool.get(name)\n },\n /**\n * Get NetworkId of current Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => String\n * @return {String}\n * @example\n * nodePool.getNetworkId()\n */\n getNetworkId,\n /**\n * Check if you have selected node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Boolean\n * @return {Boolean}\n * @example\n * nodePool.isNodeConnected()\n */\n isNodeConnected () {\n return !!this.selectedNode.instance\n },\n /**\n * Get information about node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Object\n * @return {Object}\n * @example\n * nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }\n */\n getNodeInfo () {\n if (!this.isNodeConnected()) throw new DisconnectedError()\n return {\n name: this.selectedNode.name,\n ...this.selectedNode.instance.getNodeInfo()\n }\n },\n /**\n * Get array of available nodes\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Object[]\n * @return {Object[]}\n * @example\n * nodePool.getNodesInPool()\n */\n getNodesInPool () {\n return Array.from(this.pool.entries()).map(([name, node]) => ({\n name,\n ...node.instance.getNodeInfo()\n }))\n },\n validateNodes (nodes) {\n // TODO: validate it on TypeScript level instead\n // (to speedup development, save runtime resources)\n if (!Array.isArray(nodes)) throw new TypeError('\"nodes\" should be an array')\n const notObject = nodes.map(n => typeof n).find(t => t !== 'object')\n if (notObject) throw new TypeError(`Each node should be an object, got ${notObject} instead`)\n const wrongFields = nodes.find(n => typeof n.name !== 'string' || typeof n.instance !== 'object')\n if (notObject) {\n throw new TypeError(\n 'Each node should have name (string), instance (object) ' +\n `fields, got ${JSON.stringify(wrongFields)} instead`\n )\n }\n const wrongInstanceFields = nodes\n .map(n => n.instance)\n .find(i => typeof i.api !== 'object' || typeof i.genesisHash !== 'string' ||\n typeof i.consensusProtocolVersion !== 'number')\n if (wrongInstanceFields) {\n throw new TypeError(\n 'Each node instance should have api (object), consensusProtocolVersion (number), ' +\n `genesisHash (string) fields, got ${JSON.stringify(wrongInstanceFields)} instead`\n )\n }\n }\n },\n props: {\n selectedNode: {}\n }\n})\n"],"file":"index.mjs"}
|
package/es/node.mjs
DELETED
|
@@ -1,133 +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
|
-
* Node module
|
|
20
|
-
* @module @aeternity/aepp-sdk/es/node
|
|
21
|
-
* @export Node
|
|
22
|
-
* @example import { Node } from '@aeternity/aepp-sdk'
|
|
23
|
-
*/
|
|
24
|
-
import AsyncInit from "./utils/async-init.mjs";
|
|
25
|
-
import genSwaggerClient from "./utils/swagger.mjs";
|
|
26
|
-
import semverSatisfies from "./utils/semver-satisfies.mjs";
|
|
27
|
-
import { MissingParamError, UnsupportedVersionError } from "./utils/errors.mjs";
|
|
28
|
-
/**
|
|
29
|
-
* Obtain networkId from account or node
|
|
30
|
-
* @instance
|
|
31
|
-
* @category async
|
|
32
|
-
* @rtype () => networkId: String
|
|
33
|
-
* @return {String} NetworkId
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
export function getNetworkId() {
|
|
37
|
-
var _this$selectedNode;
|
|
38
|
-
|
|
39
|
-
let {
|
|
40
|
-
networkId,
|
|
41
|
-
force = false
|
|
42
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
|
-
const res = networkId || this.networkId || ((_this$selectedNode = this.selectedNode) === null || _this$selectedNode === void 0 ? void 0 : _this$selectedNode.networkId);
|
|
44
|
-
if (!force && !res) throw new MissingParamError('networkId is not provided');
|
|
45
|
-
if (force && !res) return null;
|
|
46
|
-
return res;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* {@link genSwaggerClient} based Node remote API Stamp
|
|
50
|
-
* @function
|
|
51
|
-
* @alias module:@aeternity/aepp-sdk/es/node
|
|
52
|
-
* @rtype Stamp
|
|
53
|
-
* @param {Object} [options={}] - Options
|
|
54
|
-
* @param {String} options.url - Base URL for Node
|
|
55
|
-
* @param {String} options.internalUrl - Base URL for internal requests
|
|
56
|
-
* @param {Object} options.axiosConfig - Object with axios configuration
|
|
57
|
-
* @param {Object} options.axiosConfig.config
|
|
58
|
-
* @param {Function} options.axiosConfig.errorHandler - (err) => throw err
|
|
59
|
-
* @return {Object} Node client
|
|
60
|
-
* @example Node({url: 'https://testnet.aeternity.io'})
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
const Node = AsyncInit.compose({
|
|
64
|
-
async init(_ref) {
|
|
65
|
-
let {
|
|
66
|
-
url,
|
|
67
|
-
internalUrl,
|
|
68
|
-
ignoreVersion
|
|
69
|
-
} = _ref;
|
|
70
|
-
if (!url) throw new MissingParamError('"url" required');
|
|
71
|
-
this.url = url.replace(/\/$/, '');
|
|
72
|
-
this.internalUrl = internalUrl === null || internalUrl === void 0 ? void 0 : internalUrl.replace(/\/$/, '');
|
|
73
|
-
const client = await genSwaggerClient(`${this.url}/api?oas3`, {
|
|
74
|
-
internalUrl: this.internalUrl,
|
|
75
|
-
responseInterceptor: response => {
|
|
76
|
-
if (response.ok) return;
|
|
77
|
-
return Object.assign(response, {
|
|
78
|
-
statusText: `${new URL(response.url).pathname.slice(1)} error: ` + response.body.reason
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
this.version = client.spec.info.version;
|
|
83
|
-
|
|
84
|
-
if (!semverSatisfies(this.version, NODE_GE_VERSION, NODE_LT_VERSION) && !ignoreVersion) {
|
|
85
|
-
throw new UnsupportedVersionError('node', this.version, NODE_GE_VERSION, NODE_LT_VERSION);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.api = client.api;
|
|
89
|
-
const {
|
|
90
|
-
nodeRevision: revision,
|
|
91
|
-
genesisKeyBlockHash: genesisHash,
|
|
92
|
-
networkId,
|
|
93
|
-
protocols,
|
|
94
|
-
topBlockHeight
|
|
95
|
-
} = await this.api.getStatus();
|
|
96
|
-
this.consensusProtocolVersion = protocols.filter(_ref2 => {
|
|
97
|
-
let {
|
|
98
|
-
effectiveAtHeight
|
|
99
|
-
} = _ref2;
|
|
100
|
-
return topBlockHeight >= effectiveAtHeight;
|
|
101
|
-
}).reduce((acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc, {
|
|
102
|
-
effectiveAtHeight: -1,
|
|
103
|
-
version: 0
|
|
104
|
-
}).version;
|
|
105
|
-
this.nodeNetworkId = networkId;
|
|
106
|
-
return Object.assign(this, {
|
|
107
|
-
revision,
|
|
108
|
-
genesisHash
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
methods: {
|
|
113
|
-
getNodeInfo() {
|
|
114
|
-
return {
|
|
115
|
-
url: this.url,
|
|
116
|
-
internalUrl: this.internalUrl,
|
|
117
|
-
nodeNetworkId: this.nodeNetworkId,
|
|
118
|
-
version: this.version,
|
|
119
|
-
consensusProtocolVersion: this.consensusProtocolVersion
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
props: {
|
|
125
|
-
version: null,
|
|
126
|
-
consensusProtocolVersion: null,
|
|
127
|
-
nodeNetworkId: null
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
const NODE_GE_VERSION = '6.2.0';
|
|
131
|
-
const NODE_LT_VERSION = '7.0.0';
|
|
132
|
-
export default Node;
|
|
133
|
-
//# sourceMappingURL=node.mjs.map
|
package/es/node.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node.js"],"names":["AsyncInit","genSwaggerClient","semverSatisfies","MissingParamError","UnsupportedVersionError","getNetworkId","networkId","force","res","selectedNode","Node","compose","init","url","internalUrl","ignoreVersion","replace","client","responseInterceptor","response","ok","Object","assign","statusText","URL","pathname","slice","body","reason","version","spec","info","NODE_GE_VERSION","NODE_LT_VERSION","api","nodeRevision","revision","genesisKeyBlockHash","genesisHash","protocols","topBlockHeight","getStatus","consensusProtocolVersion","filter","effectiveAtHeight","reduce","acc","p","nodeNetworkId","methods","getNodeInfo","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;OAEOA,S;OACAC,gB;OACAC,e;SACEC,iB,EAAmBC,uB;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,GAA0D;AAAA;;AAAA,MAAnC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,KAAK,GAAG;AAArB,GAAmC,uEAAJ,EAAI;AAC/D,QAAMC,GAAG,GAAGF,SAAS,IAAI,KAAKA,SAAlB,2BAA+B,KAAKG,YAApC,uDAA+B,mBAAmBH,SAAlD,CAAZ;AACA,MAAI,CAACC,KAAD,IAAU,CAACC,GAAf,EAAoB,MAAM,IAAIL,iBAAJ,CAAsB,2BAAtB,CAAN;AACpB,MAAII,KAAK,IAAI,CAACC,GAAd,EAAmB,OAAO,IAAP;AACnB,SAAOA,GAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,IAAI,GAAGV,SAAS,CAACW,OAAV,CAAkB;AAC7B,QAAMC,IAAN,OAAiD;AAAA,QAArC;AAAEC,MAAAA,GAAF;AAAOC,MAAAA,WAAP;AAAoBC,MAAAA;AAApB,KAAqC;AAC/C,QAAI,CAACF,GAAL,EAAU,MAAM,IAAIV,iBAAJ,CAAsB,gBAAtB,CAAN;AACV,SAAKU,GAAL,GAAWA,GAAG,CAACG,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAX;AACA,SAAKF,WAAL,GAAmBA,WAAnB,aAAmBA,WAAnB,uBAAmBA,WAAW,CAAEE,OAAb,CAAqB,KAArB,EAA4B,EAA5B,CAAnB;AACA,UAAMC,MAAM,GAAG,MAAMhB,gBAAgB,CAAE,GAAE,KAAKY,GAAI,WAAb,EAAyB;AAC5DC,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B;AAAyBf,MAAAA,OAAO,EAAE;AAAlC,KAJ4B,EAM7BA,OANH;AAOA,SAAKmB,aAAL,GAAqB1C,SAArB;AACA,WAAOe,MAAM,CAACC,MAAP,CAAc,IAAd,EAAoB;AAAEc,MAAAA,QAAF;AAAYE,MAAAA;AAAZ,KAApB,CAAP;AACD,GApC4B;;AAqC7BW,EAAAA,OAAO,EAAE;AACPC,IAAAA,WAAW,GAAI;AACb,aAAO;AACLrC,QAAAA,GAAG,EAAE,KAAKA,GADL;AAELC,QAAAA,WAAW,EAAE,KAAKA,WAFb;AAGLkC,QAAAA,aAAa,EAAE,KAAKA,aAHf;AAILnB,QAAAA,OAAO,EAAE,KAAKA,OAJT;AAKLa,QAAAA,wBAAwB,EAAE,KAAKA;AAL1B,OAAP;AAOD;;AATM,GArCoB;AAgD7BS,EAAAA,KAAK,EAAE;AACLtB,IAAAA,OAAO,EAAE,IADJ;AAELa,IAAAA,wBAAwB,EAAE,IAFrB;AAGLM,IAAAA,aAAa,EAAE;AAHV;AAhDsB,CAAlB,CAAb;AAuDA,MAAMhB,eAAe,GAAG,OAAxB;AACA,MAAMC,eAAe,GAAG,OAAxB;AAEA,eAAevB,IAAf","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 * Node module\n * @module @aeternity/aepp-sdk/es/node\n * @export Node\n * @example import { Node } from '@aeternity/aepp-sdk'\n */\n\nimport AsyncInit from './utils/async-init'\nimport genSwaggerClient from './utils/swagger'\nimport semverSatisfies from './utils/semver-satisfies'\nimport { MissingParamError, UnsupportedVersionError } from './utils/errors'\n\n/**\n * Obtain networkId from account or node\n * @instance\n * @category async\n * @rtype () => networkId: String\n * @return {String} NetworkId\n */\nexport function getNetworkId ({ networkId, force = false } = {}) {\n const res = networkId || this.networkId || this.selectedNode?.networkId\n if (!force && !res) throw new MissingParamError('networkId is not provided')\n if (force && !res) return null\n return res\n}\n\n/**\n * {@link genSwaggerClient} based Node remote API Stamp\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node\n * @rtype Stamp\n * @param {Object} [options={}] - Options\n * @param {String} options.url - Base URL for Node\n * @param {String} options.internalUrl - Base URL for internal requests\n * @param {Object} options.axiosConfig - Object with axios configuration\n * @param {Object} options.axiosConfig.config\n * @param {Function} options.axiosConfig.errorHandler - (err) => throw err\n * @return {Object} Node client\n * @example Node({url: 'https://testnet.aeternity.io'})\n */\nconst Node = AsyncInit.compose({\n async init ({ url, internalUrl, ignoreVersion }) {\n if (!url) throw new MissingParamError('\"url\" required')\n this.url = url.replace(/\\/$/, '')\n this.internalUrl = internalUrl?.replace(/\\/$/, '')\n const client = await genSwaggerClient(`${this.url}/api?oas3`, {\n internalUrl: this.internalUrl,\n responseInterceptor: response => {\n if (response.ok) return\n return Object.assign(response, {\n statusText: `${new URL(response.url).pathname.slice(1)} error: ` + response.body.reason\n })\n }\n })\n this.version = client.spec.info.version\n if (\n !semverSatisfies(this.version, NODE_GE_VERSION, NODE_LT_VERSION) &&\n !ignoreVersion\n ) {\n throw new UnsupportedVersionError('node', this.version, NODE_GE_VERSION, NODE_LT_VERSION)\n }\n this.api = client.api\n\n const {\n nodeRevision: revision, genesisKeyBlockHash: genesisHash, networkId,\n protocols, topBlockHeight\n } = await this.api.getStatus()\n this.consensusProtocolVersion = protocols\n .filter(({ effectiveAtHeight }) => topBlockHeight >= effectiveAtHeight)\n .reduce(\n (acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc,\n { effectiveAtHeight: -1, version: 0 }\n )\n .version\n this.nodeNetworkId = networkId\n return Object.assign(this, { revision, genesisHash })\n },\n methods: {\n getNodeInfo () {\n return {\n url: this.url,\n internalUrl: this.internalUrl,\n nodeNetworkId: this.nodeNetworkId,\n version: this.version,\n consensusProtocolVersion: this.consensusProtocolVersion\n }\n }\n },\n props: {\n version: null,\n consensusProtocolVersion: null,\n nodeNetworkId: null\n }\n})\n\nconst NODE_GE_VERSION = '6.2.0'\nconst NODE_LT_VERSION = '7.0.0'\n\nexport default Node\n"],"file":"node.mjs"}
|
package/es/other.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const pause: (duration: number) => Promise<void>;
|
|
2
|
-
export declare const mapObject: (object: object, fn: (value: [string, any], index: number, array: Array<[string, any]>) => Array<[string, any]>) => object;
|
|
3
|
-
export declare const filterObject: (object: object, fn: (value: [string, any], index: number, array: Array<[string, any]>) => boolean) => object;
|
|
4
|
-
/**
|
|
5
|
-
* Key traversal metafunction
|
|
6
|
-
* @static
|
|
7
|
-
* @function
|
|
8
|
-
* @rtype (fn: (s: String) => String) => (o: Object) => Object
|
|
9
|
-
* @param {Function} fn - Key transformation function
|
|
10
|
-
* @param {Object} object - Object to traverse
|
|
11
|
-
* @return {Object} Transformed object
|
|
12
|
-
*/
|
|
13
|
-
export declare const traverseKeys: (fn: Function, object: any) => any;
|
|
14
|
-
/**
|
|
15
|
-
* snake_case key traversal
|
|
16
|
-
* @static
|
|
17
|
-
* @rtype (o: Object) => Object
|
|
18
|
-
* @param {Object} object - Object to traverse
|
|
19
|
-
* @return {Object} Transformed object
|
|
20
|
-
* @see pascalToSnake
|
|
21
|
-
*/
|
|
22
|
-
export declare const snakizeKeys: any;
|
|
23
|
-
/**
|
|
24
|
-
* PascalCase key traversal
|
|
25
|
-
* @static
|
|
26
|
-
* @rtype (o: Object) => Object
|
|
27
|
-
* @param {Object} object - Object to traverse
|
|
28
|
-
* @return {Object} Transformed object
|
|
29
|
-
* @see snakeToPascal
|
|
30
|
-
*/
|
|
31
|
-
export declare const pascalizeKeys: any;
|
package/es/semver-satisfies.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (version: string, geVersion: string, ltVersion: string): boolean;
|
package/es/string.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert string from snake_case to PascalCase
|
|
3
|
-
* @rtype (s: String) => String
|
|
4
|
-
* @param {String} s - String to convert
|
|
5
|
-
* @return {String} Converted string
|
|
6
|
-
*/
|
|
7
|
-
export declare function snakeToPascal(s: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Convert string from PascalCase to snake_case
|
|
10
|
-
* @rtype (s: String) => String
|
|
11
|
-
* @param {String} s - String to convert
|
|
12
|
-
* @return {String} Converted string
|
|
13
|
-
*/
|
|
14
|
-
export declare function pascalToSnake(s: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Check whether a string is valid hex.
|
|
17
|
-
* @param {string} str String to validate.
|
|
18
|
-
* @return {boolean} True if the string is valid hex, false otherwise.
|
|
19
|
-
*/
|
|
20
|
-
export declare function isHex(str: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Check whether a string is valid base-64.
|
|
23
|
-
* @param {string} str String to validate.
|
|
24
|
-
* @return {boolean} True if the string is valid base-64, false otherwise.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isBase64(str: string): boolean;
|