@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/src/AeSdkMethods.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as chainMethods from './chain';
|
|
2
|
+
import { sendTransaction } from './send-transaction';
|
|
2
3
|
import * as aensMethods from './aens';
|
|
3
4
|
import * as spendMethods from './spend';
|
|
4
5
|
import * as oracleMethods from './oracle';
|
|
@@ -7,6 +8,7 @@ import createDelegationSignature from './contract/delegation-signature';
|
|
|
7
8
|
import * as contractGaMethods from './contract/ga';
|
|
8
9
|
import { buildTxAsync } from './tx/builder';
|
|
9
10
|
import { mapObject, UnionToIntersection } from './utils/other';
|
|
11
|
+
import { wrapWithProxy } from './utils/wrap-proxy';
|
|
10
12
|
import Node from './Node';
|
|
11
13
|
import { TxParamsAsync } from './tx/builder/schema.generated';
|
|
12
14
|
import AccountBase from './account/Base';
|
|
@@ -15,29 +17,9 @@ import CompilerBase from './contract/compiler/Base';
|
|
|
15
17
|
|
|
16
18
|
export type OnAccount = Encoded.AccountAddress | AccountBase | undefined;
|
|
17
19
|
|
|
18
|
-
export function getValueOrErrorProxy<Value extends object | undefined>(
|
|
19
|
-
valueCb: () => Value,
|
|
20
|
-
): NonNullable<Value> {
|
|
21
|
-
return new Proxy(
|
|
22
|
-
{},
|
|
23
|
-
Object.fromEntries(([
|
|
24
|
-
'apply', 'construct', 'defineProperty', 'deleteProperty', 'getOwnPropertyDescriptor',
|
|
25
|
-
'getPrototypeOf', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf',
|
|
26
|
-
'get', 'has',
|
|
27
|
-
] as const).map((name) => [name, (t: {}, ...args: unknown[]) => {
|
|
28
|
-
const target = valueCb() as object; // to get a native exception in case it missed
|
|
29
|
-
const res = (Reflect[name] as any)(target, ...args);
|
|
30
|
-
return typeof res === 'function' && name === 'get'
|
|
31
|
-
? res.bind(target) // otherwise it fails with attempted to get private field on non-instance
|
|
32
|
-
: res;
|
|
33
|
-
}])),
|
|
34
|
-
) as NonNullable<Value>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const { InvalidTxError: _2, ...chainMethodsOther } = chainMethods;
|
|
38
|
-
|
|
39
20
|
const methods = {
|
|
40
|
-
...
|
|
21
|
+
...chainMethods,
|
|
22
|
+
sendTransaction,
|
|
41
23
|
...aensMethods,
|
|
42
24
|
...spendMethods,
|
|
43
25
|
...oracleMethods,
|
|
@@ -57,6 +39,12 @@ export interface AeSdkMethodsOptions
|
|
|
57
39
|
extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
|
|
58
40
|
}
|
|
59
41
|
|
|
42
|
+
export interface WrappedOptions {
|
|
43
|
+
onAccount: AccountBase;
|
|
44
|
+
onCompiler: CompilerBase;
|
|
45
|
+
onNode: Node;
|
|
46
|
+
}
|
|
47
|
+
|
|
60
48
|
/**
|
|
61
49
|
* AeSdkMethods is the composition of:
|
|
62
50
|
* - chain methods
|
|
@@ -73,33 +61,43 @@ export interface AeSdkMethodsOptions
|
|
|
73
61
|
class AeSdkMethods {
|
|
74
62
|
_options: AeSdkMethodsOptions = {};
|
|
75
63
|
|
|
64
|
+
readonly #wrappedOptions: WrappedOptions;
|
|
65
|
+
|
|
76
66
|
/**
|
|
77
67
|
* @param options - Options
|
|
78
68
|
*/
|
|
79
69
|
constructor(options: AeSdkMethodsOptions = {}) {
|
|
80
70
|
Object.assign(this._options, options);
|
|
71
|
+
this.#wrappedOptions = {
|
|
72
|
+
onAccount: wrapWithProxy(() => this._options.onAccount),
|
|
73
|
+
onNode: wrapWithProxy(() => this._options.onNode),
|
|
74
|
+
onCompiler: wrapWithProxy(() => this._options.onCompiler),
|
|
75
|
+
};
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Returns sdk instance options with references to current account, node, compiler.
|
|
80
|
+
* Used to create an instance (Contract, Oracle) bound to AeSdk state.
|
|
81
|
+
* @param mergeWith - Merge context with these extra options
|
|
82
|
+
* @returns Context object
|
|
83
|
+
*/
|
|
84
|
+
getContext(mergeWith: AeSdkMethodsOptions = {}): AeSdkMethodsOptions & WrappedOptions {
|
|
86
85
|
return {
|
|
87
86
|
...this._options,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onCompiler: getValueOrErrorProxy(() => this._options.onCompiler),
|
|
91
|
-
...callOptions,
|
|
87
|
+
...this.#wrappedOptions,
|
|
88
|
+
...mergeWith,
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
|
|
92
|
+
// TODO: omit onNode from options, because it is already in context
|
|
95
93
|
async buildTx(options: TxParamsAsync): Promise<Encoded.Transaction> {
|
|
96
|
-
return buildTxAsync({ ...this.
|
|
94
|
+
return buildTxAsync({ ...this.getContext(), ...options });
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
async initializeContract<Methods extends ContractMethodsBase>(
|
|
100
98
|
options?: Omit<Parameters<typeof Contract.initialize>[0], 'onNode'> & { onNode?: Node },
|
|
101
99
|
): Promise<Contract<Methods>> {
|
|
102
|
-
return Contract.initialize<Methods>(this.
|
|
100
|
+
return Contract.initialize<Methods>(this.getContext(options as AeSdkMethodsOptions));
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
|
@@ -110,7 +108,13 @@ type RequiredKeys<T> = {
|
|
|
110
108
|
type OptionalIfNotRequired<T extends [any]> = RequiredKeys<T[0]> extends never ? T | [] : T;
|
|
111
109
|
|
|
112
110
|
type ReplaceOnAccount<Options> = Options extends { onAccount: any }
|
|
113
|
-
? Omit<Options, 'onAccount'> & {
|
|
111
|
+
? Omit<Options, 'onAccount'> & {
|
|
112
|
+
/**
|
|
113
|
+
* Make operation on specific account by providing address (to use account from sdk) or instance
|
|
114
|
+
* of AccountBase (like MemoryAccount)
|
|
115
|
+
*/
|
|
116
|
+
onAccount: OnAccount;
|
|
117
|
+
} : Options;
|
|
114
118
|
|
|
115
119
|
type MakeOptional<Options> = OptionalIfNotRequired<[
|
|
116
120
|
Omit<Options, 'onNode' | 'onCompiler' | 'onAccount'> & Partial<ReplaceOnAccount<Options>>,
|
|
@@ -133,7 +137,7 @@ Object.assign(AeSdkMethods.prototype, mapObject<Function, Function>(
|
|
|
133
137
|
function methodWrapper(this: AeSdkMethods, ...args: any[]) {
|
|
134
138
|
args.length = handler.length;
|
|
135
139
|
const options = args[args.length - 1];
|
|
136
|
-
args[args.length - 1] = this.
|
|
140
|
+
args[args.length - 1] = this.getContext(options);
|
|
137
141
|
return handler(...args);
|
|
138
142
|
},
|
|
139
143
|
],
|
package/src/AeSdkWallet.ts
CHANGED
|
@@ -18,7 +18,9 @@ import {
|
|
|
18
18
|
WalletApi,
|
|
19
19
|
WalletInfo,
|
|
20
20
|
} from './aepp-wallet-communication/rpc/types';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
Encoded, Encoding, encode, decode,
|
|
23
|
+
} from './utils/encoder';
|
|
22
24
|
import jsonBig from './utils/json-big';
|
|
23
25
|
|
|
24
26
|
type RpcClientWallet = RpcClient<AeppApi, WalletApi>;
|
|
@@ -302,23 +304,40 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
302
304
|
};
|
|
303
305
|
},
|
|
304
306
|
[METHODS.signDelegationToContract]: async ({
|
|
305
|
-
contractAddress, name, oracleQueryId, onAccount = this.address,
|
|
307
|
+
contractAddress, name, oracleQueryId, allNames, onAccount = this.address, isOracle,
|
|
306
308
|
}, origin) => {
|
|
307
309
|
if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
|
|
308
310
|
if (!this.addresses().includes(onAccount)) {
|
|
309
311
|
throw new RpcPermissionDenyError(onAccount);
|
|
310
312
|
}
|
|
311
313
|
|
|
314
|
+
isOracle ??= false;
|
|
312
315
|
const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };
|
|
313
316
|
const signature = await (
|
|
314
317
|
(name == null ? null : this
|
|
315
318
|
.signNameDelegationToContract(contractAddress, name, parameters))
|
|
316
319
|
?? (oracleQueryId == null ? null : this
|
|
317
320
|
.signOracleQueryDelegationToContract(contractAddress, oracleQueryId, parameters))
|
|
318
|
-
??
|
|
321
|
+
?? (allNames !== true ? null : this
|
|
322
|
+
.signAllNamesDelegationToContract(contractAddress, parameters))
|
|
323
|
+
?? this.signDelegationToContract(contractAddress, { ...parameters, isOracle })
|
|
319
324
|
);
|
|
320
325
|
return { signature };
|
|
321
326
|
},
|
|
327
|
+
[METHODS.unsafeSign]: async ({ data, onAccount = this.address }, origin) => {
|
|
328
|
+
if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
|
|
329
|
+
if (!this.addresses().includes(onAccount)) throw new RpcPermissionDenyError(onAccount);
|
|
330
|
+
const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };
|
|
331
|
+
const signature = encode(await this.sign(decode(data), parameters), Encoding.Signature);
|
|
332
|
+
return { signature };
|
|
333
|
+
},
|
|
334
|
+
[METHODS.signDelegation]: async ({ delegation, onAccount = this.address }, origin) => {
|
|
335
|
+
if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
|
|
336
|
+
if (!this.addresses().includes(onAccount)) throw new RpcPermissionDenyError(onAccount);
|
|
337
|
+
const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };
|
|
338
|
+
const signature = await this.signDelegation(delegation, parameters);
|
|
339
|
+
return { signature };
|
|
340
|
+
},
|
|
322
341
|
},
|
|
323
342
|
),
|
|
324
343
|
};
|
package/src/Middleware.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line max-classes-per-file
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { OperationArguments, OperationSpec } from '@azure/core-client';
|
|
3
|
+
import { OperationArguments, OperationOptions, OperationSpec } from '@azure/core-client';
|
|
4
|
+
import { userAgentPolicyName, setClientRequestIdPolicyName } from '@azure/core-rest-pipeline';
|
|
4
5
|
import {
|
|
5
6
|
genRequestQueuesPolicy, genCombineGetRequestsPolicy, genErrorFormatterPolicy,
|
|
6
7
|
genVersionCheckPolicy, genRetryOnFailurePolicy,
|
|
@@ -105,7 +106,7 @@ export default class Middleware
|
|
|
105
106
|
/**
|
|
106
107
|
* @param url - Url for middleware API
|
|
107
108
|
* @param options - Options
|
|
108
|
-
* @param options.ignoreVersion - Don't
|
|
109
|
+
* @param options.ignoreVersion - Don't ensure that the middleware is supported
|
|
109
110
|
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
110
111
|
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
111
112
|
*/
|
|
@@ -119,10 +120,20 @@ export default class Middleware
|
|
|
119
120
|
retryOverallDelay?: number;
|
|
120
121
|
} = {},
|
|
121
122
|
) {
|
|
123
|
+
let version: string | undefined;
|
|
124
|
+
const getVersion = async (opts: OperationOptions): Promise<string> => {
|
|
125
|
+
if (version != null) return version;
|
|
126
|
+
version = (await this.getStatus(opts)).mdwVersion;
|
|
127
|
+
return version;
|
|
128
|
+
};
|
|
129
|
+
|
|
122
130
|
// eslint-disable-next-line constructor-super
|
|
123
131
|
super(url, {
|
|
124
132
|
allowInsecureConnection: true,
|
|
125
133
|
additionalPolicies: [
|
|
134
|
+
...ignoreVersion ? [] : [
|
|
135
|
+
genVersionCheckPolicy('middleware', getVersion, '1.47.0', '2.0.0'),
|
|
136
|
+
],
|
|
126
137
|
genRequestQueuesPolicy(),
|
|
127
138
|
genCombineGetRequestsPolicy(),
|
|
128
139
|
genRetryOnFailurePolicy(retryCount, retryOverallDelay),
|
|
@@ -130,12 +141,9 @@ export default class Middleware
|
|
|
130
141
|
],
|
|
131
142
|
...options,
|
|
132
143
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
genVersionCheckPolicy('middleware', '/v2/status', versionPromise, '1.47.0', '2.0.0'),
|
|
138
|
-
);
|
|
139
|
-
}
|
|
144
|
+
this.pipeline.removePolicy({ name: userAgentPolicyName });
|
|
145
|
+
this.pipeline.removePolicy({ name: setClientRequestIdPolicyName });
|
|
146
|
+
// TODO: use instead our retry policy
|
|
147
|
+
this.pipeline.removePolicy({ name: 'defaultRetryPolicy' });
|
|
140
148
|
}
|
|
141
149
|
}
|
|
@@ -35,7 +35,7 @@ export default class MiddlewareSubscriber {
|
|
|
35
35
|
readonly [target: string, s: Source, cb: (p?: Object, e?: Error) => void]
|
|
36
36
|
> = [];
|
|
37
37
|
|
|
38
|
-
#requestQueue: Array<[isSubscribe: boolean, target: string]> = [];
|
|
38
|
+
readonly #requestQueue: Array<[isSubscribe: boolean, target: string]> = [];
|
|
39
39
|
|
|
40
40
|
#webSocket?: WebSocket;
|
|
41
41
|
|
package/src/Node.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
// eslint-disable-next-line max-classes-per-file
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { OperationArguments, OperationSpec } from '@azure/core-client';
|
|
3
|
+
import { OperationArguments, OperationOptions, OperationSpec } from '@azure/core-client';
|
|
4
|
+
import { userAgentPolicyName, setClientRequestIdPolicyName } from '@azure/core-rest-pipeline';
|
|
4
5
|
import {
|
|
5
6
|
genRequestQueuesPolicy, genCombineGetRequestsPolicy, genErrorFormatterPolicy,
|
|
6
7
|
genVersionCheckPolicy, genRetryOnFailurePolicy,
|
|
7
8
|
} from './utils/autorest';
|
|
8
9
|
import { Node as NodeApi, NodeOptionalParams, ErrorModel } from './apis/node';
|
|
9
10
|
import { mapObject } from './utils/other';
|
|
11
|
+
import { UnsupportedVersionError } from './utils/errors';
|
|
10
12
|
import { Encoded } from './utils/encoder';
|
|
11
13
|
import { ConsensusProtocolVersion } from './tx/builder/constants';
|
|
12
14
|
|
|
13
15
|
const bigIntPropertyNames = [
|
|
14
16
|
'balance', 'queryFee', 'fee', 'amount', 'nameFee', 'channelAmount',
|
|
15
17
|
'initiatorAmount', 'responderAmount', 'channelReserve', 'initiatorAmountFinal',
|
|
16
|
-
'responderAmountFinal', 'gasPrice', 'deposit',
|
|
18
|
+
'responderAmountFinal', 'gasPrice', 'minGasPrice', 'deposit',
|
|
17
19
|
] as const;
|
|
18
20
|
|
|
19
21
|
const numberPropertyNames = [
|
|
@@ -21,7 +23,7 @@ const numberPropertyNames = [
|
|
|
21
23
|
'nonce', 'nextNonce', 'height', 'blockHeight', 'topBlockHeight',
|
|
22
24
|
'ttl', 'nameTtl', 'clientTtl',
|
|
23
25
|
'inbound', 'outbound', 'peerCount', 'pendingTransactionsCount', 'effectiveAtHeight',
|
|
24
|
-
'version', 'solutions', 'round',
|
|
26
|
+
'version', 'solutions', 'round', 'minutes', 'utilization', 'difficulty', 'hashrate',
|
|
25
27
|
] as const;
|
|
26
28
|
|
|
27
29
|
class NodeTransformed extends NodeApi {
|
|
@@ -111,12 +113,10 @@ interface NodeInfo {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
export default class Node extends (NodeTransformed as unknown as NodeTransformedApi) {
|
|
114
|
-
#networkIdPromise?: Promise<string | Error>;
|
|
115
|
-
|
|
116
116
|
/**
|
|
117
117
|
* @param url - Url for node API
|
|
118
118
|
* @param options - Options
|
|
119
|
-
* @param options.ignoreVersion - Don't
|
|
119
|
+
* @param options.ignoreVersion - Don't ensure that the node is supported
|
|
120
120
|
* @param options.retryCount - Amount of extra requests to do in case of failure
|
|
121
121
|
* @param options.retryOverallDelay - Time in ms to wait between all retries
|
|
122
122
|
*/
|
|
@@ -130,42 +130,63 @@ export default class Node extends (NodeTransformed as unknown as NodeTransformed
|
|
|
130
130
|
retryOverallDelay?: number;
|
|
131
131
|
} = {},
|
|
132
132
|
) {
|
|
133
|
+
const getVersion = async (opts: OperationOptions): Promise<string> => (
|
|
134
|
+
(await this._getCachedStatus(opts)).nodeVersion
|
|
135
|
+
);
|
|
133
136
|
// eslint-disable-next-line constructor-super
|
|
134
137
|
super(url, {
|
|
135
138
|
allowInsecureConnection: true,
|
|
136
139
|
additionalPolicies: [
|
|
140
|
+
...ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '7.0.0')],
|
|
137
141
|
genRequestQueuesPolicy(),
|
|
138
142
|
genCombineGetRequestsPolicy(),
|
|
139
143
|
genRetryOnFailurePolicy(retryCount, retryOverallDelay),
|
|
140
|
-
genErrorFormatterPolicy((body: ErrorModel) =>
|
|
144
|
+
genErrorFormatterPolicy((body: ErrorModel) => [
|
|
145
|
+
' ', body.reason, body.errorCode == null ? '' : ` (${body.errorCode})`,
|
|
146
|
+
].join('')),
|
|
141
147
|
],
|
|
142
148
|
...options,
|
|
143
149
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.pipeline.addPolicy(
|
|
149
|
-
genVersionCheckPolicy('node', '/v3/status', versionPromise, '6.2.0', '7.0.0'),
|
|
150
|
-
);
|
|
151
|
-
}
|
|
150
|
+
this.pipeline.removePolicy({ name: userAgentPolicyName });
|
|
151
|
+
this.pipeline.removePolicy({ name: setClientRequestIdPolicyName });
|
|
152
|
+
// TODO: use instead our retry policy
|
|
153
|
+
this.pipeline.removePolicy({ name: 'defaultRetryPolicy' });
|
|
152
154
|
this.intAsString = true;
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
#cachedStatusPromise?: ReturnType<Node['getStatus']>;
|
|
158
|
+
|
|
159
|
+
async _getCachedStatus(options?: OperationOptions): ReturnType<Node['getStatus']> {
|
|
160
|
+
if (this.#cachedStatusPromise != null) return this.#cachedStatusPromise;
|
|
161
|
+
return this.getStatus(options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// eslint-disable-next-line rulesdir/tsdoc-syntax
|
|
165
|
+
/** @ts-expect-error use code generation to create node class? */
|
|
166
|
+
override async getStatus(
|
|
167
|
+
...args: Parameters<InstanceType<NodeTransformedApi>['getStatus']>
|
|
168
|
+
): ReturnType<InstanceType<NodeTransformedApi>['getStatus']> {
|
|
169
|
+
const promise = super.getStatus(...args);
|
|
170
|
+
promise.then(() => { this.#cachedStatusPromise = promise; }, () => {});
|
|
171
|
+
return promise;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Returns network ID provided by node.
|
|
176
|
+
* This method won't do extra requests on subsequent calls.
|
|
177
|
+
*/
|
|
155
178
|
async getNetworkId(): Promise<string> {
|
|
156
|
-
|
|
157
|
-
const networkId = await this.#networkIdPromise;
|
|
158
|
-
if (networkId instanceof Error) throw networkId;
|
|
159
|
-
return networkId;
|
|
179
|
+
return (await this._getCachedStatus()).networkId;
|
|
160
180
|
}
|
|
161
181
|
|
|
162
182
|
async getNodeInfo(): Promise<NodeInfo> {
|
|
163
183
|
const {
|
|
164
|
-
nodeVersion
|
|
184
|
+
nodeVersion,
|
|
165
185
|
networkId: nodeNetworkId,
|
|
166
186
|
protocols,
|
|
167
187
|
topBlockHeight,
|
|
168
188
|
} = await this.getStatus();
|
|
189
|
+
|
|
169
190
|
const consensusProtocolVersion = protocols
|
|
170
191
|
.filter(({ effectiveAtHeight }) => topBlockHeight >= effectiveAtHeight)
|
|
171
192
|
.reduce(
|
|
@@ -173,10 +194,19 @@ export default class Node extends (NodeTransformed as unknown as NodeTransformed
|
|
|
173
194
|
{ effectiveAtHeight: -1, version: 0 },
|
|
174
195
|
)
|
|
175
196
|
.version;
|
|
197
|
+
if (ConsensusProtocolVersion[consensusProtocolVersion] == null) {
|
|
198
|
+
const version = consensusProtocolVersion.toString();
|
|
199
|
+
const versions = Object.values(ConsensusProtocolVersion)
|
|
200
|
+
.filter((el) => typeof el === 'number').map((el) => +el);
|
|
201
|
+
const geVersion = Math.min(...versions).toString();
|
|
202
|
+
const ltVersion = (Math.max(...versions) + 1).toString();
|
|
203
|
+
throw new UnsupportedVersionError('consensus protocol', version, geVersion, ltVersion);
|
|
204
|
+
}
|
|
205
|
+
|
|
176
206
|
return {
|
|
177
207
|
url: this.$host,
|
|
178
208
|
nodeNetworkId,
|
|
179
|
-
version,
|
|
209
|
+
version: nodeVersion,
|
|
180
210
|
consensusProtocolVersion,
|
|
181
211
|
};
|
|
182
212
|
}
|
package/src/account/Base.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
|
import { NotImplementedError } from '../utils/errors';
|
|
7
7
|
|
|
@@ -56,8 +56,8 @@ export default abstract class AccountBase {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Sign typed data
|
|
59
|
-
* @param type - Type of data to sign
|
|
60
59
|
* @param data - Encoded data to sign
|
|
60
|
+
* @param aci - Type of data to sign
|
|
61
61
|
* @param options - Options
|
|
62
62
|
* @returns Signature
|
|
63
63
|
*/
|
|
@@ -80,7 +80,10 @@ export default abstract class AccountBase {
|
|
|
80
80
|
* Sign delegation of AENS, oracle operations to a contract
|
|
81
81
|
* @param contractAddress - Address of a contract to delegate permissions to
|
|
82
82
|
* @param options - Options
|
|
83
|
+
* @param options.isOracle - Use to generate an oracle delegation signature in Ceres, otherwise an
|
|
84
|
+
* AENS preclaim delegation signature would be generated
|
|
83
85
|
* @returns Signature
|
|
86
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
84
87
|
*/
|
|
85
88
|
// TODO: make abstract in the next major release
|
|
86
89
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -89,6 +92,8 @@ export default abstract class AccountBase {
|
|
|
89
92
|
contractAddress: Encoded.ContractAddress,
|
|
90
93
|
options?: {
|
|
91
94
|
networkId?: string;
|
|
95
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
96
|
+
isOracle?: boolean;
|
|
92
97
|
aeppOrigin?: string;
|
|
93
98
|
aeppRpcClientId?: string;
|
|
94
99
|
},
|
|
@@ -103,6 +108,7 @@ export default abstract class AccountBase {
|
|
|
103
108
|
* @param name - AENS name to manage by a contract
|
|
104
109
|
* @param options - Options
|
|
105
110
|
* @returns Signature
|
|
111
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
106
112
|
*/
|
|
107
113
|
// TODO: make abstract in the next major release
|
|
108
114
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -112,6 +118,7 @@ export default abstract class AccountBase {
|
|
|
112
118
|
name: AensName,
|
|
113
119
|
options?: {
|
|
114
120
|
networkId?: string;
|
|
121
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
115
122
|
aeppOrigin?: string;
|
|
116
123
|
aeppRpcClientId?: string;
|
|
117
124
|
},
|
|
@@ -120,6 +127,29 @@ export default abstract class AccountBase {
|
|
|
120
127
|
throw new NotImplementedError('signNameDelegationToContract method');
|
|
121
128
|
}
|
|
122
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Sign delegation of all AENS names to a contract (not available in Iris)
|
|
132
|
+
* @param contractAddress - Address of a contract to delegate permissions to
|
|
133
|
+
* @param options - Options
|
|
134
|
+
* @returns Signature
|
|
135
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
136
|
+
*/
|
|
137
|
+
// TODO: make abstract in the next major release
|
|
138
|
+
// eslint-disable-next-line class-methods-use-this
|
|
139
|
+
async signAllNamesDelegationToContract(
|
|
140
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
141
|
+
contractAddress: Encoded.ContractAddress,
|
|
142
|
+
options?: {
|
|
143
|
+
networkId?: string;
|
|
144
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
145
|
+
aeppOrigin?: string;
|
|
146
|
+
aeppRpcClientId?: string;
|
|
147
|
+
},
|
|
148
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
149
|
+
): Promise<Encoded.Signature> {
|
|
150
|
+
throw new NotImplementedError('signAllNamesDelegationToContract method');
|
|
151
|
+
}
|
|
152
|
+
|
|
123
153
|
/**
|
|
124
154
|
* Sign delegation of oracle query to a contract
|
|
125
155
|
*
|
|
@@ -133,6 +163,7 @@ export default abstract class AccountBase {
|
|
|
133
163
|
* @param oracleQueryId - Oracle query ID to reply by a contract
|
|
134
164
|
* @param options - Options
|
|
135
165
|
* @returns Signature
|
|
166
|
+
* @deprecated use AccountBase:signDelegation in Ceres
|
|
136
167
|
*/
|
|
137
168
|
// TODO: make abstract in the next major release
|
|
138
169
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -142,6 +173,7 @@ export default abstract class AccountBase {
|
|
|
142
173
|
oracleQueryId: Encoded.OracleQueryId,
|
|
143
174
|
options?: {
|
|
144
175
|
networkId?: string;
|
|
176
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
145
177
|
aeppOrigin?: string;
|
|
146
178
|
aeppRpcClientId?: string;
|
|
147
179
|
},
|
|
@@ -156,10 +188,37 @@ export default abstract class AccountBase {
|
|
|
156
188
|
* @param options - Options
|
|
157
189
|
* @returns Signature
|
|
158
190
|
*/
|
|
159
|
-
abstract sign(
|
|
191
|
+
abstract sign(
|
|
192
|
+
data: string | Uint8Array,
|
|
193
|
+
options?: {
|
|
194
|
+
aeppOrigin?: string;
|
|
195
|
+
aeppRpcClientId?: string;
|
|
196
|
+
},
|
|
197
|
+
): Promise<Uint8Array>;
|
|
160
198
|
|
|
161
199
|
/**
|
|
162
200
|
* Account address
|
|
163
201
|
*/
|
|
164
202
|
readonly address!: Encoded.AccountAddress;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Sign delegation, works only in Ceres
|
|
206
|
+
* @param delegation - Delegation to sign
|
|
207
|
+
* @param options - Options
|
|
208
|
+
* @returns Signature
|
|
209
|
+
*/
|
|
210
|
+
// TODO: make abstract in the next major release
|
|
211
|
+
// eslint-disable-next-line class-methods-use-this
|
|
212
|
+
async signDelegation(
|
|
213
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
214
|
+
delegation: Encoded.Bytearray,
|
|
215
|
+
options?: {
|
|
216
|
+
networkId?: string;
|
|
217
|
+
aeppOrigin?: string;
|
|
218
|
+
aeppRpcClientId?: string;
|
|
219
|
+
},
|
|
220
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
221
|
+
): Promise<Encoded.Signature> {
|
|
222
|
+
throw new NotImplementedError('signDelegation method');
|
|
223
|
+
}
|
|
165
224
|
}
|
|
@@ -53,11 +53,21 @@ export default class AccountGeneralized extends AccountBase {
|
|
|
53
53
|
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// eslint-disable-next-line class-methods-use-this
|
|
57
|
+
override async signAllNamesDelegationToContract(): Promise<Encoded.Signature> {
|
|
58
|
+
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
// eslint-disable-next-line class-methods-use-this
|
|
57
62
|
override async signOracleQueryDelegationToContract(): Promise<Encoded.Signature> {
|
|
58
63
|
throw new NotImplementedError('signing delegation to contract using generalized account');
|
|
59
64
|
}
|
|
60
65
|
|
|
66
|
+
// eslint-disable-next-line class-methods-use-this
|
|
67
|
+
override async signDelegation(): Promise<Encoded.Signature> {
|
|
68
|
+
throw new NotImplementedError('signing delegation using generalized account');
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
override async signTransaction(
|
|
62
72
|
tx: Encoded.Transaction,
|
|
63
73
|
{ authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1],
|
package/src/account/Ledger.ts
CHANGED
|
@@ -55,11 +55,21 @@ export default class AccountLedger extends AccountBase {
|
|
|
55
55
|
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// eslint-disable-next-line class-methods-use-this
|
|
59
|
+
override async signAllNamesDelegationToContract(): Promise<Encoded.Signature> {
|
|
60
|
+
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
// eslint-disable-next-line class-methods-use-this
|
|
59
64
|
override async signOracleQueryDelegationToContract(): Promise<Encoded.Signature> {
|
|
60
65
|
throw new NotImplementedError('signing delegation to contract using Ledger HW');
|
|
61
66
|
}
|
|
62
67
|
|
|
68
|
+
// eslint-disable-next-line class-methods-use-this
|
|
69
|
+
override async signDelegation(): Promise<Encoded.Signature> {
|
|
70
|
+
throw new NotImplementedError('signing delegation using Ledger HW');
|
|
71
|
+
}
|
|
72
|
+
|
|
63
73
|
override async signTransaction(
|
|
64
74
|
tx: Encoded.Transaction,
|
|
65
75
|
{ innerTx, networkId }: { innerTx?: boolean; networkId?: string } = {},
|