@aeternity/aepp-sdk 12.1.2 → 13.0.0-alpha.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/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 +6580 -8860
- 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 +27 -185
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +124 -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 +7 -12
- package/es/Node.mjs +34 -47
- 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 +111 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +101 -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 -65
- 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 +3 -3
- package/es/aens.mjs +42 -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.mjs +3 -7
- 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 +4 -41
- 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 +1 -1
- package/es/chain.mjs +33 -58
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +195 -0
- package/es/channel/Base.mjs +290 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +247 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +217 -0
- package/es/channel/Spend.mjs +383 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +141 -891
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +98 -190
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/{Compiler.d.ts → CompilerHttp.d.ts} +3 -3
- package/es/contract/{Compiler.mjs → CompilerHttp.mjs} +8 -13
- package/es/contract/CompilerHttp.mjs.map +1 -0
- package/es/contract/Contract.d.ts +235 -0
- package/es/contract/Contract.mjs +534 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/ga.d.ts +7 -33
- package/es/contract/ga.mjs +20 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index.d.ts +9 -6
- package/es/index.mjs +8 -6
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +33 -39
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +17 -20
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +2 -1
- package/es/tx/builder/constants.mjs +12 -12
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/address.d.ts +15 -0
- package/es/tx/builder/field-types/address.mjs +42 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/addresses.d.ts +6 -0
- package/es/tx/builder/field-types/addresses.mjs +13 -0
- package/es/tx/builder/field-types/addresses.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -2
- 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/deposit.d.ts +0 -1
- 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/enumeration.d.ts +5 -0
- package/es/tx/builder/field-types/enumeration.mjs +21 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +1 -9
- package/es/tx/builder/field-types/fee.mjs +9 -25
- 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.mjs +4 -9
- 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 +23 -11
- package/es/tx/builder/field-types/index.mjs +10 -3
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +0 -1
- 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 +4 -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/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/u-int.d.ts +1 -1
- 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 +1 -21
- package/es/tx/builder/index.mjs +29 -148
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +336 -176
- package/es/tx/builder/schema.mjs +71 -78
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +3 -33
- package/es/tx/index.mjs +26 -43
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +2 -2
- package/es/tx/validator.mjs +86 -59
- 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 +12 -6
- package/es/utils/errors.mjs +87 -163
- 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/mptree.d.ts +1 -1
- package/es/utils/mptree.mjs +4 -26
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +3 -1
- 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 +87 -48
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +28 -202
- package/src/AeSdkMethods.ts +170 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +11 -15
- 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 +10 -9
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +5 -4
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
- 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 +6 -3
- package/src/channel/Base.ts +327 -0
- package/src/channel/Contract.ts +487 -0
- package/src/channel/Spend.ts +403 -0
- package/src/channel/handlers.ts +154 -573
- package/src/channel/internal.ts +113 -142
- package/src/contract/{Compiler.ts → CompilerHttp.ts} +5 -5
- package/src/contract/Contract.ts +620 -0
- package/src/contract/ga.ts +18 -104
- package/src/index.ts +9 -8
- package/src/oracle.ts +7 -7
- package/src/spend.ts +5 -13
- package/src/tx/builder/constants.ts +1 -0
- package/src/tx/builder/field-types/address.ts +52 -0
- package/src/tx/builder/field-types/addresses.ts +18 -0
- package/src/tx/builder/field-types/coin-amount.ts +2 -8
- package/src/tx/builder/field-types/enumeration.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +1 -3
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +16 -6
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- 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/u-int.ts +3 -2
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +6 -65
- package/src/tx/builder/schema.ts +89 -100
- package/src/tx/index.ts +19 -15
- package/src/tx/validator.ts +36 -18
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +5 -33
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +18 -12
- 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 +141 -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 +18 -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 +248 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +217 -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/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index.d.ts +39 -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 +71 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.2/tx/builder/field-types/addresses.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/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +17 -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 +12 -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 +85 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +19 -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/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.2/tx/index.d.ts +34 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +20 -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 +480 -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/mptree.d.ts +32 -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 +141 -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 +18 -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 +248 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +217 -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/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.5/index.d.ts +38 -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 +71 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.5/tx/builder/field-types/addresses.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/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +17 -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 +12 -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 +85 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +19 -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/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.5/tx/index.d.ts +34 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +20 -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 +480 -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/mptree.d.ts +32 -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.mjs.map +0 -1
- package/es/contract/aci.d.ts +0 -127
- package/es/contract/aci.mjs +0 -509
- 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/src/channel/index.ts +0 -1025
- package/src/contract/aci.ts +0 -538
- 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/tx/builder/schema.ts
CHANGED
|
@@ -8,10 +8,12 @@ import BigNumber from 'bignumber.js';
|
|
|
8
8
|
import { Tag } from './constants';
|
|
9
9
|
import {
|
|
10
10
|
Field, uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
|
|
11
|
+
address, addresses, pointers, enumeration,
|
|
11
12
|
} from './field-types';
|
|
12
13
|
import { Encoded, Encoding } from '../../utils/encoder';
|
|
13
14
|
import MPTree from '../../utils/mptree';
|
|
14
|
-
import {
|
|
15
|
+
import { UnionToIntersection } from '../../utils/other';
|
|
16
|
+
import { AddressEncodings } from './field-types/address';
|
|
15
17
|
|
|
16
18
|
export enum ORACLE_TTL_TYPES {
|
|
17
19
|
delta = 0,
|
|
@@ -26,8 +28,6 @@ export const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };
|
|
|
26
28
|
export const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
|
|
27
29
|
export const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
|
|
28
30
|
// # CONTRACT
|
|
29
|
-
export const AMOUNT = 0;
|
|
30
|
-
export const MAX_AUTH_FUN_GAS = 50000;
|
|
31
31
|
export const DRY_RUN_ACCOUNT = {
|
|
32
32
|
pub: 'ak_11111111111111111111111111111111273Yts',
|
|
33
33
|
amount: 100000000000000000000000000000000000n,
|
|
@@ -63,6 +63,12 @@ export enum ABI_VERSIONS {
|
|
|
63
63
|
FATE = 3,
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export enum CallReturnType {
|
|
67
|
+
Ok = 0,
|
|
68
|
+
Error = 1,
|
|
69
|
+
Revert = 2,
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
/**
|
|
67
73
|
* @category transaction builder
|
|
68
74
|
*/
|
|
@@ -104,8 +110,6 @@ export interface CtVersion {
|
|
|
104
110
|
* @category transaction builder
|
|
105
111
|
*/
|
|
106
112
|
export enum FIELD_TYPES {
|
|
107
|
-
id,
|
|
108
|
-
ids,
|
|
109
113
|
string,
|
|
110
114
|
binary,
|
|
111
115
|
bool,
|
|
@@ -114,23 +118,17 @@ export enum FIELD_TYPES {
|
|
|
114
118
|
rlpBinaries,
|
|
115
119
|
rawBinary,
|
|
116
120
|
signatures,
|
|
117
|
-
pointers,
|
|
118
121
|
offChainUpdates,
|
|
119
122
|
callStack,
|
|
120
123
|
proofOfInclusion,
|
|
121
124
|
mptrees,
|
|
122
|
-
callReturnType,
|
|
123
125
|
ctVersion,
|
|
124
|
-
abiVersion,
|
|
125
|
-
ttlType,
|
|
126
126
|
sophiaCodeTypeInfo,
|
|
127
127
|
payload,
|
|
128
128
|
stateTree,
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
interface BuildFieldTypes<Prefix extends undefined | Encoding | readonly Encoding[]> {
|
|
132
|
-
[FIELD_TYPES.id]: PrefixType<Prefix>;
|
|
133
|
-
[FIELD_TYPES.ids]: Array<Encoded.Generic<Prefix extends Encoding[] ? Prefix : any>>;
|
|
134
132
|
[FIELD_TYPES.string]: string;
|
|
135
133
|
[FIELD_TYPES.binary]: PrefixType<Prefix>;
|
|
136
134
|
[FIELD_TYPES.bool]: Boolean;
|
|
@@ -139,25 +137,16 @@ interface BuildFieldTypes<Prefix extends undefined | Encoding | readonly Encodin
|
|
|
139
137
|
[FIELD_TYPES.rlpBinaries]: any[];
|
|
140
138
|
[FIELD_TYPES.rawBinary]: Uint8Array;
|
|
141
139
|
[FIELD_TYPES.signatures]: Uint8Array[];
|
|
142
|
-
[FIELD_TYPES.pointers]: NamePointer[];
|
|
143
140
|
[FIELD_TYPES.offChainUpdates]: any;
|
|
144
141
|
[FIELD_TYPES.callStack]: any;
|
|
145
142
|
[FIELD_TYPES.proofOfInclusion]: any;
|
|
146
143
|
[FIELD_TYPES.mptrees]: MPTree[];
|
|
147
|
-
[FIELD_TYPES.callReturnType]: any;
|
|
148
144
|
[FIELD_TYPES.ctVersion]: CtVersion;
|
|
149
|
-
[FIELD_TYPES.abiVersion]: ABI_VERSIONS;
|
|
150
|
-
[FIELD_TYPES.ttlType]: ORACLE_TTL_TYPES;
|
|
151
145
|
[FIELD_TYPES.sophiaCodeTypeInfo]: any;
|
|
152
146
|
[FIELD_TYPES.payload]: string | undefined;
|
|
153
147
|
[FIELD_TYPES.stateTree]: any;
|
|
154
148
|
}
|
|
155
149
|
|
|
156
|
-
// based on https://stackoverflow.com/a/50375286/6176994
|
|
157
|
-
type UnionToIntersection<Union> =
|
|
158
|
-
(Union extends any ? (k: Union) => void : never) extends ((k: infer Intersection) => void)
|
|
159
|
-
? Intersection : never;
|
|
160
|
-
|
|
161
150
|
type TxElem = readonly [string, FIELD_TYPES | Field]
|
|
162
151
|
| readonly [string, FIELD_TYPES, Encoding | readonly Encoding[]];
|
|
163
152
|
|
|
@@ -206,7 +195,7 @@ export const TX_SCHEMA = {
|
|
|
206
195
|
['flags', uInt],
|
|
207
196
|
['nonce', shortUInt],
|
|
208
197
|
['balance', uInt],
|
|
209
|
-
['gaContract',
|
|
198
|
+
['gaContract', address<Encoding.ContractAddress | Encoding.Name>()],
|
|
210
199
|
['gaAuthFun', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
211
200
|
],
|
|
212
201
|
},
|
|
@@ -220,8 +209,8 @@ export const TX_SCHEMA = {
|
|
|
220
209
|
[Tag.SpendTx]: {
|
|
221
210
|
1: [
|
|
222
211
|
...BASE_TX,
|
|
223
|
-
['senderId',
|
|
224
|
-
['recipientId',
|
|
212
|
+
['senderId', address<Encoding.AccountAddress>()],
|
|
213
|
+
['recipientId', address<Encoding.AccountAddress | Encoding.Name>()],
|
|
225
214
|
['amount', coinAmount],
|
|
226
215
|
['fee', fee],
|
|
227
216
|
['ttl', shortUInt],
|
|
@@ -232,9 +221,9 @@ export const TX_SCHEMA = {
|
|
|
232
221
|
[Tag.NamePreclaimTx]: {
|
|
233
222
|
1: [
|
|
234
223
|
...BASE_TX,
|
|
235
|
-
['accountId',
|
|
224
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
236
225
|
['nonce', shortUInt],
|
|
237
|
-
['commitmentId',
|
|
226
|
+
['commitmentId', address<Encoding.Commitment>()],
|
|
238
227
|
['fee', fee],
|
|
239
228
|
['ttl', shortUInt],
|
|
240
229
|
],
|
|
@@ -242,7 +231,7 @@ export const TX_SCHEMA = {
|
|
|
242
231
|
[Tag.NameClaimTx]: {
|
|
243
232
|
2: [
|
|
244
233
|
...BASE_TX,
|
|
245
|
-
['accountId',
|
|
234
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
246
235
|
['nonce', shortUInt],
|
|
247
236
|
['name', name],
|
|
248
237
|
['nameSalt', uInt],
|
|
@@ -254,11 +243,11 @@ export const TX_SCHEMA = {
|
|
|
254
243
|
[Tag.NameUpdateTx]: {
|
|
255
244
|
1: [
|
|
256
245
|
...BASE_TX,
|
|
257
|
-
['accountId',
|
|
246
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
258
247
|
['nonce', shortUInt],
|
|
259
248
|
['nameId', nameId],
|
|
260
|
-
['nameTtl',
|
|
261
|
-
['pointers',
|
|
249
|
+
['nameTtl', shortUInt],
|
|
250
|
+
['pointers', pointers],
|
|
262
251
|
['clientTtl', shortUInt],
|
|
263
252
|
['fee', fee],
|
|
264
253
|
['ttl', shortUInt],
|
|
@@ -267,10 +256,10 @@ export const TX_SCHEMA = {
|
|
|
267
256
|
[Tag.NameTransferTx]: {
|
|
268
257
|
1: [
|
|
269
258
|
...BASE_TX,
|
|
270
|
-
['accountId',
|
|
259
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
271
260
|
['nonce', shortUInt],
|
|
272
261
|
['nameId', nameId],
|
|
273
|
-
['recipientId',
|
|
262
|
+
['recipientId', address<Encoding.AccountAddress | Encoding.Name>()],
|
|
274
263
|
['fee', fee],
|
|
275
264
|
['ttl', shortUInt],
|
|
276
265
|
],
|
|
@@ -278,7 +267,7 @@ export const TX_SCHEMA = {
|
|
|
278
267
|
[Tag.NameRevokeTx]: {
|
|
279
268
|
1: [
|
|
280
269
|
...BASE_TX,
|
|
281
|
-
['accountId',
|
|
270
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
282
271
|
['nonce', shortUInt],
|
|
283
272
|
['nameId', nameId],
|
|
284
273
|
['fee', fee],
|
|
@@ -288,19 +277,19 @@ export const TX_SCHEMA = {
|
|
|
288
277
|
[Tag.Contract]: {
|
|
289
278
|
1: [
|
|
290
279
|
...BASE_TX,
|
|
291
|
-
['owner',
|
|
280
|
+
['owner', address<Encoding.AccountAddress>()],
|
|
292
281
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
293
282
|
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
294
283
|
['log', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
295
284
|
['active', FIELD_TYPES.bool],
|
|
296
|
-
['referers',
|
|
285
|
+
['referers', addresses<Encoding.AccountAddress>()],
|
|
297
286
|
['deposit', deposit],
|
|
298
287
|
],
|
|
299
288
|
},
|
|
300
289
|
[Tag.ContractCreateTx]: {
|
|
301
290
|
1: [
|
|
302
291
|
...BASE_TX,
|
|
303
|
-
['ownerId',
|
|
292
|
+
['ownerId', address<Encoding.AccountAddress>()],
|
|
304
293
|
['nonce', shortUInt],
|
|
305
294
|
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
306
295
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
@@ -316,10 +305,10 @@ export const TX_SCHEMA = {
|
|
|
316
305
|
[Tag.ContractCallTx]: {
|
|
317
306
|
1: [
|
|
318
307
|
...BASE_TX,
|
|
319
|
-
['callerId',
|
|
308
|
+
['callerId', address<Encoding.AccountAddress>()],
|
|
320
309
|
['nonce', shortUInt],
|
|
321
|
-
['contractId',
|
|
322
|
-
['abiVersion',
|
|
310
|
+
['contractId', address<Encoding.ContractAddress | Encoding.Name>()],
|
|
311
|
+
['abiVersion', enumeration<ABI_VERSIONS>()],
|
|
323
312
|
['fee', fee],
|
|
324
313
|
['ttl', shortUInt],
|
|
325
314
|
['amount', coinAmount],
|
|
@@ -331,14 +320,14 @@ export const TX_SCHEMA = {
|
|
|
331
320
|
[Tag.ContractCall]: {
|
|
332
321
|
1: [
|
|
333
322
|
...BASE_TX,
|
|
334
|
-
['callerId',
|
|
323
|
+
['callerId', address<Encoding.AccountAddress>()],
|
|
335
324
|
['callerNonce', shortUInt],
|
|
336
325
|
['height', shortUInt],
|
|
337
|
-
['contractId',
|
|
326
|
+
['contractId', address<Encoding.ContractAddress>()],
|
|
338
327
|
['gasPrice', gasPrice],
|
|
339
328
|
['gasUsed', shortUInt],
|
|
340
329
|
['returnValue', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
341
|
-
['returnType',
|
|
330
|
+
['returnType', enumeration<CallReturnType>()],
|
|
342
331
|
// TODO: add serialization for
|
|
343
332
|
// <log> :: [ { <address> :: id, [ <topics> :: binary() ], <data> :: binary() } ]
|
|
344
333
|
['log', FIELD_TYPES.rawBinary],
|
|
@@ -347,24 +336,24 @@ export const TX_SCHEMA = {
|
|
|
347
336
|
[Tag.OracleRegisterTx]: {
|
|
348
337
|
1: [
|
|
349
338
|
...BASE_TX,
|
|
350
|
-
['accountId',
|
|
339
|
+
['accountId', address<Encoding.AccountAddress>()],
|
|
351
340
|
['nonce', shortUInt],
|
|
352
341
|
['queryFormat', FIELD_TYPES.string],
|
|
353
342
|
['responseFormat', FIELD_TYPES.string],
|
|
354
343
|
['queryFee', coinAmount],
|
|
355
|
-
['oracleTtlType',
|
|
344
|
+
['oracleTtlType', enumeration<ORACLE_TTL_TYPES>()],
|
|
356
345
|
['oracleTtlValue', shortUInt],
|
|
357
346
|
['fee', fee],
|
|
358
347
|
['ttl', shortUInt],
|
|
359
|
-
['abiVersion',
|
|
348
|
+
['abiVersion', enumeration<ABI_VERSIONS>()],
|
|
360
349
|
],
|
|
361
350
|
},
|
|
362
351
|
[Tag.OracleExtendTx]: {
|
|
363
352
|
1: [
|
|
364
353
|
...BASE_TX,
|
|
365
|
-
['oracleId',
|
|
354
|
+
['oracleId', address<Encoding.OracleAddress | Encoding.Name>()],
|
|
366
355
|
['nonce', shortUInt],
|
|
367
|
-
['oracleTtlType',
|
|
356
|
+
['oracleTtlType', enumeration<ORACLE_TTL_TYPES>()],
|
|
368
357
|
['oracleTtlValue', shortUInt],
|
|
369
358
|
['fee', fee],
|
|
370
359
|
['ttl', shortUInt],
|
|
@@ -373,14 +362,14 @@ export const TX_SCHEMA = {
|
|
|
373
362
|
[Tag.OracleQueryTx]: {
|
|
374
363
|
1: [
|
|
375
364
|
...BASE_TX,
|
|
376
|
-
['senderId',
|
|
365
|
+
['senderId', address<Encoding.AccountAddress>()],
|
|
377
366
|
['nonce', shortUInt],
|
|
378
|
-
['oracleId',
|
|
367
|
+
['oracleId', address<Encoding.OracleAddress | Encoding.Name>()],
|
|
379
368
|
['query', FIELD_TYPES.string],
|
|
380
369
|
['queryFee', coinAmount],
|
|
381
|
-
['queryTtlType',
|
|
370
|
+
['queryTtlType', enumeration<ORACLE_TTL_TYPES>()],
|
|
382
371
|
['queryTtlValue', shortUInt],
|
|
383
|
-
['responseTtlType',
|
|
372
|
+
['responseTtlType', enumeration<ORACLE_TTL_TYPES>()],
|
|
384
373
|
['responseTtlValue', shortUInt],
|
|
385
374
|
['fee', fee],
|
|
386
375
|
['ttl', shortUInt],
|
|
@@ -389,11 +378,11 @@ export const TX_SCHEMA = {
|
|
|
389
378
|
[Tag.OracleResponseTx]: {
|
|
390
379
|
1: [
|
|
391
380
|
...BASE_TX,
|
|
392
|
-
['oracleId',
|
|
381
|
+
['oracleId', address<Encoding.OracleAddress>()],
|
|
393
382
|
['nonce', shortUInt],
|
|
394
383
|
['queryId', FIELD_TYPES.binary, Encoding.OracleQueryId],
|
|
395
384
|
['response', FIELD_TYPES.string],
|
|
396
|
-
['responseTtlType',
|
|
385
|
+
['responseTtlType', enumeration<ORACLE_TTL_TYPES>()],
|
|
397
386
|
['responseTtlValue', shortUInt],
|
|
398
387
|
['fee', fee],
|
|
399
388
|
['ttl', shortUInt],
|
|
@@ -402,9 +391,9 @@ export const TX_SCHEMA = {
|
|
|
402
391
|
[Tag.ChannelCreateTx]: {
|
|
403
392
|
2: [
|
|
404
393
|
...BASE_TX,
|
|
405
|
-
['initiator',
|
|
394
|
+
['initiator', address<Encoding.AccountAddress>()],
|
|
406
395
|
['initiatorAmount', uInt],
|
|
407
|
-
['responder',
|
|
396
|
+
['responder', address<Encoding.AccountAddress>()],
|
|
408
397
|
['responderAmount', uInt],
|
|
409
398
|
['channelReserve', uInt],
|
|
410
399
|
['lockPeriod', uInt],
|
|
@@ -412,15 +401,15 @@ export const TX_SCHEMA = {
|
|
|
412
401
|
['fee', fee],
|
|
413
402
|
['initiatorDelegateIds', FIELD_TYPES.string],
|
|
414
403
|
['responderDelegateIds', FIELD_TYPES.string],
|
|
415
|
-
['stateHash', FIELD_TYPES.binary,
|
|
404
|
+
['stateHash', FIELD_TYPES.binary, Encoding.State],
|
|
416
405
|
['nonce', shortUInt],
|
|
417
406
|
],
|
|
418
407
|
},
|
|
419
408
|
[Tag.ChannelCloseMutualTx]: {
|
|
420
409
|
1: [
|
|
421
410
|
...BASE_TX,
|
|
422
|
-
['channelId',
|
|
423
|
-
['fromId',
|
|
411
|
+
['channelId', address<Encoding.Channel>()],
|
|
412
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
424
413
|
['initiatorAmountFinal', uInt],
|
|
425
414
|
['responderAmountFinal', uInt],
|
|
426
415
|
['ttl', shortUInt],
|
|
@@ -431,10 +420,10 @@ export const TX_SCHEMA = {
|
|
|
431
420
|
[Tag.ChannelCloseSoloTx]: {
|
|
432
421
|
1: [
|
|
433
422
|
...BASE_TX,
|
|
434
|
-
['channelId',
|
|
435
|
-
['fromId',
|
|
436
|
-
['payload', FIELD_TYPES.binary,
|
|
437
|
-
['poi', FIELD_TYPES.binary,
|
|
423
|
+
['channelId', address<Encoding.Channel>()],
|
|
424
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
425
|
+
['payload', FIELD_TYPES.binary, Encoding.Transaction],
|
|
426
|
+
['poi', FIELD_TYPES.binary, Encoding.Poi],
|
|
438
427
|
['ttl', shortUInt],
|
|
439
428
|
['fee', fee],
|
|
440
429
|
['nonce', shortUInt],
|
|
@@ -443,10 +432,10 @@ export const TX_SCHEMA = {
|
|
|
443
432
|
[Tag.ChannelSlashTx]: {
|
|
444
433
|
1: [
|
|
445
434
|
...BASE_TX,
|
|
446
|
-
['channelId',
|
|
447
|
-
['fromId',
|
|
448
|
-
['payload', FIELD_TYPES.binary,
|
|
449
|
-
['poi', FIELD_TYPES.binary,
|
|
435
|
+
['channelId', address<Encoding.Channel>()],
|
|
436
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
437
|
+
['payload', FIELD_TYPES.binary, Encoding.Transaction],
|
|
438
|
+
['poi', FIELD_TYPES.binary, Encoding.Poi],
|
|
450
439
|
['ttl', shortUInt],
|
|
451
440
|
['fee', fee],
|
|
452
441
|
['nonce', shortUInt],
|
|
@@ -455,12 +444,12 @@ export const TX_SCHEMA = {
|
|
|
455
444
|
[Tag.ChannelDepositTx]: {
|
|
456
445
|
1: [
|
|
457
446
|
...BASE_TX,
|
|
458
|
-
['channelId',
|
|
459
|
-
['fromId',
|
|
447
|
+
['channelId', address<Encoding.Channel>()],
|
|
448
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
460
449
|
['amount', uInt],
|
|
461
450
|
['ttl', shortUInt],
|
|
462
451
|
['fee', fee],
|
|
463
|
-
['stateHash', FIELD_TYPES.binary,
|
|
452
|
+
['stateHash', FIELD_TYPES.binary, Encoding.State],
|
|
464
453
|
['round', shortUInt],
|
|
465
454
|
['nonce', shortUInt],
|
|
466
455
|
],
|
|
@@ -468,12 +457,12 @@ export const TX_SCHEMA = {
|
|
|
468
457
|
[Tag.ChannelWithdrawTx]: {
|
|
469
458
|
1: [
|
|
470
459
|
...BASE_TX,
|
|
471
|
-
['channelId',
|
|
472
|
-
['toId',
|
|
460
|
+
['channelId', address<Encoding.Channel>()],
|
|
461
|
+
['toId', address<Encoding.AccountAddress>()],
|
|
473
462
|
['amount', uInt],
|
|
474
463
|
['ttl', shortUInt],
|
|
475
464
|
['fee', fee],
|
|
476
|
-
['stateHash', FIELD_TYPES.binary,
|
|
465
|
+
['stateHash', FIELD_TYPES.binary, Encoding.State],
|
|
477
466
|
['round', shortUInt],
|
|
478
467
|
['nonce', shortUInt],
|
|
479
468
|
],
|
|
@@ -481,8 +470,8 @@ export const TX_SCHEMA = {
|
|
|
481
470
|
[Tag.ChannelSettleTx]: {
|
|
482
471
|
1: [
|
|
483
472
|
...BASE_TX,
|
|
484
|
-
['channelId',
|
|
485
|
-
['fromId',
|
|
473
|
+
['channelId', address<Encoding.Channel>()],
|
|
474
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
486
475
|
['initiatorAmountFinal', uInt],
|
|
487
476
|
['responderAmountFinal', uInt],
|
|
488
477
|
['ttl', shortUInt],
|
|
@@ -493,12 +482,12 @@ export const TX_SCHEMA = {
|
|
|
493
482
|
[Tag.ChannelForceProgressTx]: {
|
|
494
483
|
1: [
|
|
495
484
|
...BASE_TX,
|
|
496
|
-
['channelId',
|
|
497
|
-
['fromId',
|
|
498
|
-
['payload', FIELD_TYPES.binary,
|
|
485
|
+
['channelId', address<Encoding.Channel>()],
|
|
486
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
487
|
+
['payload', FIELD_TYPES.binary, Encoding.Transaction],
|
|
499
488
|
['round', shortUInt],
|
|
500
489
|
['update', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
501
|
-
['stateHash', FIELD_TYPES.binary,
|
|
490
|
+
['stateHash', FIELD_TYPES.binary, Encoding.State],
|
|
502
491
|
['offChainTrees', FIELD_TYPES.stateTree],
|
|
503
492
|
['ttl', shortUInt],
|
|
504
493
|
['fee', fee],
|
|
@@ -508,22 +497,22 @@ export const TX_SCHEMA = {
|
|
|
508
497
|
[Tag.ChannelOffChainTx]: {
|
|
509
498
|
2: [
|
|
510
499
|
...BASE_TX,
|
|
511
|
-
['channelId',
|
|
500
|
+
['channelId', address<Encoding.Channel>()],
|
|
512
501
|
['round', shortUInt],
|
|
513
|
-
['stateHash', FIELD_TYPES.binary,
|
|
502
|
+
['stateHash', FIELD_TYPES.binary, Encoding.State],
|
|
514
503
|
],
|
|
515
504
|
},
|
|
516
505
|
[Tag.Channel]: {
|
|
517
506
|
3: [
|
|
518
507
|
...BASE_TX,
|
|
519
|
-
['initiator',
|
|
520
|
-
['responder',
|
|
508
|
+
['initiator', address<Encoding.AccountAddress>()],
|
|
509
|
+
['responder', address<Encoding.AccountAddress>()],
|
|
521
510
|
['channelAmount', uInt],
|
|
522
511
|
['initiatorAmount', uInt],
|
|
523
512
|
['responderAmount', uInt],
|
|
524
513
|
['channelReserve', uInt],
|
|
525
|
-
['initiatorDelegateIds',
|
|
526
|
-
['responderDelegateIds',
|
|
514
|
+
['initiatorDelegateIds', addresses<AddressEncodings>()],
|
|
515
|
+
['responderDelegateIds', addresses<AddressEncodings>()],
|
|
527
516
|
['stateHash', FIELD_TYPES.hex],
|
|
528
517
|
['round', shortUInt],
|
|
529
518
|
['soloRound', uInt],
|
|
@@ -536,9 +525,9 @@ export const TX_SCHEMA = {
|
|
|
536
525
|
[Tag.ChannelSnapshotSoloTx]: {
|
|
537
526
|
1: [
|
|
538
527
|
...BASE_TX,
|
|
539
|
-
['channelId',
|
|
540
|
-
['fromId',
|
|
541
|
-
['payload', FIELD_TYPES.binary,
|
|
528
|
+
['channelId', address<Encoding.Channel>()],
|
|
529
|
+
['fromId', address<Encoding.AccountAddress>()],
|
|
530
|
+
['payload', FIELD_TYPES.binary, Encoding.Transaction],
|
|
542
531
|
['ttl', shortUInt],
|
|
543
532
|
['fee', fee],
|
|
544
533
|
['nonce', shortUInt],
|
|
@@ -547,29 +536,29 @@ export const TX_SCHEMA = {
|
|
|
547
536
|
[Tag.ChannelOffChainUpdateTransfer]: {
|
|
548
537
|
1: [
|
|
549
538
|
...BASE_TX,
|
|
550
|
-
['from',
|
|
551
|
-
['to',
|
|
539
|
+
['from', address<Encoding.AccountAddress>()],
|
|
540
|
+
['to', address<Encoding.AccountAddress>()],
|
|
552
541
|
['amount', uInt],
|
|
553
542
|
],
|
|
554
543
|
},
|
|
555
544
|
[Tag.ChannelOffChainUpdateDeposit]: {
|
|
556
545
|
1: [
|
|
557
546
|
...BASE_TX,
|
|
558
|
-
['from',
|
|
547
|
+
['from', address<Encoding.AccountAddress>()],
|
|
559
548
|
['amount', uInt],
|
|
560
549
|
],
|
|
561
550
|
},
|
|
562
551
|
[Tag.ChannelOffChainUpdateWithdraw]: {
|
|
563
552
|
1: [
|
|
564
553
|
...BASE_TX,
|
|
565
|
-
['from',
|
|
554
|
+
['from', address<Encoding.AccountAddress>()],
|
|
566
555
|
['amount', uInt],
|
|
567
556
|
],
|
|
568
557
|
},
|
|
569
558
|
[Tag.ChannelOffChainUpdateCreateContract]: {
|
|
570
559
|
1: [
|
|
571
560
|
...BASE_TX,
|
|
572
|
-
['owner',
|
|
561
|
+
['owner', address<Encoding.AccountAddress>()],
|
|
573
562
|
['ctVersion', FIELD_TYPES.ctVersion],
|
|
574
563
|
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
575
564
|
['deposit', uInt],
|
|
@@ -579,9 +568,9 @@ export const TX_SCHEMA = {
|
|
|
579
568
|
[Tag.ChannelOffChainUpdateCallContract]: {
|
|
580
569
|
1: [
|
|
581
570
|
...BASE_TX,
|
|
582
|
-
['caller',
|
|
583
|
-
['contract',
|
|
584
|
-
['abiVersion',
|
|
571
|
+
['caller', address<Encoding.AccountAddress>()],
|
|
572
|
+
['contract', address<Encoding.ContractAddress>()],
|
|
573
|
+
['abiVersion', enumeration<ABI_VERSIONS>()],
|
|
585
574
|
['amount', uInt],
|
|
586
575
|
['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
587
576
|
['callStack', FIELD_TYPES.callStack],
|
|
@@ -592,10 +581,10 @@ export const TX_SCHEMA = {
|
|
|
592
581
|
[Tag.ChannelClientReconnectTx]: {
|
|
593
582
|
1: [
|
|
594
583
|
...BASE_TX,
|
|
595
|
-
['channelId',
|
|
584
|
+
['channelId', address<Encoding.Channel>()],
|
|
596
585
|
['round', shortUInt],
|
|
597
586
|
['role', FIELD_TYPES.string],
|
|
598
|
-
['pubkey',
|
|
587
|
+
['pubkey', address<Encoding.AccountAddress>()],
|
|
599
588
|
],
|
|
600
589
|
},
|
|
601
590
|
[Tag.TreesPoi]: {
|
|
@@ -672,7 +661,7 @@ export const TX_SCHEMA = {
|
|
|
672
661
|
[Tag.GaAttachTx]: {
|
|
673
662
|
1: [
|
|
674
663
|
...BASE_TX,
|
|
675
|
-
['ownerId',
|
|
664
|
+
['ownerId', address<Encoding.AccountAddress>()],
|
|
676
665
|
['nonce', shortUInt],
|
|
677
666
|
['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
678
667
|
['authFun', FIELD_TYPES.rawBinary],
|
|
@@ -687,9 +676,9 @@ export const TX_SCHEMA = {
|
|
|
687
676
|
[Tag.GaMetaTx]: {
|
|
688
677
|
2: [
|
|
689
678
|
...BASE_TX,
|
|
690
|
-
['gaId',
|
|
679
|
+
['gaId', address<Encoding.AccountAddress>()],
|
|
691
680
|
['authData', FIELD_TYPES.binary, Encoding.ContractBytearray],
|
|
692
|
-
['abiVersion',
|
|
681
|
+
['abiVersion', enumeration<ABI_VERSIONS>()],
|
|
693
682
|
['fee', fee],
|
|
694
683
|
['gasLimit', gasLimit],
|
|
695
684
|
['gasPrice', gasPrice],
|
|
@@ -699,7 +688,7 @@ export const TX_SCHEMA = {
|
|
|
699
688
|
[Tag.PayingForTx]: {
|
|
700
689
|
1: [
|
|
701
690
|
...BASE_TX,
|
|
702
|
-
['payerId',
|
|
691
|
+
['payerId', address<Encoding.AccountAddress>()],
|
|
703
692
|
['nonce', shortUInt],
|
|
704
693
|
['fee', fee],
|
|
705
694
|
['tx', FIELD_TYPES.rlpBinary],
|
package/src/tx/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import Node from '../Node';
|
|
34
34
|
import { Encoded } from '../utils/encoder';
|
|
35
35
|
import { buildTx as syncBuildTx, unpackTx } from './builder/index';
|
|
36
|
-
import { isKeyOfObject } from '../utils/other';
|
|
36
|
+
import { isAccountNotFoundError, isKeyOfObject } from '../utils/other';
|
|
37
37
|
import { AE_AMOUNT_FORMATS } from '../utils/amount-formatter';
|
|
38
38
|
|
|
39
39
|
type Int = number | string | BigNumber;
|
|
@@ -48,13 +48,13 @@ export type BuildTxOptions <TxType extends Tag, OmitFields extends string> =
|
|
|
48
48
|
* @param ctVersion - Object with vm and abi version fields
|
|
49
49
|
* @returns Object with vm/abi version
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
async function getVmVersion(
|
|
52
52
|
txType: Tag.ContractCreateTx, ctVersion: Partial<CtVersion> & { onNode: Node }
|
|
53
53
|
): Promise<CtVersion>;
|
|
54
|
-
|
|
54
|
+
async function getVmVersion(
|
|
55
55
|
txType: Tag, ctVersion: Partial<Pick<CtVersion, 'abiVersion'>> & { onNode: Node }
|
|
56
56
|
): Promise<Pick<CtVersion, 'abiVersion'>>;
|
|
57
|
-
|
|
57
|
+
async function getVmVersion(
|
|
58
58
|
txType: Tag,
|
|
59
59
|
{ vmVersion, abiVersion, onNode }: Partial<CtVersion> & { onNode: Node },
|
|
60
60
|
): Promise<Partial<CtVersion>> {
|
|
@@ -79,7 +79,7 @@ export async function getVmVersion(
|
|
|
79
79
|
* @param params - Object which contains all tx data
|
|
80
80
|
* @returns Object with account nonce, absolute ttl and transaction fee
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
async function prepareTxParams(
|
|
83
83
|
txType: Tag,
|
|
84
84
|
{
|
|
85
85
|
senderId,
|
|
@@ -88,10 +88,18 @@ export async function prepareTxParams(
|
|
|
88
88
|
absoluteTtl,
|
|
89
89
|
strategy,
|
|
90
90
|
onNode,
|
|
91
|
-
}:
|
|
91
|
+
}: {
|
|
92
|
+
senderId: Encoded.AccountAddress;
|
|
93
|
+
absoluteTtl?: boolean;
|
|
94
|
+
strategy?: 'continuity' | 'max';
|
|
95
|
+
onNode: Node;
|
|
96
|
+
} & Pick<TxParamsCommon, 'nonce' | 'ttl'>,
|
|
92
97
|
): Promise<{ ttl: number; nonce: number }> {
|
|
93
98
|
nonce ??= (
|
|
94
|
-
await onNode.getAccountNextNonce(senderId, { strategy }).catch(() =>
|
|
99
|
+
await onNode.getAccountNextNonce(senderId, { strategy }).catch((error) => {
|
|
100
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
101
|
+
return { nextNonce: 1 };
|
|
102
|
+
})
|
|
95
103
|
).nextNonce;
|
|
96
104
|
|
|
97
105
|
if (ttl !== 0) {
|
|
@@ -102,13 +110,6 @@ export async function prepareTxParams(
|
|
|
102
110
|
return { ttl, nonce };
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
interface PrepareTxParamsOptions extends Pick<TxParamsCommon, 'nonce' | 'ttl'> {
|
|
106
|
-
senderId: Encoded.AccountAddress;
|
|
107
|
-
absoluteTtl?: boolean;
|
|
108
|
-
strategy?: 'continuity' | 'max';
|
|
109
|
-
onNode: Node;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
113
|
// TODO: find a better name or rearrange methods
|
|
113
114
|
/**
|
|
114
115
|
* @category transaction builder
|
|
@@ -151,6 +152,9 @@ export async function _buildTx<TxType extends Tag>(
|
|
|
151
152
|
case Tag.GaAttachTx:
|
|
152
153
|
senderKey = 'ownerId';
|
|
153
154
|
break;
|
|
155
|
+
case Tag.GaMetaTx:
|
|
156
|
+
senderKey = 'gaId';
|
|
157
|
+
break;
|
|
154
158
|
case Tag.ContractCallTx:
|
|
155
159
|
case Tag.OracleExtendTx:
|
|
156
160
|
case Tag.OracleResponseTx:
|
|
@@ -175,7 +179,7 @@ export async function _buildTx<TxType extends Tag>(
|
|
|
175
179
|
{ ...params, ...params.ctVersion },
|
|
176
180
|
);
|
|
177
181
|
}
|
|
178
|
-
if (
|
|
182
|
+
if ([Tag.ContractCallTx, Tag.GaMetaTx].includes(txType)) {
|
|
179
183
|
params.abiVersion = (await getVmVersion(Tag.ContractCallTx, params)).abiVersion;
|
|
180
184
|
}
|
|
181
185
|
if (txType === Tag.OracleRegisterTx) {
|