@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/account/Memory.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import AccountBase from './Base';
|
|
2
2
|
import {
|
|
3
|
-
generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash,
|
|
3
|
+
generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash, messagePrefixLength,
|
|
4
4
|
} from '../utils/crypto';
|
|
5
|
-
import { ArgumentError } from '../utils/errors';
|
|
5
|
+
import { ArgumentError, UnexpectedTsError } from '../utils/errors';
|
|
6
6
|
import {
|
|
7
7
|
decode, encode, Encoded, Encoding,
|
|
8
8
|
} from '../utils/encoder';
|
|
9
9
|
import { concatBuffers } from '../utils/other';
|
|
10
10
|
import { hashTypedData, AciValue } from '../utils/typed-data';
|
|
11
11
|
import { buildTx } from '../tx/builder';
|
|
12
|
-
import { Tag, AensName } from '../tx/builder/constants';
|
|
12
|
+
import { Tag, AensName, ConsensusProtocolVersion } from '../tx/builder/constants';
|
|
13
13
|
import { produceNameId } from '../tx/builder/helpers';
|
|
14
|
+
import { DelegationTag } from '../tx/builder/delegation/schema';
|
|
15
|
+
import { packDelegation } from '../tx/builder/delegation';
|
|
14
16
|
|
|
15
|
-
const secretKeys = new WeakMap();
|
|
17
|
+
const secretKeys = new WeakMap<AccountMemory, Uint8Array>();
|
|
16
18
|
|
|
17
19
|
export function getBufferToSign(
|
|
18
20
|
transaction: Encoded.Transaction,
|
|
@@ -42,7 +44,7 @@ export default class AccountMemory extends AccountBase {
|
|
|
42
44
|
}
|
|
43
45
|
secretKeys.set(this, secretKey);
|
|
44
46
|
this.address = encode(
|
|
45
|
-
generateKeyPairFromSecret(
|
|
47
|
+
generateKeyPairFromSecret(secretKey).publicKey,
|
|
46
48
|
Encoding.AccountAddress,
|
|
47
49
|
);
|
|
48
50
|
}
|
|
@@ -56,7 +58,9 @@ export default class AccountMemory extends AccountBase {
|
|
|
56
58
|
|
|
57
59
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
60
|
override async sign(data: string | Uint8Array, options?: any): Promise<Uint8Array> {
|
|
59
|
-
|
|
61
|
+
const secretKey = secretKeys.get(this);
|
|
62
|
+
if (secretKey == null) throw new UnexpectedTsError();
|
|
63
|
+
return sign(data, secretKey);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
override async signTransaction(
|
|
@@ -93,8 +97,24 @@ export default class AccountMemory extends AccountBase {
|
|
|
93
97
|
|
|
94
98
|
override async signDelegationToContract(
|
|
95
99
|
contractAddress: Encoded.ContractAddress,
|
|
96
|
-
{ networkId
|
|
100
|
+
{ networkId, consensusProtocolVersion, isOracle }: {
|
|
101
|
+
networkId?: string;
|
|
102
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
103
|
+
isOracle?: boolean;
|
|
104
|
+
} = {},
|
|
97
105
|
): Promise<Encoded.Signature> {
|
|
106
|
+
if (isOracle == null) {
|
|
107
|
+
const protocol = (consensusProtocolVersion != null) ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';
|
|
108
|
+
console.warn(`AccountMemory:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);
|
|
109
|
+
}
|
|
110
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
111
|
+
const delegation = packDelegation({
|
|
112
|
+
tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,
|
|
113
|
+
accountAddress: this.address,
|
|
114
|
+
contractAddress,
|
|
115
|
+
});
|
|
116
|
+
return this.signDelegation(delegation, { networkId });
|
|
117
|
+
}
|
|
98
118
|
if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
|
|
99
119
|
const payload = concatBuffers([
|
|
100
120
|
Buffer.from(networkId),
|
|
@@ -108,8 +128,17 @@ export default class AccountMemory extends AccountBase {
|
|
|
108
128
|
override async signNameDelegationToContract(
|
|
109
129
|
contractAddress: Encoded.ContractAddress,
|
|
110
130
|
name: AensName,
|
|
111
|
-
{ networkId }: {
|
|
131
|
+
{ networkId, consensusProtocolVersion }: {
|
|
132
|
+
networkId?: string;
|
|
133
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
134
|
+
} = {},
|
|
112
135
|
): Promise<Encoded.Signature> {
|
|
136
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
137
|
+
const delegation = packDelegation({
|
|
138
|
+
tag: DelegationTag.AensName, accountAddress: this.address, contractAddress, nameId: name,
|
|
139
|
+
});
|
|
140
|
+
return this.signDelegation(delegation, { networkId });
|
|
141
|
+
}
|
|
113
142
|
if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
|
|
114
143
|
const payload = concatBuffers([
|
|
115
144
|
Buffer.from(networkId),
|
|
@@ -121,11 +150,44 @@ export default class AccountMemory extends AccountBase {
|
|
|
121
150
|
return encode(signature, Encoding.Signature);
|
|
122
151
|
}
|
|
123
152
|
|
|
153
|
+
override async signAllNamesDelegationToContract(
|
|
154
|
+
contractAddress: Encoded.ContractAddress,
|
|
155
|
+
{ networkId, consensusProtocolVersion }: {
|
|
156
|
+
networkId?: string;
|
|
157
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
158
|
+
} = {},
|
|
159
|
+
): Promise<Encoded.Signature> {
|
|
160
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
161
|
+
const delegation = packDelegation({
|
|
162
|
+
tag: DelegationTag.AensWildcard, accountAddress: this.address, contractAddress,
|
|
163
|
+
});
|
|
164
|
+
return this.signDelegation(delegation, { networkId });
|
|
165
|
+
}
|
|
166
|
+
if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
|
|
167
|
+
const payload = concatBuffers([
|
|
168
|
+
Buffer.from(networkId),
|
|
169
|
+
decode(this.address),
|
|
170
|
+
Buffer.from('AENS'),
|
|
171
|
+
decode(contractAddress),
|
|
172
|
+
]);
|
|
173
|
+
const signature = await this.sign(payload);
|
|
174
|
+
return encode(signature, Encoding.Signature);
|
|
175
|
+
}
|
|
176
|
+
|
|
124
177
|
override async signOracleQueryDelegationToContract(
|
|
125
178
|
contractAddress: Encoded.ContractAddress,
|
|
126
179
|
oracleQueryId: Encoded.OracleQueryId,
|
|
127
|
-
{ networkId }: {
|
|
180
|
+
{ networkId, consensusProtocolVersion }: {
|
|
181
|
+
networkId?: string;
|
|
182
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
183
|
+
} = {},
|
|
128
184
|
): Promise<Encoded.Signature> {
|
|
185
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
186
|
+
const delegation = packDelegation({
|
|
187
|
+
tag: DelegationTag.OracleResponse, queryId: oracleQueryId, contractAddress,
|
|
188
|
+
});
|
|
189
|
+
return this.signDelegation(delegation, { networkId });
|
|
190
|
+
}
|
|
129
191
|
const oracleQueryIdDecoded = decode(oracleQueryId);
|
|
130
192
|
const addressDecoded = decode(this.address);
|
|
131
193
|
// TODO: remove after fixing https://github.com/aeternity/aesophia/issues/475
|
|
@@ -141,4 +203,16 @@ export default class AccountMemory extends AccountBase {
|
|
|
141
203
|
const signature = await this.sign(payload);
|
|
142
204
|
return encode(signature, Encoding.Signature);
|
|
143
205
|
}
|
|
206
|
+
|
|
207
|
+
override async signDelegation(
|
|
208
|
+
delegation: Encoded.Bytearray,
|
|
209
|
+
{ networkId }: { networkId?: string } = {},
|
|
210
|
+
): Promise<Encoded.Signature> {
|
|
211
|
+
if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
|
|
212
|
+
const payload = concatBuffers([
|
|
213
|
+
messagePrefixLength, new Uint8Array([1]), Buffer.from(networkId), decode(delegation),
|
|
214
|
+
]);
|
|
215
|
+
const signature = await this.sign(payload);
|
|
216
|
+
return encode(signature, Encoding.Signature);
|
|
217
|
+
}
|
|
144
218
|
}
|
package/src/account/Rpc.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import AccountBase from './Base';
|
|
2
2
|
import { METHODS } from '../aepp-wallet-communication/schema';
|
|
3
|
-
import { ArgumentError,
|
|
4
|
-
import {
|
|
3
|
+
import { ArgumentError, UnsupportedProtocolError } from '../utils/errors';
|
|
4
|
+
import {
|
|
5
|
+
Encoded, Encoding, decode, encode,
|
|
6
|
+
} from '../utils/encoder';
|
|
5
7
|
import RpcClient from '../aepp-wallet-communication/rpc/RpcClient';
|
|
6
8
|
import { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';
|
|
7
|
-
import { AensName } from '../tx/builder/constants';
|
|
9
|
+
import { AensName, ConsensusProtocolVersion } from '../tx/builder/constants';
|
|
10
|
+
import { packDelegation } from '../tx/builder/delegation';
|
|
11
|
+
import { DelegationTag } from '../tx/builder/delegation/schema';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Account provided by wallet
|
|
@@ -24,9 +28,11 @@ export default class AccountRpc extends AccountBase {
|
|
|
24
28
|
this.address = address;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
async sign(dataRaw: string | Uint8Array): Promise<Uint8Array> {
|
|
32
|
+
const data = encode(Buffer.from(dataRaw), Encoding.Bytearray);
|
|
33
|
+
const { signature } = await this._rpcClient
|
|
34
|
+
.request(METHODS.unsafeSign, { onAccount: this.address, data });
|
|
35
|
+
return decode(signature);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
override async signTransaction(
|
|
@@ -73,10 +79,27 @@ export default class AccountRpc extends AccountBase {
|
|
|
73
79
|
|
|
74
80
|
override async signDelegationToContract(
|
|
75
81
|
contractAddress: Encoded.ContractAddress,
|
|
82
|
+
{ consensusProtocolVersion, isOracle }: {
|
|
83
|
+
consensusProtocolVersion?: ConsensusProtocolVersion;
|
|
84
|
+
isOracle?: boolean;
|
|
85
|
+
} = {},
|
|
76
86
|
): Promise<Encoded.Signature> {
|
|
87
|
+
if (isOracle == null) {
|
|
88
|
+
const protocol = (consensusProtocolVersion != null) ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';
|
|
89
|
+
console.warn(`AccountRpc:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);
|
|
90
|
+
}
|
|
91
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
92
|
+
const delegation = packDelegation({
|
|
93
|
+
tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,
|
|
94
|
+
accountAddress: this.address,
|
|
95
|
+
contractAddress,
|
|
96
|
+
});
|
|
97
|
+
return this.signDelegation(delegation);
|
|
98
|
+
}
|
|
77
99
|
const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {
|
|
78
100
|
onAccount: this.address,
|
|
79
101
|
contractAddress,
|
|
102
|
+
isOracle,
|
|
80
103
|
});
|
|
81
104
|
return signature;
|
|
82
105
|
}
|
|
@@ -84,7 +107,14 @@ export default class AccountRpc extends AccountBase {
|
|
|
84
107
|
override async signNameDelegationToContract(
|
|
85
108
|
contractAddress: Encoded.ContractAddress,
|
|
86
109
|
name: AensName,
|
|
110
|
+
{ consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},
|
|
87
111
|
): Promise<Encoded.Signature> {
|
|
112
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
113
|
+
const delegation = packDelegation({
|
|
114
|
+
tag: DelegationTag.AensName, accountAddress: this.address, contractAddress, nameId: name,
|
|
115
|
+
});
|
|
116
|
+
return this.signDelegation(delegation);
|
|
117
|
+
}
|
|
88
118
|
const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {
|
|
89
119
|
onAccount: this.address,
|
|
90
120
|
contractAddress,
|
|
@@ -93,10 +123,35 @@ export default class AccountRpc extends AccountBase {
|
|
|
93
123
|
return signature;
|
|
94
124
|
}
|
|
95
125
|
|
|
126
|
+
override async signAllNamesDelegationToContract(
|
|
127
|
+
contractAddress: Encoded.ContractAddress,
|
|
128
|
+
{ consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},
|
|
129
|
+
): Promise<Encoded.Signature> {
|
|
130
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
131
|
+
const delegation = packDelegation({
|
|
132
|
+
tag: DelegationTag.AensWildcard, accountAddress: this.address, contractAddress,
|
|
133
|
+
});
|
|
134
|
+
return this.signDelegation(delegation);
|
|
135
|
+
}
|
|
136
|
+
const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {
|
|
137
|
+
onAccount: this.address,
|
|
138
|
+
contractAddress,
|
|
139
|
+
allNames: true,
|
|
140
|
+
});
|
|
141
|
+
return signature;
|
|
142
|
+
}
|
|
143
|
+
|
|
96
144
|
override async signOracleQueryDelegationToContract(
|
|
97
145
|
contractAddress: Encoded.ContractAddress,
|
|
98
146
|
oracleQueryId: Encoded.OracleQueryId,
|
|
147
|
+
{ consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},
|
|
99
148
|
): Promise<Encoded.Signature> {
|
|
149
|
+
if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
|
|
150
|
+
const delegation = packDelegation({
|
|
151
|
+
tag: DelegationTag.OracleResponse, queryId: oracleQueryId, contractAddress,
|
|
152
|
+
});
|
|
153
|
+
return this.signDelegation(delegation);
|
|
154
|
+
}
|
|
100
155
|
const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {
|
|
101
156
|
onAccount: this.address,
|
|
102
157
|
contractAddress,
|
|
@@ -104,4 +159,12 @@ export default class AccountRpc extends AccountBase {
|
|
|
104
159
|
});
|
|
105
160
|
return signature;
|
|
106
161
|
}
|
|
162
|
+
|
|
163
|
+
override async signDelegation(delegation: Encoded.Bytearray): Promise<Encoded.Signature> {
|
|
164
|
+
const { signature } = await this._rpcClient.request(
|
|
165
|
+
METHODS.signDelegation,
|
|
166
|
+
{ delegation, onAccount: this.address },
|
|
167
|
+
);
|
|
168
|
+
return signature;
|
|
169
|
+
}
|
|
107
170
|
}
|
package/src/aens.ts
CHANGED
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import BigNumber from 'bignumber.js';
|
|
10
|
-
import { genSalt } from './utils/crypto';
|
|
10
|
+
import { genSalt, isAddressValid } from './utils/crypto';
|
|
11
11
|
import { commitmentHash, isAuctionName } from './tx/builder/helpers';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
} from './
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { sendTransaction, SendTransactionOptions, getName } from './chain';
|
|
12
|
+
import { Tag, AensName, ConsensusProtocolVersion } from './tx/builder/constants';
|
|
13
|
+
import { Encoded, Encoding } from './utils/encoder';
|
|
14
|
+
import { UnsupportedProtocolError } from './utils/errors';
|
|
15
|
+
import { getName } from './chain';
|
|
16
|
+
import { sendTransaction, SendTransactionOptions } from './send-transaction';
|
|
18
17
|
import { buildTxAsync, BuildTxOptions } from './tx/builder';
|
|
19
18
|
import { TransformNodeType } from './Node';
|
|
20
19
|
import { NameEntry, NamePointer } from './apis/node';
|
|
@@ -22,7 +21,7 @@ import AccountBase from './account/Base';
|
|
|
22
21
|
import { AddressEncodings } from './tx/builder/field-types/address';
|
|
23
22
|
|
|
24
23
|
interface KeyPointers {
|
|
25
|
-
[key: string]: Encoded.Generic<AddressEncodings>;
|
|
24
|
+
[key: string]: Encoded.Generic<AddressEncodings | Encoding.Bytearray>;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
@@ -30,11 +29,6 @@ interface KeyPointers {
|
|
|
30
29
|
* @category AENS
|
|
31
30
|
* @param name - Name hash
|
|
32
31
|
* @param options - Options
|
|
33
|
-
* @param options.onAccount - Make operation on specific account from sdk (you pass
|
|
34
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
35
|
-
* @param options.fee - fee
|
|
36
|
-
* @param options.ttl - ttl
|
|
37
|
-
* @param options.nonce - nonce
|
|
38
32
|
* @returns Transaction result
|
|
39
33
|
* @example
|
|
40
34
|
* ```js
|
|
@@ -51,6 +45,7 @@ export async function aensRevoke(
|
|
|
51
45
|
options: AensRevokeOptions,
|
|
52
46
|
): ReturnType<typeof sendTransaction> {
|
|
53
47
|
const nameRevokeTx = await buildTxAsync({
|
|
48
|
+
_isInternalBuild: true,
|
|
54
49
|
...options,
|
|
55
50
|
tag: Tag.NameRevokeTx,
|
|
56
51
|
nameId: name,
|
|
@@ -69,17 +64,6 @@ interface AensRevokeOptions extends
|
|
|
69
64
|
* @param name - AENS name
|
|
70
65
|
* @param pointers - Map of pointer keys to corresponding addresses
|
|
71
66
|
* @param options - Options
|
|
72
|
-
* @param options.extendPointers - Get the pointers from the node and merge with provided
|
|
73
|
-
* ones. Pointers with the same type will be overwritten
|
|
74
|
-
* @param options.onAccount - Make operation on specific account from sdk (you
|
|
75
|
-
* pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
76
|
-
* @param options.fee - fee
|
|
77
|
-
* @param options.ttl - ttl
|
|
78
|
-
* @param options.nonce - nonce
|
|
79
|
-
* @param options.nameTtl - Name ttl represented in number of
|
|
80
|
-
* blocks (Max value is 50000 blocks)
|
|
81
|
-
* @param options.clientTtl=84600 a suggestion as to how long any
|
|
82
|
-
* clients should cache this information
|
|
83
67
|
* @throws Invalid pointer array error
|
|
84
68
|
* @example
|
|
85
69
|
* ```js
|
|
@@ -104,11 +88,19 @@ export async function aensUpdate(
|
|
|
104
88
|
...pointers,
|
|
105
89
|
};
|
|
106
90
|
|
|
91
|
+
const hasRawPointers = Object.values(allPointers)
|
|
92
|
+
.some((v) => isAddressValid(v, Encoding.Bytearray));
|
|
93
|
+
const isIris = (await options.onNode.getNodeInfo())
|
|
94
|
+
.consensusProtocolVersion === ConsensusProtocolVersion.Iris;
|
|
95
|
+
if (hasRawPointers && isIris) {
|
|
96
|
+
throw new UnsupportedProtocolError('Raw pointers are available only in Ceres, the current protocol is Iris');
|
|
97
|
+
}
|
|
98
|
+
|
|
107
99
|
const nameUpdateTx = await buildTxAsync({
|
|
108
|
-
|
|
109
|
-
nameTtl: NAME_TTL,
|
|
100
|
+
_isInternalBuild: true,
|
|
110
101
|
...options,
|
|
111
102
|
tag: Tag.NameUpdateTx,
|
|
103
|
+
version: hasRawPointers ? 2 : 1,
|
|
112
104
|
nameId: name,
|
|
113
105
|
accountId: options.onAccount.address,
|
|
114
106
|
pointers: Object.entries(allPointers)
|
|
@@ -121,8 +113,18 @@ export async function aensUpdate(
|
|
|
121
113
|
interface AensUpdateOptions extends
|
|
122
114
|
BuildTxOptions<Tag.NameUpdateTx, 'nameId' | 'accountId' | 'pointers' | 'clientTtl' | 'nameTtl' | 'onNode'>,
|
|
123
115
|
SendTransactionOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Get the pointers from the node and merge with provided ones. Pointers with the same key will be
|
|
118
|
+
* overwritten.
|
|
119
|
+
*/
|
|
124
120
|
extendPointers?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* a suggestion as to how long any clients should cache this information
|
|
123
|
+
*/
|
|
125
124
|
clientTtl?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Name ttl represented in number of blocks (Max value is 50000 blocks)
|
|
127
|
+
*/
|
|
126
128
|
nameTtl?: number;
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -132,11 +134,6 @@ interface AensUpdateOptions extends
|
|
|
132
134
|
* @param name - AENS name
|
|
133
135
|
* @param account - Recipient account publick key
|
|
134
136
|
* @param options - Options
|
|
135
|
-
* @param options.onAccount - Make operation on specific account from sdk (you pass
|
|
136
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
137
|
-
* @param options.fee - fee
|
|
138
|
-
* @param options.ttl - ttl
|
|
139
|
-
* @param options.nonce - nonce
|
|
140
137
|
* @returns Transaction result
|
|
141
138
|
* @example
|
|
142
139
|
* ```js
|
|
@@ -155,6 +152,7 @@ export async function aensTransfer(
|
|
|
155
152
|
options: AensTransferOptions,
|
|
156
153
|
): ReturnType<typeof sendTransaction> {
|
|
157
154
|
const nameTransferTx = await buildTxAsync({
|
|
155
|
+
_isInternalBuild: true,
|
|
158
156
|
...options,
|
|
159
157
|
tag: Tag.NameTransferTx,
|
|
160
158
|
nameId: name,
|
|
@@ -175,7 +173,6 @@ interface AensTransferOptions extends
|
|
|
175
173
|
* @category AENS
|
|
176
174
|
* @param name - AENS name
|
|
177
175
|
* @param opt - Options
|
|
178
|
-
* @returns
|
|
179
176
|
* @example
|
|
180
177
|
* ```js
|
|
181
178
|
* const nameObject = sdkInstance.aensQuery('test.chain')
|
|
@@ -215,7 +212,7 @@ export async function aensQuery(
|
|
|
215
212
|
}
|
|
216
213
|
) => ReturnType<typeof aensRevoke>;
|
|
217
214
|
extendTtl: (
|
|
218
|
-
nameTtl
|
|
215
|
+
nameTtl?: number,
|
|
219
216
|
options?: Omit<Parameters<typeof aensQuery>[1], 'onNode' | 'onCompiler' | 'onAccount'>
|
|
220
217
|
) => ReturnType<typeof aensUpdate> & ReturnType<typeof aensQuery>;
|
|
221
218
|
}
|
|
@@ -240,11 +237,7 @@ export async function aensQuery(
|
|
|
240
237
|
async revoke(options) {
|
|
241
238
|
return aensRevoke(name, { ...opt, ...options });
|
|
242
239
|
},
|
|
243
|
-
async extendTtl(nameTtl
|
|
244
|
-
if (nameTtl > NAME_TTL || nameTtl <= 0) {
|
|
245
|
-
throw new ArgumentError('nameTtl', `a number between 1 and ${NAME_TTL} blocks`, nameTtl);
|
|
246
|
-
}
|
|
247
|
-
|
|
240
|
+
async extendTtl(nameTtl, options = {}) {
|
|
248
241
|
return {
|
|
249
242
|
...await aensUpdate(name, {}, {
|
|
250
243
|
...opt, ...options, nameTtl, extendPointers: true,
|
|
@@ -260,15 +253,9 @@ export async function aensQuery(
|
|
|
260
253
|
* preclaim step
|
|
261
254
|
* @category AENS
|
|
262
255
|
* @param name - AENS name
|
|
263
|
-
* @param salt - Salt from pre-claim, or 0 if it's a bid
|
|
256
|
+
* @param salt - Salt from pre-claim, or 0 if it's a bid or claiming without preclaim (in Ceres)
|
|
264
257
|
* @param options - options
|
|
265
|
-
* @
|
|
266
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
267
|
-
* @param options.fee - fee
|
|
268
|
-
* @param options.ttl - ttl
|
|
269
|
-
* @param options.nonce - nonce
|
|
270
|
-
* @param options.nameFee - Name Fee (By default calculated by sdk)
|
|
271
|
-
* @returns the result of the claim
|
|
258
|
+
* @returns Transaction result
|
|
272
259
|
* @example
|
|
273
260
|
* ```js
|
|
274
261
|
* const name = 'test.chain'
|
|
@@ -283,6 +270,7 @@ export async function aensClaim(
|
|
|
283
270
|
options: AensClaimOptions,
|
|
284
271
|
): Promise<AensClaimReturnType> {
|
|
285
272
|
const claimTx = await buildTxAsync({
|
|
273
|
+
_isInternalBuild: true,
|
|
286
274
|
...options,
|
|
287
275
|
tag: Tag.NameClaimTx,
|
|
288
276
|
accountId: options.onAccount.address,
|
|
@@ -312,11 +300,6 @@ interface AensClaimReturnType extends
|
|
|
312
300
|
* @category AENS
|
|
313
301
|
* @param name - AENS name
|
|
314
302
|
* @param options - Options
|
|
315
|
-
* @param options.onAccount - Make operation on specific account from sdk (you pass
|
|
316
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
317
|
-
* @param options.fee - fee
|
|
318
|
-
* @param options.ttl - ttl
|
|
319
|
-
* @param options.nonce - nonce
|
|
320
303
|
* @example
|
|
321
304
|
* ```js
|
|
322
305
|
* const name = 'test.chain'
|
|
@@ -342,6 +325,7 @@ Awaited<ReturnType<typeof sendTransaction>> & {
|
|
|
342
325
|
const commitmentId = commitmentHash(name, salt);
|
|
343
326
|
|
|
344
327
|
const preclaimTx = await buildTxAsync({
|
|
328
|
+
_isInternalBuild: true,
|
|
345
329
|
...options,
|
|
346
330
|
tag: Tag.NamePreclaimTx,
|
|
347
331
|
accountId: options.onAccount.address,
|
|
@@ -370,11 +354,6 @@ interface AensPreclaimOptions extends
|
|
|
370
354
|
* @param name - Domain name
|
|
371
355
|
* @param nameFee - Name fee (bid fee)
|
|
372
356
|
* @param options - Options
|
|
373
|
-
* @param options.onAccount - Make operation on specific account from sdk (you pass
|
|
374
|
-
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
375
|
-
* @param options.fee - fee
|
|
376
|
-
* @param options.ttl - ttl
|
|
377
|
-
* @param options.nonce - nonce
|
|
378
357
|
* @returns Transaction result
|
|
379
358
|
* @example
|
|
380
359
|
* ```js
|
|
@@ -12,6 +12,9 @@ export default class BrowserRuntimeConnection extends BrowserConnection {
|
|
|
12
12
|
|
|
13
13
|
#listeners?: [(message: any, port: Runtime.Port) => void, () => void];
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @param options - Options
|
|
17
|
+
*/
|
|
15
18
|
constructor({ port, ...options }: { port: Runtime.Port; debug: boolean }) {
|
|
16
19
|
super(options);
|
|
17
20
|
this.port = port;
|
|
@@ -19,9 +19,9 @@ export default class BrowserWindowMessageConnection extends BrowserConnection {
|
|
|
19
19
|
|
|
20
20
|
#onDisconnect?: () => void;
|
|
21
21
|
|
|
22
|
-
#target?: ImplPostMessage;
|
|
22
|
+
readonly #target?: ImplPostMessage;
|
|
23
23
|
|
|
24
|
-
#self: ImplPostMessage;
|
|
24
|
+
readonly #self: ImplPostMessage;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @param options - Options
|
|
@@ -40,11 +40,13 @@ export default class RpcClient <
|
|
|
40
40
|
> {
|
|
41
41
|
connection: BrowserConnection;
|
|
42
42
|
|
|
43
|
-
#callbacks =
|
|
43
|
+
readonly #callbacks = (
|
|
44
|
+
new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>()
|
|
45
|
+
);
|
|
44
46
|
|
|
45
47
|
#messageId = 0;
|
|
46
48
|
|
|
47
|
-
#methods: WithOrigin<LocalApi>;
|
|
49
|
+
readonly #methods: WithOrigin<LocalApi>;
|
|
48
50
|
|
|
49
51
|
constructor(
|
|
50
52
|
connection: BrowserConnection,
|
|
@@ -9,7 +9,7 @@ export interface WalletInfo {
|
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
networkId: string;
|
|
12
|
-
origin: string;
|
|
12
|
+
origin: string; // TODO: origin needs to be provided by transport
|
|
13
13
|
type: WALLET_TYPE;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -46,6 +46,10 @@ export interface WalletApi {
|
|
|
46
46
|
|
|
47
47
|
[METHODS.address]: () => Promise<Encoded.AccountAddress[]>;
|
|
48
48
|
|
|
49
|
+
[METHODS.unsafeSign]: (
|
|
50
|
+
p: { data: Encoded.Bytearray; onAccount: Encoded.AccountAddress }
|
|
51
|
+
) => Promise<{ signature: Encoded.Signature }>;
|
|
52
|
+
|
|
49
53
|
[METHODS.sign]: ((
|
|
50
54
|
p: {
|
|
51
55
|
tx: Encoded.Transaction;
|
|
@@ -89,6 +93,15 @@ export interface WalletApi {
|
|
|
89
93
|
contractAddress: Encoded.ContractAddress;
|
|
90
94
|
name?: AensName;
|
|
91
95
|
oracleQueryId?: Encoded.OracleQueryId;
|
|
96
|
+
allNames?: boolean;
|
|
97
|
+
isOracle?: boolean;
|
|
98
|
+
onAccount: Encoded.AccountAddress;
|
|
99
|
+
},
|
|
100
|
+
) => Promise<{ signature: Encoded.Signature }>;
|
|
101
|
+
|
|
102
|
+
[METHODS.signDelegation]: (
|
|
103
|
+
p: {
|
|
104
|
+
delegation: Encoded.Bytearray;
|
|
92
105
|
onAccount: Encoded.AccountAddress;
|
|
93
106
|
},
|
|
94
107
|
) => Promise<{ signature: Encoded.Signature }>;
|
|
@@ -34,10 +34,12 @@ export const enum METHODS {
|
|
|
34
34
|
updateAddress = 'address.update',
|
|
35
35
|
address = 'address.get',
|
|
36
36
|
connect = 'connection.open',
|
|
37
|
+
unsafeSign = 'data.unsafeSign',
|
|
37
38
|
sign = 'transaction.sign',
|
|
38
39
|
signMessage = 'message.sign',
|
|
39
40
|
signTypedData = 'typedData.sign',
|
|
40
41
|
signDelegationToContract = 'delegationToContract.sign',
|
|
42
|
+
signDelegation = 'delegation.sign',
|
|
41
43
|
subscribeAddress = 'address.subscribe',
|
|
42
44
|
updateNetwork = 'networkId.update',
|
|
43
45
|
closeConnection = 'connection.close',
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import BrowserConnection from './connection/Browser';
|
|
2
2
|
import BrowserWindowMessageConnection from './connection/BrowserWindowMessage';
|
|
3
3
|
import { MESSAGE_DIRECTION, METHODS } from './schema';
|
|
4
|
+
import { WalletInfo } from './rpc/types';
|
|
4
5
|
import { UnsupportedPlatformError } from '../utils/errors';
|
|
5
6
|
|
|
6
7
|
interface Wallet {
|
|
7
|
-
info:
|
|
8
|
-
id: string;
|
|
9
|
-
type: string;
|
|
10
|
-
origin: string;
|
|
11
|
-
};
|
|
8
|
+
info: WalletInfo;
|
|
12
9
|
getConnection: () => BrowserWindowMessageConnection;
|
|
13
10
|
}
|
|
14
11
|
interface Wallets { [key: string]: Wallet }
|
|
@@ -28,7 +25,7 @@ export default (
|
|
|
28
25
|
const wallets: Wallets = {};
|
|
29
26
|
|
|
30
27
|
connection.connect((
|
|
31
|
-
{ method, params }: { method: string; params:
|
|
28
|
+
{ method, params }: { method: string; params: WalletInfo },
|
|
32
29
|
origin: string,
|
|
33
30
|
source: Window,
|
|
34
31
|
) => {
|
|
@@ -37,12 +34,15 @@ export default (
|
|
|
37
34
|
const wallet = {
|
|
38
35
|
info: params,
|
|
39
36
|
getConnection() {
|
|
40
|
-
const isExtension = params.type === 'extension';
|
|
41
37
|
return new BrowserWindowMessageConnection({
|
|
42
|
-
sendDirection: isExtension ? MESSAGE_DIRECTION.to_waellet : undefined,
|
|
43
|
-
receiveDirection: isExtension ? MESSAGE_DIRECTION.to_aepp : undefined,
|
|
44
38
|
target: source,
|
|
45
|
-
|
|
39
|
+
...params.type === 'extension' ? {
|
|
40
|
+
sendDirection: MESSAGE_DIRECTION.to_waellet,
|
|
41
|
+
receiveDirection: MESSAGE_DIRECTION.to_aepp,
|
|
42
|
+
...window.origin !== 'null' && { origin: window.origin },
|
|
43
|
+
} : {
|
|
44
|
+
origin: params.origin,
|
|
45
|
+
},
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
};
|