@aeternity/aepp-sdk 13.2.2 → 13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/bin/aesophia_cli_8 +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +9171 -7086
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +3 -0
- package/es/AeSdk.mjs +12 -12
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +0 -1
- package/es/AeSdkAepp.mjs +12 -16
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +61 -6
- package/es/AeSdkBase.mjs +150 -69
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +19 -7
- package/es/AeSdkMethods.mjs +39 -38
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +86 -55
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.mjs +31 -27
- package/es/Middleware.mjs.map +1 -1
- package/es/MiddlewareSubscriber.mjs +5 -14
- package/es/MiddlewareSubscriber.mjs.map +1 -1
- package/es/Node.d.ts +10 -2
- package/es/Node.mjs +53 -54
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +39 -3
- package/es/account/Base.mjs +35 -1
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +2 -0
- package/es/account/Generalized.mjs +15 -6
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +2 -0
- package/es/account/Ledger.mjs +14 -5
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs +4 -6
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +15 -4
- package/es/account/Memory.mjs +96 -31
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +16 -5
- package/es/account/Rpc.mjs +94 -21
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +17 -44
- package/es/aens.mjs +32 -71
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +2 -0
- package/es/aepp-wallet-communication/schema.mjs +2 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -0
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.mjs +13 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/middleware/middleware.d.ts +23 -5
- package/es/apis/middleware/middleware.mjs +114 -18
- package/es/apis/middleware/middleware.mjs.map +1 -1
- package/es/apis/middleware/models/index.d.ts +164 -15
- package/es/apis/middleware/models/index.mjs +53 -3
- package/es/apis/middleware/models/index.mjs.map +1 -1
- package/es/apis/middleware/models/mappers.d.ts +8 -1
- package/es/apis/middleware/models/mappers.mjs +376 -3
- package/es/apis/middleware/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/models/parameters.d.ts +6 -3
- package/es/apis/middleware/models/parameters.mjs +38 -11
- package/es/apis/middleware/models/parameters.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +66 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +5 -1
- package/es/apis/node/models/mappers.mjs +229 -7
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.d.ts +2 -2
- package/es/apis/node/models/parameters.mjs +2 -2
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.d.ts +24 -3
- package/es/apis/node/node.mjs +135 -3
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +14 -44
- package/es/chain.mjs +125 -219
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +3 -47
- package/es/channel/Base.mjs +21 -54
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +16 -25
- package/es/channel/Contract.mjs +39 -63
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +0 -8
- package/es/channel/Spend.mjs +17 -29
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +1 -1
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +104 -5
- package/es/channel/internal.mjs +26 -34
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +9 -1
- package/es/contract/Contract.mjs +67 -73
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +14 -8
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +5 -9
- package/es/contract/compiler/Cli.mjs +45 -23
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Cli8.d.ts +13 -0
- package/es/contract/compiler/Cli8.mjs +22 -0
- package/es/contract/compiler/Cli8.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +3 -9
- package/es/contract/compiler/Http.mjs +28 -16
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +2 -5
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +2 -1
- package/es/contract/delegation-signature.mjs +18 -14
- package/es/contract/delegation-signature.mjs.map +1 -1
- package/es/contract/ga.d.ts +1 -2
- package/es/contract/ga.mjs +23 -25
- package/es/contract/ga.mjs.map +1 -1
- package/es/deprecated.d.ts +38 -0
- package/es/deprecated.mjs +45 -0
- package/es/deprecated.mjs.map +1 -1
- package/es/index-browser.d.ts +10 -5
- package/es/index-browser.mjs +9 -5
- package/es/index-browser.mjs.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +6 -37
- package/es/oracle.mjs +32 -66
- package/es/oracle.mjs.map +1 -1
- package/es/send-transaction.d.ts +53 -0
- package/es/send-transaction.mjs +109 -0
- package/es/send-transaction.mjs.map +1 -0
- package/es/spend.d.ts +4 -3
- package/es/spend.mjs +6 -1
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/common.d.ts +29 -0
- package/es/tx/builder/common.mjs +42 -0
- package/es/tx/builder/common.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -4
- package/es/tx/builder/constants.mjs +6 -15
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/delegation/index.d.ts +20 -0
- package/es/tx/builder/delegation/index.mjs +24 -0
- package/es/tx/builder/delegation/index.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.d.ts +130 -0
- package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/es/tx/builder/delegation/schema.generated.mjs +2 -0
- package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.mjs +54 -0
- package/es/tx/builder/delegation/schema.mjs.map +1 -0
- package/es/tx/builder/field-types/abi-version.mjs +8 -11
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs +1 -4
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/es/tx/builder/field-types/coin-amount.mjs +6 -6
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.mjs +3 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +7 -13
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +19 -11
- package/es/tx/builder/field-types/fee.mjs +56 -38
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs +13 -15
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +10 -2
- package/es/tx/builder/field-types/gas-price.mjs +52 -3
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +31 -29
- package/es/tx/builder/field-types/index.mjs +31 -29
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.mjs +20 -31
- package/es/tx/builder/field-types/map.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.mjs +14 -29
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +1 -1
- package/es/tx/builder/field-types/name-fee.mjs +1 -1
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +1 -0
- package/es/tx/builder/field-types/nonce.mjs +2 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +4 -7
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers2.d.ts +23 -0
- package/es/tx/builder/field-types/pointers2.mjs +65 -0
- package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
- package/es/tx/builder/field-types/query-fee.d.ts +19 -0
- package/es/tx/builder/field-types/query-fee.mjs +20 -0
- package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/ttl.d.ts +9 -1
- package/es/tx/builder/field-types/ttl.mjs +19 -8
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/field-types/with-default.d.ts +7 -0
- package/es/tx/builder/field-types/with-default.mjs +9 -0
- package/es/tx/builder/field-types/with-default.mjs.map +1 -0
- package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/es/tx/builder/field-types/with-formatting.mjs +9 -0
- package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
- package/es/tx/builder/field-types/wrapped.mjs +6 -8
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -2
- package/es/tx/builder/helpers.mjs +12 -21
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +17 -10
- package/es/tx/builder/index.mjs +39 -65
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +478 -257
- package/es/tx/builder/schema.generated.d.ts +39 -3
- package/es/tx/builder/schema.generated.mjs.map +1 -1
- package/es/tx/builder/schema.mjs +48 -36
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +6 -5
- package/es/tx/execution-cost.mjs +16 -17
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/transaction-signer.mjs +1 -4
- package/es/tx/transaction-signer.mjs.map +1 -1
- package/es/tx/validator.mjs +61 -42
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +15 -22
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +2 -3
- package/es/utils/autorest.mjs +40 -24
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -2
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -4
- package/es/utils/crypto.mjs +17 -13
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +6 -0
- package/es/utils/errors.mjs +12 -6
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +2 -0
- package/es/utils/hd-wallet.mjs +6 -5
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -10
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/jwt.d.ts +53 -0
- package/es/utils/jwt.mjs +120 -0
- package/es/utils/jwt.mjs.map +1 -0
- package/es/utils/keystore.d.ts +6 -2
- package/es/utils/keystore.mjs +8 -16
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/typed-data.mjs +1 -0
- package/es/utils/typed-data.mjs.map +1 -1
- package/es/utils/wrap-proxy.d.ts +2 -0
- package/es/utils/wrap-proxy.mjs +15 -0
- package/es/utils/wrap-proxy.mjs.map +1 -0
- package/package.json +57 -51
- package/src/AeSdk.ts +3 -0
- package/src/AeSdkAepp.ts +0 -1
- package/src/AeSdkBase.ts +97 -10
- package/src/AeSdkMethods.ts +37 -33
- package/src/AeSdkWallet.ts +22 -3
- package/src/Middleware.ts +16 -8
- package/src/MiddlewareSubscriber.ts +1 -1
- package/src/Node.ts +37 -18
- package/src/account/Base.ts +62 -3
- package/src/account/Generalized.ts +10 -0
- package/src/account/Ledger.ts +10 -0
- package/src/account/Memory.ts +83 -9
- package/src/account/Rpc.ts +69 -6
- package/src/aens.ts +35 -56
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
- package/src/aepp-wallet-communication/rpc/types.ts +13 -0
- package/src/aepp-wallet-communication/schema.ts +2 -0
- package/src/apis/compiler/compiler.ts +93 -93
- package/src/apis/compiler/models/index.ts +1 -0
- package/src/apis/compiler/models/mappers.ts +178 -165
- package/src/apis/compiler/models/parameters.ts +18 -18
- package/src/apis/middleware/middleware.ts +462 -341
- package/src/apis/middleware/models/index.ts +258 -56
- package/src/apis/middleware/models/mappers.ts +2357 -1919
- package/src/apis/middleware/models/parameters.ts +172 -142
- package/src/apis/node/models/index.ts +79 -2
- package/src/apis/node/models/mappers.ts +1529 -1302
- package/src/apis/node/models/parameters.ts +51 -51
- package/src/apis/node/node.ts +420 -275
- package/src/chain.ts +42 -128
- package/src/channel/Base.ts +14 -47
- package/src/channel/Contract.ts +18 -26
- package/src/channel/Spend.ts +0 -8
- package/src/channel/internal.ts +115 -13
- package/src/contract/Contract.ts +26 -8
- package/src/contract/compiler/Base.ts +15 -8
- package/src/contract/compiler/Cli.ts +37 -21
- package/src/contract/compiler/Cli8.ts +17 -0
- package/src/contract/compiler/Http.ts +24 -14
- package/src/contract/compiler/HttpNode.ts +2 -2
- package/src/contract/delegation-signature.ts +11 -5
- package/src/contract/ga.ts +4 -3
- package/src/deprecated.ts +36 -0
- package/src/index-browser.ts +14 -7
- package/src/index.ts +1 -0
- package/src/oracle.ts +11 -54
- package/src/send-transaction.ts +136 -0
- package/src/spend.ts +25 -11
- package/src/tx/builder/common.ts +74 -0
- package/src/tx/builder/constants.ts +6 -9
- package/src/tx/builder/delegation/index.ts +28 -0
- package/src/tx/builder/delegation/schema.generated.ts +143 -0
- package/src/tx/builder/delegation/schema.ts +61 -0
- package/src/tx/builder/field-types/coin-amount.ts +3 -2
- package/src/tx/builder/field-types/entry.ts +1 -4
- package/src/tx/builder/field-types/fee.ts +71 -43
- package/src/tx/builder/field-types/gas-limit.ts +4 -4
- package/src/tx/builder/field-types/gas-price.ts +70 -14
- package/src/tx/builder/field-types/index.ts +31 -59
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- package/src/tx/builder/field-types/nonce.ts +7 -1
- package/src/tx/builder/field-types/pointers2.ts +62 -0
- package/src/tx/builder/field-types/query-fee.ts +25 -0
- package/src/tx/builder/field-types/ttl.ts +13 -3
- package/src/tx/builder/field-types/with-default.ts +18 -0
- package/src/tx/builder/field-types/with-formatting.ts +18 -0
- package/src/tx/builder/helpers.ts +2 -2
- package/src/tx/builder/index.ts +42 -59
- package/src/tx/builder/schema.generated.ts +39 -3
- package/src/tx/builder/schema.ts +55 -29
- package/src/tx/execution-cost.ts +6 -5
- package/src/tx/validator.ts +31 -5
- package/src/utils/autorest.ts +36 -27
- package/src/utils/crypto.ts +23 -13
- package/src/utils/errors.ts +10 -0
- package/src/utils/hd-wallet.ts +2 -0
- package/src/utils/jwt.ts +126 -0
- package/src/utils/keystore.ts +6 -2
- package/src/utils/wrap-proxy.ts +24 -0
- package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.2/Node.d.ts +14 -1
- package/types-legacy/ts4.2/account/Base.d.ts +39 -3
- package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.2/aens.d.ts +17 -44
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.2/chain.d.ts +14 -44
- package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.2/deprecated.d.ts +38 -0
- package/types-legacy/ts4.2/index-browser.d.ts +10 -5
- package/types-legacy/ts4.2/index.d.ts +1 -0
- package/types-legacy/ts4.2/oracle.d.ts +6 -37
- package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.2/spend.d.ts +4 -3
- package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.5/Node.d.ts +14 -1
- package/types-legacy/ts4.5/account/Base.d.ts +39 -3
- package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.5/aens.d.ts +17 -44
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.5/chain.d.ts +14 -44
- package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.5/deprecated.d.ts +38 -0
- package/types-legacy/ts4.5/index-browser.d.ts +10 -5
- package/types-legacy/ts4.5/index.d.ts +1 -0
- package/types-legacy/ts4.5/oracle.d.ts +6 -37
- package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.5/spend.d.ts +4 -3
- package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
- package/es/tx/builder/field-types/deposit.d.ts +0 -15
- package/es/tx/builder/field-types/deposit.mjs +0 -18
- package/es/tx/builder/field-types/deposit.mjs.map +0 -1
- package/src/tx/builder/field-types/deposit.ts +0 -23
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
package/es/AeSdk.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export default class AeSdk extends AeSdkBase {
|
|
|
7
7
|
[key: Encoded.AccountAddress]: AccountBase;
|
|
8
8
|
};
|
|
9
9
|
selectedAddress?: Encoded.AccountAddress;
|
|
10
|
+
/**
|
|
11
|
+
* @param options - Options
|
|
12
|
+
*/
|
|
10
13
|
constructor({ accounts, ...options }?: {
|
|
11
14
|
accounts?: AccountBase[];
|
|
12
15
|
} & ConstructorParameters<typeof AeSdkBase>[0]);
|
package/es/AeSdk.mjs
CHANGED
|
@@ -3,19 +3,20 @@ import AeSdkBase from "./AeSdkBase.mjs";
|
|
|
3
3
|
import { decode } from "./utils/encoder.mjs";
|
|
4
4
|
import { UnavailableAccountError } from "./utils/errors.mjs";
|
|
5
5
|
export default class AeSdk extends AeSdkBase {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param options - Options
|
|
8
|
+
*/
|
|
9
|
+
constructor({
|
|
10
|
+
accounts,
|
|
11
|
+
...options
|
|
12
|
+
} = {}) {
|
|
11
13
|
super(options);
|
|
12
14
|
_defineProperty(this, "accounts", {});
|
|
13
|
-
accounts === null || accounts === void 0
|
|
15
|
+
accounts === null || accounts === void 0 || accounts.forEach((account, idx) => this.addAccount(account, {
|
|
14
16
|
select: idx === 0
|
|
15
17
|
}));
|
|
16
18
|
}
|
|
17
|
-
_resolveAccount() {
|
|
18
|
-
let account = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.selectedAddress;
|
|
19
|
+
_resolveAccount(account = this.selectedAddress) {
|
|
19
20
|
if (typeof account === 'string') {
|
|
20
21
|
const address = account;
|
|
21
22
|
decode(address);
|
|
@@ -40,10 +41,9 @@ export default class AeSdk extends AeSdkBase {
|
|
|
40
41
|
* @param options.select - Select account
|
|
41
42
|
* @example addAccount(account)
|
|
42
43
|
*/
|
|
43
|
-
addAccount(account
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
+
addAccount(account, {
|
|
45
|
+
select
|
|
46
|
+
} = {}) {
|
|
47
47
|
const {
|
|
48
48
|
address
|
|
49
49
|
} = account;
|
package/es/AeSdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeSdk.mjs","names":["AeSdkBase","decode","UnavailableAccountError","AeSdk","constructor","accounts","options","
|
|
1
|
+
{"version":3,"file":"AeSdk.mjs","names":["AeSdkBase","decode","UnavailableAccountError","AeSdk","constructor","accounts","options","_defineProperty","forEach","account","idx","addAccount","select","_resolveAccount","selectedAddress","address","addresses","Object","keys","selectAccount","removeAccount"],"sources":["../src/AeSdk.ts"],"sourcesContent":["import AeSdkBase from './AeSdkBase';\nimport { OnAccount } from './AeSdkMethods';\nimport AccountBase from './account/Base';\nimport { decode, Encoded } from './utils/encoder';\nimport { UnavailableAccountError } from './utils/errors';\n\nexport default class AeSdk extends AeSdkBase {\n accounts: { [key: Encoded.AccountAddress]: AccountBase } = {};\n\n selectedAddress?: Encoded.AccountAddress;\n\n /**\n * @param options - Options\n */\n constructor(\n { accounts, ...options }: { accounts?: AccountBase[] }\n & ConstructorParameters<typeof AeSdkBase>[0] = {},\n ) {\n super(options);\n accounts?.forEach((account, idx) => this.addAccount(account, { select: idx === 0 }));\n }\n\n override _resolveAccount(account: OnAccount = this.selectedAddress): AccountBase {\n if (typeof account === 'string') {\n const address = account as Encoded.AccountAddress;\n decode(address);\n if (this.accounts[address] == null) throw new UnavailableAccountError(account);\n account = this.accounts[address];\n }\n return super._resolveAccount(account);\n }\n\n /**\n * Get accounts addresses\n * @example addresses()\n */\n override addresses(): Encoded.AccountAddress[] {\n return Object.keys(this.accounts) as Encoded.AccountAddress[];\n }\n\n /**\n * Add specific account\n * @param account - Account instance\n * @param options - Options\n * @param options.select - Select account\n * @example addAccount(account)\n */\n addAccount(account: AccountBase, { select }: { select?: boolean } = {}): void {\n const { address } = account;\n this.accounts[address] = account;\n if (select === true) this.selectAccount(address);\n }\n\n /**\n * Remove specific account\n * @param address - Address of account to remove\n * @example removeAccount(address)\n */\n removeAccount(address: Encoded.AccountAddress): void {\n if (this.accounts[address] == null) throw new UnavailableAccountError(address);\n delete this.accounts[address]; // eslint-disable-line @typescript-eslint/no-dynamic-delete\n if (this.selectedAddress === address) delete this.selectedAddress;\n }\n\n /**\n * Select specific account\n * @param address - Address of account to select\n * @example selectAccount('ak_xxxxxxxx')\n */\n selectAccount(address: Encoded.AccountAddress): void {\n decode(address);\n if (this.accounts[address] == null) throw new UnavailableAccountError(address);\n this.selectedAddress = address;\n }\n}\n"],"mappings":";OAAOA,SAAS;AAAA,SAGPC,MAAM;AAAA,SACNC,uBAAuB;AAEhC,eAAe,MAAMC,KAAK,SAASH,SAAS,CAAC;EAK3C;AACF;AACA;EACEI,WAAWA,CACT;IAAEC,QAAQ;IAAE,GAAGC;EAC4B,CAAC,GAAG,CAAC,CAAC,EACjD;IACA,KAAK,CAACA,OAAO,CAAC;IAACC,eAAA,mBAX0C,CAAC,CAAC;IAY3DF,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEG,OAAO,CAAC,CAACC,OAAO,EAAEC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E;;EAEA;AACF;AACA;AACA;AACA;EACEK,aAAaA,CAACJ,OAA+B,EAAQ;IACnDd,MAAM,CAACc,OAAO,CAAC;IACf,IAAI,IAAI,CAACV,QAAQ,CAACU,OAAO,CAAC,IAAI,IAAI,EAAE,MAAM,IAAIb,uBAAuB,CAACa,OAAO,CAAC;IAC9E,IAAI,CAACD,eAAe,GAAGC,OAAO;EAChC;AACF"}
|
package/es/AeSdkAepp.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ export default class AeSdkAepp extends AeSdkBase {
|
|
|
39
39
|
* @param options - Options
|
|
40
40
|
* @param options.connectNode - Request wallet to bind node
|
|
41
41
|
* @param options.name - Node name
|
|
42
|
-
* @param options.select - Select this node as current
|
|
43
42
|
*/
|
|
44
43
|
connectToWallet(connection: BrowserConnection, { connectNode, name }?: {
|
|
45
44
|
connectNode?: boolean;
|
package/es/AeSdkAepp.mjs
CHANGED
|
@@ -19,22 +19,20 @@ export default class AeSdkAepp extends AeSdkBase {
|
|
|
19
19
|
* @param options.onDisconnect - Call-back function for disconnect event
|
|
20
20
|
* @param options.onNetworkChange - Call-back function for update network event
|
|
21
21
|
*/
|
|
22
|
-
constructor(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
22
|
+
constructor({
|
|
23
|
+
name,
|
|
24
|
+
onAddressChange = () => {},
|
|
25
|
+
onDisconnect = () => {},
|
|
26
|
+
onNetworkChange = () => {},
|
|
27
|
+
...other
|
|
28
|
+
}) {
|
|
30
29
|
super(other);
|
|
31
30
|
this.onAddressChange = onAddressChange;
|
|
32
31
|
this.onDisconnect = onDisconnect;
|
|
33
32
|
this.onNetworkChange = onNetworkChange;
|
|
34
33
|
this.name = name;
|
|
35
34
|
}
|
|
36
|
-
_resolveAccount() {
|
|
37
|
-
let account = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.addresses()[0];
|
|
35
|
+
_resolveAccount(account = this.addresses()[0]) {
|
|
38
36
|
if (typeof account === 'string') {
|
|
39
37
|
const address = account;
|
|
40
38
|
decode(address);
|
|
@@ -57,13 +55,11 @@ export default class AeSdkAepp extends AeSdkBase {
|
|
|
57
55
|
* @param options - Options
|
|
58
56
|
* @param options.connectNode - Request wallet to bind node
|
|
59
57
|
* @param options.name - Node name
|
|
60
|
-
* @param options.select - Select this node as current
|
|
61
58
|
*/
|
|
62
|
-
async connectToWallet(connection
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
59
|
+
async connectToWallet(connection, {
|
|
60
|
+
connectNode = false,
|
|
61
|
+
name = 'wallet-node'
|
|
62
|
+
} = {}) {
|
|
67
63
|
if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');
|
|
68
64
|
let disconnectParams;
|
|
69
65
|
const updateNetwork = params => {
|
package/es/AeSdkAepp.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeSdkAepp.mjs","names":["AeSdkBase","AccountRpc","decode","RPC_VERSION","RpcClient","METHODS","AlreadyConnectedError","NoWalletConnectedError","UnsubscribedAccountError","UnAuthorizedAccountError","RpcConnectionError","Node","AeSdkAepp","constructor","_ref","name","onAddressChange","onDisconnect","onNetworkChange","other","_resolveAccount","account","arguments","length","undefined","addresses","address","includes","_ensureConnected","rpcClient","_ensureAccountAccess","_accounts","current","Object","keys","connected","connectToWallet","connection","connectNode","disconnectParams","updateNetwork","params","_params$node","node","url","pool","delete","addNode","client","updateAddress","closeConnection","disconnect","readyToConnect","walletInfo","request","connect","version","disconnectWallet","notify","reason","askAddresses","subscribeAddress","type","value","result"],"sources":["../src/AeSdkAepp.ts"],"sourcesContent":["import AeSdkBase from './AeSdkBase';\nimport { OnAccount } from './AeSdkMethods';\nimport AccountBase from './account/Base';\nimport AccountRpc from './account/Rpc';\nimport { decode, Encoded } from './utils/encoder';\nimport {\n Accounts, RPC_VERSION, WalletInfo, Network, WalletApi, AeppApi, Node as NodeRpc,\n} from './aepp-wallet-communication/rpc/types';\nimport RpcClient from './aepp-wallet-communication/rpc/RpcClient';\nimport { METHODS, SUBSCRIPTION_TYPES } from './aepp-wallet-communication/schema';\nimport {\n AlreadyConnectedError,\n NoWalletConnectedError,\n UnsubscribedAccountError,\n UnAuthorizedAccountError,\n RpcConnectionError,\n} from './utils/errors';\nimport Node from './Node';\nimport BrowserConnection from './aepp-wallet-communication/connection/Browser';\n\n/**\n * RPC handler for AEPP side\n * Contain functionality for wallet interaction and connect it to sdk\n * @category aepp wallet communication\n */\nexport default class AeSdkAepp extends AeSdkBase {\n name: string;\n\n onAddressChange: (a: Accounts) => void;\n\n onDisconnect: (p: any) => void;\n\n onNetworkChange: (a: Network) => void;\n\n rpcClient?: RpcClient<WalletApi, AeppApi>;\n\n _accounts?: Accounts;\n\n /**\n * @param options - Options\n * @param options.name - Aepp name\n * @param options.onAddressChange - Call-back function for update address event\n * @param options.onDisconnect - Call-back function for disconnect event\n * @param options.onNetworkChange - Call-back function for update network event\n */\n constructor({\n name,\n onAddressChange = () => {},\n onDisconnect = () => {},\n onNetworkChange = () => {},\n ...other\n }: {\n name: string;\n onAddressChange?: (a: Accounts) => void;\n onDisconnect?: (p: any) => void;\n onNetworkChange?: (a: Network) => void;\n } & ConstructorParameters<typeof AeSdkBase>[0]) {\n super(other);\n this.onAddressChange = onAddressChange;\n this.onDisconnect = onDisconnect;\n this.onNetworkChange = onNetworkChange;\n this.name = name;\n }\n\n override _resolveAccount(account: OnAccount = this.addresses()[0]): AccountBase {\n if (typeof account === 'string') {\n const address = account as Encoded.AccountAddress;\n decode(address);\n if (!this.addresses().includes(address)) throw new UnAuthorizedAccountError(address);\n this._ensureConnected();\n account = new AccountRpc(this.rpcClient, address);\n }\n if (account == null) this._ensureAccountAccess();\n return super._resolveAccount(account);\n }\n\n override addresses(): Encoded.AccountAddress[] {\n if (this._accounts == null) return [];\n const current = Object.keys(this._accounts.current)[0];\n return [\n ...current != null ? [current] : [], ...Object.keys(this._accounts.connected),\n ] as Encoded.AccountAddress[];\n }\n\n /**\n * Connect to wallet\n * @param connection - Wallet connection object\n * @param options - Options\n * @param options.connectNode - Request wallet to bind node\n * @param options.name - Node name\n * @param options.select - Select this node as current\n */\n async connectToWallet(\n connection: BrowserConnection,\n { connectNode = false, name = 'wallet-node' }: { connectNode?: boolean; name?: string } = {},\n ): Promise<WalletInfo & { node?: NodeRpc }> {\n if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');\n let disconnectParams: any;\n\n const updateNetwork = (params: Network): void => {\n if (connectNode) {\n if (params.node?.url == null) throw new RpcConnectionError('Missing URLs of the Node');\n this.pool.delete(name);\n this.addNode(name, new Node(params.node.url), true);\n }\n this.onNetworkChange(params);\n };\n\n const client = new RpcClient<WalletApi, AeppApi>(\n connection,\n () => {\n delete this.rpcClient;\n delete this._accounts;\n this.onDisconnect(disconnectParams);\n },\n {\n [METHODS.updateAddress]: (params) => {\n this._accounts = params;\n this.onAddressChange(params);\n },\n [METHODS.updateNetwork]: updateNetwork,\n [METHODS.closeConnection]: (params) => {\n disconnectParams = params;\n client.connection.disconnect();\n },\n [METHODS.readyToConnect]: () => {},\n },\n );\n const walletInfo = await client\n .request(METHODS.connect, { name: this.name, version: RPC_VERSION, connectNode });\n updateNetwork(walletInfo);\n this.rpcClient = client;\n return walletInfo;\n }\n\n /**\n * Disconnect from wallet\n */\n disconnectWallet(): void {\n this._ensureConnected();\n this.rpcClient.notify(METHODS.closeConnection, { reason: 'bye' });\n this.rpcClient.connection.disconnect();\n }\n\n /**\n * Ask addresses from wallet\n * @returns Addresses from wallet\n */\n async askAddresses(): Promise<Encoded.AccountAddress[]> {\n this._ensureAccountAccess();\n return this.rpcClient.request(METHODS.address, undefined);\n }\n\n /**\n * Subscribe for addresses from wallet\n * @param type - Subscription type\n * @param value - Should be one of 'current' (the selected account), 'connected' (all)\n * @returns Accounts from wallet\n */\n async subscribeAddress(\n type: SUBSCRIPTION_TYPES,\n value: 'current' | 'connected',\n ): Promise<ReturnType<WalletApi[METHODS.subscribeAddress]>> {\n this._ensureConnected();\n const result = await this.rpcClient.request(METHODS.subscribeAddress, { type, value });\n this._accounts = result.address;\n return result;\n }\n\n _ensureConnected(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {\n if (this.rpcClient != null) return;\n throw new NoWalletConnectedError('You are not connected to Wallet');\n }\n\n _ensureAccountAccess(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {\n this._ensureConnected();\n if (this.addresses().length !== 0) return;\n throw new UnsubscribedAccountError();\n }\n}\n"],"mappings":"OAAOA,SAAS;AAAA,OAGTC,UAAU;AAAA,SACRC,MAAM;AAAA,SAEHC,WAAW;AAAA,OAEhBC,SAAS;AAAA,SACPC,OAAO;AAAA,SAEdC,qBAAqB,EACrBC,sBAAsB,EACtBC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB;AAAA,OAEbC,IAAI;AAGX;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,SAAS,SAASZ,SAAS,CAAC;EAa/C;AACF;AACA;AACA;AACA;AACA;AACA;EACEa,WAAWA,CAAAC,IAAA,EAWqC;IAAA,IAXpC;MACVC,IAAI;MACJC,eAAe,GAAGA,CAAA,KAAM,CAAC,CAAC;MAC1BC,YAAY,GAAGA,CAAA,KAAM,CAAC,CAAC;MACvBC,eAAe,GAAGA,CAAA,KAAM,CAAC,CAAC;MAC1B,GAAGC;IAMwC,CAAC,GAAAL,IAAA;IAC5C,KAAK,CAACK,KAAK,CAAC;IACZ,IAAI,CAACH,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACC,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACH,IAAI,GAAGA,IAAI;EAClB;EAESK,eAAeA,CAAA,EAAwD;IAAA,IAAvDC,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,SAAS,CAAC,CAAC,CAACF,MAAM,KAAK,CAAC,EAAE;IACnC,MAAM,IAAIf,wBAAwB,CAAC,CAAC;EACtC;AACF"}
|
|
1
|
+
{"version":3,"file":"AeSdkAepp.mjs","names":["AeSdkBase","AccountRpc","decode","RPC_VERSION","RpcClient","METHODS","AlreadyConnectedError","NoWalletConnectedError","UnsubscribedAccountError","UnAuthorizedAccountError","RpcConnectionError","Node","AeSdkAepp","constructor","name","onAddressChange","onDisconnect","onNetworkChange","other","_resolveAccount","account","addresses","address","includes","_ensureConnected","rpcClient","_ensureAccountAccess","_accounts","current","Object","keys","connected","connectToWallet","connection","connectNode","disconnectParams","updateNetwork","params","_params$node","node","url","pool","delete","addNode","client","updateAddress","closeConnection","disconnect","readyToConnect","walletInfo","request","connect","version","disconnectWallet","notify","reason","askAddresses","undefined","subscribeAddress","type","value","result","length"],"sources":["../src/AeSdkAepp.ts"],"sourcesContent":["import AeSdkBase from './AeSdkBase';\nimport { OnAccount } from './AeSdkMethods';\nimport AccountBase from './account/Base';\nimport AccountRpc from './account/Rpc';\nimport { decode, Encoded } from './utils/encoder';\nimport {\n Accounts, RPC_VERSION, WalletInfo, Network, WalletApi, AeppApi, Node as NodeRpc,\n} from './aepp-wallet-communication/rpc/types';\nimport RpcClient from './aepp-wallet-communication/rpc/RpcClient';\nimport { METHODS, SUBSCRIPTION_TYPES } from './aepp-wallet-communication/schema';\nimport {\n AlreadyConnectedError,\n NoWalletConnectedError,\n UnsubscribedAccountError,\n UnAuthorizedAccountError,\n RpcConnectionError,\n} from './utils/errors';\nimport Node from './Node';\nimport BrowserConnection from './aepp-wallet-communication/connection/Browser';\n\n/**\n * RPC handler for AEPP side\n * Contain functionality for wallet interaction and connect it to sdk\n * @category aepp wallet communication\n */\nexport default class AeSdkAepp extends AeSdkBase {\n name: string;\n\n onAddressChange: (a: Accounts) => void;\n\n onDisconnect: (p: any) => void;\n\n onNetworkChange: (a: Network) => void;\n\n rpcClient?: RpcClient<WalletApi, AeppApi>;\n\n _accounts?: Accounts;\n\n /**\n * @param options - Options\n * @param options.name - Aepp name\n * @param options.onAddressChange - Call-back function for update address event\n * @param options.onDisconnect - Call-back function for disconnect event\n * @param options.onNetworkChange - Call-back function for update network event\n */\n constructor({\n name,\n onAddressChange = () => {},\n onDisconnect = () => {},\n onNetworkChange = () => {},\n ...other\n }: {\n name: string;\n onAddressChange?: (a: Accounts) => void;\n onDisconnect?: (p: any) => void;\n onNetworkChange?: (a: Network) => void;\n } & ConstructorParameters<typeof AeSdkBase>[0]) {\n super(other);\n this.onAddressChange = onAddressChange;\n this.onDisconnect = onDisconnect;\n this.onNetworkChange = onNetworkChange;\n this.name = name;\n }\n\n override _resolveAccount(account: OnAccount = this.addresses()[0]): AccountBase {\n if (typeof account === 'string') {\n const address = account as Encoded.AccountAddress;\n decode(address);\n if (!this.addresses().includes(address)) throw new UnAuthorizedAccountError(address);\n this._ensureConnected();\n account = new AccountRpc(this.rpcClient, address);\n }\n if (account == null) this._ensureAccountAccess();\n return super._resolveAccount(account);\n }\n\n override addresses(): Encoded.AccountAddress[] {\n if (this._accounts == null) return [];\n const current = Object.keys(this._accounts.current)[0];\n return [\n ...current != null ? [current] : [], ...Object.keys(this._accounts.connected),\n ] as Encoded.AccountAddress[];\n }\n\n /**\n * Connect to wallet\n * @param connection - Wallet connection object\n * @param options - Options\n * @param options.connectNode - Request wallet to bind node\n * @param options.name - Node name\n */\n async connectToWallet(\n connection: BrowserConnection,\n { connectNode = false, name = 'wallet-node' }: { connectNode?: boolean; name?: string } = {},\n ): Promise<WalletInfo & { node?: NodeRpc }> {\n if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');\n let disconnectParams: any;\n\n const updateNetwork = (params: Network): void => {\n if (connectNode) {\n if (params.node?.url == null) throw new RpcConnectionError('Missing URLs of the Node');\n this.pool.delete(name);\n this.addNode(name, new Node(params.node.url), true);\n }\n this.onNetworkChange(params);\n };\n\n const client = new RpcClient<WalletApi, AeppApi>(\n connection,\n () => {\n delete this.rpcClient;\n delete this._accounts;\n this.onDisconnect(disconnectParams);\n },\n {\n [METHODS.updateAddress]: (params) => {\n this._accounts = params;\n this.onAddressChange(params);\n },\n [METHODS.updateNetwork]: updateNetwork,\n [METHODS.closeConnection]: (params) => {\n disconnectParams = params;\n client.connection.disconnect();\n },\n [METHODS.readyToConnect]: () => {},\n },\n );\n const walletInfo = await client\n .request(METHODS.connect, { name: this.name, version: RPC_VERSION, connectNode });\n updateNetwork(walletInfo);\n this.rpcClient = client;\n return walletInfo;\n }\n\n /**\n * Disconnect from wallet\n */\n disconnectWallet(): void {\n this._ensureConnected();\n this.rpcClient.notify(METHODS.closeConnection, { reason: 'bye' });\n this.rpcClient.connection.disconnect();\n }\n\n /**\n * Ask addresses from wallet\n * @returns Addresses from wallet\n */\n async askAddresses(): Promise<Encoded.AccountAddress[]> {\n this._ensureAccountAccess();\n return this.rpcClient.request(METHODS.address, undefined);\n }\n\n /**\n * Subscribe for addresses from wallet\n * @param type - Subscription type\n * @param value - Should be one of 'current' (the selected account), 'connected' (all)\n * @returns Accounts from wallet\n */\n async subscribeAddress(\n type: SUBSCRIPTION_TYPES,\n value: 'current' | 'connected',\n ): Promise<ReturnType<WalletApi[METHODS.subscribeAddress]>> {\n this._ensureConnected();\n const result = await this.rpcClient.request(METHODS.subscribeAddress, { type, value });\n this._accounts = result.address;\n return result;\n }\n\n _ensureConnected(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {\n if (this.rpcClient != null) return;\n throw new NoWalletConnectedError('You are not connected to Wallet');\n }\n\n _ensureAccountAccess(): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {\n this._ensureConnected();\n if (this.addresses().length !== 0) return;\n throw new UnsubscribedAccountError();\n }\n}\n"],"mappings":"OAAOA,SAAS;AAAA,OAGTC,UAAU;AAAA,SACRC,MAAM;AAAA,SAEHC,WAAW;AAAA,OAEhBC,SAAS;AAAA,SACPC,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D,IAAI,CAACpC,gBAAgB,CAAC,CAAC;IACvB,MAAMqC,MAAM,GAAG,MAAM,IAAI,CAACpC,SAAS,CAACyB,OAAO,CAAC7C,OAAO,CAACqD,gBAAgB,EAAE;MAAEC,IAAI;MAAEC;IAAM,CAAC,CAAC;IACtF,IAAI,CAACjC,SAAS,GAAGkC,MAAM,CAACvC,OAAO;IAC/B,OAAOuC,MAAM;EACf;EAEArC,gBAAgBA,CAAA,EAAmF;IACjG,IAAI,IAAI,CAACC,SAAS,IAAI,IAAI,EAAE;IAC5B,MAAM,IAAIlB,sBAAsB,CAAC,iCAAiC,CAAC;EACrE;EAEAmB,oBAAoBA,CAAA,EAAmF;IACrG,IAAI,CAACF,gBAAgB,CAAC,CAAC;IACvB,IAAI,IAAI,CAACH,SAAS,CAAC,CAAC,CAACyC,MAAM,KAAK,CAAC,EAAE;IACnC,MAAM,IAAItD,wBAAwB,CAAC,CAAC;EACtC;AACF"}
|
package/es/AeSdkBase.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Node from './Node';
|
|
|
2
2
|
import AccountBase from './account/Base';
|
|
3
3
|
import { Encoded } from './utils/encoder';
|
|
4
4
|
import CompilerBase from './contract/compiler/Base';
|
|
5
|
-
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions } from './AeSdkMethods';
|
|
5
|
+
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions, WrappedOptions } from './AeSdkMethods';
|
|
6
6
|
import { AensName } from './tx/builder/constants';
|
|
7
7
|
type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
|
|
8
8
|
name: string;
|
|
@@ -14,6 +14,7 @@ type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
|
|
|
14
14
|
* - wrappers of account methods mapped to the current account.
|
|
15
15
|
*/
|
|
16
16
|
export default class AeSdkBase extends AeSdkMethods {
|
|
17
|
+
#private;
|
|
17
18
|
pool: Map<string, Node>;
|
|
18
19
|
selectedNodeName?: string;
|
|
19
20
|
/**
|
|
@@ -79,31 +80,85 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
79
80
|
*/
|
|
80
81
|
_resolveAccount(account?: OnAccount): AccountBase;
|
|
81
82
|
get address(): Encoded.AccountAddress;
|
|
83
|
+
/**
|
|
84
|
+
* Sign data blob
|
|
85
|
+
* @param data - Data to sign
|
|
86
|
+
* @param options - Options
|
|
87
|
+
*/
|
|
82
88
|
sign(data: string | Uint8Array, { onAccount, ...options }?: {
|
|
83
89
|
onAccount?: OnAccount;
|
|
84
90
|
}): Promise<Uint8Array>;
|
|
91
|
+
/**
|
|
92
|
+
* Sign encoded transaction
|
|
93
|
+
* @param tx - Transaction to sign
|
|
94
|
+
* @param options - Options
|
|
95
|
+
*/
|
|
85
96
|
signTransaction(tx: Encoded.Transaction, { onAccount, ...options }?: {
|
|
86
97
|
onAccount?: OnAccount;
|
|
87
98
|
} & Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
|
|
99
|
+
/**
|
|
100
|
+
* Sign message
|
|
101
|
+
* @param message - Message to sign
|
|
102
|
+
* @param options - Options
|
|
103
|
+
*/
|
|
88
104
|
signMessage(message: string, { onAccount, ...options }?: {
|
|
89
105
|
onAccount?: OnAccount;
|
|
90
106
|
} & Parameters<AccountBase['signMessage']>[1]): Promise<Uint8Array>;
|
|
107
|
+
/**
|
|
108
|
+
* Sign typed data
|
|
109
|
+
* @param data - Encoded data to sign
|
|
110
|
+
* @param aci - Type of data to sign
|
|
111
|
+
* @param options - Options
|
|
112
|
+
*/
|
|
91
113
|
signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
|
|
92
114
|
onAccount?: OnAccount;
|
|
93
115
|
} & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
118
|
+
* @param contractAddress - Contract address
|
|
119
|
+
* @param options - Options
|
|
120
|
+
*/
|
|
94
121
|
signDelegationToContract(contractAddress: Encoded.ContractAddress, { onAccount, ...options }?: {
|
|
95
122
|
onAccount?: OnAccount;
|
|
96
123
|
} & Parameters<AccountBase['signDelegationToContract']>[1]): Promise<Encoded.Signature>;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
126
|
+
* @param contractAddress - Contract address
|
|
127
|
+
* @param name - AENS name
|
|
128
|
+
* @param options - Options
|
|
129
|
+
*/
|
|
97
130
|
signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { onAccount, ...options }?: {
|
|
98
131
|
onAccount?: OnAccount;
|
|
99
132
|
} & Parameters<AccountBase['signNameDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
135
|
+
* @param contractAddress - Contract address
|
|
136
|
+
* @param options - Options
|
|
137
|
+
*/
|
|
138
|
+
signAllNamesDelegationToContract(contractAddress: Encoded.ContractAddress, { onAccount, ...options }?: {
|
|
139
|
+
onAccount?: OnAccount;
|
|
140
|
+
} & Parameters<AccountBase['signAllNamesDelegationToContract']>[1]): Promise<Encoded.Signature>;
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
143
|
+
* @param contractAddress - Contract address
|
|
144
|
+
* @param oracleQueryId - Oracle query id
|
|
145
|
+
* @param options - Options
|
|
146
|
+
*/
|
|
100
147
|
signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { onAccount, ...options }?: {
|
|
101
148
|
onAccount?: OnAccount;
|
|
102
149
|
} & Parameters<AccountBase['signOracleQueryDelegationToContract']>[2]): Promise<Encoded.Signature>;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Sign delegation, works only in Ceres
|
|
152
|
+
* @param delegation - Delegation to sign
|
|
153
|
+
* @param options - Options
|
|
154
|
+
*/
|
|
155
|
+
signDelegation(delegation: Encoded.Bytearray, { onAccount, ...options }?: {
|
|
156
|
+
onAccount?: OnAccount;
|
|
157
|
+
} & Parameters<AccountBase['signDelegation']>[1]): Promise<Encoded.Signature>;
|
|
158
|
+
/**
|
|
159
|
+
* The same as AeSdkMethods:getContext, but it would resolve ak_-prefixed address in
|
|
160
|
+
* `mergeWith.onAccount` to AccountBase.
|
|
161
|
+
*/
|
|
162
|
+
getContext(mergeWith?: AeSdkMethodsOptions): AeSdkMethodsOptions & WrappedOptions;
|
|
108
163
|
}
|
|
109
164
|
export {};
|
package/es/AeSdkBase.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
|
|
3
|
+
import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/classPrivateFieldSet";
|
|
4
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
5
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
6
|
+
import { CompilerError, DuplicateNodeError, NodeNotFoundError, NotImplementedError, TypeError as _TypeError } from "./utils/errors.mjs";
|
|
7
|
+
import { wrapWithProxy } from "./utils/wrap-proxy.mjs";
|
|
8
|
+
import AeSdkMethods from "./AeSdkMethods.mjs";
|
|
9
|
+
var _wrappedOptions = /*#__PURE__*/new WeakMap();
|
|
4
10
|
/**
|
|
5
11
|
* Basic AeSdk class implements:
|
|
6
12
|
* - node selector,
|
|
@@ -12,19 +18,24 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
12
18
|
* @param options - Options
|
|
13
19
|
* @param options.nodes - Array of nodes
|
|
14
20
|
*/
|
|
15
|
-
constructor(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
+
constructor({
|
|
22
|
+
nodes = [],
|
|
23
|
+
...options
|
|
24
|
+
} = {}) {
|
|
20
25
|
super(options);
|
|
21
26
|
_defineProperty(this, "pool", new Map());
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
_classPrivateFieldInitSpec(this, _wrappedOptions, {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
nodes.forEach(({
|
|
32
|
+
name,
|
|
33
|
+
instance
|
|
34
|
+
}, i) => this.addNode(name, instance, i === 0));
|
|
35
|
+
_classPrivateFieldSet(this, _wrappedOptions, {
|
|
36
|
+
onNode: wrapWithProxy(() => this.api),
|
|
37
|
+
onCompiler: wrapWithProxy(() => this.compilerApi),
|
|
38
|
+
onAccount: wrapWithProxy(() => this._resolveAccount())
|
|
28
39
|
});
|
|
29
40
|
}
|
|
30
41
|
|
|
@@ -53,8 +64,7 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
53
64
|
* aeSdkBase.addNode('testNode', new Node({ url }), true)
|
|
54
65
|
* ```
|
|
55
66
|
*/
|
|
56
|
-
addNode(name, node) {
|
|
57
|
-
let select = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
67
|
+
addNode(name, node, select = false) {
|
|
58
68
|
if (this.pool.has(name)) throw new DuplicateNodeError(name);
|
|
59
69
|
this.pool.set(name, node);
|
|
60
70
|
if (select || this.selectedNodeName == null) {
|
|
@@ -108,13 +118,10 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
108
118
|
* nodePool.getNodesInPool()
|
|
109
119
|
*/
|
|
110
120
|
async getNodesInPool() {
|
|
111
|
-
return Promise.all(Array.from(this.pool.entries()).map(async
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
...(await node.getNodeInfo())
|
|
116
|
-
};
|
|
117
|
-
}));
|
|
121
|
+
return Promise.all(Array.from(this.pool.entries()).map(async ([name, node]) => ({
|
|
122
|
+
name,
|
|
123
|
+
...(await node.getNodeInfo())
|
|
124
|
+
})));
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -126,82 +133,156 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
126
133
|
* Resolves an account
|
|
127
134
|
* @param account - ak-address, instance of AccountBase, or keypair
|
|
128
135
|
*/
|
|
129
|
-
_resolveAccount() {
|
|
130
|
-
let account = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._options.onAccount;
|
|
136
|
+
_resolveAccount(account = this._options.onAccount) {
|
|
131
137
|
if (typeof account === 'string') throw new NotImplementedError('Address in AccountResolver');
|
|
132
138
|
if (typeof account === 'object') return account;
|
|
133
|
-
throw new
|
|
139
|
+
throw new _TypeError('Account should be an address (ak-prefixed string), ' + `or instance of AccountBase, got ${String(account)} instead`);
|
|
134
140
|
}
|
|
135
141
|
get address() {
|
|
136
142
|
return this._resolveAccount().address;
|
|
137
143
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Sign data blob
|
|
147
|
+
* @param data - Data to sign
|
|
148
|
+
* @param options - Options
|
|
149
|
+
*/
|
|
150
|
+
async sign(data, {
|
|
151
|
+
onAccount,
|
|
152
|
+
...options
|
|
153
|
+
} = {}) {
|
|
143
154
|
return this._resolveAccount(onAccount).sign(data, options);
|
|
144
155
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Sign encoded transaction
|
|
159
|
+
* @param tx - Transaction to sign
|
|
160
|
+
* @param options - Options
|
|
161
|
+
*/
|
|
162
|
+
async signTransaction(tx, {
|
|
163
|
+
onAccount,
|
|
164
|
+
...options
|
|
165
|
+
} = {}) {
|
|
150
166
|
const networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
151
167
|
return this._resolveAccount(onAccount).signTransaction(tx, {
|
|
152
168
|
networkId,
|
|
153
169
|
...options
|
|
154
170
|
});
|
|
155
171
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Sign message
|
|
175
|
+
* @param message - Message to sign
|
|
176
|
+
* @param options - Options
|
|
177
|
+
*/
|
|
178
|
+
async signMessage(message, {
|
|
179
|
+
onAccount,
|
|
180
|
+
...options
|
|
181
|
+
} = {}) {
|
|
161
182
|
return this._resolveAccount(onAccount).signMessage(message, options);
|
|
162
183
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Sign typed data
|
|
187
|
+
* @param data - Encoded data to sign
|
|
188
|
+
* @param aci - Type of data to sign
|
|
189
|
+
* @param options - Options
|
|
190
|
+
*/
|
|
191
|
+
async signTypedData(data, aci, {
|
|
192
|
+
onAccount,
|
|
193
|
+
...options
|
|
194
|
+
} = {}) {
|
|
168
195
|
return this._resolveAccount(onAccount).signTypedData(data, aci, options);
|
|
169
196
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
200
|
+
* @param contractAddress - Contract address
|
|
201
|
+
* @param options - Options
|
|
202
|
+
*/
|
|
203
|
+
async signDelegationToContract(contractAddress, {
|
|
204
|
+
onAccount,
|
|
205
|
+
...options
|
|
206
|
+
} = {}) {
|
|
207
|
+
var _options$networkId, _options$consensusPro;
|
|
176
208
|
(_options$networkId = options.networkId) !== null && _options$networkId !== void 0 ? _options$networkId : options.networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
209
|
+
(_options$consensusPro = options.consensusProtocolVersion) !== null && _options$consensusPro !== void 0 ? _options$consensusPro : options.consensusProtocolVersion = this.selectedNodeName !== null ? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
177
210
|
return this._resolveAccount(onAccount).signDelegationToContract(contractAddress, options);
|
|
178
211
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
215
|
+
* @param contractAddress - Contract address
|
|
216
|
+
* @param name - AENS name
|
|
217
|
+
* @param options - Options
|
|
218
|
+
*/
|
|
219
|
+
async signNameDelegationToContract(contractAddress, name, {
|
|
220
|
+
onAccount,
|
|
221
|
+
...options
|
|
222
|
+
} = {}) {
|
|
223
|
+
var _options$networkId2, _options$consensusPro2;
|
|
185
224
|
(_options$networkId2 = options.networkId) !== null && _options$networkId2 !== void 0 ? _options$networkId2 : options.networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
225
|
+
(_options$consensusPro2 = options.consensusProtocolVersion) !== null && _options$consensusPro2 !== void 0 ? _options$consensusPro2 : options.consensusProtocolVersion = this.selectedNodeName !== null ? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
186
226
|
return this._resolveAccount(onAccount).signNameDelegationToContract(contractAddress, name, options);
|
|
187
227
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
231
|
+
* @param contractAddress - Contract address
|
|
232
|
+
* @param options - Options
|
|
233
|
+
*/
|
|
234
|
+
async signAllNamesDelegationToContract(contractAddress, {
|
|
235
|
+
onAccount,
|
|
236
|
+
...options
|
|
237
|
+
} = {}) {
|
|
238
|
+
var _options$networkId3, _options$consensusPro3;
|
|
194
239
|
(_options$networkId3 = options.networkId) !== null && _options$networkId3 !== void 0 ? _options$networkId3 : options.networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
240
|
+
(_options$consensusPro3 = options.consensusProtocolVersion) !== null && _options$consensusPro3 !== void 0 ? _options$consensusPro3 : options.consensusProtocolVersion = this.selectedNodeName !== null ? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
241
|
+
return this._resolveAccount(onAccount).signAllNamesDelegationToContract(contractAddress, options);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
246
|
+
* @param contractAddress - Contract address
|
|
247
|
+
* @param oracleQueryId - Oracle query id
|
|
248
|
+
* @param options - Options
|
|
249
|
+
*/
|
|
250
|
+
async signOracleQueryDelegationToContract(contractAddress, oracleQueryId, {
|
|
251
|
+
onAccount,
|
|
252
|
+
...options
|
|
253
|
+
} = {}) {
|
|
254
|
+
var _options$networkId4, _options$consensusPro4;
|
|
255
|
+
(_options$networkId4 = options.networkId) !== null && _options$networkId4 !== void 0 ? _options$networkId4 : options.networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
256
|
+
(_options$consensusPro4 = options.consensusProtocolVersion) !== null && _options$consensusPro4 !== void 0 ? _options$consensusPro4 : options.consensusProtocolVersion = this.selectedNodeName !== null ? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
195
257
|
return this._resolveAccount(onAccount).signOracleQueryDelegationToContract(contractAddress, oracleQueryId, options);
|
|
196
258
|
}
|
|
197
|
-
|
|
198
|
-
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Sign delegation, works only in Ceres
|
|
262
|
+
* @param delegation - Delegation to sign
|
|
263
|
+
* @param options - Options
|
|
264
|
+
*/
|
|
265
|
+
async signDelegation(delegation, {
|
|
266
|
+
onAccount,
|
|
267
|
+
...options
|
|
268
|
+
} = {}) {
|
|
269
|
+
var _options$networkId5;
|
|
270
|
+
(_options$networkId5 = options.networkId) !== null && _options$networkId5 !== void 0 ? _options$networkId5 : options.networkId = this.selectedNodeName !== null ? await this.api.getNetworkId() : undefined;
|
|
271
|
+
return this._resolveAccount(onAccount).signDelegation(delegation, options);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* The same as AeSdkMethods:getContext, but it would resolve ak_-prefixed address in
|
|
276
|
+
* `mergeWith.onAccount` to AccountBase.
|
|
277
|
+
*/
|
|
278
|
+
getContext(mergeWith = {}) {
|
|
199
279
|
return {
|
|
200
280
|
...this._options,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
...
|
|
204
|
-
|
|
281
|
+
..._classPrivateFieldGet(this, _wrappedOptions),
|
|
282
|
+
...mergeWith,
|
|
283
|
+
...(mergeWith.onAccount != null && {
|
|
284
|
+
onAccount: this._resolveAccount(mergeWith.onAccount)
|
|
285
|
+
})
|
|
205
286
|
};
|
|
206
287
|
}
|
|
207
288
|
}
|