@aeternity/aepp-sdk 13.0.0-alpha.1 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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 +1833 -1543
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +5 -4
- package/es/AeSdkAepp.mjs +13 -17
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +11 -12
- package/es/AeSdkMethods.mjs +6 -8
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +1 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +5 -1
- package/es/Node.mjs +11 -5
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +11 -6
- package/es/account/Base.mjs +0 -17
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.mjs +12 -25
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +2 -1
- package/es/account/Memory.mjs +9 -21
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +12 -14
- package/es/aens.mjs +17 -31
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +0 -16
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -16
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs +0 -17
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -16
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +1 -1
- package/es/apis/compiler/compiler.mjs +4 -20
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +3 -2
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +1 -1
- package/es/apis/compiler/models/mappers.mjs +19 -2
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +15 -15
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +1 -1
- package/es/apis/node/models/mappers.mjs +2 -1
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.d.ts +2 -2
- package/es/apis/node/models/parameters.mjs +2 -2
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +3 -19
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +8 -8
- package/es/chain.mjs +20 -23
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +25 -12
- package/es/channel/Base.mjs +23 -26
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.mjs +8 -21
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +4 -2
- package/es/channel/Spend.mjs +0 -16
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +6 -18
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +19 -2
- package/es/channel/internal.mjs +19 -19
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +30 -85
- package/es/contract/Contract.mjs +197 -215
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +10 -14
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.mjs +5 -11
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.mjs +6 -30
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/compiler/getFileSystem.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +43 -0
- package/es/contract/delegation-signature.mjs +45 -0
- package/es/contract/delegation-signature.mjs.map +1 -0
- package/es/contract/ga.d.ts +23 -7
- package/es/contract/ga.mjs +52 -27
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +5 -4
- package/es/index-browser.mjs +7 -21
- package/es/index-browser.mjs.map +1 -1
- package/es/oracle.d.ts +12 -17
- package/es/oracle.mjs +28 -48
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +19 -27
- package/es/spend.mjs +20 -43
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/SchemaTypes.d.ts +37 -0
- package/es/tx/builder/SchemaTypes.mjs +2 -0
- package/es/tx/builder/SchemaTypes.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -2
- package/es/tx/builder/constants.mjs +2 -0
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +11 -2
- package/es/tx/builder/field-types/abi-version.mjs +24 -4
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/array.d.ts +1 -1
- package/es/tx/builder/field-types/array.mjs.map +1 -1
- package/es/tx/builder/field-types/boolean.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/es/tx/builder/field-types/coin-amount.mjs +4 -5
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +22 -3
- package/es/tx/builder/field-types/ct-version.mjs +32 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +2 -1
- package/es/tx/builder/field-types/deposit.mjs +3 -2
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +1 -1
- package/es/tx/builder/field-types/encoded.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +3 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +3 -1
- package/es/tx/builder/field-types/fee.mjs +5 -1
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/es/tx/builder/field-types/gas-limit.mjs +4 -2
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +3 -1
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +52 -13
- package/es/tx/builder/field-types/index.mjs +10 -2
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.d.ts +13 -0
- package/es/tx/builder/field-types/map.mjs +49 -0
- package/es/tx/builder/field-types/map.mjs.map +1 -0
- package/es/tx/builder/field-types/mptree.d.ts +7 -2
- package/es/tx/builder/field-types/mptree.mjs +5 -7
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +1 -1
- package/es/tx/builder/field-types/name-fee.mjs +2 -2
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +14 -0
- package/es/tx/builder/field-types/nonce.mjs +29 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/raw.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/es/tx/builder/field-types/short-u-int-const.mjs +12 -8
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -1
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.mjs.map +1 -1
- package/es/tx/builder/field-types/ttl.d.ts +11 -0
- package/es/tx/builder/field-types/ttl.mjs +21 -0
- package/es/tx/builder/field-types/ttl.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/wrapped.d.ts +14 -0
- package/es/tx/builder/field-types/wrapped.mjs +22 -0
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +20 -20
- package/es/tx/builder/index.mjs +54 -64
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2735 -2865
- package/es/tx/builder/schema.generated.d.ts +2011 -0
- package/es/tx/builder/schema.generated.mjs +2 -0
- package/es/tx/builder/schema.generated.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +459 -155
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +35 -0
- package/es/tx/execution-cost.mjs +123 -0
- package/es/tx/execution-cost.mjs.map +1 -0
- package/es/tx/transaction-signer.d.ts +6 -0
- package/es/tx/transaction-signer.mjs +27 -0
- package/es/tx/transaction-signer.mjs.map +1 -0
- package/es/tx/validator.mjs +60 -109
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +0 -16
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +3 -2
- package/es/utils/autorest.mjs +43 -11
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +0 -16
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.mjs +0 -16
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +14 -31
- package/es/utils/errors.mjs +3 -33
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -1
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs +0 -17
- package/es/utils/string.mjs.map +1 -1
- package/package.json +34 -30
- package/src/AeSdkAepp.ts +16 -14
- package/src/AeSdkMethods.ts +11 -16
- package/src/AeSdkWallet.ts +1 -1
- package/src/Node.ts +17 -6
- package/src/account/Base.ts +11 -22
- package/src/account/Generalized.ts +9 -24
- package/src/account/Memory.ts +14 -21
- package/src/aens.ts +31 -47
- package/src/aepp-wallet-communication/connection/Browser.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +0 -17
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +0 -17
- package/src/aepp-wallet-communication/connection-proxy.ts +0 -17
- package/src/aepp-wallet-communication/rpc/types.ts +7 -2
- package/src/aepp-wallet-communication/wallet-detector.ts +0 -17
- package/src/apis/compiler/compiler.ts +3 -27
- package/src/apis/compiler/models/index.ts +3 -2
- package/src/apis/compiler/models/mappers.ts +15 -2
- package/src/apis/node/models/index.ts +16 -15
- package/src/apis/node/models/mappers.ts +2 -1
- package/src/apis/node/models/parameters.ts +2 -2
- package/src/apis/node/node.ts +3 -27
- package/src/chain.ts +29 -28
- package/src/channel/Base.ts +33 -33
- package/src/channel/Contract.ts +8 -23
- package/src/channel/Spend.ts +2 -17
- package/src/channel/handlers.ts +5 -18
- package/src/channel/internal.ts +40 -22
- package/src/contract/Contract.ts +161 -170
- package/src/contract/compiler/Base.ts +10 -14
- package/src/contract/compiler/Cli.ts +5 -11
- package/src/contract/compiler/Http.ts +6 -25
- package/src/contract/delegation-signature.ts +56 -0
- package/src/contract/ga.ts +53 -32
- package/src/index-browser.ts +15 -21
- package/src/oracle.ts +46 -56
- package/src/spend.ts +33 -67
- package/src/tx/builder/SchemaTypes.ts +79 -0
- package/src/tx/builder/constants.ts +2 -0
- package/src/tx/builder/field-types/abi-version.ts +29 -6
- package/src/tx/builder/field-types/array.ts +1 -1
- package/src/tx/builder/field-types/coin-amount.ts +6 -4
- package/src/tx/builder/field-types/ct-version.ts +37 -4
- package/src/tx/builder/field-types/deposit.ts +3 -1
- package/src/tx/builder/field-types/encoded.ts +1 -1
- package/src/tx/builder/field-types/entry.ts +8 -3
- package/src/tx/builder/field-types/fee.ts +6 -4
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/index.ts +15 -1
- package/src/tx/builder/field-types/map.ts +45 -0
- package/src/tx/builder/field-types/mptree.ts +4 -3
- package/src/tx/builder/field-types/name-fee.ts +2 -1
- package/src/tx/builder/field-types/nonce.ts +40 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +18 -8
- package/src/tx/builder/field-types/ttl.ts +24 -0
- package/src/tx/builder/field-types/wrapped.ts +32 -0
- package/src/tx/builder/index.ts +57 -71
- package/src/tx/builder/schema.generated.ts +2013 -0
- package/src/tx/builder/schema.ts +544 -624
- package/src/tx/execution-cost.ts +146 -0
- package/src/tx/transaction-signer.ts +27 -0
- package/src/tx/validator.ts +60 -91
- package/src/utils/amount-formatter.ts +0 -16
- package/src/utils/autorest.ts +52 -11
- package/src/utils/bytes.ts +0 -16
- package/src/utils/crypto.ts +0 -16
- package/src/utils/errors.ts +16 -45
- package/src/utils/string.ts +0 -17
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.2/Node.d.ts +5 -1
- package/types-legacy/ts4.2/account/Base.d.ts +11 -6
- package/types-legacy/ts4.2/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.2/aens.d.ts +12 -14
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/chain.d.ts +8 -8
- package/types-legacy/ts4.2/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.2/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.2/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.2/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.2/index-browser.d.ts +5 -4
- package/types-legacy/ts4.2/oracle.d.ts +12 -17
- package/types-legacy/ts4.2/spend.d.ts +19 -27
- package/types-legacy/ts4.2/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.2/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +7 -2
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.2/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.2/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.2/utils/other.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +11 -12
- package/types-legacy/ts4.5/Node.d.ts +5 -1
- package/types-legacy/ts4.5/account/Base.d.ts +11 -6
- package/types-legacy/ts4.5/account/Memory.d.ts +2 -1
- package/types-legacy/ts4.5/aens.d.ts +12 -14
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +6 -2
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +1 -1
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +3 -2
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +15 -15
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +1 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/chain.d.ts +8 -8
- package/types-legacy/ts4.5/channel/Base.d.ts +25 -12
- package/types-legacy/ts4.5/channel/Spend.d.ts +4 -2
- package/types-legacy/ts4.5/channel/internal.d.ts +22 -2
- package/types-legacy/ts4.5/contract/Contract.d.ts +29 -84
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +10 -14
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +43 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +23 -7
- package/types-legacy/ts4.5/index-browser.d.ts +5 -4
- package/types-legacy/ts4.5/oracle.d.ts +12 -17
- package/types-legacy/ts4.5/spend.d.ts +19 -27
- package/types-legacy/ts4.5/tx/builder/SchemaTypes.d.ts +37 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +11 -2
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +3 -4
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +33 -3
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +2 -1
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +3 -2
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +3 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +52 -13
- package/types-legacy/ts4.5/tx/builder/field-types/map.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +7 -2
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/wrapped.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +23 -20
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2962 -4629
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +2011 -0
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +35 -0
- package/types-legacy/ts4.5/tx/transaction-signer.d.ts +6 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +3 -2
- package/types-legacy/ts4.5/utils/errors.d.ts +14 -31
- package/types-legacy/ts4.5/utils/other.d.ts +1 -1
- package/es/tx/index.d.ts +0 -19
- package/es/tx/index.mjs +0 -115
- package/es/tx/index.mjs.map +0 -1
- package/src/apis/compiler/code-model-v4.yaml +0 -2442
- package/src/apis/node/code-model-v4.yaml +0 -10080
- package/src/tx/index.ts +0 -129
- package/types-legacy/ts4.2/tx/index.d.ts +0 -19
- package/types-legacy/ts4.5/tx/index.d.ts +0 -19
|
@@ -25,7 +25,8 @@ export default {
|
|
|
25
25
|
serialize(
|
|
26
26
|
value: Int | undefined,
|
|
27
27
|
txFields: { name: AensName } & Parameters<typeof coinAmount['serialize']>[1],
|
|
28
|
+
parameters: Parameters<typeof coinAmount['serialize']>[2],
|
|
28
29
|
): Buffer {
|
|
29
|
-
return coinAmount.serialize.call(this, value, txFields);
|
|
30
|
+
return coinAmount.serialize.call(this, value, txFields, parameters);
|
|
30
31
|
},
|
|
31
32
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isAccountNotFoundError } from '../../../utils/other';
|
|
2
|
+
import shortUInt from './short-u-int';
|
|
3
|
+
import Node from '../../../Node';
|
|
4
|
+
import { ArgumentError } from '../../../utils/errors';
|
|
5
|
+
import { NextNonceStrategy } from '../../../apis/node';
|
|
6
|
+
|
|
7
|
+
export default function genNonceField<SenderKey extends string>(senderKey: SenderKey): {
|
|
8
|
+
serialize: (value: number) => Buffer;
|
|
9
|
+
// TODO: (value: number) => Promise<number> | (value: undefined, ...) => Promise<number>
|
|
10
|
+
prepare: (
|
|
11
|
+
value: number | undefined,
|
|
12
|
+
params: {},
|
|
13
|
+
// TODO: replace `string` with AddressEncodings
|
|
14
|
+
options: { [key in SenderKey]: string } & { strategy?: NextNonceStrategy; onNode?: Node },
|
|
15
|
+
) => Promise<number>;
|
|
16
|
+
deserialize: (value: Buffer) => number;
|
|
17
|
+
senderKey: string;
|
|
18
|
+
} {
|
|
19
|
+
return {
|
|
20
|
+
...shortUInt,
|
|
21
|
+
|
|
22
|
+
async prepare(value, params, options) {
|
|
23
|
+
if (value != null) return value;
|
|
24
|
+
const { onNode, strategy } = options;
|
|
25
|
+
const senderId = options[senderKey];
|
|
26
|
+
const requirement = 'provided (or provide `nonce` instead)';
|
|
27
|
+
if (onNode == null) throw new ArgumentError('onNode', requirement, onNode);
|
|
28
|
+
if (senderId == null) throw new ArgumentError('senderId', requirement, senderId);
|
|
29
|
+
return (
|
|
30
|
+
await onNode.getAccountNextNonce(senderId.replace(/^ok_/, 'ak_'), { strategy })
|
|
31
|
+
.catch((error) => {
|
|
32
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
33
|
+
return { nextNonce: 1 };
|
|
34
|
+
})
|
|
35
|
+
).nextNonce;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
senderKey,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { ArgumentError } from '../../../utils/errors';
|
|
2
2
|
import shortUInt from './short-u-int';
|
|
3
3
|
|
|
4
|
-
export default function genShortUIntConstField<
|
|
5
|
-
|
|
4
|
+
export default function genShortUIntConstField<
|
|
5
|
+
Value extends number, Optional extends boolean = false,
|
|
6
|
+
>(constValue: Value, optional?: Optional): {
|
|
7
|
+
serialize: Optional extends true ? (value?: Value) => Buffer : (value: Value) => Buffer;
|
|
6
8
|
deserialize: (value: Buffer) => Value;
|
|
9
|
+
constValue: Value;
|
|
10
|
+
constValueOptional: boolean;
|
|
7
11
|
} {
|
|
8
12
|
return {
|
|
9
|
-
serialize(
|
|
10
|
-
if (
|
|
11
|
-
|
|
13
|
+
serialize(value?: Value) {
|
|
14
|
+
if ((optional !== true || value != null) && value !== constValue) {
|
|
15
|
+
throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
16
|
+
}
|
|
17
|
+
return shortUInt.serialize(constValue);
|
|
12
18
|
},
|
|
13
19
|
|
|
14
20
|
deserialize(buf) {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
21
|
+
const value = shortUInt.deserialize(buf);
|
|
22
|
+
if (value !== constValue) throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
23
|
+
return constValue;
|
|
18
24
|
},
|
|
25
|
+
|
|
26
|
+
constValue,
|
|
27
|
+
|
|
28
|
+
constValueOptional: optional === true,
|
|
19
29
|
};
|
|
20
30
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import shortUInt from './short-u-int';
|
|
2
|
+
import Node from '../../../Node';
|
|
3
|
+
import { ArgumentError } from '../../../utils/errors';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
...shortUInt,
|
|
7
|
+
|
|
8
|
+
serialize(value: number | undefined): Buffer {
|
|
9
|
+
return shortUInt.serialize(value ?? 0);
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
async prepare(
|
|
13
|
+
value: number | undefined,
|
|
14
|
+
params: {},
|
|
15
|
+
// TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }
|
|
16
|
+
{ onNode, absoluteTtl }: { onNode?: Node; absoluteTtl?: boolean },
|
|
17
|
+
) {
|
|
18
|
+
if (absoluteTtl !== true && value !== 0 && value != null) {
|
|
19
|
+
if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);
|
|
20
|
+
value += (await onNode.getCurrentKeyBlock()).height;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tag } from '../constants';
|
|
2
|
+
import { encode, Encoding, decode } from '../../../utils/encoder';
|
|
3
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
4
|
+
|
|
5
|
+
type TagWrapping = Tag.AccountsMtree | Tag.CallsMtree | Tag.ChannelsMtree | Tag.ContractsMtree
|
|
6
|
+
| Tag.NameserviceMtree | Tag.OraclesMtree;
|
|
7
|
+
|
|
8
|
+
export default function genWrappedField<T extends TagWrapping>(tag: T): {
|
|
9
|
+
serialize: (
|
|
10
|
+
// TODO: replace with `(TxParams & { tag: T })['payload']`,
|
|
11
|
+
// but fix TS2502 value is referenced directly or indirectly in its own type annotation
|
|
12
|
+
value: any, options: { buildTx: typeof buildTxType }
|
|
13
|
+
) => Buffer;
|
|
14
|
+
deserialize: (
|
|
15
|
+
value: Buffer, options: { unpackTx: typeof unpackTxType },
|
|
16
|
+
// TODO: replace with `(TxUnpacked & { tag: T })['payload']`,
|
|
17
|
+
// TS2577 Return type annotation circularly references itself
|
|
18
|
+
) => any;
|
|
19
|
+
recursiveType: true;
|
|
20
|
+
} {
|
|
21
|
+
return {
|
|
22
|
+
serialize(payload, { buildTx }) {
|
|
23
|
+
return decode(buildTx({ tag, payload }));
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
deserialize(buffer, { unpackTx }) {
|
|
27
|
+
return unpackTx<TagWrapping>(encode(buffer, Encoding.Transaction), tag).payload;
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
recursiveType: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
package/src/tx/builder/index.ts
CHANGED
|
@@ -1,49 +1,26 @@
|
|
|
1
|
-
import { decode as rlpDecode, encode as rlpEncode
|
|
1
|
+
import { decode as rlpDecode, encode as rlpEncode } from 'rlp';
|
|
2
2
|
import {
|
|
3
3
|
decode, encode, Encoded, Encoding,
|
|
4
4
|
} from '../../utils/encoder';
|
|
5
|
-
import { AE_AMOUNT_FORMATS } from '../../utils/amount-formatter';
|
|
6
5
|
import { hash } from '../../utils/crypto';
|
|
7
6
|
import { BinaryData, Field } from './field-types';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
} from './schema';
|
|
7
|
+
import { txSchema } from './schema';
|
|
8
|
+
import { TxUnpacked, TxParams, TxParamsAsync } from './schema.generated';
|
|
11
9
|
import { Tag } from './constants';
|
|
12
10
|
import { buildContractId, readInt } from './helpers';
|
|
13
11
|
import { ArgumentError, DecodeError, SchemaNotFoundError } from '../../utils/errors';
|
|
14
|
-
import { isKeyOfObject } from '../../utils/other';
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* JavaScript-based Transaction builder
|
|
18
15
|
*/
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function unpackRawTx<Tx extends TxSchema>(
|
|
28
|
-
binary: Uint8Array | NestedUint8Array,
|
|
29
|
-
schema: TxField[],
|
|
30
|
-
): RawTxObject<Tx> {
|
|
31
|
-
if (binary.length !== schema.length) {
|
|
32
|
-
throw new ArgumentError('Transaction RLP length', schema.length, binary.length);
|
|
33
|
-
}
|
|
34
|
-
return schema
|
|
35
|
-
.reduce<any>(
|
|
36
|
-
(
|
|
37
|
-
acc,
|
|
38
|
-
[name, field],
|
|
39
|
-
index,
|
|
40
|
-
) => {
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
42
|
-
const deserialized = field.deserialize(binary[index] as BinaryData, { unpackTx });
|
|
43
|
-
return { ...acc, [name]: deserialized };
|
|
44
|
-
},
|
|
45
|
-
{},
|
|
46
|
-
);
|
|
17
|
+
export function getSchema(tag: Tag, version?: number): Array<[string, Field]> {
|
|
18
|
+
const schemas = txSchema.filter((s) => s.tag.constValue === tag);
|
|
19
|
+
if (schemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);
|
|
20
|
+
version ??= Math.max(...schemas.map((schema) => schema.version.constValue));
|
|
21
|
+
const schema = schemas.find((s) => s.version.constValue === version);
|
|
22
|
+
if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);
|
|
23
|
+
return Object.entries(schema);
|
|
47
24
|
}
|
|
48
25
|
|
|
49
26
|
/**
|
|
@@ -51,52 +28,35 @@ function unpackRawTx<Tx extends TxSchema>(
|
|
|
51
28
|
* @category transaction builder
|
|
52
29
|
* @param params - Object with tx params
|
|
53
30
|
* @param options - options
|
|
54
|
-
* @param options.denomination - Denomination of amounts
|
|
55
31
|
* @param options.prefix - Prefix of transaction
|
|
56
|
-
* @
|
|
57
|
-
* @returns object
|
|
58
|
-
* @returns object.tx Base64Check transaction hash with 'tx_' prefix
|
|
59
|
-
* @returns object.rlpEncoded rlp encoded transaction
|
|
60
|
-
* @returns object.binary binary transaction
|
|
32
|
+
* @returns object Base64Check transaction hash with 'tx_' prefix
|
|
61
33
|
*/
|
|
62
34
|
export function buildTx<
|
|
63
|
-
TxType extends Tag,
|
|
64
35
|
E extends Encoding = Encoding.Transaction,
|
|
65
36
|
>(
|
|
66
|
-
params:
|
|
67
|
-
// TODO: get it from gas-limit.ts somehow
|
|
68
|
-
& (TxType extends Tag.ContractCreateTx | Tag.ContractCallTx
|
|
69
|
-
| Tag.ChannelOffChainUpdateCallContract | Tag.GaAttachTx | Tag.GaMetaTx
|
|
70
|
-
? { gasMax?: number } : {}),
|
|
37
|
+
params: TxParams,
|
|
71
38
|
{
|
|
72
39
|
prefix,
|
|
73
|
-
denomination = AE_AMOUNT_FORMATS.AETTOS,
|
|
74
40
|
}: {
|
|
75
41
|
prefix?: E;
|
|
76
|
-
denomination?: AE_AMOUNT_FORMATS;
|
|
77
42
|
} = {},
|
|
78
43
|
): Encoded.Generic<E> {
|
|
79
|
-
const
|
|
80
|
-
params.version ??= Math.max(...Object.keys(schemas).map((a) => +a));
|
|
81
|
-
if (!isKeyOfObject(params.version, schemas)) {
|
|
82
|
-
throw new SchemaNotFoundError('serialization', Tag[params.tag], params.version);
|
|
83
|
-
}
|
|
84
|
-
const schema = schemas[params.version] as unknown as TxField[];
|
|
44
|
+
const schema = getSchema(params.tag, params.version);
|
|
85
45
|
|
|
86
|
-
const binary = schema.map(([key, field]
|
|
46
|
+
const binary = schema.map(([key, field]) => (
|
|
87
47
|
field.serialize(
|
|
48
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
88
49
|
params[key],
|
|
89
50
|
{
|
|
90
51
|
...params,
|
|
91
52
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
92
53
|
unpackTx,
|
|
93
54
|
buildTx,
|
|
94
|
-
denomination,
|
|
95
55
|
rebuildTx: (overrideParams: any) => buildTx(
|
|
96
56
|
{ ...params, ...overrideParams },
|
|
97
|
-
{ denomination },
|
|
98
57
|
),
|
|
99
58
|
},
|
|
59
|
+
params,
|
|
100
60
|
)
|
|
101
61
|
));
|
|
102
62
|
|
|
@@ -104,27 +64,53 @@ export function buildTx<
|
|
|
104
64
|
return encode(rlpEncode(binary), prefix ?? Encoding.Transaction);
|
|
105
65
|
}
|
|
106
66
|
|
|
67
|
+
export type BuildTxOptions <TxType extends Tag, OmitFields extends string> =
|
|
68
|
+
Omit<TxParamsAsync & { tag: TxType }, 'tag' | OmitFields>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @category transaction builder
|
|
72
|
+
*/
|
|
73
|
+
export async function buildTxAsync(params: TxParamsAsync): Promise<Encoded.Transaction> {
|
|
74
|
+
await Promise.all(
|
|
75
|
+
getSchema(params.tag, params.version)
|
|
76
|
+
.map(async ([key, field]) => {
|
|
77
|
+
if (field.prepare == null) return;
|
|
78
|
+
// @ts-expect-error the type of `params[key]` can't be determined accurately
|
|
79
|
+
params[key] = await field.prepare(params[key], params, params);
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// @ts-expect-error after preparation properties should be compatible with sync tx builder
|
|
84
|
+
return buildTx(params);
|
|
85
|
+
}
|
|
86
|
+
|
|
107
87
|
/**
|
|
108
|
-
* Unpack transaction
|
|
88
|
+
* Unpack transaction encoded as string
|
|
109
89
|
* @category transaction builder
|
|
110
90
|
* @param encodedTx - Transaction to unpack
|
|
111
91
|
* @param txType - Expected transaction type
|
|
112
|
-
* @returns
|
|
113
|
-
* @returns object.tx Object with transaction param's
|
|
114
|
-
* @returns object.txType Transaction type
|
|
92
|
+
* @returns Object with transaction param's
|
|
115
93
|
*/
|
|
116
94
|
export function unpackTx<TxType extends Tag>(
|
|
117
|
-
encodedTx: Encoded.Transaction | Encoded.Poi,
|
|
95
|
+
encodedTx: Encoded.Transaction | Encoded.Poi | Encoded.StateTrees | Encoded.CallStateTree,
|
|
118
96
|
txType?: TxType,
|
|
119
|
-
):
|
|
97
|
+
): TxUnpacked & { tag: TxType } {
|
|
120
98
|
const binary = rlpDecode(decode(encodedTx));
|
|
121
99
|
const tag = +readInt(binary[0] as Buffer);
|
|
122
|
-
if (!isKeyOfObject(tag, TX_SCHEMA)) throw new DecodeError(`Unknown transaction tag: ${tag}`);
|
|
123
|
-
if (txType != null && txType !== tag) throw new DecodeError(`Expected transaction to have ${Tag[txType]} tag, got ${Tag[tag]} instead`);
|
|
124
100
|
const version = +readInt(binary[1] as Buffer);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
101
|
+
const schema = getSchema(tag, version);
|
|
102
|
+
if (txType != null && txType !== tag) throw new DecodeError(`Expected transaction to have ${Tag[txType]} tag, got ${Tag[tag]} instead`);
|
|
103
|
+
if (binary.length !== schema.length) {
|
|
104
|
+
throw new ArgumentError('Transaction RLP length', schema.length, binary.length);
|
|
105
|
+
}
|
|
106
|
+
return schema.reduce<any>(
|
|
107
|
+
(acc, [name, field], index) => {
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
109
|
+
const deserialized = field.deserialize(binary[index] as BinaryData, { unpackTx });
|
|
110
|
+
return { ...acc, [name]: deserialized };
|
|
111
|
+
},
|
|
112
|
+
{},
|
|
113
|
+
) as any;
|
|
128
114
|
}
|
|
129
115
|
|
|
130
116
|
/**
|
|
@@ -149,9 +135,9 @@ export function buildTxHash(rawTx: Encoded.Transaction | Uint8Array): Encoded.Tx
|
|
|
149
135
|
export function buildContractIdByContractTx(
|
|
150
136
|
contractTx: Encoded.Transaction,
|
|
151
137
|
): Encoded.ContractAddress {
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
throw new ArgumentError('
|
|
138
|
+
const params = unpackTx(contractTx);
|
|
139
|
+
if (Tag.ContractCreateTx !== params.tag && Tag.GaAttachTx !== params.tag) {
|
|
140
|
+
throw new ArgumentError('contractTx', 'a contractCreateTx or gaAttach', params.tag);
|
|
155
141
|
}
|
|
156
|
-
return buildContractId(ownerId,
|
|
142
|
+
return buildContractId(params.ownerId, params.nonce);
|
|
157
143
|
}
|