@aeternity/aepp-sdk 13.2.1 → 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 +7288 -9464
- 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.d.ts +1 -1
- package/es/Middleware.mjs +32 -28
- 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 +11 -3
- package/es/Node.mjs +65 -57
- 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.d.ts +2 -5
- package/es/aepp-wallet-communication/wallet-detector.mjs +13 -9
- 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 +10 -2
- package/es/contract/Contract.mjs +83 -79
- 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 +12 -11
- package/es/contract/compiler/Cli.mjs +52 -25
- 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 +48 -0
- package/es/deprecated.mjs +66 -1
- package/es/deprecated.mjs.map +1 -1
- package/es/index-browser.d.ts +11 -6
- package/es/index-browser.mjs +10 -6
- 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 +6 -5
- package/es/tx/builder/constants.mjs +7 -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.d.ts +1 -1
- package/es/tx/builder/field-types/ct-version.mjs +4 -5
- 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 +57 -39
- 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 +53 -4
- 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 +41 -25
- 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 +9 -5
- package/es/utils/crypto.mjs +18 -14
- 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.d.ts +0 -2
- package/es/utils/typed-data.mjs +8 -23
- 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 +17 -9
- package/src/MiddlewareSubscriber.ts +1 -1
- package/src/Node.ts +51 -21
- 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 +14 -1
- package/src/aepp-wallet-communication/schema.ts +2 -0
- package/src/aepp-wallet-communication/wallet-detector.ts +10 -10
- 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 +36 -12
- package/src/contract/compiler/Base.ts +15 -8
- package/src/contract/compiler/Cli.ts +44 -23
- 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 +55 -1
- package/src/index-browser.ts +18 -11
- 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 +7 -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/ct-version.ts +1 -1
- package/src/tx/builder/field-types/entry.ts +1 -4
- package/src/tx/builder/field-types/fee.ts +72 -44
- package/src/tx/builder/field-types/gas-limit.ts +4 -4
- package/src/tx/builder/field-types/gas-price.ts +59 -3
- 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 +37 -28
- package/src/utils/crypto.ts +24 -14
- 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/typed-data.ts +4 -30
- 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/Middleware.d.ts +1 -1
- package/types-legacy/ts4.2/Node.d.ts +15 -2
- 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/aepp-wallet-communication/wallet-detector.d.ts +2 -5
- 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 +10 -2
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +12 -11
- 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 +48 -0
- package/types-legacy/ts4.2/index-browser.d.ts +11 -6
- 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 +6 -5
- 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/ct-version.d.ts +1 -1
- 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 +9 -5
- 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/typed-data.d.ts +0 -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/Middleware.d.ts +1 -1
- package/types-legacy/ts4.5/Node.d.ts +15 -2
- 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/aepp-wallet-communication/wallet-detector.d.ts +2 -5
- 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 +10 -2
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +12 -11
- 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 +48 -0
- package/types-legacy/ts4.5/index-browser.d.ts +11 -6
- 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 +6 -5
- 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/ct-version.d.ts +1 -1
- 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 +9 -5
- 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/typed-data.d.ts +0 -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
package/es/Node.mjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
|
|
2
1
|
import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/classPrivateFieldSet";
|
|
2
|
+
import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
|
|
3
3
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
4
4
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
5
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
6
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { _assertClassBrand(privateSet, receiver); return fn; }
|
|
7
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
7
8
|
// eslint-disable-next-line max-classes-per-file
|
|
8
9
|
import BigNumber from 'bignumber.js';
|
|
10
|
+
import { userAgentPolicyName, setClientRequestIdPolicyName } from '@azure/core-rest-pipeline';
|
|
9
11
|
import { genRequestQueuesPolicy, genCombineGetRequestsPolicy, genErrorFormatterPolicy, genVersionCheckPolicy, genRetryOnFailurePolicy } from "./utils/autorest.mjs";
|
|
10
12
|
import { Node as NodeApi } from "./apis/node/index.mjs";
|
|
11
13
|
import { mapObject } from "./utils/other.mjs";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
import { UnsupportedVersionError } from "./utils/errors.mjs";
|
|
15
|
+
import { ConsensusProtocolVersion } from "./tx/builder/constants.mjs";
|
|
16
|
+
const bigIntPropertyNames = ['balance', 'queryFee', 'fee', 'amount', 'nameFee', 'channelAmount', 'initiatorAmount', 'responderAmount', 'channelReserve', 'initiatorAmountFinal', 'responderAmountFinal', 'gasPrice', 'minGasPrice', 'deposit'];
|
|
17
|
+
const numberPropertyNames = ['time', 'gas', 'gasUsed', 'nameSalt', 'nonce', 'nextNonce', 'height', 'blockHeight', 'topBlockHeight', 'ttl', 'nameTtl', 'clientTtl', 'inbound', 'outbound', 'peerCount', 'pendingTransactionsCount', 'effectiveAtHeight', 'version', 'solutions', 'round', 'minutes', 'utilization', 'difficulty', 'hashrate'];
|
|
14
18
|
var _mapData = /*#__PURE__*/new WeakSet();
|
|
15
19
|
var _encodeArg = /*#__PURE__*/new WeakSet();
|
|
16
20
|
var _decodeRes = /*#__PURE__*/new WeakSet();
|
|
17
21
|
class NodeTransformed extends NodeApi {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...
|
|
22
|
+
constructor(...args) {
|
|
23
|
+
super(...args);
|
|
20
24
|
_classPrivateMethodInitSpec(this, _decodeRes);
|
|
21
25
|
_classPrivateMethodInitSpec(this, _encodeArg);
|
|
22
26
|
_classPrivateMethodInitSpec(this, _mapData);
|
|
23
27
|
}
|
|
24
28
|
async sendOperationRequest(operationArguments, operationSpec) {
|
|
25
|
-
const args = mapObject(operationArguments,
|
|
26
|
-
let [key, value] = _ref;
|
|
27
|
-
return [key, _classPrivateMethodGet(this, _encodeArg, _encodeArg2).call(this, value)];
|
|
28
|
-
});
|
|
29
|
+
const args = mapObject(operationArguments, ([key, value]) => [key, _classPrivateMethodGet(this, _encodeArg, _encodeArg2).call(this, value)]);
|
|
29
30
|
return _classPrivateMethodGet(this, _decodeRes, _decodeRes2).call(this, await super.sendOperationRequest(args, operationSpec));
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
function _mapData2(data, transform) {
|
|
33
34
|
if (Array.isArray(data)) return data.map(d => _classPrivateMethodGet(this, _mapData, _mapData2).call(this, d, transform));
|
|
34
35
|
if (data != null && typeof data === 'object') {
|
|
35
|
-
return mapObject(data,
|
|
36
|
-
let [key, value] = _ref6;
|
|
36
|
+
return mapObject(data, ([key, value]) => {
|
|
37
37
|
if (value == null) return [key, value];
|
|
38
38
|
if (bigIntPropertyNames.some(k => k === key)) return [key, transform.bigInt(value)];
|
|
39
39
|
if (numberPropertyNames.some(k => k === key)) return [key, transform.number(value)];
|
|
@@ -57,82 +57,90 @@ function _decodeRes2(data) {
|
|
|
57
57
|
number: value => +value
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
var
|
|
60
|
+
var _cachedStatusPromise = /*#__PURE__*/new WeakMap();
|
|
61
61
|
export default class Node extends NodeTransformed {
|
|
62
62
|
/**
|
|
63
63
|
* @param url - Url for node API
|
|
64
64
|
* @param options - Options
|
|
65
|
-
* @param options.ignoreVersion - Don't
|
|
65
|
+
* @param options.ignoreVersion - Don't ensure that the node is supported
|
|
66
66
|
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
67
67
|
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
68
68
|
*/
|
|
69
|
-
constructor(url
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
constructor(url, {
|
|
70
|
+
ignoreVersion = false,
|
|
71
|
+
retryCount = 3,
|
|
72
|
+
retryOverallDelay = 800,
|
|
73
|
+
...options
|
|
74
|
+
} = {}) {
|
|
75
|
+
const getVersion = async opts => (await this._getCachedStatus(opts)).nodeVersion;
|
|
76
76
|
// eslint-disable-next-line constructor-super
|
|
77
77
|
super(url, {
|
|
78
78
|
allowInsecureConnection: true,
|
|
79
|
-
additionalPolicies: [genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genRetryOnFailurePolicy(retryCount, retryOverallDelay), genErrorFormatterPolicy(body => ` ${body.
|
|
79
|
+
additionalPolicies: [...(ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '7.0.0')]), genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genRetryOnFailurePolicy(retryCount, retryOverallDelay), genErrorFormatterPolicy(body => [' ', body.reason, body.errorCode == null ? '' : ` (${body.errorCode})`].join(''))],
|
|
80
80
|
...options
|
|
81
81
|
});
|
|
82
|
-
_classPrivateFieldInitSpec(this,
|
|
82
|
+
_classPrivateFieldInitSpec(this, _cachedStatusPromise, {
|
|
83
83
|
writable: true,
|
|
84
84
|
value: void 0
|
|
85
85
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
networkId
|
|
97
|
-
} = _ref3;
|
|
98
|
-
return networkId;
|
|
99
|
-
}, error => error));
|
|
100
|
-
this.pipeline.addPolicy(genVersionCheckPolicy('node', '/v3/status', versionPromise, '6.2.0', '7.0.0'));
|
|
101
|
-
}
|
|
86
|
+
this.pipeline.removePolicy({
|
|
87
|
+
name: userAgentPolicyName
|
|
88
|
+
});
|
|
89
|
+
this.pipeline.removePolicy({
|
|
90
|
+
name: setClientRequestIdPolicyName
|
|
91
|
+
});
|
|
92
|
+
// TODO: use instead our retry policy
|
|
93
|
+
this.pipeline.removePolicy({
|
|
94
|
+
name: 'defaultRetryPolicy'
|
|
95
|
+
});
|
|
102
96
|
this.intAsString = true;
|
|
103
97
|
}
|
|
98
|
+
async _getCachedStatus(options) {
|
|
99
|
+
if (_classPrivateFieldGet(this, _cachedStatusPromise) != null) return _classPrivateFieldGet(this, _cachedStatusPromise);
|
|
100
|
+
return this.getStatus(options);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// eslint-disable-next-line rulesdir/tsdoc-syntax
|
|
104
|
+
/** @ts-expect-error use code generation to create node class? */
|
|
105
|
+
async getStatus(...args) {
|
|
106
|
+
const promise = super.getStatus(...args);
|
|
107
|
+
promise.then(() => {
|
|
108
|
+
_classPrivateFieldSet(this, _cachedStatusPromise, promise);
|
|
109
|
+
}, () => {});
|
|
110
|
+
return promise;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Returns network ID provided by node.
|
|
115
|
+
* This method won't do extra requests on subsequent calls.
|
|
116
|
+
*/
|
|
104
117
|
async getNetworkId() {
|
|
105
|
-
|
|
106
|
-
(_classPrivateFieldGet2 = _classPrivateFieldGet(this, _networkIdPromise)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _classPrivateFieldSet(this, _networkIdPromise, this.getStatus().then(_ref4 => {
|
|
107
|
-
let {
|
|
108
|
-
networkId
|
|
109
|
-
} = _ref4;
|
|
110
|
-
return networkId;
|
|
111
|
-
}));
|
|
112
|
-
const networkId = await _classPrivateFieldGet(this, _networkIdPromise);
|
|
113
|
-
if (networkId instanceof Error) throw networkId;
|
|
114
|
-
return networkId;
|
|
118
|
+
return (await this._getCachedStatus()).networkId;
|
|
115
119
|
}
|
|
116
120
|
async getNodeInfo() {
|
|
117
121
|
const {
|
|
118
|
-
nodeVersion
|
|
122
|
+
nodeVersion,
|
|
119
123
|
networkId: nodeNetworkId,
|
|
120
124
|
protocols,
|
|
121
125
|
topBlockHeight
|
|
122
126
|
} = await this.getStatus();
|
|
123
|
-
const consensusProtocolVersion = protocols.filter(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref5;
|
|
127
|
-
return topBlockHeight >= effectiveAtHeight;
|
|
128
|
-
}).reduce((acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc, {
|
|
127
|
+
const consensusProtocolVersion = protocols.filter(({
|
|
128
|
+
effectiveAtHeight
|
|
129
|
+
}) => topBlockHeight >= effectiveAtHeight).reduce((acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc, {
|
|
129
130
|
effectiveAtHeight: -1,
|
|
130
131
|
version: 0
|
|
131
132
|
}).version;
|
|
133
|
+
if (ConsensusProtocolVersion[consensusProtocolVersion] == null) {
|
|
134
|
+
const version = consensusProtocolVersion.toString();
|
|
135
|
+
const versions = Object.values(ConsensusProtocolVersion).filter(el => typeof el === 'number').map(el => +el);
|
|
136
|
+
const geVersion = Math.min(...versions).toString();
|
|
137
|
+
const ltVersion = (Math.max(...versions) + 1).toString();
|
|
138
|
+
throw new UnsupportedVersionError('consensus protocol', version, geVersion, ltVersion);
|
|
139
|
+
}
|
|
132
140
|
return {
|
|
133
141
|
url: this.$host,
|
|
134
142
|
nodeNetworkId,
|
|
135
|
-
version,
|
|
143
|
+
version: nodeVersion,
|
|
136
144
|
consensusProtocolVersion
|
|
137
145
|
};
|
|
138
146
|
}
|
package/es/Node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.mjs","names":["BigNumber","genRequestQueuesPolicy","genCombineGetRequestsPolicy","genErrorFormatterPolicy","genVersionCheckPolicy","genRetryOnFailurePolicy","Node","NodeApi","mapObject","bigIntPropertyNames","numberPropertyNames","_mapData","WeakSet","_encodeArg","_decodeRes","NodeTransformed","constructor","arguments","_classPrivateMethodInitSpec","sendOperationRequest","operationArguments","operationSpec","args","_ref","key","value","_classPrivateMethodGet","_encodeArg2","call","_decodeRes2","_mapData2","data","transform","Array","isArray","map","d","_ref6","some","k","bigInt","number","toFixed","toString","BigInt","_networkIdPromise","WeakMap","url","ignoreVersion","retryCount","retryOverallDelay","options","length","undefined","allowInsecureConnection","additionalPolicies","body","reason","_classPrivateFieldInitSpec","writable","statusPromise","getStatus","versionPromise","then","_ref2","nodeVersion","error","_classPrivateFieldSet","_ref3","networkId","pipeline","addPolicy","intAsString","getNetworkId","_classPrivateFieldGet2","_classPrivateFieldGet","_ref4","Error","getNodeInfo","version","nodeNetworkId","protocols","topBlockHeight","consensusProtocolVersion","filter","_ref5","effectiveAtHeight","reduce","acc","p","$host"],"sources":["../src/Node.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport BigNumber from 'bignumber.js';\nimport { OperationArguments, OperationSpec } from '@azure/core-client';\nimport {\n genRequestQueuesPolicy, genCombineGetRequestsPolicy, genErrorFormatterPolicy,\n genVersionCheckPolicy, genRetryOnFailurePolicy,\n} from './utils/autorest';\nimport { Node as NodeApi, NodeOptionalParams, ErrorModel } from './apis/node';\nimport { mapObject } from './utils/other';\nimport { Encoded } from './utils/encoder';\nimport { ConsensusProtocolVersion } from './tx/builder/constants';\n\nconst bigIntPropertyNames = [\n 'balance', 'queryFee', 'fee', 'amount', 'nameFee', 'channelAmount',\n 'initiatorAmount', 'responderAmount', 'channelReserve', 'initiatorAmountFinal',\n 'responderAmountFinal', 'gasPrice', 'deposit',\n] as const;\n\nconst numberPropertyNames = [\n 'time', 'gas', 'gasUsed', 'nameSalt',\n 'nonce', 'nextNonce', 'height', 'blockHeight', 'topBlockHeight',\n 'ttl', 'nameTtl', 'clientTtl',\n 'inbound', 'outbound', 'peerCount', 'pendingTransactionsCount', 'effectiveAtHeight',\n 'version', 'solutions', 'round',\n] as const;\n\nclass NodeTransformed extends NodeApi {\n override async sendOperationRequest(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<any> {\n const args = mapObject(\n operationArguments,\n ([key, value]) => [key, this.#encodeArg(value)],\n ) as OperationArguments;\n return this.#decodeRes(await super.sendOperationRequest(args, operationSpec));\n }\n\n #mapData(data: any, transform: {\n bigInt: (v: any) => any;\n number: (v: any) => any;\n }): unknown {\n if (Array.isArray(data)) return data.map((d) => this.#mapData(d, transform));\n if (data != null && typeof data === 'object') {\n return mapObject(data, ([key, value]) => {\n if (value == null) return [key, value];\n if (bigIntPropertyNames.some((k) => k === key)) return [key, transform.bigInt(value)];\n if (numberPropertyNames.some((k) => k === key)) return [key, transform.number(value)];\n return [key, this.#mapData(value, transform)];\n });\n }\n return data;\n }\n\n #encodeArg(data: any): any {\n return this.#mapData(data, {\n bigInt: (value) => {\n if (value instanceof BigNumber) return value.toFixed();\n return value.toString();\n },\n number: (value) => value.toString(),\n });\n }\n\n #decodeRes(data: any): any {\n return this.#mapData(data, {\n bigInt: (value) => BigInt(value),\n number: (value) => +value,\n });\n }\n}\n\ntype BigIntPropertyNames = typeof bigIntPropertyNames[number];\ntype NumberPropertyNames = typeof numberPropertyNames[number];\ntype PreserveOptional<NewType, OrigType> =\n OrigType extends undefined ? NewType | undefined : NewType;\nexport type TransformNodeType<Type> =\n Type extends (...args: infer Args) => infer Ret\n ? (...args: TransformNodeType<Args>) => TransformNodeType<Ret>\n : Type extends [infer Item, ...infer Rest]\n ? [TransformNodeType<Item>, ...TransformNodeType<Rest>]\n : Type extends Array<infer Item>\n ? Array<TransformNodeType<Item>>\n : Type extends Promise<infer T>\n ? Promise<TransformNodeType<T>>\n : Type extends { [P in any]: any }\n ? {\n [Property in keyof Type]:\n Property extends BigIntPropertyNames\n ? PreserveOptional<bigint, Type[Property]>\n : Property extends NumberPropertyNames\n ? PreserveOptional<number, Type[Property]>\n : Property extends 'txHash'\n ? PreserveOptional<Encoded.TxHash, Type[Property]>\n : Property extends 'bytecode'\n ? PreserveOptional<Encoded.ContractBytearray, Type[Property]>\n : TransformNodeType<Type[Property]>\n }\n : Type;\ntype NodeTransformedApi = new (...args: ConstructorParameters<typeof NodeApi>) => {\n [Name in keyof InstanceType<typeof NodeApi>]:\n Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest'\n ? NodeApi[Name] : TransformNodeType<NodeApi[Name]>\n};\n\ninterface NodeInfo {\n url: string;\n nodeNetworkId: string;\n version: string;\n consensusProtocolVersion: ConsensusProtocolVersion;\n}\n\nexport default class Node extends (NodeTransformed as unknown as NodeTransformedApi) {\n #networkIdPromise?: Promise<string | Error>;\n\n /**\n * @param url - Url for node API\n * @param options - Options\n * @param options.ignoreVersion - Don't check node version\n * @param options.retryCount - Amount of extra requests to do in case of failure\n * @param options.retryOverallDelay - Time in ms to wait between all retries\n */\n constructor(\n url: string,\n {\n ignoreVersion = false, retryCount = 3, retryOverallDelay = 800, ...options\n }: NodeOptionalParams & {\n ignoreVersion?: boolean;\n retryCount?: number;\n retryOverallDelay?: number;\n } = {},\n ) {\n // eslint-disable-next-line constructor-super\n super(url, {\n allowInsecureConnection: true,\n additionalPolicies: [\n genRequestQueuesPolicy(),\n genCombineGetRequestsPolicy(),\n genRetryOnFailurePolicy(retryCount, retryOverallDelay),\n genErrorFormatterPolicy((body: ErrorModel) => ` ${body.reason}`),\n ],\n ...options,\n });\n if (!ignoreVersion) {\n const statusPromise = this.getStatus();\n const versionPromise = statusPromise.then(({ nodeVersion }) => nodeVersion, (error) => error);\n this.#networkIdPromise = statusPromise.then(({ networkId }) => networkId, (error) => error);\n this.pipeline.addPolicy(\n genVersionCheckPolicy('node', '/v3/status', versionPromise, '6.2.0', '7.0.0'),\n );\n }\n this.intAsString = true;\n }\n\n async getNetworkId(): Promise<string> {\n this.#networkIdPromise ??= this.getStatus().then(({ networkId }) => networkId);\n const networkId = await this.#networkIdPromise;\n if (networkId instanceof Error) throw networkId;\n return networkId;\n }\n\n async getNodeInfo(): Promise<NodeInfo> {\n const {\n nodeVersion: version,\n networkId: nodeNetworkId,\n protocols,\n topBlockHeight,\n } = await this.getStatus();\n const consensusProtocolVersion = protocols\n .filter(({ effectiveAtHeight }) => topBlockHeight >= effectiveAtHeight)\n .reduce(\n (acc, p) => (p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc),\n { effectiveAtHeight: -1, version: 0 },\n )\n .version;\n return {\n url: this.$host,\n nodeNetworkId,\n version,\n consensusProtocolVersion,\n };\n }\n}\n"],"mappings":";;;;;;AAAA;AACA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAGnCC,sBAAsB,EAAEC,2BAA2B,EAAEC,uBAAuB,EAC5EC,qBAAqB,EAAEC,uBAAuB;AAAA,SAEvCC,IAAI,IAAIC,OAAO;AAAA,SACfC,SAAS;AAIlB,MAAMC,mBAAmB,GAAG,CAC1B,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAClE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,sBAAsB,EAC9E,sBAAsB,EAAE,UAAU,EAAE,SAAS,CACrC;AAEV,MAAMC,mBAAmB,GAAG,CAC1B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EACpC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAC/D,KAAK,EAAE,SAA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fV,aAAa;MACbD,OAAO;MACPI;IACF,CAAC;EACH;AACF"}
|
|
1
|
+
{"version":3,"file":"Node.mjs","names":["BigNumber","userAgentPolicyName","setClientRequestIdPolicyName","genRequestQueuesPolicy","genCombineGetRequestsPolicy","genErrorFormatterPolicy","genVersionCheckPolicy","genRetryOnFailurePolicy","Node","NodeApi","mapObject","UnsupportedVersionError","ConsensusProtocolVersion","bigIntPropertyNames","numberPropertyNames","_mapData","WeakSet","_encodeArg","_decodeRes","NodeTransformed","constructor","args","_classPrivateMethodInitSpec","sendOperationRequest","operationArguments","operationSpec","key","value","_classPrivateMethodGet","_encodeArg2","call","_decodeRes2","_mapData2","data","transform","Array","isArray","map","d","some","k","bigInt","number","toFixed","toString","BigInt","_cachedStatusPromise","WeakMap","url","ignoreVersion","retryCount","retryOverallDelay","options","getVersion","opts","_getCachedStatus","nodeVersion","allowInsecureConnection","additionalPolicies","body","reason","errorCode","join","_classPrivateFieldInitSpec","writable","pipeline","removePolicy","name","intAsString","_classPrivateFieldGet","getStatus","promise","then","_classPrivateFieldSet","getNetworkId","networkId","getNodeInfo","nodeNetworkId","protocols","topBlockHeight","consensusProtocolVersion","filter","effectiveAtHeight","reduce","acc","p","version","versions","Object","values","el","geVersion","Math","min","ltVersion","max","$host"],"sources":["../src/Node.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport BigNumber from 'bignumber.js';\nimport { OperationArguments, OperationOptions, OperationSpec } from '@azure/core-client';\nimport { userAgentPolicyName, setClientRequestIdPolicyName } from '@azure/core-rest-pipeline';\nimport {\n genRequestQueuesPolicy, genCombineGetRequestsPolicy, genErrorFormatterPolicy,\n genVersionCheckPolicy, genRetryOnFailurePolicy,\n} from './utils/autorest';\nimport { Node as NodeApi, NodeOptionalParams, ErrorModel } from './apis/node';\nimport { mapObject } from './utils/other';\nimport { UnsupportedVersionError } from './utils/errors';\nimport { Encoded } from './utils/encoder';\nimport { ConsensusProtocolVersion } from './tx/builder/constants';\n\nconst bigIntPropertyNames = [\n 'balance', 'queryFee', 'fee', 'amount', 'nameFee', 'channelAmount',\n 'initiatorAmount', 'responderAmount', 'channelReserve', 'initiatorAmountFinal',\n 'responderAmountFinal', 'gasPrice', 'minGasPrice', 'deposit',\n] as const;\n\nconst numberPropertyNames = [\n 'time', 'gas', 'gasUsed', 'nameSalt',\n 'nonce', 'nextNonce', 'height', 'blockHeight', 'topBlockHeight',\n 'ttl', 'nameTtl', 'clientTtl',\n 'inbound', 'outbound', 'peerCount', 'pendingTransactionsCount', 'effectiveAtHeight',\n 'version', 'solutions', 'round', 'minutes', 'utilization', 'difficulty', 'hashrate',\n] as const;\n\nclass NodeTransformed extends NodeApi {\n override async sendOperationRequest(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<any> {\n const args = mapObject(\n operationArguments,\n ([key, value]) => [key, this.#encodeArg(value)],\n ) as OperationArguments;\n return this.#decodeRes(await super.sendOperationRequest(args, operationSpec));\n }\n\n #mapData(data: any, transform: {\n bigInt: (v: any) => any;\n number: (v: any) => any;\n }): unknown {\n if (Array.isArray(data)) return data.map((d) => this.#mapData(d, transform));\n if (data != null && typeof data === 'object') {\n return mapObject(data, ([key, value]) => {\n if (value == null) return [key, value];\n if (bigIntPropertyNames.some((k) => k === key)) return [key, transform.bigInt(value)];\n if (numberPropertyNames.some((k) => k === key)) return [key, transform.number(value)];\n return [key, this.#mapData(value, transform)];\n });\n }\n return data;\n }\n\n #encodeArg(data: any): any {\n return this.#mapData(data, {\n bigInt: (value) => {\n if (value instanceof BigNumber) return value.toFixed();\n return value.toString();\n },\n number: (value) => value.toString(),\n });\n }\n\n #decodeRes(data: any): any {\n return this.#mapData(data, {\n bigInt: (value) => BigInt(value),\n number: (value) => +value,\n });\n }\n}\n\ntype BigIntPropertyNames = typeof bigIntPropertyNames[number];\ntype NumberPropertyNames = typeof numberPropertyNames[number];\ntype PreserveOptional<NewType, OrigType> =\n OrigType extends undefined ? NewType | undefined : NewType;\nexport type TransformNodeType<Type> =\n Type extends (...args: infer Args) => infer Ret\n ? (...args: TransformNodeType<Args>) => TransformNodeType<Ret>\n : Type extends [infer Item, ...infer Rest]\n ? [TransformNodeType<Item>, ...TransformNodeType<Rest>]\n : Type extends Array<infer Item>\n ? Array<TransformNodeType<Item>>\n : Type extends Promise<infer T>\n ? Promise<TransformNodeType<T>>\n : Type extends { [P in any]: any }\n ? {\n [Property in keyof Type]:\n Property extends BigIntPropertyNames\n ? PreserveOptional<bigint, Type[Property]>\n : Property extends NumberPropertyNames\n ? PreserveOptional<number, Type[Property]>\n : Property extends 'txHash'\n ? PreserveOptional<Encoded.TxHash, Type[Property]>\n : Property extends 'bytecode'\n ? PreserveOptional<Encoded.ContractBytearray, Type[Property]>\n : TransformNodeType<Type[Property]>\n }\n : Type;\ntype NodeTransformedApi = new (...args: ConstructorParameters<typeof NodeApi>) => {\n [Name in keyof InstanceType<typeof NodeApi>]:\n Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest'\n ? NodeApi[Name] : TransformNodeType<NodeApi[Name]>\n};\n\ninterface NodeInfo {\n url: string;\n nodeNetworkId: string;\n version: string;\n consensusProtocolVersion: ConsensusProtocolVersion;\n}\n\nexport default class Node extends (NodeTransformed as unknown as NodeTransformedApi) {\n /**\n * @param url - Url for node API\n * @param options - Options\n * @param options.ignoreVersion - Don't ensure that the node is supported\n * @param options.retryCount - Amount of extra requests to do in case of failure\n * @param options.retryOverallDelay - Time in ms to wait between all retries\n */\n constructor(\n url: string,\n {\n ignoreVersion = false, retryCount = 3, retryOverallDelay = 800, ...options\n }: NodeOptionalParams & {\n ignoreVersion?: boolean;\n retryCount?: number;\n retryOverallDelay?: number;\n } = {},\n ) {\n const getVersion = async (opts: OperationOptions): Promise<string> => (\n (await this._getCachedStatus(opts)).nodeVersion\n );\n // eslint-disable-next-line constructor-super\n super(url, {\n allowInsecureConnection: true,\n additionalPolicies: [\n ...ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '7.0.0')],\n genRequestQueuesPolicy(),\n genCombineGetRequestsPolicy(),\n genRetryOnFailurePolicy(retryCount, retryOverallDelay),\n genErrorFormatterPolicy((body: ErrorModel) => [\n ' ', body.reason, body.errorCode == null ? '' : ` (${body.errorCode})`,\n ].join('')),\n ],\n ...options,\n });\n this.pipeline.removePolicy({ name: userAgentPolicyName });\n this.pipeline.removePolicy({ name: setClientRequestIdPolicyName });\n // TODO: use instead our retry policy\n this.pipeline.removePolicy({ name: 'defaultRetryPolicy' });\n this.intAsString = true;\n }\n\n #cachedStatusPromise?: ReturnType<Node['getStatus']>;\n\n async _getCachedStatus(options?: OperationOptions): ReturnType<Node['getStatus']> {\n if (this.#cachedStatusPromise != null) return this.#cachedStatusPromise;\n return this.getStatus(options);\n }\n\n // eslint-disable-next-line rulesdir/tsdoc-syntax\n /** @ts-expect-error use code generation to create node class? */\n override async getStatus(\n ...args: Parameters<InstanceType<NodeTransformedApi>['getStatus']>\n ): ReturnType<InstanceType<NodeTransformedApi>['getStatus']> {\n const promise = super.getStatus(...args);\n promise.then(() => { this.#cachedStatusPromise = promise; }, () => {});\n return promise;\n }\n\n /**\n * Returns network ID provided by node.\n * This method won't do extra requests on subsequent calls.\n */\n async getNetworkId(): Promise<string> {\n return (await this._getCachedStatus()).networkId;\n }\n\n async getNodeInfo(): Promise<NodeInfo> {\n const {\n nodeVersion,\n networkId: nodeNetworkId,\n protocols,\n topBlockHeight,\n } = await this.getStatus();\n\n const consensusProtocolVersion = protocols\n .filter(({ effectiveAtHeight }) => topBlockHeight >= effectiveAtHeight)\n .reduce(\n (acc, p) => (p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc),\n { effectiveAtHeight: -1, version: 0 },\n )\n .version;\n if (ConsensusProtocolVersion[consensusProtocolVersion] == null) {\n const version = consensusProtocolVersion.toString();\n const versions = Object.values(ConsensusProtocolVersion)\n .filter((el) => typeof el === 'number').map((el) => +el);\n const geVersion = Math.min(...versions).toString();\n const ltVersion = (Math.max(...versions) + 1).toString();\n throw new UnsupportedVersionError('consensus protocol', version, geVersion, ltVersion);\n }\n\n return {\n url: this.$host,\n nodeNetworkId,\n version: nodeVersion,\n consensusProtocolVersion,\n };\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA,OAAOA,SAAS,MAAM,cAAc;AAEpC,SAASC,mBAAmB,EAAEC,4BAA4B,QAAQ,2BAA2B;AAAC,SAE5FC,sBAAsB,EAAEC,2BAA2B,EAAEC,uBAAuB,EAC5EC,qBAAqB,EAAEC,uBAAuB;AAAA,SAEvCC,IAAI,IAAIC,OAAO;AAAA,SACfC,SAAS;AAAA,SACTC,uBAAuB;AAAA,SAEvBC,wBAAwB;AAEjC,MAAMC,mBAAmB,GAAG,CAC1B,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAClE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,sBAAsB,EAC9E,sBAAsB,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CACpD;AAEV,MAAMC,mBAAmB,GAAG,CAC1B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EACpC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAC/D,KAAK,EAAE,SAAS,EAAE,WAAW,EAC7B,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,0BAA0B,EAAE,mBAAmB,EACnF,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,CAC3E;AAAC,IAAAC,QAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,UAAA,oBAAAF,OAAA;AAEX,MAAMG,eAAe,SAASV,OAAO,CAAC;EAAAW,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,2BAAA,OAAAJ,UAAA;IAAAI,2BAAA,OAAAL,UAAA;IAAAK,2BAAA,OAAAP,QAAA;E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AAI,CAACG,GAAG,CAAC,GAAGR,QAAQ,CAAC,GAAG,CAAC,EAAE3C,QAAQ,CAAC,CAAC;MACxD,MAAM,IAAIjC,uBAAuB,CAAC,oBAAoB,EAAE2E,OAAO,EAAEK,SAAS,EAAEG,SAAS,CAAC;IACxF;IAEA,OAAO;MACL9C,GAAG,EAAE,IAAI,CAACgD,KAAK;MACfnB,aAAa;MACbS,OAAO,EAAE9B,WAAW;MACpBwB;IACF,CAAC;EACH;AACF"}
|
package/es/account/Base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Encoded } from '../utils/encoder';
|
|
2
2
|
import Node from '../Node';
|
|
3
3
|
import CompilerBase from '../contract/compiler/Base';
|
|
4
|
-
import { AensName, Int } from '../tx/builder/constants';
|
|
4
|
+
import { AensName, ConsensusProtocolVersion, Int } from '../tx/builder/constants';
|
|
5
5
|
import { AciValue, Domain } from '../utils/typed-data';
|
|
6
6
|
interface AuthData {
|
|
7
7
|
fee?: Int;
|
|
@@ -45,8 +45,8 @@ export default abstract class AccountBase {
|
|
|
45
45
|
}): Promise<Uint8Array>;
|
|
46
46
|
/**
|
|
47
47
|
* Sign typed data
|
|
48
|
-
* @param type - Type of data to sign
|
|
49
48
|
* @param data - Encoded data to sign
|
|
49
|
+
* @param aci - Type of data to sign
|
|
50
50
|
* @param options - Options
|
|
51
51
|
* @returns Signature
|
|
52
52
|
*/
|
|
@@ -58,10 +58,15 @@ export default abstract class AccountBase {
|
|
|
58
58
|
* Sign delegation of AENS, oracle operations to a contract
|
|
59
59
|
* @param contractAddress - Address of a contract to delegate permissions to
|
|
60
60
|
* @param options - Options
|
|
61
|
+
* @param options.isOracle - Use to generate an oracle delegation signature in Ceres, otherwise an
|
|
62
|
+
* AENS preclaim delegation signature would be generated
|
|
61
63
|
* @returns Signature
|
|
64
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
62
65
|
*/
|
|
63
66
|
signDelegationToContract(contractAddress: Encoded.ContractAddress, options?: {
|
|
64
67
|
networkId?: string;
|
|
68
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
69
|
+
isOracle?: boolean;
|
|
65
70
|
aeppOrigin?: string;
|
|
66
71
|
aeppRpcClientId?: string;
|
|
67
72
|
}): Promise<Encoded.Signature>;
|
|
@@ -71,9 +76,24 @@ export default abstract class AccountBase {
|
|
|
71
76
|
* @param name - AENS name to manage by a contract
|
|
72
77
|
* @param options - Options
|
|
73
78
|
* @returns Signature
|
|
79
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
74
80
|
*/
|
|
75
81
|
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, options?: {
|
|
76
82
|
networkId?: string;
|
|
83
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
84
|
+
aeppOrigin?: string;
|
|
85
|
+
aeppRpcClientId?: string;
|
|
86
|
+
}): Promise<Encoded.Signature>;
|
|
87
|
+
/**
|
|
88
|
+
* Sign delegation of all AENS names to a contract (not available in Iris)
|
|
89
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
90
|
+
* @param options - Options
|
|
91
|
+
* @returns Signature
|
|
92
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
93
|
+
*/
|
|
94
|
+
signAllNamesDelegationToContract(contractAddress: Encoded.ContractAddress, options?: {
|
|
95
|
+
networkId?: string;
|
|
96
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
77
97
|
aeppOrigin?: string;
|
|
78
98
|
aeppRpcClientId?: string;
|
|
79
99
|
}): Promise<Encoded.Signature>;
|
|
@@ -90,9 +110,11 @@ export default abstract class AccountBase {
|
|
|
90
110
|
* @param oracleQueryId - Oracle query ID to reply by a contract
|
|
91
111
|
* @param options - Options
|
|
92
112
|
* @returns Signature
|
|
113
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
93
114
|
*/
|
|
94
115
|
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, options?: {
|
|
95
116
|
networkId?: string;
|
|
117
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
96
118
|
aeppOrigin?: string;
|
|
97
119
|
aeppRpcClientId?: string;
|
|
98
120
|
}): Promise<Encoded.Signature>;
|
|
@@ -102,10 +124,24 @@ export default abstract class AccountBase {
|
|
|
102
124
|
* @param options - Options
|
|
103
125
|
* @returns Signature
|
|
104
126
|
*/
|
|
105
|
-
abstract sign(data: string | Uint8Array, options?:
|
|
127
|
+
abstract sign(data: string | Uint8Array, options?: {
|
|
128
|
+
aeppOrigin?: string;
|
|
129
|
+
aeppRpcClientId?: string;
|
|
130
|
+
}): Promise<Uint8Array>;
|
|
106
131
|
/**
|
|
107
132
|
* Account address
|
|
108
133
|
*/
|
|
109
134
|
readonly address: Encoded.AccountAddress;
|
|
135
|
+
/**
|
|
136
|
+
* Sign delegation, works only in Ceres
|
|
137
|
+
* @param delegation - Delegation to sign
|
|
138
|
+
* @param options - Options
|
|
139
|
+
* @returns Signature
|
|
140
|
+
*/
|
|
141
|
+
signDelegation(delegation: Encoded.Bytearray, options?: {
|
|
142
|
+
networkId?: string;
|
|
143
|
+
aeppOrigin?: string;
|
|
144
|
+
aeppRpcClientId?: string;
|
|
145
|
+
}): Promise<Encoded.Signature>;
|
|
110
146
|
}
|
|
111
147
|
export {};
|
package/es/account/Base.mjs
CHANGED
|
@@ -22,8 +22,8 @@ export default class AccountBase {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Sign typed data
|
|
25
|
-
* @param type - Type of data to sign
|
|
26
25
|
* @param data - Encoded data to sign
|
|
26
|
+
* @param aci - Type of data to sign
|
|
27
27
|
* @param options - Options
|
|
28
28
|
* @returns Signature
|
|
29
29
|
*/
|
|
@@ -39,7 +39,10 @@ export default class AccountBase {
|
|
|
39
39
|
* Sign delegation of AENS, oracle operations to a contract
|
|
40
40
|
* @param contractAddress - Address of a contract to delegate permissions to
|
|
41
41
|
* @param options - Options
|
|
42
|
+
* @param options.isOracle - Use to generate an oracle delegation signature in Ceres, otherwise an
|
|
43
|
+
* AENS preclaim delegation signature would be generated
|
|
42
44
|
* @returns Signature
|
|
45
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
43
46
|
*/
|
|
44
47
|
// TODO: make abstract in the next major release
|
|
45
48
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -55,6 +58,7 @@ export default class AccountBase {
|
|
|
55
58
|
* @param name - AENS name to manage by a contract
|
|
56
59
|
* @param options - Options
|
|
57
60
|
* @returns Signature
|
|
61
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
58
62
|
*/
|
|
59
63
|
// TODO: make abstract in the next major release
|
|
60
64
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -64,6 +68,21 @@ export default class AccountBase {
|
|
|
64
68
|
throw new NotImplementedError('signNameDelegationToContract method');
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Sign delegation of all AENS names to a contract (not available in Iris)
|
|
73
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
74
|
+
* @param options - Options
|
|
75
|
+
* @returns Signature
|
|
76
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
77
|
+
*/
|
|
78
|
+
// TODO: make abstract in the next major release
|
|
79
|
+
// eslint-disable-next-line class-methods-use-this
|
|
80
|
+
async signAllNamesDelegationToContract( /* eslint-disable @typescript-eslint/no-unused-vars */
|
|
81
|
+
contractAddress, options
|
|
82
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */) {
|
|
83
|
+
throw new NotImplementedError('signAllNamesDelegationToContract method');
|
|
84
|
+
}
|
|
85
|
+
|
|
67
86
|
/**
|
|
68
87
|
* Sign delegation of oracle query to a contract
|
|
69
88
|
*
|
|
@@ -77,6 +96,7 @@ export default class AccountBase {
|
|
|
77
96
|
* @param oracleQueryId - Oracle query ID to reply by a contract
|
|
78
97
|
* @param options - Options
|
|
79
98
|
* @returns Signature
|
|
99
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
80
100
|
*/
|
|
81
101
|
// TODO: make abstract in the next major release
|
|
82
102
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -96,5 +116,19 @@ export default class AccountBase {
|
|
|
96
116
|
/**
|
|
97
117
|
* Account address
|
|
98
118
|
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Sign delegation, works only in Ceres
|
|
122
|
+
* @param delegation - Delegation to sign
|
|
123
|
+
* @param options - Options
|
|
124
|
+
* @returns Signature
|
|
125
|
+
*/
|
|
126
|
+
// TODO: make abstract in the next major release
|
|
127
|
+
// eslint-disable-next-line class-methods-use-this
|
|
128
|
+
async signDelegation( /* eslint-disable @typescript-eslint/no-unused-vars */
|
|
129
|
+
delegation, options
|
|
130
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */) {
|
|
131
|
+
throw new NotImplementedError('signDelegation method');
|
|
132
|
+
}
|
|
99
133
|
}
|
|
100
134
|
//# sourceMappingURL=Base.mjs.map
|
package/es/account/Base.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.mjs","names":["NotImplementedError","AccountBase","signTypedData","data","aci","options","signDelegationToContract","contractAddress","signNameDelegationToContract","name","signOracleQueryDelegationToContract","oracleQueryId"],"sources":["../../src/account/Base.ts"],"sourcesContent":["import { Encoded } from '../utils/encoder';\nimport Node from '../Node';\nimport CompilerBase from '../contract/compiler/Base';\nimport { AensName, Int } from '../tx/builder/constants';\nimport { AciValue, Domain } from '../utils/typed-data';\nimport { NotImplementedError } from '../utils/errors';\n\ninterface AuthData {\n fee?: Int;\n gasLimit?: number;\n gasPrice?: Int;\n callData?: Encoded.ContractBytearray;\n sourceCode?: string;\n args?: any[];\n}\n\n/**\n * Account is one of the three basic building blocks of an\n * {@link AeSdk} and provides access to a signing key pair.\n */\nexport default abstract class AccountBase {\n /**\n * Sign encoded transaction\n * @param tx - Transaction to sign\n * @param options - Options\n * @param options.innerTx - Sign as inner transaction for PayingFor\n * @param options.authData - Object with gaMeta params\n * @returns Signed transaction\n */\n abstract signTransaction(\n tx: Encoded.Transaction,\n options: {\n innerTx?: boolean;\n networkId?: string;\n authData?: AuthData | ((tx: Encoded.Transaction) => Promise<AuthData>);\n onNode?: Node;\n onCompiler?: CompilerBase;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n ): Promise<Encoded.Transaction>;\n\n /**\n * Sign message\n * @param message - Message to sign\n * @param options - Options\n * @returns Signature\n */\n abstract signMessage(\n message: string,\n options?: {\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n ): Promise<Uint8Array>;\n\n /**\n * Sign typed data\n * @param
|
|
1
|
+
{"version":3,"file":"Base.mjs","names":["NotImplementedError","AccountBase","signTypedData","data","aci","options","signDelegationToContract","contractAddress","signNameDelegationToContract","name","signAllNamesDelegationToContract","signOracleQueryDelegationToContract","oracleQueryId","signDelegation","delegation"],"sources":["../../src/account/Base.ts"],"sourcesContent":["import { Encoded } from '../utils/encoder';\nimport Node from '../Node';\nimport CompilerBase from '../contract/compiler/Base';\nimport { AensName, ConsensusProtocolVersion, Int } from '../tx/builder/constants';\nimport { AciValue, Domain } from '../utils/typed-data';\nimport { NotImplementedError } from '../utils/errors';\n\ninterface AuthData {\n fee?: Int;\n gasLimit?: number;\n gasPrice?: Int;\n callData?: Encoded.ContractBytearray;\n sourceCode?: string;\n args?: any[];\n}\n\n/**\n * Account is one of the three basic building blocks of an\n * {@link AeSdk} and provides access to a signing key pair.\n */\nexport default abstract class AccountBase {\n /**\n * Sign encoded transaction\n * @param tx - Transaction to sign\n * @param options - Options\n * @param options.innerTx - Sign as inner transaction for PayingFor\n * @param options.authData - Object with gaMeta params\n * @returns Signed transaction\n */\n abstract signTransaction(\n tx: Encoded.Transaction,\n options: {\n innerTx?: boolean;\n networkId?: string;\n authData?: AuthData | ((tx: Encoded.Transaction) => Promise<AuthData>);\n onNode?: Node;\n onCompiler?: CompilerBase;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n ): Promise<Encoded.Transaction>;\n\n /**\n * Sign message\n * @param message - Message to sign\n * @param options - Options\n * @returns Signature\n */\n abstract signMessage(\n message: string,\n options?: {\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n ): Promise<Uint8Array>;\n\n /**\n * Sign typed data\n * @param data - Encoded data to sign\n * @param aci - Type of data to sign\n * @param options - Options\n * @returns Signature\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signTypedData(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n data: Encoded.ContractBytearray,\n aci: AciValue,\n options?: Domain & {\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signTypedData method');\n }\n\n /**\n * Sign delegation of AENS, oracle operations to a contract\n * @param contractAddress - Address of a contract to delegate permissions to\n * @param options - Options\n * @param options.isOracle - Use to generate an oracle delegation signature in Ceres, otherwise an\n * AENS preclaim delegation signature would be generated\n * @returns Signature\n * @deprecated use AccountBase:signDelegation in Ceres\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signDelegationToContract(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n contractAddress: Encoded.ContractAddress,\n options?: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n isOracle?: boolean;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signDelegationToContract method');\n }\n\n /**\n * Sign delegation of an AENS name to a contract\n * @param contractAddress - Address of a contract to delegate permissions to\n * @param name - AENS name to manage by a contract\n * @param options - Options\n * @returns Signature\n * @deprecated use AccountBase:signDelegation in Ceres\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signNameDelegationToContract(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n contractAddress: Encoded.ContractAddress,\n name: AensName,\n options?: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signNameDelegationToContract method');\n }\n\n /**\n * Sign delegation of all AENS names to a contract (not available in Iris)\n * @param contractAddress - Address of a contract to delegate permissions to\n * @param options - Options\n * @returns Signature\n * @deprecated use AccountBase:signDelegation in Ceres\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signAllNamesDelegationToContract(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n contractAddress: Encoded.ContractAddress,\n options?: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signAllNamesDelegationToContract method');\n }\n\n /**\n * Sign delegation of oracle query to a contract\n *\n * Warning! Implementations needs to ensure that decoded oracle query id is not equal to decoded\n * current account address unless https://github.com/aeternity/aesophia/issues/475 is fixed.\n *\n * Warning! Implementations needs to ensure that oracle query and contract exists unless\n * https://github.com/aeternity/aesophia/issues/474 is fixed.\n *\n * @param contractAddress - Address of a contract to delegate permissions to\n * @param oracleQueryId - Oracle query ID to reply by a contract\n * @param options - Options\n * @returns Signature\n * @deprecated use AccountBase:signDelegation in Ceres\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signOracleQueryDelegationToContract(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n contractAddress: Encoded.ContractAddress,\n oracleQueryId: Encoded.OracleQueryId,\n options?: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signOracleQueryDelegationToContract method');\n }\n\n /**\n * Sign data blob\n * @param data - Data blob to sign\n * @param options - Options\n * @returns Signature\n */\n abstract sign(\n data: string | Uint8Array,\n options?: {\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n ): Promise<Uint8Array>;\n\n /**\n * Account address\n */\n readonly address!: Encoded.AccountAddress;\n\n /**\n * Sign delegation, works only in Ceres\n * @param delegation - Delegation to sign\n * @param options - Options\n * @returns Signature\n */\n // TODO: make abstract in the next major release\n // eslint-disable-next-line class-methods-use-this\n async signDelegation(\n /* eslint-disable @typescript-eslint/no-unused-vars */\n delegation: Encoded.Bytearray,\n options?: {\n networkId?: string;\n aeppOrigin?: string;\n aeppRpcClientId?: string;\n },\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ): Promise<Encoded.Signature> {\n throw new NotImplementedError('signDelegation method');\n }\n}\n"],"mappings":"SAKSA,mBAAmB;AAW5B;AACA;AACA;AACA;AACA,eAAe,MAAeC,WAAW,CAAC;EACxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAcE;AACF;AACA;AACA;AACA;AACA;;EASE;AACF;AACA;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMC,aAAaA,CAAA,CACjB;EACAC,IAA+B,EAC/BC,GAAa,EACbC;EAIA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,sBAAsB,CAAC;EACvD;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMM,wBAAwBA,CAAA,CAC5B;EACAC,eAAwC,EACxCF;EAOA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,iCAAiC,CAAC;EAClE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMQ,4BAA4BA,CAAA,CAChC;EACAD,eAAwC,EACxCE,IAAc,EACdJ;EAMA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,qCAAqC,CAAC;EACtE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMU,gCAAgCA,CAAA,CACpC;EACAH,eAAwC,EACxCF;EAMA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,yCAAyC,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMW,mCAAmCA,CAAA,CACvC;EACAJ,eAAwC,EACxCK,aAAoC,EACpCP;EAMA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,4CAA4C,CAAC;EAC7E;;EAEA;AACF;AACA;AACA;AACA;AACA;;EASE;AACF;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;EACE;EACA;EACA,MAAMa,cAAcA,CAAA,CAClB;EACAC,UAA6B,EAC7BT;EAKA,uDAC4B;IAC5B,MAAM,IAAIL,mBAAmB,CAAC,uBAAuB,CAAC;EACxD;AACF"}
|
|
@@ -15,6 +15,8 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
15
15
|
signTypedData(): Promise<Encoded.Signature>;
|
|
16
16
|
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
17
17
|
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
18
|
+
signAllNamesDelegationToContract(): Promise<Encoded.Signature>;
|
|
18
19
|
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
20
|
+
signDelegation(): Promise<Encoded.Signature>;
|
|
19
21
|
signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
20
22
|
}
|
|
@@ -52,16 +52,25 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
52
52
|
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
// eslint-disable-next-line class-methods-use-this
|
|
56
|
+
async signAllNamesDelegationToContract() {
|
|
57
|
+
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
// eslint-disable-next-line class-methods-use-this
|
|
56
61
|
async signOracleQueryDelegationToContract() {
|
|
57
62
|
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
// eslint-disable-next-line class-methods-use-this
|
|
66
|
+
async signDelegation() {
|
|
67
|
+
throw new NotImplementedError('signing delegation using generalized account');
|
|
68
|
+
}
|
|
69
|
+
async signTransaction(tx, {
|
|
70
|
+
authData,
|
|
71
|
+
onCompiler,
|
|
72
|
+
onNode
|
|
73
|
+
}) {
|
|
65
74
|
if (authData == null || onCompiler == null || onNode == null) {
|
|
66
75
|
throw new ArgumentError('authData, onCompiler, onNode', 'provided', null);
|
|
67
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Generalized.mjs","names":["AccountBase","ArgumentError","InternalError","InvalidAuthDataError","NotImplementedError","decode","getAccount","Contract","buildTxAsync","buildTx","Tag","_authFun","WeakMap","AccountGeneralized","constructor","address","_classPrivateFieldInitSpec","writable","value","sign","signMessage","signTypedData","signDelegationToContract","signNameDelegationToContract","signOracleQueryDelegationToContract","
|
|
1
|
+
{"version":3,"file":"Generalized.mjs","names":["AccountBase","ArgumentError","InternalError","InvalidAuthDataError","NotImplementedError","decode","getAccount","Contract","buildTxAsync","buildTx","Tag","_authFun","WeakMap","AccountGeneralized","constructor","address","_classPrivateFieldInitSpec","writable","value","sign","signMessage","signTypedData","signDelegationToContract","signNameDelegationToContract","signAllNamesDelegationToContract","signOracleQueryDelegationToContract","signDelegation","signTransaction","tx","authData","onCompiler","onNode","callData","sourceCode","args","fee","gasLimit","gasPrice","authCallData","_classPrivateFieldGet","account","kind","_classPrivateFieldSet","authFun","contract","initialize","_calldata","encode","_name","gaMetaTx","tag","GaMetaTx","SignedTx","encodedTx","signatures","gaId"],"sources":["../../src/account/Generalized.ts"],"sourcesContent":["import AccountBase from './Base';\nimport {\n ArgumentError,\n InternalError,\n InvalidAuthDataError,\n NotImplementedError,\n} from '../utils/errors';\nimport { decode, Encoded } from '../utils/encoder';\nimport { getAccount } from '../chain';\nimport Contract from '../contract/Contract';\nimport { buildTxAsync, buildTx } from '../tx/builder';\nimport { Tag } from '../tx/builder/constants';\n\n/**\n * Generalized account class\n */\nexport default class AccountGeneralized extends AccountBase {\n override readonly address: Encoded.AccountAddress;\n\n #authFun?: string;\n\n /**\n * @param address - Address of generalized account\n */\n constructor(address: Encoded.AccountAddress) {\n super();\n decode(address);\n this.address = address;\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async sign(): Promise<Uint8Array> {\n throw new NotImplementedError('Can\\'t sign using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signMessage(): Promise<Uint8Array> {\n throw new NotImplementedError('Can\\'t sign using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signTypedData(): Promise<Encoded.Signature> {\n throw new NotImplementedError('Can\\'t sign using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signDelegationToContract(): Promise<Encoded.Signature> {\n throw new NotImplementedError('signing delegation to contract using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signNameDelegationToContract(): Promise<Encoded.Signature> {\n throw new NotImplementedError('signing delegation to contract using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signAllNamesDelegationToContract(): Promise<Encoded.Signature> {\n throw new NotImplementedError('signing delegation to contract using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signOracleQueryDelegationToContract(): Promise<Encoded.Signature> {\n throw new NotImplementedError('signing delegation to contract using generalized account');\n }\n\n // eslint-disable-next-line class-methods-use-this\n override async signDelegation(): Promise<Encoded.Signature> {\n throw new NotImplementedError('signing delegation using generalized account');\n }\n\n override async signTransaction(\n tx: Encoded.Transaction,\n { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1],\n ): Promise<Encoded.Transaction> {\n if (authData == null || onCompiler == null || onNode == null) {\n throw new ArgumentError('authData, onCompiler, onNode', 'provided', null);\n }\n const {\n callData, sourceCode, args, fee, gasLimit, gasPrice,\n } = typeof authData === 'function' ? await authData(tx) : authData;\n\n const authCallData = callData ?? await (async () => {\n if (this.#authFun == null) {\n const account = await getAccount(this.address, { onNode });\n if (account.kind !== 'generalized') {\n throw new ArgumentError('account kind', 'generalized', account.kind);\n }\n this.#authFun = account.authFun;\n }\n if (this.#authFun == null) {\n throw new InternalError('Account in generalised, but authFun not provided');\n }\n\n if (sourceCode == null || args == null) {\n throw new InvalidAuthDataError('Auth data must contain sourceCode and args or callData.');\n }\n const contract = await Contract.initialize({ onCompiler, onNode, sourceCode });\n return contract._calldata.encode(contract._name, this.#authFun, args);\n })();\n\n const gaMetaTx = await buildTxAsync({\n tag: Tag.GaMetaTx,\n tx: { tag: Tag.SignedTx, encodedTx: decode(tx), signatures: [] },\n gaId: this.address,\n authData: authCallData,\n fee,\n gasLimit,\n gasPrice,\n onNode,\n });\n return buildTx({ tag: Tag.SignedTx, encodedTx: decode(gaMetaTx), signatures: [] });\n }\n}\n"],"mappings":";;;;OAAOA,WAAW;AAAA,SAEhBC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,mBAAmB;AAAA,SAEZC,MAAM;AAAA,SACNC,UAAU;AAAA,OACZC,QAAQ;AAAA,SACNC,YAAY,EAAEC,OAAO;AAAA,SACrBC,GAAG;AAEZ;AACA;AACA;AAFA,IAAAC,QAAA,oBAAAC,OAAA;AAGA,eAAe,MAAMC,kBAAkB,SAASb,WAAW,CAAC;EAK1D;AACF;AACA;EACEc,WAAWA,CAACC,OAA+B,EAAE;IAC3C,KAAK,CAAC,CAAC;IAACC,0BAAA,OAAAL,QAAA;MAAAM,QAAA;MAAA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AAC;QAAE0B,UAAU,EAAE;MAAG,CAAC;MAChEC,IAAI,EAAE,IAAI,CAACxC,OAAO;MAClBc,QAAQ,EAAES,YAAY;MACtBH,GAAG;MACHC,QAAQ;MACRC,QAAQ;MACRN;IACF,CAAC,CAAC;IACF,OAAOtB,OAAO,CAAC;MAAEyC,GAAG,EAAExC,GAAG,CAAC0C,QAAQ;MAAEC,SAAS,EAAEhD,MAAM,CAAC4C,QAAQ,CAAC;MAAEK,UAAU,EAAE;IAAG,CAAC,CAAC;EACpF;AACF"}
|
package/es/account/Ledger.d.ts
CHANGED
|
@@ -23,7 +23,9 @@ export default class AccountLedger extends AccountBase {
|
|
|
23
23
|
signTypedData(): Promise<Encoded.Signature>;
|
|
24
24
|
signDelegationToContract(): Promise<Encoded.Signature>;
|
|
25
25
|
signNameDelegationToContract(): Promise<Encoded.Signature>;
|
|
26
|
+
signAllNamesDelegationToContract(): Promise<Encoded.Signature>;
|
|
26
27
|
signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
|
|
28
|
+
signDelegation(): Promise<Encoded.Signature>;
|
|
27
29
|
signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
|
|
28
30
|
innerTx?: boolean;
|
|
29
31
|
networkId?: string;
|
package/es/account/Ledger.mjs
CHANGED
|
@@ -51,15 +51,24 @@ export default class AccountLedger extends AccountBase {
|
|
|
51
51
|
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
// eslint-disable-next-line class-methods-use-this
|
|
55
|
+
async signAllNamesDelegationToContract() {
|
|
56
|
+
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
// eslint-disable-next-line class-methods-use-this
|
|
55
60
|
async signOracleQueryDelegationToContract() {
|
|
56
61
|
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
57
62
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
|
|
64
|
+
// eslint-disable-next-line class-methods-use-this
|
|
65
|
+
async signDelegation() {
|
|
66
|
+
throw new NotImplementedError('signing delegation using Ledger HW');
|
|
67
|
+
}
|
|
68
|
+
async signTransaction(tx, {
|
|
69
|
+
innerTx,
|
|
70
|
+
networkId
|
|
71
|
+
} = {}) {
|
|
63
72
|
if (innerTx != null) throw new NotImplementedError('innerTx option in AccountLedger');
|
|
64
73
|
if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
|
|
65
74
|
const rawTx = decode(tx);
|