@aeternity/aepp-sdk 13.2.2 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/aesophia_cli +0 -0
- package/bin/aesophia_cli_8 +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +9171 -7086
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +3 -0
- package/es/AeSdk.mjs +12 -12
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +0 -1
- package/es/AeSdkAepp.mjs +12 -16
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +61 -6
- package/es/AeSdkBase.mjs +150 -69
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +19 -7
- package/es/AeSdkMethods.mjs +39 -38
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +86 -55
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.mjs +31 -27
- package/es/Middleware.mjs.map +1 -1
- package/es/MiddlewareSubscriber.mjs +5 -14
- package/es/MiddlewareSubscriber.mjs.map +1 -1
- package/es/Node.d.ts +10 -2
- package/es/Node.mjs +53 -54
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +39 -3
- package/es/account/Base.mjs +35 -1
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +2 -0
- package/es/account/Generalized.mjs +15 -6
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +2 -0
- package/es/account/Ledger.mjs +14 -5
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/LedgerFactory.mjs +4 -6
- package/es/account/LedgerFactory.mjs.map +1 -1
- package/es/account/Memory.d.ts +15 -4
- package/es/account/Memory.mjs +96 -31
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +16 -5
- package/es/account/Rpc.mjs +94 -21
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +17 -44
- package/es/aens.mjs +32 -71
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +2 -0
- package/es/aepp-wallet-communication/schema.mjs +2 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -0
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.mjs +13 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/middleware/middleware.d.ts +23 -5
- package/es/apis/middleware/middleware.mjs +114 -18
- package/es/apis/middleware/middleware.mjs.map +1 -1
- package/es/apis/middleware/models/index.d.ts +164 -15
- package/es/apis/middleware/models/index.mjs +53 -3
- package/es/apis/middleware/models/index.mjs.map +1 -1
- package/es/apis/middleware/models/mappers.d.ts +8 -1
- package/es/apis/middleware/models/mappers.mjs +376 -3
- package/es/apis/middleware/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/models/parameters.d.ts +6 -3
- package/es/apis/middleware/models/parameters.mjs +38 -11
- package/es/apis/middleware/models/parameters.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +66 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.d.ts +5 -1
- package/es/apis/node/models/mappers.mjs +229 -7
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.d.ts +2 -2
- package/es/apis/node/models/parameters.mjs +2 -2
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.d.ts +24 -3
- package/es/apis/node/node.mjs +135 -3
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +14 -44
- package/es/chain.mjs +125 -219
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +3 -47
- package/es/channel/Base.mjs +21 -54
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +16 -25
- package/es/channel/Contract.mjs +39 -63
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +0 -8
- package/es/channel/Spend.mjs +17 -29
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +1 -1
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +104 -5
- package/es/channel/internal.mjs +26 -34
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +9 -1
- package/es/contract/Contract.mjs +67 -73
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +14 -8
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +5 -9
- package/es/contract/compiler/Cli.mjs +45 -23
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Cli8.d.ts +13 -0
- package/es/contract/compiler/Cli8.mjs +22 -0
- package/es/contract/compiler/Cli8.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +3 -9
- package/es/contract/compiler/Http.mjs +28 -16
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +2 -5
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/contract/delegation-signature.d.ts +2 -1
- package/es/contract/delegation-signature.mjs +18 -14
- package/es/contract/delegation-signature.mjs.map +1 -1
- package/es/contract/ga.d.ts +1 -2
- package/es/contract/ga.mjs +23 -25
- package/es/contract/ga.mjs.map +1 -1
- package/es/deprecated.d.ts +38 -0
- package/es/deprecated.mjs +45 -0
- package/es/deprecated.mjs.map +1 -1
- package/es/index-browser.d.ts +10 -5
- package/es/index-browser.mjs +9 -5
- package/es/index-browser.mjs.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +6 -37
- package/es/oracle.mjs +32 -66
- package/es/oracle.mjs.map +1 -1
- package/es/send-transaction.d.ts +53 -0
- package/es/send-transaction.mjs +109 -0
- package/es/send-transaction.mjs.map +1 -0
- package/es/spend.d.ts +4 -3
- package/es/spend.mjs +6 -1
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/common.d.ts +29 -0
- package/es/tx/builder/common.mjs +42 -0
- package/es/tx/builder/common.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +4 -4
- package/es/tx/builder/constants.mjs +6 -15
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/delegation/index.d.ts +20 -0
- package/es/tx/builder/delegation/index.mjs +24 -0
- package/es/tx/builder/delegation/index.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.d.ts +130 -0
- package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/es/tx/builder/delegation/schema.generated.mjs +2 -0
- package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
- package/es/tx/builder/delegation/schema.mjs +54 -0
- package/es/tx/builder/delegation/schema.mjs.map +1 -0
- package/es/tx/builder/field-types/abi-version.mjs +8 -11
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
- package/es/tx/builder/field-types/address.mjs +1 -4
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/es/tx/builder/field-types/coin-amount.mjs +6 -6
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.mjs +3 -4
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
- package/es/tx/builder/field-types/entry.mjs +7 -13
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +19 -11
- package/es/tx/builder/field-types/fee.mjs +56 -38
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.mjs +13 -15
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +10 -2
- package/es/tx/builder/field-types/gas-price.mjs +52 -3
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +31 -29
- package/es/tx/builder/field-types/index.mjs +31 -29
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/map.mjs +20 -31
- package/es/tx/builder/field-types/map.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.mjs +14 -29
- package/es/tx/builder/field-types/mptree.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +1 -1
- package/es/tx/builder/field-types/name-fee.mjs +1 -1
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/nonce.d.ts +1 -0
- package/es/tx/builder/field-types/nonce.mjs +2 -0
- package/es/tx/builder/field-types/nonce.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +4 -7
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers2.d.ts +23 -0
- package/es/tx/builder/field-types/pointers2.mjs +65 -0
- package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
- package/es/tx/builder/field-types/query-fee.d.ts +19 -0
- package/es/tx/builder/field-types/query-fee.mjs +20 -0
- package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/ttl.d.ts +9 -1
- package/es/tx/builder/field-types/ttl.mjs +19 -8
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/field-types/with-default.d.ts +7 -0
- package/es/tx/builder/field-types/with-default.mjs +9 -0
- package/es/tx/builder/field-types/with-default.mjs.map +1 -0
- package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/es/tx/builder/field-types/with-formatting.mjs +9 -0
- package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
- package/es/tx/builder/field-types/wrapped.mjs +6 -8
- package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -2
- package/es/tx/builder/helpers.mjs +12 -21
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +17 -10
- package/es/tx/builder/index.mjs +39 -65
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +478 -257
- package/es/tx/builder/schema.generated.d.ts +39 -3
- package/es/tx/builder/schema.generated.mjs.map +1 -1
- package/es/tx/builder/schema.mjs +48 -36
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/execution-cost.d.ts +6 -5
- package/es/tx/execution-cost.mjs +16 -17
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/transaction-signer.mjs +1 -4
- package/es/tx/transaction-signer.mjs.map +1 -1
- package/es/tx/validator.mjs +61 -42
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.mjs +15 -22
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +2 -3
- package/es/utils/autorest.mjs +40 -24
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -2
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -4
- package/es/utils/crypto.mjs +17 -13
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +6 -0
- package/es/utils/errors.mjs +12 -6
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +2 -0
- package/es/utils/hd-wallet.mjs +6 -5
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -10
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/jwt.d.ts +53 -0
- package/es/utils/jwt.mjs +120 -0
- package/es/utils/jwt.mjs.map +1 -0
- package/es/utils/keystore.d.ts +6 -2
- package/es/utils/keystore.mjs +8 -16
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/typed-data.mjs +1 -0
- package/es/utils/typed-data.mjs.map +1 -1
- package/es/utils/wrap-proxy.d.ts +2 -0
- package/es/utils/wrap-proxy.mjs +15 -0
- package/es/utils/wrap-proxy.mjs.map +1 -0
- package/package.json +57 -51
- package/src/AeSdk.ts +3 -0
- package/src/AeSdkAepp.ts +0 -1
- package/src/AeSdkBase.ts +97 -10
- package/src/AeSdkMethods.ts +37 -33
- package/src/AeSdkWallet.ts +22 -3
- package/src/Middleware.ts +16 -8
- package/src/MiddlewareSubscriber.ts +1 -1
- package/src/Node.ts +37 -18
- package/src/account/Base.ts +62 -3
- package/src/account/Generalized.ts +10 -0
- package/src/account/Ledger.ts +10 -0
- package/src/account/Memory.ts +83 -9
- package/src/account/Rpc.ts +69 -6
- package/src/aens.ts +35 -56
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
- package/src/aepp-wallet-communication/rpc/types.ts +13 -0
- package/src/aepp-wallet-communication/schema.ts +2 -0
- package/src/apis/compiler/compiler.ts +93 -93
- package/src/apis/compiler/models/index.ts +1 -0
- package/src/apis/compiler/models/mappers.ts +178 -165
- package/src/apis/compiler/models/parameters.ts +18 -18
- package/src/apis/middleware/middleware.ts +462 -341
- package/src/apis/middleware/models/index.ts +258 -56
- package/src/apis/middleware/models/mappers.ts +2357 -1919
- package/src/apis/middleware/models/parameters.ts +172 -142
- package/src/apis/node/models/index.ts +79 -2
- package/src/apis/node/models/mappers.ts +1529 -1302
- package/src/apis/node/models/parameters.ts +51 -51
- package/src/apis/node/node.ts +420 -275
- package/src/chain.ts +42 -128
- package/src/channel/Base.ts +14 -47
- package/src/channel/Contract.ts +18 -26
- package/src/channel/Spend.ts +0 -8
- package/src/channel/internal.ts +115 -13
- package/src/contract/Contract.ts +26 -8
- package/src/contract/compiler/Base.ts +15 -8
- package/src/contract/compiler/Cli.ts +37 -21
- package/src/contract/compiler/Cli8.ts +17 -0
- package/src/contract/compiler/Http.ts +24 -14
- package/src/contract/compiler/HttpNode.ts +2 -2
- package/src/contract/delegation-signature.ts +11 -5
- package/src/contract/ga.ts +4 -3
- package/src/deprecated.ts +36 -0
- package/src/index-browser.ts +14 -7
- package/src/index.ts +1 -0
- package/src/oracle.ts +11 -54
- package/src/send-transaction.ts +136 -0
- package/src/spend.ts +25 -11
- package/src/tx/builder/common.ts +74 -0
- package/src/tx/builder/constants.ts +6 -9
- package/src/tx/builder/delegation/index.ts +28 -0
- package/src/tx/builder/delegation/schema.generated.ts +143 -0
- package/src/tx/builder/delegation/schema.ts +61 -0
- package/src/tx/builder/field-types/coin-amount.ts +3 -2
- package/src/tx/builder/field-types/entry.ts +1 -4
- package/src/tx/builder/field-types/fee.ts +71 -43
- package/src/tx/builder/field-types/gas-limit.ts +4 -4
- package/src/tx/builder/field-types/gas-price.ts +58 -2
- package/src/tx/builder/field-types/index.ts +31 -59
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- package/src/tx/builder/field-types/nonce.ts +7 -1
- package/src/tx/builder/field-types/pointers2.ts +62 -0
- package/src/tx/builder/field-types/query-fee.ts +25 -0
- package/src/tx/builder/field-types/ttl.ts +13 -3
- package/src/tx/builder/field-types/with-default.ts +18 -0
- package/src/tx/builder/field-types/with-formatting.ts +18 -0
- package/src/tx/builder/helpers.ts +2 -2
- package/src/tx/builder/index.ts +42 -59
- package/src/tx/builder/schema.generated.ts +39 -3
- package/src/tx/builder/schema.ts +55 -29
- package/src/tx/execution-cost.ts +6 -5
- package/src/tx/validator.ts +31 -5
- package/src/utils/autorest.ts +36 -27
- package/src/utils/crypto.ts +23 -13
- package/src/utils/errors.ts +10 -0
- package/src/utils/hd-wallet.ts +2 -0
- package/src/utils/jwt.ts +126 -0
- package/src/utils/keystore.ts +6 -2
- package/src/utils/wrap-proxy.ts +24 -0
- package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.2/Node.d.ts +14 -1
- package/types-legacy/ts4.2/account/Base.d.ts +39 -3
- package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.2/aens.d.ts +17 -44
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.2/chain.d.ts +14 -44
- package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.2/deprecated.d.ts +38 -0
- package/types-legacy/ts4.2/index-browser.d.ts +10 -5
- package/types-legacy/ts4.2/index.d.ts +1 -0
- package/types-legacy/ts4.2/oracle.d.ts +6 -37
- package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.2/spend.d.ts +4 -3
- package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
- package/types-legacy/ts4.5/Node.d.ts +14 -1
- package/types-legacy/ts4.5/account/Base.d.ts +39 -3
- package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
- package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
- package/types-legacy/ts4.5/aens.d.ts +17 -44
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
- package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
- package/types-legacy/ts4.5/chain.d.ts +14 -44
- package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
- package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
- package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
- package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
- package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
- package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
- package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
- package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
- package/types-legacy/ts4.5/deprecated.d.ts +38 -0
- package/types-legacy/ts4.5/index-browser.d.ts +10 -5
- package/types-legacy/ts4.5/index.d.ts +1 -0
- package/types-legacy/ts4.5/oracle.d.ts +6 -37
- package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
- package/types-legacy/ts4.5/spend.d.ts +4 -3
- package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
- package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
- package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
- package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
- package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
- package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
- package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
- package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
- package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
- package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
- package/es/tx/builder/field-types/deposit.d.ts +0 -15
- package/es/tx/builder/field-types/deposit.mjs +0 -18
- package/es/tx/builder/field-types/deposit.mjs.map +0 -1
- package/src/tx/builder/field-types/deposit.ts +0 -23
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keystore.mjs","names":["nacl","v4","uuid","_aeternityArgon","hash","argon2id","getAddressFromPriv","InvalidPasswordError","DERIVED_KEY_FUNCTIONS","pass","salt","params","memlimit_kib","memoryCost","opslimit","timeCost","hashLength","type","CRYPTO_FUNCTIONS","encrypt","secretbox","decrypt","
|
|
1
|
+
{"version":3,"file":"keystore.mjs","names":["nacl","v4","uuid","_aeternityArgon","hash","argon2id","getAddressFromPriv","InvalidPasswordError","DERIVED_KEY_FUNCTIONS","pass","salt","params","memlimit_kib","memoryCost","opslimit","timeCost","hashLength","type","CRYPTO_FUNCTIONS","encrypt","secretbox","decrypt","args","res","open","CRYPTO_DEFAULTS","secret_type","symmetric_alg","kdf","kdf_params","parallelism","plaintext","key","nonce","algo","ciphertext","deriveKey","password","kdfParams","recover","crypto","_Buffer","from","cipher_params","toString","dump","name","privateKey","randomBytes","options","opt","derivedKey","payload","version","public_key","id"],"sources":["../../src/utils/keystore.ts"],"sourcesContent":["import nacl from 'tweetnacl';\nimport { v4 as uuid } from '@aeternity/uuid';\nimport { hash, argon2id } from '@aeternity/argon2';\nimport { getAddressFromPriv } from './crypto';\nimport { InvalidPasswordError } from './errors';\n\nconst DERIVED_KEY_FUNCTIONS = {\n async argon2id(\n pass: string | Uint8Array,\n salt: string | Uint8Array,\n params: Partial<Keystore['crypto']['kdf_params']>,\n ): Promise<Uint8Array> {\n const { memlimit_kib: memoryCost, opslimit: timeCost } = params;\n\n return hash(pass, {\n hashLength: 32,\n salt,\n timeCost,\n memoryCost,\n type: argon2id,\n });\n },\n};\n\nconst CRYPTO_FUNCTIONS = {\n 'xsalsa20-poly1305': {\n encrypt: nacl.secretbox,\n decrypt(...args: Parameters<typeof nacl.secretbox.open>): Uint8Array {\n const res = nacl.secretbox.open(...args);\n if (res == null) throw new InvalidPasswordError();\n return res;\n },\n },\n};\n\nexport interface Keystore {\n name: string;\n version: 1;\n public_key: string;\n id: string;\n crypto: {\n secret_type: 'ed25519';\n symmetric_alg: keyof typeof CRYPTO_FUNCTIONS;\n ciphertext: string;\n cipher_params: {\n nonce: string;\n };\n /**\n * Key derivation function name.\n */\n kdf: keyof typeof DERIVED_KEY_FUNCTIONS;\n /**\n * Key derivation function parameters.\n */\n kdf_params: {\n memlimit_kib: number;\n opslimit: number;\n parallelism: number;\n salt: string;\n };\n };\n}\n\nconst CRYPTO_DEFAULTS = {\n secret_type: 'ed25519',\n symmetric_alg: 'xsalsa20-poly1305',\n kdf: 'argon2id',\n kdf_params: {\n memlimit_kib: 65536,\n opslimit: 3,\n parallelism: 1,\n },\n} as const;\n\n/**\n * Symmetric private key encryption using secret (derived) key.\n * @category keystore\n * @param plaintext - Data to be encrypted.\n * @param key - Secret key.\n * @param nonce - Randomly generated nonce.\n * @param algo - Encryption algorithm.\n * @returns Encrypted data.\n */\nfunction encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n nonce: Uint8Array,\n algo: keyof typeof CRYPTO_FUNCTIONS = CRYPTO_DEFAULTS.symmetric_alg,\n): Uint8Array {\n return CRYPTO_FUNCTIONS[algo].encrypt(plaintext, nonce, key);\n}\n\n/**\n * Symmetric private key decryption using secret (derived) key.\n * @category keystore\n * @param ciphertext - Data to be decrypted.\n * @param key - Secret key.\n * @param nonce - Nonce from key-object.\n * @param algo - Encryption algorithm.\n * @returns Decrypted data.\n */\nfunction decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n nonce: Uint8Array,\n algo: keyof typeof CRYPTO_FUNCTIONS = CRYPTO_DEFAULTS.symmetric_alg,\n): Uint8Array {\n return CRYPTO_FUNCTIONS[algo].decrypt(ciphertext, nonce, key);\n}\n\n/**\n * Derive secret key from password with key derivation function.\n * @category keystore\n * @param password - User-supplied password.\n * @param nonce - Randomly generated nonce.\n * @param kdf - Key derivation function.\n * @param kdfParams - KDF parameters.\n * @returns Secret key derived from password.\n */\nasync function deriveKey(\n password: string | Uint8Array,\n nonce: string | Uint8Array,\n kdf: Keystore['crypto']['kdf'],\n kdfParams: Omit<Keystore['crypto']['kdf_params'], 'salt'>,\n): Promise<Uint8Array> {\n return DERIVED_KEY_FUNCTIONS[kdf](password, nonce, kdfParams);\n}\n\n/**\n * Recover plaintext private key from secret-storage key object.\n * @category keystore\n * @param password - Keystore object password.\n * @param keystore - Keystore object.\n * @returns Plaintext private key.\n */\nexport async function recover(\n password: string | Uint8Array,\n { crypto }: Keystore,\n): Promise<string> {\n const salt = Buffer.from(crypto.kdf_params.salt, 'hex');\n return Buffer.from(decrypt(\n Buffer.from(crypto.ciphertext, 'hex'),\n await deriveKey(password, salt, crypto.kdf, crypto.kdf_params),\n Buffer.from(crypto.cipher_params.nonce, 'hex'),\n crypto.symmetric_alg,\n )).toString('hex');\n}\n\n/**\n * Export private key to keystore secret-storage format.\n * @category keystore\n * @param name - Key name.\n * @param password - User-supplied password.\n * @param privateKey - Private key as hex-string or a Buffer.\n * @param nonce - Randomly generated 24byte nonce.\n * @param salt - Randomly generated 16byte salt.\n * @param options - Encryption parameters.\n */\nexport async function dump(\n name: string,\n password: string | Uint8Array,\n privateKey: string | Uint8Array,\n nonce: Uint8Array = nacl.randomBytes(24),\n salt: Uint8Array = nacl.randomBytes(16),\n options?: Partial<Keystore['crypto']>,\n): Promise<Keystore> {\n const opt = { ...CRYPTO_DEFAULTS, ...options };\n const derivedKey = await deriveKey(password, salt, opt.kdf, opt.kdf_params);\n const payload = typeof privateKey === 'string' ? Buffer.from(privateKey, 'hex') : privateKey;\n return {\n name,\n version: 1,\n public_key: getAddressFromPriv(payload),\n id: uuid(),\n crypto: {\n secret_type: opt.secret_type,\n symmetric_alg: opt.symmetric_alg,\n ciphertext: Buffer.from(\n encrypt(payload, derivedKey, nonce, opt.symmetric_alg),\n ).toString('hex'),\n cipher_params: { nonce: Buffer.from(nonce).toString('hex') },\n kdf: opt.kdf,\n kdf_params: {\n ...opt.kdf_params,\n salt: Buffer.from(salt).toString('hex'),\n },\n },\n };\n}\n"],"mappings":"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"}
|
package/es/utils/typed-data.mjs
CHANGED
|
@@ -17,6 +17,7 @@ export function hashJson(data) {
|
|
|
17
17
|
|
|
18
18
|
// TODO: move this type to calldata library https://github.com/aeternity/aepp-calldata-js/issues/215
|
|
19
19
|
// based on https://github.com/aeternity/aepp-calldata-js/blob/82b5a98f9b308482627da8d7484d213e9cf87151/src/AciTypeResolver.js#L129
|
|
20
|
+
|
|
20
21
|
/**
|
|
21
22
|
* Hashes domain object, can be used to inline domain hash to contract source code
|
|
22
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-data.mjs","names":["_aeternityAeppCalldata","TypeResolver","ContractByteArrayEncoder","canonicalize","decode","hash","messagePrefixLength","concatBuffers","hashJson","data","_canonicalize","hashDomain","domain","domainAci","record","name","type","option","domainType","resolveType","fateValue","encodeWithType","hashTypedData","aci","Uint8Array"],"sources":["../../src/utils/typed-data.ts"],"sourcesContent":["import { TypeResolver, ContractByteArrayEncoder } from '@aeternity/aepp-calldata';\nimport canonicalize from 'canonicalize';\nimport { Encoded, decode } from './encoder';\nimport { hash, messagePrefixLength } from './crypto';\nimport { concatBuffers } from './other';\n\n/**\n * Hashes arbitrary object, can be used to inline the aci hash to contract source code\n */\nexport function hashJson(data: unknown): Buffer {\n return hash(canonicalize(data) ?? '');\n}\n\n// TODO: move this type to calldata library https://github.com/aeternity/aepp-calldata-js/issues/215\n// based on https://github.com/aeternity/aepp-calldata-js/blob/82b5a98f9b308482627da8d7484d213e9cf87151/src/AciTypeResolver.js#L129\nexport type AciValue = 'void' | 'unit' | 'int' | 'bool' | 'string' | 'bits' | 'hash' | 'signature'\n| 'address' | 'contract_pubkey' | 'Chain.ttl' | 'Chain.ga_meta_tx' | 'Chain.paying_for_tx'\n| 'Chain.base_tx' | 'AENS.pointee' | 'AENS.name' | 'MCL_BLS12_381.fr' | 'MCL_BLS12_381.fp'\n| { 'Set.set': readonly [AciValue] }\n| { bytes: number }\n| { list: readonly [AciValue] }\n| { map: readonly [AciValue, AciValue] }\n| { tuple: readonly AciValue[] }\n| { record: ReadonlyArray<{ name: string; type: AciValue }> }\n| { variant: ReadonlyArray<{ [key: string]: readonly AciValue[] }> }\n| { option: readonly [AciValue] }\n| { oracle: readonly [AciValue, AciValue] }\n| { oracle_query: readonly [AciValue, AciValue] };\n\nexport interface Domain {\n name?: string;\n version?: number;\n networkId?: string;\n contractAddress?: Encoded.ContractAddress;\n}\n\n/**\n * Hashes domain object, can be used to inline domain hash to contract source code\n */\nexport function hashDomain(domain: Domain): Buffer {\n const domainAci = {\n record: [{\n name: 'name',\n type: { option: ['string'] },\n }, {\n name: 'version',\n type: { option: ['int'] },\n }, {\n name: 'networkId',\n type: { option: ['string'] },\n }, {\n name: 'contractAddress',\n type: { option: ['contract_pubkey'] },\n }],\n } as const;\n const domainType = new TypeResolver().resolveType(domainAci, {});\n const fateValue = new ContractByteArrayEncoder().encodeWithType(domain, domainType);\n return hash(decode(fateValue));\n}\n\nexport function hashTypedData(\n data: Encoded.ContractBytearray,\n aci: AciValue,\n domain: Domain,\n): Buffer {\n return hash(concatBuffers([\n messagePrefixLength, new Uint8Array([0]), hashDomain(domain), hashJson(aci), hash(decode(data)),\n ]));\n}\n"],"mappings":"AAAA,OAAAA,sBAAA,MAAuD,0BAA0B;AAAC;EAAAC,YAAA;EAAAC;AAAA,IAAAF,sBAAA;AAClF,OAAOG,YAAY,MAAM,cAAc;AAAC,SACtBC,MAAM;AAAA,SACfC,IAAI,EAAEC,mBAAmB;AAAA,SACzBC,aAAa;AAEtB;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CAACC,IAAa,EAAU;EAAA,IAAAC,aAAA;EAC9C,OAAOL,IAAI,EAAAK,aAAA,GAACP,YAAY,CAACM,IAAI,CAAC,cAAAC,aAAA,cAAAA,aAAA,GAAI,EAAE,CAAC;AACvC;;AAEA;AACA
|
|
1
|
+
{"version":3,"file":"typed-data.mjs","names":["_aeternityAeppCalldata","TypeResolver","ContractByteArrayEncoder","canonicalize","decode","hash","messagePrefixLength","concatBuffers","hashJson","data","_canonicalize","hashDomain","domain","domainAci","record","name","type","option","domainType","resolveType","fateValue","encodeWithType","hashTypedData","aci","Uint8Array"],"sources":["../../src/utils/typed-data.ts"],"sourcesContent":["import { TypeResolver, ContractByteArrayEncoder } from '@aeternity/aepp-calldata';\nimport canonicalize from 'canonicalize';\nimport { Encoded, decode } from './encoder';\nimport { hash, messagePrefixLength } from './crypto';\nimport { concatBuffers } from './other';\n\n/**\n * Hashes arbitrary object, can be used to inline the aci hash to contract source code\n */\nexport function hashJson(data: unknown): Buffer {\n return hash(canonicalize(data) ?? '');\n}\n\n// TODO: move this type to calldata library https://github.com/aeternity/aepp-calldata-js/issues/215\n// based on https://github.com/aeternity/aepp-calldata-js/blob/82b5a98f9b308482627da8d7484d213e9cf87151/src/AciTypeResolver.js#L129\nexport type AciValue = 'void' | 'unit' | 'int' | 'bool' | 'string' | 'bits' | 'hash' | 'signature'\n| 'address' | 'contract_pubkey' | 'Chain.ttl' | 'Chain.ga_meta_tx' | 'Chain.paying_for_tx'\n| 'Chain.base_tx' | 'AENS.pointee' | 'AENS.name' | 'MCL_BLS12_381.fr' | 'MCL_BLS12_381.fp'\n| { 'Set.set': readonly [AciValue] }\n| { bytes: number }\n| { list: readonly [AciValue] }\n| { map: readonly [AciValue, AciValue] }\n| { tuple: readonly AciValue[] }\n| { record: ReadonlyArray<{ name: string; type: AciValue }> }\n| { variant: ReadonlyArray<{ [key: string]: readonly AciValue[] }> }\n| { option: readonly [AciValue] }\n| { oracle: readonly [AciValue, AciValue] }\n| { oracle_query: readonly [AciValue, AciValue] };\n\nexport interface Domain {\n name?: string;\n version?: number;\n networkId?: string;\n contractAddress?: Encoded.ContractAddress;\n}\n\n/**\n * Hashes domain object, can be used to inline domain hash to contract source code\n */\nexport function hashDomain(domain: Domain): Buffer {\n const domainAci = {\n record: [{\n name: 'name',\n type: { option: ['string'] },\n }, {\n name: 'version',\n type: { option: ['int'] },\n }, {\n name: 'networkId',\n type: { option: ['string'] },\n }, {\n name: 'contractAddress',\n type: { option: ['contract_pubkey'] },\n }],\n } as const;\n const domainType = new TypeResolver().resolveType(domainAci, {});\n const fateValue = new ContractByteArrayEncoder().encodeWithType(domain, domainType);\n return hash(decode(fateValue));\n}\n\nexport function hashTypedData(\n data: Encoded.ContractBytearray,\n aci: AciValue,\n domain: Domain,\n): Buffer {\n return hash(concatBuffers([\n messagePrefixLength, new Uint8Array([0]), hashDomain(domain), hashJson(aci), hash(decode(data)),\n ]));\n}\n"],"mappings":"AAAA,OAAAA,sBAAA,MAAuD,0BAA0B;AAAC;EAAAC,YAAA;EAAAC;AAAA,IAAAF,sBAAA;AAClF,OAAOG,YAAY,MAAM,cAAc;AAAC,SACtBC,MAAM;AAAA,SACfC,IAAI,EAAEC,mBAAmB;AAAA,SACzBC,aAAa;AAEtB;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CAACC,IAAa,EAAU;EAAA,IAAAC,aAAA;EAC9C,OAAOL,IAAI,EAAAK,aAAA,GAACP,YAAY,CAACM,IAAI,CAAC,cAAAC,aAAA,cAAAA,aAAA,GAAI,EAAE,CAAC;AACvC;;AAEA;AACA;;AAsBA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,MAAc,EAAU;EACjD,MAAMC,SAAS,GAAG;IAChBC,MAAM,EAAE,CAAC;MACPC,IAAI,EAAE,MAAM;MACZC,IAAI,EAAE;QAAEC,MAAM,EAAE,CAAC,QAAQ;MAAE;IAC7B,CAAC,EAAE;MACDF,IAAI,EAAE,SAAS;MACfC,IAAI,EAAE;QAAEC,MAAM,EAAE,CAAC,KAAK;MAAE;IAC1B,CAAC,EAAE;MACDF,IAAI,EAAE,WAAW;MACjBC,IAAI,EAAE;QAAEC,MAAM,EAAE,CAAC,QAAQ;MAAE;IAC7B,CAAC,EAAE;MACDF,IAAI,EAAE,iBAAiB;MACvBC,IAAI,EAAE;QAAEC,MAAM,EAAE,CAAC,iBAAiB;MAAE;IACtC,CAAC;EACH,CAAU;EACV,MAAMC,UAAU,GAAG,IAAIjB,YAAY,CAAC,CAAC,CAACkB,WAAW,CAACN,SAAS,EAAE,CAAC,CAAC,CAAC;EAChE,MAAMO,SAAS,GAAG,IAAIlB,wBAAwB,CAAC,CAAC,CAACmB,cAAc,CAACT,MAAM,EAAEM,UAAU,CAAC;EACnF,OAAOb,IAAI,CAACD,MAAM,CAACgB,SAAS,CAAC,CAAC;AAChC;AAEA,OAAO,SAASE,aAAaA,CAC3Bb,IAA+B,EAC/Bc,GAAa,EACbX,MAAc,EACN;EACR,OAAOP,IAAI,CAACE,aAAa,CAAC,CACxBD,mBAAmB,EAAE,IAAIkB,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEb,UAAU,CAACC,MAAM,CAAC,EAAEJ,QAAQ,CAACe,GAAG,CAAC,EAAElB,IAAI,CAACD,MAAM,CAACK,IAAI,CAAC,CAAC,CAChG,CAAC,CAAC;AACL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ArgumentError } from "./errors.mjs";
|
|
2
|
+
export function wrapWithProxy(valueCb) {
|
|
3
|
+
return new Proxy({}, Object.fromEntries(['apply', 'construct', 'defineProperty', 'deleteProperty', 'getOwnPropertyDescriptor', 'getPrototypeOf', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf', 'get', 'has'].map(name => [name, (t, ...args) => {
|
|
4
|
+
const target = valueCb();
|
|
5
|
+
if (target == null) throw new ArgumentError('wrapped value', 'defined', target);
|
|
6
|
+
if (name === 'get' && args[0] === '_wrappedValue') return target;
|
|
7
|
+
const res = Reflect[name](target, ...args);
|
|
8
|
+
return typeof res === 'function' && name === 'get' ? res.bind(target) : res;
|
|
9
|
+
}])));
|
|
10
|
+
}
|
|
11
|
+
export function unwrapProxy(value) {
|
|
12
|
+
var _wrappedValue;
|
|
13
|
+
return (_wrappedValue = value._wrappedValue) !== null && _wrappedValue !== void 0 ? _wrappedValue : value;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=wrap-proxy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-proxy.mjs","names":["ArgumentError","wrapWithProxy","valueCb","Proxy","Object","fromEntries","map","name","t","args","target","res","Reflect","bind","unwrapProxy","value","_wrappedValue"],"sources":["../../src/utils/wrap-proxy.ts"],"sourcesContent":["import { ArgumentError } from './errors';\n\nexport function wrapWithProxy<Value extends object | undefined>(\n valueCb: () => Value,\n): NonNullable<Value> {\n return new Proxy(\n {},\n Object.fromEntries(([\n 'apply', 'construct', 'defineProperty', 'deleteProperty', 'getOwnPropertyDescriptor',\n 'getPrototypeOf', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf',\n 'get', 'has',\n ] as const).map((name) => [name, (t: {}, ...args: unknown[]) => {\n const target = valueCb();\n if (target == null) throw new ArgumentError('wrapped value', 'defined', target);\n if (name === 'get' && args[0] === '_wrappedValue') return target;\n const res = (Reflect[name] as any)(target, ...args);\n return typeof res === 'function' && name === 'get' ? res.bind(target) : res;\n }])),\n ) as NonNullable<Value>;\n}\n\nexport function unwrapProxy<Value extends object>(value: Value): Value {\n return (value as { _wrappedValue?: Value })._wrappedValue ?? value;\n}\n"],"mappings":"SAASA,aAAa;AAEtB,OAAO,SAASC,aAAaA,CAC3BC,OAAoB,EACA;EACpB,OAAO,IAAIC,KAAK,CACd,CAAC,CAAC,EACFC,MAAM,CAACC,WAAW,CAAE,CAClB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,0BAA0B,EACpF,gBAAgB,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,KAAK,EAAE,gBAAgB,EACzF,KAAK,EAAE,KAAK,CACb,CAAWC,GAAG,CAAEC,IAAI,IAAK,CAACA,IAAI,EAAE,CAACC,CAAK,EAAE,GAAGC,IAAe,KAAK;IAC9D,MAAMC,MAAM,GAAGR,OAAO,CAAC,CAAC;IACxB,IAAIQ,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIV,aAAa,CAAC,eAAe,EAAE,SAAS,EAAEU,MAAM,CAAC;IAC/E,IAAIH,IAAI,KAAK,KAAK,IAAIE,IAAI,CAAC,CAAC,CAAC,KAAK,eAAe,EAAE,OAAOC,MAAM;IAChE,MAAMC,GAAG,GAAIC,OAAO,CAACL,IAAI,CAAC,CAASG,MAAM,EAAE,GAAGD,IAAI,CAAC;IACnD,OAAO,OAAOE,GAAG,KAAK,UAAU,IAAIJ,IAAI,KAAK,KAAK,GAAGI,GAAG,CAACE,IAAI,CAACH,MAAM,CAAC,GAAGC,GAAG;EAC7E,CAAC,CAAC,CAAC,CACL,CAAC;AACH;AAEA,OAAO,SAASG,WAAWA,CAAuBC,KAAY,EAAS;EAAA,IAAAC,aAAA;EACrE,QAAAA,aAAA,GAAQD,KAAK,CAA+BC,aAAa,cAAAA,aAAA,cAAAA,aAAA,GAAID,KAAK;AACpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeternity/aepp-sdk",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.0",
|
|
4
4
|
"description": "SDK for the æternity blockchain",
|
|
5
5
|
"main": "dist/aepp-sdk.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build:assets": "node tooling/fetch-aesophia-cli.mjs",
|
|
46
|
+
"build:assets": "node tooling/fetch-aesophia-cli.mjs && node tooling/fetch-aesophia-cli-8.mjs",
|
|
47
47
|
"build:types": "tsc && node tooling/downlevel/run.mjs",
|
|
48
48
|
"build:es": "babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
|
|
49
49
|
"build:api:node": "autorest tooling/autorest/node.yaml",
|
|
@@ -75,23 +75,23 @@
|
|
|
75
75
|
"SDK"
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@aeternity/aepp-calldata": "^1.
|
|
78
|
+
"@aeternity/aepp-calldata": "^1.7.0",
|
|
79
79
|
"@aeternity/argon2": "^0.0.1",
|
|
80
80
|
"@aeternity/uuid": "^0.0.1",
|
|
81
|
-
"@azure/core-client": "1.
|
|
82
|
-
"@azure/core-rest-pipeline": "^1.
|
|
83
|
-
"@babel/runtime-corejs3": "^7.
|
|
84
|
-
"@ledgerhq/hw-transport": "^6.
|
|
85
|
-
"@types/aes-js": "^3.1.
|
|
86
|
-
"@types/json-bigint": "^1.0.
|
|
87
|
-
"@types/node": "~18.
|
|
88
|
-
"@types/sha.js": "^2.4.
|
|
89
|
-
"@types/uuid": "^9.0.
|
|
90
|
-
"@types/webextension-polyfill": "^0.10.
|
|
91
|
-
"@types/websocket": "^1.0.
|
|
92
|
-
"@types/ws": "^8.5.
|
|
81
|
+
"@azure/core-client": "^1.8.0",
|
|
82
|
+
"@azure/core-rest-pipeline": "^1.14.0",
|
|
83
|
+
"@babel/runtime-corejs3": "^7.24.0",
|
|
84
|
+
"@ledgerhq/hw-transport": "^6.30.4",
|
|
85
|
+
"@types/aes-js": "^3.1.4",
|
|
86
|
+
"@types/json-bigint": "^1.0.4",
|
|
87
|
+
"@types/node": "~18.13",
|
|
88
|
+
"@types/sha.js": "^2.4.4",
|
|
89
|
+
"@types/uuid": "^9.0.8",
|
|
90
|
+
"@types/webextension-polyfill": "^0.10.7",
|
|
91
|
+
"@types/websocket": "^1.0.10",
|
|
92
|
+
"@types/ws": "^8.5.10",
|
|
93
93
|
"aes-js": "^3.1.2",
|
|
94
|
-
"bignumber.js": "^9.1.
|
|
94
|
+
"bignumber.js": "^9.1.2",
|
|
95
95
|
"bip32-path": "^0.4.2",
|
|
96
96
|
"blakejs": "^1.2.1",
|
|
97
97
|
"bs58": "^5.0.0",
|
|
@@ -107,58 +107,58 @@
|
|
|
107
107
|
"tweetnacl-auth": "^1.0.1",
|
|
108
108
|
"varuint-bitcoin": "^1.1.2",
|
|
109
109
|
"websocket": "^1.0.34",
|
|
110
|
-
"ws": "^8.
|
|
110
|
+
"ws": "^8.16.0"
|
|
111
111
|
},
|
|
112
112
|
"repository": {
|
|
113
113
|
"type": "git",
|
|
114
114
|
"url": "https://github.com/aeternity/aepp-sdk-js"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@babel/cli": "^7.
|
|
118
|
-
"@babel/core": "^7.
|
|
119
|
-
"@babel/node": "^7.
|
|
120
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
121
|
-
"@babel/preset-env": "^7.
|
|
122
|
-
"@babel/preset-typescript": "^7.
|
|
123
|
-
"@babel/register": "^7.
|
|
124
|
-
"@commitlint/cli": "^
|
|
125
|
-
"@commitlint/config-conventional": "^
|
|
126
|
-
"@ledgerhq/hw-transport-mocker": "^6.
|
|
127
|
-
"@ledgerhq/hw-transport-node-hid-singleton": "^6.
|
|
128
|
-
"@ledgerhq/hw-transport-webusb": "^6.
|
|
129
|
-
"@types/chai": "^4.3.
|
|
130
|
-
"@types/chai-as-promised": "^7.1.
|
|
131
|
-
"@types/mocha": "^10.0.
|
|
132
|
-
"@types/node-hid": "^1.3.
|
|
133
|
-
"@types/sinon": "^
|
|
134
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
135
|
-
"@typescript-eslint/parser": "^
|
|
136
|
-
"autorest": "^3.
|
|
117
|
+
"@babel/cli": "^7.23.9",
|
|
118
|
+
"@babel/core": "^7.24.0",
|
|
119
|
+
"@babel/node": "^7.23.9",
|
|
120
|
+
"@babel/plugin-transform-runtime": "^7.24.0",
|
|
121
|
+
"@babel/preset-env": "^7.24.0",
|
|
122
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
123
|
+
"@babel/register": "^7.23.7",
|
|
124
|
+
"@commitlint/cli": "^19.0.3",
|
|
125
|
+
"@commitlint/config-conventional": "^19.0.3",
|
|
126
|
+
"@ledgerhq/hw-transport-mocker": "^6.28.4",
|
|
127
|
+
"@ledgerhq/hw-transport-node-hid-singleton": "^6.30.4",
|
|
128
|
+
"@ledgerhq/hw-transport-webusb": "^6.28.4",
|
|
129
|
+
"@types/chai": "^4.3.12",
|
|
130
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
131
|
+
"@types/mocha": "^10.0.6",
|
|
132
|
+
"@types/node-hid": "^1.3.4",
|
|
133
|
+
"@types/sinon": "^17.0.3",
|
|
134
|
+
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
135
|
+
"@typescript-eslint/parser": "^7.1.1",
|
|
136
|
+
"autorest": "^3.7.1",
|
|
137
137
|
"babel-loader": "^9.1.3",
|
|
138
138
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
139
139
|
"babel-plugin-import-globals": "^2.0.0",
|
|
140
140
|
"babel-plugin-transform-default-named-imports": "^1.2.2",
|
|
141
|
-
"babel-plugin-transform-import-meta": "^2.2.
|
|
142
|
-
"chai": "^4.
|
|
141
|
+
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
142
|
+
"chai": "^4.4.1",
|
|
143
143
|
"chai-as-promised": "^7.1.1",
|
|
144
144
|
"downlevel-dts": "github:aeternity/downlevel-dts",
|
|
145
|
-
"eslint": "^8.
|
|
145
|
+
"eslint": "^8.57.0",
|
|
146
146
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
147
|
-
"eslint-config-airbnb-typescript": "^
|
|
147
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
148
148
|
"eslint-plugin-rulesdir": "^0.2.2",
|
|
149
149
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
150
|
-
"html-webpack-plugin": "^5.
|
|
151
|
-
"mocha": "^10.
|
|
150
|
+
"html-webpack-plugin": "^5.6.0",
|
|
151
|
+
"mocha": "^10.3.0",
|
|
152
152
|
"nyc": "^15.1.0",
|
|
153
|
-
"sinon": "^
|
|
153
|
+
"sinon": "^17.0.1",
|
|
154
154
|
"source-map": "^0.7.4",
|
|
155
155
|
"standard-version": "^9.5.0",
|
|
156
|
-
"ts-node": "^10.9.
|
|
157
|
-
"typedoc": "^0.
|
|
158
|
-
"typedoc-plugin-missing-exports": "^2.
|
|
159
|
-
"typescript": "^5.
|
|
160
|
-
"webpack": "^5.
|
|
161
|
-
"webpack-bundle-analyzer": "^4.
|
|
156
|
+
"ts-node": "^10.9.2",
|
|
157
|
+
"typedoc": "^0.25.11",
|
|
158
|
+
"typedoc-plugin-missing-exports": "^2.2.0",
|
|
159
|
+
"typescript": "^5.3.3",
|
|
160
|
+
"webpack": "^5.90.3",
|
|
161
|
+
"webpack-bundle-analyzer": "^4.10.1",
|
|
162
162
|
"webpack-cli": "^5.1.4"
|
|
163
163
|
},
|
|
164
164
|
"files": [
|
|
@@ -189,5 +189,11 @@
|
|
|
189
189
|
"engines": {
|
|
190
190
|
"node": ">=14.19.0"
|
|
191
191
|
},
|
|
192
|
-
"packageManager": "npm@8.19.3"
|
|
192
|
+
"packageManager": "npm@8.19.3",
|
|
193
|
+
"contributors": [
|
|
194
|
+
"Till Kolter <till.kolter@gmail.com>",
|
|
195
|
+
"Alexander Kahl <ak@sodosopa.io>",
|
|
196
|
+
"Nazar Duchak <omelko39@gmail.com>",
|
|
197
|
+
"Denis Davidyuk <denis_davidyuk@hotmail.com>"
|
|
198
|
+
]
|
|
193
199
|
}
|
package/src/AeSdk.ts
CHANGED
|
@@ -9,6 +9,9 @@ export default class AeSdk extends AeSdkBase {
|
|
|
9
9
|
|
|
10
10
|
selectedAddress?: Encoded.AccountAddress;
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @param options - Options
|
|
14
|
+
*/
|
|
12
15
|
constructor(
|
|
13
16
|
{ accounts, ...options }: { accounts?: AccountBase[] }
|
|
14
17
|
& ConstructorParameters<typeof AeSdkBase>[0] = {},
|
package/src/AeSdkAepp.ts
CHANGED
|
@@ -88,7 +88,6 @@ export default class AeSdkAepp extends AeSdkBase {
|
|
|
88
88
|
* @param options - Options
|
|
89
89
|
* @param options.connectNode - Request wallet to bind node
|
|
90
90
|
* @param options.name - Node name
|
|
91
|
-
* @param options.select - Select this node as current
|
|
92
91
|
*/
|
|
93
92
|
async connectToWallet(
|
|
94
93
|
connection: BrowserConnection,
|
package/src/AeSdkBase.ts
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
CompilerError, DuplicateNodeError, NodeNotFoundError, NotImplementedError, TypeError,
|
|
5
5
|
} from './utils/errors';
|
|
6
6
|
import { Encoded } from './utils/encoder';
|
|
7
|
+
import { wrapWithProxy } from './utils/wrap-proxy';
|
|
7
8
|
import CompilerBase from './contract/compiler/Base';
|
|
8
|
-
import AeSdkMethods, { OnAccount,
|
|
9
|
+
import AeSdkMethods, { OnAccount, AeSdkMethodsOptions, WrappedOptions } from './AeSdkMethods';
|
|
9
10
|
import { AensName } from './tx/builder/constants';
|
|
10
11
|
|
|
11
12
|
type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & { name: string };
|
|
@@ -21,6 +22,8 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
21
22
|
|
|
22
23
|
selectedNodeName?: string;
|
|
23
24
|
|
|
25
|
+
readonly #wrappedOptions: WrappedOptions;
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* @param options - Options
|
|
26
29
|
* @param options.nodes - Array of nodes
|
|
@@ -33,6 +36,12 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
33
36
|
super(options);
|
|
34
37
|
|
|
35
38
|
nodes.forEach(({ name, instance }, i) => this.addNode(name, instance, i === 0));
|
|
39
|
+
|
|
40
|
+
this.#wrappedOptions = {
|
|
41
|
+
onNode: wrapWithProxy(() => this.api),
|
|
42
|
+
onCompiler: wrapWithProxy(() => this.compilerApi),
|
|
43
|
+
onAccount: wrapWithProxy(() => this._resolveAccount()),
|
|
44
|
+
};
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
// TODO: consider dropping this getter, because:
|
|
@@ -147,6 +156,11 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
147
156
|
return this._resolveAccount().address;
|
|
148
157
|
}
|
|
149
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Sign data blob
|
|
161
|
+
* @param data - Data to sign
|
|
162
|
+
* @param options - Options
|
|
163
|
+
*/
|
|
150
164
|
async sign(
|
|
151
165
|
data: string | Uint8Array,
|
|
152
166
|
{ onAccount, ...options }: { onAccount?: OnAccount } = {},
|
|
@@ -154,6 +168,11 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
154
168
|
return this._resolveAccount(onAccount).sign(data, options);
|
|
155
169
|
}
|
|
156
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Sign encoded transaction
|
|
173
|
+
* @param tx - Transaction to sign
|
|
174
|
+
* @param options - Options
|
|
175
|
+
*/
|
|
157
176
|
async signTransaction(
|
|
158
177
|
tx: Encoded.Transaction,
|
|
159
178
|
{ onAccount, ...options }: { onAccount?: OnAccount } & Parameters<AccountBase['signTransaction']>[1] = {},
|
|
@@ -162,6 +181,11 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
162
181
|
return this._resolveAccount(onAccount).signTransaction(tx, { networkId, ...options });
|
|
163
182
|
}
|
|
164
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Sign message
|
|
186
|
+
* @param message - Message to sign
|
|
187
|
+
* @param options - Options
|
|
188
|
+
*/
|
|
165
189
|
async signMessage(
|
|
166
190
|
message: string,
|
|
167
191
|
{ onAccount, ...options }: { onAccount?: OnAccount } & Parameters<AccountBase['signMessage']>[1] = {},
|
|
@@ -169,6 +193,12 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
169
193
|
return this._resolveAccount(onAccount).signMessage(message, options);
|
|
170
194
|
}
|
|
171
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Sign typed data
|
|
198
|
+
* @param data - Encoded data to sign
|
|
199
|
+
* @param aci - Type of data to sign
|
|
200
|
+
* @param options - Options
|
|
201
|
+
*/
|
|
172
202
|
async signTypedData(
|
|
173
203
|
data: Encoded.ContractBytearray,
|
|
174
204
|
aci: Parameters<AccountBase['signTypedData']>[1],
|
|
@@ -177,6 +207,11 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
177
207
|
return this._resolveAccount(onAccount).signTypedData(data, aci, options);
|
|
178
208
|
}
|
|
179
209
|
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
212
|
+
* @param contractAddress - Contract address
|
|
213
|
+
* @param options - Options
|
|
214
|
+
*/
|
|
180
215
|
async signDelegationToContract(
|
|
181
216
|
contractAddress: Encoded.ContractAddress,
|
|
182
217
|
{ onAccount, ...options }: { onAccount?: OnAccount }
|
|
@@ -184,10 +219,18 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
184
219
|
): Promise<Encoded.Signature> {
|
|
185
220
|
options.networkId ??= this.selectedNodeName !== null
|
|
186
221
|
? await this.api.getNetworkId() : undefined;
|
|
222
|
+
options.consensusProtocolVersion ??= this.selectedNodeName !== null
|
|
223
|
+
? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
187
224
|
return this._resolveAccount(onAccount)
|
|
188
225
|
.signDelegationToContract(contractAddress, options);
|
|
189
226
|
}
|
|
190
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
230
|
+
* @param contractAddress - Contract address
|
|
231
|
+
* @param name - AENS name
|
|
232
|
+
* @param options - Options
|
|
233
|
+
*/
|
|
191
234
|
async signNameDelegationToContract(
|
|
192
235
|
contractAddress: Encoded.ContractAddress,
|
|
193
236
|
name: AensName,
|
|
@@ -196,10 +239,36 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
196
239
|
): Promise<Encoded.Signature> {
|
|
197
240
|
options.networkId ??= this.selectedNodeName !== null
|
|
198
241
|
? await this.api.getNetworkId() : undefined;
|
|
242
|
+
options.consensusProtocolVersion ??= this.selectedNodeName !== null
|
|
243
|
+
? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
199
244
|
return this._resolveAccount(onAccount)
|
|
200
245
|
.signNameDelegationToContract(contractAddress, name, options);
|
|
201
246
|
}
|
|
202
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
250
|
+
* @param contractAddress - Contract address
|
|
251
|
+
* @param options - Options
|
|
252
|
+
*/
|
|
253
|
+
async signAllNamesDelegationToContract(
|
|
254
|
+
contractAddress: Encoded.ContractAddress,
|
|
255
|
+
{ onAccount, ...options }: { onAccount?: OnAccount }
|
|
256
|
+
& Parameters<AccountBase['signAllNamesDelegationToContract']>[1] = {},
|
|
257
|
+
): Promise<Encoded.Signature> {
|
|
258
|
+
options.networkId ??= this.selectedNodeName !== null
|
|
259
|
+
? await this.api.getNetworkId() : undefined;
|
|
260
|
+
options.consensusProtocolVersion ??= this.selectedNodeName !== null
|
|
261
|
+
? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
262
|
+
return this._resolveAccount(onAccount)
|
|
263
|
+
.signAllNamesDelegationToContract(contractAddress, options);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @deprecated use AeSdkBase:signDelegation in Ceres
|
|
268
|
+
* @param contractAddress - Contract address
|
|
269
|
+
* @param oracleQueryId - Oracle query id
|
|
270
|
+
* @param options - Options
|
|
271
|
+
*/
|
|
203
272
|
async signOracleQueryDelegationToContract(
|
|
204
273
|
contractAddress: Encoded.ContractAddress,
|
|
205
274
|
oracleQueryId: Encoded.OracleQueryId,
|
|
@@ -208,21 +277,39 @@ export default class AeSdkBase extends AeSdkMethods {
|
|
|
208
277
|
): Promise<Encoded.Signature> {
|
|
209
278
|
options.networkId ??= this.selectedNodeName !== null
|
|
210
279
|
? await this.api.getNetworkId() : undefined;
|
|
280
|
+
options.consensusProtocolVersion ??= this.selectedNodeName !== null
|
|
281
|
+
? (await this.api.getNodeInfo()).consensusProtocolVersion : undefined;
|
|
211
282
|
return this._resolveAccount(onAccount)
|
|
212
283
|
.signOracleQueryDelegationToContract(contractAddress, oracleQueryId, options);
|
|
213
284
|
}
|
|
214
285
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Sign delegation, works only in Ceres
|
|
288
|
+
* @param delegation - Delegation to sign
|
|
289
|
+
* @param options - Options
|
|
290
|
+
*/
|
|
291
|
+
async signDelegation(
|
|
292
|
+
delegation: Encoded.Bytearray,
|
|
293
|
+
{ onAccount, ...options }: { onAccount?: OnAccount }
|
|
294
|
+
& Parameters<AccountBase['signDelegation']>[1] = {},
|
|
295
|
+
): Promise<Encoded.Signature> {
|
|
296
|
+
options.networkId ??= this.selectedNodeName !== null
|
|
297
|
+
? await this.api.getNetworkId() : undefined;
|
|
298
|
+
return this._resolveAccount(onAccount).signDelegation(delegation, options);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* The same as AeSdkMethods:getContext, but it would resolve ak_-prefixed address in
|
|
303
|
+
* `mergeWith.onAccount` to AccountBase.
|
|
304
|
+
*/
|
|
305
|
+
override getContext(mergeWith: AeSdkMethodsOptions = {}): AeSdkMethodsOptions & WrappedOptions {
|
|
220
306
|
return {
|
|
221
307
|
...this._options,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
...
|
|
225
|
-
|
|
308
|
+
...this.#wrappedOptions,
|
|
309
|
+
...mergeWith,
|
|
310
|
+
...mergeWith.onAccount != null && {
|
|
311
|
+
onAccount: this._resolveAccount(mergeWith.onAccount),
|
|
312
|
+
},
|
|
226
313
|
};
|
|
227
314
|
}
|
|
228
315
|
}
|
package/src/AeSdkMethods.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as chainMethods from './chain';
|
|
2
|
+
import { sendTransaction } from './send-transaction';
|
|
2
3
|
import * as aensMethods from './aens';
|
|
3
4
|
import * as spendMethods from './spend';
|
|
4
5
|
import * as oracleMethods from './oracle';
|
|
@@ -7,6 +8,7 @@ import createDelegationSignature from './contract/delegation-signature';
|
|
|
7
8
|
import * as contractGaMethods from './contract/ga';
|
|
8
9
|
import { buildTxAsync } from './tx/builder';
|
|
9
10
|
import { mapObject, UnionToIntersection } from './utils/other';
|
|
11
|
+
import { wrapWithProxy } from './utils/wrap-proxy';
|
|
10
12
|
import Node from './Node';
|
|
11
13
|
import { TxParamsAsync } from './tx/builder/schema.generated';
|
|
12
14
|
import AccountBase from './account/Base';
|
|
@@ -15,29 +17,9 @@ import CompilerBase from './contract/compiler/Base';
|
|
|
15
17
|
|
|
16
18
|
export type OnAccount = Encoded.AccountAddress | AccountBase | undefined;
|
|
17
19
|
|
|
18
|
-
export function getValueOrErrorProxy<Value extends object | undefined>(
|
|
19
|
-
valueCb: () => Value,
|
|
20
|
-
): NonNullable<Value> {
|
|
21
|
-
return new Proxy(
|
|
22
|
-
{},
|
|
23
|
-
Object.fromEntries(([
|
|
24
|
-
'apply', 'construct', 'defineProperty', 'deleteProperty', 'getOwnPropertyDescriptor',
|
|
25
|
-
'getPrototypeOf', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf',
|
|
26
|
-
'get', 'has',
|
|
27
|
-
] as const).map((name) => [name, (t: {}, ...args: unknown[]) => {
|
|
28
|
-
const target = valueCb() as object; // to get a native exception in case it missed
|
|
29
|
-
const res = (Reflect[name] as any)(target, ...args);
|
|
30
|
-
return typeof res === 'function' && name === 'get'
|
|
31
|
-
? res.bind(target) // otherwise it fails with attempted to get private field on non-instance
|
|
32
|
-
: res;
|
|
33
|
-
}])),
|
|
34
|
-
) as NonNullable<Value>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const { InvalidTxError: _2, ...chainMethodsOther } = chainMethods;
|
|
38
|
-
|
|
39
20
|
const methods = {
|
|
40
|
-
...
|
|
21
|
+
...chainMethods,
|
|
22
|
+
sendTransaction,
|
|
41
23
|
...aensMethods,
|
|
42
24
|
...spendMethods,
|
|
43
25
|
...oracleMethods,
|
|
@@ -57,6 +39,12 @@ export interface AeSdkMethodsOptions
|
|
|
57
39
|
extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
|
|
58
40
|
}
|
|
59
41
|
|
|
42
|
+
export interface WrappedOptions {
|
|
43
|
+
onAccount: AccountBase;
|
|
44
|
+
onCompiler: CompilerBase;
|
|
45
|
+
onNode: Node;
|
|
46
|
+
}
|
|
47
|
+
|
|
60
48
|
/**
|
|
61
49
|
* AeSdkMethods is the composition of:
|
|
62
50
|
* - chain methods
|
|
@@ -73,33 +61,43 @@ export interface AeSdkMethodsOptions
|
|
|
73
61
|
class AeSdkMethods {
|
|
74
62
|
_options: AeSdkMethodsOptions = {};
|
|
75
63
|
|
|
64
|
+
readonly #wrappedOptions: WrappedOptions;
|
|
65
|
+
|
|
76
66
|
/**
|
|
77
67
|
* @param options - Options
|
|
78
68
|
*/
|
|
79
69
|
constructor(options: AeSdkMethodsOptions = {}) {
|
|
80
70
|
Object.assign(this._options, options);
|
|
71
|
+
this.#wrappedOptions = {
|
|
72
|
+
onAccount: wrapWithProxy(() => this._options.onAccount),
|
|
73
|
+
onNode: wrapWithProxy(() => this._options.onNode),
|
|
74
|
+
onCompiler: wrapWithProxy(() => this._options.onCompiler),
|
|
75
|
+
};
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Returns sdk instance options with references to current account, node, compiler.
|
|
80
|
+
* Used to create an instance (Contract, Oracle) bound to AeSdk state.
|
|
81
|
+
* @param mergeWith - Merge context with these extra options
|
|
82
|
+
* @returns Context object
|
|
83
|
+
*/
|
|
84
|
+
getContext(mergeWith: AeSdkMethodsOptions = {}): AeSdkMethodsOptions & WrappedOptions {
|
|
86
85
|
return {
|
|
87
86
|
...this._options,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onCompiler: getValueOrErrorProxy(() => this._options.onCompiler),
|
|
91
|
-
...callOptions,
|
|
87
|
+
...this.#wrappedOptions,
|
|
88
|
+
...mergeWith,
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
|
|
92
|
+
// TODO: omit onNode from options, because it is already in context
|
|
95
93
|
async buildTx(options: TxParamsAsync): Promise<Encoded.Transaction> {
|
|
96
|
-
return buildTxAsync({ ...this.
|
|
94
|
+
return buildTxAsync({ ...this.getContext(), ...options });
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
async initializeContract<Methods extends ContractMethodsBase>(
|
|
100
98
|
options?: Omit<Parameters<typeof Contract.initialize>[0], 'onNode'> & { onNode?: Node },
|
|
101
99
|
): Promise<Contract<Methods>> {
|
|
102
|
-
return Contract.initialize<Methods>(this.
|
|
100
|
+
return Contract.initialize<Methods>(this.getContext(options as AeSdkMethodsOptions));
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
|
@@ -110,7 +108,13 @@ type RequiredKeys<T> = {
|
|
|
110
108
|
type OptionalIfNotRequired<T extends [any]> = RequiredKeys<T[0]> extends never ? T | [] : T;
|
|
111
109
|
|
|
112
110
|
type ReplaceOnAccount<Options> = Options extends { onAccount: any }
|
|
113
|
-
? Omit<Options, 'onAccount'> & {
|
|
111
|
+
? Omit<Options, 'onAccount'> & {
|
|
112
|
+
/**
|
|
113
|
+
* Make operation on specific account by providing address (to use account from sdk) or instance
|
|
114
|
+
* of AccountBase (like MemoryAccount)
|
|
115
|
+
*/
|
|
116
|
+
onAccount: OnAccount;
|
|
117
|
+
} : Options;
|
|
114
118
|
|
|
115
119
|
type MakeOptional<Options> = OptionalIfNotRequired<[
|
|
116
120
|
Omit<Options, 'onNode' | 'onCompiler' | 'onAccount'> & Partial<ReplaceOnAccount<Options>>,
|
|
@@ -133,7 +137,7 @@ Object.assign(AeSdkMethods.prototype, mapObject<Function, Function>(
|
|
|
133
137
|
function methodWrapper(this: AeSdkMethods, ...args: any[]) {
|
|
134
138
|
args.length = handler.length;
|
|
135
139
|
const options = args[args.length - 1];
|
|
136
|
-
args[args.length - 1] = this.
|
|
140
|
+
args[args.length - 1] = this.getContext(options);
|
|
137
141
|
return handler(...args);
|
|
138
142
|
},
|
|
139
143
|
],
|