@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
|
@@ -12,16 +12,20 @@ import _fee from "./fee.mjs";
|
|
|
12
12
|
import _field from "./field.mjs";
|
|
13
13
|
import _gasLimit from "./gas-limit.mjs";
|
|
14
14
|
import _gasPrice from "./gas-price.mjs";
|
|
15
|
+
import _map from "./map.mjs";
|
|
15
16
|
import _mptree from "./mptree.mjs";
|
|
16
17
|
import _name from "./name.mjs";
|
|
17
18
|
import _nameFee from "./name-fee.mjs";
|
|
18
19
|
import _nameId from "./name-id.mjs";
|
|
20
|
+
import _nonce from "./nonce.mjs";
|
|
19
21
|
import _pointers from "./pointers.mjs";
|
|
20
22
|
import _raw from "./raw.mjs";
|
|
21
23
|
import _shortUInt from "./short-u-int.mjs";
|
|
22
24
|
import _shortUIntConst from "./short-u-int-const.mjs";
|
|
23
25
|
import _string from "./string.mjs";
|
|
24
|
-
import
|
|
26
|
+
import _ttl from "./ttl.mjs";
|
|
27
|
+
import _uInt from "./u-int.mjs";
|
|
28
|
+
import _wrapped from "./wrapped.mjs"; // TODO: remove after fixing https://github.com/Gerrit0/typedoc-plugin-missing-exports/issues/15
|
|
25
29
|
const abiVersion = _abiVersion;
|
|
26
30
|
const address = _address;
|
|
27
31
|
const array = _array;
|
|
@@ -36,15 +40,19 @@ const fee = _fee;
|
|
|
36
40
|
const field = _field;
|
|
37
41
|
const gasLimit = _gasLimit;
|
|
38
42
|
const gasPrice = _gasPrice;
|
|
43
|
+
const map = _map;
|
|
39
44
|
const mptree = _mptree;
|
|
40
45
|
const name = _name;
|
|
41
46
|
const nameFee = _nameFee;
|
|
42
47
|
const nameId = _nameId;
|
|
48
|
+
const nonce = _nonce;
|
|
43
49
|
const pointers = _pointers;
|
|
44
50
|
const raw = _raw;
|
|
45
51
|
const shortUInt = _shortUInt;
|
|
46
52
|
const shortUIntConst = _shortUIntConst;
|
|
47
53
|
const string = _string;
|
|
54
|
+
const ttl = _ttl;
|
|
48
55
|
const uInt = _uInt;
|
|
49
|
-
|
|
56
|
+
const wrapped = _wrapped;
|
|
57
|
+
export { abiVersion, address, array, boolean, coinAmount, ctVersion, deposit, encoded, entry, enumeration, fee, field, gasLimit, gasPrice, map, mptree, name, nameFee, nameId, nonce, pointers, raw, shortUInt, shortUIntConst, string, ttl, uInt, wrapped };
|
|
50
58
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["_abiVersion","_address","_array","_boolean","_coinAmount","_ctVersion","_deposit","_encoded","_entry","_enumeration","_fee","_field","_gasLimit","_gasPrice","_mptree","_name","_nameFee","_nameId","_pointers","_raw","_shortUInt","_shortUIntConst","_string","_uInt","abiVersion","address","array","boolean","coinAmount","ctVersion","deposit","encoded","entry","enumeration","fee","field","gasLimit","gasPrice","mptree","name","nameFee","nameId","pointers","raw","shortUInt","shortUIntConst","string","uInt"],"sources":["../../../../src/tx/builder/field-types/index.ts"],"sourcesContent":["import _abiVersion from './abi-version';\nimport _address from './address';\nimport _array from './array';\nimport _boolean from './boolean';\nimport _coinAmount from './coin-amount';\nimport _ctVersion from './ct-version';\nimport _deposit from './deposit';\nimport _encoded from './encoded';\nimport _entry from './entry';\nimport _enumeration from './enumeration';\nimport _fee from './fee';\nimport _field from './field';\nimport _gasLimit from './gas-limit';\nimport _gasPrice from './gas-price';\nimport _mptree from './mptree';\nimport _name from './name';\nimport _nameFee from './name-fee';\nimport _nameId from './name-id';\nimport _pointers from './pointers';\nimport _raw from './raw';\nimport _shortUInt from './short-u-int';\nimport _shortUIntConst from './short-u-int-const';\nimport _string from './string';\nimport _uInt from './u-int';\n\n// TODO: remove after fixing https://github.com/Gerrit0/typedoc-plugin-missing-exports/issues/15\nconst abiVersion = _abiVersion;\nconst address = _address;\nconst array = _array;\nconst boolean = _boolean;\nconst coinAmount = _coinAmount;\nconst ctVersion = _ctVersion;\nconst deposit = _deposit;\nconst encoded = _encoded;\nconst entry = _entry;\nconst enumeration = _enumeration;\nconst fee = _fee;\nconst field = _field;\nconst gasLimit = _gasLimit;\nconst gasPrice = _gasPrice;\nconst mptree = _mptree;\nconst name = _name;\nconst nameFee = _nameFee;\nconst nameId = _nameId;\nconst pointers = _pointers;\nconst raw = _raw;\nconst shortUInt = _shortUInt;\nconst shortUIntConst = _shortUIntConst;\nconst string = _string;\nconst uInt = _uInt;\n\nexport type BinaryData = Buffer | Buffer[] | Buffer[][]\n| Array<[Buffer, Array<[Buffer, Buffer[]]>]>;\nexport interface Field {\n serialize: (value: any, options: any) => BinaryData;\n deserialize: (value: BinaryData, options: any) => any;\n}\n\nexport {\n abiVersion,\n address,\n array,\n boolean,\n coinAmount,\n ctVersion,\n deposit,\n encoded,\n entry,\n enumeration,\n fee,\n field,\n gasLimit,\n gasPrice,\n mptree,\n name,\n nameFee,\n nameId,\n pointers,\n raw,\n shortUInt,\n shortUIntConst,\n string,\n uInt,\n};\n"],"mappings":"OAAOA,WAAW;AAAA,OACXC,QAAQ;AAAA,OACRC,MAAM;AAAA,OACNC,QAAQ;AAAA,OACRC,WAAW;AAAA,OACXC,UAAU;AAAA,OACVC,QAAQ;AAAA,OACRC,QAAQ;AAAA,OACRC,MAAM;AAAA,OACNC,YAAY;AAAA,OACZC,IAAI;AAAA,OACJC,MAAM;AAAA,OACNC,SAAS;AAAA,OACTC,SAAS;AAAA,OACTC,OAAO;AAAA,OACPC,KAAK;AAAA,OACLC,QAAQ;AAAA,OACRC,OAAO;AAAA,OACPC,SAAS;AAAA,OACTC,IAAI;AAAA,OACJC,UAAU;AAAA,OACVC,eAAe;AAAA,OACfC,OAAO;AAAA,OACPC,KAAK,
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["_abiVersion","_address","_array","_boolean","_coinAmount","_ctVersion","_deposit","_encoded","_entry","_enumeration","_fee","_field","_gasLimit","_gasPrice","_map","_mptree","_name","_nameFee","_nameId","_nonce","_pointers","_raw","_shortUInt","_shortUIntConst","_string","_ttl","_uInt","_wrapped","abiVersion","address","array","boolean","coinAmount","ctVersion","deposit","encoded","entry","enumeration","fee","field","gasLimit","gasPrice","map","mptree","name","nameFee","nameId","nonce","pointers","raw","shortUInt","shortUIntConst","string","ttl","uInt","wrapped"],"sources":["../../../../src/tx/builder/field-types/index.ts"],"sourcesContent":["import _abiVersion from './abi-version';\nimport _address from './address';\nimport _array from './array';\nimport _boolean from './boolean';\nimport _coinAmount from './coin-amount';\nimport _ctVersion from './ct-version';\nimport _deposit from './deposit';\nimport _encoded from './encoded';\nimport _entry from './entry';\nimport _enumeration from './enumeration';\nimport _fee from './fee';\nimport _field from './field';\nimport _gasLimit from './gas-limit';\nimport _gasPrice from './gas-price';\nimport _map from './map';\nimport _mptree from './mptree';\nimport _name from './name';\nimport _nameFee from './name-fee';\nimport _nameId from './name-id';\nimport _nonce from './nonce';\nimport _pointers from './pointers';\nimport _raw from './raw';\nimport _shortUInt from './short-u-int';\nimport _shortUIntConst from './short-u-int-const';\nimport _string from './string';\nimport _ttl from './ttl';\nimport _uInt from './u-int';\nimport _wrapped from './wrapped';\n\n// TODO: remove after fixing https://github.com/Gerrit0/typedoc-plugin-missing-exports/issues/15\nconst abiVersion = _abiVersion;\nconst address = _address;\nconst array = _array;\nconst boolean = _boolean;\nconst coinAmount = _coinAmount;\nconst ctVersion = _ctVersion;\nconst deposit = _deposit;\nconst encoded = _encoded;\nconst entry = _entry;\nconst enumeration = _enumeration;\nconst fee = _fee;\nconst field = _field;\nconst gasLimit = _gasLimit;\nconst gasPrice = _gasPrice;\nconst map = _map;\nconst mptree = _mptree;\nconst name = _name;\nconst nameFee = _nameFee;\nconst nameId = _nameId;\nconst nonce = _nonce;\nconst pointers = _pointers;\nconst raw = _raw;\nconst shortUInt = _shortUInt;\nconst shortUIntConst = _shortUIntConst;\nconst string = _string;\nconst ttl = _ttl;\nconst uInt = _uInt;\nconst wrapped = _wrapped;\n\nexport type BinaryData = Buffer | Buffer[] | Buffer[][]\n| Array<[Buffer, Array<[Buffer, Buffer[]]>]>;\nexport interface Field {\n serialize: (value: any, options: any, parameters: any) => BinaryData;\n prepare?: (value: any, options: any, parameters: any) => Promise<any>;\n deserialize: (value: BinaryData, options: any) => any;\n recursiveType?: boolean;\n}\n\nexport {\n abiVersion,\n address,\n array,\n boolean,\n coinAmount,\n ctVersion,\n deposit,\n encoded,\n entry,\n enumeration,\n fee,\n field,\n gasLimit,\n gasPrice,\n map,\n mptree,\n name,\n nameFee,\n nameId,\n nonce,\n pointers,\n raw,\n shortUInt,\n shortUIntConst,\n string,\n ttl,\n uInt,\n wrapped,\n};\n"],"mappings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,MAAM6B,QAAQ,GAAG5B,SAAS;AAC1B,MAAM6B,GAAG,GAAG5B,IAAI;AAChB,MAAM6B,SAAS,GAAG5B,UAAU;AAC5B,MAAM6B,cAAc,GAAG5B,eAAe;AACtC,MAAM6B,MAAM,GAAG5B,OAAO;AACtB,MAAM6B,GAAG,GAAG5B,IAAI;AAChB,MAAM6B,IAAI,GAAG5B,KAAK;AAClB,MAAM6B,OAAO,GAAG5B,QAAQ;AAWxB,SACEC,UAAU,EACVC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,WAAW,EACXC,GAAG,EACHC,KAAK,EACLC,QAAQ,EACRC,QAAQ,EACRC,GAAG,EACHC,MAAM,EACNC,IAAI,EACJC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,QAAQ,EACRC,GAAG,EACHC,SAAS,EACTC,cAAc,EACdC,MAAM,EACNC,GAAG,EACHC,IAAI,EACJC,OAAO"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Tag } from '../constants';
|
|
3
|
+
import { Encoding, Encoded } from '../../../utils/encoder';
|
|
4
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
5
|
+
export default function genMapField<E extends Encoding, T extends Tag>(encoding: E, tag: T): {
|
|
6
|
+
serialize: (value: Record<Encoded.Generic<E>, any>, options: {
|
|
7
|
+
buildTx: typeof buildTxType;
|
|
8
|
+
}) => Buffer;
|
|
9
|
+
deserialize: (value: Buffer, options: {
|
|
10
|
+
unpackTx: typeof unpackTxType;
|
|
11
|
+
}) => Record<Encoded.Generic<E>, any>;
|
|
12
|
+
recursiveType: true;
|
|
13
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Tag } from "../constants.mjs";
|
|
2
|
+
import { encode, Encoding, decode } from "../../../utils/encoder.mjs";
|
|
3
|
+
export default function genMapField(encoding, tag) {
|
|
4
|
+
return {
|
|
5
|
+
serialize(object, _ref) {
|
|
6
|
+
let {
|
|
7
|
+
buildTx
|
|
8
|
+
} = _ref;
|
|
9
|
+
return decode(buildTx({
|
|
10
|
+
tag: Tag.Mtree,
|
|
11
|
+
values: Object.entries(object).map(_ref2 => {
|
|
12
|
+
let [key, value] = _ref2;
|
|
13
|
+
return {
|
|
14
|
+
tag: Tag.MtreeValue,
|
|
15
|
+
key: decode(key),
|
|
16
|
+
value: decode(buildTx({
|
|
17
|
+
...value,
|
|
18
|
+
tag
|
|
19
|
+
}))
|
|
20
|
+
};
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
},
|
|
24
|
+
deserialize(buffer, _ref3) {
|
|
25
|
+
let {
|
|
26
|
+
unpackTx
|
|
27
|
+
} = _ref3;
|
|
28
|
+
const {
|
|
29
|
+
values
|
|
30
|
+
} = unpackTx(encode(buffer, Encoding.Transaction), Tag.Mtree);
|
|
31
|
+
return Object.fromEntries(values
|
|
32
|
+
// TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066
|
|
33
|
+
.filter(_ref4 => {
|
|
34
|
+
let {
|
|
35
|
+
key
|
|
36
|
+
} = _ref4;
|
|
37
|
+
return encoding !== Encoding.ContractAddress || key.length === 32;
|
|
38
|
+
}).map(_ref5 => {
|
|
39
|
+
let {
|
|
40
|
+
key,
|
|
41
|
+
value
|
|
42
|
+
} = _ref5;
|
|
43
|
+
return [encode(key, encoding), unpackTx(encode(value, Encoding.Transaction), tag)];
|
|
44
|
+
}));
|
|
45
|
+
},
|
|
46
|
+
recursiveType: true
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=map.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.mjs","names":["Tag","encode","Encoding","decode","genMapField","encoding","tag","serialize","object","_ref","buildTx","Mtree","values","Object","entries","map","_ref2","key","value","MtreeValue","deserialize","buffer","_ref3","unpackTx","Transaction","fromEntries","filter","_ref4","ContractAddress","length","_ref5","recursiveType"],"sources":["../../../../src/tx/builder/field-types/map.ts"],"sourcesContent":["import { Tag } from '../constants';\nimport {\n encode, Encoding, Encoded, decode,\n} from '../../../utils/encoder';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nexport default function genMapField<E extends Encoding, T extends Tag>(encoding: E, tag: T): {\n serialize: (\n // TODO: replace with `TxParams & { tag: T }`,\n // but fix TS2502 value is referenced directly or indirectly in its own type annotation\n value: Record<Encoded.Generic<E>, any>, options: { buildTx: typeof buildTxType }\n ) => Buffer;\n deserialize: (\n value: Buffer, options: { unpackTx: typeof unpackTxType },\n // TODO: replace with `TxUnpacked & { tag: T }`,\n // TS2577 Return type annotation circularly references itself\n ) => Record<Encoded.Generic<E>, any>;\n recursiveType: true;\n} {\n return {\n serialize(object, { buildTx }) {\n return decode(buildTx({\n tag: Tag.Mtree,\n values: Object.entries(object).map(([key, value]) => ({\n tag: Tag.MtreeValue,\n key: decode(key as Encoded.Generic<E>),\n value: decode(buildTx({ ...value as any, tag })),\n })),\n }));\n },\n\n deserialize(buffer, { unpackTx }) {\n const { values } = unpackTx(encode(buffer, Encoding.Transaction), Tag.Mtree);\n return Object.fromEntries(values\n // TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066\n .filter(({ key }) => encoding !== Encoding.ContractAddress || key.length === 32)\n .map(({ key, value }) => [\n encode(key, encoding),\n unpackTx(encode(value, Encoding.Transaction), tag),\n ])) as Record<Encoded.Generic<E>, any>;\n },\n\n recursiveType: true,\n };\n}\n"],"mappings":"SAASA,GAAG;AAAA,SAEVC,MAAM,EAAEC,QAAQ,EAAWC,MAAM;AAInC,eAAe,SAASC,WAAWA,CAAoCC,QAAW,EAAEC,GAAM,EAYxF;EACA,OAAO;IACLC,SAASA,CAACC,MAAM,EAAAC,IAAA,EAAe;MAAA,IAAb;QAAEC;MAAQ,CAAC,GAAAD,IAAA;MAC3B,OAAON,MAAM,CAACO,OAAO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2
|
import { Tag } from '../constants';
|
|
3
3
|
import { Encoded, Encoding } from '../../../utils/encoder';
|
|
4
4
|
import type { unpackTx } from '..';
|
|
5
|
+
import type { TxUnpacked } from '../schema.generated';
|
|
5
6
|
type MPTreeBinary = [Buffer, Array<[Buffer, Buffer[]]>];
|
|
6
7
|
declare class MPTree<E extends Encoding, T extends Tag> {
|
|
7
8
|
#private;
|
|
@@ -25,8 +26,12 @@ declare class MPTree<E extends Encoding, T extends Tag> {
|
|
|
25
26
|
* @param key - The key of the element to retrieve
|
|
26
27
|
* @returns Value associated to the specified key
|
|
27
28
|
*/
|
|
28
|
-
get(key: Encoded.Generic<E>):
|
|
29
|
-
|
|
29
|
+
get(key: Encoded.Generic<E>): TxUnpacked & {
|
|
30
|
+
tag: T;
|
|
31
|
+
} | undefined;
|
|
32
|
+
toObject(): Record<Encoded.Generic<E>, TxUnpacked & {
|
|
33
|
+
tag: T;
|
|
34
|
+
}>;
|
|
30
35
|
}
|
|
31
36
|
export default function genMPTreeField<E extends Encoding, T extends Tag>(encoding: E, tag: T): {
|
|
32
37
|
serialize: (value: MPTree<E, T>) => MPTreeBinary;
|
|
@@ -44,6 +44,11 @@ class MPTree {
|
|
|
44
44
|
*/
|
|
45
45
|
constructor(binary, encoding, tag, unpTx) {
|
|
46
46
|
_classPrivateMethodInitSpec(this, _entriesRaw);
|
|
47
|
+
/**
|
|
48
|
+
* Retrieve value from Merkle Patricia Tree
|
|
49
|
+
* @param _key - The key of the element to retrieve
|
|
50
|
+
* @returns Value associated to the specified key
|
|
51
|
+
*/
|
|
47
52
|
_classPrivateMethodInitSpec(this, _getRaw);
|
|
48
53
|
_classPrivateFieldInitSpec(this, _rootHash, {
|
|
49
54
|
writable: true,
|
|
@@ -122,13 +127,6 @@ class MPTree {
|
|
|
122
127
|
return [_Buffer.from(mptHash, 'hex'), value];
|
|
123
128
|
})];
|
|
124
129
|
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Retrieve value from Merkle Patricia Tree
|
|
128
|
-
* @param _key - The key of the element to retrieve
|
|
129
|
-
* @returns Value associated to the specified key
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
130
|
/**
|
|
133
131
|
* Retrieve value from Merkle Patricia Tree
|
|
134
132
|
* @param key - The key of the element to retrieve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mptree.mjs","names":["hash","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownPathNibbleError","UnexpectedTsError","UnknownNodeLengthError","InternalError","decode","encode","Encoding","NodeType","MPTree","isComplete","constructor","binary","encoding","tag","unpTx","toString","Object","fromEntries","map","node","keys","length","entries","forEach","key","type","Branch","slice","filter","n","Extension","Leaf","isEqual","tree","serialize","from","mptHash","value","get","d","Transaction","toObject","k","ContractAddress","v","rlpEncode","nibble","includes","path","_key","searchFrom","undefined","substring","rec","t","idx","push","genMPTreeField","deserialize","unpackTx"],"sources":["../../../../src/tx/builder/field-types/mptree.ts"],"sourcesContent":["import { encode as rlpEncode, Input } from 'rlp';\nimport { Tag } from '../constants';\nimport { hash } from '../../../utils/crypto';\nimport {\n MerkleTreeHashMismatchError,\n MissingNodeInTreeError,\n UnknownPathNibbleError,\n UnexpectedTsError,\n UnknownNodeLengthError,\n InternalError,\n} from '../../../utils/errors';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport type { unpackTx } from '..';\n\nenum NodeType {\n Branch,\n Extension,\n Leaf,\n}\n\ntype MPTreeBinary = [Buffer, Array<[Buffer, Buffer[]]>];\n\nclass MPTree<E extends Encoding, T extends Tag> {\n readonly #rootHash: string;\n\n #isComplete = true;\n\n get isComplete(): boolean {\n return this.#isComplete;\n }\n\n readonly #nodes: { [key: string]: Buffer[] };\n\n readonly #encoding: E;\n\n readonly #tag: T;\n\n readonly #unpackTx: typeof unpackTx;\n\n static #nodeHash(node: Input): string {\n return Buffer.from(hash(rlpEncode(node))).toString('hex');\n }\n\n /**\n * Deserialize Merkle Patricia Tree\n * @param binary - Binary\n * @param tag - Tag to use to decode value\n * @param unpTx - Implementation of unpackTx use to decode values\n * @returns Merkle Patricia Tree\n */\n constructor(binary: MPTreeBinary, encoding: E, tag: T, unpTx: typeof unpackTx) {\n this.#encoding = encoding;\n this.#tag = tag;\n this.#unpackTx = unpTx;\n this.#rootHash = binary[0].toString('hex');\n this.#nodes = Object.fromEntries(\n binary[1].map((node) => [node[0].toString('hex'), node[1]]),\n );\n\n if (this.#nodes[this.#rootHash] == null) {\n if (Object.keys(this.#nodes).length !== 0) {\n throw new MissingNodeInTreeError('Can\\'t find a node by root hash');\n }\n this.#isComplete = false;\n return;\n }\n Object.entries(this.#nodes).forEach(([key, node]) => {\n if (MPTree.#nodeHash(node) !== key) throw new MerkleTreeHashMismatchError();\n const { type } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n node\n .slice(0, 16)\n .filter((n) => n.length)\n .forEach((n) => {\n // TODO: enable after resolving https://github.com/aeternity/aeternity/issues/4066\n // if (n.length !== 32) {\n // throw new ArgumentError('MPTree branch item length', 32, n.length);\n // }\n if (this.#nodes[n.toString('hex')] == null) this.#isComplete = false;\n });\n break;\n case NodeType.Extension:\n if (this.#nodes[node[1].toString('hex')] == null) {\n throw new MissingNodeInTreeError('Can\\'t find a node by hash in extension node');\n }\n break;\n case NodeType.Leaf:\n break;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n });\n }\n\n isEqual(tree: MPTree<E, T>): boolean {\n return this.#rootHash === tree.#rootHash;\n }\n\n static #parseNode(node: Buffer[]): { type: NodeType; value?: Buffer; path?: string } {\n switch (node.length) {\n case 17:\n return {\n type: NodeType.Branch,\n ...node[16].length !== 0 && { value: node[16] },\n };\n case 2: {\n const nibble = node[0][0] >> 4; // eslint-disable-line no-bitwise\n if (nibble > 3) throw new UnknownPathNibbleError(nibble);\n const type = nibble <= 1 ? NodeType.Extension : NodeType.Leaf;\n const slice = [0, 2].includes(nibble) ? 2 : 1;\n return {\n type,\n ...type === NodeType.Leaf && { value: node[1] },\n path: node[0].toString('hex').slice(slice),\n };\n }\n default:\n throw new UnknownNodeLengthError(node.length);\n }\n }\n\n /**\n * Serialize Merkle Patricia Tree\n * @returns Binary\n */\n serialize(): MPTreeBinary {\n return [\n Buffer.from(this.#rootHash, 'hex'),\n Object.entries(this.#nodes).map(([mptHash, value]) => ([\n Buffer.from(mptHash, 'hex'),\n value,\n ])),\n ];\n }\n\n /**\n * Retrieve value from Merkle Patricia Tree\n * @param _key - The key of the element to retrieve\n * @returns Value associated to the specified key\n */\n #getRaw(_key: string): Buffer | undefined {\n let searchFrom = this.#rootHash;\n let key = _key;\n while (true) { // eslint-disable-line no-constant-condition\n const node = this.#nodes[searchFrom];\n if (node == null) {\n if (!this.isComplete) return undefined;\n throw new InternalError('Can\\'t find node in complete tree');\n }\n const { type, value, path } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n if (key.length === 0) return value;\n searchFrom = node[+`0x${key[0]}`].toString('hex');\n key = key.substring(1);\n break;\n case NodeType.Extension:\n if (key.substring(0, path?.length) !== path) return undefined;\n searchFrom = node[1].toString('hex');\n key = key.substring(path.length);\n break;\n case NodeType.Leaf:\n if (path !== key) return undefined;\n return value;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n }\n }\n\n /**\n * Retrieve value from Merkle Patricia Tree\n * @param key - The key of the element to retrieve\n * @returns Value associated to the specified key\n */\n get(key: Encoded.Generic<E>): ReturnType<typeof unpackTx<T>> | undefined {\n const d = this.#getRaw(decode(key).toString('hex'));\n if (d == null) return d;\n return this.#unpackTx(encode(d, Encoding.Transaction), this.#tag);\n }\n\n #entriesRaw(): Array<[string, Buffer]> {\n const entries: Array<[string, Buffer]> = [];\n const rec = (searchFrom: string, key: string): void => {\n const node = this.#nodes[searchFrom];\n if (node == null) {\n if (!this.isComplete) return;\n throw new InternalError('Can\\'t find node in complete tree');\n }\n const { type, value, path } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n node\n .slice(0, 16)\n .map((t, idx): [typeof t, number] => [t, idx])\n .filter(([t]) => t.length)\n .forEach(([t, idx]) => rec(t.toString('hex'), key + idx.toString(16)));\n if (value != null) entries.push([key, value]);\n break;\n case NodeType.Extension:\n rec(node[1].toString('hex'), key + path);\n break;\n case NodeType.Leaf:\n if (value == null) throw new UnexpectedTsError();\n entries.push([key + path, value]);\n break;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n };\n rec(this.#rootHash, '');\n return entries;\n }\n\n toObject(): Record<Encoded.Any, ReturnType<typeof unpackTx<T>>> {\n return Object.fromEntries(this.#entriesRaw()\n // TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066\n .filter(([k]) => this.#encoding !== Encoding.ContractAddress || k.length !== 66)\n .map(([k, v]) => [\n encode(Buffer.from(k, 'hex'), this.#encoding),\n this.#unpackTx(encode(v, Encoding.Transaction), this.#tag),\n ]));\n }\n}\n\nexport default function genMPTreeField<E extends Encoding, T extends Tag>(encoding: E, tag: T): {\n serialize: (value: MPTree<E, T>) => MPTreeBinary;\n deserialize: (value: MPTreeBinary, o: { unpackTx: typeof unpackTx }) => MPTree<E, T>;\n} {\n return {\n serialize(value) {\n return value.serialize();\n },\n\n deserialize(value, { unpackTx }) {\n return new MPTree(value, encoding, tag, unpackTx);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAAA,iBAA2C,KAAK;AAAC;EAAA;AAAA;AAAA,SAExCA,IAAI;AAAA,SAEXC,2BAA2B,EAC3BC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,sBAAsB,EACtBC,aAAa;AAAA,SAGbC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,IAI9BC,QAAQ;AAAA,WAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;AAAA,GAARA,QAAQ,KAARA,QAAQ;AAAA;AAAA;AAAA;A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E;MACf,OAAOA,KAAK,CAACH,SAAS,EAAE;IAC1B,CAAC;IAEDwB,WAAW,CAACrB,KAAK,SAAgB;MAAA,IAAd;QAAEsB;MAAS,CAAC;MAC7B,OAAO,IAAInD,MAAM,CAAC6B,KAAK,EAAEzB,QAAQ,EAAEC,GAAG,EAAE8C,QAAQ,CAAC;IACnD;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"mptree.mjs","names":["_rlp","encode","rlpEncode","hash","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownPathNibbleError","UnexpectedTsError","UnknownNodeLengthError","InternalError","decode","Encoding","NodeType","_rootHash","WeakMap","_isComplete","_nodes","_encoding","_tag","_unpackTx","_getRaw","WeakSet","_entriesRaw","MPTree","isComplete","_classPrivateFieldGet","constructor","binary","encoding","tag","unpTx","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","_classPrivateFieldSet","toString","Object","fromEntries","map","node","keys","length","entries","forEach","_ref","key","_classStaticPrivateMethodGet","_nodeHash","call","type","_parseNode","Branch","slice","filter","n","Extension","Leaf","isEqual","tree","serialize","_Buffer","from","_ref2","mptHash","get","d","_classPrivateMethodGet","_getRaw2","Transaction","toObject","_entriesRaw2","_ref3","k","ContractAddress","_ref4","v","nibble","includes","path","_key","searchFrom","undefined","substring","rec","t","idx","_ref6","_ref7","push","genMPTreeField","deserialize","_ref5","unpackTx"],"sources":["../../../../src/tx/builder/field-types/mptree.ts"],"sourcesContent":["import { encode as rlpEncode, Input } from 'rlp';\nimport { Tag } from '../constants';\nimport { hash } from '../../../utils/crypto';\nimport {\n MerkleTreeHashMismatchError,\n MissingNodeInTreeError,\n UnknownPathNibbleError,\n UnexpectedTsError,\n UnknownNodeLengthError,\n InternalError,\n} from '../../../utils/errors';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport type { unpackTx } from '..';\nimport type { TxUnpacked } from '../schema.generated';\n\nenum NodeType {\n Branch,\n Extension,\n Leaf,\n}\n\ntype MPTreeBinary = [Buffer, Array<[Buffer, Buffer[]]>];\n\nclass MPTree<E extends Encoding, T extends Tag> {\n readonly #rootHash: string;\n\n #isComplete = true;\n\n get isComplete(): boolean {\n return this.#isComplete;\n }\n\n readonly #nodes: { [key: string]: Buffer[] };\n\n readonly #encoding: E;\n\n readonly #tag: T;\n\n readonly #unpackTx: typeof unpackTx;\n\n static #nodeHash(node: Input): string {\n return Buffer.from(hash(rlpEncode(node))).toString('hex');\n }\n\n /**\n * Deserialize Merkle Patricia Tree\n * @param binary - Binary\n * @param tag - Tag to use to decode value\n * @param unpTx - Implementation of unpackTx use to decode values\n * @returns Merkle Patricia Tree\n */\n constructor(binary: MPTreeBinary, encoding: E, tag: T, unpTx: typeof unpackTx) {\n this.#encoding = encoding;\n this.#tag = tag;\n this.#unpackTx = unpTx;\n this.#rootHash = binary[0].toString('hex');\n this.#nodes = Object.fromEntries(\n binary[1].map((node) => [node[0].toString('hex'), node[1]]),\n );\n\n if (this.#nodes[this.#rootHash] == null) {\n if (Object.keys(this.#nodes).length !== 0) {\n throw new MissingNodeInTreeError('Can\\'t find a node by root hash');\n }\n this.#isComplete = false;\n return;\n }\n Object.entries(this.#nodes).forEach(([key, node]) => {\n if (MPTree.#nodeHash(node) !== key) throw new MerkleTreeHashMismatchError();\n const { type } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n node\n .slice(0, 16)\n .filter((n) => n.length)\n .forEach((n) => {\n // TODO: enable after resolving https://github.com/aeternity/aeternity/issues/4066\n // if (n.length !== 32) {\n // throw new ArgumentError('MPTree branch item length', 32, n.length);\n // }\n if (this.#nodes[n.toString('hex')] == null) this.#isComplete = false;\n });\n break;\n case NodeType.Extension:\n if (this.#nodes[node[1].toString('hex')] == null) {\n throw new MissingNodeInTreeError('Can\\'t find a node by hash in extension node');\n }\n break;\n case NodeType.Leaf:\n break;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n });\n }\n\n isEqual(tree: MPTree<E, T>): boolean {\n return this.#rootHash === tree.#rootHash;\n }\n\n static #parseNode(node: Buffer[]): { type: NodeType; value?: Buffer; path?: string } {\n switch (node.length) {\n case 17:\n return {\n type: NodeType.Branch,\n ...node[16].length !== 0 && { value: node[16] },\n };\n case 2: {\n const nibble = node[0][0] >> 4; // eslint-disable-line no-bitwise\n if (nibble > 3) throw new UnknownPathNibbleError(nibble);\n const type = nibble <= 1 ? NodeType.Extension : NodeType.Leaf;\n const slice = [0, 2].includes(nibble) ? 2 : 1;\n return {\n type,\n ...type === NodeType.Leaf && { value: node[1] },\n path: node[0].toString('hex').slice(slice),\n };\n }\n default:\n throw new UnknownNodeLengthError(node.length);\n }\n }\n\n /**\n * Serialize Merkle Patricia Tree\n * @returns Binary\n */\n serialize(): MPTreeBinary {\n return [\n Buffer.from(this.#rootHash, 'hex'),\n Object.entries(this.#nodes).map(([mptHash, value]) => ([\n Buffer.from(mptHash, 'hex'),\n value,\n ])),\n ];\n }\n\n /**\n * Retrieve value from Merkle Patricia Tree\n * @param _key - The key of the element to retrieve\n * @returns Value associated to the specified key\n */\n #getRaw(_key: string): Buffer | undefined {\n let searchFrom = this.#rootHash;\n let key = _key;\n while (true) { // eslint-disable-line no-constant-condition\n const node = this.#nodes[searchFrom];\n if (node == null) {\n if (!this.isComplete) return undefined;\n throw new InternalError('Can\\'t find node in complete tree');\n }\n const { type, value, path } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n if (key.length === 0) return value;\n searchFrom = node[+`0x${key[0]}`].toString('hex');\n key = key.substring(1);\n break;\n case NodeType.Extension:\n if (key.substring(0, path?.length) !== path) return undefined;\n searchFrom = node[1].toString('hex');\n key = key.substring(path.length);\n break;\n case NodeType.Leaf:\n if (path !== key) return undefined;\n return value;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n }\n }\n\n /**\n * Retrieve value from Merkle Patricia Tree\n * @param key - The key of the element to retrieve\n * @returns Value associated to the specified key\n */\n get(key: Encoded.Generic<E>): TxUnpacked & { tag: T } | undefined {\n const d = this.#getRaw(decode(key).toString('hex'));\n if (d == null) return d;\n return this.#unpackTx(encode(d, Encoding.Transaction), this.#tag);\n }\n\n #entriesRaw(): Array<[string, Buffer]> {\n const entries: Array<[string, Buffer]> = [];\n const rec = (searchFrom: string, key: string): void => {\n const node = this.#nodes[searchFrom];\n if (node == null) {\n if (!this.isComplete) return;\n throw new InternalError('Can\\'t find node in complete tree');\n }\n const { type, value, path } = MPTree.#parseNode(node);\n switch (type) {\n case NodeType.Branch:\n node\n .slice(0, 16)\n .map((t, idx): [typeof t, number] => [t, idx])\n .filter(([t]) => t.length)\n .forEach(([t, idx]) => rec(t.toString('hex'), key + idx.toString(16)));\n if (value != null) entries.push([key, value]);\n break;\n case NodeType.Extension:\n rec(node[1].toString('hex'), key + path);\n break;\n case NodeType.Leaf:\n if (value == null) throw new UnexpectedTsError();\n entries.push([key + path, value]);\n break;\n default:\n throw new InternalError(`Unknown MPTree node type: ${type}`);\n }\n };\n rec(this.#rootHash, '');\n return entries;\n }\n\n toObject(): Record<Encoded.Generic<E>, TxUnpacked & { tag: T }> {\n return Object.fromEntries(this.#entriesRaw()\n // TODO: remove after resolving https://github.com/aeternity/aeternity/issues/4066\n .filter(([k]) => this.#encoding !== Encoding.ContractAddress || k.length !== 66)\n .map(([k, v]) => [\n encode(Buffer.from(k, 'hex'), this.#encoding),\n this.#unpackTx(encode(v, Encoding.Transaction), this.#tag),\n ])) as Record<Encoded.Generic<E>, TxUnpacked & { tag: T }>;\n }\n}\n\nexport default function genMPTreeField<E extends Encoding, T extends Tag>(encoding: E, tag: T): {\n serialize: (value: MPTree<E, T>) => MPTreeBinary;\n deserialize: (value: MPTreeBinary, o: { unpackTx: typeof unpackTx }) => MPTree<E, T>;\n} {\n return {\n serialize(value) {\n return value.serialize();\n },\n\n deserialize(value, { unpackTx }) {\n return new MPTree(value, encoding, tag, unpackTx);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAAA,IA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Int | undefined, txFields: {
|
|
14
14
|
name: AensName;
|
|
15
|
-
} & Parameters<(typeof coinAmount)['serialize']>[1]): Buffer;
|
|
15
|
+
} & Parameters<(typeof coinAmount)['serialize']>[1], parameters: Parameters<(typeof coinAmount)['serialize']>[2]): Buffer;
|
|
16
16
|
deserialize(value: Buffer): string;
|
|
17
17
|
};
|
|
18
18
|
export default _default;
|
|
@@ -15,8 +15,8 @@ export default {
|
|
|
15
15
|
* @param txFields - Transaction fields
|
|
16
16
|
* @param txFields.name - AENS Name in transaction
|
|
17
17
|
*/
|
|
18
|
-
serialize(value, txFields) {
|
|
19
|
-
return coinAmount.serialize.call(this, value, txFields);
|
|
18
|
+
serialize(value, txFields, parameters) {
|
|
19
|
+
return coinAmount.serialize.call(this, value, txFields, parameters);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=name-fee.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-fee.mjs","names":["BigNumber","getMinimumNameFee","InsufficientNameFeeError","coinAmount","serializeAettos","_value","txFields","minNameFee","name","value","gt","toFixed","serialize","call"],"sources":["../../../../src/tx/builder/field-types/name-fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { getMinimumNameFee } from '../helpers';\nimport { InsufficientNameFeeError } from '../../../utils/errors';\nimport coinAmount from './coin-amount';\nimport { AensName, Int } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n txFields: { name: AensName },\n ): string {\n const minNameFee = getMinimumNameFee(txFields.name);\n const value = new BigNumber(_value ?? minNameFee);\n if (minNameFee.gt(value)) throw new InsufficientNameFeeError(value, minNameFee);\n return value.toFixed();\n },\n\n /**\n * @param value - AENS name fee Buffer\n * @param txFields - Transaction fields\n * @param txFields.name - AENS Name in transaction\n */\n serialize(\n value: Int | undefined,\n txFields: { name: AensName } & Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n return coinAmount.serialize.call(this, value, txFields);\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,iBAAiB;AAAA,SACjBC,wBAAwB;AAAA,OAC1BC,UAAU;AAGjB,eAAe;EACb,GAAGA,UAAU;EAEbC,
|
|
1
|
+
{"version":3,"file":"name-fee.mjs","names":["BigNumber","getMinimumNameFee","InsufficientNameFeeError","coinAmount","serializeAettos","_value","txFields","minNameFee","name","value","gt","toFixed","serialize","parameters","call"],"sources":["../../../../src/tx/builder/field-types/name-fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { getMinimumNameFee } from '../helpers';\nimport { InsufficientNameFeeError } from '../../../utils/errors';\nimport coinAmount from './coin-amount';\nimport { AensName, Int } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n txFields: { name: AensName },\n ): string {\n const minNameFee = getMinimumNameFee(txFields.name);\n const value = new BigNumber(_value ?? minNameFee);\n if (minNameFee.gt(value)) throw new InsufficientNameFeeError(value, minNameFee);\n return value.toFixed();\n },\n\n /**\n * @param value - AENS name fee Buffer\n * @param txFields - Transaction fields\n * @param txFields.name - AENS Name in transaction\n */\n serialize(\n value: Int | undefined,\n txFields: { name: AensName } & Parameters<typeof coinAmount['serialize']>[1],\n parameters: Parameters<typeof coinAmount['serialize']>[2],\n ): Buffer {\n return coinAmount.serialize.call(this, value, txFields, parameters);\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,iBAAiB;AAAA,SACjBC,wBAAwB;AAAA,OAC1BC,UAAU;AAGjB,eAAe;EACb,GAAGA,UAAU;EAEbC,eAAeA,CACbC,MAA0B,EAC1BC,QAA4B,EACpB;IACR,MAAMC,UAAU,GAAGN,iBAAiB,CAACK,QAAQ,CAACE,IAAI,CAAC;IACnD,MAAMC,KAAK,GAAG,IAAIT,SAAS,CAACK,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIE,UAAU,CAAC;IACjD,IAAIA,UAAU,CAACG,EAAE,CAACD,KAAK,CAAC,EAAE,MAAM,IAAIP,wBAAwB,CAACO,KAAK,EAAEF,UAAU,CAAC;IAC/E,OAAOE,KAAK,CAACE,OAAO,EAAE;EACxB,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,SAASA,CACPH,KAAsB,EACtBH,QAA4E,EAC5EO,UAAyD,EACjD;IACR,OAAOV,UAAU,CAACS,SAAS,CAACE,IAAI,CAAC,IAAI,EAAEL,KAAK,EAAEH,QAAQ,EAAEO,UAAU,CAAC;EACrE;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-id.mjs","names":["produceNameId","isNameValid","address","Encoding","addressName","Name","serialize","value"],"sources":["../../../../src/tx/builder/field-types/name-id.ts"],"sourcesContent":["import { AensName } from '../constants';\nimport { produceNameId, isNameValid } from '../helpers';\nimport address from './address';\nimport { Encoded, Encoding } from '../../../utils/encoder';\n\nconst addressName = address(Encoding.Name);\n\nexport default {\n ...addressName,\n\n /**\n * @param value - AENS name ID\n */\n serialize(value: AensName | Encoded.Name): Buffer {\n return addressName.serialize(isNameValid(value) ? produceNameId(value) : value);\n },\n};\n"],"mappings":"SACSA,aAAa,EAAEC,WAAW;AAAA,OAC5BC,OAAO;AAAA,SACIC,QAAQ;AAE1B,MAAMC,WAAW,GAAGF,OAAO,CAACC,QAAQ,CAACE,IAAI,CAAC;AAE1C,eAAe;EACb,GAAGD,WAAW;EAEd;AACF;AACA;EACEE,
|
|
1
|
+
{"version":3,"file":"name-id.mjs","names":["produceNameId","isNameValid","address","Encoding","addressName","Name","serialize","value"],"sources":["../../../../src/tx/builder/field-types/name-id.ts"],"sourcesContent":["import { AensName } from '../constants';\nimport { produceNameId, isNameValid } from '../helpers';\nimport address from './address';\nimport { Encoded, Encoding } from '../../../utils/encoder';\n\nconst addressName = address(Encoding.Name);\n\nexport default {\n ...addressName,\n\n /**\n * @param value - AENS name ID\n */\n serialize(value: AensName | Encoded.Name): Buffer {\n return addressName.serialize(isNameValid(value) ? produceNameId(value) : value);\n },\n};\n"],"mappings":"SACSA,aAAa,EAAEC,WAAW;AAAA,OAC5BC,OAAO;AAAA,SACIC,QAAQ;AAE1B,MAAMC,WAAW,GAAGF,OAAO,CAACC,QAAQ,CAACE,IAAI,CAAC;AAE1C,eAAe;EACb,GAAGD,WAAW;EAEd;AACF;AACA;EACEE,SAASA,CAACC,KAA8B,EAAU;IAChD,OAAOH,WAAW,CAACE,SAAS,CAACL,WAAW,CAACM,KAAK,CAAC,GAAGP,aAAa,CAACO,KAAK,CAAC,GAAGA,KAAK,CAAC;EACjF;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name.mjs","names":["field","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/name.ts"],"sourcesContent":["import field from './field';\nimport { AensName } from '../constants';\n\nexport default {\n /**\n * @param value - AENS name\n */\n serialize(value: AensName): Buffer {\n return field.serialize(value);\n },\n\n /**\n * @param value - AENS name\n */\n deserialize(value: Buffer): AensName {\n return field.deserialize(value) as AensName;\n },\n};\n"],"mappings":"OAAOA,KAAK;AAGZ,eAAe;EACb;AACF;AACA;EACEC,
|
|
1
|
+
{"version":3,"file":"name.mjs","names":["field","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/name.ts"],"sourcesContent":["import field from './field';\nimport { AensName } from '../constants';\n\nexport default {\n /**\n * @param value - AENS name\n */\n serialize(value: AensName): Buffer {\n return field.serialize(value);\n },\n\n /**\n * @param value - AENS name\n */\n deserialize(value: Buffer): AensName {\n return field.deserialize(value) as AensName;\n },\n};\n"],"mappings":"OAAOA,KAAK;AAGZ,eAAe;EACb;AACF;AACA;EACEC,SAASA,CAACC,KAAe,EAAU;IACjC,OAAOF,KAAK,CAACC,SAAS,CAACC,KAAK,CAAC;EAC/B,CAAC;EAED;AACF;AACA;EACEC,WAAWA,CAACD,KAAa,EAAY;IACnC,OAAOF,KAAK,CAACG,WAAW,CAACD,KAAK,CAAC;EACjC;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Node from '../../../Node';
|
|
3
|
+
import { NextNonceStrategy } from '../../../apis/node';
|
|
4
|
+
export default function genNonceField<SenderKey extends string>(senderKey: SenderKey): {
|
|
5
|
+
serialize: (value: number) => Buffer;
|
|
6
|
+
prepare: (value: number | undefined, params: {}, options: {
|
|
7
|
+
[key in SenderKey]: string;
|
|
8
|
+
} & {
|
|
9
|
+
strategy?: NextNonceStrategy;
|
|
10
|
+
onNode?: Node;
|
|
11
|
+
}) => Promise<number>;
|
|
12
|
+
deserialize: (value: Buffer) => number;
|
|
13
|
+
senderKey: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isAccountNotFoundError } from "../../../utils/other.mjs";
|
|
2
|
+
import shortUInt from "./short-u-int.mjs";
|
|
3
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
4
|
+
export default function genNonceField(senderKey) {
|
|
5
|
+
return {
|
|
6
|
+
...shortUInt,
|
|
7
|
+
async prepare(value, params, options) {
|
|
8
|
+
if (value != null) return value;
|
|
9
|
+
const {
|
|
10
|
+
onNode,
|
|
11
|
+
strategy
|
|
12
|
+
} = options;
|
|
13
|
+
const senderId = options[senderKey];
|
|
14
|
+
const requirement = 'provided (or provide `nonce` instead)';
|
|
15
|
+
if (onNode == null) throw new ArgumentError('onNode', requirement, onNode);
|
|
16
|
+
if (senderId == null) throw new ArgumentError('senderId', requirement, senderId);
|
|
17
|
+
return (await onNode.getAccountNextNonce(senderId.replace(/^ok_/, 'ak_'), {
|
|
18
|
+
strategy
|
|
19
|
+
}).catch(error => {
|
|
20
|
+
if (!isAccountNotFoundError(error)) throw error;
|
|
21
|
+
return {
|
|
22
|
+
nextNonce: 1
|
|
23
|
+
};
|
|
24
|
+
})).nextNonce;
|
|
25
|
+
},
|
|
26
|
+
senderKey
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=nonce.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.mjs","names":["isAccountNotFoundError","shortUInt","ArgumentError","genNonceField","senderKey","prepare","value","params","options","onNode","strategy","senderId","requirement","getAccountNextNonce","replace","catch","error","nextNonce"],"sources":["../../../../src/tx/builder/field-types/nonce.ts"],"sourcesContent":["import { isAccountNotFoundError } from '../../../utils/other';\nimport shortUInt from './short-u-int';\nimport Node from '../../../Node';\nimport { ArgumentError } from '../../../utils/errors';\nimport { NextNonceStrategy } from '../../../apis/node';\n\nexport default function genNonceField<SenderKey extends string>(senderKey: SenderKey): {\n serialize: (value: number) => Buffer;\n // TODO: (value: number) => Promise<number> | (value: undefined, ...) => Promise<number>\n prepare: (\n value: number | undefined,\n params: {},\n // TODO: replace `string` with AddressEncodings\n options: { [key in SenderKey]: string } & { strategy?: NextNonceStrategy; onNode?: Node },\n ) => Promise<number>;\n deserialize: (value: Buffer) => number;\n senderKey: string;\n} {\n return {\n ...shortUInt,\n\n async prepare(value, params, options) {\n if (value != null) return value;\n const { onNode, strategy } = options;\n const senderId = options[senderKey];\n const requirement = 'provided (or provide `nonce` instead)';\n if (onNode == null) throw new ArgumentError('onNode', requirement, onNode);\n if (senderId == null) throw new ArgumentError('senderId', requirement, senderId);\n return (\n await onNode.getAccountNextNonce(senderId.replace(/^ok_/, 'ak_'), { strategy })\n .catch((error) => {\n if (!isAccountNotFoundError(error)) throw error;\n return { nextNonce: 1 };\n })\n ).nextNonce;\n },\n\n senderKey,\n };\n}\n"],"mappings":"SAASA,sBAAsB;AAAA,OACxBC,SAAS;AAAA,SAEPC,aAAa;AAGtB,eAAe,SAASC,aAAaA,CAA2BC,SAAoB,EAWlF;EACA,OAAO;IACL,GAAGH,SAAS;IAEZ,MAAMI,OAAOA,CAACC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAE;MACpC,IAAIF,KAAK,IAAI,IAAI,EAAE,OAAOA,KAAK;MAC/B,MAAM;QAAEG,MAAM;QAAEC;MAAS,CAAC,GAAGF,OAAO;MACpC,MAAMG,QAAQ,GAAGH,OAAO,CAACJ,SAAS,CAAC;MACnC,MAAMQ,WAAW,GAAG,uCAAuC;MAC3D,IAAIH,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIP,aAAa,CAAC,QAAQ,EAAEU,WAAW,EAAEH,MAAM,CAAC;MAC1E,IAAIE,QAAQ,IAAI,IAAI,EAAE,MAAM,IAAIT,aAAa,CAAC,UAAU,EAAEU,WAAW,EAAED,QAAQ,CAAC;MAChF,OAAO,CACL,MAAMF,MAAM,CAACI,mBAAmB,CAACF,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;QAAEJ;MAAS,CAAC,CAAC,CAC5EK,KAAK,CAAEC,KAAK,IAAK;QAChB,IAAI,CAAChB,sBAAsB,CAACgB,KAAK,CAAC,EAAE,MAAMA,KAAK;QAC/C,OAAO;UAAEC,SAAS,EAAE;QAAE,CAAC;MACzB,CAAC,CAAC,EACJA,SAAS;IACb,CAAC;IAEDb;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointers.mjs","names":["toBytes","IllegalArgumentError","address","idTagToEncoding","addressAny","serialize","pointers","length","map","pointer","key","id","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/pointers.ts"],"sourcesContent":["import { NamePointer as NamePointerString } from '../../../apis/node';\nimport { toBytes } from '../../../utils/bytes';\nimport { Encoded } from '../../../utils/encoder';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport address, { AddressEncodings, idTagToEncoding } from './address';\n\nconst addressAny = address(...idTagToEncoding);\n\n// TODO: remove after fixing node types\ntype NamePointer = NamePointerString & {\n id: Encoded.Generic<AddressEncodings>;\n};\n\nexport default {\n /**\n * Helper function to build pointers for name update TX\n * @param pointers - Array of pointers\n * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`\n * @returns Serialized pointers array\n */\n serialize(pointers: NamePointer[]): Buffer[][] {\n if (pointers.length > 32) {\n throw new IllegalArgumentError(`Expected 32 pointers or less, got ${pointers.length} instead`);\n }\n\n return pointers.map(\n (pointer) => [toBytes(pointer.key), addressAny.serialize(pointer.id)],\n );\n },\n\n /**\n * Helper function to read pointers from name update TX\n * @param pointers - Array of pointers\n * @returns Deserialize pointer array\n */\n deserialize(pointers: Array<[key: Buffer, id: Buffer]>): NamePointer[] {\n return pointers.map(\n ([key, id]) => ({ key: key.toString(), id: addressAny.deserialize(id) }),\n );\n },\n};\n"],"mappings":"SACSA,OAAO;AAAA,SAEPC,oBAAoB;AAAA,OACtBC,OAAO,IAAsBC,eAAe;AAEnD,MAAMC,UAAU,GAAGF,OAAO,CAAC,GAAGC,eAAe,CAAC;;AAE9C;;AAKA,eAAe;EACb;AACF;AACA;AACA;AACA;AACA;EACEE,
|
|
1
|
+
{"version":3,"file":"pointers.mjs","names":["toBytes","IllegalArgumentError","address","idTagToEncoding","addressAny","serialize","pointers","length","map","pointer","key","id","deserialize","_ref","toString"],"sources":["../../../../src/tx/builder/field-types/pointers.ts"],"sourcesContent":["import { NamePointer as NamePointerString } from '../../../apis/node';\nimport { toBytes } from '../../../utils/bytes';\nimport { Encoded } from '../../../utils/encoder';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport address, { AddressEncodings, idTagToEncoding } from './address';\n\nconst addressAny = address(...idTagToEncoding);\n\n// TODO: remove after fixing node types\ntype NamePointer = NamePointerString & {\n id: Encoded.Generic<AddressEncodings>;\n};\n\nexport default {\n /**\n * Helper function to build pointers for name update TX\n * @param pointers - Array of pointers\n * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`\n * @returns Serialized pointers array\n */\n serialize(pointers: NamePointer[]): Buffer[][] {\n if (pointers.length > 32) {\n throw new IllegalArgumentError(`Expected 32 pointers or less, got ${pointers.length} instead`);\n }\n\n return pointers.map(\n (pointer) => [toBytes(pointer.key), addressAny.serialize(pointer.id)],\n );\n },\n\n /**\n * Helper function to read pointers from name update TX\n * @param pointers - Array of pointers\n * @returns Deserialize pointer array\n */\n deserialize(pointers: Array<[key: Buffer, id: Buffer]>): NamePointer[] {\n return pointers.map(\n ([key, id]) => ({ key: key.toString(), id: addressAny.deserialize(id) }),\n );\n },\n};\n"],"mappings":"SACSA,OAAO;AAAA,SAEPC,oBAAoB;AAAA,OACtBC,OAAO,IAAsBC,eAAe;AAEnD,MAAMC,UAAU,GAAGF,OAAO,CAAC,GAAGC,eAAe,CAAC;;AAE9C;;AAKA,eAAe;EACb;AACF;AACA;AACA;AACA;AACA;EACEE,SAASA,CAACC,QAAuB,EAAc;IAC7C,IAAIA,QAAQ,CAACC,MAAM,GAAG,EAAE,EAAE;MACxB,MAAM,IAAIN,oBAAoB,CAAE,qCAAoCK,QAAQ,CAACC,MAAO,UAAS,CAAC;IAChG;IAEA,OAAOD,QAAQ,CAACE,GAAG,CAChBC,OAAO,IAAK,CAACT,OAAO,CAACS,OAAO,CAACC,GAAG,CAAC,EAAEN,UAAU,CAACC,SAAS,CAACI,OAAO,CAACE,EAAE,CAAC,CAAC,CACtE;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACN,QAA0C,EAAiB;IACrE,OAAOA,QAAQ,CAACE,GAAG,CACjBK,IAAA;MAAA,IAAC,CAACH,GAAG,EAAEC,EAAE,CAAC,GAAAE,IAAA;MAAA,OAAM;QAAEH,GAAG,EAAEA,GAAG,CAACI,QAAQ,EAAE;QAAEH,EAAE,EAAEP,UAAU,CAACQ,WAAW,CAACD,EAAE;MAAE,CAAC;IAAA,CAAC,CACzE;EACH;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw.mjs","names":["serialize","buffer","from","deserialize"],"sources":["../../../../src/tx/builder/field-types/raw.ts"],"sourcesContent":["export default {\n serialize(buffer: Uint8Array): Buffer {\n return Buffer.from(buffer);\n },\n\n deserialize(buffer: Buffer): Buffer {\n return buffer;\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,
|
|
1
|
+
{"version":3,"file":"raw.mjs","names":["serialize","buffer","_Buffer","from","deserialize"],"sources":["../../../../src/tx/builder/field-types/raw.ts"],"sourcesContent":["export default {\n serialize(buffer: Uint8Array): Buffer {\n return Buffer.from(buffer);\n },\n\n deserialize(buffer: Buffer): Buffer {\n return buffer;\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAASA,CAACC,MAAkB,EAAU;IACpC,OAAOC,OAAA,CAAOC,IAAI,CAACF,MAAM,CAAC;EAC5B,CAAC;EAEDG,WAAWA,CAACH,MAAc,EAAU;IAClC,OAAOA,MAAM;EACf;AACF,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export default function genShortUIntConstField<Value extends number>(
|
|
3
|
-
serialize: (value?: Value) => Buffer;
|
|
2
|
+
export default function genShortUIntConstField<Value extends number, Optional extends boolean = false>(constValue: Value, optional?: Optional): {
|
|
3
|
+
serialize: Optional extends true ? (value?: Value) => Buffer : (value: Value) => Buffer;
|
|
4
4
|
deserialize: (value: Buffer) => Value;
|
|
5
|
+
constValue: Value;
|
|
6
|
+
constValueOptional: boolean;
|
|
5
7
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
2
2
|
import shortUInt from "./short-u-int.mjs";
|
|
3
|
-
export default function genShortUIntConstField(
|
|
3
|
+
export default function genShortUIntConstField(constValue, optional) {
|
|
4
4
|
return {
|
|
5
|
-
serialize(
|
|
6
|
-
if (
|
|
7
|
-
|
|
5
|
+
serialize(value) {
|
|
6
|
+
if ((optional !== true || value != null) && value !== constValue) {
|
|
7
|
+
throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
8
|
+
}
|
|
9
|
+
return shortUInt.serialize(constValue);
|
|
8
10
|
},
|
|
9
11
|
deserialize(buf) {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
13
|
-
}
|
|
12
|
+
const value = shortUInt.deserialize(buf);
|
|
13
|
+
if (value !== constValue) throw new ArgumentError('ShortUIntConst', constValue, value);
|
|
14
|
+
return constValue;
|
|
15
|
+
},
|
|
16
|
+
constValue,
|
|
17
|
+
constValueOptional: optional === true
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=short-u-int-const.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"short-u-int-const.mjs","names":["ArgumentError","shortUInt","genShortUIntConstField","
|
|
1
|
+
{"version":3,"file":"short-u-int-const.mjs","names":["ArgumentError","shortUInt","genShortUIntConstField","constValue","optional","serialize","value","deserialize","buf","constValueOptional"],"sources":["../../../../src/tx/builder/field-types/short-u-int-const.ts"],"sourcesContent":["import { ArgumentError } from '../../../utils/errors';\nimport shortUInt from './short-u-int';\n\nexport default function genShortUIntConstField<\n Value extends number, Optional extends boolean = false,\n>(constValue: Value, optional?: Optional): {\n serialize: Optional extends true ? (value?: Value) => Buffer : (value: Value) => Buffer;\n deserialize: (value: Buffer) => Value;\n constValue: Value;\n constValueOptional: boolean;\n} {\n return {\n serialize(value?: Value) {\n if ((optional !== true || value != null) && value !== constValue) {\n throw new ArgumentError('ShortUIntConst', constValue, value);\n }\n return shortUInt.serialize(constValue);\n },\n\n deserialize(buf) {\n const value = shortUInt.deserialize(buf);\n if (value !== constValue) throw new ArgumentError('ShortUIntConst', constValue, value);\n return constValue;\n },\n\n constValue,\n\n constValueOptional: optional === true,\n };\n}\n"],"mappings":"SAASA,aAAa;AAAA,OACfC,SAAS;AAEhB,eAAe,SAASC,sBAAsBA,CAE5CC,UAAiB,EAAEC,QAAmB,EAKtC;EACA,OAAO;IACLC,SAASA,CAACC,KAAa,EAAE;MACvB,IAAI,CAACF,QAAQ,KAAK,IAAI,IAAIE,KAAK,IAAI,IAAI,KAAKA,KAAK,KAAKH,UAAU,EAAE;QAChE,MAAM,IAAIH,aAAa,CAAC,gBAAgB,EAAEG,UAAU,EAAEG,KAAK,CAAC;MAC9D;MACA,OAAOL,SAAS,CAACI,SAAS,CAACF,UAAU,CAAC;IACxC,CAAC;IAEDI,WAAWA,CAACC,GAAG,EAAE;MACf,MAAMF,KAAK,GAAGL,SAAS,CAACM,WAAW,CAACC,GAAG,CAAC;MACxC,IAAIF,KAAK,KAAKH,UAAU,EAAE,MAAM,IAAIH,aAAa,CAAC,gBAAgB,EAAEG,UAAU,EAAEG,KAAK,CAAC;MACtF,OAAOH,UAAU;IACnB,CAAC;IAEDA,UAAU;IAEVM,kBAAkB,EAAEL,QAAQ,KAAK;EACnC,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"short-u-int.mjs","names":["uInt","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/short-u-int.ts"],"sourcesContent":["import uInt from './u-int';\n\nexport default {\n serialize(value: number): Buffer {\n return uInt.serialize(value);\n },\n\n deserialize(value: Buffer): number {\n return +uInt.deserialize(value);\n },\n};\n"],"mappings":"OAAOA,IAAI;AAEX,eAAe;EACbC,
|
|
1
|
+
{"version":3,"file":"short-u-int.mjs","names":["uInt","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/short-u-int.ts"],"sourcesContent":["import uInt from './u-int';\n\nexport default {\n serialize(value: number): Buffer {\n return uInt.serialize(value);\n },\n\n deserialize(value: Buffer): number {\n return +uInt.deserialize(value);\n },\n};\n"],"mappings":"OAAOA,IAAI;AAEX,eAAe;EACbC,SAASA,CAACC,KAAa,EAAU;IAC/B,OAAOF,IAAI,CAACC,SAAS,CAACC,KAAK,CAAC;EAC9B,CAAC;EAEDC,WAAWA,CAACD,KAAa,EAAU;IACjC,OAAO,CAACF,IAAI,CAACG,WAAW,CAACD,KAAK,CAAC;EACjC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.mjs","names":["toBytes","serialize","string","deserialize","buffer","toString"],"sources":["../../../../src/tx/builder/field-types/string.ts"],"sourcesContent":["import { toBytes } from '../../../utils/bytes';\n\nexport default {\n serialize(string: string): Buffer {\n return toBytes(string);\n },\n\n deserialize(buffer: Buffer): string {\n return buffer.toString();\n },\n};\n"],"mappings":"SAASA,OAAO;AAEhB,eAAe;EACbC,
|
|
1
|
+
{"version":3,"file":"string.mjs","names":["toBytes","serialize","string","deserialize","buffer","toString"],"sources":["../../../../src/tx/builder/field-types/string.ts"],"sourcesContent":["import { toBytes } from '../../../utils/bytes';\n\nexport default {\n serialize(string: string): Buffer {\n return toBytes(string);\n },\n\n deserialize(buffer: Buffer): string {\n return buffer.toString();\n },\n};\n"],"mappings":"SAASA,OAAO;AAEhB,eAAe;EACbC,SAASA,CAACC,MAAc,EAAU;IAChC,OAAOF,OAAO,CAACE,MAAM,CAAC;EACxB,CAAC;EAEDC,WAAWA,CAACC,MAAc,EAAU;IAClC,OAAOA,MAAM,CAACC,QAAQ,EAAE;EAC1B;AACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Node from '../../../Node';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
serialize(value: number | undefined): Buffer;
|
|
5
|
+
prepare(value: number | undefined, params: {}, { onNode, absoluteTtl }: {
|
|
6
|
+
onNode?: Node | undefined;
|
|
7
|
+
absoluteTtl?: boolean | undefined;
|
|
8
|
+
}): Promise<number | undefined>;
|
|
9
|
+
deserialize(value: Buffer): number;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import shortUInt from "./short-u-int.mjs";
|
|
2
|
+
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
3
|
+
export default {
|
|
4
|
+
...shortUInt,
|
|
5
|
+
serialize(value) {
|
|
6
|
+
return shortUInt.serialize(value !== null && value !== void 0 ? value : 0);
|
|
7
|
+
},
|
|
8
|
+
async prepare(value, params, // TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }
|
|
9
|
+
_ref) {
|
|
10
|
+
let {
|
|
11
|
+
onNode,
|
|
12
|
+
absoluteTtl
|
|
13
|
+
} = _ref;
|
|
14
|
+
if (absoluteTtl !== true && value !== 0 && value != null) {
|
|
15
|
+
if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);
|
|
16
|
+
value += (await onNode.getCurrentKeyBlock()).height;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ttl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ttl.mjs","names":["shortUInt","ArgumentError","serialize","value","prepare","params","_ref","onNode","absoluteTtl","getCurrentKeyBlock","height"],"sources":["../../../../src/tx/builder/field-types/ttl.ts"],"sourcesContent":["import shortUInt from './short-u-int';\nimport Node from '../../../Node';\nimport { ArgumentError } from '../../../utils/errors';\n\nexport default {\n ...shortUInt,\n\n serialize(value: number | undefined): Buffer {\n return shortUInt.serialize(value ?? 0);\n },\n\n async prepare(\n value: number | undefined,\n params: {},\n // TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }\n { onNode, absoluteTtl }: { onNode?: Node; absoluteTtl?: boolean },\n ) {\n if (absoluteTtl !== true && value !== 0 && value != null) {\n if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);\n value += (await onNode.getCurrentKeyBlock()).height;\n }\n return value;\n },\n};\n"],"mappings":"OAAOA,SAAS;AAAA,SAEPC,aAAa;AAEtB,eAAe;EACb,GAAGD,SAAS;EAEZE,SAASA,CAACC,KAAyB,EAAU;IAC3C,OAAOH,SAAS,CAACE,SAAS,CAACC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC;EACxC,CAAC;EAED,MAAMC,OAAOA,CACXD,KAAyB,EACzBE,MAAU,EACV;EAAAC,IAAA,EAEA;IAAA,IADA;MAAEC,MAAM;MAAEC;IAAsD,CAAC,GAAAF,IAAA;IAEjE,IAAIE,WAAW,KAAK,IAAI,IAAIL,KAAK,KAAK,CAAC,IAAIA,KAAK,IAAI,IAAI,EAAE;MACxD,IAAII,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIN,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAEM,MAAM,CAAC;MACzEJ,KAAK,IAAI,CAAC,MAAMI,MAAM,CAACE,kBAAkB,EAAE,EAAEC,MAAM;IACrD;IACA,OAAOP,KAAK;EACd;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"u-int.mjs","names":["readInt","ArgumentError","toBytes","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/u-int.ts"],"sourcesContent":["import { readInt } from '../helpers';\nimport { Int } from '../constants';\nimport { ArgumentError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\n\nexport default {\n serialize(value: Int): Buffer {\n if (value < 0) throw new ArgumentError('value', 'greater or equal to 0', value);\n return toBytes(value, true);\n },\n\n deserialize(value: Buffer): string {\n return readInt(value);\n },\n};\n"],"mappings":"SAASA,OAAO;AAAA,SAEPC,aAAa;AAAA,SACbC,OAAO;AAEhB,eAAe;EACbC,
|
|
1
|
+
{"version":3,"file":"u-int.mjs","names":["readInt","ArgumentError","toBytes","serialize","value","deserialize"],"sources":["../../../../src/tx/builder/field-types/u-int.ts"],"sourcesContent":["import { readInt } from '../helpers';\nimport { Int } from '../constants';\nimport { ArgumentError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\n\nexport default {\n serialize(value: Int): Buffer {\n if (value < 0) throw new ArgumentError('value', 'greater or equal to 0', value);\n return toBytes(value, true);\n },\n\n deserialize(value: Buffer): string {\n return readInt(value);\n },\n};\n"],"mappings":"SAASA,OAAO;AAAA,SAEPC,aAAa;AAAA,SACbC,OAAO;AAEhB,eAAe;EACbC,SAASA,CAACC,KAAU,EAAU;IAC5B,IAAIA,KAAK,GAAG,CAAC,EAAE,MAAM,IAAIH,aAAa,CAAC,OAAO,EAAE,uBAAuB,EAAEG,KAAK,CAAC;IAC/E,OAAOF,OAAO,CAACE,KAAK,EAAE,IAAI,CAAC;EAC7B,CAAC;EAEDC,WAAWA,CAACD,KAAa,EAAU;IACjC,OAAOJ,OAAO,CAACI,KAAK,CAAC;EACvB;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Tag } from '../constants';
|
|
3
|
+
import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
|
|
4
|
+
type TagWrapping = Tag.AccountsMtree | Tag.CallsMtree | Tag.ChannelsMtree | Tag.ContractsMtree | Tag.NameserviceMtree | Tag.OraclesMtree;
|
|
5
|
+
export default function genWrappedField<T extends TagWrapping>(tag: T): {
|
|
6
|
+
serialize: (value: any, options: {
|
|
7
|
+
buildTx: typeof buildTxType;
|
|
8
|
+
}) => Buffer;
|
|
9
|
+
deserialize: (value: Buffer, options: {
|
|
10
|
+
unpackTx: typeof unpackTxType;
|
|
11
|
+
}) => any;
|
|
12
|
+
recursiveType: true;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { encode, Encoding, decode } from "../../../utils/encoder.mjs";
|
|
2
|
+
export default function genWrappedField(tag) {
|
|
3
|
+
return {
|
|
4
|
+
serialize(payload, _ref) {
|
|
5
|
+
let {
|
|
6
|
+
buildTx
|
|
7
|
+
} = _ref;
|
|
8
|
+
return decode(buildTx({
|
|
9
|
+
tag,
|
|
10
|
+
payload
|
|
11
|
+
}));
|
|
12
|
+
},
|
|
13
|
+
deserialize(buffer, _ref2) {
|
|
14
|
+
let {
|
|
15
|
+
unpackTx
|
|
16
|
+
} = _ref2;
|
|
17
|
+
return unpackTx(encode(buffer, Encoding.Transaction), tag).payload;
|
|
18
|
+
},
|
|
19
|
+
recursiveType: true
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=wrapped.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapped.mjs","names":["encode","Encoding","decode","genWrappedField","tag","serialize","payload","_ref","buildTx","deserialize","buffer","_ref2","unpackTx","Transaction","recursiveType"],"sources":["../../../../src/tx/builder/field-types/wrapped.ts"],"sourcesContent":["import { Tag } from '../constants';\nimport { encode, Encoding, decode } from '../../../utils/encoder';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\ntype TagWrapping = Tag.AccountsMtree | Tag.CallsMtree | Tag.ChannelsMtree | Tag.ContractsMtree\n| Tag.NameserviceMtree | Tag.OraclesMtree;\n\nexport default function genWrappedField<T extends TagWrapping>(tag: T): {\n serialize: (\n // TODO: replace with `(TxParams & { tag: T })['payload']`,\n // but fix TS2502 value is referenced directly or indirectly in its own type annotation\n value: any, options: { buildTx: typeof buildTxType }\n ) => Buffer;\n deserialize: (\n value: Buffer, options: { unpackTx: typeof unpackTxType },\n // TODO: replace with `(TxUnpacked & { tag: T })['payload']`,\n // TS2577 Return type annotation circularly references itself\n ) => any;\n recursiveType: true;\n} {\n return {\n serialize(payload, { buildTx }) {\n return decode(buildTx({ tag, payload }));\n },\n\n deserialize(buffer, { unpackTx }) {\n return unpackTx<TagWrapping>(encode(buffer, Encoding.Transaction), tag).payload;\n },\n\n recursiveType: true,\n };\n}\n"],"mappings":"SACSA,MAAM,EAAEC,QAAQ,EAAEC,MAAM;AAMjC,eAAe,SAASC,eAAeA,CAAwBC,GAAM,EAYnE;EACA,OAAO;IACLC,SAASA,CAACC,OAAO,EAAAC,IAAA,EAAe;MAAA,IAAb;QAAEC;MAAQ,CAAC,GAAAD,IAAA;MAC5B,OAAOL,MAAM,CAACM,OAAO,CAAC;QAAEJ,GAAG;QAAEE;MAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEDG,WAAWA,CAACC,MAAM,EAAAC,KAAA,EAAgB;MAAA,IAAd;QAAEC;MAAS,CAAC,GAAAD,KAAA;MAC9B,OAAOC,QAAQ,CAAcZ,MAAM,CAACU,MAAM,EAAET,QAAQ,CAACY,WAAW,CAAC,EAAET,GAAG,CAAC,CAACE,OAAO;IACjF,CAAC;IAEDQ,aAAa,EAAE;EACjB,CAAC;AACH"}
|