@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"amount-formatter.mjs","names":["BigNumber","isBigNumber","ArgumentError","AE_AMOUNT_FORMATS","DENOMINATION_MAGNITUDE","AE","MILI_AE","MICRO_AE","NANO_AE","PICO_AE","FEMTO_AE","AETTOS","formatAmount","value","denomination","targetDenomination","toString","shiftedBy","toFixed","toAe","toAettos","prefixes","name","magnitude","getNearestPrefix","exponent","reduce","p","n","Math","abs","getLowerBoundPrefix","find","length","rawValue","exp","e","v","precision","min"],"sources":["../../src/utils/amount-formatter.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\nimport BigNumber from 'bignumber.js';\nimport { isBigNumber } from './bignumber';\nimport { ArgumentError } from './errors';\n\nexport enum AE_AMOUNT_FORMATS {\n AE = 'ae',\n MILI_AE = 'miliAE',\n MICRO_AE = 'microAE',\n NANO_AE = 'nanoAE',\n PICO_AE = 'picoAE',\n FEMTO_AE = 'femtoAE',\n AETTOS = 'aettos',\n}\n\n/**\n * DENOMINATION_MAGNITUDE\n */\nconst DENOMINATION_MAGNITUDE = {\n [AE_AMOUNT_FORMATS.AE]: 0,\n [AE_AMOUNT_FORMATS.MILI_AE]: -3,\n [AE_AMOUNT_FORMATS.MICRO_AE]: -6,\n [AE_AMOUNT_FORMATS.NANO_AE]: -9,\n [AE_AMOUNT_FORMATS.PICO_AE]: -12,\n [AE_AMOUNT_FORMATS.FEMTO_AE]: -15,\n [AE_AMOUNT_FORMATS.AETTOS]: -18,\n} as const;\n\n/**\n * Convert amount from one to other denomination\n * @param value - amount to convert\n * @param options - options\n * @param options.denomination - denomination of amount, can be ['ae', 'aettos']\n * @param options.targetDenomination - target denomination,\n * can be ['ae', 'aettos']\n */\nexport const formatAmount = (\n value: string | number | bigint | BigNumber,\n { denomination = AE_AMOUNT_FORMATS.AETTOS, targetDenomination = AE_AMOUNT_FORMATS.AETTOS }:\n { denomination?: AE_AMOUNT_FORMATS; targetDenomination?: AE_AMOUNT_FORMATS },\n): string => {\n if (!isBigNumber(value)) throw new ArgumentError('value', 'a number', value);\n\n return new BigNumber(typeof value === 'bigint' ? value.toString() : value)\n .shiftedBy(DENOMINATION_MAGNITUDE[denomination] - DENOMINATION_MAGNITUDE[targetDenomination])\n .toFixed();\n};\n\n/**\n * Convert amount to AE\n * @param value - amount to convert\n * @param options - options\n * @param options.denomination - denomination of amount, can be ['ae', 'aettos']\n */\nexport const toAe = (\n value: string | number | BigNumber,\n { denomination = AE_AMOUNT_FORMATS.AETTOS }: { denomination?: AE_AMOUNT_FORMATS } = {},\n): string => formatAmount(value, { denomination, targetDenomination: AE_AMOUNT_FORMATS.AE });\n\n/**\n * Convert amount to aettos\n * @param value - amount to convert\n * @param options - options\n * @param options.denomination - denomination of amount, can be ['ae', 'aettos']\n */\nexport const toAettos = (\n value: string | number | BigNumber,\n { denomination = AE_AMOUNT_FORMATS.AE }: { denomination?: AE_AMOUNT_FORMATS } = {},\n): string => formatAmount(value, { denomination });\n\ninterface Prefix {\n name: string;\n magnitude: number;\n}\n\nconst prefixes: Prefix[] = [\n { name: 'exa', magnitude: 18 },\n { name: 'giga', magnitude: 9 },\n { name: '', magnitude: 0 },\n { name: 'pico', magnitude: -12 },\n];\n\nconst getNearestPrefix = (exponent: number): Prefix => prefixes.reduce((p, n) => (\n Math.abs(n.magnitude - exponent) < Math.abs(p.magnitude - exponent) ? n : p));\n\nconst getLowerBoundPrefix = (exponent: number): Prefix => prefixes\n .find((p) => p.magnitude <= exponent) ?? prefixes[prefixes.length - 1];\n\nexport default (rawValue: string | number | BigNumber): string => {\n const value: BigNumber = new BigNumber(rawValue);\n\n const exp = value.e ?? 0;\n const { name, magnitude } = (exp < 0 ? getNearestPrefix : getLowerBoundPrefix)(exp);\n const v = value\n .shiftedBy(-magnitude)\n .precision(9 + Math.min(exp - magnitude, 0))\n .toFixed();\n return `${v}${name !== '' ? ' ' : ''}${name}`;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,W;SACAC,a;AAET,WAAYC,iBAAZ;AAUA;AACA;AACA;;WAZYA,iB;EAAAA,iB;EAAAA,iB;EAAAA,iB;EAAAA,iB;EAAAA,iB;EAAAA,iB;EAAAA,iB;GAAAA,iB,KAAAA,iB;;AAaZ,MAAMC,sBAAsB,GAAG;EAC7B,CAACD,iBAAiB,CAACE,EAAnB,GAAwB,CADK;EAE7B,CAACF,iBAAiB,CAACG,OAAnB,GAA6B,CAAC,CAFD;EAG7B,CAACH,iBAAiB,CAACI,QAAnB,GAA8B,CAAC,CAHF;EAI7B,CAACJ,iBAAiB,CAACK,OAAnB,GAA6B,CAAC,CAJD;EAK7B,CAACL,iBAAiB,CAACM,OAAnB,GAA6B,CAAC,EALD;EAM7B,CAACN,iBAAiB,CAACO,QAAnB,GAA8B,CAAC,EANF;EAO7B,CAACP,iBAAiB,CAACQ,MAAnB,GAA4B,CAAC;AAPA,CAA/B;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAG,CAC1BC,KAD0B,WAIf;EAAA,IAFX;IAAEC,YAAY,GAAGX,iBAAiB,CAACQ,MAAnC;IAA2CI,kBAAkB,GAAGZ,iBAAiB,CAACQ;EAAlF,CAEW;EACX,IAAI,CAACV,WAAW,CAACY,KAAD,CAAhB,EAAyB,MAAM,IAAIX,aAAJ,CAAkB,OAAlB,EAA2B,UAA3B,EAAuCW,KAAvC,CAAN;EAEzB,OAAO,IAAIb,SAAJ,CAAc,OAAOa,KAAP,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E,GAA0ED,CADrB,CAAvD;;AAGA,MAAMI,mBAAmB,GAAIN,QAAD;EAAA;;EAAA,yBAA8BJ,QAAQ,CAC/DW,IADuD,CACjDL,CAAD,IAAOA,CAAC,CAACJ,SAAF,IAAeE,QAD4B,CAA9B,2DACeJ,QAAQ,CAACA,QAAQ,CAACY,MAAT,GAAkB,CAAnB,CADvB;AAAA,CAA5B;;AAGA,gBAAgBC,QAAD,IAAmD;EAAA;;EAChE,MAAMrB,KAAgB,GAAG,IAAIb,SAAJ,CAAckC,QAAd,CAAzB;EAEA,MAAMC,GAAG,eAAGtB,KAAK,CAACuB,CAAT,+CAAc,CAAvB;EACA,MAAM;IAAEd,IAAF;IAAQC;EAAR,IAAsB,CAACY,GAAG,GAAG,CAAN,GAAUX,gBAAV,GAA6BO,mBAA9B,EAAmDI,GAAnD,CAA5B;EACA,MAAME,CAAC,GAAGxB,KAAK,CACZI,SADO,CACG,CAACM,SADJ,EAEPe,SAFO,CAEG,IAAIT,IAAI,CAACU,GAAL,CAASJ,GAAG,GAAGZ,SAAf,EAA0B,CAA1B,CAFP,EAGPL,OAHO,EAAV;EAIA,OAAQ,GAAEmB,CAAE,GAAEf,IAAI,KAAK,EAAT,GAAc,GAAd,GAAoB,EAAG,GAAEA,IAAK,EAA5C;AACD,CAVD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PipelinePolicy } from '@azure/core-rest-pipeline';
|
|
2
|
+
import { AdditionalPolicyConfig } from '@azure/core-client';
|
|
3
|
+
export declare const genRequestQueuesPolicy: () => AdditionalPolicyConfig;
|
|
4
|
+
export declare const genCombineGetRequestsPolicy: () => AdditionalPolicyConfig;
|
|
5
|
+
export declare const genErrorFormatterPolicy: (getMessage: (b: any) => string) => AdditionalPolicyConfig;
|
|
6
|
+
export declare const genVersionCheckPolicy: (name: string, ignorePath: string, versionPromise: Promise<string>, geVersion: string, ltVersion: string) => PipelinePolicy;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { RestError } from '@azure/core-rest-pipeline';
|
|
2
|
+
import { pause } from "./other.mjs";
|
|
3
|
+
import semverSatisfies from "./semver-satisfies.mjs";
|
|
4
|
+
import { UnsupportedVersionError } from "./errors.mjs";
|
|
5
|
+
export const genRequestQueuesPolicy = () => {
|
|
6
|
+
const requestQueues = new Map();
|
|
7
|
+
return {
|
|
8
|
+
policy: {
|
|
9
|
+
name: 'request-queues',
|
|
10
|
+
|
|
11
|
+
async sendRequest(request, next) {
|
|
12
|
+
var _requestQueues$get;
|
|
13
|
+
|
|
14
|
+
const key = request.headers.get('__queue');
|
|
15
|
+
request.headers.delete('__queue');
|
|
16
|
+
|
|
17
|
+
const getResponse = async () => next(request);
|
|
18
|
+
|
|
19
|
+
if (key == null) return getResponse();
|
|
20
|
+
const req = ((_requestQueues$get = requestQueues.get(key)) !== null && _requestQueues$get !== void 0 ? _requestQueues$get : Promise.resolve()).then(getResponse, getResponse); // TODO: remove after fixing https://github.com/aeternity/aeternity/issues/3803
|
|
21
|
+
// gap to ensure that node won't reject the nonce
|
|
22
|
+
|
|
23
|
+
requestQueues.set(key, req.then(async () => pause(750)));
|
|
24
|
+
return req;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
position: 'perCall'
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const genCombineGetRequestsPolicy = () => {
|
|
32
|
+
const pendingGetRequests = new Map();
|
|
33
|
+
return {
|
|
34
|
+
policy: {
|
|
35
|
+
name: 'combine-requests',
|
|
36
|
+
|
|
37
|
+
async sendRequest(request, next) {
|
|
38
|
+
var _pendingGetRequests$g;
|
|
39
|
+
|
|
40
|
+
if (request.method !== 'GET') return next(request);
|
|
41
|
+
const key = JSON.stringify([request.url, request.body]);
|
|
42
|
+
const response = (_pendingGetRequests$g = pendingGetRequests.get(key)) !== null && _pendingGetRequests$g !== void 0 ? _pendingGetRequests$g : next(request);
|
|
43
|
+
pendingGetRequests.set(key, response);
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
return await response;
|
|
47
|
+
} finally {
|
|
48
|
+
pendingGetRequests.delete(key);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
position: 'perCall'
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export const genErrorFormatterPolicy = getMessage => ({
|
|
57
|
+
policy: {
|
|
58
|
+
name: 'error-formatter',
|
|
59
|
+
|
|
60
|
+
async sendRequest(request, next) {
|
|
61
|
+
try {
|
|
62
|
+
return await next(request);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
var _error$response;
|
|
65
|
+
|
|
66
|
+
if (!(error instanceof RestError) || error.request == null) throw error;
|
|
67
|
+
if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.bodyAsText) == null) throw error;
|
|
68
|
+
let body;
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
body = JSON.parse(error.response.bodyAsText);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
error.message = `${new URL(error.request.url).pathname.slice(1)} error`;
|
|
77
|
+
const message = getMessage(body);
|
|
78
|
+
if (message !== '') error.message += `:${message}`;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
},
|
|
84
|
+
position: 'perCall'
|
|
85
|
+
});
|
|
86
|
+
export const genVersionCheckPolicy = (name, ignorePath, versionPromise, geVersion, ltVersion) => ({
|
|
87
|
+
name: 'version-check',
|
|
88
|
+
|
|
89
|
+
async sendRequest(request, next) {
|
|
90
|
+
if (new URL(request.url).pathname === ignorePath) return next(request);
|
|
91
|
+
const args = [await versionPromise, geVersion, ltVersion];
|
|
92
|
+
if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args);
|
|
93
|
+
return next(request);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=autorest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autorest.mjs","names":["RestError","pause","semverSatisfies","UnsupportedVersionError","genRequestQueuesPolicy","requestQueues","Map","policy","name","sendRequest","request","next","key","headers","get","delete","getResponse","req","Promise","resolve","then","set","position","genCombineGetRequestsPolicy","pendingGetRequests","method","JSON","stringify","url","body","response","genErrorFormatterPolicy","getMessage","error","bodyAsText","parse","e","message","URL","pathname","slice","genVersionCheckPolicy","ignorePath","versionPromise","geVersion","ltVersion","args"],"sources":["../../src/utils/autorest.ts"],"sourcesContent":["import { RestError, PipelineResponse, PipelinePolicy } from '@azure/core-rest-pipeline';\nimport { AdditionalPolicyConfig } from '@azure/core-client';\nimport { pause } from './other';\nimport semverSatisfies from './semver-satisfies';\nimport { UnsupportedVersionError } from './errors';\n\nexport const genRequestQueuesPolicy = (): AdditionalPolicyConfig => {\n const requestQueues = new Map<string, Promise<unknown>>();\n\n return {\n policy: {\n name: 'request-queues',\n async sendRequest(request, next) {\n const key = request.headers.get('__queue');\n request.headers.delete('__queue');\n const getResponse = async (): Promise<PipelineResponse> => next(request);\n if (key == null) return getResponse();\n const req = (requestQueues.get(key) ?? Promise.resolve()).then(getResponse, getResponse);\n // TODO: remove after fixing https://github.com/aeternity/aeternity/issues/3803\n // gap to ensure that node won't reject the nonce\n requestQueues.set(key, req.then(async () => pause(750)));\n return req;\n },\n },\n position: 'perCall',\n };\n};\n\nexport const genCombineGetRequestsPolicy = (): AdditionalPolicyConfig => {\n const pendingGetRequests = new Map<string, Promise<PipelineResponse>>();\n\n return {\n policy: {\n name: 'combine-requests',\n async sendRequest(request, next) {\n if (request.method !== 'GET') return next(request);\n const key = JSON.stringify([request.url, request.body]);\n const response = pendingGetRequests.get(key) ?? next(request);\n pendingGetRequests.set(key, response);\n try {\n return await response;\n } finally {\n pendingGetRequests.delete(key);\n }\n },\n },\n position: 'perCall',\n };\n};\n\nexport const genErrorFormatterPolicy = (\n getMessage: (b: any) => string,\n): AdditionalPolicyConfig => ({\n policy: {\n name: 'error-formatter',\n async sendRequest(request, next) {\n try {\n return await next(request);\n } catch (error) {\n if (!(error instanceof RestError) || error.request == null) throw error;\n if (error.response?.bodyAsText == null) throw error;\n\n let body;\n try {\n body = JSON.parse(error.response.bodyAsText);\n } catch (e) {\n throw error;\n }\n error.message = `${new URL(error.request.url).pathname.slice(1)} error`;\n const message = getMessage(body);\n if (message !== '') error.message += `:${message}`;\n throw error;\n }\n },\n },\n position: 'perCall',\n});\n\nexport const genVersionCheckPolicy = (\n name: string,\n ignorePath: string,\n versionPromise: Promise<string>,\n geVersion: string,\n ltVersion: string,\n): PipelinePolicy => ({\n name: 'version-check',\n async sendRequest(request, next) {\n if (new URL(request.url).pathname === ignorePath) return next(request);\n const args = [await versionPromise, geVersion, ltVersion] as const;\n if (!semverSatisfies(...args)) throw new UnsupportedVersionError(name, ...args);\n return next(request);\n },\n});\n"],"mappings":"AAAA,SAASA,SAAT,QAA4D,2BAA5D;SAESC,K;OACFC,e;SACEC,uB;AAET,OAAO,MAAMC,sBAAsB,GAAG,MAA8B;EAClE,MAAMC,aAAa,GAAG,IAAIC,GAAJ,EAAtB;EAEA,OAAO;IACLC,MAAM,EAAE;MACNC,IAAI,EAAE,gBADA;;MAEN,MAAMC,WAAN,CAAkBC,OAAlB,EAA2BC,IAA3B,EAAiC;QAAA;;QAC/B,MAAMC,GAAG,GAAGF,OAAO,CAACG,OAAR,CAAgBC,GAAhB,CAAoB,SAApB,CAAZ;QACAJ,OAAO,CAACG,OAAR,CAAgBE,MAAhB,CAAuB,SAAvB;;QACA,MAAMC,WAAW,GAAG,YAAuCL,IAAI,CAACD,OAAD,CAA/D;;QACA,IAAIE,GAAG,IAAI,IAAX,EAAiB,OAAOI,WAAW,EAAlB;QACjB,MAAMC,GAAG,GAAG,uBAACZ,aAAa,CAACS,GAAd,CAAkBF,GAAlB,CAAD,mEAA2BM,OAAO,CAACC,OAAR,EAA3B,EAA8CC,IAA9C,CAA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CAApB,EAA+B,MAAM,IAAI3C,uBAAJ,CAA4BK,IAA5B,EAAkC,GAAGsC,IAArC,CAAN;IAC/B,OAAOnC,IAAI,CAACD,OAAD,CAAX;EACD;;AAPmB,CANe,CAA9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Big Number Helpers
|
|
3
|
+
*/
|
|
4
|
+
import BigNumber from 'bignumber.js';
|
|
5
|
+
/**
|
|
6
|
+
* Check if value is BigNumber, Number, BigInt or number string representation
|
|
7
|
+
* @param number - number to check
|
|
8
|
+
*/
|
|
9
|
+
export declare const isBigNumber: (number: string | number | bigint | BigNumber) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* BigNumber ceil operation
|
|
12
|
+
*/
|
|
13
|
+
export declare const ceil: (bigNumber: BigNumber) => BigNumber;
|
package/es/utils/bignumber.mjs
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Big Number Helpers
|
|
3
|
-
* @module @aeternity/aepp-sdk/es/utils/bignumber
|
|
4
|
-
* @example import { isBigNumber, ceil } from '@aeternity/aepp-sdk/es/utils/bignumber'
|
|
5
5
|
*/
|
|
6
6
|
import BigNumber from 'bignumber.js';
|
|
7
7
|
/**
|
|
8
|
-
* Check if value is BigNumber, Number or number string representation
|
|
9
|
-
* @param
|
|
10
|
-
* @return {Boolean}
|
|
8
|
+
* Check if value is BigNumber, Number, BigInt or number string representation
|
|
9
|
+
* @param number - number to check
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
|
-
export const isBigNumber = number =>
|
|
12
|
+
export const isBigNumber = number => {
|
|
13
|
+
var _context;
|
|
14
|
+
|
|
15
|
+
if (typeof number === 'bigint') return true;
|
|
16
|
+
return _includesInstanceProperty(_context = ['number', 'object', 'string']).call(_context, typeof number) // eslint-disable-next-line no-restricted-globals
|
|
17
|
+
&& (!isNaN(number) || Number.isInteger(number) || BigNumber.isBigNumber(number));
|
|
18
|
+
};
|
|
14
19
|
/**
|
|
15
20
|
* BigNumber ceil operation
|
|
16
|
-
* @param {BigNumber} bigNumber
|
|
17
|
-
* @return {BigNumber}
|
|
18
21
|
*/
|
|
19
22
|
|
|
20
23
|
export const ceil = bigNumber => bigNumber.integerValue(BigNumber.ROUND_CEIL);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"bignumber.mjs","names":["BigNumber","isBigNumber","number","isNaN","Number","isInteger","ceil","bigNumber","integerValue","ROUND_CEIL"],"sources":["../../src/utils/bignumber.ts"],"sourcesContent":["/**\n * Big Number Helpers\n */\nimport BigNumber from 'bignumber.js';\n\n/**\n * Check if value is BigNumber, Number, BigInt or number string representation\n * @param number - number to check\n */\nexport const isBigNumber = (number: string | number | bigint | BigNumber): boolean => {\n if (typeof number === 'bigint') return true;\n return ['number', 'object', 'string'].includes(typeof number)\n // eslint-disable-next-line no-restricted-globals\n && (!isNaN(number as number) || Number.isInteger(number) || BigNumber.isBigNumber(number));\n};\n\n/**\n * BigNumber ceil operation\n */\nexport const ceil = (bigNumber: BigNumber): BigNumber => bigNumber\n .integerValue(BigNumber.ROUND_CEIL);\n"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,cAAtB;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAIC,MAAD,IAA2D;EAAA;;EACpF,IAAI,OAAOA,MAAP,KAAkB,QAAtB,EAAgC,OAAO,IAAP;EAChC,OAAO,sCAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,kBAAwC,OAAOA,MAA/C,EACL;EADK,IAED,CAACC,KAAK,CAACD,MAAD,CAAN,IAA4BE,MAAM,CAACC,SAAP,CAAiBH,MAAjB,CAA5B,IAAwDF,SAAS,CAACC,WAAV,CAAsBC,MAAtB,CAFvD,CAAP;AAGD,CALM;AAOP;AACA;AACA;;AACA,OAAO,MAAMI,IAAI,GAAIC,SAAD,IAAqCA,SAAS,CAC/DC,YADsD,CACzCR,SAAS,CAACS,UAD+B,CAAlD"}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
/**
|
|
4
|
-
* Bytes module
|
|
5
|
-
* @module @aeternity/aepp-sdk/es/utils/bytes
|
|
6
|
-
* @example import { Crypto } from '@aeternity/aepp-sdk'
|
|
7
|
-
*/
|
|
8
3
|
/**
|
|
9
4
|
* Convert bignumber to byte array
|
|
10
|
-
* @param
|
|
11
|
-
* @
|
|
5
|
+
* @param x - bignumber instance
|
|
6
|
+
* @returns Buffer
|
|
12
7
|
*/
|
|
13
8
|
export declare function bigNumberToByteArray(x: BigNumber): Buffer;
|
|
14
9
|
/**
|
|
15
10
|
* Convert string, number, or BigNumber to byte array
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @
|
|
11
|
+
* @param val - value to convert
|
|
12
|
+
* @param big - enables force conversion to BigNumber
|
|
13
|
+
* @returns Buffer
|
|
19
14
|
*/
|
|
20
15
|
export declare function toBytes(val?: null | string | number | BigNumber, big?: boolean): Buffer;
|
|
21
16
|
/**
|
|
22
17
|
* Convert a string to a Buffer. If encoding is not specified, hex-encoding
|
|
23
18
|
* will be used if the input is valid hex. If the input is valid base64 but
|
|
24
19
|
* not valid hex, base64 will be used. Otherwise, utf8 will be used.
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
20
|
+
* @param str - String to be converted.
|
|
21
|
+
* @param enc - Encoding of the input string.
|
|
22
|
+
* @returns Buffer containing the input data.
|
|
28
23
|
*/
|
|
29
24
|
export declare function str2buf(str: string, enc?: BufferEncoding): Buffer;
|
|
25
|
+
export declare const bytesToHex: (b: Uint8Array) => string;
|
|
26
|
+
export declare const hexToBytes: (s: string) => Uint8Array;
|
package/es/utils/bytes.mjs
CHANGED
|
@@ -22,29 +22,23 @@ const {
|
|
|
22
22
|
import BigNumber from 'bignumber.js';
|
|
23
23
|
import { NoSerializerFoundError, TypeError } from "./errors.mjs";
|
|
24
24
|
import { isBase64, isHex } from "./string.mjs";
|
|
25
|
-
/**
|
|
26
|
-
* Bytes module
|
|
27
|
-
* @module @aeternity/aepp-sdk/es/utils/bytes
|
|
28
|
-
* @example import { Crypto } from '@aeternity/aepp-sdk'
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
25
|
/**
|
|
32
26
|
* Convert bignumber to byte array
|
|
33
|
-
* @param
|
|
34
|
-
* @
|
|
27
|
+
* @param x - bignumber instance
|
|
28
|
+
* @returns Buffer
|
|
35
29
|
*/
|
|
36
30
|
|
|
37
31
|
export function bigNumberToByteArray(x) {
|
|
38
32
|
if (!x.isInteger()) throw new TypeError(`Unexpected not integer value: ${x.toFixed()}`);
|
|
39
33
|
let hexString = x.toString(16);
|
|
40
|
-
if (hexString.length % 2 === 1) hexString =
|
|
34
|
+
if (hexString.length % 2 === 1) hexString = `0${hexString}`;
|
|
41
35
|
return _Buffer.from(hexString, 'hex');
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
38
|
* Convert string, number, or BigNumber to byte array
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @
|
|
39
|
+
* @param val - value to convert
|
|
40
|
+
* @param big - enables force conversion to BigNumber
|
|
41
|
+
* @returns Buffer
|
|
48
42
|
*/
|
|
49
43
|
|
|
50
44
|
export function toBytes(val) {
|
|
@@ -69,9 +63,9 @@ export function toBytes(val) {
|
|
|
69
63
|
* Convert a string to a Buffer. If encoding is not specified, hex-encoding
|
|
70
64
|
* will be used if the input is valid hex. If the input is valid base64 but
|
|
71
65
|
* not valid hex, base64 will be used. Otherwise, utf8 will be used.
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @
|
|
66
|
+
* @param str - String to be converted.
|
|
67
|
+
* @param enc - Encoding of the input string.
|
|
68
|
+
* @returns Buffer containing the input data.
|
|
75
69
|
*/
|
|
76
70
|
|
|
77
71
|
export function str2buf(str, enc) {
|
|
@@ -79,4 +73,6 @@ export function str2buf(str, enc) {
|
|
|
79
73
|
|
|
80
74
|
return _Buffer.from(str, (_ref = enc !== null && enc !== void 0 ? enc : isHex(str) ? 'hex' : undefined) !== null && _ref !== void 0 ? _ref : isBase64(str) ? 'base64' : undefined);
|
|
81
75
|
}
|
|
76
|
+
export const bytesToHex = b => _Buffer.from(b).toString('hex');
|
|
77
|
+
export const hexToBytes = s => _Buffer.from(s, 'hex');
|
|
82
78
|
//# sourceMappingURL=bytes.mjs.map
|
package/es/utils/bytes.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"bytes.mjs","names":["BigNumber","NoSerializerFoundError","TypeError","isBase64","isHex","bigNumberToByteArray","x","isInteger","toFixed","hexString","toString","length","from","toBytes","val","big","undefined","Number","isBigNumber","str2buf","str","enc","bytesToHex","b","hexToBytes","s"],"sources":["../../src/utils/bytes.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 */\nimport BigNumber from 'bignumber.js';\nimport { NoSerializerFoundError, TypeError } from './errors';\nimport { isBase64, isHex } from './string';\n\n/**\n * Convert bignumber to byte array\n * @param x - bignumber instance\n * @returns Buffer\n */\nexport function bigNumberToByteArray(x: BigNumber): Buffer {\n if (!x.isInteger()) throw new TypeError(`Unexpected not integer value: ${x.toFixed()}`);\n let hexString = x.toString(16);\n if (hexString.length % 2 === 1) hexString = `0${hexString}`;\n return Buffer.from(hexString, 'hex');\n}\n\n/**\n * Convert string, number, or BigNumber to byte array\n * @param val - value to convert\n * @param big - enables force conversion to BigNumber\n * @returns Buffer\n */\nexport function toBytes(val?: null | string | number | BigNumber, big = false): Buffer {\n // Encode a value to bytes.\n // If the value is an int it will be encoded as bytes big endian\n // Raises ValueError if the input is not an int or string\n\n if (val === undefined || val === null) return Buffer.from([]);\n if (Number.isInteger(val) || BigNumber.isBigNumber(val) || big) {\n if (!BigNumber.isBigNumber(val)) val = new BigNumber(val);\n return bigNumberToByteArray(val);\n }\n if (typeof val === 'string') {\n return Buffer.from(val);\n }\n throw new NoSerializerFoundError();\n}\n\n/**\n * Convert a string to a Buffer. If encoding is not specified, hex-encoding\n * will be used if the input is valid hex. If the input is valid base64 but\n * not valid hex, base64 will be used. Otherwise, utf8 will be used.\n * @param str - String to be converted.\n * @param enc - Encoding of the input string.\n * @returns Buffer containing the input data.\n */\nexport function str2buf(str: string, enc?: BufferEncoding): Buffer {\n return Buffer.from(\n str,\n enc ?? (isHex(str) ? 'hex' : undefined) ?? (isBase64(str) ? 'base64' : undefined),\n );\n}\n\nexport const bytesToHex = (b: Uint8Array): string => Buffer.from(b).toString('hex');\n\nexport const hexToBytes = (s: string): Uint8Array => Buffer.from(s, 'hex');\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,sB,EAAwBC,S;SACxBC,Q,EAA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GAFK,aAELA,GAFK,cAELA,GAFK,GAEGjB,KAAK,CAACgB,GAAD,CAAL,GAAa,KAAb,GAAqBJ,SAFxB,uCAEuCb,QAAQ,CAACiB,GAAD,CAAR,GAAgB,QAAhB,GAA2BJ,SAFlE,CAAP;AAID;AAED,OAAO,MAAMM,UAAU,GAAIC,CAAD,IAA2B,QAAOX,IAAP,CAAYW,CAAZ,EAAeb,QAAf,CAAwB,KAAxB,CAA9C;AAEP,OAAO,MAAMc,UAAU,GAAIC,CAAD,IAA2B,QAAOb,IAAP,CAAYa,CAAZ,EAAe,KAAf,CAA9C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SignKeyPair } from 'tweetnacl';
|
|
3
|
+
import { Encoded, Encoding } from './encoder';
|
|
4
|
+
/**
|
|
5
|
+
* Generate address from secret key
|
|
6
|
+
* @param secret - Private key
|
|
7
|
+
* @returns Public key encoded as address
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAddressFromPriv(secret: string | Uint8Array): Encoded.AccountAddress;
|
|
10
|
+
/**
|
|
11
|
+
* Check if address is valid
|
|
12
|
+
* @param address - Address
|
|
13
|
+
* @param prefix - Transaction prefix. Default: 'ak'
|
|
14
|
+
* @returns is valid
|
|
15
|
+
*/
|
|
16
|
+
export declare function isAddressValid(address: string, prefix?: Encoding): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a random salt (positive integer)
|
|
19
|
+
* @returns random salt
|
|
20
|
+
*/
|
|
21
|
+
export declare function genSalt(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a positive integer to the smallest possible
|
|
24
|
+
* representation in a binary digit representation
|
|
25
|
+
* @param value - Value to encode
|
|
26
|
+
* @returns Encoded number
|
|
27
|
+
*/
|
|
28
|
+
export declare function encodeUnsigned(value: number): Buffer;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate 256bits Blake2b hash of `input`
|
|
31
|
+
* @param input - Data to hash
|
|
32
|
+
* @returns Hash
|
|
33
|
+
*/
|
|
34
|
+
export declare function hash(input: string | Uint8Array): Buffer;
|
|
35
|
+
/**
|
|
36
|
+
* Compute contract address
|
|
37
|
+
* @category contract
|
|
38
|
+
* @param owner - Address of contract owner
|
|
39
|
+
* @param nonce - Round when contract was created
|
|
40
|
+
* @returns Contract address
|
|
41
|
+
*/
|
|
42
|
+
export declare function encodeContractAddress(owner: Encoded.AccountAddress, nonce: number): Encoded.ContractAddress;
|
|
43
|
+
/**
|
|
44
|
+
* Generate keyPair from secret key
|
|
45
|
+
* @param secret - secret key
|
|
46
|
+
* @returns Object with Private(privateKey) and Public(publicKey) keys
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateKeyPairFromSecret(secret: Uint8Array): SignKeyPair;
|
|
49
|
+
/**
|
|
50
|
+
* Generate a random ED25519 keypair
|
|
51
|
+
* @param raw - Whether to return raw (binary) keys
|
|
52
|
+
* @returns Key pair
|
|
53
|
+
*/
|
|
54
|
+
export declare function generateKeyPair(raw: true): {
|
|
55
|
+
publicKey: Buffer;
|
|
56
|
+
secretKey: Buffer;
|
|
57
|
+
};
|
|
58
|
+
export declare function generateKeyPair(raw?: false): {
|
|
59
|
+
publicKey: Encoded.AccountAddress;
|
|
60
|
+
secretKey: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Generate signature
|
|
64
|
+
* @param data - Data to sign
|
|
65
|
+
* @param privateKey - Key to sign with
|
|
66
|
+
* @returns Signature
|
|
67
|
+
*/
|
|
68
|
+
export declare function sign(data: string | Uint8Array, privateKey: string | Uint8Array): Uint8Array;
|
|
69
|
+
/**
|
|
70
|
+
* Verify that signature was signed by public key
|
|
71
|
+
* @param data - Data to verify
|
|
72
|
+
* @param signature - Signature to verify
|
|
73
|
+
* @param publicKey - Key to verify against
|
|
74
|
+
* @returns Valid?
|
|
75
|
+
*/
|
|
76
|
+
export declare function verify(data: Uint8Array, signature: Uint8Array, publicKey: string | Uint8Array): boolean;
|
|
77
|
+
export declare function messageToHash(message: string): Buffer;
|
|
78
|
+
export declare function signMessage(message: string, privateKey: string | Buffer): Uint8Array;
|
|
79
|
+
export declare function verifyMessage(str: string, signature: Uint8Array, publicKey: string | Uint8Array): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Check key pair for validity
|
|
82
|
+
*
|
|
83
|
+
* Sign a message, and then verifying that signature
|
|
84
|
+
* @param privateKey - Private key to verify
|
|
85
|
+
* @param publicKey - Public key to verify
|
|
86
|
+
* @returns Valid?
|
|
87
|
+
*/
|
|
88
|
+
export declare function isValidKeypair(privateKey: string | Uint8Array, publicKey: string | Uint8Array): boolean;
|