@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +12031 -11231
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -3
- package/es/AeSdk.mjs +17 -22
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +6 -5
- package/es/AeSdkAepp.mjs +7 -30
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +18 -140
- package/es/AeSdkBase.mjs +30 -184
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +123 -0
- package/es/AeSdkMethods.mjs +122 -0
- package/es/AeSdkMethods.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +7 -21
- package/es/AeSdkWallet.mjs +38 -86
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +11 -15
- package/es/Node.mjs +35 -48
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +24 -40
- package/es/account/Base.mjs +1 -101
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +16 -0
- package/es/account/Generalized.mjs +113 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +102 -0
- package/es/account/Ledger.mjs.map +1 -0
- package/es/account/LedgerFactory.d.ts +39 -0
- package/es/account/LedgerFactory.mjs +81 -0
- package/es/account/LedgerFactory.mjs.map +1 -0
- package/es/account/Memory.d.ts +13 -17
- package/es/account/Memory.mjs +43 -64
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -8
- package/es/account/Rpc.mjs +14 -32
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +4 -4
- package/es/aens.mjs +46 -41
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs +14 -68
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +23 -29
- package/es/apis/compiler/compiler.mjs +128 -189
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/index.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +82 -135
- package/es/apis/compiler/models/index.mjs +1 -47
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +8 -8
- package/es/apis/compiler/models/mappers.mjs +165 -183
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.d.ts +0 -1
- package/es/apis/compiler/models/parameters.mjs +5 -9
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/node/index.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +48 -48
- package/es/apis/node/models/mappers.mjs +12 -6
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +43 -84
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +10 -2
- package/es/chain.mjs +37 -59
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +200 -0
- package/es/channel/Base.mjs +293 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +248 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +219 -0
- package/es/channel/Spend.mjs +385 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +151 -899
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +101 -191
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +210 -0
- package/es/contract/Contract.mjs +551 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/compiler/Base.d.ts +81 -0
- package/es/contract/compiler/Base.mjs +5 -0
- package/es/contract/compiler/Base.mjs.map +1 -0
- package/es/contract/compiler/Cli.d.ts +23 -0
- package/es/contract/compiler/Cli.mjs +155 -0
- package/es/contract/compiler/Cli.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +32 -0
- package/es/contract/compiler/Http.mjs +118 -0
- package/es/contract/compiler/Http.mjs.map +1 -0
- package/es/contract/compiler/HttpNode.d.ts +17 -0
- package/es/contract/compiler/HttpNode.mjs +26 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -0
- package/es/contract/compiler/getFileSystem.d.ts +6 -0
- package/es/contract/compiler/getFileSystem.mjs +40 -0
- package/es/contract/compiler/getFileSystem.mjs.map +1 -0
- package/es/contract/ga.d.ts +9 -34
- package/es/contract/ga.mjs +29 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +39 -0
- package/es/index-browser.mjs +55 -0
- package/es/index-browser.mjs.map +1 -0
- package/es/index.d.ts +4 -35
- package/es/index.mjs +4 -51
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +34 -40
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +18 -23
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +30 -2
- package/es/tx/builder/constants.mjs +43 -14
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +10 -0
- package/es/tx/builder/field-types/abi-version.mjs +20 -0
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
- package/es/tx/builder/field-types/address.d.ts +14 -0
- package/es/tx/builder/field-types/address.mjs +51 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/array.d.ts +7 -0
- package/es/tx/builder/field-types/array.mjs +11 -0
- package/es/tx/builder/field-types/array.mjs.map +1 -0
- package/es/tx/builder/field-types/boolean.d.ts +6 -0
- package/es/tx/builder/field-types/boolean.mjs +13 -0
- package/es/tx/builder/field-types/boolean.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
- package/es/tx/builder/field-types/coin-amount.mjs +4 -12
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +30 -0
- package/es/tx/builder/field-types/ct-version.mjs +48 -0
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +1 -2
- package/es/tx/builder/field-types/deposit.mjs +2 -4
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +6 -0
- package/es/tx/builder/field-types/encoded.mjs +21 -0
- package/es/tx/builder/field-types/encoded.mjs.map +1 -0
- package/es/tx/builder/field-types/entry.d.ts +11 -0
- package/es/tx/builder/field-types/entry.mjs +31 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -0
- package/es/tx/builder/field-types/enumeration.d.ts +7 -0
- package/es/tx/builder/field-types/enumeration.mjs +30 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +10 -15
- package/es/tx/builder/field-types/fee.mjs +31 -43
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs +0 -2
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/es/tx/builder/field-types/gas-limit.mjs +12 -14
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -2
- package/es/tx/builder/field-types/gas-price.mjs +3 -7
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +80 -30
- package/es/tx/builder/field-types/index.mjs +34 -9
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.d.ts +37 -0
- package/es/tx/builder/field-types/mptree.mjs +268 -0
- package/es/tx/builder/field-types/mptree.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +1 -3
- package/es/tx/builder/field-types/name-fee.mjs +3 -5
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.d.ts +1 -4
- package/es/tx/builder/field-types/name-id.mjs +5 -10
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs +0 -2
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.d.ts +23 -0
- package/es/tx/builder/field-types/pointers.mjs +36 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -0
- package/es/tx/builder/field-types/raw.d.ts +6 -0
- package/es/tx/builder/field-types/raw.mjs +13 -0
- package/es/tx/builder/field-types/raw.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.mjs +0 -2
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.d.ts +6 -0
- package/es/tx/builder/field-types/string.mjs +10 -0
- package/es/tx/builder/field-types/string.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +1 -2
- package/es/tx/builder/field-types/u-int.mjs +3 -4
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -32
- package/es/tx/builder/helpers.mjs +19 -71
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +11 -49
- package/es/tx/builder/index.mjs +57 -337
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2367 -667
- package/es/tx/builder/schema.mjs +70 -145
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +4 -49
- package/es/tx/index.mjs +38 -112
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -6
- package/es/tx/validator.mjs +104 -90
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +4 -10
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +1 -0
- package/es/utils/autorest.mjs +17 -19
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +4 -7
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.d.ts +0 -17
- package/es/utils/bytes.mjs +6 -35
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +15 -8
- package/es/utils/crypto.mjs +40 -40
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +28 -28
- package/es/utils/encoder-types.mjs +0 -1
- package/es/utils/encoder-types.mjs.map +1 -1
- package/es/utils/encoder.d.ts +0 -1
- package/es/utils/encoder.mjs +7 -15
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +15 -14
- package/es/utils/errors.mjs +86 -172
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +27 -19
- package/es/utils/hd-wallet.mjs +42 -26
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +0 -8
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +2 -0
- package/es/utils/keystore.mjs +37 -36
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +4 -2
- package/es/utils/other.mjs +11 -7
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs +0 -3
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +0 -12
- package/es/utils/string.mjs +1 -21
- package/es/utils/string.mjs.map +1 -1
- package/package.json +98 -51
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +31 -202
- package/src/AeSdkMethods.ts +169 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +17 -18
- package/src/account/Base.ts +29 -75
- package/src/account/Generalized.ts +98 -0
- package/src/account/Ledger.ts +131 -0
- package/src/account/LedgerFactory.ts +86 -0
- package/src/account/Memory.ts +46 -60
- package/src/account/Rpc.ts +17 -26
- package/src/aens.ts +13 -11
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
- package/src/aepp-wallet-communication/rpc/types.ts +11 -1
- package/src/aepp-wallet-communication/schema.ts +18 -18
- package/src/apis/compiler/code-model-v4.yaml +681 -888
- package/src/apis/compiler/compiler.ts +113 -154
- package/src/apis/compiler/models/index.ts +80 -140
- package/src/apis/compiler/models/mappers.ts +165 -183
- package/src/apis/compiler/models/parameters.ts +6 -12
- package/src/chain.ts +11 -6
- package/src/channel/Base.ts +335 -0
- package/src/channel/Contract.ts +488 -0
- package/src/channel/Spend.ts +408 -0
- package/src/channel/handlers.ts +164 -582
- package/src/channel/internal.ts +114 -143
- package/src/contract/Contract.ts +610 -0
- package/src/contract/compiler/Base.ts +94 -0
- package/src/contract/compiler/Cli.ts +134 -0
- package/src/contract/compiler/Http.ts +124 -0
- package/src/contract/compiler/HttpNode.ts +26 -0
- package/src/contract/compiler/getFileSystem.ts +42 -0
- package/src/contract/ga.ts +23 -106
- package/src/index-browser.ts +58 -0
- package/src/index.ts +4 -55
- package/src/oracle.ts +8 -8
- package/src/spend.ts +6 -14
- package/src/tx/builder/constants.ts +33 -3
- package/src/tx/builder/field-types/abi-version.ts +21 -0
- package/src/tx/builder/field-types/address.ts +62 -0
- package/src/tx/builder/field-types/array.ts +19 -0
- package/src/tx/builder/field-types/boolean.ts +9 -0
- package/src/tx/builder/field-types/coin-amount.ts +4 -9
- package/src/tx/builder/field-types/ct-version.ts +50 -0
- package/src/tx/builder/field-types/deposit.ts +1 -1
- package/src/tx/builder/field-types/encoded.ts +27 -0
- package/src/tx/builder/field-types/entry.ts +31 -0
- package/src/tx/builder/field-types/enumeration.ts +32 -0
- package/src/tx/builder/field-types/fee.ts +39 -21
- package/src/tx/builder/field-types/gas-limit.ts +13 -8
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +54 -15
- package/src/tx/builder/field-types/mptree.ts +242 -0
- package/src/tx/builder/field-types/name-fee.ts +2 -3
- package/src/tx/builder/field-types/name-id.ts +7 -10
- package/src/tx/builder/field-types/pointers.ts +41 -0
- package/src/tx/builder/field-types/raw.ts +9 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
- package/src/tx/builder/field-types/string.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +4 -5
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +65 -308
- package/src/tx/builder/schema.ts +280 -341
- package/src/tx/index.ts +40 -103
- package/src/tx/validator.ts +91 -96
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +6 -34
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +22 -25
- package/src/utils/hd-wallet.ts +30 -9
- package/src/utils/keystore.ts +24 -21
- package/src/utils/other.ts +16 -1
- package/src/utils/string.ts +0 -20
- package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.2/Node.d.ts +78 -0
- package/types-legacy/ts4.2/account/Base.d.ts +52 -0
- package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.2/aens.d.ts +222 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.2/chain.d.ts +256 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index-browser.d.ts +39 -0
- package/types-legacy/ts4.2/index.d.ts +5 -0
- package/types-legacy/ts4.2/oracle.d.ts +161 -0
- package/types-legacy/ts4.2/spend.d.ts +62 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.2/tx/index.d.ts +19 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.2/utils/other.d.ts +31 -0
- package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.2/utils/string.d.ts +12 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.5/Node.d.ts +78 -0
- package/types-legacy/ts4.5/account/Base.d.ts +52 -0
- package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.5/aens.d.ts +222 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.5/chain.d.ts +256 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.5/index-browser.d.ts +39 -0
- package/types-legacy/ts4.5/index.d.ts +4 -0
- package/types-legacy/ts4.5/oracle.d.ts +161 -0
- package/types-legacy/ts4.5/spend.d.ts +62 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.5/tx/index.d.ts +19 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.5/utils/other.d.ts +31 -0
- package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.5/utils/string.d.ts +12 -0
- package/es/channel/index.d.ts +0 -625
- package/es/channel/index.mjs +0 -975
- package/es/channel/index.mjs.map +0 -1
- package/es/contract/Compiler.d.ts +0 -18
- package/es/contract/Compiler.mjs +0 -68
- package/es/contract/Compiler.mjs.map +0 -1
- package/es/contract/aci.d.ts +0 -127
- package/es/contract/aci.mjs +0 -508
- package/es/contract/aci.mjs.map +0 -1
- package/es/contract/methods.d.ts +0 -71
- package/es/contract/methods.mjs +0 -104
- package/es/contract/methods.mjs.map +0 -1
- package/es/deprecated/index.d.ts +0 -143
- package/es/deprecated/index.mjs +0 -162
- package/es/deprecated/index.mjs.map +0 -1
- package/es/deprecated/methods.d.ts +0 -18
- package/es/deprecated/methods.mjs +0 -26
- package/es/deprecated/methods.mjs.map +0 -1
- package/es/tx/builder/address.d.ts +0 -25
- package/es/tx/builder/address.mjs +0 -45
- package/es/tx/builder/address.mjs.map +0 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
- package/es/utils/mptree.d.ts +0 -26
- package/es/utils/mptree.mjs +0 -165
- package/es/utils/mptree.mjs.map +0 -1
- package/src/channel/index.ts +0 -1025
- package/src/contract/Compiler.ts +0 -67
- package/src/contract/aci.ts +0 -537
- package/src/contract/methods.ts +0 -123
- package/src/deprecated/index.ts +0 -172
- package/src/deprecated/methods.ts +0 -25
- package/src/tx/builder/address.ts +0 -50
- package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
- package/src/utils/mptree.ts +0 -145
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder-types.mjs","names":["Encoding"],"sources":["../../src/utils/encoder-types.ts"],"sourcesContent":["/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L205-L230}\n */\nexport enum Encoding {\n KeyBlockHash = 'kh',\n MicroBlockHash = 'mh',\n BlockPofHash = 'bf',\n BlockTxHash = 'bx',\n BlockStateHash = 'bs',\n Channel = 'ch',\n ContractAddress = 'ct',\n ContractBytearray = 'cb',\n ContractStoreKey = 'ck',\n ContractStoreValue = 'cv',\n Transaction = 'tx',\n TxHash = 'th',\n OracleAddress = 'ok',\n OracleQuery = 'ov',\n OracleQueryId = 'oq',\n OracleResponse = 'or',\n AccountAddress = 'ak',\n Signature = 'sg',\n Commitment = 'cm',\n PeerPubkey = 'pp',\n Name = 'nm',\n State = 'st',\n Poi = 'pi',\n StateTrees = 'ss',\n CallStateTree = 'cs',\n Bytearray = 'ba',\n}\n\nexport type KeyBlockHash = `${Encoding.KeyBlockHash}_${string}`;\nexport type MicroBlockHash = `${Encoding.MicroBlockHash}_${string}`;\nexport type BlockPofHash = `${Encoding.BlockPofHash}_${string}`;\nexport type BlockTxHash = `${Encoding.BlockTxHash}_${string}`;\nexport type BlockStateHash = `${Encoding.BlockStateHash}_${string}`;\nexport type Channel = `${Encoding.Channel}_${string}`;\nexport type ContractAddress = `${Encoding.ContractAddress}_${string}`;\nexport type ContractBytearray = `${Encoding.ContractBytearray}_${string}`;\nexport type ContractStoreKey = `${Encoding.ContractStoreKey}_${string}`;\nexport type ContractStoreValue = `${Encoding.ContractStoreValue}_${string}`;\nexport type Transaction = `${Encoding.Transaction}_${string}`;\nexport type TxHash = `${Encoding.TxHash}_${string}`;\nexport type OracleAddress = `${Encoding.OracleAddress}_${string}`;\nexport type OracleQuery = `${Encoding.OracleQuery}_${string}`;\nexport type OracleQueryId = `${Encoding.OracleQueryId}_${string}`;\nexport type OracleResponse = `${Encoding.OracleResponse}_${string}`;\nexport type AccountAddress = `${Encoding.AccountAddress}_${string}`;\nexport type Signature = `${Encoding.Signature}_${string}`;\nexport type Commitment = `${Encoding.Commitment}_${string}`;\nexport type PeerPubkey = `${Encoding.PeerPubkey}_${string}`;\nexport type Name = `${Encoding.Name}_${string}`;\nexport type State = `${Encoding.State}_${string}`;\nexport type Poi = `${Encoding.Poi}_${string}`;\nexport type StateTrees = `${Encoding.StateTrees}_${string}`;\nexport type CallStateTree = `${Encoding.CallStateTree}_${string}`;\nexport type Bytearray = `${Encoding.Bytearray}_${string}`;\n\nexport type Generic<Type extends Encoding> = `${Type}_${string}`;\nexport type Any = `${Encoding}_${string}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,WAAYA,
|
|
1
|
+
{"version":3,"file":"encoder-types.mjs","names":["Encoding"],"sources":["../../src/utils/encoder-types.ts"],"sourcesContent":["/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L205-L230}\n */\nexport enum Encoding {\n KeyBlockHash = 'kh',\n MicroBlockHash = 'mh',\n BlockPofHash = 'bf',\n BlockTxHash = 'bx',\n BlockStateHash = 'bs',\n Channel = 'ch',\n ContractAddress = 'ct',\n ContractBytearray = 'cb',\n ContractStoreKey = 'ck',\n ContractStoreValue = 'cv',\n Transaction = 'tx',\n TxHash = 'th',\n OracleAddress = 'ok',\n OracleQuery = 'ov',\n OracleQueryId = 'oq',\n OracleResponse = 'or',\n AccountAddress = 'ak',\n Signature = 'sg',\n Commitment = 'cm',\n PeerPubkey = 'pp',\n Name = 'nm',\n State = 'st',\n Poi = 'pi',\n StateTrees = 'ss',\n CallStateTree = 'cs',\n Bytearray = 'ba',\n}\n\nexport type KeyBlockHash = `${Encoding.KeyBlockHash}_${string}`;\nexport type MicroBlockHash = `${Encoding.MicroBlockHash}_${string}`;\nexport type BlockPofHash = `${Encoding.BlockPofHash}_${string}`;\nexport type BlockTxHash = `${Encoding.BlockTxHash}_${string}`;\nexport type BlockStateHash = `${Encoding.BlockStateHash}_${string}`;\nexport type Channel = `${Encoding.Channel}_${string}`;\nexport type ContractAddress = `${Encoding.ContractAddress}_${string}`;\nexport type ContractBytearray = `${Encoding.ContractBytearray}_${string}`;\nexport type ContractStoreKey = `${Encoding.ContractStoreKey}_${string}`;\nexport type ContractStoreValue = `${Encoding.ContractStoreValue}_${string}`;\nexport type Transaction = `${Encoding.Transaction}_${string}`;\nexport type TxHash = `${Encoding.TxHash}_${string}`;\nexport type OracleAddress = `${Encoding.OracleAddress}_${string}`;\nexport type OracleQuery = `${Encoding.OracleQuery}_${string}`;\nexport type OracleQueryId = `${Encoding.OracleQueryId}_${string}`;\nexport type OracleResponse = `${Encoding.OracleResponse}_${string}`;\nexport type AccountAddress = `${Encoding.AccountAddress}_${string}`;\nexport type Signature = `${Encoding.Signature}_${string}`;\nexport type Commitment = `${Encoding.Commitment}_${string}`;\nexport type PeerPubkey = `${Encoding.PeerPubkey}_${string}`;\nexport type Name = `${Encoding.Name}_${string}`;\nexport type State = `${Encoding.State}_${string}`;\nexport type Poi = `${Encoding.Poi}_${string}`;\nexport type StateTrees = `${Encoding.StateTrees}_${string}`;\nexport type CallStateTree = `${Encoding.CallStateTree}_${string}`;\nexport type Bytearray = `${Encoding.Bytearray}_${string}`;\n\nexport type Generic<Type extends Encoding> = `${Type}_${string}`;\nexport type Any = `${Encoding}_${string}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,WAAYA,QAAQ;AA2BnB,WA3BWA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;AAAA,GAARA,QAAQ,KAARA,QAAQ"}
|
package/es/utils/encoder.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { Encoded, Encoding };
|
|
|
6
6
|
* Calculate SHA256 hash of `input`
|
|
7
7
|
* @param input - Data to hash
|
|
8
8
|
* @returns Hash
|
|
9
|
-
* @deprecated use `SubtleCrypto.digest` or `sha.js` package instead
|
|
10
9
|
*/
|
|
11
10
|
export declare function sha256hash(input: Uint8Array | string): Buffer;
|
|
12
11
|
/**
|
package/es/utils/encoder.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import _buffer from "buffer";
|
|
|
2
2
|
const {
|
|
3
3
|
Buffer: _Buffer
|
|
4
4
|
} = _buffer;
|
|
5
|
-
import _bs from 'bs58';
|
|
5
|
+
import _bs from 'bs58';
|
|
6
|
+
// js extension is required for mjs build, not importing the whole package to reduce bundle size
|
|
6
7
|
// eslint-disable-next-line import/extensions
|
|
7
|
-
|
|
8
8
|
const {
|
|
9
9
|
encode: bs58Encode,
|
|
10
10
|
decode: bs58Decode
|
|
@@ -15,26 +15,25 @@ import { concatBuffers, isKeyOfObject } from "./other.mjs";
|
|
|
15
15
|
import * as Encoded from "./encoder-types.mjs";
|
|
16
16
|
import { Encoding } from "./encoder-types.mjs";
|
|
17
17
|
export { Encoded, Encoding };
|
|
18
|
+
|
|
18
19
|
/**
|
|
19
20
|
* Calculate SHA256 hash of `input`
|
|
20
21
|
* @param input - Data to hash
|
|
21
22
|
* @returns Hash
|
|
22
|
-
* @deprecated use `SubtleCrypto.digest` or `sha.js` package instead
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
24
|
export function sha256hash(input) {
|
|
26
25
|
return new Sha256().update(input).digest();
|
|
27
26
|
}
|
|
27
|
+
|
|
28
28
|
/**
|
|
29
29
|
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L177-L202}
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
31
|
const base64Types = [Encoding.ContractBytearray, Encoding.ContractStoreKey, Encoding.ContractStoreValue, Encoding.Transaction, Encoding.OracleQuery, Encoding.OracleResponse, Encoding.State, Encoding.Poi, Encoding.StateTrees, Encoding.CallStateTree, Encoding.Bytearray];
|
|
33
32
|
const base58Types = [Encoding.KeyBlockHash, Encoding.MicroBlockHash, Encoding.BlockPofHash, Encoding.BlockTxHash, Encoding.BlockStateHash, Encoding.Channel, Encoding.ContractAddress, Encoding.TxHash, Encoding.OracleAddress, Encoding.OracleQueryId, Encoding.AccountAddress, Encoding.Signature, Encoding.Commitment, Encoding.PeerPubkey, Encoding.Name];
|
|
33
|
+
|
|
34
34
|
/**
|
|
35
35
|
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L261-L286}
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
37
|
const byteSizeForType = {
|
|
39
38
|
[Encoding.KeyBlockHash]: 32,
|
|
40
39
|
[Encoding.MicroBlockHash]: 32,
|
|
@@ -52,24 +51,19 @@ const byteSizeForType = {
|
|
|
52
51
|
[Encoding.PeerPubkey]: 32,
|
|
53
52
|
[Encoding.State]: 32
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
function ensureValidLength(data, type) {
|
|
57
55
|
if (!isKeyOfObject(type, byteSizeForType)) return;
|
|
58
56
|
const reqLen = byteSizeForType[type];
|
|
59
57
|
if (reqLen == null || data.length === reqLen) return;
|
|
60
58
|
throw new PayloadLengthError(`Payload should be ${reqLen} bytes, got ${data.length} instead`);
|
|
61
59
|
}
|
|
62
|
-
|
|
63
60
|
const getChecksum = payload => sha256hash(sha256hash(payload)).slice(0, 4);
|
|
64
|
-
|
|
65
61
|
const addChecksum = payload => concatBuffers([payload, getChecksum(payload)]);
|
|
66
|
-
|
|
67
62
|
function getPayload(buffer) {
|
|
68
63
|
const payload = buffer.slice(0, -4);
|
|
69
64
|
if (!getChecksum(payload).equals(buffer.slice(-4))) throw new InvalidChecksumError();
|
|
70
65
|
return payload;
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
const base64 = {
|
|
74
68
|
encode: buffer => addChecksum(buffer).toString('base64'),
|
|
75
69
|
decode: string => getPayload(_Buffer.from(string, 'base64'))
|
|
@@ -78,7 +72,6 @@ const base58 = {
|
|
|
78
72
|
encode: buffer => bs58Encode(addChecksum(buffer)),
|
|
79
73
|
decode: string => getPayload(_Buffer.from(bs58Decode(string)))
|
|
80
74
|
};
|
|
81
|
-
|
|
82
75
|
const parseType = maybeType => {
|
|
83
76
|
const base64Type = base64Types.find(t => t === maybeType);
|
|
84
77
|
if (base64Type != null) return [base64Type, base64];
|
|
@@ -86,14 +79,13 @@ const parseType = maybeType => {
|
|
|
86
79
|
if (base58Type != null) return [base58Type, base58];
|
|
87
80
|
throw new ArgumentError('prefix', `one of ${[...base58Types, ...base64Types].join(', ')}`, maybeType);
|
|
88
81
|
};
|
|
82
|
+
|
|
89
83
|
/**
|
|
90
84
|
* Decode data using the default encoding/decoding algorithm
|
|
91
85
|
* @param data - An Base58/64check encoded and prefixed string
|
|
92
86
|
* (ex tx_..., sg_..., ak_....)
|
|
93
87
|
* @returns Decoded data
|
|
94
88
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
89
|
export function decode(data) {
|
|
98
90
|
const [prefix, encodedPayload, extra] = data.split('_');
|
|
99
91
|
if (encodedPayload == null) throw new DecodeError(`Encoded string missing payload: ${data}`);
|
|
@@ -103,13 +95,13 @@ export function decode(data) {
|
|
|
103
95
|
ensureValidLength(payload, type);
|
|
104
96
|
return payload;
|
|
105
97
|
}
|
|
98
|
+
|
|
106
99
|
/**
|
|
107
100
|
* Encode data using the default encoding/decoding algorithm
|
|
108
101
|
* @param data - An decoded data
|
|
109
102
|
* @param type - Prefix of Transaction
|
|
110
103
|
* @returns Encoded string Base58check or Base64check data
|
|
111
104
|
*/
|
|
112
|
-
|
|
113
105
|
export function encode(data, type) {
|
|
114
106
|
const [, encoder] = parseType(type);
|
|
115
107
|
ensureValidLength(data, type);
|
package/es/utils/encoder.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.mjs","names":["Sha256","DecodeError","ArgumentError","InvalidChecksumError","PayloadLengthError","concatBuffers","isKeyOfObject","Encoded","Encoding","sha256hash","input","update","digest","base64Types","ContractBytearray","ContractStoreKey","ContractStoreValue","Transaction","OracleQuery","OracleResponse","State","Poi","StateTrees","CallStateTree","Bytearray","base58Types","KeyBlockHash","MicroBlockHash","BlockPofHash","BlockTxHash","BlockStateHash","Channel","ContractAddress","TxHash","OracleAddress","OracleQueryId","AccountAddress","Signature","Commitment","PeerPubkey","Name","byteSizeForType","ensureValidLength","data","type","reqLen","length","getChecksum","payload","slice","addChecksum","getPayload","buffer","equals","base64","encode","toString","decode","string","from","base58","bs58Encode","bs58Decode","parseType","maybeType","base64Type","find","t","base58Type","join","prefix","encodedPayload","extra","split","encoder"],"sources":["../../src/utils/encoder.ts"],"sourcesContent":["import { encode as bs58Encode, decode as bs58Decode } from 'bs58';\n// js extension is required for mjs build, not importing the whole package to reduce bundle size\n// eslint-disable-next-line import/extensions\nimport Sha256 from 'sha.js/sha256.js';\nimport {\n DecodeError,\n ArgumentError,\n InvalidChecksumError,\n PayloadLengthError,\n} from './errors';\nimport { concatBuffers, isKeyOfObject } from './other';\nimport * as Encoded from './encoder-types';\nimport { Encoding } from './encoder-types';\n\nexport { Encoded, Encoding };\n\n/**\n * Calculate SHA256 hash of `input`\n * @param input - Data to hash\n * @returns Hash\n * @deprecated use `SubtleCrypto.digest` or `sha.js` package instead\n */\nexport function sha256hash(input: Uint8Array | string): Buffer {\n return new Sha256().update(input).digest();\n}\n\n/**\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L177-L202}\n */\nconst base64Types = [\n Encoding.ContractBytearray,\n Encoding.ContractStoreKey,\n Encoding.ContractStoreValue,\n Encoding.Transaction,\n Encoding.OracleQuery,\n Encoding.OracleResponse,\n Encoding.State,\n Encoding.Poi,\n Encoding.StateTrees,\n Encoding.CallStateTree,\n Encoding.Bytearray,\n] as const;\nconst base58Types = [\n Encoding.KeyBlockHash,\n Encoding.MicroBlockHash,\n Encoding.BlockPofHash,\n Encoding.BlockTxHash,\n Encoding.BlockStateHash,\n Encoding.Channel,\n Encoding.ContractAddress,\n Encoding.TxHash,\n Encoding.OracleAddress,\n Encoding.OracleQueryId,\n Encoding.AccountAddress,\n Encoding.Signature,\n Encoding.Commitment,\n Encoding.PeerPubkey,\n Encoding.Name,\n] as const;\n\n/**\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L261-L286}\n */\nconst byteSizeForType = {\n [Encoding.KeyBlockHash]: 32,\n [Encoding.MicroBlockHash]: 32,\n [Encoding.BlockPofHash]: 32,\n [Encoding.BlockTxHash]: 32,\n [Encoding.BlockStateHash]: 32,\n [Encoding.Channel]: 32,\n [Encoding.ContractAddress]: 32,\n [Encoding.TxHash]: 32,\n [Encoding.OracleAddress]: 32,\n [Encoding.OracleQueryId]: 32,\n [Encoding.AccountAddress]: 32,\n [Encoding.Signature]: 64,\n [Encoding.Commitment]: 32,\n [Encoding.PeerPubkey]: 32,\n [Encoding.State]: 32,\n} as const;\n\nfunction ensureValidLength(data: Uint8Array, type: Encoding): void {\n if (!isKeyOfObject(type, byteSizeForType)) return;\n const reqLen = byteSizeForType[type];\n if (reqLen == null || data.length === reqLen) return;\n throw new PayloadLengthError(`Payload should be ${reqLen} bytes, got ${data.length} instead`);\n}\n\nconst getChecksum = (payload: Uint8Array): Buffer => sha256hash(sha256hash(payload)).slice(0, 4);\n\nconst addChecksum = (payload: Uint8Array): Buffer => concatBuffers([payload, getChecksum(payload)]);\n\nfunction getPayload(buffer: Buffer): Buffer {\n const payload = buffer.slice(0, -4);\n if (!getChecksum(payload).equals(buffer.slice(-4))) throw new InvalidChecksumError();\n return payload;\n}\n\nconst base64 = {\n encode: (buffer: Uint8Array) => addChecksum(buffer).toString('base64'),\n decode: (string: string) => getPayload(Buffer.from(string, 'base64')),\n};\n\nconst base58 = {\n encode: (buffer: Uint8Array) => bs58Encode(addChecksum(buffer)),\n decode: (string: string) => getPayload(Buffer.from(bs58Decode(string))),\n};\n\nconst parseType = (maybeType: unknown): [Encoding, typeof base64] => {\n const base64Type = base64Types.find((t) => t === maybeType);\n if (base64Type != null) return [base64Type, base64];\n const base58Type = base58Types.find((t) => t === maybeType);\n if (base58Type != null) return [base58Type, base58];\n throw new ArgumentError('prefix', `one of ${[...base58Types, ...base64Types].join(', ')}`, maybeType);\n};\n\n/**\n * Decode data using the default encoding/decoding algorithm\n * @param data - An Base58/64check encoded and prefixed string\n * (ex tx_..., sg_..., ak_....)\n * @returns Decoded data\n */\nexport function decode(data: Encoded.Any): Buffer {\n const [prefix, encodedPayload, extra] = data.split('_');\n if (encodedPayload == null) throw new DecodeError(`Encoded string missing payload: ${data}`);\n if (extra != null) throw new DecodeError(`Encoded string have extra parts: ${data}`);\n const [type, encoder] = parseType(prefix);\n const payload = encoder.decode(encodedPayload);\n ensureValidLength(payload, type);\n return payload;\n}\n\n/**\n * Encode data using the default encoding/decoding algorithm\n * @param data - An decoded data\n * @param type - Prefix of Transaction\n * @returns Encoded string Base58check or Base64check data\n */\nexport function encode<Type extends Encoding>(\n data: Uint8Array,\n type: Type,\n): Encoded.Generic<Type> {\n const [, encoder] = parseType(type);\n ensureValidLength(data, type);\n return `${type}_${encoder.encode(data)}`;\n}\n"],"mappings":";;;;AAAA,gBAA2D,MAA3D,C,CACA;AACA;;;;;;AACA,OAAOA,MAAP,MAAmB,kBAAnB;SAEEC,W,EACAC,a,EACAC,oB,EACAC,kB;SAEOC,a,EAAeC,a;OACjB,KAAKC,O;SACHC,Q;AAET,SAASD,OAAT,EAAkBC,QAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,UAAT,CAAoBC,KAApB,EAAwD;EAC7D,OAAO,IAAIV,MAAJ,GAAaW,MAAb,CAAoBD,KAApB,EAA2BE,MAA3B,EAAP;AACD;AAED;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,CAClBL,QA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AJ,CAAiB,mCAAkC0C,IAAK,EAAxD,CAAN;EAC5B,IAAI6B,KAAK,IAAI,IAAb,EAAmB,MAAM,IAAIvE,WAAJ,CAAiB,oCAAmC0C,IAAK,EAAzD,CAAN;EACnB,MAAM,CAACC,IAAD,EAAO8B,OAAP,IAAkBX,SAAS,CAACO,MAAD,CAAjC;EACA,MAAMtB,OAAO,GAAG0B,OAAO,CAACjB,MAAR,CAAec,cAAf,CAAhB;EACA7B,iBAAiB,CAACM,OAAD,EAAUJ,IAAV,CAAjB;EACA,OAAOI,OAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,MAAT,CACLZ,IADK,EAELC,IAFK,EAGkB;EACvB,MAAM,GAAG8B,OAAH,IAAcX,SAAS,CAACnB,IAAD,CAA7B;EACAF,iBAAiB,CAACC,IAAD,EAAOC,IAAP,CAAjB;EACA,OAAQ,GAAEA,IAAK,IAAG8B,OAAO,CAACnB,MAAR,CAAeZ,IAAf,CAAqB,EAAvC;AACD"}
|
|
1
|
+
{"version":3,"file":"encoder.mjs","names":["Sha256","DecodeError","ArgumentError","InvalidChecksumError","PayloadLengthError","concatBuffers","isKeyOfObject","Encoded","Encoding","sha256hash","input","update","digest","base64Types","ContractBytearray","ContractStoreKey","ContractStoreValue","Transaction","OracleQuery","OracleResponse","State","Poi","StateTrees","CallStateTree","Bytearray","base58Types","KeyBlockHash","MicroBlockHash","BlockPofHash","BlockTxHash","BlockStateHash","Channel","ContractAddress","TxHash","OracleAddress","OracleQueryId","AccountAddress","Signature","Commitment","PeerPubkey","Name","byteSizeForType","ensureValidLength","data","type","reqLen","length","getChecksum","payload","slice","addChecksum","getPayload","buffer","equals","base64","encode","toString","decode","string","from","base58","bs58Encode","bs58Decode","parseType","maybeType","base64Type","find","t","base58Type","join","prefix","encodedPayload","extra","split","encoder"],"sources":["../../src/utils/encoder.ts"],"sourcesContent":["import { encode as bs58Encode, decode as bs58Decode } from 'bs58';\n// js extension is required for mjs build, not importing the whole package to reduce bundle size\n// eslint-disable-next-line import/extensions\nimport Sha256 from 'sha.js/sha256.js';\nimport {\n DecodeError,\n ArgumentError,\n InvalidChecksumError,\n PayloadLengthError,\n} from './errors';\nimport { concatBuffers, isKeyOfObject } from './other';\nimport * as Encoded from './encoder-types';\nimport { Encoding } from './encoder-types';\n\nexport { Encoded, Encoding };\n\n/**\n * Calculate SHA256 hash of `input`\n * @param input - Data to hash\n * @returns Hash\n */\nexport function sha256hash(input: Uint8Array | string): Buffer {\n return new Sha256().update(input).digest();\n}\n\n/**\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L177-L202}\n */\nconst base64Types = [\n Encoding.ContractBytearray,\n Encoding.ContractStoreKey,\n Encoding.ContractStoreValue,\n Encoding.Transaction,\n Encoding.OracleQuery,\n Encoding.OracleResponse,\n Encoding.State,\n Encoding.Poi,\n Encoding.StateTrees,\n Encoding.CallStateTree,\n Encoding.Bytearray,\n] as const;\nconst base58Types = [\n Encoding.KeyBlockHash,\n Encoding.MicroBlockHash,\n Encoding.BlockPofHash,\n Encoding.BlockTxHash,\n Encoding.BlockStateHash,\n Encoding.Channel,\n Encoding.ContractAddress,\n Encoding.TxHash,\n Encoding.OracleAddress,\n Encoding.OracleQueryId,\n Encoding.AccountAddress,\n Encoding.Signature,\n Encoding.Commitment,\n Encoding.PeerPubkey,\n Encoding.Name,\n] as const;\n\n/**\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L261-L286}\n */\nconst byteSizeForType = {\n [Encoding.KeyBlockHash]: 32,\n [Encoding.MicroBlockHash]: 32,\n [Encoding.BlockPofHash]: 32,\n [Encoding.BlockTxHash]: 32,\n [Encoding.BlockStateHash]: 32,\n [Encoding.Channel]: 32,\n [Encoding.ContractAddress]: 32,\n [Encoding.TxHash]: 32,\n [Encoding.OracleAddress]: 32,\n [Encoding.OracleQueryId]: 32,\n [Encoding.AccountAddress]: 32,\n [Encoding.Signature]: 64,\n [Encoding.Commitment]: 32,\n [Encoding.PeerPubkey]: 32,\n [Encoding.State]: 32,\n} as const;\n\nfunction ensureValidLength(data: Uint8Array, type: Encoding): void {\n if (!isKeyOfObject(type, byteSizeForType)) return;\n const reqLen = byteSizeForType[type];\n if (reqLen == null || data.length === reqLen) return;\n throw new PayloadLengthError(`Payload should be ${reqLen} bytes, got ${data.length} instead`);\n}\n\nconst getChecksum = (payload: Uint8Array): Buffer => sha256hash(sha256hash(payload)).slice(0, 4);\n\nconst addChecksum = (payload: Uint8Array): Buffer => concatBuffers([payload, getChecksum(payload)]);\n\nfunction getPayload(buffer: Buffer): Buffer {\n const payload = buffer.slice(0, -4);\n if (!getChecksum(payload).equals(buffer.slice(-4))) throw new InvalidChecksumError();\n return payload;\n}\n\nconst base64 = {\n encode: (buffer: Uint8Array) => addChecksum(buffer).toString('base64'),\n decode: (string: string) => getPayload(Buffer.from(string, 'base64')),\n};\n\nconst base58 = {\n encode: (buffer: Uint8Array) => bs58Encode(addChecksum(buffer)),\n decode: (string: string) => getPayload(Buffer.from(bs58Decode(string))),\n};\n\nconst parseType = (maybeType: unknown): [Encoding, typeof base64] => {\n const base64Type = base64Types.find((t) => t === maybeType);\n if (base64Type != null) return [base64Type, base64];\n const base58Type = base58Types.find((t) => t === maybeType);\n if (base58Type != null) return [base58Type, base58];\n throw new ArgumentError('prefix', `one of ${[...base58Types, ...base64Types].join(', ')}`, maybeType);\n};\n\n/**\n * Decode data using the default encoding/decoding algorithm\n * @param data - An Base58/64check encoded and prefixed string\n * (ex tx_..., sg_..., ak_....)\n * @returns Decoded data\n */\nexport function decode(data: Encoded.Any): Buffer {\n const [prefix, encodedPayload, extra] = data.split('_');\n if (encodedPayload == null) throw new DecodeError(`Encoded string missing payload: ${data}`);\n if (extra != null) throw new DecodeError(`Encoded string have extra parts: ${data}`);\n const [type, encoder] = parseType(prefix);\n const payload = encoder.decode(encodedPayload);\n ensureValidLength(payload, type);\n return payload;\n}\n\n/**\n * Encode data using the default encoding/decoding algorithm\n * @param data - An decoded data\n * @param type - Prefix of Transaction\n * @returns Encoded string Base58check or Base64check data\n */\nexport function encode<Type extends Encoding>(\n data: Uint8Array,\n type: Type,\n): Encoded.Generic<Type> {\n const [, encoder] = parseType(type);\n ensureValidLength(data, type);\n return `${type}_${encoder.encode(data)}`;\n}\n"],"mappings":";;;;AAAA,gBAA2D,MAAM;AACjE;AACA;AAAA;EAAA;EAAA;AAAA;AACA,OAAOA,MAAM,MAAM,kBAAkB;AAAC,SAEpCC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EACpBC,kBAAkB;AAAA,SAEXC,aAAa,EAAEC,aAAa;AAAA,OAC9B,KAAKC,OAAO;AAAA,SACVC,QAAQ;AAEjB,SAASD,OAAO,EAAEC,QAAQ;;AAE1B;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAU,CAACC,KAA0B,EAAU;EAC7D,OAAO,IAAIV,MAAM,EAAE,CAACW,MAAM,CAACD,KAAK,CAAC,CAACE,MAAM,EAAE;AAC5C;;AAEA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,CAClBL,QAAQ,CAACM,iBAAiB,EAC1BN,QAAQ,CAACO,gBAAgB,EACzBP,QAAQ,CAACQ,kBAAkB,EAC3BR,QAAQ,CAACS,WAAW,EACpBT,QAAQ,CAACU,WAAW,EACpBV,QAAQ,CAACW,cAAc,EACvBX,QAAQ,CAACY,KAAK,EACdZ,QAAQ,CAACa,GAAG,EACZb,QAAQ,CAACc,UAAU,EACnBd,QAAQ,CAACe,aAAa,EACtBf,QAAQ,CAACgB,SAAS,CACV;AACV,MAAMC,WAAW,GAAG,CAClBjB,QAAQ,CAACkB,YAAY,EACrBlB,QAAQ,CAACmB,cAAc,EACvBnB,QAAQ,CAACoB,YAAY,EACrBpB,QAAQ,CAACqB,WAAW,EACpBrB,QAAQ,CAACsB,cAAc,EACvBtB,QAAQ,CAACu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OAAO,CAACnB,MAAM,CAACZ,IAAI,CAAE,EAAC;AAC1C"}
|
package/es/utils/errors.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { Int } from '../tx/builder/constants';
|
|
2
3
|
/**
|
|
3
4
|
* aepp-sdk originated error
|
|
4
5
|
* @category exception
|
|
@@ -70,7 +71,7 @@ export declare class WalletError extends BaseError {
|
|
|
70
71
|
* @category exception
|
|
71
72
|
*/
|
|
72
73
|
export declare class ArgumentError extends BaseError {
|
|
73
|
-
constructor(argumentName: string, requirement:
|
|
74
|
+
constructor(argumentName: string, requirement: unknown, argumentValue: unknown);
|
|
74
75
|
}
|
|
75
76
|
/**
|
|
76
77
|
* @category exception
|
|
@@ -156,12 +157,6 @@ export declare class InternalError extends BaseError {
|
|
|
156
157
|
export declare class UnexpectedTsError extends InternalError {
|
|
157
158
|
constructor(message?: string);
|
|
158
159
|
}
|
|
159
|
-
/**
|
|
160
|
-
* @category exception
|
|
161
|
-
*/
|
|
162
|
-
export declare class InvalidKeypairError extends AccountError {
|
|
163
|
-
constructor(message: string);
|
|
164
|
-
}
|
|
165
160
|
/**
|
|
166
161
|
* @category exception
|
|
167
162
|
*/
|
|
@@ -240,6 +235,18 @@ export declare class ChannelPingTimedOutError extends ChannelError {
|
|
|
240
235
|
export declare class UnexpectedChannelMessageError extends ChannelError {
|
|
241
236
|
constructor(message: string);
|
|
242
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* @category exception
|
|
240
|
+
*/
|
|
241
|
+
export declare class ChannelIncomingMessageError extends ChannelError {
|
|
242
|
+
handlerError: BaseError;
|
|
243
|
+
incomingMessage: {
|
|
244
|
+
[key: string]: any;
|
|
245
|
+
};
|
|
246
|
+
constructor(handlerError: BaseError, incomingMessage: {
|
|
247
|
+
[key: string]: any;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
243
250
|
/**
|
|
244
251
|
* @category exception
|
|
245
252
|
*/
|
|
@@ -311,7 +318,7 @@ export declare class NoSuchContractFunctionError extends ContractError {
|
|
|
311
318
|
* @category exception
|
|
312
319
|
*/
|
|
313
320
|
export declare class NotPayableFunctionError extends ContractError {
|
|
314
|
-
constructor(amount:
|
|
321
|
+
constructor(amount: Int, fn: string);
|
|
315
322
|
}
|
|
316
323
|
/**
|
|
317
324
|
* @category exception
|
|
@@ -433,12 +440,6 @@ export declare class TagNotFoundError extends TransactionError {
|
|
|
433
440
|
export declare class TxNotInChainError extends TransactionError {
|
|
434
441
|
constructor(txHash: string);
|
|
435
442
|
}
|
|
436
|
-
/**
|
|
437
|
-
* @category exception
|
|
438
|
-
*/
|
|
439
|
-
export declare class UnknownTxError extends TransactionError {
|
|
440
|
-
constructor(message: string);
|
|
441
|
-
}
|
|
442
443
|
/**
|
|
443
444
|
* @category exception
|
|
444
445
|
*/
|