@aeternity/aepp-sdk 13.2.2 → 13.3.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/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/bin/aesophia_cli_8 +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 +9171 -7086
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +3 -0
- package/es/AeSdk.mjs +12 -12
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +0 -1
- package/es/AeSdkAepp.mjs +12 -16
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +61 -6
- package/es/AeSdkBase.mjs +150 -69
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +19 -7
- package/es/AeSdkMethods.mjs +39 -38
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +86 -55
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.mjs +31 -27
- package/es/Middleware.mjs.map +1 -1
- package/es/MiddlewareSubscriber.mjs +5 -14
- package/es/MiddlewareSubscriber.mjs.map +1 -1
- package/es/Node.d.ts +10 -2
- package/es/Node.mjs +53 -54
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +39 -3
- package/es/account/Base.mjs +35 -1
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +2 -0
- package/es/account/Generalized.mjs +15 -6
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +2 -0
- package/es/account/Ledger.mjs +14 -5
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs +4 -6
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +15 -4
- package/es/account/Memory.mjs +96 -31
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +16 -5
- package/es/account/Rpc.mjs +94 -21
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +17 -44
- package/es/aens.mjs +32 -71
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +2 -0
- package/es/aepp-wallet-communication/schema.mjs +2 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -0
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.mjs +13 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/middleware/middleware.d.ts +23 -5
- package/es/apis/middleware/middleware.mjs +114 -18
- package/es/apis/middleware/middleware.mjs.map +1 -1
- package/es/apis/middleware/models/index.d.ts +164 -15
- package/es/apis/middleware/models/index.mjs +53 -3
- package/es/apis/middleware/models/index.mjs.map +1 -1
- package/es/apis/middleware/models/mappers.d.ts +8 -1
- package/es/apis/middleware/models/mappers.mjs +376 -3
- package/es/apis/middleware/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/models/parameters.d.ts +6 -3
- package/es/apis/middleware/models/parameters.mjs +38 -11
- package/es/apis/middleware/models/parameters.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +66 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +5 -1
- package/es/apis/node/models/mappers.mjs +229 -7
- 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.d.ts +24 -3
- package/es/apis/node/node.mjs +135 -3
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +14 -44
- package/es/chain.mjs +125 -219
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +3 -47
- package/es/channel/Base.mjs +21 -54
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +16 -25
- package/es/channel/Contract.mjs +39 -63
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +0 -8
- package/es/channel/Spend.mjs +17 -29
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +1 -1
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +104 -5
- package/es/channel/internal.mjs +26 -34
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +9 -1
- package/es/contract/Contract.mjs +67 -73
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +14 -8
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +5 -9
- package/es/contract/compiler/Cli.mjs +45 -23
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Cli8.d.ts +13 -0
- package/es/contract/compiler/Cli8.mjs +22 -0
- package/es/contract/compiler/Cli8.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +3 -9
- package/es/contract/compiler/Http.mjs +28 -16
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +2 -5
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +2 -1
- package/es/contract/delegation-signature.mjs +18 -14
- package/es/contract/delegation-signature.mjs.map +1 -1
- package/es/contract/ga.d.ts +1 -2
- package/es/contract/ga.mjs +23 -25
- package/es/contract/ga.mjs.map +1 -1
- package/es/deprecated.d.ts +38 -0
- package/es/deprecated.mjs +45 -0
- package/es/deprecated.mjs.map +1 -1
- package/es/index-browser.d.ts +10 -5
- package/es/index-browser.mjs +9 -5
- package/es/index-browser.mjs.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +6 -37
- package/es/oracle.mjs +32 -66
- package/es/oracle.mjs.map +1 -1
- package/es/send-transaction.d.ts +53 -0
- package/es/send-transaction.mjs +109 -0
- package/es/send-transaction.mjs.map +1 -0
- package/es/spend.d.ts +4 -3
- package/es/spend.mjs +6 -1
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/common.d.ts +29 -0
- package/es/tx/builder/common.mjs +42 -0
- package/es/tx/builder/common.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -4
- package/es/tx/builder/constants.mjs +6 -15
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/delegation/index.d.ts +20 -0
- package/es/tx/builder/delegation/index.mjs +24 -0
- package/es/tx/builder/delegation/index.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.d.ts +130 -0
- package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/es/tx/builder/delegation/schema.generated.mjs +2 -0
- package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.mjs +54 -0
- package/es/tx/builder/delegation/schema.mjs.map +1 -0
- package/es/tx/builder/field-types/abi-version.mjs +8 -11
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs +1 -4
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/es/tx/builder/field-types/coin-amount.mjs +6 -6
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.mjs +3 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +7 -13
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +19 -11
- package/es/tx/builder/field-types/fee.mjs +56 -38
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs +13 -15
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +10 -2
- package/es/tx/builder/field-types/gas-price.mjs +52 -3
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +31 -29
- package/es/tx/builder/field-types/index.mjs +31 -29
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.mjs +20 -31
- package/es/tx/builder/field-types/map.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.mjs +14 -29
- 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 +1 -1
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +1 -0
- package/es/tx/builder/field-types/nonce.mjs +2 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +4 -7
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers2.d.ts +23 -0
- package/es/tx/builder/field-types/pointers2.mjs +65 -0
- package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
- package/es/tx/builder/field-types/query-fee.d.ts +19 -0
- package/es/tx/builder/field-types/query-fee.mjs +20 -0
- package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/ttl.d.ts +9 -1
- package/es/tx/builder/field-types/ttl.mjs +19 -8
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/field-types/with-default.d.ts +7 -0
- package/es/tx/builder/field-types/with-default.mjs +9 -0
- package/es/tx/builder/field-types/with-default.mjs.map +1 -0
- package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/es/tx/builder/field-types/with-formatting.mjs +9 -0
- package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
- package/es/tx/builder/field-types/wrapped.mjs +6 -8
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -2
- package/es/tx/builder/helpers.mjs +12 -21
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +17 -10
- package/es/tx/builder/index.mjs +39 -65
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +478 -257
- package/es/tx/builder/schema.generated.d.ts +39 -3
- package/es/tx/builder/schema.generated.mjs.map +1 -1
- package/es/tx/builder/schema.mjs +48 -36
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +6 -5
- package/es/tx/execution-cost.mjs +16 -17
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/transaction-signer.mjs +1 -4
- package/es/tx/transaction-signer.mjs.map +1 -1
- package/es/tx/validator.mjs +61 -42
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +15 -22
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +2 -3
- package/es/utils/autorest.mjs +40 -24
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -2
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -4
- package/es/utils/crypto.mjs +17 -13
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +6 -0
- package/es/utils/errors.mjs +12 -6
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +2 -0
- package/es/utils/hd-wallet.mjs +6 -5
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -10
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/jwt.d.ts +53 -0
- package/es/utils/jwt.mjs +120 -0
- package/es/utils/jwt.mjs.map +1 -0
- package/es/utils/keystore.d.ts +6 -2
- package/es/utils/keystore.mjs +8 -16
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/typed-data.mjs +1 -0
- package/es/utils/typed-data.mjs.map +1 -1
- package/es/utils/wrap-proxy.d.ts +2 -0
- package/es/utils/wrap-proxy.mjs +15 -0
- package/es/utils/wrap-proxy.mjs.map +1 -0
- package/package.json +57 -51
- package/src/AeSdk.ts +3 -0
- package/src/AeSdkAepp.ts +0 -1
- package/src/AeSdkBase.ts +97 -10
- package/src/AeSdkMethods.ts +37 -33
- package/src/AeSdkWallet.ts +22 -3
- package/src/Middleware.ts +16 -8
- package/src/MiddlewareSubscriber.ts +1 -1
- package/src/Node.ts +37 -18
- package/src/account/Base.ts +62 -3
- package/src/account/Generalized.ts +10 -0
- package/src/account/Ledger.ts +10 -0
- package/src/account/Memory.ts +83 -9
- package/src/account/Rpc.ts +69 -6
- package/src/aens.ts +35 -56
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
- package/src/aepp-wallet-communication/rpc/types.ts +13 -0
- package/src/aepp-wallet-communication/schema.ts +2 -0
- package/src/apis/compiler/compiler.ts +93 -93
- package/src/apis/compiler/models/index.ts +1 -0
- package/src/apis/compiler/models/mappers.ts +178 -165
- package/src/apis/compiler/models/parameters.ts +18 -18
- package/src/apis/middleware/middleware.ts +462 -341
- package/src/apis/middleware/models/index.ts +258 -56
- package/src/apis/middleware/models/mappers.ts +2357 -1919
- package/src/apis/middleware/models/parameters.ts +172 -142
- package/src/apis/node/models/index.ts +79 -2
- package/src/apis/node/models/mappers.ts +1529 -1302
- package/src/apis/node/models/parameters.ts +51 -51
- package/src/apis/node/node.ts +420 -275
- package/src/chain.ts +42 -128
- package/src/channel/Base.ts +14 -47
- package/src/channel/Contract.ts +18 -26
- package/src/channel/Spend.ts +0 -8
- package/src/channel/internal.ts +115 -13
- package/src/contract/Contract.ts +26 -8
- package/src/contract/compiler/Base.ts +15 -8
- package/src/contract/compiler/Cli.ts +37 -21
- package/src/contract/compiler/Cli8.ts +17 -0
- package/src/contract/compiler/Http.ts +24 -14
- package/src/contract/compiler/HttpNode.ts +2 -2
- package/src/contract/delegation-signature.ts +11 -5
- package/src/contract/ga.ts +4 -3
- package/src/deprecated.ts +36 -0
- package/src/index-browser.ts +14 -7
- package/src/index.ts +1 -0
- package/src/oracle.ts +11 -54
- package/src/send-transaction.ts +136 -0
- package/src/spend.ts +25 -11
- package/src/tx/builder/common.ts +74 -0
- package/src/tx/builder/constants.ts +6 -9
- package/src/tx/builder/delegation/index.ts +28 -0
- package/src/tx/builder/delegation/schema.generated.ts +143 -0
- package/src/tx/builder/delegation/schema.ts +61 -0
- package/src/tx/builder/field-types/coin-amount.ts +3 -2
- package/src/tx/builder/field-types/entry.ts +1 -4
- package/src/tx/builder/field-types/fee.ts +71 -43
- package/src/tx/builder/field-types/gas-limit.ts +4 -4
- package/src/tx/builder/field-types/gas-price.ts +58 -2
- package/src/tx/builder/field-types/index.ts +31 -59
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- package/src/tx/builder/field-types/nonce.ts +7 -1
- package/src/tx/builder/field-types/pointers2.ts +62 -0
- package/src/tx/builder/field-types/query-fee.ts +25 -0
- package/src/tx/builder/field-types/ttl.ts +13 -3
- package/src/tx/builder/field-types/with-default.ts +18 -0
- package/src/tx/builder/field-types/with-formatting.ts +18 -0
- package/src/tx/builder/helpers.ts +2 -2
- package/src/tx/builder/index.ts +42 -59
- package/src/tx/builder/schema.generated.ts +39 -3
- package/src/tx/builder/schema.ts +55 -29
- package/src/tx/execution-cost.ts +6 -5
- package/src/tx/validator.ts +31 -5
- package/src/utils/autorest.ts +36 -27
- package/src/utils/crypto.ts +23 -13
- package/src/utils/errors.ts +10 -0
- package/src/utils/hd-wallet.ts +2 -0
- package/src/utils/jwt.ts +126 -0
- package/src/utils/keystore.ts +6 -2
- package/src/utils/wrap-proxy.ts +24 -0
- package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.2/Node.d.ts +14 -1
- package/types-legacy/ts4.2/account/Base.d.ts +39 -3
- package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.2/aens.d.ts +17 -44
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.2/chain.d.ts +14 -44
- package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.2/deprecated.d.ts +38 -0
- package/types-legacy/ts4.2/index-browser.d.ts +10 -5
- package/types-legacy/ts4.2/index.d.ts +1 -0
- package/types-legacy/ts4.2/oracle.d.ts +6 -37
- package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.2/spend.d.ts +4 -3
- package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
- 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 +1 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.5/Node.d.ts +14 -1
- package/types-legacy/ts4.5/account/Base.d.ts +39 -3
- package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.5/aens.d.ts +17 -44
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.5/chain.d.ts +14 -44
- package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.5/deprecated.d.ts +38 -0
- package/types-legacy/ts4.5/index-browser.d.ts +10 -5
- package/types-legacy/ts4.5/index.d.ts +1 -0
- package/types-legacy/ts4.5/oracle.d.ts +6 -37
- package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.5/spend.d.ts +4 -3
- package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
- 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 +1 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
- package/es/tx/builder/field-types/deposit.d.ts +0 -15
- package/es/tx/builder/field-types/deposit.mjs +0 -18
- package/es/tx/builder/field-types/deposit.mjs.map +0 -1
- package/src/tx/builder/field-types/deposit.ts +0 -23
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import verifyTransaction from "./tx/validator.mjs";
|
|
2
|
+
import { ensureError } from "./utils/other.mjs";
|
|
3
|
+
import { TransactionError } from "./utils/errors.mjs";
|
|
4
|
+
import { buildTxHash } from "./tx/builder/index.mjs";
|
|
5
|
+
import { poll, waitForTxConfirm } from "./chain.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* @category exception
|
|
8
|
+
*/
|
|
9
|
+
export class InvalidTxError extends TransactionError {
|
|
10
|
+
constructor(message, validation, transaction) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'InvalidTxError';
|
|
13
|
+
this.validation = validation;
|
|
14
|
+
this.transaction = transaction;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Signs and submits transaction for mining
|
|
20
|
+
* @category chain
|
|
21
|
+
* @param txUnsigned - Transaction to sign and submit
|
|
22
|
+
* @param options - Options
|
|
23
|
+
* @returns Transaction details
|
|
24
|
+
*/
|
|
25
|
+
export async function sendTransaction(txUnsigned, {
|
|
26
|
+
onNode,
|
|
27
|
+
onAccount,
|
|
28
|
+
verify = true,
|
|
29
|
+
waitMined = true,
|
|
30
|
+
confirm,
|
|
31
|
+
innerTx,
|
|
32
|
+
...options
|
|
33
|
+
}) {
|
|
34
|
+
const tx = await onAccount.signTransaction(txUnsigned, {
|
|
35
|
+
...options,
|
|
36
|
+
onNode,
|
|
37
|
+
innerTx,
|
|
38
|
+
networkId: await onNode.getNetworkId()
|
|
39
|
+
});
|
|
40
|
+
if (innerTx === true) return {
|
|
41
|
+
hash: buildTxHash(tx),
|
|
42
|
+
rawTx: tx
|
|
43
|
+
};
|
|
44
|
+
if (verify) {
|
|
45
|
+
const validation = await verifyTransaction(tx, onNode);
|
|
46
|
+
if (validation.length > 0) {
|
|
47
|
+
const message = `Transaction verification errors: ${validation.map(v => v.message).join(', ')}`;
|
|
48
|
+
throw new InvalidTxError(message, validation, tx);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
let __queue;
|
|
53
|
+
try {
|
|
54
|
+
__queue = onAccount != null ? `tx-${onAccount.address}` : null;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
__queue = null;
|
|
57
|
+
}
|
|
58
|
+
const {
|
|
59
|
+
txHash
|
|
60
|
+
} = await onNode.postTransaction({
|
|
61
|
+
tx
|
|
62
|
+
}, {
|
|
63
|
+
requestOptions: {
|
|
64
|
+
customHeaders: {
|
|
65
|
+
// TODO: remove __retry-code after fixing https://github.com/aeternity/aeternity/issues/3803
|
|
66
|
+
'__retry-code': '400',
|
|
67
|
+
...(__queue != null ? {
|
|
68
|
+
__queue
|
|
69
|
+
} : {})
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (waitMined) {
|
|
74
|
+
const pollResult = await poll(txHash, {
|
|
75
|
+
onNode,
|
|
76
|
+
...options
|
|
77
|
+
});
|
|
78
|
+
const txData = {
|
|
79
|
+
...pollResult,
|
|
80
|
+
hash: pollResult.hash,
|
|
81
|
+
rawTx: tx
|
|
82
|
+
};
|
|
83
|
+
// wait for transaction confirmation
|
|
84
|
+
if (confirm != null && +confirm > 0) {
|
|
85
|
+
const c = typeof confirm === 'boolean' ? undefined : confirm;
|
|
86
|
+
return {
|
|
87
|
+
...txData,
|
|
88
|
+
confirmationHeight: await waitForTxConfirm(txHash, {
|
|
89
|
+
onNode,
|
|
90
|
+
confirm: c,
|
|
91
|
+
...options
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return txData;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
hash: txHash,
|
|
99
|
+
rawTx: tx
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
ensureError(error);
|
|
103
|
+
throw Object.assign(error, {
|
|
104
|
+
rawTx: tx,
|
|
105
|
+
verifyTx: async () => verifyTransaction(tx, onNode)
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=send-transaction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-transaction.mjs","names":["verifyTransaction","ensureError","TransactionError","buildTxHash","poll","waitForTxConfirm","InvalidTxError","constructor","message","validation","transaction","name","sendTransaction","txUnsigned","onNode","onAccount","verify","waitMined","confirm","innerTx","options","tx","signTransaction","networkId","getNetworkId","hash","rawTx","length","map","v","join","__queue","address","error","txHash","postTransaction","requestOptions","customHeaders","pollResult","txData","c","undefined","confirmationHeight","Object","assign","verifyTx"],"sources":["../src/send-transaction.ts"],"sourcesContent":["import verifyTransaction, { ValidatorResult } from './tx/validator';\nimport { ensureError } from './utils/other';\nimport { TransactionError } from './utils/errors';\nimport Node, { TransformNodeType } from './Node';\nimport { SignedTx } from './apis/node';\nimport { Encoded } from './utils/encoder';\nimport AccountBase from './account/Base';\nimport { buildTxHash } from './tx/builder';\nimport { poll, waitForTxConfirm } from './chain';\n\n/**\n * @category exception\n */\nexport class InvalidTxError extends TransactionError {\n validation: ValidatorResult[];\n\n transaction: Encoded.Transaction;\n\n constructor(\n message: string,\n validation: ValidatorResult[],\n transaction: Encoded.Transaction,\n ) {\n super(message);\n this.name = 'InvalidTxError';\n this.validation = validation;\n this.transaction = transaction;\n }\n}\n\n/**\n * Signs and submits transaction for mining\n * @category chain\n * @param txUnsigned - Transaction to sign and submit\n * @param options - Options\n * @returns Transaction details\n */\nexport async function sendTransaction(\n txUnsigned: Encoded.Transaction,\n {\n onNode, onAccount, verify = true, waitMined = true, confirm, innerTx, ...options\n }:\n SendTransactionOptions,\n): Promise<SendTransactionReturnType> {\n const tx = await onAccount.signTransaction(txUnsigned, {\n ...options,\n onNode,\n innerTx,\n networkId: await onNode.getNetworkId(),\n });\n\n if (innerTx === true) return { hash: buildTxHash(tx), rawTx: tx };\n\n if (verify) {\n const validation = await verifyTransaction(tx, onNode);\n if (validation.length > 0) {\n const message = `Transaction verification errors: ${\n validation.map((v: { message: string }) => v.message).join(', ')}`;\n throw new InvalidTxError(message, validation, tx);\n }\n }\n\n try {\n let __queue;\n try {\n __queue = onAccount != null ? `tx-${onAccount.address}` : null;\n } catch (error) {\n __queue = null;\n }\n const { txHash } = await onNode.postTransaction({ tx }, {\n requestOptions: {\n customHeaders: {\n // TODO: remove __retry-code after fixing https://github.com/aeternity/aeternity/issues/3803\n '__retry-code': '400',\n ...__queue != null ? { __queue } : {},\n },\n },\n });\n\n if (waitMined) {\n const pollResult = await poll(txHash, { onNode, ...options });\n const txData = {\n ...pollResult,\n hash: pollResult.hash as Encoded.TxHash,\n rawTx: tx,\n };\n // wait for transaction confirmation\n if (confirm != null && +confirm > 0) {\n const c = typeof confirm === 'boolean' ? undefined : confirm;\n return {\n ...txData,\n confirmationHeight: await waitForTxConfirm(txHash, { onNode, confirm: c, ...options }),\n };\n }\n return txData;\n }\n return { hash: txHash, rawTx: tx };\n } catch (error) {\n ensureError(error);\n throw Object.assign(error, {\n rawTx: tx,\n verifyTx: async () => verifyTransaction(tx, onNode),\n });\n }\n}\n\ntype SendTransactionOptionsType = {\n /**\n * Node to use\n */\n onNode: Node;\n /**\n * Account to use\n */\n onAccount: AccountBase;\n /**\n * Verify transaction before broadcast, throw error if not\n */\n verify?: boolean;\n /**\n * Ensure that transaction get into block\n */\n waitMined?: boolean;\n /**\n * Number of micro blocks that should be mined after tx get included\n */\n confirm?: boolean | number;\n} & Parameters<typeof poll>[1] & Omit<Parameters<typeof waitForTxConfirm>[1], 'confirm'>\n& Parameters<AccountBase['signTransaction']>[1];\nexport interface SendTransactionOptions extends SendTransactionOptionsType {}\ninterface SendTransactionReturnType extends Partial<TransformNodeType<SignedTx>> {\n hash: Encoded.TxHash;\n // TODO: use `SignedTx.encodedTx` instead\n rawTx: Encoded.Transaction;\n confirmationHeight?: number;\n}\n"],"mappings":"OAAOA,iBAAiB;AAAA,SACfC,WAAW;AAAA,SACXC,gBAAgB;AAAA,SAKhBC,WAAW;AAAA,SACXC,IAAI,EAAEC,gBAAgB;AAE/B;AACA;AACA;AACA,OAAO,MAAMC,cAAc,SAASJ,gBAAgB,CAAC;EAKnDK,WAAWA,CACTC,OAAe,EACfC,UAA6B,EAC7BC,WAAgC,EAChC;IACA,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACG,IAAI,GAAG,gBAAgB;IAC5B,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeE,eAAeA,CACnCC,UAA+B,EAC/B;EACEC,MAAM;EAAEC,SAAS;EAAEC,MAAM,GAAG,IAAI;EAAEC,SAAS,GAAG,IAAI;EAAEC,OAAO;EAAEC,OAAO;EAAE,GAAGC;AAEtD,CAAC,EACc;EACpC,MAAMC,EAAE,GAAG,MAAMN,SAAS,CAACO,eAAe,CAACT,UAAU,EAAE;IACrD,GAAGO,OAAO;IACVN,MAAM;IACNK,OAAO;IACPI,SAAS,EAAE,MAAMT,MAAM,CAACU,YAAY,CAAC;EACvC,CAAC,CAAC;EAEF,IAAIL,OAAO,KAAK,IAAI,EAAE,OAAO;IAAEM,IAAI,EA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GAAG,OAAOtB,OAAO,KAAK,SAAS,GAAGuB,SAAS,GAAGvB,OAAO;QAC5D,OAAO;UACL,GAAGqB,MAAM;UACTG,kBAAkB,EAAE,MAAMrC,gBAAgB,CAAC6B,MAAM,EAAE;YAAEpB,MAAM;YAAEI,OAAO,EAAEsB,CAAC;YAAE,GAAGpB;UAAQ,CAAC;QACvF,CAAC;MACH;MACA,OAAOmB,MAAM;IACf;IACA,OAAO;MAAEd,IAAI,EAAES,MAAM;MAAER,KAAK,EAAEL;IAAG,CAAC;EACpC,CAAC,CAAC,OAAOY,KAAK,EAAE;IACdhC,WAAW,CAACgC,KAAK,CAAC;IAClB,MAAMU,MAAM,CAACC,MAAM,CAACX,KAAK,EAAE;MACzBP,KAAK,EAAEL,EAAE;MACTwB,QAAQ,EAAE,MAAAA,CAAA,KAAY7C,iBAAiB,CAACqB,EAAE,EAAEP,MAAM;IACpD,CAAC,CAAC;EACJ;AACF"}
|
package/es/spend.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveName } from './chain';
|
|
2
|
+
import { sendTransaction, SendTransactionOptions } from './send-transaction';
|
|
2
3
|
import { BuildTxOptions } from './tx/builder';
|
|
3
4
|
import { Encoded } from './utils/encoder';
|
|
4
5
|
import { Tag, AensName } from './tx/builder/constants';
|
|
@@ -11,7 +12,7 @@ import AccountBase from './account/Base';
|
|
|
11
12
|
* @param options - Options
|
|
12
13
|
* @returns Transaction
|
|
13
14
|
*/
|
|
14
|
-
export declare function spend(amount: number | string, recipientIdOrName: Encoded.AccountAddress | AensName, options: SpendOptions): ReturnType<typeof sendTransaction>;
|
|
15
|
+
export declare function spend(amount: number | string, recipientIdOrName: Encoded.AccountAddress | Encoded.ContractAddress | AensName, options: SpendOptions): ReturnType<typeof sendTransaction>;
|
|
15
16
|
type SpendOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
|
|
16
17
|
onAccount: AccountBase;
|
|
17
18
|
} & SendTransactionOptions;
|
|
@@ -35,7 +36,7 @@ interface SpendOptions extends SpendOptionsType {
|
|
|
35
36
|
* ```
|
|
36
37
|
*/
|
|
37
38
|
export declare function transferFunds(fraction: number | string, // TODO: accept only number
|
|
38
|
-
recipientIdOrName: AensName | Encoded.AccountAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
|
|
39
|
+
recipientIdOrName: AensName | Encoded.AccountAddress | Encoded.ContractAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
|
|
39
40
|
type TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
|
|
40
41
|
onAccount: AccountBase;
|
|
41
42
|
} & SendTransactionOptions;
|
package/es/spend.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import {
|
|
2
|
+
import { getBalance, resolveName } from "./chain.mjs";
|
|
3
|
+
import { sendTransaction } from "./send-transaction.mjs";
|
|
3
4
|
import { buildTxAsync, unpackTx } from "./tx/builder/index.mjs";
|
|
4
5
|
import { ArgumentError } from "./utils/errors.mjs";
|
|
5
6
|
import { Tag } from "./tx/builder/constants.mjs";
|
|
@@ -13,6 +14,7 @@ import { Tag } from "./tx/builder/constants.mjs";
|
|
|
13
14
|
*/
|
|
14
15
|
export async function spend(amount, recipientIdOrName, options) {
|
|
15
16
|
return sendTransaction(await buildTxAsync({
|
|
17
|
+
_isInternalBuild: true,
|
|
16
18
|
...options,
|
|
17
19
|
tag: Tag.SpendTx,
|
|
18
20
|
senderId: options.onAccount.address,
|
|
@@ -51,6 +53,7 @@ recipientIdOrName, options) {
|
|
|
51
53
|
const {
|
|
52
54
|
fee
|
|
53
55
|
} = unpackTx(await buildTxAsync({
|
|
56
|
+
_isInternalBuild: true,
|
|
54
57
|
...options,
|
|
55
58
|
tag: Tag.SpendTx,
|
|
56
59
|
senderId,
|
|
@@ -60,6 +63,7 @@ recipientIdOrName, options) {
|
|
|
60
63
|
// Reducing of the amount may reduce transaction fee, so this is not completely accurate
|
|
61
64
|
const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
|
|
62
65
|
return sendTransaction(await buildTxAsync({
|
|
66
|
+
_isInternalBuild: true,
|
|
63
67
|
...options,
|
|
64
68
|
tag: Tag.SpendTx,
|
|
65
69
|
senderId,
|
|
@@ -76,6 +80,7 @@ recipientIdOrName, options) {
|
|
|
76
80
|
*/
|
|
77
81
|
export async function payForTransaction(transaction, options) {
|
|
78
82
|
return sendTransaction(await buildTxAsync({
|
|
83
|
+
_isInternalBuild: true,
|
|
79
84
|
...options,
|
|
80
85
|
tag: Tag.PayingForTx,
|
|
81
86
|
payerId: options.onAccount.address,
|
package/es/spend.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spend.mjs","names":["BigNumber","
|
|
1
|
+
{"version":3,"file":"spend.mjs","names":["BigNumber","getBalance","resolveName","sendTransaction","buildTxAsync","unpackTx","ArgumentError","Tag","spend","amount","recipientIdOrName","options","_isInternalBuild","tag","SpendTx","senderId","onAccount","address","recipientId","transferFunds","fraction","balance","bind","desiredAmount","times","integerValue","ROUND_HALF_UP","fee","plus","gt","minus","payForTransaction","transaction","PayingForTx","payerId","tx"],"sources":["../src/spend.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { getBalance, resolveName } from './chain';\nimport { sendTransaction, SendTransactionOptions } from './send-transaction';\nimport { buildTxAsync, BuildTxOptions, unpackTx } from './tx/builder';\nimport { ArgumentError } from './utils/errors';\nimport { Encoded } from './utils/encoder';\nimport { Tag, AensName } from './tx/builder/constants';\nimport AccountBase from './account/Base';\n\n/**\n * Send coins to another account\n * @category chain\n * @param amount - Amount to spend\n * @param recipientIdOrName - Address or name of recipient account\n * @param options - Options\n * @returns Transaction\n */\nexport async function spend(\n amount: number | string,\n recipientIdOrName: Encoded.AccountAddress | Encoded.ContractAddress | AensName,\n options: SpendOptions,\n): ReturnType<typeof sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId: options.onAccount.address,\n recipientId: await resolveName(\n recipientIdOrName,\n 'account_pubkey',\n options,\n ),\n amount,\n }),\n options,\n );\n}\n\ntype SpendOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendTransactionOptions;\ninterface SpendOptions extends SpendOptionsType {}\n\n// TODO: Rename to spendFraction\n/**\n * Spend a fraction of coin balance to another account. Useful if needed to drain account balance\n * completely, sending funds to another account (with fraction set to 1).\n * @category chain\n * @param fraction - Fraction of balance to spend (between 0 and 1)\n * @param recipientIdOrName - Address or name of recipient account\n * @param options - Options\n * @example\n * ```js\n * // `fraction` * 100 = % of AE to be transferred (e.g. `0.42` for 42% or `1` for 100%)\n * const { blockHeight } = await aeSdk.transferFunds(\n * 0.42,\n * 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E',\n * );\n * console.log('Transaction mined at', blockHeight);\n * ```\n */\nexport async function transferFunds(\n fraction: number | string, // TODO: accept only number\n recipientIdOrName: AensName | Encoded.AccountAddress | Encoded.ContractAddress,\n options: TransferFundsOptions,\n): ReturnType<typeof sendTransaction> {\n if (+fraction < 0 || +fraction > 1) {\n throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);\n }\n const recipientId = await resolveName(\n recipientIdOrName,\n 'account_pubkey',\n options,\n );\n const senderId = options.onAccount.address;\n const balance = new BigNumber(\n await getBalance.bind(options.onAccount)(senderId, options),\n );\n const desiredAmount = balance.times(fraction).integerValue(BigNumber.ROUND_HALF_UP);\n const { fee } = unpackTx(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId,\n recipientId,\n amount: desiredAmount,\n }),\n Tag.SpendTx,\n );\n // Reducing of the amount may reduce transaction fee, so this is not completely accurate\n const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;\n return sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId,\n recipientId,\n amount,\n }),\n options,\n );\n}\n\ntype TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendTransactionOptions;\ninterface TransferFundsOptions extends TransferFundsOptionsType {}\n\n/**\n * Submit transaction of another account paying for it (fee and gas)\n * @category chain\n * @param transaction - tx_<base64>-encoded transaction\n * @param options - Options\n * @returns Object Transaction\n */\nexport async function payForTransaction(\n transaction: Encoded.Transaction,\n options: PayForTransactionOptions,\n): ReturnType<typeof sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.PayingForTx,\n payerId: options.onAccount.address,\n tx: transaction,\n }),\n options,\n );\n}\n\ninterface PayForTransactionOptions extends\n BuildTxOptions<Tag.PayingForTx, 'payerId' | 'tx' | 'onNode'>, SendTransactionOptions {\n onAccount: AccountBase;\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,UAAU,EAAEC,WAAW;AAAA,SACvBC,eAAe;AAAA,SACfC,YAAY,EAAkBC,QAAQ;AAAA,SACtCC,aAAa;AAAA,SAEbC,GAAG;AAGZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CACzBC,MAAuB,EACvBC,iBAA8E,EAC9EC,OAAqB,EACe;EACpC,OAAOR,eAAe,CACpB,MAAMC,YAAY,CAAC;IACjBQ,gBAAgB,EAAE,IAAI;IACtB,GAAGD,OAAO;IACVE,GAAG,EAAEN,GAAG,CAACO,OAAO;IAChBC,QAAQ,EAAEJ,OAAO,CAACK,SAAS,CAACC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CAACH,GAAG,CAAC,GAAGJ,aAAa;EACvF,OAAOpB,eAAe,CACpB,MAAMC,YAAY,CAAC;IACjBQ,gBAAgB,EAAE,IAAI;IACtB,GAAGD,OAAO;IACVE,GAAG,EAAEN,GAAG,CAACO,OAAO;IAChBC,QAAQ;IACRG,WAAW;IACXT;EACF,CAAC,CAAC,EACFE,OACF,CAAC;AACH;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeoB,iBAAiBA,CACrCC,WAAgC,EAChCrB,OAAiC,EACG;EACpC,OAAOR,eAAe,CACpB,MAAMC,YAAY,CAAC;IACjBQ,gBAAgB,EAAE,IAAI;IACtB,GAAGD,OAAO;IACVE,GAAG,EAAEN,GAAG,CAAC0B,WAAW;IACpBC,OAAO,EAAEvB,OAAO,CAACK,SAAS,CAACC,OAAO;IAClCkB,EAAE,EAAEH;EACN,CAAC,CAAC,EACFrB,OACF,CAAC;AACH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Field } from './field-types';
|
|
2
|
+
import { Encoding, Encoded } from '../../utils/encoder';
|
|
3
|
+
type Schemas = ReadonlyArray<{
|
|
4
|
+
tag: {
|
|
5
|
+
constValue: number;
|
|
6
|
+
} & Field;
|
|
7
|
+
version: {
|
|
8
|
+
constValue: number;
|
|
9
|
+
constValueOptional: boolean;
|
|
10
|
+
} & Field;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function getSchema(schemas: Schemas, Tag: {
|
|
13
|
+
[key: number]: string;
|
|
14
|
+
}, tag: number, version: number | undefined): Array<[string, Field]>;
|
|
15
|
+
export declare function packRecord<E extends Encoding>(schemas: Schemas, Tag: {
|
|
16
|
+
[key: number]: string;
|
|
17
|
+
}, params: {
|
|
18
|
+
tag: number;
|
|
19
|
+
version?: number;
|
|
20
|
+
[k: string]: unknown;
|
|
21
|
+
}, extraParams: {
|
|
22
|
+
[k: string]: unknown;
|
|
23
|
+
}, encoding: E): Encoded.Generic<E>;
|
|
24
|
+
export declare function unpackRecord(schemas: Schemas, Tag: {
|
|
25
|
+
[key: number]: string;
|
|
26
|
+
}, encodedRecord: Encoded.Any, expectedTag: number | undefined, extraParams: {
|
|
27
|
+
[k: string]: unknown;
|
|
28
|
+
}): unknown;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _rlp from 'rlp';
|
|
2
|
+
const {
|
|
3
|
+
decode: rlpDecode,
|
|
4
|
+
encode: rlpEncode
|
|
5
|
+
} = _rlp;
|
|
6
|
+
import { ArgumentError, DecodeError, SchemaNotFoundError, InternalError } from "../../utils/errors.mjs";
|
|
7
|
+
import { encode, decode } from "../../utils/encoder.mjs";
|
|
8
|
+
import { readInt } from "./helpers.mjs";
|
|
9
|
+
export function getSchema(schemas, Tag, tag, version) {
|
|
10
|
+
const subSchemas = schemas.filter(s => s.tag.constValue === tag);
|
|
11
|
+
if (subSchemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);
|
|
12
|
+
if (version == null) {
|
|
13
|
+
const defaultSchema = subSchemas.find(schema => schema.version.constValueOptional);
|
|
14
|
+
if (defaultSchema == null) throw new InternalError(`Can't find default schema of ${Tag[tag]} (${tag})`);
|
|
15
|
+
version = defaultSchema.version.constValue;
|
|
16
|
+
}
|
|
17
|
+
const schema = subSchemas.find(s => s.version.constValue === version);
|
|
18
|
+
if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);
|
|
19
|
+
return Object.entries(schema);
|
|
20
|
+
}
|
|
21
|
+
export function packRecord(schemas, Tag, params, extraParams, encoding) {
|
|
22
|
+
const schema = getSchema(schemas, Tag, params.tag, params.version);
|
|
23
|
+
const binary = schema.map(([key, field]) => field.serialize(params[key], {
|
|
24
|
+
...params,
|
|
25
|
+
...extraParams
|
|
26
|
+
}, params));
|
|
27
|
+
return encode(rlpEncode(binary), encoding);
|
|
28
|
+
}
|
|
29
|
+
export function unpackRecord(schemas, Tag, encodedRecord, expectedTag, extraParams) {
|
|
30
|
+
const binary = rlpDecode(decode(encodedRecord));
|
|
31
|
+
const tag = +readInt(binary[0]);
|
|
32
|
+
const version = +readInt(binary[1]);
|
|
33
|
+
const schema = getSchema(schemas, Tag, tag, version);
|
|
34
|
+
if (expectedTag != null && expectedTag !== tag) {
|
|
35
|
+
throw new DecodeError(`Expected ${Tag[expectedTag]} tag, got ${Tag[tag]} instead`);
|
|
36
|
+
}
|
|
37
|
+
if (binary.length !== schema.length) {
|
|
38
|
+
throw new ArgumentError('RLP length', schema.length, binary.length);
|
|
39
|
+
}
|
|
40
|
+
return Object.fromEntries(schema.map(([name, field], index) => [name, field.deserialize(binary[index], extraParams)]));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=common.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.mjs","names":["_rlp","decode","rlpDecode","encode","rlpEncode","ArgumentError","DecodeError","SchemaNotFoundError","InternalError","readInt","getSchema","schemas","Tag","tag","version","subSchemas","filter","s","constValue","length","defaultSchema","find","schema","constValueOptional","Object","entries","packRecord","params","extraParams","encoding","binary","map","key","field","serialize","unpackRecord","encodedRecord","expectedTag","fromEntries","name","index","deserialize"],"sources":["../../../src/tx/builder/common.ts"],"sourcesContent":["import { decode as rlpDecode, encode as rlpEncode } from 'rlp';\nimport { Field, BinaryData } from './field-types';\nimport {\n ArgumentError, DecodeError, SchemaNotFoundError, InternalError,\n} from '../../utils/errors';\nimport {\n Encoding, Encoded, encode, decode,\n} from '../../utils/encoder';\nimport { readInt } from './helpers';\n\ntype Schemas = ReadonlyArray<{\n tag: { constValue: number } & Field;\n version: { constValue: number; constValueOptional: boolean } & Field;\n}>;\n\nexport function getSchema(\n schemas: Schemas,\n Tag: { [key: number]: string },\n tag: number,\n version: number | undefined,\n): Array<[string, Field]> {\n const subSchemas = schemas.filter((s) => s.tag.constValue === tag);\n if (subSchemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);\n if (version == null) {\n const defaultSchema = subSchemas.find((schema) => schema.version.constValueOptional);\n if (defaultSchema == null) throw new InternalError(`Can't find default schema of ${Tag[tag]} (${tag})`);\n version = defaultSchema.version.constValue;\n }\n const schema = subSchemas.find((s) => s.version.constValue === version);\n if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);\n return Object.entries(schema);\n}\n\nexport function packRecord<E extends Encoding>(\n schemas: Schemas,\n Tag: { [key: number]: string },\n params: {\n tag: number;\n version?: number;\n [k: string]: unknown;\n },\n extraParams: { [k: string]: unknown },\n encoding: E,\n): Encoded.Generic<E> {\n const schema = getSchema(schemas, Tag, params.tag, params.version);\n const binary = schema.map(([key, field]) => (\n field.serialize(params[key], { ...params, ...extraParams }, params)\n ));\n return encode(rlpEncode(binary), encoding);\n}\n\nexport function unpackRecord(\n schemas: Schemas,\n Tag: { [key: number]: string },\n encodedRecord: Encoded.Any,\n expectedTag: number | undefined,\n extraParams: { [k: string]: unknown },\n): unknown {\n const binary = rlpDecode(decode(encodedRecord));\n const tag = +readInt(binary[0] as Buffer);\n const version = +readInt(binary[1] as Buffer);\n const schema = getSchema(schemas, Tag, tag, version);\n if (expectedTag != null && expectedTag !== tag) {\n throw new DecodeError(`Expected ${Tag[expectedTag]} tag, got ${Tag[tag]} instead`);\n }\n if (binary.length !== schema.length) {\n throw new ArgumentError('RLP length', schema.length, binary.length);\n }\n return Object.fromEntries(\n schema.map(([name, field], index) => [\n name, field.deserialize(binary[index] as BinaryData, extraParams),\n ]),\n );\n}\n"],"mappings":"AAAA,OAAAA,IAAA,MAAyD,KAAK;AAAC;EAAAC,MAAA,EAAAC,SAAA;EAAAC,MAAA,EAAAC;AAAA,IAAAJ,IAAA;AAAA,SAG7DK,aAAa,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,aAAa;AAAA,SAG3CL,MAAM,EAAEF,MAAM;AAAA,SAE1BQ,OAAO;AAOhB,OAAO,SAASC,SAASA,CACvBC,OAAgB,EAChBC,GAA8B,EAC9B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
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
+
export declare const DRY_RUN_ACCOUNT: {
|
|
3
|
+
readonly pub: "ak_11111111111111111111111111111111273Yts";
|
|
4
|
+
readonly amount: 100000000000000000000000000000000000n;
|
|
5
|
+
};
|
|
2
6
|
export declare const MAX_AUTH_FUN_GAS = 50000;
|
|
3
7
|
export type Int = number | string | BigNumber;
|
|
4
8
|
export type AensName = `${string}.chain`;
|
|
5
|
-
export declare const NAME_TTL = 180000;
|
|
6
|
-
export declare const NAME_MAX_TTL = 36000;
|
|
7
|
-
export declare const NAME_MAX_CLIENT_TTL = 84600;
|
|
8
|
-
export declare const CLIENT_TTL = 84600;
|
|
9
9
|
export declare const MIN_GAS_PRICE = 1000000000;
|
|
10
10
|
export declare const NAME_FEE_MULTIPLIER = 100000000000000;
|
|
11
11
|
export declare const NAME_FEE_BID_INCREMENT = 0.05;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { mapObject } from "../../utils/other.mjs";
|
|
3
|
+
export const DRY_RUN_ACCOUNT = {
|
|
4
|
+
pub: 'ak_11111111111111111111111111111111273Yts',
|
|
5
|
+
amount: 100000000000000000000000000000000000n
|
|
6
|
+
};
|
|
3
7
|
export const MAX_AUTH_FUN_GAS = 50000;
|
|
4
|
-
|
|
5
|
-
// # AENS
|
|
6
|
-
|
|
7
|
-
export const NAME_TTL = 180000;
|
|
8
|
-
// # max number of block into the future that the name is going to be available
|
|
9
|
-
// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update
|
|
10
|
-
// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry
|
|
11
|
-
export const NAME_MAX_TTL = 36000;
|
|
12
|
-
export const NAME_MAX_CLIENT_TTL = 84600;
|
|
13
|
-
export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
|
|
14
|
-
export const MIN_GAS_PRICE = 1e9;
|
|
8
|
+
export const MIN_GAS_PRICE = 1e9; // TODO: don't use number for ae
|
|
15
9
|
// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
|
|
16
10
|
export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
|
|
17
11
|
export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
|
|
@@ -54,10 +48,7 @@ export const NAME_BID_RANGES = mapObject({
|
|
|
54
48
|
3: 2178309,
|
|
55
49
|
2: 3524578,
|
|
56
50
|
1: 5702887
|
|
57
|
-
},
|
|
58
|
-
let [key, value] = _ref;
|
|
59
|
-
return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
|
|
60
|
-
});
|
|
51
|
+
}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);
|
|
61
52
|
export let ConsensusProtocolVersion = /*#__PURE__*/function (ConsensusProtocolVersion) {
|
|
62
53
|
ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
|
|
63
54
|
ConsensusProtocolVersion[ConsensusProtocolVersion["Ceres"] = 6] = "Ceres";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","DRY_RUN_ACCOUNT","pub","amount","MAX_AUTH_FUN_GAS","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_RANGES","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const DRY_RUN_ACCOUNT = {\n pub: 'ak_11111111111111111111111111111111273Yts',\n amount: 100000000000000000000000000000000000n,\n} as const;\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\nexport type AensName = `${string}.chain`;\nexport const MIN_GAS_PRICE = 1e9; // TODO: don't use number for ae\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n Ceres = 6,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n Fate3 = 8,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n // CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n GaMetaTxAuthData = 810,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,eAAe,GAAG;EAC7BC,GAAG,EAAE,2CAA2C;EAChDC,MAAM,EAAE;AACV,CAAU;AAEV,OAAO,MAAMC,gBAAgB,GAAG,KAAK;AAGrC,OAAO,MAAMC,aAAa,GAAG,GAAG,CAAC,CAAC;AAClC;AACA,OAAO,MAAMC,mBAAmB,GAAG,IAAI,CAAC,CAAC;AACzC,OAAO,MAAMC,sBAAsB,GAAG,IAAI,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAAE;AACrC;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGV,SAAS,CAAC;EACvC,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,IAAI;EACR,EAAE,E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AA,OAAHA,GAAG;AAAA,OAyDb;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Encoded } from '../../../utils/encoder';
|
|
2
|
+
import { DelegationTag } from './schema';
|
|
3
|
+
import { DlgParams, DlgUnpacked } from './schema.generated';
|
|
4
|
+
/**
|
|
5
|
+
* Pack delegation
|
|
6
|
+
* @category delegation signature
|
|
7
|
+
* @param params - Params of delegation
|
|
8
|
+
* @returns Encoded delegation
|
|
9
|
+
*/
|
|
10
|
+
export declare function packDelegation(params: DlgParams): Encoded.Bytearray;
|
|
11
|
+
/**
|
|
12
|
+
* Unpack delegation
|
|
13
|
+
* @category delegation signature
|
|
14
|
+
* @param encoded - Encoded delegation
|
|
15
|
+
* @param expectedTag - Expected delegation signature type
|
|
16
|
+
* @returns Params of delegation
|
|
17
|
+
*/
|
|
18
|
+
export declare function unpackDelegation<T extends DelegationTag>(encoded: Encoded.Bytearray, expectedTag?: T): DlgUnpacked & {
|
|
19
|
+
tag: T;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Encoding } from "../../../utils/encoder.mjs";
|
|
2
|
+
import { packRecord, unpackRecord } from "../common.mjs";
|
|
3
|
+
import { DelegationTag, schemas } from "./schema.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Pack delegation
|
|
6
|
+
* @category delegation signature
|
|
7
|
+
* @param params - Params of delegation
|
|
8
|
+
* @returns Encoded delegation
|
|
9
|
+
*/
|
|
10
|
+
export function packDelegation(params) {
|
|
11
|
+
return packRecord(schemas, DelegationTag, params, {}, Encoding.Bytearray);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Unpack delegation
|
|
16
|
+
* @category delegation signature
|
|
17
|
+
* @param encoded - Encoded delegation
|
|
18
|
+
* @param expectedTag - Expected delegation signature type
|
|
19
|
+
* @returns Params of delegation
|
|
20
|
+
*/
|
|
21
|
+
export function unpackDelegation(encoded, expectedTag) {
|
|
22
|
+
return unpackRecord(schemas, DelegationTag, encoded, expectedTag, {});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Encoding","packRecord","unpackRecord","DelegationTag","schemas","packDelegation","params","Bytearray","unpackDelegation","encoded","expectedTag"],"sources":["../../../../src/tx/builder/delegation/index.ts"],"sourcesContent":["import { Encoded, Encoding } from '../../../utils/encoder';\nimport { packRecord, unpackRecord } from '../common';\nimport { DelegationTag, schemas } from './schema';\nimport { DlgParams, DlgUnpacked } from './schema.generated';\n\n/**\n * Pack delegation\n * @category delegation signature\n * @param params - Params of delegation\n * @returns Encoded delegation\n */\nexport function packDelegation(params: DlgParams): Encoded.Bytearray {\n return packRecord(schemas, DelegationTag, params, {}, Encoding.Bytearray);\n}\n\n/**\n * Unpack delegation\n * @category delegation signature\n * @param encoded - Encoded delegation\n * @param expectedTag - Expected delegation signature type\n * @returns Params of delegation\n */\nexport function unpackDelegation<T extends DelegationTag>(\n encoded: Encoded.Bytearray,\n expectedTag?: T,\n): DlgUnpacked & { tag: T } {\n return unpackRecord(schemas, DelegationTag, encoded, expectedTag, {}) as any;\n}\n"],"mappings":"SAAkBA,QAAQ;AAAA,SACjBC,UAAU,EAAEC,YAAY;AAAA,SACxBC,aAAa,EAAEC,OAAO;AAG/B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,MAAiB,EAAqB;EACnE,OAAOL,UAAU,CAACG,OAAO,EAAED,aAAa,EAAEG,MAAM,EAAE,CAAC,CAAC,EAAEN,QAAQ,CAACO,SAAS,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,OAA0B,EAC1BC,WAAe,EACW;EAC1B,OAAOR,YAAY,CAACE,OAAO,EAAED,aAAa,EAAEM,OAAO,EAAEC,WAAW,EAAE,CAAC,CAAC,CAAC;AACvE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import SchemaTypes from '../SchemaTypes';
|
|
3
|
+
import { Encoded } from '../../../utils/encoder';
|
|
4
|
+
/**
|
|
5
|
+
* @category delegation signature
|
|
6
|
+
*/
|
|
7
|
+
export declare enum DelegationTag {
|
|
8
|
+
AensWildcard = 1,
|
|
9
|
+
AensName = 2,
|
|
10
|
+
AensPreclaim = 3,
|
|
11
|
+
Oracle = 4,
|
|
12
|
+
OracleResponse = 5
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @see {@link https://github.com/aeternity/protocol/blob/8a9d1d1206174627f6aaef86159dc9c643080653/contracts/fate.md#from-ceres-serialized-signature-data}
|
|
16
|
+
*/
|
|
17
|
+
export declare const schemas: readonly [{
|
|
18
|
+
readonly tag: {
|
|
19
|
+
serialize: (value: DelegationTag.AensWildcard) => Buffer;
|
|
20
|
+
deserialize: (value: Buffer) => DelegationTag.AensWildcard;
|
|
21
|
+
constValue: DelegationTag.AensWildcard;
|
|
22
|
+
constValueOptional: boolean;
|
|
23
|
+
};
|
|
24
|
+
readonly version: {
|
|
25
|
+
serialize: (value?: 1 | undefined) => Buffer;
|
|
26
|
+
deserialize: (value: Buffer) => 1;
|
|
27
|
+
constValue: 1;
|
|
28
|
+
constValueOptional: boolean;
|
|
29
|
+
};
|
|
30
|
+
readonly accountAddress: {
|
|
31
|
+
serialize: (value: `ak_${string}`) => Buffer;
|
|
32
|
+
deserialize: (value: Buffer) => `ak_${string}`;
|
|
33
|
+
};
|
|
34
|
+
readonly contractAddress: {
|
|
35
|
+
serialize: (value: `ct_${string}`) => Buffer;
|
|
36
|
+
deserialize: (value: Buffer) => `ct_${string}`;
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
readonly tag: {
|
|
40
|
+
serialize: (value: DelegationTag.AensName) => Buffer;
|
|
41
|
+
deserialize: (value: Buffer) => DelegationTag.AensName;
|
|
42
|
+
constValue: DelegationTag.AensName;
|
|
43
|
+
constValueOptional: boolean;
|
|
44
|
+
};
|
|
45
|
+
readonly version: {
|
|
46
|
+
serialize: (value?: 1 | undefined) => Buffer;
|
|
47
|
+
deserialize: (value: Buffer) => 1;
|
|
48
|
+
constValue: 1;
|
|
49
|
+
constValueOptional: boolean;
|
|
50
|
+
};
|
|
51
|
+
readonly accountAddress: {
|
|
52
|
+
serialize: (value: `ak_${string}`) => Buffer;
|
|
53
|
+
deserialize: (value: Buffer) => `ak_${string}`;
|
|
54
|
+
};
|
|
55
|
+
readonly nameId: {
|
|
56
|
+
serialize(value: `${string}.chain` | `nm_${string}`): Buffer;
|
|
57
|
+
deserialize: (value: Buffer) => `nm_${string}`;
|
|
58
|
+
};
|
|
59
|
+
readonly contractAddress: {
|
|
60
|
+
serialize: (value: `ct_${string}`) => Buffer;
|
|
61
|
+
deserialize: (value: Buffer) => `ct_${string}`;
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
readonly tag: {
|
|
65
|
+
serialize: (value: DelegationTag.AensPreclaim) => Buffer;
|
|
66
|
+
deserialize: (value: Buffer) => DelegationTag.AensPreclaim;
|
|
67
|
+
constValue: DelegationTag.AensPreclaim;
|
|
68
|
+
constValueOptional: boolean;
|
|
69
|
+
};
|
|
70
|
+
readonly version: {
|
|
71
|
+
serialize: (value?: 1 | undefined) => Buffer;
|
|
72
|
+
deserialize: (value: Buffer) => 1;
|
|
73
|
+
constValue: 1;
|
|
74
|
+
constValueOptional: boolean;
|
|
75
|
+
};
|
|
76
|
+
readonly accountAddress: {
|
|
77
|
+
serialize: (value: `ak_${string}`) => Buffer;
|
|
78
|
+
deserialize: (value: Buffer) => `ak_${string}`;
|
|
79
|
+
};
|
|
80
|
+
readonly contractAddress: {
|
|
81
|
+
serialize: (value: `ct_${string}`) => Buffer;
|
|
82
|
+
deserialize: (value: Buffer) => `ct_${string}`;
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
readonly tag: {
|
|
86
|
+
serialize: (value: DelegationTag.Oracle) => Buffer;
|
|
87
|
+
deserialize: (value: Buffer) => DelegationTag.Oracle;
|
|
88
|
+
constValue: DelegationTag.Oracle;
|
|
89
|
+
constValueOptional: boolean;
|
|
90
|
+
};
|
|
91
|
+
readonly version: {
|
|
92
|
+
serialize: (value?: 1 | undefined) => Buffer;
|
|
93
|
+
deserialize: (value: Buffer) => 1;
|
|
94
|
+
constValue: 1;
|
|
95
|
+
constValueOptional: boolean;
|
|
96
|
+
};
|
|
97
|
+
readonly accountAddress: {
|
|
98
|
+
serialize: (value: `ak_${string}`) => Buffer;
|
|
99
|
+
deserialize: (value: Buffer) => `ak_${string}`;
|
|
100
|
+
};
|
|
101
|
+
readonly contractAddress: {
|
|
102
|
+
serialize: (value: `ct_${string}`) => Buffer;
|
|
103
|
+
deserialize: (value: Buffer) => `ct_${string}`;
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
106
|
+
readonly tag: {
|
|
107
|
+
serialize: (value: DelegationTag.OracleResponse) => Buffer;
|
|
108
|
+
deserialize: (value: Buffer) => DelegationTag.OracleResponse;
|
|
109
|
+
constValue: DelegationTag.OracleResponse;
|
|
110
|
+
constValueOptional: boolean;
|
|
111
|
+
};
|
|
112
|
+
readonly version: {
|
|
113
|
+
serialize: (value?: 1 | undefined) => Buffer;
|
|
114
|
+
deserialize: (value: Buffer) => 1;
|
|
115
|
+
constValue: 1;
|
|
116
|
+
constValueOptional: boolean;
|
|
117
|
+
};
|
|
118
|
+
readonly queryId: {
|
|
119
|
+
readonly serialize: (value: Encoded.OracleQueryId) => Buffer;
|
|
120
|
+
readonly deserialize: (value: Buffer) => Encoded.OracleQueryId;
|
|
121
|
+
};
|
|
122
|
+
readonly contractAddress: {
|
|
123
|
+
serialize: (value: `ct_${string}`) => Buffer;
|
|
124
|
+
deserialize: (value: Buffer) => `ct_${string}`;
|
|
125
|
+
};
|
|
126
|
+
}];
|
|
127
|
+
type Schemas = SchemaTypes<typeof schemas>;
|
|
128
|
+
export type DlgParams = Schemas['TxParams'];
|
|
129
|
+
export type DlgUnpacked = Schemas['TxUnpacked'];
|
|
130
|
+
export {};
|