@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.mjs","names":["decode","encode","Encoding","ArgumentError","genEntryField","tag","serialize","txParams","buildTx","ArrayBuffer","isView","from","deserialize","buf","unpackTx","tx","Transaction"],"sources":["../../../../src/tx/builder/field-types/entry.ts"],"sourcesContent":["import { decode, encode, Encoding } from '../../../utils/encoder';\nimport { Tag } from '../constants';\nimport { ArgumentError } from '../../../utils/errors';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nexport default function genEntryField<T extends Tag = Tag>(tag?: T): {\n serialize: (\n // TODO: replace with `Parameters<typeof buildTxType<T>>[0]`,\n // but fix TS2502 value is referenced directly or indirectly in its own type annotation\n value: any,\n options: { buildTx: typeof buildTxType },\n ) => Buffer;\n deserialize: (\n value: Buffer, options: { unpackTx: typeof unpackTxType },\n // TODO: replace with `ReturnType<typeof unpackTxType<T>>`,\n // TS2577 Return type annotation circularly references itself\n ) => any;\n} {\n return {\n serialize(txParams, { buildTx }) {\n if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams as any);\n return decode(buildTx({ ...txParams, ...tag != null && { tag } }));\n },\n\n deserialize(buf, { unpackTx }) {\n const tx = unpackTx(encode(buf, Encoding.Transaction));\n if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', tag, tx.tag);\n return tx;\n },\n };\n}\n"],"mappings":";;;;SAASA,MAAM,EAAEC,MAAM,EAAEC,QAAQ;AAAA,SAExBC,aAAa;AAGtB,eAAe,SAASC,aAAa,CAAsBC,GAAO,EAYhE;EACA,OAAO;IACLC,SAAS,CAACC,QAAQ,QAAe;MAAA,IAAb;QAAEC;MAAQ,CAAC;MAC7B,IAAIC,WAAW,CAACC,MAAM,CAACH,QAAQ,CAAC,EAAE,OAAO,QAAOI,IAAI,CAACJ,QAAQ,CAAQ;MACrE,OAAOP,MAAM,CAACQ,OAAO,CAAC;QAAE,GAAGD,QAAQ;QAAE,IAAGF,GAAG,IAAI,IAAI,IAAI;UAAEA;QAAI,CAAC;MAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IAEDO,WAAW,CAACC,GAAG,SAAgB;MAAA,IAAd;QAAEC;MAAS,CAAC;MAC3B,MAAMC,EAAE,GAAGD,QAAQ,CAACb,MAAM,CAACY,GAAG,EAAEX,QAAQ,CAACc,WAAW,CAAC,CAAC;MACtD,IAAIX,GAAG,IAAI,IAAI,IAAIU,EAAE,CAACV,GAAG,KAAKA,GAAG,EAAE,MAAM,IAAIF,aAAa,CAAC,KAAK,EAAEE,GAAG,EAAEU,EAAE,CAACV,GAAG,CAAC;MAC9E,OAAOU,EAAE;IACX;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
6
|
+
import { isItemOfArray } from "../../../utils/other.mjs";
|
|
7
|
+
export default function genEnumerationField(enm) {
|
|
8
|
+
const values = Object.values(enm).filter(v => typeof v === 'number');
|
|
9
|
+
return {
|
|
10
|
+
serialize(value) {
|
|
11
|
+
if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);
|
|
12
|
+
if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);
|
|
13
|
+
if (!isItemOfArray(value, values)) {
|
|
14
|
+
throw new ArgumentError('value', 'to be a value of Enum', value);
|
|
15
|
+
}
|
|
16
|
+
return _Buffer.from([value]);
|
|
17
|
+
},
|
|
18
|
+
deserialize(buffer) {
|
|
19
|
+
if (buffer.length !== 1) {
|
|
20
|
+
throw new ArgumentError('buffer', 'to have single element', buffer.length);
|
|
21
|
+
}
|
|
22
|
+
const value = buffer[0];
|
|
23
|
+
if (!isItemOfArray(value, values)) {
|
|
24
|
+
throw new ArgumentError('value', 'to be a value of Enum', value);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=enumeration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumeration.mjs","names":["ArgumentError","isItemOfArray","genEnumerationField","enm","values","Object","filter","v","serialize","value","from","deserialize","buffer","length"],"sources":["../../../../src/tx/builder/field-types/enumeration.ts"],"sourcesContent":["import { ArgumentError } from '../../../utils/errors';\nimport { isItemOfArray } from '../../../utils/other';\n\nexport default function genEnumerationField<\n Enum extends { [key: string]: number | string },\n>(enm: Enum): {\n serialize: (value: Enum[keyof Enum]) => Buffer;\n deserialize: (value: Buffer) => Enum[keyof Enum];\n} {\n const values = Object.values(enm).filter((v) => typeof v === 'number');\n return {\n serialize(value) {\n if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);\n if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);\n if (!isItemOfArray(value, values)) {\n throw new ArgumentError('value', 'to be a value of Enum', value);\n }\n return Buffer.from([value]);\n },\n\n deserialize(buffer) {\n if (buffer.length !== 1) {\n throw new ArgumentError('buffer', 'to have single element', buffer.length);\n }\n const value = buffer[0];\n if (!isItemOfArray(value, values)) {\n throw new ArgumentError('value', 'to be a value of Enum', value);\n }\n return value as Enum[keyof Enum];\n },\n };\n}\n"],"mappings":";;;;SAASA,aAAa;AAAA,SACbC,aAAa;AAEtB,eAAe,SAASC,mBAAmB,CAEzCC,GAAS,EAGT;EACA,MAAMC,MAAM,GAAGC,MAAM,CAACD,MAAM,CAACD,GAAG,CAAC,CAACG,MAAM,CAAEC,CAAC,IAAK,OAAOA,CAAC,KAAK,QAAQ,CAAC;EACtE,OAAO;IACLC,SAAS,CAACC,KAAK,EAAE;MACf,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,MAAM,IAAIT,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAES,KAAK,CAAC;MACxF,IAAIA,KAAK,GAAG,IAAI,EAAE,MAAM,IAAIT,aAAa,CAAC,OAAO,EAAE,qBAAqB,EAAES,KAAK,CAAC;MAChF,IAAI,CAACR,aAAa,CAACQ,KAAK,EAAEL,MAAM,CAAC,EAAE;QACjC,MAAM,IAAIJ,aAAa,CAAC,OAAO,EAAE,uBAAuB,EAAES,KAAK,CAAC;MAClE;MACA,OAAO,QAAOC,IAAI,CAAC,CAACD,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEDE,WAAW,CAACC,MAAM,EAAE;MAClB,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAIb,aAAa,CAAC,QAAQ,EAAE,wBAAwB,EAAEY,MAAM,CAACC,MAAM,CAAC;MAC5E;MACA,MAAMJ,KAAK,GAAGG,MAAM,CAAC,CAAC,CAAC;MACvB,IAAI,CAACX,aAAa,CAACQ,KAAK,EAAEL,MAAM,CAAC,EAAE;QACjC,MAAM,IAAIJ,aAAa,CAAC,OAAO,EAAE,uBAAuB,EAAES,KAAK,CAAC;MAClE;MACA,OAAOA,KAAK;IACd;EACF,CAAC;AACH"}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Encoded } from '../../../utils/encoder';
|
|
4
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
4
5
|
/**
|
|
5
6
|
* Calculate fee based on tx type and params
|
|
6
7
|
*/
|
|
7
|
-
export declare function buildFee(
|
|
8
|
-
/**
|
|
9
|
-
* Calculate min fee
|
|
10
|
-
* @category transaction builder
|
|
11
|
-
* @param txType - Transaction type
|
|
12
|
-
* @param rebuildTx - Callback to get built transaction with specific fee
|
|
13
|
-
*/
|
|
14
|
-
export declare function calculateMinFee(txType: Tag, rebuildTx: (value: BigNumber) => any): BigNumber;
|
|
8
|
+
export declare function buildFee(builtTx: Encoded.Transaction, unpackTx: typeof unpackTxType, buildTx: typeof buildTxType): BigNumber;
|
|
15
9
|
declare const _default: {
|
|
16
|
-
serializeAettos(_value: string | undefined, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
serializeAettos(_value: string | undefined, { rebuildTx, unpackTx, buildTx, _computingMinFee, _pickBiggerFee, }: {
|
|
11
|
+
rebuildTx: (params: any) => Encoded.Transaction;
|
|
12
|
+
unpackTx: typeof unpackTxType;
|
|
13
|
+
buildTx: typeof buildTxType;
|
|
14
|
+
_computingMinFee?: BigNumber | undefined;
|
|
15
|
+
_pickBiggerFee?: boolean | undefined;
|
|
20
16
|
}): string;
|
|
21
|
-
serialize
|
|
22
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
17
|
+
serialize(value: import("../constants").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
23
18
|
deserialize(value: Buffer): string;
|
|
24
19
|
};
|
|
25
20
|
export default _default;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
2
1
|
import BigNumber from 'bignumber.js';
|
|
3
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
4
3
|
import { MIN_GAS_PRICE, Tag } from "../constants.mjs";
|
|
5
4
|
import coinAmount from "./coin-amount.mjs";
|
|
6
5
|
import { isKeyOfObject } from "../../../utils/other.mjs";
|
|
6
|
+
import { decode } from "../../../utils/encoder.mjs";
|
|
7
7
|
const BASE_GAS = 15000;
|
|
8
8
|
const GAS_PER_BYTE = 20;
|
|
9
9
|
const KEY_BLOCK_INTERVAL = 3;
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
12
|
* Calculate the Base fee gas
|
|
12
13
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
@@ -17,10 +18,8 @@ const KEY_BLOCK_INTERVAL = 3;
|
|
|
17
18
|
* TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
21
|
const TX_FEE_BASE_GAS = txType => {
|
|
22
22
|
var _feeFactors;
|
|
23
|
-
|
|
24
23
|
const feeFactors = {
|
|
25
24
|
[Tag.ChannelForceProgressTx]: 30,
|
|
26
25
|
[Tag.ChannelOffChainTx]: 0,
|
|
@@ -38,6 +37,7 @@ const TX_FEE_BASE_GAS = txType => {
|
|
|
38
37
|
const factor = (_feeFactors = feeFactors[txType]) !== null && _feeFactors !== void 0 ? _feeFactors : 1;
|
|
39
38
|
return new BigNumber(factor * BASE_GAS);
|
|
40
39
|
};
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
* Calculate fee for Other types of transactions
|
|
43
43
|
* @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
|
|
@@ -53,98 +53,86 @@ const TX_FEE_BASE_GAS = txType => {
|
|
|
53
53
|
* => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
56
|
const TX_FEE_OTHER_GAS = (txType, txSize, _ref) => {
|
|
59
57
|
let {
|
|
60
58
|
relativeTtl,
|
|
61
59
|
innerTxSize
|
|
62
60
|
} = _ref;
|
|
63
|
-
|
|
64
61
|
switch (txType) {
|
|
65
62
|
case Tag.OracleRegisterTx:
|
|
66
63
|
case Tag.OracleExtendTx:
|
|
67
64
|
case Tag.OracleQueryTx:
|
|
68
65
|
case Tag.OracleResponseTx:
|
|
69
66
|
return new BigNumber(txSize).times(GAS_PER_BYTE).plus(Math.ceil(32000 * relativeTtl / Math.floor(60 * 24 * 365 / KEY_BLOCK_INTERVAL)));
|
|
70
|
-
|
|
71
67
|
case Tag.GaMetaTx:
|
|
72
68
|
case Tag.PayingForTx:
|
|
73
69
|
return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);
|
|
74
|
-
|
|
75
70
|
default:
|
|
76
71
|
return new BigNumber(txSize).times(GAS_PER_BYTE);
|
|
77
72
|
}
|
|
78
73
|
};
|
|
79
|
-
|
|
80
|
-
function getOracleRelativeTtl(params, txType) {
|
|
74
|
+
function getOracleRelativeTtl(params) {
|
|
81
75
|
const ttlKeys = {
|
|
82
76
|
[Tag.OracleRegisterTx]: 'oracleTtlValue',
|
|
83
77
|
[Tag.OracleExtendTx]: 'oracleTtlValue',
|
|
84
78
|
[Tag.OracleQueryTx]: 'queryTtlValue',
|
|
85
79
|
[Tag.OracleResponseTx]: 'responseTtlValue'
|
|
86
80
|
};
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
const {
|
|
82
|
+
tag
|
|
83
|
+
} = params;
|
|
84
|
+
if (!isKeyOfObject(tag, ttlKeys)) return 1;
|
|
85
|
+
return params[ttlKeys[tag]];
|
|
89
86
|
}
|
|
87
|
+
|
|
90
88
|
/**
|
|
91
89
|
* Calculate fee based on tx type and params
|
|
92
90
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export function buildFee(txType, buildTx) {
|
|
96
|
-
var _context;
|
|
97
|
-
|
|
91
|
+
export function buildFee(builtTx, unpackTx, buildTx) {
|
|
98
92
|
const {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
relativeTtl: getOracleRelativeTtl(txObject, txType),
|
|
106
|
-
innerTxSize: _includesInstanceProperty(_context = [Tag.GaMetaTx, Tag.PayingForTx]).call(_context, txType) ? txObject.tx.tx.encodedTx.rlpEncoded.length : 0
|
|
93
|
+
length
|
|
94
|
+
} = decode(builtTx);
|
|
95
|
+
const txObject = unpackTx(builtTx);
|
|
96
|
+
return TX_FEE_BASE_GAS(txObject.tag).plus(TX_FEE_OTHER_GAS(txObject.tag, length, {
|
|
97
|
+
relativeTtl: getOracleRelativeTtl(txObject),
|
|
98
|
+
innerTxSize: txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx ? decode(buildTx(txObject.tx.encodedTx)).length : 0
|
|
107
99
|
})).times(MIN_GAS_PRICE);
|
|
108
100
|
}
|
|
101
|
+
|
|
109
102
|
/**
|
|
110
103
|
* Calculate min fee
|
|
111
104
|
* @category transaction builder
|
|
112
|
-
* @param txType - Transaction type
|
|
113
105
|
* @param rebuildTx - Callback to get built transaction with specific fee
|
|
114
106
|
*/
|
|
115
|
-
|
|
116
|
-
export function calculateMinFee(txType, rebuildTx) {
|
|
107
|
+
function calculateMinFee(rebuildTx, unpackTx, buildTx) {
|
|
117
108
|
let fee = new BigNumber(0);
|
|
118
109
|
let previousFee;
|
|
119
|
-
|
|
120
110
|
do {
|
|
121
111
|
previousFee = fee;
|
|
122
|
-
fee = buildFee(
|
|
112
|
+
fee = buildFee(rebuildTx(fee), unpackTx, buildTx);
|
|
123
113
|
} while (!fee.eq(previousFee));
|
|
124
|
-
|
|
125
114
|
return fee;
|
|
126
115
|
}
|
|
127
|
-
export default {
|
|
128
|
-
|
|
116
|
+
export default {
|
|
117
|
+
...coinAmount,
|
|
129
118
|
serializeAettos(_value, _ref2) {
|
|
130
119
|
let {
|
|
131
|
-
txType,
|
|
132
120
|
rebuildTx,
|
|
133
|
-
|
|
121
|
+
unpackTx,
|
|
122
|
+
buildTx,
|
|
123
|
+
_computingMinFee,
|
|
124
|
+
_pickBiggerFee
|
|
134
125
|
} = _ref2;
|
|
135
|
-
if (_computingMinFee != null) return _computingMinFee;
|
|
136
|
-
const minFee = calculateMinFee(
|
|
126
|
+
if (_computingMinFee != null) return _computingMinFee.toFixed();
|
|
127
|
+
const minFee = calculateMinFee(fee => rebuildTx({
|
|
137
128
|
_computingMinFee: fee
|
|
138
|
-
}));
|
|
129
|
+
}), unpackTx, buildTx);
|
|
139
130
|
const value = new BigNumber(_value !== null && _value !== void 0 ? _value : minFee);
|
|
140
|
-
|
|
141
131
|
if (minFee.gt(value)) {
|
|
132
|
+
if (_pickBiggerFee === true) return minFee.toFixed();
|
|
142
133
|
throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);
|
|
143
134
|
}
|
|
144
|
-
|
|
145
135
|
return value.toFixed();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
serialize: coinAmount.serializeOptional
|
|
136
|
+
}
|
|
149
137
|
};
|
|
150
138
|
//# sourceMappingURL=fee.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","buildFee","
|
|
1
|
+
{"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","decode","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","tag","buildFee","builtTx","unpackTx","buildTx","length","txObject","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_computingMinFee","_pickBiggerFee","toFixed","minFee","value","gt","toString"],"sources":["../../../../src/tx/builder/field-types/fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport coinAmount from './coin-amount';\nimport { isKeyOfObject } from '../../../utils/other';\nimport { decode, Encoded } from '../../../utils/encoder';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nconst BASE_GAS = 15000;\nconst GAS_PER_BYTE = 20;\nconst KEY_BLOCK_INTERVAL = 3;\n\n/**\n * Calculate the Base fee gas\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @returns The base fee\n * @example\n * ```js\n * TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)\n * ```\n */\nconst TX_FEE_BASE_GAS = (txType: Tag): BigNumber => {\n const feeFactors = {\n [Tag.ChannelForceProgressTx]: 30,\n [Tag.ChannelOffChainTx]: 0,\n [Tag.ChannelOffChainUpdateCallContract]: 0,\n [Tag.ChannelOffChainUpdateCreateContract]: 0,\n [Tag.ChannelOffChainUpdateDeposit]: 0,\n [Tag.ChannelOffChainUpdateWithdraw]: 0,\n [Tag.ChannelOffChainUpdateTransfer]: 0,\n [Tag.ContractCreateTx]: 5,\n [Tag.ContractCallTx]: 12,\n [Tag.GaAttachTx]: 5,\n [Tag.GaMetaTx]: 5,\n [Tag.PayingForTx]: 1 / 5,\n } as const;\n const factor = feeFactors[txType as keyof typeof feeFactors] ?? 1;\n return new BigNumber(factor * BASE_GAS);\n};\n\n/**\n * Calculate fee for Other types of transactions\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @param txSize - The transaction size\n * @returns parameters - The transaction parameters\n * @returns parameters.relativeTtl - The relative ttl\n * @returns parameters.innerTxSize - The size of the inner transaction\n * @returns The Other fee\n * @example\n * ```js\n * TX_FEE_OTHER_GAS('oracleResponse',10, { relativeTtl: 10, innerTxSize: 10 })\n * => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))\n * ```\n */\nconst TX_FEE_OTHER_GAS = (\n txType: Tag,\n txSize: number,\n { relativeTtl, innerTxSize }: { relativeTtl: number; innerTxSize: number },\n): BigNumber => {\n switch (txType) {\n case Tag.OracleRegisterTx:\n case Tag.OracleExtendTx:\n case Tag.OracleQueryTx:\n case Tag.OracleResponseTx:\n return new BigNumber(txSize)\n .times(GAS_PER_BYTE)\n .plus(\n Math.ceil((32000 * relativeTtl) / Math.floor((60 * 24 * 365) / KEY_BLOCK_INTERVAL)),\n );\n case Tag.GaMetaTx:\n case Tag.PayingForTx:\n return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);\n default:\n return new BigNumber(txSize).times(GAS_PER_BYTE);\n }\n};\n\nfunction getOracleRelativeTtl(params: any): number {\n const ttlKeys = {\n [Tag.OracleRegisterTx]: 'oracleTtlValue',\n [Tag.OracleExtendTx]: 'oracleTtlValue',\n [Tag.OracleQueryTx]: 'queryTtlValue',\n [Tag.OracleResponseTx]: 'responseTtlValue',\n } as const;\n\n const { tag } = params;\n if (!isKeyOfObject(tag, ttlKeys)) return 1;\n return params[ttlKeys[tag]];\n}\n\n/**\n * Calculate fee based on tx type and params\n */\nexport function buildFee(\n builtTx: Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): BigNumber {\n const { length } = decode(builtTx);\n const txObject = unpackTx(builtTx);\n\n return TX_FEE_BASE_GAS(txObject.tag)\n .plus(TX_FEE_OTHER_GAS(txObject.tag, length, {\n relativeTtl: getOracleRelativeTtl(txObject),\n innerTxSize: txObject.tag === Tag.GaMetaTx || txObject.tag === Tag.PayingForTx\n ? decode(buildTx(txObject.tx.encodedTx)).length\n : 0,\n }))\n .times(MIN_GAS_PRICE);\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nfunction calculateMinFee(\n rebuildTx: (value: BigNumber) => Encoded.Transaction,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = buildFee(rebuildTx(fee), unpackTx, buildTx);\n } while (!fee.eq(previousFee));\n return fee;\n}\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n {\n rebuildTx, unpackTx, buildTx, _computingMinFee, _pickBiggerFee,\n }: {\n rebuildTx: (params: any) => Encoded.Transaction;\n unpackTx: typeof unpackTxType;\n buildTx: typeof buildTxType;\n _computingMinFee?: BigNumber;\n _pickBiggerFee?: boolean;\n },\n ): string {\n if (_computingMinFee != null) return _computingMinFee.toFixed();\n const minFee = calculateMinFee(\n (fee) => rebuildTx({ _computingMinFee: fee }),\n unpackTx,\n buildTx,\n );\n const value = new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n if (_pickBiggerFee === true) return minFee.toFixed();\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);\n }\n return value.toFixed();\n },\n};\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.mjs","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,
|
|
1
|
+
{"version":3,"file":"field.mjs","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAa,EAAU;IAC/B,OAAO,QAAOC,IAAI,CAACD,KAAK,CAAC;EAC3B,CAAC;EAEDE,WAAW,CAACF,KAAa,EAAU;IACjC,OAAOA,KAAK,CAACG,QAAQ,EAAE;EACzB;AACF,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Tag } from '../constants';
|
|
3
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
3
4
|
declare const _default: {
|
|
4
|
-
serialize(_value: number | undefined, {
|
|
5
|
-
|
|
5
|
+
serialize(_value: number | undefined, { tag, rebuildTx, unpackTx, buildTx, gasMax, _computingGasLimit, }: {
|
|
6
|
+
tag: Tag;
|
|
6
7
|
rebuildTx: (params: any) => any;
|
|
8
|
+
unpackTx: typeof unpackTxType;
|
|
9
|
+
buildTx: typeof buildTxType;
|
|
7
10
|
gasMax: number;
|
|
8
11
|
_computingGasLimit?: number | undefined;
|
|
9
12
|
}): Buffer;
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
2
|
-
import { MIN_GAS_PRICE } from "../constants.mjs";
|
|
2
|
+
import { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from "../constants.mjs";
|
|
3
3
|
import shortUInt from "./short-u-int.mjs";
|
|
4
4
|
import { buildFee } from "./fee.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);
|
|
5
|
+
function calculateGasLimitMax(gasMax, rebuildTx, unpackTx, buildTx) {
|
|
6
|
+
return gasMax - +buildFee(rebuildTx(gasMax), unpackTx, buildTx).dividedBy(MIN_GAS_PRICE);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export default {
|
|
9
|
+
...shortUInt,
|
|
12
10
|
serialize(_value, _ref) {
|
|
13
11
|
let {
|
|
14
|
-
|
|
12
|
+
tag,
|
|
15
13
|
rebuildTx,
|
|
14
|
+
unpackTx,
|
|
15
|
+
buildTx,
|
|
16
16
|
gasMax = 6e6,
|
|
17
17
|
_computingGasLimit
|
|
18
18
|
} = _ref;
|
|
19
19
|
if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);
|
|
20
|
-
const gasLimitMax = calculateGasLimitMax(
|
|
21
|
-
_computingGasLimit: gasLimit
|
|
22
|
-
|
|
20
|
+
const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(gasMax, gasLimit => rebuildTx({
|
|
21
|
+
_computingGasLimit: gasLimit,
|
|
22
|
+
_pickBiggerFee: true
|
|
23
|
+
}), unpackTx, buildTx);
|
|
23
24
|
const value = _value !== null && _value !== void 0 ? _value : gasLimitMax;
|
|
24
|
-
|
|
25
25
|
if (value > gasLimitMax) {
|
|
26
26
|
throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
28
|
return shortUInt.serialize(value);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
};
|
|
33
31
|
//# sourceMappingURL=gas-limit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","shortUInt","buildFee","calculateGasLimitMax","
|
|
1
|
+
{"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","Tag","MAX_AUTH_FUN_GAS","shortUInt","buildFee","calculateGasLimitMax","gasMax","rebuildTx","unpackTx","buildTx","dividedBy","serialize","_value","tag","_computingGasLimit","gasLimitMax","GaMetaTx","gasLimit","_pickBiggerFee","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildFee } from './fee';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nfunction calculateGasLimitMax(\n gasMax: number,\n rebuildTx: (value: number) => any,\n unpackTx: typeof unpackTxType,\n buildTx: typeof buildTxType,\n): number {\n return gasMax - +buildFee(rebuildTx(gasMax), unpackTx, buildTx).dividedBy(MIN_GAS_PRICE);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n tag, rebuildTx, unpackTx, buildTx, gasMax = 6e6, _computingGasLimit,\n }: {\n tag: Tag;\n rebuildTx: (params: any) => any;\n unpackTx: typeof unpackTxType;\n buildTx: typeof buildTxType;\n gasMax: number;\n _computingGasLimit?: number;\n },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = tag === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit, _pickBiggerFee: true }),\n unpackTx,\n buildTx,\n );\n const value = _value ?? gasLimitMax;\n if (value > gasLimitMax) {\n throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);\n }\n return shortUInt.serialize(value);\n },\n};\n"],"mappings":"SAASA,oBAAoB;AAAA,SACpBC,aAAa,EAAEC,GAAG,EAAEC,gBAAgB;AAAA,OACtCC,SAAS;AAAA,SACPC,QAAQ;AAGjB,SAASC,oBAAoB,CAC3BC,MAAc,EACdC,SAAiC,EACjCC,QAA6B,EAC7BC,OAA2B,EACnB;EACR,OAAOH,MAAM,GAAG,CAACF,QAAQ,CAACG,SAAS,CAACD,MAAM,CAAC,EAAEE,QAAQ,EAAEC,OAAO,CAAC,CAACC,SAAS,CAACV,aAAa,CAAC;AAC1F;AAEA,eAAe;EACb,GAAGG,SAAS;EAEZQ,SAAS,CACPC,MAA0B,QAWlB;IAAA,IAVR;MACEC,GAAG;MAAEN,SAAS;MAAEC,QAAQ;MAAEC,OAAO;MAAEH,MAAM,GAAG,GAAG;MAAEQ;IAQnD,CAAC;IAED,IAAIA,kBAAkB,IAAI,IAAI,EAAE,OAAOX,SAAS,CAACQ,SAAS,CAACG,kBAAkB,CAAC;IAE9E,MAAMC,WAAW,GAAGF,GAAG,KAAKZ,GAAG,CAACe,QAAQ,GAAGd,gBAAgB,GAAGG,oBAAoB,CAChFC,MAAM,EACLW,QAAQ,IAAKV,SAAS,CAAC;MAAEO,kBAAkB,EAAEG,QAAQ;MAAEC,cAAc,EAAE;IAAK,CAAC,CAAC,EAC/EV,QAAQ,EACRC,OAAO,CACR;IACD,MAAMU,KAAK,GAAGP,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIG,WAAW;IACnC,IAAII,KAAK,GAAGJ,WAAW,EAAE;MACvB,MAAM,IAAIhB,oBAAoB,CAAE,aAAYoB,KAAM,6BAA4BJ,WAAY,EAAC,CAAC;IAC9F;IACA,OAAOZ,SAAS,CAACQ,SAAS,CAACQ,KAAK,CAAC;EACnC;AACF,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
declare const _default: {
|
|
3
3
|
serializeAettos(value?: string | undefined): string;
|
|
4
|
-
serialize
|
|
5
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
4
|
+
serialize(value: import("../constants").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
6
5
|
deserialize(value: Buffer): string;
|
|
7
6
|
};
|
|
8
7
|
export default _default;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import coinAmount from "./coin-amount.mjs";
|
|
2
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
3
|
import { MIN_GAS_PRICE } from "../constants.mjs";
|
|
4
|
-
export default {
|
|
5
|
-
|
|
4
|
+
export default {
|
|
5
|
+
...coinAmount,
|
|
6
6
|
serializeAettos() {
|
|
7
7
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_GAS_PRICE.toString();
|
|
8
|
-
|
|
9
8
|
if (+value < MIN_GAS_PRICE) {
|
|
10
9
|
throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
serialize: coinAmount.serializeOptional
|
|
12
|
+
}
|
|
17
13
|
};
|
|
18
14
|
//# sourceMappingURL=gas-price.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString"
|
|
1
|
+
{"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString"],"sources":["../../../../src/tx/builder/field-types/gas-price.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(value: string | undefined = MIN_GAS_PRICE.toString()): string {\n if (+value < MIN_GAS_PRICE) {\n throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);\n }\n return value;\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SACRC,oBAAoB;AAAA,SACpBC,aAAa;AAEtB,eAAe;EACb,GAAGF,UAAU;EAEbG,eAAe,GAA+D;IAAA,IAA9DC,KAAyB,uEAAGF,aAAa,CAACG,QAAQ,EAAE;IAClE,IAAI,CAACD,KAAK,GAAGF,aAAa,EAAE;MAC1B,MAAM,IAAID,oBAAoB,CAAE,aAAYG,KAAK,CAACC,QAAQ,EAAG,wBAAuBH,aAAc,EAAC,CAAC;IACtG;IACA,OAAOE,KAAK;EACd;AACF,CAAC"}
|
|
@@ -1,42 +1,64 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import _address from './address';
|
|
3
|
+
import _array from './array';
|
|
4
|
+
import _encoded from './encoded';
|
|
5
|
+
import _entry from './entry';
|
|
6
|
+
import _enumeration from './enumeration';
|
|
7
|
+
import _mptree from './mptree';
|
|
8
|
+
import _shortUIntConst from './short-u-int-const';
|
|
9
|
+
declare const abiVersion: {
|
|
10
|
+
serialize(value: import("../constants").AbiVersion | undefined, { tag, consensusProtocolVersion }: {
|
|
11
|
+
tag: import("../constants").Tag;
|
|
12
|
+
consensusProtocolVersion: import("../constants").ConsensusProtocolVersion;
|
|
13
|
+
}): Buffer;
|
|
14
|
+
deserialize(buffer: Buffer): import("../constants").AbiVersion;
|
|
9
15
|
};
|
|
10
|
-
declare const
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
declare const address: typeof _address;
|
|
17
|
+
declare const array: typeof _array;
|
|
18
|
+
declare const boolean: {
|
|
19
|
+
serialize(value: boolean): Buffer;
|
|
20
|
+
deserialize(buffer: Buffer): boolean;
|
|
13
21
|
};
|
|
14
22
|
declare const coinAmount: {
|
|
15
23
|
serializeAettos(value: string | undefined): string;
|
|
16
|
-
|
|
17
|
-
serialize(value: import("./u-int").Int, options: import("./coin-amount").Options): Buffer;
|
|
24
|
+
serialize(value: import("../constants").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
18
25
|
deserialize(value: Buffer): string;
|
|
19
26
|
};
|
|
27
|
+
declare const ctVersion: {
|
|
28
|
+
serialize(value: import("./ct-version").CtVersion | undefined, { consensusProtocolVersion }: {
|
|
29
|
+
consensusProtocolVersion: import("../constants").ConsensusProtocolVersion;
|
|
30
|
+
}): Buffer;
|
|
31
|
+
deserialize(buffer: Buffer): import("./ct-version").CtVersion;
|
|
32
|
+
};
|
|
20
33
|
declare const deposit: {
|
|
21
|
-
serialize(value: import("
|
|
34
|
+
serialize(value: import("../constants").Int | undefined, options: import("./coin-amount").Options): Buffer;
|
|
22
35
|
serializeAettos(value: string | undefined): string;
|
|
23
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
24
36
|
deserialize(value: Buffer): string;
|
|
25
37
|
};
|
|
38
|
+
declare const encoded: typeof _encoded;
|
|
39
|
+
declare const entry: typeof _entry;
|
|
40
|
+
declare const enumeration: typeof _enumeration;
|
|
26
41
|
declare const fee: {
|
|
27
|
-
serializeAettos(_value: string | undefined, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
serializeAettos(_value: string | undefined, { rebuildTx, unpackTx, buildTx, _computingMinFee, _pickBiggerFee, }: {
|
|
43
|
+
rebuildTx: (params: any) => `tx_${string}`;
|
|
44
|
+
unpackTx: typeof import("..").unpackTx;
|
|
45
|
+
buildTx: typeof import("..").buildTx;
|
|
46
|
+
_computingMinFee?: import("bignumber.js").BigNumber | undefined;
|
|
47
|
+
_pickBiggerFee?: boolean | undefined;
|
|
31
48
|
}): string;
|
|
32
|
-
serialize
|
|
33
|
-
|
|
49
|
+
serialize(value: import("../constants").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
50
|
+
deserialize(value: Buffer): string;
|
|
51
|
+
};
|
|
52
|
+
declare const field: {
|
|
53
|
+
serialize(value: string): Buffer;
|
|
34
54
|
deserialize(value: Buffer): string;
|
|
35
55
|
};
|
|
36
56
|
declare const gasLimit: {
|
|
37
|
-
serialize(_value: number | undefined, {
|
|
38
|
-
|
|
57
|
+
serialize(_value: number | undefined, { tag, rebuildTx, unpackTx, buildTx, gasMax, _computingGasLimit, }: {
|
|
58
|
+
tag: import("../constants").Tag;
|
|
39
59
|
rebuildTx: (params: any) => any;
|
|
60
|
+
unpackTx: typeof import("..").unpackTx;
|
|
61
|
+
buildTx: typeof import("..").buildTx;
|
|
40
62
|
gasMax: number;
|
|
41
63
|
_computingGasLimit?: number | undefined;
|
|
42
64
|
}): Buffer;
|
|
@@ -44,10 +66,10 @@ declare const gasLimit: {
|
|
|
44
66
|
};
|
|
45
67
|
declare const gasPrice: {
|
|
46
68
|
serializeAettos(value?: string | undefined): string;
|
|
47
|
-
serialize
|
|
48
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
69
|
+
serialize(value: import("../constants").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
49
70
|
deserialize(value: Buffer): string;
|
|
50
71
|
};
|
|
72
|
+
declare const mptree: typeof _mptree;
|
|
51
73
|
declare const name: {
|
|
52
74
|
serialize(value: `${string}.chain`): Buffer;
|
|
53
75
|
deserialize(value: Buffer): `${string}.chain`;
|
|
@@ -56,15 +78,43 @@ declare const nameFee: {
|
|
|
56
78
|
serializeAettos(_value: string | undefined, txFields: {
|
|
57
79
|
name: `${string}.chain`;
|
|
58
80
|
}): string;
|
|
59
|
-
serialize(value: import("
|
|
81
|
+
serialize(value: import("../constants").Int | undefined, txFields: {
|
|
60
82
|
name: `${string}.chain`;
|
|
61
83
|
} & import("./coin-amount").Options): Buffer;
|
|
62
|
-
serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
63
84
|
deserialize(value: Buffer): string;
|
|
64
85
|
};
|
|
65
86
|
declare const nameId: {
|
|
66
|
-
serialize(value:
|
|
67
|
-
deserialize(value: Buffer)
|
|
87
|
+
serialize(value: `${string}.chain` | `nm_${string}`): Buffer;
|
|
88
|
+
deserialize: (value: Buffer) => `nm_${string}`;
|
|
89
|
+
};
|
|
90
|
+
declare const pointers: {
|
|
91
|
+
serialize(pointers: (import("../../../apis/node").NamePointer & {
|
|
92
|
+
id: `ch_${string}` | `ct_${string}` | `ok_${string}` | `ak_${string}` | `cm_${string}` | `nm_${string}`;
|
|
93
|
+
})[]): Buffer[][];
|
|
94
|
+
deserialize(pointers: [key: Buffer, id: Buffer][]): (import("../../../apis/node").NamePointer & {
|
|
95
|
+
id: `ch_${string}` | `ct_${string}` | `ok_${string}` | `ak_${string}` | `cm_${string}` | `nm_${string}`;
|
|
96
|
+
})[];
|
|
97
|
+
};
|
|
98
|
+
declare const raw: {
|
|
99
|
+
serialize(buffer: Uint8Array): Buffer;
|
|
100
|
+
deserialize(buffer: Buffer): Buffer;
|
|
101
|
+
};
|
|
102
|
+
declare const shortUInt: {
|
|
103
|
+
serialize(value: number): Buffer;
|
|
104
|
+
deserialize(value: Buffer): number;
|
|
105
|
+
};
|
|
106
|
+
declare const shortUIntConst: typeof _shortUIntConst;
|
|
107
|
+
declare const string: {
|
|
108
|
+
serialize(string: string): Buffer;
|
|
109
|
+
deserialize(buffer: Buffer): string;
|
|
110
|
+
};
|
|
111
|
+
declare const uInt: {
|
|
112
|
+
serialize(value: import("../constants").Int): Buffer;
|
|
113
|
+
deserialize(value: Buffer): string;
|
|
68
114
|
};
|
|
69
|
-
export
|
|
70
|
-
export
|
|
115
|
+
export type BinaryData = Buffer | Buffer[] | Buffer[][] | Array<[Buffer, Array<[Buffer, Buffer[]]>]>;
|
|
116
|
+
export interface Field {
|
|
117
|
+
serialize: (value: any, options: any) => BinaryData;
|
|
118
|
+
deserialize: (value: BinaryData, options: any) => any;
|
|
119
|
+
}
|
|
120
|
+
export { abiVersion, address, array, boolean, coinAmount, ctVersion, deposit, encoded, entry, enumeration, fee, field, gasLimit, gasPrice, mptree, name, nameFee, nameId, pointers, raw, shortUInt, shortUIntConst, string, uInt, };
|