@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aesophia_cli +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 +12031 -11231
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -3
- package/es/AeSdk.mjs +17 -22
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +6 -5
- package/es/AeSdkAepp.mjs +7 -30
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +18 -140
- package/es/AeSdkBase.mjs +30 -184
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +123 -0
- package/es/AeSdkMethods.mjs +122 -0
- package/es/AeSdkMethods.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +7 -21
- package/es/AeSdkWallet.mjs +38 -86
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +11 -15
- package/es/Node.mjs +35 -48
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +24 -40
- package/es/account/Base.mjs +1 -101
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +16 -0
- package/es/account/Generalized.mjs +113 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +102 -0
- package/es/account/Ledger.mjs.map +1 -0
- package/es/account/LedgerFactory.d.ts +39 -0
- package/es/account/LedgerFactory.mjs +81 -0
- package/es/account/LedgerFactory.mjs.map +1 -0
- package/es/account/Memory.d.ts +13 -17
- package/es/account/Memory.mjs +43 -64
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -8
- package/es/account/Rpc.mjs +14 -32
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +4 -4
- package/es/aens.mjs +46 -41
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.mjs +14 -68
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.d.ts +23 -29
- package/es/apis/compiler/compiler.mjs +128 -189
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/index.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +82 -135
- package/es/apis/compiler/models/index.mjs +1 -47
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +8 -8
- package/es/apis/compiler/models/mappers.mjs +165 -183
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/compiler/models/parameters.d.ts +0 -1
- package/es/apis/compiler/models/parameters.mjs +5 -9
- package/es/apis/compiler/models/parameters.mjs.map +1 -1
- package/es/apis/node/index.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +48 -48
- package/es/apis/node/models/mappers.mjs +12 -6
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/apis/node/models/parameters.mjs.map +1 -1
- package/es/apis/node/node.mjs +43 -84
- package/es/apis/node/node.mjs.map +1 -1
- package/es/chain.d.ts +10 -2
- package/es/chain.mjs +37 -59
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +200 -0
- package/es/channel/Base.mjs +293 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +248 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +219 -0
- package/es/channel/Spend.mjs +385 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +151 -899
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +101 -191
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +210 -0
- package/es/contract/Contract.mjs +551 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/compiler/Base.d.ts +81 -0
- package/es/contract/compiler/Base.mjs +5 -0
- package/es/contract/compiler/Base.mjs.map +1 -0
- package/es/contract/compiler/Cli.d.ts +23 -0
- package/es/contract/compiler/Cli.mjs +155 -0
- package/es/contract/compiler/Cli.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +32 -0
- package/es/contract/compiler/Http.mjs +118 -0
- package/es/contract/compiler/Http.mjs.map +1 -0
- package/es/contract/compiler/HttpNode.d.ts +17 -0
- package/es/contract/compiler/HttpNode.mjs +26 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -0
- package/es/contract/compiler/getFileSystem.d.ts +6 -0
- package/es/contract/compiler/getFileSystem.mjs +40 -0
- package/es/contract/compiler/getFileSystem.mjs.map +1 -0
- package/es/contract/ga.d.ts +9 -34
- package/es/contract/ga.mjs +29 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +39 -0
- package/es/index-browser.mjs +55 -0
- package/es/index-browser.mjs.map +1 -0
- package/es/index.d.ts +4 -35
- package/es/index.mjs +4 -51
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +34 -40
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +18 -23
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +30 -2
- package/es/tx/builder/constants.mjs +43 -14
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +10 -0
- package/es/tx/builder/field-types/abi-version.mjs +20 -0
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
- package/es/tx/builder/field-types/address.d.ts +14 -0
- package/es/tx/builder/field-types/address.mjs +51 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/array.d.ts +7 -0
- package/es/tx/builder/field-types/array.mjs +11 -0
- package/es/tx/builder/field-types/array.mjs.map +1 -0
- package/es/tx/builder/field-types/boolean.d.ts +6 -0
- package/es/tx/builder/field-types/boolean.mjs +13 -0
- package/es/tx/builder/field-types/boolean.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
- package/es/tx/builder/field-types/coin-amount.mjs +4 -12
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +30 -0
- package/es/tx/builder/field-types/ct-version.mjs +48 -0
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +1 -2
- package/es/tx/builder/field-types/deposit.mjs +2 -4
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +6 -0
- package/es/tx/builder/field-types/encoded.mjs +21 -0
- package/es/tx/builder/field-types/encoded.mjs.map +1 -0
- package/es/tx/builder/field-types/entry.d.ts +11 -0
- package/es/tx/builder/field-types/entry.mjs +31 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -0
- package/es/tx/builder/field-types/enumeration.d.ts +7 -0
- package/es/tx/builder/field-types/enumeration.mjs +30 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +10 -15
- package/es/tx/builder/field-types/fee.mjs +31 -43
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/field.mjs +0 -2
- package/es/tx/builder/field-types/field.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/es/tx/builder/field-types/gas-limit.mjs +12 -14
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -2
- package/es/tx/builder/field-types/gas-price.mjs +3 -7
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +80 -30
- package/es/tx/builder/field-types/index.mjs +34 -9
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.d.ts +37 -0
- package/es/tx/builder/field-types/mptree.mjs +268 -0
- package/es/tx/builder/field-types/mptree.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +1 -3
- package/es/tx/builder/field-types/name-fee.mjs +3 -5
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.d.ts +1 -4
- package/es/tx/builder/field-types/name-id.mjs +5 -10
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/name.mjs +0 -2
- package/es/tx/builder/field-types/name.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.d.ts +23 -0
- package/es/tx/builder/field-types/pointers.mjs +36 -0
- package/es/tx/builder/field-types/pointers.mjs.map +1 -0
- package/es/tx/builder/field-types/raw.d.ts +6 -0
- package/es/tx/builder/field-types/raw.mjs +13 -0
- package/es/tx/builder/field-types/raw.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.mjs +0 -2
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
- package/es/tx/builder/field-types/string.d.ts +6 -0
- package/es/tx/builder/field-types/string.mjs +10 -0
- package/es/tx/builder/field-types/string.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +1 -2
- package/es/tx/builder/field-types/u-int.mjs +3 -4
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/helpers.d.ts +2 -32
- package/es/tx/builder/helpers.mjs +19 -71
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +11 -49
- package/es/tx/builder/index.mjs +57 -337
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2367 -667
- package/es/tx/builder/schema.mjs +70 -145
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +4 -49
- package/es/tx/index.mjs +38 -112
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -6
- package/es/tx/validator.mjs +104 -90
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +4 -10
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.d.ts +1 -0
- package/es/utils/autorest.mjs +17 -19
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +4 -7
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.d.ts +0 -17
- package/es/utils/bytes.mjs +6 -35
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +15 -8
- package/es/utils/crypto.mjs +40 -40
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +28 -28
- package/es/utils/encoder-types.mjs +0 -1
- package/es/utils/encoder-types.mjs.map +1 -1
- package/es/utils/encoder.d.ts +0 -1
- package/es/utils/encoder.mjs +7 -15
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +15 -14
- package/es/utils/errors.mjs +86 -172
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +27 -19
- package/es/utils/hd-wallet.mjs +42 -26
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +0 -8
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.d.ts +2 -0
- package/es/utils/keystore.mjs +37 -36
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/other.d.ts +4 -2
- package/es/utils/other.mjs +11 -7
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.mjs +0 -3
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.d.ts +0 -12
- package/es/utils/string.mjs +1 -21
- package/es/utils/string.mjs.map +1 -1
- package/package.json +98 -51
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +31 -202
- package/src/AeSdkMethods.ts +169 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +17 -18
- package/src/account/Base.ts +29 -75
- package/src/account/Generalized.ts +98 -0
- package/src/account/Ledger.ts +131 -0
- package/src/account/LedgerFactory.ts +86 -0
- package/src/account/Memory.ts +46 -60
- package/src/account/Rpc.ts +17 -26
- package/src/aens.ts +13 -11
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
- package/src/aepp-wallet-communication/rpc/types.ts +11 -1
- package/src/aepp-wallet-communication/schema.ts +18 -18
- package/src/apis/compiler/code-model-v4.yaml +681 -888
- package/src/apis/compiler/compiler.ts +113 -154
- package/src/apis/compiler/models/index.ts +80 -140
- package/src/apis/compiler/models/mappers.ts +165 -183
- package/src/apis/compiler/models/parameters.ts +6 -12
- package/src/chain.ts +11 -6
- package/src/channel/Base.ts +335 -0
- package/src/channel/Contract.ts +488 -0
- package/src/channel/Spend.ts +408 -0
- package/src/channel/handlers.ts +164 -582
- package/src/channel/internal.ts +114 -143
- package/src/contract/Contract.ts +610 -0
- package/src/contract/compiler/Base.ts +94 -0
- package/src/contract/compiler/Cli.ts +134 -0
- package/src/contract/compiler/Http.ts +124 -0
- package/src/contract/compiler/HttpNode.ts +26 -0
- package/src/contract/compiler/getFileSystem.ts +42 -0
- package/src/contract/ga.ts +23 -106
- package/src/index-browser.ts +58 -0
- package/src/index.ts +4 -55
- package/src/oracle.ts +8 -8
- package/src/spend.ts +6 -14
- package/src/tx/builder/constants.ts +33 -3
- package/src/tx/builder/field-types/abi-version.ts +21 -0
- package/src/tx/builder/field-types/address.ts +62 -0
- package/src/tx/builder/field-types/array.ts +19 -0
- package/src/tx/builder/field-types/boolean.ts +9 -0
- package/src/tx/builder/field-types/coin-amount.ts +4 -9
- package/src/tx/builder/field-types/ct-version.ts +50 -0
- package/src/tx/builder/field-types/deposit.ts +1 -1
- package/src/tx/builder/field-types/encoded.ts +27 -0
- package/src/tx/builder/field-types/entry.ts +31 -0
- package/src/tx/builder/field-types/enumeration.ts +32 -0
- package/src/tx/builder/field-types/fee.ts +39 -21
- package/src/tx/builder/field-types/gas-limit.ts +13 -8
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +54 -15
- package/src/tx/builder/field-types/mptree.ts +242 -0
- package/src/tx/builder/field-types/name-fee.ts +2 -3
- package/src/tx/builder/field-types/name-id.ts +7 -10
- package/src/tx/builder/field-types/pointers.ts +41 -0
- package/src/tx/builder/field-types/raw.ts +9 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
- package/src/tx/builder/field-types/string.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +4 -5
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +65 -308
- package/src/tx/builder/schema.ts +280 -341
- package/src/tx/index.ts +40 -103
- package/src/tx/validator.ts +91 -96
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +6 -34
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +22 -25
- package/src/utils/hd-wallet.ts +30 -9
- package/src/utils/keystore.ts +24 -21
- package/src/utils/other.ts +16 -1
- package/src/utils/string.ts +0 -20
- package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.2/Node.d.ts +78 -0
- package/types-legacy/ts4.2/account/Base.d.ts +52 -0
- package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.2/aens.d.ts +222 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.2/chain.d.ts +256 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index-browser.d.ts +39 -0
- package/types-legacy/ts4.2/index.d.ts +5 -0
- package/types-legacy/ts4.2/oracle.d.ts +161 -0
- package/types-legacy/ts4.2/spend.d.ts +62 -0
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.2/tx/index.d.ts +19 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.2/utils/other.d.ts +31 -0
- package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.2/utils/string.d.ts +12 -0
- package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
- package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
- package/types-legacy/ts4.5/Node.d.ts +78 -0
- package/types-legacy/ts4.5/account/Base.d.ts +52 -0
- package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
- package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
- package/types-legacy/ts4.5/aens.d.ts +222 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
- package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
- package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
- package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
- package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
- package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
- package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
- package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
- package/types-legacy/ts4.5/chain.d.ts +256 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
- package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
- package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
- package/types-legacy/ts4.5/index-browser.d.ts +39 -0
- package/types-legacy/ts4.5/index.d.ts +4 -0
- package/types-legacy/ts4.5/oracle.d.ts +161 -0
- package/types-legacy/ts4.5/spend.d.ts +62 -0
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
- package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
- package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
- package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
- package/types-legacy/ts4.5/tx/index.d.ts +19 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
- package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
- package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
- package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
- package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
- package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
- package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
- package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
- package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
- package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
- package/types-legacy/ts4.5/utils/other.d.ts +31 -0
- package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
- package/types-legacy/ts4.5/utils/string.d.ts +12 -0
- package/es/channel/index.d.ts +0 -625
- package/es/channel/index.mjs +0 -975
- package/es/channel/index.mjs.map +0 -1
- package/es/contract/Compiler.d.ts +0 -18
- package/es/contract/Compiler.mjs +0 -68
- package/es/contract/Compiler.mjs.map +0 -1
- package/es/contract/aci.d.ts +0 -127
- package/es/contract/aci.mjs +0 -508
- package/es/contract/aci.mjs.map +0 -1
- package/es/contract/methods.d.ts +0 -71
- package/es/contract/methods.mjs +0 -104
- package/es/contract/methods.mjs.map +0 -1
- package/es/deprecated/index.d.ts +0 -143
- package/es/deprecated/index.mjs +0 -162
- package/es/deprecated/index.mjs.map +0 -1
- package/es/deprecated/methods.d.ts +0 -18
- package/es/deprecated/methods.mjs +0 -26
- package/es/deprecated/methods.mjs.map +0 -1
- package/es/tx/builder/address.d.ts +0 -25
- package/es/tx/builder/address.mjs +0 -45
- package/es/tx/builder/address.mjs.map +0 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
- package/es/utils/mptree.d.ts +0 -26
- package/es/utils/mptree.mjs +0 -165
- package/es/utils/mptree.mjs.map +0 -1
- package/src/channel/index.ts +0 -1025
- package/src/contract/Compiler.ts +0 -67
- package/src/contract/aci.ts +0 -537
- package/src/contract/methods.ts +0 -123
- package/src/deprecated/index.ts +0 -172
- package/src/deprecated/methods.ts +0 -25
- package/src/tx/builder/address.ts +0 -50
- package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
- package/src/utils/mptree.ts +0 -145
package/es/AeSdkWallet.d.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import AeSdk from './AeSdk';
|
|
2
|
-
import { Account } from './AeSdkBase';
|
|
3
2
|
import RpcClient from './aepp-wallet-communication/rpc/RpcClient';
|
|
4
3
|
import { METHODS, RPC_STATUS, WALLET_TYPE } from './aepp-wallet-communication/schema';
|
|
5
4
|
import AccountBase from './account/Base';
|
|
6
5
|
import BrowserConnection from './aepp-wallet-communication/connection/Browser';
|
|
7
6
|
import { Accounts, AeppApi, Network, WalletApi, WalletInfo } from './aepp-wallet-communication/rpc/types';
|
|
8
7
|
import { Encoded } from './utils/encoder';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onAccount?: Account;
|
|
15
|
-
} | undefined> | Promise<void>;
|
|
16
|
-
declare type OnDisconnect = (clientId: string, params: Parameters<WalletApi[METHODS.closeConnection]>[0]) => void;
|
|
17
|
-
declare type OnAskAccounts = (clientId: string, params: undefined, origin: string) => void;
|
|
18
|
-
declare type OnMessageSign = (clientId: string, params: Parameters<WalletApi[METHODS.signMessage]>[0], origin: string) => Promise<{
|
|
19
|
-
onAccount?: Account;
|
|
20
|
-
} | undefined> | Promise<void>;
|
|
8
|
+
type RpcClientWallet = RpcClient<AeppApi, WalletApi>;
|
|
9
|
+
type OnConnection = (clientId: string, params: Omit<Parameters<WalletApi[METHODS.connect]>[0], 'version'>, origin: string) => void;
|
|
10
|
+
type OnSubscription = (clientId: string, params: Parameters<WalletApi[METHODS.subscribeAddress]>[0], origin: string) => void;
|
|
11
|
+
type OnDisconnect = (clientId: string, params: Parameters<WalletApi[METHODS.closeConnection]>[0]) => void;
|
|
12
|
+
type OnAskAccounts = (clientId: string, params: undefined, origin: string) => void;
|
|
21
13
|
interface RpcClientsInfo {
|
|
22
14
|
id: string;
|
|
23
15
|
status: RPC_STATUS;
|
|
@@ -36,10 +28,8 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
36
28
|
_clients: Map<string, RpcClientsInfo>;
|
|
37
29
|
onConnection: OnConnection;
|
|
38
30
|
onSubscription: OnSubscription;
|
|
39
|
-
onSign: OnSign;
|
|
40
31
|
onDisconnect: OnDisconnect;
|
|
41
32
|
onAskAccounts: OnAskAccounts;
|
|
42
|
-
onMessageSign: OnMessageSign;
|
|
43
33
|
/**
|
|
44
34
|
* @param options - Options
|
|
45
35
|
* @param options.name - Wallet name
|
|
@@ -47,25 +37,21 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
47
37
|
* @param options.type - Wallet type
|
|
48
38
|
* @param options.onConnection - Call-back function for incoming AEPP connection
|
|
49
39
|
* @param options.onSubscription - Call-back function for incoming AEPP account subscription
|
|
50
|
-
* @param options.onSign - Call-back function for incoming AEPP sign request
|
|
51
40
|
* @param options.onAskAccounts - Call-back function for incoming AEPP get address request
|
|
52
|
-
* @param options.onMessageSign - Call-back function for incoming AEPP sign message request
|
|
53
41
|
* @param options.onDisconnect - Call-back function for disconnect event
|
|
54
42
|
*/
|
|
55
|
-
constructor({ name, id, type, onConnection, onSubscription,
|
|
43
|
+
constructor({ name, id, type, onConnection, onSubscription, onDisconnect, onAskAccounts, ...options }: {
|
|
56
44
|
id: string;
|
|
57
45
|
type: WALLET_TYPE;
|
|
58
46
|
name: string;
|
|
59
47
|
onConnection: OnConnection;
|
|
60
48
|
onSubscription: OnSubscription;
|
|
61
|
-
onSign: OnSign;
|
|
62
49
|
onDisconnect: OnDisconnect;
|
|
63
50
|
onAskAccounts: OnAskAccounts;
|
|
64
|
-
onMessageSign: OnMessageSign;
|
|
65
51
|
} & ConstructorParameters<typeof AeSdk>[0]);
|
|
66
52
|
_pushAccountsToApps(): void;
|
|
67
53
|
selectAccount(address: Encoded.AccountAddress): void;
|
|
68
|
-
addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]):
|
|
54
|
+
addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]): void;
|
|
69
55
|
_getNode(): {
|
|
70
56
|
node: Network['node'];
|
|
71
57
|
};
|
package/es/AeSdkWallet.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _buffer from "buffer";
|
|
2
|
+
const {
|
|
3
|
+
Buffer: _Buffer
|
|
4
|
+
} = _buffer;
|
|
5
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
6
|
import { v4 as uuid } from '@aeternity/uuid';
|
|
3
7
|
import AeSdk from "./AeSdk.mjs";
|
|
4
8
|
import verifyTransaction from "./tx/validator.mjs";
|
|
@@ -7,7 +11,6 @@ import { METHODS, RPC_STATUS, SUBSCRIPTION_TYPES, RpcBroadcastError, RpcInvalidT
|
|
|
7
11
|
import { InternalError, UnknownRpcClientError } from "./utils/errors.mjs";
|
|
8
12
|
import { RPC_VERSION } from "./aepp-wallet-communication/rpc/types.mjs";
|
|
9
13
|
import jsonBig from "./utils/json-big.mjs";
|
|
10
|
-
|
|
11
14
|
/**
|
|
12
15
|
* Contain functionality for aepp interaction and managing multiple aepps
|
|
13
16
|
* @category aepp wallet communication
|
|
@@ -20,9 +23,7 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
20
23
|
* @param options.type - Wallet type
|
|
21
24
|
* @param options.onConnection - Call-back function for incoming AEPP connection
|
|
22
25
|
* @param options.onSubscription - Call-back function for incoming AEPP account subscription
|
|
23
|
-
* @param options.onSign - Call-back function for incoming AEPP sign request
|
|
24
26
|
* @param options.onAskAccounts - Call-back function for incoming AEPP get address request
|
|
25
|
-
* @param options.onMessageSign - Call-back function for incoming AEPP sign message request
|
|
26
27
|
* @param options.onDisconnect - Call-back function for disconnect event
|
|
27
28
|
*/
|
|
28
29
|
constructor(_ref) {
|
|
@@ -32,54 +33,44 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
32
33
|
type,
|
|
33
34
|
onConnection,
|
|
34
35
|
onSubscription,
|
|
35
|
-
onSign,
|
|
36
36
|
onDisconnect,
|
|
37
37
|
onAskAccounts,
|
|
38
|
-
onMessageSign,
|
|
39
38
|
...options
|
|
40
39
|
} = _ref;
|
|
41
40
|
super(options);
|
|
41
|
+
_defineProperty(this, "_clients", new Map());
|
|
42
42
|
this.onConnection = onConnection;
|
|
43
43
|
this.onSubscription = onSubscription;
|
|
44
|
-
this.onSign = onSign;
|
|
45
44
|
this.onDisconnect = onDisconnect;
|
|
46
45
|
this.onAskAccounts = onAskAccounts;
|
|
47
|
-
this.onMessageSign = onMessageSign;
|
|
48
|
-
this._clients = new Map();
|
|
49
46
|
this.name = name;
|
|
50
47
|
this.id = id;
|
|
51
48
|
this._type = type;
|
|
52
49
|
}
|
|
53
|
-
|
|
54
50
|
_pushAccountsToApps() {
|
|
51
|
+
if (this._clients == null) return;
|
|
55
52
|
Array.from(this._clients.keys()).filter(clientId => this._isRpcClientSubscribed(clientId)).map(clientId => this._getClient(clientId).rpc).forEach(client => client.notify(METHODS.updateAddress, this.getAccounts()));
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
selectAccount(address) {
|
|
59
55
|
super.selectAccount(address);
|
|
60
|
-
|
|
61
56
|
this._pushAccountsToApps();
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
await super.addAccount(account, options);
|
|
66
|
-
|
|
58
|
+
addAccount(account, options) {
|
|
59
|
+
super.addAccount(account, options);
|
|
67
60
|
this._pushAccountsToApps();
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
_getNode() {
|
|
71
63
|
this.ensureNodeConnected();
|
|
72
64
|
return {
|
|
73
65
|
node: {
|
|
74
|
-
url: this.api
|
|
66
|
+
url: this.api.$host,
|
|
75
67
|
name: this.selectedNodeName
|
|
76
68
|
}
|
|
77
69
|
};
|
|
78
70
|
}
|
|
79
|
-
|
|
80
71
|
async selectNode(name) {
|
|
81
72
|
super.selectNode(name);
|
|
82
|
-
const networkId = await this.getNetworkId();
|
|
73
|
+
const networkId = await this.api.getNetworkId();
|
|
83
74
|
Array.from(this._clients.keys()).filter(clientId => this._isRpcClientConnected(clientId)).map(clientId => this._getClient(clientId)).forEach(client => {
|
|
84
75
|
client.rpc.notify(METHODS.updateNetwork, {
|
|
85
76
|
networkId,
|
|
@@ -87,47 +78,38 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
87
78
|
});
|
|
88
79
|
});
|
|
89
80
|
}
|
|
90
|
-
|
|
91
81
|
_getClient(clientId) {
|
|
92
82
|
const client = this._clients.get(clientId);
|
|
93
|
-
|
|
94
83
|
if (client == null) throw new UnknownRpcClientError(clientId);
|
|
95
84
|
return client;
|
|
96
85
|
}
|
|
97
|
-
|
|
98
86
|
_isRpcClientSubscribed(clientId) {
|
|
99
87
|
return this._isRpcClientConnected(clientId) && this._getClient(clientId).addressSubscription.size !== 0;
|
|
100
88
|
}
|
|
101
|
-
|
|
102
89
|
_isRpcClientConnected(clientId) {
|
|
103
90
|
return RPC_STATUS.CONNECTED === this._getClient(clientId).status && this._getClient(clientId).rpc.connection.isConnected();
|
|
104
91
|
}
|
|
105
|
-
|
|
106
92
|
_disconnectRpcClient(clientId) {
|
|
107
93
|
const client = this._getClient(clientId);
|
|
108
|
-
|
|
109
94
|
client.rpc.connection.disconnect();
|
|
110
95
|
client.status = RPC_STATUS.DISCONNECTED;
|
|
111
96
|
client.addressSubscription = new Set();
|
|
112
97
|
}
|
|
98
|
+
|
|
113
99
|
/**
|
|
114
100
|
* Remove specific RpcClient by ID
|
|
115
101
|
* @param id - Client ID
|
|
116
102
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
103
|
removeRpcClient(id) {
|
|
120
104
|
this._disconnectRpcClient(id);
|
|
121
|
-
|
|
122
105
|
this._clients.delete(id);
|
|
123
106
|
}
|
|
107
|
+
|
|
124
108
|
/**
|
|
125
109
|
* Add new client by AEPP connection
|
|
126
110
|
* @param clientConnection - AEPP connection object
|
|
127
111
|
* @returns Client ID
|
|
128
112
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
113
|
addRpcClient(clientConnection) {
|
|
132
114
|
// @TODO detect if aepp has some history based on origin????
|
|
133
115
|
// if yes use this instance for connection
|
|
@@ -140,12 +122,10 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
140
122
|
connectNode: false,
|
|
141
123
|
rpc: new RpcClient(clientConnection, () => {
|
|
142
124
|
this._clients.delete(id);
|
|
143
|
-
|
|
144
125
|
this.onDisconnect(id, disconnectParams); // also related info
|
|
145
126
|
}, {
|
|
146
127
|
[METHODS.closeConnection]: params => {
|
|
147
128
|
disconnectParams = params;
|
|
148
|
-
|
|
149
129
|
this._disconnectRpcClient(id);
|
|
150
130
|
},
|
|
151
131
|
// Store client info and prepare two fn for each client `connect` and `denyConnection`
|
|
@@ -165,7 +145,8 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
165
145
|
}, origin);
|
|
166
146
|
client.status = RPC_STATUS.CONNECTED;
|
|
167
147
|
client.connectNode = connectNode;
|
|
168
|
-
return {
|
|
148
|
+
return {
|
|
149
|
+
...(await this.getWalletInfo()),
|
|
169
150
|
...(connectNode && this._getNode())
|
|
170
151
|
};
|
|
171
152
|
},
|
|
@@ -179,20 +160,16 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
179
160
|
type,
|
|
180
161
|
value
|
|
181
162
|
}, origin);
|
|
182
|
-
|
|
183
163
|
switch (type) {
|
|
184
164
|
case SUBSCRIPTION_TYPES.subscribe:
|
|
185
165
|
client.addressSubscription.add(value);
|
|
186
166
|
break;
|
|
187
|
-
|
|
188
167
|
case SUBSCRIPTION_TYPES.unsubscribe:
|
|
189
168
|
client.addressSubscription.delete(value);
|
|
190
169
|
break;
|
|
191
|
-
|
|
192
170
|
default:
|
|
193
171
|
throw new InternalError(`Unknown subscription type: ${type}`);
|
|
194
172
|
}
|
|
195
|
-
|
|
196
173
|
return {
|
|
197
174
|
subscription: Array.from(client.addressSubscription),
|
|
198
175
|
address: this.getAccounts()
|
|
@@ -204,40 +181,29 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
204
181
|
return this.addresses();
|
|
205
182
|
},
|
|
206
183
|
[METHODS.sign]: async (_ref4, origin) => {
|
|
207
|
-
var _onAccount, _context, _overrides$onAccount, _overrides$tx;
|
|
208
|
-
|
|
209
184
|
let {
|
|
210
185
|
tx,
|
|
211
|
-
onAccount,
|
|
186
|
+
onAccount = this.address,
|
|
212
187
|
returnSigned
|
|
213
188
|
} = _ref4;
|
|
214
189
|
if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
|
|
215
|
-
(
|
|
216
|
-
|
|
217
|
-
if (!_includesInstanceProperty(_context = this.addresses()).call(_context, onAccount)) {
|
|
190
|
+
if (!this.addresses().includes(onAccount)) {
|
|
218
191
|
throw new RpcPermissionDenyError(onAccount);
|
|
219
192
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}, origin);
|
|
226
|
-
onAccount = (_overrides$onAccount = overrides === null || overrides === void 0 ? void 0 : overrides.onAccount) !== null && _overrides$onAccount !== void 0 ? _overrides$onAccount : onAccount;
|
|
227
|
-
tx = (_overrides$tx = overrides === null || overrides === void 0 ? void 0 : overrides.tx) !== null && _overrides$tx !== void 0 ? _overrides$tx : tx;
|
|
228
|
-
|
|
193
|
+
const parameters = {
|
|
194
|
+
onAccount,
|
|
195
|
+
aeppOrigin: origin,
|
|
196
|
+
aeppRpcClientId: id
|
|
197
|
+
};
|
|
229
198
|
if (returnSigned) {
|
|
230
199
|
return {
|
|
231
|
-
signedTransaction: await this.signTransaction(tx,
|
|
232
|
-
onAccount
|
|
233
|
-
})
|
|
200
|
+
signedTransaction: await this.signTransaction(tx, parameters)
|
|
234
201
|
};
|
|
235
202
|
}
|
|
236
|
-
|
|
237
203
|
try {
|
|
238
204
|
return jsonBig.parse(jsonBig.stringify({
|
|
239
205
|
transactionHash: await this.send(tx, {
|
|
240
|
-
|
|
206
|
+
...parameters,
|
|
241
207
|
verify: false
|
|
242
208
|
})
|
|
243
209
|
}));
|
|
@@ -248,79 +214,65 @@ export default class AeSdkWallet extends AeSdk {
|
|
|
248
214
|
}
|
|
249
215
|
},
|
|
250
216
|
[METHODS.signMessage]: async (_ref5, origin) => {
|
|
251
|
-
var _onAccount2, _context2, _overrides$onAccount2;
|
|
252
|
-
|
|
253
217
|
let {
|
|
254
218
|
message,
|
|
255
|
-
onAccount
|
|
219
|
+
onAccount = this.address
|
|
256
220
|
} = _ref5;
|
|
257
221
|
if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
|
|
258
|
-
(
|
|
259
|
-
|
|
260
|
-
if (!_includesInstanceProperty(_context2 = this.addresses()).call(_context2, onAccount)) {
|
|
222
|
+
if (!this.addresses().includes(onAccount)) {
|
|
261
223
|
throw new RpcPermissionDenyError(onAccount);
|
|
262
224
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
onAccount = (_overrides$onAccount2 = overrides === null || overrides === void 0 ? void 0 : overrides.onAccount) !== null && _overrides$onAccount2 !== void 0 ? _overrides$onAccount2 : onAccount;
|
|
225
|
+
const parameters = {
|
|
226
|
+
onAccount,
|
|
227
|
+
aeppOrigin: origin,
|
|
228
|
+
aeppRpcClientId: id
|
|
229
|
+
};
|
|
269
230
|
return {
|
|
270
|
-
|
|
271
|
-
signature: await this.signMessage(message, {
|
|
272
|
-
onAccount,
|
|
273
|
-
returnHex: true
|
|
274
|
-
})
|
|
231
|
+
signature: _Buffer.from(await this.signMessage(message, parameters)).toString('hex')
|
|
275
232
|
};
|
|
276
233
|
}
|
|
277
234
|
})
|
|
278
235
|
};
|
|
279
|
-
|
|
280
236
|
this._clients.set(id, client);
|
|
281
|
-
|
|
282
237
|
return id;
|
|
283
238
|
}
|
|
239
|
+
|
|
284
240
|
/**
|
|
285
241
|
* Send shareWalletInfo message to notify AEPP about wallet
|
|
286
242
|
* @param clientId - ID of RPC client send message to
|
|
287
243
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
244
|
async shareWalletInfo(clientId) {
|
|
291
245
|
this._getClient(clientId).rpc.notify(METHODS.readyToConnect, await this.getWalletInfo());
|
|
292
246
|
}
|
|
247
|
+
|
|
293
248
|
/**
|
|
294
249
|
* Get Wallet info object
|
|
295
250
|
* @returns Object with wallet information
|
|
296
251
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
252
|
async getWalletInfo() {
|
|
300
253
|
return {
|
|
301
254
|
id: this.id,
|
|
302
255
|
name: this.name,
|
|
303
|
-
networkId: await this.getNetworkId(),
|
|
256
|
+
networkId: await this.api.getNetworkId(),
|
|
304
257
|
origin: window.location.origin,
|
|
305
258
|
type: this._type
|
|
306
259
|
};
|
|
307
260
|
}
|
|
261
|
+
|
|
308
262
|
/**
|
|
309
263
|
* Get Wallet accounts
|
|
310
264
|
* @returns Object with accounts information (\{ connected: Object, current: Object \})
|
|
311
265
|
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
266
|
getAccounts() {
|
|
315
267
|
return {
|
|
316
268
|
current: this.selectedAddress != null ? {
|
|
317
269
|
[this.selectedAddress]: {}
|
|
318
270
|
} : {},
|
|
319
|
-
connected: this.addresses().filter(a => a !== this.selectedAddress).reduce((acc, a) => ({
|
|
271
|
+
connected: this.addresses().filter(a => a !== this.selectedAddress).reduce((acc, a) => ({
|
|
272
|
+
...acc,
|
|
320
273
|
[a]: {}
|
|
321
274
|
}), {})
|
|
322
275
|
};
|
|
323
276
|
}
|
|
324
|
-
|
|
325
277
|
}
|
|
326
278
|
//# sourceMappingURL=AeSdkWallet.mjs.map
|
package/es/AeSdkWallet.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeSdkWallet.mjs","names":["v4","uuid","AeSdk","verifyTransaction","RpcClient","METHODS","RPC_STATUS","SUBSCRIPTION_TYPES","RpcBroadcastError","RpcInvalidTransactionError","RpcNotAuthorizeError","RpcPermissionDenyError","RpcUnsupportedProtocolError","InternalError","UnknownRpcClientError","RPC_VERSION","jsonBig","AeSdkWallet","constructor","name","id","type","onConnection","onSubscription","onSign","onDisconnect","onAskAccounts","onMessageSign","options","_clients","Map","_type","_pushAccountsToApps","Array","from","keys","filter","clientId","_isRpcClientSubscribed","map","_getClient","rpc","forEach","client","notify","updateAddress","getAccounts","selectAccount","address","addAccount","account","_getNode","ensureNodeConnected","node","url","api","selectedNodeName","selectNode","networkId","getNetworkId","_isRpcClientConnected","updateNetwork","connectNode","get","addressSubscription","size","CONNECTED","status","connection","isConnected","_disconnectRpcClient","disconnect","DISCONNECTED","Set","removeRpcClient","delete","addRpcClient","clientConnection","disconnectParams","WAITING_FOR_CONNECTION_REQUEST","closeConnection","params","connect","origin","version","icons","getWalletInfo","subscribeAddress","value","subscribe","add","unsubscribe","subscription","addresses","sign","tx","onAccount","returnSigned","overrides","signedTransaction","signTransaction","parse","stringify","transactionHash","send","verify","error","validation","length","message","signMessage","signature","returnHex","set","shareWalletInfo","readyToConnect","window","location","current","selectedAddress","connected","a","reduce","acc"],"sources":["../src/AeSdkWallet.ts"],"sourcesContent":["import { v4 as uuid } from '@aeternity/uuid';\nimport AeSdk from './AeSdk';\nimport { Account } from './AeSdkBase';\nimport verifyTransaction from './tx/validator';\nimport RpcClient from './aepp-wallet-communication/rpc/RpcClient';\nimport {\n METHODS, RPC_STATUS, SUBSCRIPTION_TYPES, WALLET_TYPE,\n RpcBroadcastError, RpcInvalidTransactionError,\n RpcNotAuthorizeError, RpcPermissionDenyError, RpcUnsupportedProtocolError,\n} from './aepp-wallet-communication/schema';\nimport { InternalError, UnknownRpcClientError } from './utils/errors';\nimport AccountBase from './account/Base';\nimport BrowserConnection from './aepp-wallet-communication/connection/Browser';\nimport {\n Accounts,\n AeppApi,\n Network,\n RPC_VERSION,\n WalletApi,\n WalletInfo,\n} from './aepp-wallet-communication/rpc/types';\nimport { Encoded } from './utils/encoder';\nimport jsonBig from './utils/json-big';\n\ntype RpcClientWallet = RpcClient<AeppApi, WalletApi>;\n\ntype OnConnection = (\n clientId: string, params: Omit<Parameters<WalletApi[METHODS.connect]>[0], 'version'>, origin: string\n) => void;\n\ntype OnSubscription = (\n clientId: string, params: Parameters<WalletApi[METHODS.subscribeAddress]>[0], origin: string\n) => void;\n\ntype OnSign = (\n clientId: string, params: Parameters<WalletApi[METHODS.sign]>[0], origin: string\n) => Promise<{ tx?: Encoded.Transaction; onAccount?: Account } | undefined> | Promise<void>;\n\ntype OnDisconnect = (\n clientId: string, params: Parameters<WalletApi[METHODS.closeConnection]>[0]\n) => void;\n\ntype OnAskAccounts = (\n clientId: string, params: undefined, origin: string\n) => void;\n\ntype OnMessageSign = (\n clientId: string, params: Parameters<WalletApi[METHODS.signMessage]>[0], origin: string\n) => Promise<{ onAccount?: Account } | undefined> | Promise<void>;\n\ninterface RpcClientsInfo {\n id: string;\n status: RPC_STATUS;\n connectNode: boolean;\n addressSubscription: Set<'connected' | 'current'>;\n rpc: RpcClientWallet;\n}\n\n/**\n * Contain functionality for aepp interaction and managing multiple aepps\n * @category aepp wallet communication\n */\nexport default class AeSdkWallet extends AeSdk {\n id: string;\n\n _type: WALLET_TYPE;\n\n name: string;\n\n _clients: Map<string, RpcClientsInfo>;\n\n onConnection: OnConnection;\n\n onSubscription: OnSubscription;\n\n onSign: OnSign;\n\n onDisconnect: OnDisconnect;\n\n onAskAccounts: OnAskAccounts;\n\n onMessageSign: OnMessageSign;\n\n /**\n * @param options - Options\n * @param options.name - Wallet name\n * @param options.id - Wallet id\n * @param options.type - Wallet type\n * @param options.onConnection - Call-back function for incoming AEPP connection\n * @param options.onSubscription - Call-back function for incoming AEPP account subscription\n * @param options.onSign - Call-back function for incoming AEPP sign request\n * @param options.onAskAccounts - Call-back function for incoming AEPP get address request\n * @param options.onMessageSign - Call-back function for incoming AEPP sign message request\n * @param options.onDisconnect - Call-back function for disconnect event\n */\n constructor({\n name,\n id,\n type,\n onConnection,\n onSubscription,\n onSign,\n onDisconnect,\n onAskAccounts,\n onMessageSign,\n ...options\n }: {\n id: string;\n type: WALLET_TYPE;\n name: string;\n onConnection: OnConnection;\n onSubscription: OnSubscription;\n onSign: OnSign;\n onDisconnect: OnDisconnect;\n onAskAccounts: OnAskAccounts;\n onMessageSign: OnMessageSign;\n } & ConstructorParameters<typeof AeSdk>[0]) {\n super(options);\n this.onConnection = onConnection;\n this.onSubscription = onSubscription;\n this.onSign = onSign;\n this.onDisconnect = onDisconnect;\n this.onAskAccounts = onAskAccounts;\n this.onMessageSign = onMessageSign;\n this._clients = new Map();\n this.name = name;\n this.id = id;\n this._type = type;\n }\n\n _pushAccountsToApps(): void {\n Array.from(this._clients.keys())\n .filter((clientId) => this._isRpcClientSubscribed(clientId))\n .map((clientId) => this._getClient(clientId).rpc)\n .forEach((client) => client.notify(METHODS.updateAddress, this.getAccounts()));\n }\n\n selectAccount(address: Encoded.AccountAddress): void {\n super.selectAccount(address);\n this._pushAccountsToApps();\n }\n\n async addAccount(\n account: AccountBase,\n options?: Parameters<AeSdk['addAccount']>[1],\n ): Promise<void> {\n await super.addAccount(account, options);\n this._pushAccountsToApps();\n }\n\n _getNode(): { node: Network['node'] } {\n this.ensureNodeConnected();\n return { node: { url: this.api.url, name: this.selectedNodeName } };\n }\n\n async selectNode(name: string): Promise<void> {\n super.selectNode(name);\n const networkId = await this.getNetworkId();\n Array.from(this._clients.keys())\n .filter((clientId) => this._isRpcClientConnected(clientId))\n .map((clientId) => this._getClient(clientId))\n .forEach((client) => {\n client.rpc.notify(METHODS.updateNetwork, {\n networkId,\n ...client.connectNode && this._getNode(),\n });\n });\n }\n\n _getClient(clientId: string): RpcClientsInfo {\n const client = this._clients.get(clientId);\n if (client == null) throw new UnknownRpcClientError(clientId);\n return client;\n }\n\n _isRpcClientSubscribed(clientId: string): boolean {\n return this._isRpcClientConnected(clientId)\n && this._getClient(clientId).addressSubscription.size !== 0;\n }\n\n _isRpcClientConnected(clientId: string): boolean {\n return RPC_STATUS.CONNECTED === this._getClient(clientId).status\n && this._getClient(clientId).rpc.connection.isConnected();\n }\n\n _disconnectRpcClient(clientId: string): void {\n const client = this._getClient(clientId);\n client.rpc.connection.disconnect();\n client.status = RPC_STATUS.DISCONNECTED;\n client.addressSubscription = new Set();\n }\n\n /**\n * Remove specific RpcClient by ID\n * @param id - Client ID\n */\n removeRpcClient(id: string): void {\n this._disconnectRpcClient(id);\n this._clients.delete(id);\n }\n\n /**\n * Add new client by AEPP connection\n * @param clientConnection - AEPP connection object\n * @returns Client ID\n */\n addRpcClient(clientConnection: BrowserConnection): string {\n // @TODO detect if aepp has some history based on origin????\n // if yes use this instance for connection\n const id = uuid();\n let disconnectParams: any;\n const client: RpcClientsInfo = {\n id,\n status: RPC_STATUS.WAITING_FOR_CONNECTION_REQUEST,\n addressSubscription: new Set(),\n connectNode: false,\n rpc: new RpcClient<AeppApi, WalletApi>(\n clientConnection,\n () => {\n this._clients.delete(id);\n this.onDisconnect(id, disconnectParams); // also related info\n },\n {\n [METHODS.closeConnection]: (params) => {\n disconnectParams = params;\n this._disconnectRpcClient(id);\n },\n // Store client info and prepare two fn for each client `connect` and `denyConnection`\n // which automatically prepare and send response for that client\n [METHODS.connect]: async ({\n name, version, icons, connectNode,\n }, origin) => {\n if (version !== RPC_VERSION) throw new RpcUnsupportedProtocolError();\n\n await this.onConnection(id, { name, icons, connectNode }, origin);\n client.status = RPC_STATUS.CONNECTED;\n client.connectNode = connectNode;\n return {\n ...await this.getWalletInfo(),\n ...connectNode && this._getNode(),\n };\n },\n [METHODS.subscribeAddress]: async ({ type, value }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n\n await this.onSubscription(id, { type, value }, origin);\n\n switch (type) {\n case SUBSCRIPTION_TYPES.subscribe:\n client.addressSubscription.add(value);\n break;\n case SUBSCRIPTION_TYPES.unsubscribe:\n client.addressSubscription.delete(value);\n break;\n default:\n throw new InternalError(`Unknown subscription type: ${type}`);\n }\n\n return {\n subscription: Array.from(client.addressSubscription),\n address: this.getAccounts(),\n };\n },\n [METHODS.address]: async (params, origin) => {\n if (!this._isRpcClientSubscribed(id)) throw new RpcNotAuthorizeError();\n await this.onAskAccounts(id, params, origin);\n return this.addresses();\n },\n [METHODS.sign]: async ({ tx, onAccount, returnSigned }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n onAccount ??= await this.address();\n if (!this.addresses().includes(onAccount)) {\n throw new RpcPermissionDenyError(onAccount);\n }\n\n const overrides = await this.onSign(id, { tx, returnSigned, onAccount }, origin);\n onAccount = overrides?.onAccount ?? onAccount;\n tx = overrides?.tx ?? tx;\n if (returnSigned) {\n return { signedTransaction: await this.signTransaction(tx, { onAccount }) };\n }\n try {\n return jsonBig.parse(jsonBig.stringify({\n transactionHash: await this.send(tx, { onAccount, verify: false }),\n }));\n } catch (error) {\n const validation = await verifyTransaction(tx, this.api);\n if (validation.length > 0) throw new RpcInvalidTransactionError(validation);\n throw new RpcBroadcastError(error.message);\n }\n },\n [METHODS.signMessage]: async ({ message, onAccount }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n onAccount ??= await this.address();\n if (!this.addresses().includes(onAccount)) {\n throw new RpcPermissionDenyError(onAccount);\n }\n\n const overrides = await this.onMessageSign(id, { message, onAccount }, origin);\n onAccount = overrides?.onAccount ?? onAccount;\n return {\n // TODO: fix signMessage return type\n signature: await this.signMessage(message, { onAccount, returnHex: true }) as\n unknown as string,\n };\n },\n },\n ),\n };\n this._clients.set(id, client);\n return id;\n }\n\n /**\n * Send shareWalletInfo message to notify AEPP about wallet\n * @param clientId - ID of RPC client send message to\n */\n async shareWalletInfo(clientId: string): Promise<void> {\n this._getClient(clientId).rpc.notify(METHODS.readyToConnect, await this.getWalletInfo());\n }\n\n /**\n * Get Wallet info object\n * @returns Object with wallet information\n */\n async getWalletInfo(): Promise<WalletInfo> {\n return {\n id: this.id,\n name: this.name,\n networkId: await this.getNetworkId(),\n origin: window.location.origin,\n type: this._type,\n };\n }\n\n /**\n * Get Wallet accounts\n * @returns Object with accounts information (\\{ connected: Object, current: Object \\})\n */\n getAccounts(): Accounts {\n return {\n current: this.selectedAddress != null ? { [this.selectedAddress]: {} } : {},\n connected: this.addresses()\n .filter((a) => a !== this.selectedAddress)\n .reduce((acc, a) => ({ ...acc, [a]: {} }), {}),\n };\n }\n}\n"],"mappings":";AAAA,SAASA,EAAE,IAAIC,IAAf,QAA2B,iBAA3B;OACOC,K;OAEAC,iB;OACAC,S;SAELC,O,EAASC,U,EAAYC,kB,EACrBC,iB,EAAmBC,0B,EACnBC,oB,EAAsBC,sB,EAAwBC,2B;SAEvCC,a,EAAeC,qB;SAOtBC,W;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KnF,QAAL,CAAcoF,GAAd,CAAkB7F,EAAlB,EAAsBuB,MAAtB;;IACA,OAAOvB,EAAP;EACD;EAED;AACF;AACA;AACA;;;EACuB,MAAf8F,eAAe,CAAC7E,QAAD,EAAkC;IACrD,KAAKG,UAAL,CAAgBH,QAAhB,EAA0BI,GAA1B,CAA8BG,MAA9B,CAAqCvC,OAAO,CAAC8G,cAA7C,EAA6D,MAAM,KAAK7B,aAAL,EAAnE;EACD;EAED;AACF;AACA;AACA;;;EACqB,MAAbA,aAAa,GAAwB;IACzC,OAAO;MACLlE,EAAE,EAAE,KAAKA,EADJ;MAELD,IAAI,EAAE,KAAKA,IAFN;MAGLuC,SAAS,EAAE,MAAM,KAAKC,YAAL,EAHZ;MAILwB,MAAM,EAAEiC,MAAM,CAACC,QAAP,CAAgBlC,MAJnB;MAKL9D,IAAI,EAAE,KAAKU;IALN,CAAP;EAOD;EAED;AACF;AACA;AACA;;;EACEe,WAAW,GAAa;IACtB,OAAO;MACLwE,OAAO,EAAE,KAAKC,eAAL,IAAwB,IAAxB,GAA+B;QAAE,CAAC,KAAKA,eAAN,GAAwB;MAA1B,CAA/B,GAAgE,EADpE;MAELC,SAAS,EAAE,KAAK3B,SAAL,GACRzD,MADQ,CACAqF,CAAD,IAAOA,CAAC,KAAK,KAAKF,eADjB,EAERG,MAFQ,CAED,CAACC,GAAD,EAAMF,CAAN,MAAa,EAAE,GAAGE,GAAL;QAAU,CAACF,CAAD,GAAK;MAAf,CAAb,CAFC,EAEkC,EAFlC;IAFN,CAAP;EAMD;;AA5R4C"}
|
|
1
|
+
{"version":3,"file":"AeSdkWallet.mjs","names":["v4","uuid","AeSdk","verifyTransaction","RpcClient","METHODS","RPC_STATUS","SUBSCRIPTION_TYPES","RpcBroadcastError","RpcInvalidTransactionError","RpcNotAuthorizeError","RpcPermissionDenyError","RpcUnsupportedProtocolError","InternalError","UnknownRpcClientError","RPC_VERSION","jsonBig","AeSdkWallet","constructor","name","id","type","onConnection","onSubscription","onDisconnect","onAskAccounts","options","Map","_type","_pushAccountsToApps","_clients","Array","from","keys","filter","clientId","_isRpcClientSubscribed","map","_getClient","rpc","forEach","client","notify","updateAddress","getAccounts","selectAccount","address","addAccount","account","_getNode","ensureNodeConnected","node","url","api","$host","selectedNodeName","selectNode","networkId","getNetworkId","_isRpcClientConnected","updateNetwork","connectNode","get","addressSubscription","size","CONNECTED","status","connection","isConnected","_disconnectRpcClient","disconnect","DISCONNECTED","Set","removeRpcClient","delete","addRpcClient","clientConnection","disconnectParams","WAITING_FOR_CONNECTION_REQUEST","closeConnection","params","connect","origin","version","icons","getWalletInfo","subscribeAddress","value","subscribe","add","unsubscribe","subscription","addresses","sign","tx","onAccount","returnSigned","includes","parameters","aeppOrigin","aeppRpcClientId","signedTransaction","signTransaction","parse","stringify","transactionHash","send","verify","error","validation","length","message","signMessage","signature","toString","set","shareWalletInfo","readyToConnect","window","location","current","selectedAddress","connected","a","reduce","acc"],"sources":["../src/AeSdkWallet.ts"],"sourcesContent":["import { v4 as uuid } from '@aeternity/uuid';\nimport AeSdk from './AeSdk';\nimport verifyTransaction from './tx/validator';\nimport RpcClient from './aepp-wallet-communication/rpc/RpcClient';\nimport {\n METHODS, RPC_STATUS, SUBSCRIPTION_TYPES, WALLET_TYPE,\n RpcBroadcastError, RpcInvalidTransactionError,\n RpcNotAuthorizeError, RpcPermissionDenyError, RpcUnsupportedProtocolError,\n} from './aepp-wallet-communication/schema';\nimport { InternalError, UnknownRpcClientError } from './utils/errors';\nimport AccountBase from './account/Base';\nimport BrowserConnection from './aepp-wallet-communication/connection/Browser';\nimport {\n Accounts,\n AeppApi,\n Network,\n RPC_VERSION,\n WalletApi,\n WalletInfo,\n} from './aepp-wallet-communication/rpc/types';\nimport { Encoded } from './utils/encoder';\nimport jsonBig from './utils/json-big';\n\ntype RpcClientWallet = RpcClient<AeppApi, WalletApi>;\n\ntype OnConnection = (\n clientId: string, params: Omit<Parameters<WalletApi[METHODS.connect]>[0], 'version'>, origin: string\n) => void;\n\ntype OnSubscription = (\n clientId: string, params: Parameters<WalletApi[METHODS.subscribeAddress]>[0], origin: string\n) => void;\n\ntype OnDisconnect = (\n clientId: string, params: Parameters<WalletApi[METHODS.closeConnection]>[0]\n) => void;\n\ntype OnAskAccounts = (\n clientId: string, params: undefined, origin: string\n) => void;\n\ninterface RpcClientsInfo {\n id: string;\n status: RPC_STATUS;\n connectNode: boolean;\n addressSubscription: Set<'connected' | 'current'>;\n rpc: RpcClientWallet;\n}\n\n/**\n * Contain functionality for aepp interaction and managing multiple aepps\n * @category aepp wallet communication\n */\nexport default class AeSdkWallet extends AeSdk {\n id: string;\n\n _type: WALLET_TYPE;\n\n name: string;\n\n _clients = new Map<string, RpcClientsInfo>();\n\n onConnection: OnConnection;\n\n onSubscription: OnSubscription;\n\n onDisconnect: OnDisconnect;\n\n onAskAccounts: OnAskAccounts;\n\n /**\n * @param options - Options\n * @param options.name - Wallet name\n * @param options.id - Wallet id\n * @param options.type - Wallet type\n * @param options.onConnection - Call-back function for incoming AEPP connection\n * @param options.onSubscription - Call-back function for incoming AEPP account subscription\n * @param options.onAskAccounts - Call-back function for incoming AEPP get address request\n * @param options.onDisconnect - Call-back function for disconnect event\n */\n constructor({\n name,\n id,\n type,\n onConnection,\n onSubscription,\n onDisconnect,\n onAskAccounts,\n ...options\n }: {\n id: string;\n type: WALLET_TYPE;\n name: string;\n onConnection: OnConnection;\n onSubscription: OnSubscription;\n onDisconnect: OnDisconnect;\n onAskAccounts: OnAskAccounts;\n } & ConstructorParameters<typeof AeSdk>[0]) {\n super(options);\n this.onConnection = onConnection;\n this.onSubscription = onSubscription;\n this.onDisconnect = onDisconnect;\n this.onAskAccounts = onAskAccounts;\n this.name = name;\n this.id = id;\n this._type = type;\n }\n\n _pushAccountsToApps(): void {\n if (this._clients == null) return;\n Array.from(this._clients.keys())\n .filter((clientId) => this._isRpcClientSubscribed(clientId))\n .map((clientId) => this._getClient(clientId).rpc)\n .forEach((client) => client.notify(METHODS.updateAddress, this.getAccounts()));\n }\n\n override selectAccount(address: Encoded.AccountAddress): void {\n super.selectAccount(address);\n this._pushAccountsToApps();\n }\n\n override addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]): void {\n super.addAccount(account, options);\n this._pushAccountsToApps();\n }\n\n _getNode(): { node: Network['node'] } {\n this.ensureNodeConnected();\n return { node: { url: this.api.$host, name: this.selectedNodeName } };\n }\n\n override async selectNode(name: string): Promise<void> {\n super.selectNode(name);\n const networkId = await this.api.getNetworkId();\n Array.from(this._clients.keys())\n .filter((clientId) => this._isRpcClientConnected(clientId))\n .map((clientId) => this._getClient(clientId))\n .forEach((client) => {\n client.rpc.notify(METHODS.updateNetwork, {\n networkId,\n ...client.connectNode && this._getNode(),\n });\n });\n }\n\n _getClient(clientId: string): RpcClientsInfo {\n const client = this._clients.get(clientId);\n if (client == null) throw new UnknownRpcClientError(clientId);\n return client;\n }\n\n _isRpcClientSubscribed(clientId: string): boolean {\n return this._isRpcClientConnected(clientId)\n && this._getClient(clientId).addressSubscription.size !== 0;\n }\n\n _isRpcClientConnected(clientId: string): boolean {\n return RPC_STATUS.CONNECTED === this._getClient(clientId).status\n && this._getClient(clientId).rpc.connection.isConnected();\n }\n\n _disconnectRpcClient(clientId: string): void {\n const client = this._getClient(clientId);\n client.rpc.connection.disconnect();\n client.status = RPC_STATUS.DISCONNECTED;\n client.addressSubscription = new Set();\n }\n\n /**\n * Remove specific RpcClient by ID\n * @param id - Client ID\n */\n removeRpcClient(id: string): void {\n this._disconnectRpcClient(id);\n this._clients.delete(id);\n }\n\n /**\n * Add new client by AEPP connection\n * @param clientConnection - AEPP connection object\n * @returns Client ID\n */\n addRpcClient(clientConnection: BrowserConnection): string {\n // @TODO detect if aepp has some history based on origin????\n // if yes use this instance for connection\n const id = uuid();\n let disconnectParams: any;\n const client: RpcClientsInfo = {\n id,\n status: RPC_STATUS.WAITING_FOR_CONNECTION_REQUEST,\n addressSubscription: new Set(),\n connectNode: false,\n rpc: new RpcClient<AeppApi, WalletApi>(\n clientConnection,\n () => {\n this._clients.delete(id);\n this.onDisconnect(id, disconnectParams); // also related info\n },\n {\n [METHODS.closeConnection]: (params) => {\n disconnectParams = params;\n this._disconnectRpcClient(id);\n },\n // Store client info and prepare two fn for each client `connect` and `denyConnection`\n // which automatically prepare and send response for that client\n [METHODS.connect]: async ({\n name, version, icons, connectNode,\n }, origin) => {\n if (version !== RPC_VERSION) throw new RpcUnsupportedProtocolError();\n\n await this.onConnection(id, { name, icons, connectNode }, origin);\n client.status = RPC_STATUS.CONNECTED;\n client.connectNode = connectNode;\n return {\n ...await this.getWalletInfo(),\n ...connectNode && this._getNode(),\n };\n },\n [METHODS.subscribeAddress]: async ({ type, value }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n\n await this.onSubscription(id, { type, value }, origin);\n\n switch (type) {\n case SUBSCRIPTION_TYPES.subscribe:\n client.addressSubscription.add(value);\n break;\n case SUBSCRIPTION_TYPES.unsubscribe:\n client.addressSubscription.delete(value);\n break;\n default:\n throw new InternalError(`Unknown subscription type: ${type}`);\n }\n\n return {\n subscription: Array.from(client.addressSubscription),\n address: this.getAccounts(),\n };\n },\n [METHODS.address]: async (params, origin) => {\n if (!this._isRpcClientSubscribed(id)) throw new RpcNotAuthorizeError();\n await this.onAskAccounts(id, params, origin);\n return this.addresses();\n },\n [METHODS.sign]: async ({ tx, onAccount = this.address, returnSigned }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n if (!this.addresses().includes(onAccount)) {\n throw new RpcPermissionDenyError(onAccount);\n }\n\n const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };\n if (returnSigned) {\n return { signedTransaction: await this.signTransaction(tx, parameters) };\n }\n try {\n return jsonBig.parse(jsonBig.stringify({\n transactionHash: await this.send(tx, { ...parameters, verify: false }),\n }));\n } catch (error) {\n const validation = await verifyTransaction(tx, this.api);\n if (validation.length > 0) throw new RpcInvalidTransactionError(validation);\n throw new RpcBroadcastError(error.message);\n }\n },\n [METHODS.signMessage]: async ({ message, onAccount = this.address }, origin) => {\n if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();\n if (!this.addresses().includes(onAccount)) {\n throw new RpcPermissionDenyError(onAccount);\n }\n\n const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };\n return {\n signature: Buffer.from(await this.signMessage(message, parameters)).toString('hex'),\n };\n },\n },\n ),\n };\n this._clients.set(id, client);\n return id;\n }\n\n /**\n * Send shareWalletInfo message to notify AEPP about wallet\n * @param clientId - ID of RPC client send message to\n */\n async shareWalletInfo(clientId: string): Promise<void> {\n this._getClient(clientId).rpc.notify(METHODS.readyToConnect, await this.getWalletInfo());\n }\n\n /**\n * Get Wallet info object\n * @returns Object with wallet information\n */\n async getWalletInfo(): Promise<WalletInfo> {\n return {\n id: this.id,\n name: this.name,\n networkId: await this.api.getNetworkId(),\n origin: window.location.origin,\n type: this._type,\n };\n }\n\n /**\n * Get Wallet accounts\n * @returns Object with accounts information (\\{ connected: Object, current: Object \\})\n */\n getAccounts(): Accounts {\n return {\n current: this.selectedAddress != null ? { [this.selectedAddress]: {} } : {},\n connected: this.addresses()\n .filter((a) => a !== this.selectedAddress)\n .reduce((acc, a) => ({ ...acc, [a]: {} }), {}),\n };\n }\n}\n"],"mappings":";;;;;AAAA,SAASA,EAAE,IAAIC,IAAI,QAAQ,iBAAiB;AAAC,OACtCC,KAAK;AAAA,OACLC,iBAAiB;AAAA,OACjBC,SAAS;AAAA,SAEdC,OAAO,EAAEC,UAAU,EAAEC,kBAAkB,EACvCC,iBAAiB,EAAEC,0BAA0B,EAC7CC,oBAAoB,EAAEC,sBAAsB,EAAEC,2BAA2B;AAAA,SAElEC,aAAa,EAAEC,qBAAqB;AAAA,SAO3CC,WAAW;AAAA,OAKNC,OAAO;AA4Bd;AACA;AACA;AACA;AACA,eAAe,MAAMC,WAAW,SAASf,KAAK,CAAC;EAiB7C;AACF;AACA;AACA;A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EAAE,CAAC;EAC1F;;EAEA;AACF;AACA;AACA;EACE,MAAMA,aAAa,GAAwB;IACzC,OAAO;MACLjE,EAAE,EAAE,IAAI,CAACA,EAAE;MACXD,IAAI,EAAE,IAAI,CAACA,IAAI;MACfsC,SAAS,EAAE,MAAM,IAAI,CAACJ,GAAG,CAACK,YAAY,EAAE;MACxCwB,MAAM,EAAEoC,MAAM,CAACC,QAAQ,CAACrC,MAAM;MAC9B7D,IAAI,EAAE,IAAI,CAACO;IACb,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACEgB,WAAW,GAAa;IACtB,OAAO;MACL4E,OAAO,EAAE,IAAI,CAACC,eAAe,IAAI,IAAI,GAAG;QAAE,CAAC,IAAI,CAACA,eAAe,GAAG,CAAC;MAAE,CAAC,GAAG,CAAC,CAAC;MAC3EC,SAAS,EAAE,IAAI,CAAC9B,SAAS,EAAE,CACxB1D,MAAM,CAAEyF,CAAC,IAAKA,CAAC,KAAK,IAAI,CAACF,eAAe,CAAC,CACzCG,MAAM,CAAC,CAACC,GAAG,EAAEF,CAAC,MAAM;QAAE,GAAGE,GAAG;QAAE,CAACF,CAAC,GAAG,CAAC;MAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;EACH;AACF"}
|
package/es/Node.d.ts
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
import { Node as NodeApi, NodeOptionalParams } from './apis/node';
|
|
2
2
|
import { Encoded } from './utils/encoder';
|
|
3
|
-
|
|
4
|
-
* Obtain networkId from account or node
|
|
5
|
-
*/
|
|
6
|
-
export declare function getNetworkId({ networkId }?: {
|
|
7
|
-
networkId?: string;
|
|
8
|
-
}): Promise<string>;
|
|
3
|
+
import { ConsensusProtocolVersion } from './tx/builder/constants';
|
|
9
4
|
declare const bigIntPropertyNames: readonly ["balance", "queryFee", "fee", "amount", "nameFee", "channelAmount", "initiatorAmount", "responderAmount", "channelReserve", "initiatorAmountFinal", "responderAmountFinal", "gasPrice", "deposit"];
|
|
10
|
-
declare const numberPropertyNames: readonly ["time", "gas", "gasUsed", "nameSalt", "nonce", "nextNonce", "height", "blockHeight", "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
5
|
+
declare const numberPropertyNames: readonly ["time", "gas", "gasUsed", "nameSalt", "nonce", "nextNonce", "height", "blockHeight", "topBlockHeight", "ttl", "nameTtl", "clientTtl", "inbound", "outbound", "peerCount", "pendingTransactionsCount", "effectiveAtHeight", "version", "solutions", "round"];
|
|
6
|
+
type BigIntPropertyNames = typeof bigIntPropertyNames[number];
|
|
7
|
+
type NumberPropertyNames = typeof numberPropertyNames[number];
|
|
8
|
+
type PreserveOptional<NewType, OrigType> = OrigType extends undefined ? NewType | undefined : NewType;
|
|
9
|
+
export type TransformNodeType<Type> = Type extends (...args: infer Args) => infer Ret ? (...args: TransformNodeType<Args>) => TransformNodeType<Ret> : Type extends [infer Item, ...infer Rest] ? [TransformNodeType<Item>, ...TransformNodeType<Rest>] : Type extends Array<infer Item> ? Array<TransformNodeType<Item>> : Type extends Promise<infer T> ? Promise<TransformNodeType<T>> : Type extends {
|
|
15
10
|
[P in any]: any;
|
|
16
11
|
} ? {
|
|
17
|
-
[Property in keyof Type]: Property extends BigIntPropertyNames ? PreserveOptional<bigint, Type[Property]> : Property extends NumberPropertyNames ? PreserveOptional<number, Type[Property]> : Property extends 'txHash' ? PreserveOptional<Encoded.TxHash, Type[Property]> : TransformNodeType<Type[Property]>;
|
|
12
|
+
[Property in keyof Type]: Property extends BigIntPropertyNames ? PreserveOptional<bigint, Type[Property]> : Property extends NumberPropertyNames ? PreserveOptional<number, Type[Property]> : Property extends 'txHash' ? PreserveOptional<Encoded.TxHash, Type[Property]> : Property extends 'bytecode' ? PreserveOptional<Encoded.ContractBytearray, Type[Property]> : TransformNodeType<Type[Property]>;
|
|
18
13
|
} : Type;
|
|
19
|
-
|
|
14
|
+
type NodeTransformedApi = new (...args: ConstructorParameters<typeof NodeApi>) => {
|
|
20
15
|
[Name in keyof InstanceType<typeof NodeApi>]: Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest' ? NodeApi[Name] : TransformNodeType<NodeApi[Name]>;
|
|
21
16
|
};
|
|
22
17
|
export interface NodeInfo {
|
|
23
18
|
url: string;
|
|
24
19
|
nodeNetworkId: string;
|
|
25
20
|
version: string;
|
|
26
|
-
consensusProtocolVersion:
|
|
21
|
+
consensusProtocolVersion: ConsensusProtocolVersion;
|
|
27
22
|
}
|
|
28
23
|
declare const Node_base: NodeTransformedApi;
|
|
29
24
|
export default class Node extends Node_base {
|
|
30
|
-
|
|
25
|
+
#private;
|
|
31
26
|
/**
|
|
32
27
|
* @param url - Url for node API
|
|
33
28
|
* @param options - Options
|
|
@@ -36,6 +31,7 @@ export default class Node extends Node_base {
|
|
|
36
31
|
constructor(url: string, { ignoreVersion, ...options }?: NodeOptionalParams & {
|
|
37
32
|
ignoreVersion?: boolean;
|
|
38
33
|
});
|
|
34
|
+
getNetworkId(): Promise<string>;
|
|
39
35
|
getNodeInfo(): Promise<NodeInfo>;
|
|
40
36
|
}
|
|
41
37
|
export {};
|