@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +12031 -11231
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -3
- package/es/AeSdk.mjs +17 -22
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +6 -5
- package/es/AeSdkAepp.mjs +7 -30
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +18 -140
- package/es/AeSdkBase.mjs +30 -184
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +123 -0
- package/es/AeSdkMethods.mjs +122 -0
- package/es/AeSdkMethods.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +7 -21
- package/es/AeSdkWallet.mjs +38 -86
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +11 -15
- package/es/Node.mjs +35 -48
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +24 -40
- package/es/account/Base.mjs +1 -101
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +16 -0
- package/es/account/Generalized.mjs +113 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +102 -0
- package/es/account/Ledger.mjs.map +1 -0
- package/es/account/LedgerFactory.d.ts +39 -0
- package/es/account/LedgerFactory.mjs +81 -0
- package/es/account/LedgerFactory.mjs.map +1 -0
- package/es/account/Memory.d.ts +13 -17
- package/es/account/Memory.mjs +43 -64
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -8
- package/es/account/Rpc.mjs +14 -32
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +4 -4
- package/es/aens.mjs +46 -41
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs +14 -68
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +23 -29
- package/es/apis/compiler/compiler.mjs +128 -189
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/index.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +82 -135
- package/es/apis/compiler/models/index.mjs +1 -47
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +8 -8
- package/es/apis/compiler/models/mappers.mjs +165 -183
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.d.ts +0 -1
- package/es/apis/compiler/models/parameters.mjs +5 -9
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/node/index.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +48 -48
- package/es/apis/node/models/mappers.mjs +12 -6
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +43 -84
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +10 -2
- package/es/chain.mjs +37 -59
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +200 -0
- package/es/channel/Base.mjs +293 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +248 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +219 -0
- package/es/channel/Spend.mjs +385 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +151 -899
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +101 -191
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +210 -0
- package/es/contract/Contract.mjs +551 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/compiler/Base.d.ts +81 -0
- package/es/contract/compiler/Base.mjs +5 -0
- package/es/contract/compiler/Base.mjs.map +1 -0
- package/es/contract/compiler/Cli.d.ts +23 -0
- package/es/contract/compiler/Cli.mjs +155 -0
- package/es/contract/compiler/Cli.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +32 -0
- package/es/contract/compiler/Http.mjs +118 -0
- package/es/contract/compiler/Http.mjs.map +1 -0
- package/es/contract/compiler/HttpNode.d.ts +17 -0
- package/es/contract/compiler/HttpNode.mjs +26 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -0
- package/es/contract/compiler/getFileSystem.d.ts +6 -0
- package/es/contract/compiler/getFileSystem.mjs +40 -0
- package/es/contract/compiler/getFileSystem.mjs.map +1 -0
- package/es/contract/ga.d.ts +9 -34
- package/es/contract/ga.mjs +29 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +39 -0
- package/es/index-browser.mjs +55 -0
- package/es/index-browser.mjs.map +1 -0
- package/es/index.d.ts +4 -35
- package/es/index.mjs +4 -51
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +34 -40
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +18 -23
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +30 -2
- package/es/tx/builder/constants.mjs +43 -14
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +10 -0
- package/es/tx/builder/field-types/abi-version.mjs +20 -0
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
- package/es/tx/builder/field-types/address.d.ts +14 -0
- package/es/tx/builder/field-types/address.mjs +51 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/array.d.ts +7 -0
- package/es/tx/builder/field-types/array.mjs +11 -0
- package/es/tx/builder/field-types/array.mjs.map +1 -0
- package/es/tx/builder/field-types/boolean.d.ts +6 -0
- package/es/tx/builder/field-types/boolean.mjs +13 -0
- package/es/tx/builder/field-types/boolean.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
- package/es/tx/builder/field-types/coin-amount.mjs +4 -12
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +30 -0
- package/es/tx/builder/field-types/ct-version.mjs +48 -0
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +1 -2
- package/es/tx/builder/field-types/deposit.mjs +2 -4
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +6 -0
- package/es/tx/builder/field-types/encoded.mjs +21 -0
- package/es/tx/builder/field-types/encoded.mjs.map +1 -0
- package/es/tx/builder/field-types/entry.d.ts +11 -0
- package/es/tx/builder/field-types/entry.mjs +31 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -0
- package/es/tx/builder/field-types/enumeration.d.ts +7 -0
- package/es/tx/builder/field-types/enumeration.mjs +30 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +10 -15
- package/es/tx/builder/field-types/fee.mjs +31 -43
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs +0 -2
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/es/tx/builder/field-types/gas-limit.mjs +12 -14
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -2
- package/es/tx/builder/field-types/gas-price.mjs +3 -7
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +80 -30
- package/es/tx/builder/field-types/index.mjs +34 -9
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.d.ts +37 -0
- package/es/tx/builder/field-types/mptree.mjs +268 -0
- package/es/tx/builder/field-types/mptree.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +1 -3
- package/es/tx/builder/field-types/name-fee.mjs +3 -5
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.d.ts +1 -4
- package/es/tx/builder/field-types/name-id.mjs +5 -10
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs +0 -2
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.d.ts +23 -0
- package/es/tx/builder/field-types/pointers.mjs +36 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -0
- package/es/tx/builder/field-types/raw.d.ts +6 -0
- package/es/tx/builder/field-types/raw.mjs +13 -0
- package/es/tx/builder/field-types/raw.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.mjs +0 -2
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.d.ts +6 -0
- package/es/tx/builder/field-types/string.mjs +10 -0
- package/es/tx/builder/field-types/string.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +1 -2
- package/es/tx/builder/field-types/u-int.mjs +3 -4
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -32
- package/es/tx/builder/helpers.mjs +19 -71
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +11 -49
- package/es/tx/builder/index.mjs +57 -337
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2367 -667
- package/es/tx/builder/schema.mjs +70 -145
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +4 -49
- package/es/tx/index.mjs +38 -112
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -6
- package/es/tx/validator.mjs +104 -90
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +4 -10
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +1 -0
- package/es/utils/autorest.mjs +17 -19
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +4 -7
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.d.ts +0 -17
- package/es/utils/bytes.mjs +6 -35
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +15 -8
- package/es/utils/crypto.mjs +40 -40
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +28 -28
- package/es/utils/encoder-types.mjs +0 -1
- package/es/utils/encoder-types.mjs.map +1 -1
- package/es/utils/encoder.d.ts +0 -1
- package/es/utils/encoder.mjs +7 -15
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +15 -14
- package/es/utils/errors.mjs +86 -172
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +27 -19
- package/es/utils/hd-wallet.mjs +42 -26
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +0 -8
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +2 -0
- package/es/utils/keystore.mjs +37 -36
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +4 -2
- package/es/utils/other.mjs +11 -7
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs +0 -3
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +0 -12
- package/es/utils/string.mjs +1 -21
- package/es/utils/string.mjs.map +1 -1
- package/package.json +98 -51
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +31 -202
- package/src/AeSdkMethods.ts +169 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +17 -18
- package/src/account/Base.ts +29 -75
- package/src/account/Generalized.ts +98 -0
- package/src/account/Ledger.ts +131 -0
- package/src/account/LedgerFactory.ts +86 -0
- package/src/account/Memory.ts +46 -60
- package/src/account/Rpc.ts +17 -26
- package/src/aens.ts +13 -11
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
- package/src/aepp-wallet-communication/rpc/types.ts +11 -1
- package/src/aepp-wallet-communication/schema.ts +18 -18
- package/src/apis/compiler/code-model-v4.yaml +681 -888
- package/src/apis/compiler/compiler.ts +113 -154
- package/src/apis/compiler/models/index.ts +80 -140
- package/src/apis/compiler/models/mappers.ts +165 -183
- package/src/apis/compiler/models/parameters.ts +6 -12
- package/src/chain.ts +11 -6
- package/src/channel/Base.ts +335 -0
- package/src/channel/Contract.ts +488 -0
- package/src/channel/Spend.ts +408 -0
- package/src/channel/handlers.ts +164 -582
- package/src/channel/internal.ts +114 -143
- package/src/contract/Contract.ts +610 -0
- package/src/contract/compiler/Base.ts +94 -0
- package/src/contract/compiler/Cli.ts +134 -0
- package/src/contract/compiler/Http.ts +124 -0
- package/src/contract/compiler/HttpNode.ts +26 -0
- package/src/contract/compiler/getFileSystem.ts +42 -0
- package/src/contract/ga.ts +23 -106
- package/src/index-browser.ts +58 -0
- package/src/index.ts +4 -55
- package/src/oracle.ts +8 -8
- package/src/spend.ts +6 -14
- package/src/tx/builder/constants.ts +33 -3
- package/src/tx/builder/field-types/abi-version.ts +21 -0
- package/src/tx/builder/field-types/address.ts +62 -0
- package/src/tx/builder/field-types/array.ts +19 -0
- package/src/tx/builder/field-types/boolean.ts +9 -0
- package/src/tx/builder/field-types/coin-amount.ts +4 -9
- package/src/tx/builder/field-types/ct-version.ts +50 -0
- package/src/tx/builder/field-types/deposit.ts +1 -1
- package/src/tx/builder/field-types/encoded.ts +27 -0
- package/src/tx/builder/field-types/entry.ts +31 -0
- package/src/tx/builder/field-types/enumeration.ts +32 -0
- package/src/tx/builder/field-types/fee.ts +39 -21
- package/src/tx/builder/field-types/gas-limit.ts +13 -8
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +54 -15
- package/src/tx/builder/field-types/mptree.ts +242 -0
- package/src/tx/builder/field-types/name-fee.ts +2 -3
- package/src/tx/builder/field-types/name-id.ts +7 -10
- package/src/tx/builder/field-types/pointers.ts +41 -0
- package/src/tx/builder/field-types/raw.ts +9 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
- package/src/tx/builder/field-types/string.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +4 -5
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +65 -308
- package/src/tx/builder/schema.ts +280 -341
- package/src/tx/index.ts +40 -103
- package/src/tx/validator.ts +91 -96
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +6 -34
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +22 -25
- package/src/utils/hd-wallet.ts +30 -9
- package/src/utils/keystore.ts +24 -21
- package/src/utils/other.ts +16 -1
- package/src/utils/string.ts +0 -20
- package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.2/Node.d.ts +78 -0
- package/types-legacy/ts4.2/account/Base.d.ts +52 -0
- package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.2/aens.d.ts +222 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.2/chain.d.ts +256 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index-browser.d.ts +39 -0
- package/types-legacy/ts4.2/index.d.ts +5 -0
- package/types-legacy/ts4.2/oracle.d.ts +161 -0
- package/types-legacy/ts4.2/spend.d.ts +62 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.2/tx/index.d.ts +19 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.2/utils/other.d.ts +31 -0
- package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.2/utils/string.d.ts +12 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.5/Node.d.ts +78 -0
- package/types-legacy/ts4.5/account/Base.d.ts +52 -0
- package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.5/aens.d.ts +222 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.5/chain.d.ts +256 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.5/index-browser.d.ts +39 -0
- package/types-legacy/ts4.5/index.d.ts +4 -0
- package/types-legacy/ts4.5/oracle.d.ts +161 -0
- package/types-legacy/ts4.5/spend.d.ts +62 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.5/tx/index.d.ts +19 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.5/utils/other.d.ts +31 -0
- package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.5/utils/string.d.ts +12 -0
- package/es/channel/index.d.ts +0 -625
- package/es/channel/index.mjs +0 -975
- package/es/channel/index.mjs.map +0 -1
- package/es/contract/Compiler.d.ts +0 -18
- package/es/contract/Compiler.mjs +0 -68
- package/es/contract/Compiler.mjs.map +0 -1
- package/es/contract/aci.d.ts +0 -127
- package/es/contract/aci.mjs +0 -508
- package/es/contract/aci.mjs.map +0 -1
- package/es/contract/methods.d.ts +0 -71
- package/es/contract/methods.mjs +0 -104
- package/es/contract/methods.mjs.map +0 -1
- package/es/deprecated/index.d.ts +0 -143
- package/es/deprecated/index.mjs +0 -162
- package/es/deprecated/index.mjs.map +0 -1
- package/es/deprecated/methods.d.ts +0 -18
- package/es/deprecated/methods.mjs +0 -26
- package/es/deprecated/methods.mjs.map +0 -1
- package/es/tx/builder/address.d.ts +0 -25
- package/es/tx/builder/address.mjs +0 -45
- package/es/tx/builder/address.mjs.map +0 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
- package/es/utils/mptree.d.ts +0 -26
- package/es/utils/mptree.mjs +0 -165
- package/es/utils/mptree.mjs.map +0 -1
- package/src/channel/index.ts +0 -1025
- package/src/contract/Compiler.ts +0 -67
- package/src/contract/aci.ts +0 -537
- package/src/contract/methods.ts +0 -123
- package/src/deprecated/index.ts +0 -172
- package/src/deprecated/methods.ts +0 -25
- package/src/tx/builder/address.ts +0 -50
- package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
- package/src/utils/mptree.ts +0 -145
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { mapObject } from "../../utils/other.mjs";
|
|
3
|
-
|
|
4
|
-
export const NAME_TTL = 180000;
|
|
2
|
+
import { mapObject } from "../../utils/other.mjs";
|
|
3
|
+
export const MAX_AUTH_FUN_GAS = 50000;
|
|
4
|
+
export const NAME_TTL = 180000;
|
|
5
|
+
// # max number of block into the future that the name is going to be available
|
|
5
6
|
// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update
|
|
6
7
|
// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry
|
|
7
|
-
|
|
8
8
|
export const NAME_MAX_TTL = 36000;
|
|
9
9
|
export const NAME_MAX_CLIENT_TTL = 84600;
|
|
10
10
|
export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
|
|
11
|
-
export const MIN_GAS_PRICE = 1e9;
|
|
12
|
-
|
|
11
|
+
export const MIN_GAS_PRICE = 1e9;
|
|
12
|
+
// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
|
|
13
13
|
export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
|
|
14
|
-
|
|
15
14
|
export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
|
|
16
15
|
// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272
|
|
17
|
-
|
|
18
16
|
export const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day
|
|
19
17
|
// # this is the max length for a domain that requires a base fee to be paid
|
|
20
|
-
|
|
21
18
|
export const NAME_MAX_LENGTH_FEE = 31;
|
|
22
19
|
export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
|
|
23
20
|
// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
|
|
24
21
|
// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
|
|
25
22
|
// # bid ranges:
|
|
26
|
-
|
|
27
23
|
export const NAME_BID_RANGES = mapObject({
|
|
28
24
|
31: 3,
|
|
29
25
|
30: 5,
|
|
@@ -60,6 +56,32 @@ export const NAME_BID_RANGES = mapObject({
|
|
|
60
56
|
let [key, value] = _ref;
|
|
61
57
|
return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
|
|
62
58
|
});
|
|
59
|
+
export let ConsensusProtocolVersion;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @category transaction builder
|
|
63
|
+
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
64
|
+
*/
|
|
65
|
+
(function (ConsensusProtocolVersion) {
|
|
66
|
+
ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
|
|
67
|
+
})(ConsensusProtocolVersion || (ConsensusProtocolVersion = {}));
|
|
68
|
+
export let VmVersion;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @category transaction builder
|
|
72
|
+
* @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
|
|
73
|
+
*/
|
|
74
|
+
(function (VmVersion) {
|
|
75
|
+
VmVersion[VmVersion["NoVm"] = 0] = "NoVm";
|
|
76
|
+
VmVersion[VmVersion["Sophia"] = 1] = "Sophia";
|
|
77
|
+
VmVersion[VmVersion["SophiaImprovementsMinerva"] = 3] = "SophiaImprovementsMinerva";
|
|
78
|
+
VmVersion[VmVersion["SophiaImprovementsFortuna"] = 4] = "SophiaImprovementsFortuna";
|
|
79
|
+
VmVersion[VmVersion["Fate"] = 5] = "Fate";
|
|
80
|
+
VmVersion[VmVersion["SophiaImprovementsLima"] = 6] = "SophiaImprovementsLima";
|
|
81
|
+
VmVersion[VmVersion["Fate2"] = 7] = "Fate2";
|
|
82
|
+
})(VmVersion || (VmVersion = {}));
|
|
83
|
+
export let AbiVersion;
|
|
84
|
+
|
|
63
85
|
/**
|
|
64
86
|
* Enum with tag types
|
|
65
87
|
* @category transaction builder
|
|
@@ -67,17 +89,25 @@ export const NAME_BID_RANGES = mapObject({
|
|
|
67
89
|
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}
|
|
68
90
|
*/
|
|
69
91
|
// TODO: implement serialisation for commented-out tags
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
(function (AbiVersion) {
|
|
93
|
+
AbiVersion[AbiVersion["NoAbi"] = 0] = "NoAbi";
|
|
94
|
+
AbiVersion[AbiVersion["Sophia"] = 1] = "Sophia";
|
|
95
|
+
AbiVersion[AbiVersion["Fate"] = 3] = "Fate";
|
|
96
|
+
})(AbiVersion || (AbiVersion = {}));
|
|
97
|
+
export let Tag; // KeyBlock = 100,
|
|
98
|
+
// MicroBlock = 101,
|
|
99
|
+
// LightMicroBlock = 102,
|
|
100
|
+
// Pof = 200,
|
|
73
101
|
(function (Tag) {
|
|
74
102
|
Tag[Tag["Account"] = 10] = "Account";
|
|
75
103
|
Tag[Tag["SignedTx"] = 11] = "SignedTx";
|
|
76
104
|
Tag[Tag["SpendTx"] = 12] = "SpendTx";
|
|
105
|
+
Tag[Tag["Oracle"] = 20] = "Oracle";
|
|
77
106
|
Tag[Tag["OracleRegisterTx"] = 22] = "OracleRegisterTx";
|
|
78
107
|
Tag[Tag["OracleQueryTx"] = 23] = "OracleQueryTx";
|
|
79
108
|
Tag[Tag["OracleResponseTx"] = 24] = "OracleResponseTx";
|
|
80
109
|
Tag[Tag["OracleExtendTx"] = 25] = "OracleExtendTx";
|
|
110
|
+
Tag[Tag["Name"] = 30] = "Name";
|
|
81
111
|
Tag[Tag["NameClaimTx"] = 32] = "NameClaimTx";
|
|
82
112
|
Tag[Tag["NamePreclaimTx"] = 33] = "NamePreclaimTx";
|
|
83
113
|
Tag[Tag["NameUpdateTx"] = 34] = "NameUpdateTx";
|
|
@@ -114,7 +144,6 @@ export let Tag;
|
|
|
114
144
|
Tag[Tag["NameserviceMtree"] = 624] = "NameserviceMtree";
|
|
115
145
|
Tag[Tag["OraclesMtree"] = 625] = "OraclesMtree";
|
|
116
146
|
Tag[Tag["AccountsMtree"] = 626] = "AccountsMtree";
|
|
117
|
-
Tag[Tag["CompilerSophia"] = 70] = "CompilerSophia";
|
|
118
147
|
Tag[Tag["GaAttachTx"] = 80] = "GaAttachTx";
|
|
119
148
|
Tag[Tag["GaMetaTx"] = 81] = "GaMetaTx";
|
|
120
149
|
Tag[Tag["PayingForTx"] = 82] = "PayingForTx";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n // CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,gBAAgB,GAAG,KAAK;AAIrC,OAAO,MAAMC,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,KAAK;AACjC,OAAO,MAAMC,mBAAmB,GAAG,KAAK;AACxC,OAAO,MAAMC,UAAU,GAAGD,mBAAmB;AAC7C,OAAO,MAAME,aAAa,GAAG,GAAG;AAChC;AACA,OAAO,MAAMC,mBAAmB,GAAG,IAAI,CAAC,CAAC;AACzC,OAAO,MAAMC,sBAAsB,GAAG,IAAI,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAAE;AACrC,OAAO,MAAMC,mBAAmB,GAAG,EAAE,CAAC,CAAC;AACvC;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGZ,SAAS,CAAC;EACvC,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,KAAK;EACT,CAAC,EAAE,MAAM;EACT,CAAC,EAAE,MAAM;EACT,CAAC,EAAE,MAAM;EACT,CAAC,EAAE,MAAM;EACT,CAAC,EAAE,MAAM;EACT,CAAC,EAAE,OAAO;EACV,CAAC,EAAE,OAAO;EACV,CAAC,EAAE,OAAO;EACV,CAAC,EAAE;AACL,CAAC,EAAE;EAAA,IAAC,CAACa,GAAG,EAAEC,KAAK,CAAC;EAAA,OAAK,CAACD,GAAG,EAAE,IAAId,SAAS,CAACe,KAAK,CAAC,CAACC,KAAK,CAACR,mBAAmB,CAAC,CAAC;AAAA,EAAC;AAE5E,WAAYS,wBAAwB;;AAIpC;AACA;AACA;AACA;AAHA,WAJYA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;AAAA,GAAxBA,wBAAwB,KAAxBA,wBAAwB;AAQpC,WAAYC,SAAS;;AAUrB;AACA;AACA;AACA;AAHA,WAVYA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;AAAA,GAATA,SAAS,KAATA,SAAS;AAcrB,WAAYC,UAAU;;AAMtB;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,WAZYA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;AAAA,GAAVA,UAAU,KAAVA,UAAU;AAatB,WAAYC,GAAG,EAwDb;AACA;AACA;AACA;AACD,WA5DWA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;AAAA,GAAHA,GAAG,KAAHA,GAAG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Tag, ConsensusProtocolVersion, AbiVersion } from '../constants';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
serialize(value: AbiVersion | undefined, { tag, consensusProtocolVersion }: {
|
|
5
|
+
tag: Tag;
|
|
6
|
+
consensusProtocolVersion: ConsensusProtocolVersion;
|
|
7
|
+
}): Buffer;
|
|
8
|
+
deserialize(buffer: Buffer): AbiVersion;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { Tag, ConsensusProtocolVersion } from "../constants.mjs";
|
|
6
|
+
import { getProtocolDetails } from "./ct-version.mjs";
|
|
7
|
+
export default {
|
|
8
|
+
serialize(value, _ref) {
|
|
9
|
+
let {
|
|
10
|
+
tag,
|
|
11
|
+
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
12
|
+
} = _ref;
|
|
13
|
+
const result = value !== null && value !== void 0 ? value : getProtocolDetails(consensusProtocolVersion, Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call').abiVersion;
|
|
14
|
+
return _Buffer.from([result]);
|
|
15
|
+
},
|
|
16
|
+
deserialize(buffer) {
|
|
17
|
+
return buffer[0];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=abi-version.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi-version.mjs","names":["Tag","ConsensusProtocolVersion","getProtocolDetails","serialize","value","tag","consensusProtocolVersion","Iris","result","ContractCallTx","GaMetaTx","abiVersion","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/abi-version.ts"],"sourcesContent":["import { Tag, ConsensusProtocolVersion, AbiVersion } from '../constants';\nimport { getProtocolDetails } from './ct-version';\n\nexport default {\n serialize(\n value: AbiVersion | undefined,\n { tag, consensusProtocolVersion = ConsensusProtocolVersion.Iris }:\n { tag: Tag; consensusProtocolVersion: ConsensusProtocolVersion },\n ): Buffer {\n const result = value ?? getProtocolDetails(\n consensusProtocolVersion,\n Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call',\n ).abiVersion;\n\n return Buffer.from([result]);\n },\n\n deserialize(buffer: Buffer): AbiVersion {\n return buffer[0];\n },\n};\n"],"mappings":";;;;SAASA,GAAG,EAAEC,wBAAwB;AAAA,SAC7BC,kBAAkB;AAE3B,eAAe;EACbC,SAAS,CACPC,KAA6B,QAGrB;IAAA,IAFR;MAAEC,GAAG;MAAEC,wBAAwB,GAAGL,wBAAwB,CAACM;IACI,CAAC;IAEhE,MAAMC,MAAM,GAAGJ,KAAK,aAALA,KAAK,cAALA,KAAK,GAAIF,kBAAkB,CACxCI,wBAAwB,EACxBN,GAAG,CAACS,cAAc,KAAKJ,GAAG,IAAIL,GAAG,CAACU,QAAQ,KAAKL,GAAG,GAAG,eAAe,GAAG,aAAa,CACrF,CAACM,UAAU;IAEZ,OAAO,QAAOC,IAAI,CAAC,CAACJ,MAAM,CAAC,CAAC;EAC9B,CAAC;EAEDK,WAAW,CAACC,MAAc,EAAc;IACtC,OAAOA,MAAM,CAAC,CAAC,CAAC;EAClB;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Encoded } from '../../../utils/encoder';
|
|
3
|
+
/**
|
|
4
|
+
* Map of prefix to ID tag constant
|
|
5
|
+
* @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
|
|
6
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
|
|
7
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
|
|
8
|
+
*/
|
|
9
|
+
export declare const idTagToEncoding: readonly [Encoded.Encoding.AccountAddress, Encoded.Encoding.Name, Encoded.Encoding.Commitment, Encoded.Encoding.OracleAddress, Encoded.Encoding.ContractAddress, Encoded.Encoding.Channel];
|
|
10
|
+
export type AddressEncodings = typeof idTagToEncoding[number];
|
|
11
|
+
export default function genAddressField<Encoding extends AddressEncodings>(...encodings: Encoding[]): {
|
|
12
|
+
serialize: (value: Encoded.Generic<Encoding>) => Buffer;
|
|
13
|
+
deserialize: (value: Buffer) => Encoded.Generic<Encoding>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from "../../../utils/errors.mjs";
|
|
6
|
+
import { toBytes } from "../../../utils/bytes.mjs";
|
|
7
|
+
import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
|
|
8
|
+
import { isItemOfArray } from "../../../utils/other.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Map of prefix to ID tag constant
|
|
11
|
+
* @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
|
|
12
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
|
|
13
|
+
* @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
|
|
14
|
+
*/
|
|
15
|
+
export const idTagToEncoding = [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
|
|
16
|
+
export default function genAddressField() {
|
|
17
|
+
for (var _len = arguments.length, encodings = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
encodings[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
/**
|
|
22
|
+
* Utility function to create and _id type
|
|
23
|
+
* @param hashId - Encoded hash
|
|
24
|
+
* @returns Buffer Buffer with ID tag and decoded HASh
|
|
25
|
+
*/
|
|
26
|
+
serialize(hashId) {
|
|
27
|
+
const enc = hashId.slice(0, 2);
|
|
28
|
+
if (!isItemOfArray(enc, idTagToEncoding)) throw new TagNotFoundError(enc);
|
|
29
|
+
if (!isItemOfArray(enc, encodings)) {
|
|
30
|
+
throw new ArgumentError('Address encoding', encodings.join(', '), enc);
|
|
31
|
+
}
|
|
32
|
+
const idTag = idTagToEncoding.indexOf(enc) + 1;
|
|
33
|
+
return _Buffer.from([...toBytes(idTag), ...decode(hashId)]);
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Utility function to read and _id type
|
|
37
|
+
* @param buf - Data
|
|
38
|
+
* @returns Encoded hash string with prefix
|
|
39
|
+
*/
|
|
40
|
+
deserialize(buf) {
|
|
41
|
+
const idTag = _Buffer.from(buf).readUIntBE(0, 1);
|
|
42
|
+
const enc = idTagToEncoding[idTag - 1];
|
|
43
|
+
if (enc == null) throw new PrefixNotFoundError(idTag);
|
|
44
|
+
if (!isItemOfArray(enc, encodings)) {
|
|
45
|
+
throw new ArgumentError('Address encoding', encodings.join(', '), enc);
|
|
46
|
+
}
|
|
47
|
+
return encode(buf.subarray(1), enc);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=address.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.mjs","names":["ArgumentError","PrefixNotFoundError","TagNotFoundError","toBytes","decode","encode","Encoding","isItemOfArray","idTagToEncoding","AccountAddress","Name","Commitment","OracleAddress","ContractAddress","Channel","genAddressField","encodings","serialize","hashId","enc","slice","join","idTag","indexOf","from","deserialize","buf","readUIntBE","subarray"],"sources":["../../../../src/tx/builder/field-types/address.ts"],"sourcesContent":["import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { isItemOfArray } from '../../../utils/other';\n\n/**\n * Map of prefix to ID tag constant\n * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}\n */\nexport const idTagToEncoding = [\n Encoding.AccountAddress,\n Encoding.Name,\n Encoding.Commitment,\n Encoding.OracleAddress,\n Encoding.ContractAddress,\n Encoding.Channel,\n] as const;\n\nexport type AddressEncodings = typeof idTagToEncoding[number];\n\nexport default function genAddressField<Encoding extends AddressEncodings>(\n ...encodings: Encoding[]\n): {\n serialize: (value: Encoded.Generic<Encoding>) => Buffer;\n deserialize: (value: Buffer) => Encoded.Generic<Encoding>;\n } {\n return {\n /**\n * Utility function to create and _id type\n * @param hashId - Encoded hash\n * @returns Buffer Buffer with ID tag and decoded HASh\n */\n serialize(hashId) {\n const enc = hashId.slice(0, 2);\n if (!isItemOfArray(enc, idTagToEncoding)) throw new TagNotFoundError(enc);\n if (!isItemOfArray(enc, encodings)) {\n throw new ArgumentError('Address encoding', encodings.join(', '), enc);\n }\n const idTag = idTagToEncoding.indexOf(enc) + 1;\n return Buffer.from([...toBytes(idTag), ...decode(hashId)]);\n },\n\n /**\n * Utility function to read and _id type\n * @param buf - Data\n * @returns Encoded hash string with prefix\n */\n deserialize(buf) {\n const idTag = Buffer.from(buf).readUIntBE(0, 1);\n const enc = idTagToEncoding[idTag - 1];\n if (enc == null) throw new PrefixNotFoundError(idTag);\n if (!isItemOfArray(enc, encodings)) {\n throw new ArgumentError('Address encoding', encodings.join(', '), enc);\n }\n return encode(buf.subarray(1), enc) as Encoded.Generic<Encoding>;\n },\n };\n}\n"],"mappings":";;;;SAASA,aAAa,EAAEC,mBAAmB,EAAEC,gBAAgB;AAAA,SACpDC,OAAO;AAAA,SAEdC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG,CAC7BF,QAAQ,CAACG,cAAc,EACvBH,QAAQ,CAACI,IAAI,EACbJ,QAAQ,CAACK,UAAU,EACnBL,QAAQ,CAACM,aAAa,EACtBN,QAAQ,CAACO,eAAe,EACxBP,QAAQ,CAACQ,OAAO,CACR;AAIV,eAAe,SAASC,eAAe,GAKnC;EAAA,kCAJCC,SAAS;IAATA,SAAS;EAAA;EAKZ,OAAO;IACL;AACJ;AACA;AACA;AACA;IACIC,SAAS,CAACC,MAAM,EAAE;MAChB,MAAMC,GAAG,GAAGD,MAAM,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;MAC9B,IAAI,CAACb,aAAa,CAACY,GAAG,EAAEX,eAAe,CAAC,EAAE,MAAM,IAAIN,gBAAgB,CAACiB,GAAG,CAAC;MACzE,IAAI,CAACZ,aAAa,CAACY,GAAG,EAAEH,SAAS,CAAC,EAAE;QAClC,MAAM,IAAIhB,aAAa,CAAC,kBAAkB,EAAEgB,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC,EAAEF,GAAG,CAAC;MACxE;MACA,MAAMG,KAAK,GAAGd,eAAe,CAACe,OAAO,CAACJ,GAAG,CAAC,GAAG,CAAC;MAC9C,OAAO,QAAOK,IAAI,CAAC,CAAC,GAAGrB,OAAO,CAACmB,KAAK,CAAC,EAAE,GAAGlB,MAAM,CAACc,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIO,WAAW,CAACC,GAAG,EAAE;MACf,MAAMJ,KAAK,GAAG,QAAOE,IAAI,CAACE,GAAG,CAAC,CAACC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;MAC/C,MAAMR,GAAG,GAAGX,eAAe,CAACc,KAAK,GAAG,CAAC,CAAC;MACtC,IAAIH,GAAG,IAAI,IAAI,EAAE,MAAM,IAAIlB,mBAAmB,CAACqB,KAAK,CAAC;MACrD,IAAI,CAACf,aAAa,CAACY,GAAG,EAAEH,SAAS,CAAC,EAAE;QAClC,MAAM,IAAIhB,aAAa,CAAC,kBAAkB,EAAEgB,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC,EAAEF,GAAG,CAAC;MACxE;MACA,OAAOd,MAAM,CAACqB,GAAG,CAACE,QAAQ,CAAC,CAAC,CAAC,EAAET,GAAG,CAAC;IACrC;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function genArrayField<Input, Output, Binary>(itemHandler: {
|
|
2
|
+
serialize: (value: Input, params: unknown) => Binary;
|
|
3
|
+
deserialize: (value: Binary, params: unknown) => Output;
|
|
4
|
+
}): {
|
|
5
|
+
serialize: (value: Input[], params: unknown) => Binary[];
|
|
6
|
+
deserialize: (value: Binary[], params: unknown) => Output[];
|
|
7
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function genArrayField(itemHandler) {
|
|
2
|
+
return {
|
|
3
|
+
serialize(items, params) {
|
|
4
|
+
return items.map(item => itemHandler.serialize(item, params));
|
|
5
|
+
},
|
|
6
|
+
deserialize(buffers, params) {
|
|
7
|
+
return buffers.map(buffer => itemHandler.deserialize(buffer, params));
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=array.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.mjs","names":["genArrayField","itemHandler","serialize","items","params","map","item","deserialize","buffers","buffer"],"sources":["../../../../src/tx/builder/field-types/array.ts"],"sourcesContent":["export default function genArrayField<Input, Output, Binary>(\n itemHandler: {\n serialize: (value: Input, params: unknown) => Binary;\n deserialize: (value: Binary, params: unknown) => Output;\n },\n): {\n serialize: (value: Input[], params: unknown) => Binary[];\n deserialize: (value: Binary[], params: unknown) => Output[];\n } {\n return {\n serialize(items, params) {\n return items.map((item) => itemHandler.serialize(item, params));\n },\n\n deserialize(buffers, params) {\n return buffers.map((buffer) => itemHandler.deserialize(buffer, params));\n },\n };\n}\n"],"mappings":"AAAA,eAAe,SAASA,aAAa,CACnCC,WAGC,EAIC;EACF,OAAO;IACLC,SAAS,CAACC,KAAK,EAAEC,MAAM,EAAE;MACvB,OAAOD,KAAK,CAACE,GAAG,CAAEC,IAAI,IAAKL,WAAW,CAACC,SAAS,CAACI,IAAI,EAAEF,MAAM,CAAC,CAAC;IACjE,CAAC;IAEDG,WAAW,CAACC,OAAO,EAAEJ,MAAM,EAAE;MAC3B,OAAOI,OAAO,CAACH,GAAG,CAAEI,MAAM,IAAKR,WAAW,CAACM,WAAW,CAACE,MAAM,EAAEL,MAAM,CAAC,CAAC;IACzE;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
export default {
|
|
6
|
+
serialize(value) {
|
|
7
|
+
return _Buffer.from([value ? 1 : 0]);
|
|
8
|
+
},
|
|
9
|
+
deserialize(buffer) {
|
|
10
|
+
return buffer[0] === 1;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=boolean.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.mjs","names":["serialize","value","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/boolean.ts"],"sourcesContent":["export default {\n serialize(value: boolean): Buffer {\n return Buffer.from([value ? 1 : 0]);\n },\n\n deserialize(buffer: Buffer): boolean {\n return buffer[0] === 1;\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAc,EAAU;IAChC,OAAO,QAAOC,IAAI,CAAC,CAACD,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;EACrC,CAAC;EAEDE,WAAW,CAACC,MAAc,EAAW;IACnC,OAAOA,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;EACxB;AACF,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Int } from '
|
|
2
|
+
import { Int } from '../constants';
|
|
3
3
|
import { AE_AMOUNT_FORMATS } from '../../../utils/amount-formatter';
|
|
4
4
|
export interface Options {
|
|
5
5
|
denomination?: AE_AMOUNT_FORMATS;
|
|
6
6
|
}
|
|
7
7
|
declare const _default: {
|
|
8
8
|
serializeAettos(value: string | undefined): string;
|
|
9
|
-
|
|
10
|
-
serialize(value: Int, options: Options): Buffer;
|
|
9
|
+
serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer;
|
|
11
10
|
deserialize(value: Buffer): string;
|
|
12
11
|
};
|
|
13
12
|
export default _default;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import uInt from "./u-int.mjs";
|
|
2
2
|
import { formatAmount } from "../../../utils/amount-formatter.mjs";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export default {
|
|
4
|
+
...uInt,
|
|
6
5
|
serializeAettos(value) {
|
|
7
|
-
|
|
8
|
-
return value;
|
|
6
|
+
return value !== null && value !== void 0 ? value : '0';
|
|
9
7
|
},
|
|
10
|
-
|
|
11
|
-
serializeOptional(value, _ref) {
|
|
8
|
+
serialize(value, _ref) {
|
|
12
9
|
let {
|
|
13
10
|
denomination,
|
|
14
11
|
...options
|
|
@@ -16,11 +13,6 @@ export default { ...uInt,
|
|
|
16
13
|
return uInt.serialize(this.serializeAettos(value != null ? formatAmount(value, {
|
|
17
14
|
denomination
|
|
18
15
|
}) : value, options));
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
serialize(value, options) {
|
|
22
|
-
return this.serializeOptional(value, options);
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
};
|
|
26
18
|
//# sourceMappingURL=coin-amount.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","
|
|
1
|
+
{"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","serializeAettos","value","serialize","denomination","options"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt from './u-int';\nimport { Int } from '../constants';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\n\nexport interface Options { denomination?: AE_AMOUNT_FORMATS }\n\nexport default {\n ...uInt,\n\n serializeAettos(value: string | undefined): string {\n return value ?? '0';\n },\n\n serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n options,\n ),\n );\n },\n};\n"],"mappings":"OAAOA,IAAI;AAAA,SAEiBC,YAAY;AAIxC,eAAe;EACb,GAAGD,IAAI;EAEPE,eAAe,CAACC,KAAyB,EAAU;IACjD,OAAOA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,GAAG;EACrB,CAAC;EAEDC,SAAS,CAACD,KAAsB,QAAiD;IAAA,IAA/C;MAAEE,YAAY;MAAE,GAAGC;IAAiB,CAAC;IACrE,OAAON,IAAI,CAACI,SAAS,CACnB,IAAI,CAACF,eAAe,CAClBC,KAAK,IAAI,IAAI,GAAGF,YAAY,CAACE,KAAK,EAAE;MAAEE;IAAa,CAAC,CAAC,GAAGF,KAAK,EAC7DG,OAAO,CACR,CACF;EACH;AACF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ConsensusProtocolVersion, VmVersion, AbiVersion } from '../constants';
|
|
3
|
+
export declare const ProtocolToVmAbi: {
|
|
4
|
+
readonly 5: {
|
|
5
|
+
readonly 'contract-create': {
|
|
6
|
+
readonly vmVersion: readonly [VmVersion.Fate2];
|
|
7
|
+
readonly abiVersion: readonly [AbiVersion.Fate];
|
|
8
|
+
};
|
|
9
|
+
readonly 'contract-call': {
|
|
10
|
+
readonly vmVersion: readonly [];
|
|
11
|
+
readonly abiVersion: readonly [AbiVersion.Fate, AbiVersion.Sophia];
|
|
12
|
+
};
|
|
13
|
+
readonly 'oracle-call': {
|
|
14
|
+
readonly vmVersion: readonly [];
|
|
15
|
+
readonly abiVersion: readonly [AbiVersion.NoAbi, AbiVersion.Sophia];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface CtVersion {
|
|
20
|
+
vmVersion: VmVersion;
|
|
21
|
+
abiVersion: AbiVersion;
|
|
22
|
+
}
|
|
23
|
+
export declare function getProtocolDetails(protocolVersion: ConsensusProtocolVersion, type: 'contract-create' | 'contract-call' | 'oracle-call'): CtVersion;
|
|
24
|
+
declare const _default: {
|
|
25
|
+
serialize(value: CtVersion | undefined, { consensusProtocolVersion }: {
|
|
26
|
+
consensusProtocolVersion: ConsensusProtocolVersion;
|
|
27
|
+
}): Buffer;
|
|
28
|
+
deserialize(buffer: Buffer): CtVersion;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { ConsensusProtocolVersion, VmVersion, AbiVersion } from "../constants.mjs"; // First abi/vm by default
|
|
6
|
+
export const ProtocolToVmAbi = {
|
|
7
|
+
[ConsensusProtocolVersion.Iris]: {
|
|
8
|
+
'contract-create': {
|
|
9
|
+
vmVersion: [VmVersion.Fate2],
|
|
10
|
+
abiVersion: [AbiVersion.Fate]
|
|
11
|
+
},
|
|
12
|
+
// TODO: Ensure that AEVM (Sophia?) is still available here
|
|
13
|
+
'contract-call': {
|
|
14
|
+
vmVersion: [],
|
|
15
|
+
abiVersion: [AbiVersion.Fate, AbiVersion.Sophia]
|
|
16
|
+
},
|
|
17
|
+
'oracle-call': {
|
|
18
|
+
vmVersion: [],
|
|
19
|
+
abiVersion: [AbiVersion.NoAbi, AbiVersion.Sophia]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export function getProtocolDetails(protocolVersion, type) {
|
|
24
|
+
var _protocol$vmVersion$;
|
|
25
|
+
const protocol = ProtocolToVmAbi[protocolVersion][type];
|
|
26
|
+
return {
|
|
27
|
+
vmVersion: (_protocol$vmVersion$ = protocol.vmVersion[0]) !== null && _protocol$vmVersion$ !== void 0 ? _protocol$vmVersion$ : VmVersion.Fate2,
|
|
28
|
+
abiVersion: protocol.abiVersion[0]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export default {
|
|
32
|
+
serialize(value, _ref) {
|
|
33
|
+
var _value;
|
|
34
|
+
let {
|
|
35
|
+
consensusProtocolVersion = ConsensusProtocolVersion.Iris
|
|
36
|
+
} = _ref;
|
|
37
|
+
(_value = value) !== null && _value !== void 0 ? _value : value = getProtocolDetails(consensusProtocolVersion, 'contract-create');
|
|
38
|
+
return _Buffer.from([value.vmVersion, 0, value.abiVersion]);
|
|
39
|
+
},
|
|
40
|
+
deserialize(buffer) {
|
|
41
|
+
const [vm,, abi] = buffer;
|
|
42
|
+
return {
|
|
43
|
+
vmVersion: +vm,
|
|
44
|
+
abiVersion: +abi
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=ct-version.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-version.mjs","names":["ConsensusProtocolVersion","VmVersion","AbiVersion","ProtocolToVmAbi","Iris","vmVersion","Fate2","abiVersion","Fate","Sophia","NoAbi","getProtocolDetails","protocolVersion","type","protocol","serialize","value","consensusProtocolVersion","from","deserialize","buffer","vm","abi"],"sources":["../../../../src/tx/builder/field-types/ct-version.ts"],"sourcesContent":["import { ConsensusProtocolVersion, VmVersion, AbiVersion } from '../constants';\n\n// First abi/vm by default\nexport const ProtocolToVmAbi = {\n [ConsensusProtocolVersion.Iris]: {\n 'contract-create': {\n vmVersion: [VmVersion.Fate2], abiVersion: [AbiVersion.Fate],\n },\n // TODO: Ensure that AEVM (Sophia?) is still available here\n 'contract-call': {\n vmVersion: [], abiVersion: [AbiVersion.Fate, AbiVersion.Sophia],\n },\n 'oracle-call': {\n vmVersion: [], abiVersion: [AbiVersion.NoAbi, AbiVersion.Sophia],\n },\n },\n} as const;\n\nexport interface CtVersion {\n vmVersion: VmVersion;\n abiVersion: AbiVersion;\n}\n\nexport function getProtocolDetails(\n protocolVersion: ConsensusProtocolVersion,\n type: 'contract-create' | 'contract-call' | 'oracle-call',\n): CtVersion {\n const protocol = ProtocolToVmAbi[protocolVersion][type];\n return {\n vmVersion: protocol.vmVersion[0] ?? VmVersion.Fate2,\n abiVersion: protocol.abiVersion[0],\n };\n}\n\nexport default {\n serialize(\n value: CtVersion | undefined,\n { consensusProtocolVersion = ConsensusProtocolVersion.Iris }:\n { consensusProtocolVersion: ConsensusProtocolVersion },\n ): Buffer {\n value ??= getProtocolDetails(consensusProtocolVersion, 'contract-create');\n\n return Buffer.from([value.vmVersion, 0, value.abiVersion]);\n },\n\n deserialize(buffer: Buffer): CtVersion {\n const [vm, , abi] = buffer;\n return { vmVersion: +vm, abiVersion: +abi };\n },\n};\n"],"mappings":";;;;SAASA,wBAAwB,EAAEC,SAAS,EAAEC,UAAU,4BAExD;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7B,CAACH,wBAAwB,CAACI,IAAI,GAAG;IAC/B,iBAAiB,EAAE;MACjBC,SAAS,EAAE,CAACJ,SAAS,CAACK,KAAK,CAAC;MAAEC,UAAU,EAAE,CAACL,UAAU,CAACM,IAAI;IAC5D,CAAC;IACD;IACA,eAAe,EAAE;MACfH,SAAS,EAAE,EAAE;MAAEE,UAAU,EAAE,CAACL,UAAU,CAACM,IAAI,EAAEN,UAAU,CAACO,MAAM;IAChE,CAAC;IACD,aAAa,EAAE;MACbJ,SAAS,EAAE,EAAE;MAAEE,UAAU,EAAE,CAACL,UAAU,CAACQ,KAAK,EAAER,UAAU,CAACO,MAAM;IACjE;EACF;AACF,CAAU;AAOV,OAAO,SAASE,kBAAkB,CAChCC,eAAyC,EACzCC,IAAyD,EAC9C;EAAA;EACX,MAAMC,QAAQ,GAAGX,eAAe,CAACS,eAAe,CAAC,CAACC,IAAI,CAAC;EACvD,OAAO;IACLR,SAAS,0BAAES,QAAQ,CAACT,SAAS,CAAC,CAAC,CAAC,uEAAIJ,SAAS,CAACK,KAAK;IACnDC,UAAU,EAAEO,QAAQ,CAACP,UAAU,CAAC,CAAC;EACnC,CAAC;AACH;AAEA,eAAe;EACbQ,SAAS,CACPC,KAA4B,QAGpB;IAAA;IAAA,IAFR;MAAEC,wBAAwB,GAAGjB,wBAAwB,CAACI;IACD,CAAC;IAEtD,UAAAY,KAAK,2CAALA,KAAK,GAAKL,kBAAkB,CAACM,wBAAwB,EAAE,iBAAiB,CAAC;IAEzE,OAAO,QAAOC,IAAI,CAAC,CAACF,KAAK,CAACX,SAAS,EAAE,CAAC,EAAEW,KAAK,CAACT,UAAU,CAAC,CAAC;EAC5D,CAAC;EAEDY,WAAW,CAACC,MAAc,EAAa;IACrC,MAAM,CAACC,EAAE,GAAIC,GAAG,CAAC,GAAGF,MAAM;IAC1B,OAAO;MAAEf,SAAS,EAAE,CAACgB,EAAE;MAAEd,UAAU,EAAE,CAACe;IAAI,CAAC;EAC7C;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import coinAmount from './coin-amount';
|
|
3
|
-
import { Int } from '
|
|
3
|
+
import { Int } from '../constants';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
/**
|
|
6
6
|
* @param value - Deposit value in string format. Should be equal to '0'.
|
|
@@ -9,7 +9,6 @@ declare const _default: {
|
|
|
9
9
|
*/
|
|
10
10
|
serialize(value: Int | undefined, options: Parameters<(typeof coinAmount)['serialize']>[1]): Buffer;
|
|
11
11
|
serializeAettos(value: string | undefined): string;
|
|
12
|
-
serializeOptional(value: Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
|
|
13
12
|
deserialize(value: Buffer): string;
|
|
14
13
|
};
|
|
15
14
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import coinAmount from "./coin-amount.mjs";
|
|
2
2
|
import { IllegalArgumentError } from "../../../utils/errors.mjs";
|
|
3
|
-
export default {
|
|
4
|
-
|
|
3
|
+
export default {
|
|
4
|
+
...coinAmount,
|
|
5
5
|
/**
|
|
6
6
|
* @param value - Deposit value in string format. Should be equal to '0'.
|
|
7
7
|
* @param options - Options
|
|
@@ -9,11 +9,9 @@ export default { ...coinAmount,
|
|
|
9
9
|
*/
|
|
10
10
|
serialize(value, options) {
|
|
11
11
|
var _value;
|
|
12
|
-
|
|
13
12
|
(_value = value) !== null && _value !== void 0 ? _value : value = 0;
|
|
14
13
|
if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
|
|
15
14
|
return coinAmount.serialize(value, options);
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
};
|
|
19
17
|
//# sourceMappingURL=deposit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from '
|
|
1
|
+
{"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from '../constants';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SAERC,oBAAoB;AAE7B,eAAe;EACb,GAAGD,UAAU;EAEb;AACF;AACA;AACA;AACA;EACEE,SAAS,CACPC,KAAsB,EACtBC,OAAsD,EAC9C;IAAA;IACR,UAAAD,KAAK,2CAALA,KAAK,GAAK,CAAC;IACX,IAAI,CAACA,KAAK,KAAK,CAAC,EAAE,MAAM,IAAIF,oBAAoB,CAAE,oEAAmEE,KAAK,CAACE,QAAQ,EAAG,UAAS,CAAC;IAChJ,OAAOL,UAAU,CAACE,SAAS,CAACC,KAAK,EAAEC,OAAO,CAAC;EAC7C;AACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Encoded, Encoding } from '../../../utils/encoder';
|
|
3
|
+
export default function genEncodedField<E extends Encoding, Optional extends boolean = false>(encoding: E, optional?: Optional): {
|
|
4
|
+
serialize: Optional extends true ? (value?: Encoded.Generic<E>) => Buffer : (value: Encoded.Generic<E>) => Buffer;
|
|
5
|
+
deserialize: (value: Buffer) => Encoded.Generic<Encoding>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { decode, encode } from "../../../utils/encoder.mjs";
|
|
6
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
7
|
+
export default function genEncodedField(encoding, optional) {
|
|
8
|
+
return {
|
|
9
|
+
serialize(encodedData) {
|
|
10
|
+
if (encodedData == null) {
|
|
11
|
+
if (optional === true) return _Buffer.from([]);
|
|
12
|
+
throw new ArgumentError('Encoded data', 'provided', encodedData);
|
|
13
|
+
}
|
|
14
|
+
return decode(encodedData);
|
|
15
|
+
},
|
|
16
|
+
deserialize(buffer) {
|
|
17
|
+
return encode(buffer, encoding);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=encoded.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoded.mjs","names":["decode","encode","ArgumentError","genEncodedField","encoding","optional","serialize","encodedData","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/encoded.ts"],"sourcesContent":["import {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { ArgumentError } from '../../../utils/errors';\n\nexport default function genEncodedField<E extends Encoding, Optional extends boolean = false>(\n encoding: E,\n optional?: Optional,\n): {\n serialize: Optional extends true\n ? (value?: Encoded.Generic<E>) => Buffer : (value: Encoded.Generic<E>) => Buffer;\n deserialize: (value: Buffer) => Encoded.Generic<Encoding>;\n } {\n return {\n serialize(encodedData?: Encoded.Generic<E>) {\n if (encodedData == null) {\n if (optional === true) return Buffer.from([]);\n throw new ArgumentError('Encoded data', 'provided', encodedData);\n }\n return decode(encodedData);\n },\n\n deserialize(buffer) {\n return encode(buffer, encoding);\n },\n };\n}\n"],"mappings":";;;;SACEA,MAAM,EAAEC,MAAM;AAAA,SAEPC,aAAa;AAEtB,eAAe,SAASC,eAAe,CACrCC,QAAW,EACXC,QAAmB,EAKjB;EACF,OAAO;IACLC,SAAS,CAACC,WAAgC,EAAE;MAC1C,IAAIA,WAAW,IAAI,IAAI,EAAE;QACvB,IAAIF,QAAQ,KAAK,IAAI,EAAE,OAAO,QAAOG,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAIN,aAAa,CAAC,cAAc,EAAE,UAAU,EAAEK,WAAW,CAAC;MAClE;MACA,OAAOP,MAAM,CAACO,WAAW,CAAC;IAC5B,CAAC;IAEDE,WAAW,CAACC,MAAM,EAAE;MAClB,OAAOT,MAAM,CAACS,MAAM,EAAEN,QAAQ,CAAC;IACjC;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Tag } from '../constants';
|
|
3
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
4
|
+
export default function genEntryField<T extends Tag = Tag>(tag?: T): {
|
|
5
|
+
serialize: (value: any, options: {
|
|
6
|
+
buildTx: typeof buildTxType;
|
|
7
|
+
}) => Buffer;
|
|
8
|
+
deserialize: (value: Buffer, options: {
|
|
9
|
+
unpackTx: typeof unpackTxType;
|
|
10
|
+
}) => any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
|
|
6
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
7
|
+
export default function genEntryField(tag) {
|
|
8
|
+
return {
|
|
9
|
+
serialize(txParams, _ref) {
|
|
10
|
+
let {
|
|
11
|
+
buildTx
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (ArrayBuffer.isView(txParams)) return _Buffer.from(txParams);
|
|
14
|
+
return decode(buildTx({
|
|
15
|
+
...txParams,
|
|
16
|
+
...(tag != null && {
|
|
17
|
+
tag
|
|
18
|
+
})
|
|
19
|
+
}));
|
|
20
|
+
},
|
|
21
|
+
deserialize(buf, _ref2) {
|
|
22
|
+
let {
|
|
23
|
+
unpackTx
|
|
24
|
+
} = _ref2;
|
|
25
|
+
const tx = unpackTx(encode(buf, Encoding.Transaction));
|
|
26
|
+
if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', tag, tx.tag);
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=entry.mjs.map
|