@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/utils/other.mjs
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
|
+
const {
|
|
4
|
+
Buffer: _Buffer
|
|
5
|
+
} = _buffer;
|
|
6
|
+
export const pause = async duration => new Promise(resolve => {
|
|
7
|
+
setTimeout(resolve, duration);
|
|
8
|
+
});
|
|
9
|
+
export const mapObject = (object, fn) => Object.fromEntries(Object.entries(object).map(fn)); // remove after dropping webpack4 support
|
|
10
|
+
|
|
11
|
+
const isWebpack4Buffer = (() => {
|
|
12
|
+
try {
|
|
13
|
+
_Buffer.concat([Uint8Array.from([])]);
|
|
14
|
+
|
|
15
|
+
return false;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
14
20
|
|
|
15
|
-
export const
|
|
16
|
-
if (typeof object !== 'object' || object === null) return object;
|
|
17
|
-
if (Array.isArray(object)) return object.map(i => traverseKeys(fn, i));
|
|
18
|
-
return mapObject(object, _ref => {
|
|
19
|
-
let [key, value] = _ref;
|
|
20
|
-
return [fn(key), traverseKeys(fn, value)];
|
|
21
|
-
});
|
|
22
|
-
};
|
|
21
|
+
export const concatBuffers = isWebpack4Buffer ? (list, totalLength) => _Buffer.concat(list.map(el => _Buffer.from(el)), totalLength) : _Buffer.concat;
|
|
23
22
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
* @
|
|
27
|
-
* @param {Object} object - Object to traverse
|
|
28
|
-
* @return {Object} Transformed object
|
|
29
|
-
* @see pascalToSnake
|
|
23
|
+
* Object key type guard
|
|
24
|
+
* @param key - Maybe object key
|
|
25
|
+
* @param object - Object
|
|
30
26
|
*/
|
|
31
27
|
|
|
32
|
-
export
|
|
28
|
+
export function isKeyOfObject(key, object) {
|
|
29
|
+
return key in object;
|
|
30
|
+
}
|
|
33
31
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
37
|
-
* @param {Object} object - Object to traverse
|
|
38
|
-
* @return {Object} Transformed object
|
|
39
|
-
* @see snakeToPascal
|
|
32
|
+
* Array item type guard
|
|
33
|
+
* @param item - Maybe array item
|
|
34
|
+
* @param array - Array
|
|
40
35
|
*/
|
|
41
36
|
|
|
42
|
-
export
|
|
37
|
+
export function isItemOfArray(item, array) {
|
|
38
|
+
return _includesInstanceProperty(array).call(array, item);
|
|
39
|
+
}
|
|
43
40
|
//# sourceMappingURL=other.mjs.map
|
package/es/utils/other.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"other.mjs","names":["pause","duration","Promise","resolve","setTimeout","mapObject","object","fn","Object","fromEntries","entries","map","isWebpack4Buffer","concat","Uint8Array","from","error","concatBuffers","list","totalLength","el","isKeyOfObject","key","isItemOfArray","item","array"],"sources":["../../src/utils/other.ts"],"sourcesContent":["export const pause = async (duration: number): Promise<void> => new Promise((resolve) => {\n setTimeout(resolve, duration);\n});\n\nexport const mapObject = <InputV, OutputV>(\n object: { [k: string]: InputV },\n fn: (\n value: [string, InputV], index: number, array: Array<[string, InputV]>\n ) => [number | string, OutputV],\n): { [k: string]: OutputV } => Object.fromEntries(Object.entries(object).map(fn));\n\n// remove after dropping webpack4 support\nconst isWebpack4Buffer = (() => {\n try {\n Buffer.concat([Uint8Array.from([])]);\n return false;\n } catch (error) {\n return true;\n }\n})();\n\nexport const concatBuffers = isWebpack4Buffer\n ? (list: readonly Uint8Array[], totalLength?: number): Buffer => (\n Buffer.concat(list.map((el) => Buffer.from(el)), totalLength)\n )\n : Buffer.concat;\n\n/**\n * Object key type guard\n * @param key - Maybe object key\n * @param object - Object\n */\nexport function isKeyOfObject<T>(key: string | number | symbol, object: T): key is keyof T {\n return key in object;\n}\n\n/**\n * Array item type guard\n * @param item - Maybe array item\n * @param array - Array\n */\nexport function isItemOfArray<T>(item: any, array: readonly T[]): item is T {\n return array.includes(item);\n}\n"],"mappings":";;;;;AAAA,OAAO,MAAMA,KAAK,GAAG,MAAOC,QAAP,IAA2C,IAAIC,OAAJ,CAAaC,OAAD,IAAa;EACvFC,UAAU,CAACD,OAAD,EAAUF,QAAV,CAAV;AACD,CAF+D,CAAzD;AAIP,OAAO,MAAMI,SAAS,GAAG,CACvBC,MADuB,EAEvBC,EAFuB,KAKMC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBK,GAAvB,CAA2BJ,EAA3B,CAAnB,CALxB,C,CAOP;;AACA,MAAMK,gBAAgB,GAAG,CAAC,MAAM;EAC9B,IAAI;IACF,QAAOC,MAAP,CAAc,CAACC,UAAU,CAACC,IAAX,CAAgB,EAAhB,CAAD,CAAd;;IACA,OAAO,KAAP;EACD,CAHD,CAGE,OAAOC,KAAP,EAAc;IACd,OAAO,IAAP;EACD;AACF,CAPwB,GAAzB;;AASA,OAAO,MAAMC,aAAa,GAAGL,gBAAgB,GACzC,CAACM,IAAD,EAA8BC,WAA9B,KACA,QAAON,MAAP,CAAcK,IAAI,CAACP,GAAL,CAAUS,EAAD,IAAQ,QAAOL,IAAP,CAAYK,EAAZ,CAAjB,CAAd,EAAiDD,WAAjD,CAFyC,GAIzC,QAAON,MAJJ;AAMP;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASQ,aAAT,CAA0BC,GAA1B,EAAyDhB,MAAzD,EAAoF;EACzF,OAAOgB,GAAG,IAAIhB,MAAd;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASiB,aAAT,CAA0BC,IAA1B,EAAqCC,KAArC,EAAqE;EAC1E,OAAO,0BAAAA,KAAK,MAAL,CAAAA,KAAK,EAAUD,IAAV,CAAZ;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function semverSatisfies(version: string, geVersion: string, ltVersion: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function (version, geVersion, ltVersion) {
|
|
1
|
+
export default function semverSatisfies(version, geVersion, ltVersion) {
|
|
2
2
|
const getComponents = v => v.split(/[-+]/)[0].split('.').map(i => +i);
|
|
3
3
|
|
|
4
4
|
const versionComponents = getComponents(version);
|
|
@@ -6,7 +6,7 @@ export default function (version, geVersion, ltVersion) {
|
|
|
6
6
|
const ltComponents = getComponents(ltVersion);
|
|
7
7
|
const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1;
|
|
8
8
|
|
|
9
|
-
const componentsToNumber = components => components.reverse().reduce((acc, n, idx) => acc + n *
|
|
9
|
+
const componentsToNumber = components => components.reverse().reduce((acc, n, idx) => acc + n * base ** idx, 0);
|
|
10
10
|
|
|
11
11
|
const vNumber = componentsToNumber(versionComponents);
|
|
12
12
|
const geNumber = componentsToNumber(geComponents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"semver-satisfies.mjs","names":["semverSatisfies","version","geVersion","ltVersion","getComponents","v","split","map","i","versionComponents","geComponents","ltComponents","base","Math","max","componentsToNumber","components","reverse","reduce","acc","n","idx","vNumber","geNumber","ltNumber"],"sources":["../../src/utils/semver-satisfies.ts"],"sourcesContent":["export default function semverSatisfies(\n version: string,\n geVersion: string,\n ltVersion: string,\n): boolean {\n const getComponents = (v: string): number[] => v\n .split(/[-+]/)[0].split('.').map((i) => +i);\n\n const versionComponents = getComponents(version);\n const geComponents = getComponents(geVersion);\n const ltComponents = getComponents(ltVersion);\n\n const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1;\n const componentsToNumber = (components: number[]): number => components.reverse()\n .reduce((acc, n, idx) => acc + n * base ** idx, 0);\n\n const vNumber = componentsToNumber(versionComponents);\n const geNumber = componentsToNumber(geComponents);\n const ltNumber = componentsToNumber(ltComponents);\n return vNumber >= geNumber && vNumber < ltNumber;\n}\n"],"mappings":"AAAA,eAAe,SAASA,eAAT,CACbC,OADa,EAEbC,SAFa,EAGbC,SAHa,EAIJ;EACT,MAAMC,aAAa,GAAIC,CAAD,IAAyBA,CAAC,CAC7CC,KAD4C,CACtC,MADsC,EAC9B,CAD8B,EAC3BA,KAD2B,CACrB,GADqB,EAChBC,GADgB,CACXC,CAAD,IAAO,CAACA,CADI,CAA/C;;EAGA,MAAMC,iBAAiB,GAAGL,aAAa,CAACH,OAAD,CAAvC;EACA,MAAMS,YAAY,GAAGN,aAAa,CAACF,SAAD,CAAlC;EACA,MAAMS,YAAY,GAAGP,aAAa,CAACD,SAAD,CAAlC;EAEA,MAAMS,IAAI,GAAGC,IAAI,CAACC,GAAL,CAAS,GAAGL,iBAAZ,EAA+B,GAAGC,YAAlC,EAAgD,GAAGC,YAAnD,IAAmE,CAAhF;;EACA,MAAMI,kBAAkB,GAAIC,UAAD,IAAkCA,UAAU,CAACC,OAAX,GAC1DC,MAD0D,CACnD,CAACC,GAAD,EAAMC,CAAN,EAASC,GAAT,KAAiBF,GAAG,GAAGC,CAAC,GAAGR,IAAI,IAAIS,GADgB,EACX,CADW,CAA7D;;EAGA,MAAMC,OAAO,GAAGP,kBAAkB,CAACN,iBAAD,CAAlC;EACA,MAAMc,QAAQ,GAAGR,kBAAkB,CAACL,YAAD,CAAnC;EACA,MAAMc,QAAQ,GAAGT,kBAAkB,CAACJ,YAAD,CAAnC;EACA,OAAOW,OAAO,IAAIC,QAAX,IAAuBD,OAAO,GAAGE,QAAxC;AACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert string from snake_case to PascalCase
|
|
3
|
+
* @param s - String to convert
|
|
4
|
+
* @returns Converted string
|
|
5
|
+
*/
|
|
6
|
+
export declare function snakeToPascal(s: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Convert string from PascalCase to snake_case
|
|
9
|
+
* @param s - String to convert
|
|
10
|
+
* @returns Converted string
|
|
11
|
+
*/
|
|
12
|
+
export declare function pascalToSnake(s: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Check whether a string is valid hex.
|
|
15
|
+
* @param str - String to validate.
|
|
16
|
+
* @returns True if the string is valid hex, false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isHex(str: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a string is valid base-64.
|
|
21
|
+
* @param str - String to validate.
|
|
22
|
+
* @returns True if the string is valid base-64, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isBase64(str: string): boolean;
|
package/es/utils/string.mjs
CHANGED
|
@@ -17,18 +17,16 @@
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Convert string from snake_case to PascalCase
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @return {String} Converted string
|
|
20
|
+
* @param s - String to convert
|
|
21
|
+
* @returns Converted string
|
|
23
22
|
*/
|
|
24
23
|
export function snakeToPascal(s) {
|
|
25
24
|
return s.replace(/_./g, match => match[1].toUpperCase());
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
27
|
* Convert string from PascalCase to snake_case
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
31
|
-
* @return {String} Converted string
|
|
28
|
+
* @param s - String to convert
|
|
29
|
+
* @returns Converted string
|
|
32
30
|
*/
|
|
33
31
|
|
|
34
32
|
export function pascalToSnake(s) {
|
|
@@ -36,8 +34,8 @@ export function pascalToSnake(s) {
|
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
36
|
* Check whether a string is valid hex.
|
|
39
|
-
* @param
|
|
40
|
-
* @
|
|
37
|
+
* @param str - String to validate.
|
|
38
|
+
* @returns True if the string is valid hex, false otherwise.
|
|
41
39
|
*/
|
|
42
40
|
|
|
43
41
|
export function isHex(str) {
|
|
@@ -45,8 +43,8 @@ export function isHex(str) {
|
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
45
|
* Check whether a string is valid base-64.
|
|
48
|
-
* @param
|
|
49
|
-
* @
|
|
46
|
+
* @param str - String to validate.
|
|
47
|
+
* @returns True if the string is valid base-64, false otherwise.
|
|
50
48
|
*/
|
|
51
49
|
|
|
52
50
|
export function isBase64(str) {
|
package/es/utils/string.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"string.mjs","names":["snakeToPascal","s","replace","match","toUpperCase","pascalToSnake","toLowerCase","isHex","str","length","test","isBase64","index","indexOf","slice"],"sources":["../../src/utils/string.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Convert string from snake_case to PascalCase\n * @param s - String to convert\n * @returns Converted string\n */\nexport function snakeToPascal(s: string): string {\n return s.replace(/_./g, (match) => match[1].toUpperCase());\n}\n\n/**\n * Convert string from PascalCase to snake_case\n * @param s - String to convert\n * @returns Converted string\n */\nexport function pascalToSnake(s: string): string {\n return s.replace(/[A-Z]/g, (match) => `_${match.toLowerCase()}`);\n}\n\n/**\n * Check whether a string is valid hex.\n * @param str - String to validate.\n * @returns True if the string is valid hex, false otherwise.\n */\nexport function isHex(str: string): boolean {\n return str.length % 2 === 0 && /^[0-9a-f]+$/i.test(str);\n}\n\n/**\n * Check whether a string is valid base-64.\n * @param str - String to validate.\n * @returns True if the string is valid base-64, false otherwise.\n */\nexport function isBase64(str: string): boolean {\n if (str.length % 4 > 0 || /[^0-9a-z+/=]/i.test(str)) return false;\n const index = str.indexOf('=');\n return index === -1 || /={1,2}/.test(str.slice(index));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAuBC,CAAvB,EAA0C;EAC/C,OAAOA,CAAC,CAACC,OAAF,CAAU,KAAV,EAAkBC,KAAD,IAAWA,KAAK,CAAC,CAAD,CAAL,CAASC,WAAT,EAA5B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBJ,CAAvB,EAA0C;EAC/C,OAAOA,CAAC,CAACC,OAAF,CAAU,QAAV,EAAqBC,KAAD,IAAY,IAAGA,KAAK,CAACG,WAAN,EAAoB,EAAvD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAeC,GAAf,EAAqC;EAC1C,OAAOA,GAAG,CAACC,MAAJ,GAAa,CAAb,KAAmB,CAAnB,IAAwB,eAAeC,IAAf,CAAoBF,GAApB,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,QAAT,CAAkBH,GAAlB,EAAwC;EAC7C,IAAIA,GAAG,CAACC,MAAJ,GAAa,CAAb,GAAiB,CAAjB,IAAsB,gBAAgBC,IAAhB,CAAqBF,GAArB,CAA1B,EAAqD,OAAO,KAAP;EACrD,MAAMI,KAAK,GAAGJ,GAAG,CAACK,OAAJ,CAAY,GAAZ,CAAd;EACA,OAAOD,KAAK,KAAK,CAAC,CAAX,IAAgB,SAASF,IAAT,CAAcF,GAAG,CAACM,KAAJ,CAAUF,KAAV,CAAd,CAAvB;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeternity/aepp-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "SDK for the æternity blockchain",
|
|
5
5
|
"main": "dist/aepp-sdk.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -11,18 +11,21 @@
|
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
|
|
14
|
-
"build": "
|
|
14
|
+
"build:api": "npx autorest tooling/autorest/compiler.yaml --output-artifact:code-model-v4 && npx autorest tooling/autorest/node.yaml --output-artifact:code-model-v4",
|
|
15
|
+
"build": "npm run build:api && webpack --mode=production && npm run build:es",
|
|
15
16
|
"build:dev": "webpack --mode=development && npm run build:es",
|
|
16
17
|
"docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.js",
|
|
17
|
-
"docs:api": "
|
|
18
|
-
"
|
|
18
|
+
"docs:api": "typedoc",
|
|
19
|
+
"commitlint": "commitlint --from develop",
|
|
20
|
+
"lint": "eslint . --ext .ts,.js,.mjs",
|
|
21
|
+
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
|
19
22
|
"test": "nyc mocha './test/unit/' './test/integration/'",
|
|
20
23
|
"test:integration": "nyc mocha './test/integration/'",
|
|
21
24
|
"test:unit": "nyc mocha './test/unit/'",
|
|
22
25
|
"test:watch": "mocha './test/unit/' './test/integration/' --watch",
|
|
23
26
|
"prepare": "npm run build",
|
|
24
|
-
"prepublishOnly": "npm run docs:examples",
|
|
25
|
-
"release": "standard-version --skip.tag"
|
|
27
|
+
"prepublishOnly": "test/examples.sh && npm run docs:examples && npm run docs:api",
|
|
28
|
+
"release": "standard-version --skip.tag --infile docs/CHANGELOG.md"
|
|
26
29
|
},
|
|
27
30
|
"license": "ISC",
|
|
28
31
|
"keywords": [
|
|
@@ -32,27 +35,33 @@
|
|
|
32
35
|
"SDK"
|
|
33
36
|
],
|
|
34
37
|
"dependencies": {
|
|
35
|
-
"@aeternity/aepp-calldata": "^1.
|
|
38
|
+
"@aeternity/aepp-calldata": "^1.2.0",
|
|
36
39
|
"@aeternity/argon2-browser": "^0.1.2",
|
|
37
|
-
"@aeternity/blakejs": "^1.1.2",
|
|
38
|
-
"@aeternity/json-bigint": "^0.3.1",
|
|
39
40
|
"@aeternity/uuid": "^0.0.1",
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
41
|
+
"@azure/core-client": "^1.6.0",
|
|
42
|
+
"@azure/core-rest-pipeline": "^1.9.0",
|
|
43
|
+
"@babel/runtime-corejs3": "^7.18.9",
|
|
44
|
+
"@types/aes-js": "^3.1.1",
|
|
45
|
+
"@types/argon2-browser": "^1.18.1",
|
|
46
|
+
"@types/json-bigint": "^1.0.1",
|
|
47
|
+
"@types/sha.js": "^2.4.0",
|
|
48
|
+
"@types/uuid": "^8.3.4",
|
|
49
|
+
"@types/webextension-polyfill": "^0.9.0",
|
|
50
|
+
"@types/websocket": "^1.0.5",
|
|
43
51
|
"aes-js": "^3.1.2",
|
|
44
52
|
"bignumber.js": "^9.0.2",
|
|
45
53
|
"bip32-path": "^0.4.2",
|
|
46
|
-
"
|
|
54
|
+
"blakejs": "^1.2.1",
|
|
55
|
+
"bs58": "^5.0.0",
|
|
47
56
|
"buffer": "^6.0.3",
|
|
48
|
-
"cross-fetch": "^3.1.5",
|
|
49
57
|
"events": "^3.3.0",
|
|
58
|
+
"json-bigint": "^1.0.0",
|
|
50
59
|
"process": "^0.11.10",
|
|
51
60
|
"rlp": "^3.0.0",
|
|
52
61
|
"sha.js": "^2.4.11",
|
|
53
|
-
"swagger-client": "^3.18.4",
|
|
54
62
|
"tweetnacl": "^1.0.3",
|
|
55
63
|
"tweetnacl-auth": "^1.0.1",
|
|
64
|
+
"varuint-bitcoin": "^1.1.2",
|
|
56
65
|
"websocket": "^1.0.34"
|
|
57
66
|
},
|
|
58
67
|
"repository": {
|
|
@@ -60,40 +69,45 @@
|
|
|
60
69
|
"url": "https://github.com/aeternity/aepp-sdk-js"
|
|
61
70
|
},
|
|
62
71
|
"devDependencies": {
|
|
63
|
-
"@babel/cli": "^7.
|
|
64
|
-
"@babel/core": "^7.
|
|
65
|
-
"@babel/node": "^7.
|
|
66
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
67
|
-
"@babel/preset-env": "^7.
|
|
68
|
-
"@babel/preset-typescript": "^7.
|
|
69
|
-
"@babel/register": "^7.
|
|
70
|
-
"@commitlint/cli": "^
|
|
71
|
-
"@commitlint/config-conventional": "^
|
|
72
|
-
"@types/
|
|
73
|
-
"@types/chai": "^
|
|
74
|
-
"@types/mocha": "^9.1.
|
|
75
|
-
"@types/
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
77
|
-
"@typescript-eslint/parser": "^5.
|
|
78
|
-
"babel-loader": "^8.2.
|
|
72
|
+
"@babel/cli": "^7.18.9",
|
|
73
|
+
"@babel/core": "^7.18.9",
|
|
74
|
+
"@babel/node": "^7.18.9",
|
|
75
|
+
"@babel/plugin-transform-runtime": "^7.18.9",
|
|
76
|
+
"@babel/preset-env": "^7.18.9",
|
|
77
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
78
|
+
"@babel/register": "^7.18.9",
|
|
79
|
+
"@commitlint/cli": "^17.0.3",
|
|
80
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
81
|
+
"@types/chai": "^4.3.1",
|
|
82
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
83
|
+
"@types/mocha": "^9.1.1",
|
|
84
|
+
"@types/sinon": "^10.0.13",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
86
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
87
|
+
"babel-loader": "^8.2.5",
|
|
79
88
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
80
89
|
"babel-plugin-import-globals": "^2.0.0",
|
|
81
90
|
"babel-plugin-transform-default-named-imports": "^1.2.2",
|
|
82
91
|
"chai": "^4.3.6",
|
|
83
92
|
"chai-as-promised": "^7.1.1",
|
|
84
|
-
"
|
|
85
|
-
"eslint
|
|
86
|
-
"
|
|
87
|
-
"
|
|
93
|
+
"codecov": "^3.8.3",
|
|
94
|
+
"eslint": "^8.20.0",
|
|
95
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
96
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
97
|
+
"eslint-plugin-rulesdir": "^0.2.1",
|
|
98
|
+
"eslint-plugin-tsdoc": "^0.2.16",
|
|
99
|
+
"mocha": "^10.0.0",
|
|
88
100
|
"nyc": "^15.1.0",
|
|
89
|
-
"sinon": "^
|
|
90
|
-
"source-map": "^0.7.
|
|
91
|
-
"standard-version": "^9.
|
|
92
|
-
"ts-node": "^10.
|
|
93
|
-
"
|
|
94
|
-
"
|
|
101
|
+
"sinon": "^14.0.0",
|
|
102
|
+
"source-map": "^0.7.4",
|
|
103
|
+
"standard-version": "^9.5.0",
|
|
104
|
+
"ts-node": "^10.9.1",
|
|
105
|
+
"typedoc": "^0.23.9",
|
|
106
|
+
"typedoc-plugin-missing-exports": "^0.23.0",
|
|
107
|
+
"typescript": "^4.7.4",
|
|
108
|
+
"webpack": "^5.74.0",
|
|
95
109
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
96
|
-
"webpack-cli": "^4.
|
|
110
|
+
"webpack-cli": "^4.10.0"
|
|
97
111
|
},
|
|
98
112
|
"files": [
|
|
99
113
|
"dist",
|
package/src/AeSdk.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import AeSdkBase, { Account } from './AeSdkBase';
|
|
2
|
+
import AccountBase from './account/Base';
|
|
3
|
+
import { decode, Encoded } from './utils/encoder';
|
|
4
|
+
import { UnavailableAccountError } from './utils/errors';
|
|
5
|
+
|
|
6
|
+
export default class AeSdk extends AeSdkBase {
|
|
7
|
+
accounts: { [key: Encoded.AccountAddress]: AccountBase } = {};
|
|
8
|
+
|
|
9
|
+
selectedAddress?: Encoded.AccountAddress;
|
|
10
|
+
|
|
11
|
+
_resolveAccount(
|
|
12
|
+
account: Account | Encoded.AccountAddress = this.selectedAddress,
|
|
13
|
+
): AccountBase {
|
|
14
|
+
if (typeof account === 'string') {
|
|
15
|
+
const address = account as Encoded.AccountAddress;
|
|
16
|
+
decode(address);
|
|
17
|
+
if (this.accounts[address] == null) throw new UnavailableAccountError(account);
|
|
18
|
+
account = this.accounts[address];
|
|
19
|
+
}
|
|
20
|
+
return super._resolveAccount(account);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get accounts addresses
|
|
25
|
+
* @example addresses()
|
|
26
|
+
*/
|
|
27
|
+
addresses(): Encoded.AccountAddress[] {
|
|
28
|
+
return Object.keys(this.accounts) as Encoded.AccountAddress[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Add specific account
|
|
33
|
+
* @param account - Account instance
|
|
34
|
+
* @param options - Options
|
|
35
|
+
* @param options.select - Select account
|
|
36
|
+
* @example addAccount(account)
|
|
37
|
+
*/
|
|
38
|
+
async addAccount(account: AccountBase, { select }: { select?: boolean } = {}): Promise<void> {
|
|
39
|
+
const address = await account.address();
|
|
40
|
+
this.accounts[address] = account;
|
|
41
|
+
if (select === true) this.selectAccount(address);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Remove specific account
|
|
46
|
+
* @param address - Address of account to remove
|
|
47
|
+
* @example removeAccount(address)
|
|
48
|
+
*/
|
|
49
|
+
removeAccount(address: Encoded.AccountAddress): void {
|
|
50
|
+
if (this.accounts[address] == null) {
|
|
51
|
+
console.warn(`removeAccount: Account for ${address} not available`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
delete this.accounts[address]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
55
|
+
if (this.selectedAddress === address) delete this.selectedAddress;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Select specific account
|
|
60
|
+
* @param address - Address of account to select
|
|
61
|
+
* @example selectAccount('ak_xxxxxxxx')
|
|
62
|
+
*/
|
|
63
|
+
selectAccount(address: Encoded.AccountAddress): void {
|
|
64
|
+
decode(address);
|
|
65
|
+
if (this.accounts[address] == null) throw new UnavailableAccountError(address);
|
|
66
|
+
this.selectedAddress = address;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/AeSdkAepp.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import AeSdkBase, { Account } from './AeSdkBase';
|
|
2
|
+
import AccountBase from './account/Base';
|
|
3
|
+
import AccountRpc from './account/Rpc';
|
|
4
|
+
import { decode, Encoded } from './utils/encoder';
|
|
5
|
+
import {
|
|
6
|
+
Accounts, RPC_VERSION, WalletInfo, Network, WalletApi, AeppApi,
|
|
7
|
+
} from './aepp-wallet-communication/rpc/types';
|
|
8
|
+
import RpcClient from './aepp-wallet-communication/rpc/RpcClient';
|
|
9
|
+
import { METHODS, SUBSCRIPTION_TYPES } from './aepp-wallet-communication/schema';
|
|
10
|
+
import {
|
|
11
|
+
AlreadyConnectedError,
|
|
12
|
+
NoWalletConnectedError,
|
|
13
|
+
UnsubscribedAccountError,
|
|
14
|
+
UnAuthorizedAccountError,
|
|
15
|
+
RpcConnectionError,
|
|
16
|
+
} from './utils/errors';
|
|
17
|
+
import Node from './Node';
|
|
18
|
+
import BrowserConnection from './aepp-wallet-communication/connection/Browser';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* RPC handler for AEPP side
|
|
22
|
+
* Contain functionality for wallet interaction and connect it to sdk
|
|
23
|
+
* @category aepp wallet communication
|
|
24
|
+
*/
|
|
25
|
+
export default class AeSdkAepp extends AeSdkBase {
|
|
26
|
+
name: string;
|
|
27
|
+
|
|
28
|
+
onAddressChange: (a: Accounts) => void;
|
|
29
|
+
|
|
30
|
+
onDisconnect: (p: any) => void;
|
|
31
|
+
|
|
32
|
+
onNetworkChange: (a: Network) => void;
|
|
33
|
+
|
|
34
|
+
rpcClient?: RpcClient<WalletApi, AeppApi>;
|
|
35
|
+
|
|
36
|
+
_accounts?: Accounts;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param options - Options
|
|
40
|
+
* @param options.name - Aepp name
|
|
41
|
+
* @param options.onAddressChange - Call-back function for update address event
|
|
42
|
+
* @param options.onDisconnect - Call-back function for disconnect event
|
|
43
|
+
* @param options.onNetworkChange - Call-back function for update network event
|
|
44
|
+
*/
|
|
45
|
+
constructor({
|
|
46
|
+
name,
|
|
47
|
+
onAddressChange = () => {},
|
|
48
|
+
onDisconnect = () => {},
|
|
49
|
+
onNetworkChange = () => {},
|
|
50
|
+
...other
|
|
51
|
+
}: {
|
|
52
|
+
name: string;
|
|
53
|
+
onAddressChange: (a: Accounts) => void;
|
|
54
|
+
onDisconnect: (p: any) => void;
|
|
55
|
+
onNetworkChange: (a: Network) => void;
|
|
56
|
+
} & ConstructorParameters<typeof AeSdkBase>[0]) {
|
|
57
|
+
super(other);
|
|
58
|
+
this.onAddressChange = onAddressChange;
|
|
59
|
+
this.onDisconnect = onDisconnect;
|
|
60
|
+
this.onNetworkChange = onNetworkChange;
|
|
61
|
+
this.name = name;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_resolveAccount(account: Account = this.addresses()[0]): AccountBase {
|
|
65
|
+
if (typeof account === 'string') {
|
|
66
|
+
const address = account as Encoded.AccountAddress;
|
|
67
|
+
decode(address);
|
|
68
|
+
if (!this.addresses().includes(address)) throw new UnAuthorizedAccountError(address);
|
|
69
|
+
account = new AccountRpc({ rpcClient: this.rpcClient, address });
|
|
70
|
+
}
|
|
71
|
+
if (account == null) this._ensureAccountAccess();
|
|
72
|
+
return super._resolveAccount(account);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
addresses(): Encoded.AccountAddress[] {
|
|
76
|
+
if (this._accounts == null) return [];
|
|
77
|
+
const current = Object.keys(this._accounts.current)[0];
|
|
78
|
+
return [
|
|
79
|
+
...current != null ? [current] : [], ...Object.keys(this._accounts.connected),
|
|
80
|
+
] as Encoded.AccountAddress[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Connect to wallet
|
|
85
|
+
* @param connection - Wallet connection object
|
|
86
|
+
* @param options - Options
|
|
87
|
+
* @param options.connectNode - Request wallet to bind node
|
|
88
|
+
* @param options.name - Node name
|
|
89
|
+
* @param options.select - Select this node as current
|
|
90
|
+
*/
|
|
91
|
+
async connectToWallet(
|
|
92
|
+
connection: BrowserConnection,
|
|
93
|
+
{ connectNode = false, name = 'wallet-node', select = false }:
|
|
94
|
+
{ connectNode?: boolean; name?: string; select?: boolean } = {},
|
|
95
|
+
): Promise<WalletInfo> {
|
|
96
|
+
if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');
|
|
97
|
+
let disconnectParams: any;
|
|
98
|
+
const client = new RpcClient<WalletApi, AeppApi>(
|
|
99
|
+
connection,
|
|
100
|
+
() => {
|
|
101
|
+
delete this.rpcClient;
|
|
102
|
+
delete this._accounts;
|
|
103
|
+
this.onDisconnect(disconnectParams);
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
[METHODS.updateAddress]: (params) => {
|
|
107
|
+
this._accounts = params;
|
|
108
|
+
this.onAddressChange(params);
|
|
109
|
+
},
|
|
110
|
+
[METHODS.updateNetwork]: (params) => {
|
|
111
|
+
const { node } = params;
|
|
112
|
+
if (node != null) this.addNode(node.name, new Node(node.url), true);
|
|
113
|
+
this.onNetworkChange(params);
|
|
114
|
+
},
|
|
115
|
+
[METHODS.closeConnection]: (params) => {
|
|
116
|
+
disconnectParams = params;
|
|
117
|
+
client.connection.disconnect();
|
|
118
|
+
},
|
|
119
|
+
[METHODS.readyToConnect]: () => {},
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
const { node, ...walletInfo } = await client
|
|
123
|
+
.request(METHODS.connect, { name: this.name, version: RPC_VERSION, connectNode });
|
|
124
|
+
if (connectNode) {
|
|
125
|
+
if (node == null) throw new RpcConnectionError('Missing URLs of the Node');
|
|
126
|
+
this.addNode(name, new Node(node.url), select);
|
|
127
|
+
}
|
|
128
|
+
this.rpcClient = client;
|
|
129
|
+
return walletInfo;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Disconnect from wallet
|
|
134
|
+
*/
|
|
135
|
+
disconnectWallet(): void {
|
|
136
|
+
this._ensureConnected();
|
|
137
|
+
this.rpcClient.notify(METHODS.closeConnection, { reason: 'bye' });
|
|
138
|
+
this.rpcClient.connection.disconnect();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Ask addresses from wallet
|
|
143
|
+
* @returns Addresses from wallet
|
|
144
|
+
*/
|
|
145
|
+
async askAddresses(): Promise<Encoded.AccountAddress[]> {
|
|
146
|
+
this._ensureAccountAccess();
|
|
147
|
+
return this.rpcClient.request(METHODS.address, undefined);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Subscribe for addresses from wallet
|
|
152
|
+
* @param type - Subscription type
|
|
153
|
+
* @param value - Should be one of 'current' (the selected account), 'connected' (all)
|
|
154
|
+
* @returns Accounts from wallet
|
|
155
|
+
*/
|
|
156
|
+
async subscribeAddress(
|
|
157
|
+
type: SUBSCRIPTION_TYPES,
|
|
158
|
+
value: 'current' | 'connected',
|
|
159
|
+
): Promise<ReturnType<WalletApi[METHODS.subscribeAddress]>> {
|
|
160
|
+
this._ensureConnected();
|
|
161
|
+
const result = await this.rpcClient.request(METHODS.subscribeAddress, { type, value });
|
|
162
|
+
this._accounts = result.address;
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_ensureConnected(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {
|
|
167
|
+
if (this.rpcClient != null) return;
|
|
168
|
+
throw new NoWalletConnectedError('You are not connected to Wallet');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_ensureAccountAccess(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {
|
|
172
|
+
this._ensureConnected();
|
|
173
|
+
if (this.addresses().length !== 0) return;
|
|
174
|
+
throw new UnsubscribedAccountError();
|
|
175
|
+
}
|
|
176
|
+
}
|