@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.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/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 +6580 -8859
- 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 +27 -185
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +124 -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 +7 -12
- package/es/Node.mjs +34 -47
- 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 +111 -0
- package/es/account/Generalized.mjs.map +1 -0
- package/es/account/Ledger.d.ts +28 -0
- package/es/account/Ledger.mjs +101 -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 -65
- 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 +3 -3
- package/es/aens.mjs +42 -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.mjs +3 -7
- 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 +4 -41
- 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 +1 -1
- package/es/chain.mjs +33 -58
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +195 -0
- package/es/channel/Base.mjs +290 -0
- package/es/channel/Base.mjs.map +1 -0
- package/es/channel/Contract.d.ts +247 -0
- package/es/channel/Contract.mjs +420 -0
- package/es/channel/Contract.mjs.map +1 -0
- package/es/channel/Spend.d.ts +217 -0
- package/es/channel/Spend.mjs +383 -0
- package/es/channel/Spend.mjs.map +1 -0
- package/es/channel/handlers.d.ts +8 -21
- package/es/channel/handlers.mjs +141 -891
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.d.ts +27 -21
- package/es/channel/internal.mjs +98 -190
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/{Compiler.d.ts → CompilerHttp.d.ts} +3 -3
- package/es/contract/{Compiler.mjs → CompilerHttp.mjs} +8 -13
- package/es/contract/CompilerHttp.mjs.map +1 -0
- package/es/contract/Contract.d.ts +235 -0
- package/es/contract/Contract.mjs +534 -0
- package/es/contract/Contract.mjs.map +1 -0
- package/es/contract/ga.d.ts +7 -33
- package/es/contract/ga.mjs +20 -112
- package/es/contract/ga.mjs.map +1 -1
- package/es/index.d.ts +9 -6
- package/es/index.mjs +8 -6
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +5 -5
- package/es/oracle.mjs +33 -39
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +3 -3
- package/es/spend.mjs +17 -20
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +2 -1
- package/es/tx/builder/constants.mjs +12 -12
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/address.d.ts +15 -0
- package/es/tx/builder/field-types/address.mjs +42 -0
- package/es/tx/builder/field-types/address.mjs.map +1 -0
- package/es/tx/builder/field-types/addresses.d.ts +6 -0
- package/es/tx/builder/field-types/addresses.mjs +13 -0
- package/es/tx/builder/field-types/addresses.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -2
- 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/deposit.d.ts +0 -1
- 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/enumeration.d.ts +5 -0
- package/es/tx/builder/field-types/enumeration.mjs +21 -0
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +1 -9
- package/es/tx/builder/field-types/fee.mjs +9 -25
- 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.mjs +4 -9
- 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 +23 -11
- package/es/tx/builder/field-types/index.mjs +10 -3
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/name-fee.d.ts +0 -1
- 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 +4 -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/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/u-int.d.ts +1 -1
- 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 +1 -21
- package/es/tx/builder/index.mjs +29 -148
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +336 -176
- package/es/tx/builder/schema.mjs +71 -78
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +3 -33
- package/es/tx/index.mjs +26 -43
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +2 -2
- package/es/tx/validator.mjs +86 -59
- 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 +12 -6
- package/es/utils/errors.mjs +87 -163
- 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/mptree.d.ts +1 -1
- package/es/utils/mptree.mjs +4 -26
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +3 -1
- 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 +86 -47
- package/src/AeSdk.ts +15 -11
- package/src/AeSdkAepp.ts +9 -7
- package/src/AeSdkBase.ts +28 -202
- package/src/AeSdkMethods.ts +170 -0
- package/src/AeSdkWallet.ts +16 -47
- package/src/Node.ts +11 -15
- 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 +10 -9
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +5 -4
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
- 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 +6 -3
- package/src/channel/Base.ts +327 -0
- package/src/channel/Contract.ts +487 -0
- package/src/channel/Spend.ts +403 -0
- package/src/channel/handlers.ts +154 -573
- package/src/channel/internal.ts +113 -142
- package/src/contract/{Compiler.ts → CompilerHttp.ts} +5 -5
- package/src/contract/Contract.ts +620 -0
- package/src/contract/ga.ts +18 -104
- package/src/index.ts +9 -8
- package/src/oracle.ts +7 -7
- package/src/spend.ts +5 -13
- package/src/tx/builder/constants.ts +1 -0
- package/src/tx/builder/field-types/address.ts +52 -0
- package/src/tx/builder/field-types/addresses.ts +18 -0
- package/src/tx/builder/field-types/coin-amount.ts +2 -8
- package/src/tx/builder/field-types/enumeration.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +1 -3
- package/src/tx/builder/field-types/gas-limit.ts +2 -2
- package/src/tx/builder/field-types/gas-price.ts +0 -2
- package/src/tx/builder/field-types/index.ts +16 -6
- package/src/tx/builder/field-types/name-fee.ts +1 -1
- 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/u-int.ts +3 -2
- package/src/tx/builder/helpers.ts +10 -60
- package/src/tx/builder/index.ts +6 -65
- package/src/tx/builder/schema.ts +89 -100
- package/src/tx/index.ts +19 -15
- package/src/tx/validator.ts +36 -18
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
- package/src/utils/autorest.ts +16 -1
- package/src/utils/bytes.ts +5 -33
- package/src/utils/crypto.ts +23 -16
- package/src/utils/encoder.ts +0 -1
- package/src/utils/errors.ts +18 -12
- 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 +141 -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 +18 -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 +248 -0
- package/types-legacy/ts4.2/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.2/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.2/channel/Spend.d.ts +217 -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/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.2/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.2/globals.d.ts +16 -0
- package/types-legacy/ts4.2/index.d.ts +39 -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 +71 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.2/tx/builder/field-types/addresses.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/deposit.d.ts +14 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +17 -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 +12 -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 +85 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +19 -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/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.2/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.2/tx/index.d.ts +34 -0
- package/types-legacy/ts4.2/tx/validator.d.ts +20 -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 +480 -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/mptree.d.ts +32 -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 +141 -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 +18 -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 +248 -0
- package/types-legacy/ts4.5/channel/Base.d.ts +194 -0
- package/types-legacy/ts4.5/channel/Contract.d.ts +247 -0
- package/types-legacy/ts4.5/channel/Spend.d.ts +217 -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/CompilerHttp.d.ts +18 -0
- package/types-legacy/ts4.5/contract/Contract.d.ts +237 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +43 -0
- package/types-legacy/ts4.5/index.d.ts +38 -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 +71 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +22 -0
- package/types-legacy/ts4.5/tx/builder/field-types/addresses.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/deposit.d.ts +14 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +17 -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 +12 -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 +85 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +19 -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/short-u-int.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +8 -0
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
- package/types-legacy/ts4.5/tx/builder/index.d.ts +68 -0
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2963 -0
- package/types-legacy/ts4.5/tx/index.d.ts +34 -0
- package/types-legacy/ts4.5/tx/validator.d.ts +20 -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 +480 -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/mptree.d.ts +32 -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.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/src/channel/index.ts +0 -1025
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserWindowMessage.mjs","names":["BrowserConnection","MESSAGE_DIRECTION","InternalError","RpcConnectionError","BrowserWindowMessageConnection","constructor","target","self","window","origin","sendDirection","receiveDirection","to_aepp","options","isConnected","listener","connect","onMessage","onDisconnect","message","data","jsonrpc","source","receiveMessage","type","addEventListener","disconnect","removeEventListener","undefined","sendMessage","msg","postMessage"],"sources":["../../../src/aepp-wallet-communication/connection/BrowserWindowMessage.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport BrowserConnection from './Browser';\nimport { MESSAGE_DIRECTION } from '../schema';\nimport { InternalError, RpcConnectionError } from '../../utils/errors';\n\nexport type ImplPostMessage = Pick<Window, 'addEventListener' | 'removeEventListener' | 'postMessage'>;\n\n/**\n * Browser window Post Message connector module\n * @category aepp wallet communication\n */\nexport default class BrowserWindowMessageConnection extends BrowserConnection {\n origin?: string;\n\n sendDirection?: MESSAGE_DIRECTION;\n\n receiveDirection: MESSAGE_DIRECTION;\n\n listener?: (this: Window, ev: MessageEvent<any>) => void;\n\n #onDisconnect?: () => void;\n\n #target?: ImplPostMessage;\n\n #self: ImplPostMessage;\n\n /**\n * @param options - Options\n * @param options.target Target window for message\n * @param options.self Host window for message\n * @param options.origin Origin of receiver\n * @param options.sendDirection Wrapping messages into additional struct\n * `({ type: 'to_aepp' || 'to_waellet', data })`\n * Used for handling messages between content script and page\n * @param options.receiveDirection Unwrapping messages from additional struct\n */\n constructor({\n target,\n self = window,\n origin,\n sendDirection,\n receiveDirection = MESSAGE_DIRECTION.to_aepp,\n ...options\n }: {\n target?: ImplPostMessage;\n self?: ImplPostMessage;\n origin?: string;\n sendDirection?: MESSAGE_DIRECTION;\n receiveDirection?: MESSAGE_DIRECTION;\n debug?: boolean;\n } = {}) {\n super(options);\n this.#target = target;\n this.#self = self;\n this.origin = origin;\n this.sendDirection = sendDirection;\n this.receiveDirection = receiveDirection;\n }\n\n isConnected(): boolean {\n return this.listener != null;\n }\n\n connect(\n onMessage: (message: any, origin: string, source: MessageEventSource | null) => void,\n onDisconnect: () => void,\n ): void {\n super.connect(onMessage, onDisconnect);\n this.listener = (message: MessageEvent<any>) => {\n // TODO: strict validate origin and source instead of checking message structure\n if (\n typeof message.data !== 'object'\n || (message.data.jsonrpc ?? message.data.data?.jsonrpc) !== '2.0'\n ) return;\n if (this.origin != null && this.origin !== message.origin) return;\n if (this.#target != null && this.#target !== message.source) return;\n this.receiveMessage(message);\n let { data } = message;\n if (data.type != null) {\n if (message.data.type !== this.receiveDirection) return;\n data = data.data;\n }\n onMessage(data, message.origin, message.source);\n };\n this.#self.addEventListener('message', this.listener);\n this.#onDisconnect = onDisconnect;\n }\n\n disconnect(): void {\n super.disconnect();\n if (this.listener == null || this.#onDisconnect == null) {\n throw new InternalError('Expected to not happen, required for TS');\n }\n this.#self.removeEventListener('message', this.listener);\n delete this.listener;\n this.#onDisconnect();\n this.#onDisconnect = undefined;\n }\n\n sendMessage(msg: any): void {\n if (this.#target == null) throw new RpcConnectionError('Can\\'t send messages without target');\n const message = this.sendDirection != null ? { type: this.sendDirection, data: msg } : msg;\n super.sendMessage(message);\n this.#target.postMessage(message, this.origin ?? '*');\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BrowserWindowMessage.mjs","names":["BrowserConnection","MESSAGE_DIRECTION","InternalError","RpcConnectionError","BrowserWindowMessageConnection","constructor","target","self","window","origin","sendDirection","receiveDirection","to_aepp","options","isConnected","listener","connect","onMessage","onDisconnect","message","data","jsonrpc","source","receiveMessage","type","addEventListener","disconnect","removeEventListener","undefined","sendMessage","msg","postMessage"],"sources":["../../../src/aepp-wallet-communication/connection/BrowserWindowMessage.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport BrowserConnection from './Browser';\nimport { MESSAGE_DIRECTION } from '../schema';\nimport { InternalError, RpcConnectionError } from '../../utils/errors';\n\nexport type ImplPostMessage = Pick<Window, 'addEventListener' | 'removeEventListener' | 'postMessage'>;\n\n/**\n * Browser window Post Message connector module\n * @category aepp wallet communication\n */\nexport default class BrowserWindowMessageConnection extends BrowserConnection {\n origin?: string;\n\n sendDirection?: MESSAGE_DIRECTION;\n\n receiveDirection: MESSAGE_DIRECTION;\n\n listener?: (this: Window, ev: MessageEvent<any>) => void;\n\n #onDisconnect?: () => void;\n\n #target?: ImplPostMessage;\n\n #self: ImplPostMessage;\n\n /**\n * @param options - Options\n * @param options.target Target window for message\n * @param options.self Host window for message\n * @param options.origin Origin of receiver\n * @param options.sendDirection Wrapping messages into additional struct\n * `({ type: 'to_aepp' || 'to_waellet', data })`\n * Used for handling messages between content script and page\n * @param options.receiveDirection Unwrapping messages from additional struct\n */\n constructor({\n target,\n self = window,\n origin,\n sendDirection,\n receiveDirection = MESSAGE_DIRECTION.to_aepp,\n ...options\n }: {\n target?: ImplPostMessage;\n self?: ImplPostMessage;\n origin?: string;\n sendDirection?: MESSAGE_DIRECTION;\n receiveDirection?: MESSAGE_DIRECTION;\n debug?: boolean;\n } = {}) {\n super(options);\n this.#target = target;\n this.#self = self;\n this.origin = origin;\n this.sendDirection = sendDirection;\n this.receiveDirection = receiveDirection;\n }\n\n isConnected(): boolean {\n return this.listener != null;\n }\n\n override connect(\n onMessage: (message: any, origin: string, source: MessageEventSource | null) => void,\n onDisconnect: () => void,\n ): void {\n super.connect(onMessage, onDisconnect);\n this.listener = (message: MessageEvent<any>) => {\n // TODO: strict validate origin and source instead of checking message structure\n if (\n typeof message.data !== 'object'\n || (message.data.jsonrpc ?? message.data.data?.jsonrpc) !== '2.0'\n ) return;\n if (this.origin != null && this.origin !== message.origin) return;\n if (this.#target != null && this.#target !== message.source) return;\n this.receiveMessage(message);\n let { data } = message;\n if (data.type != null) {\n if (message.data.type !== this.receiveDirection) return;\n data = data.data;\n }\n onMessage(data, message.origin, message.source);\n };\n this.#self.addEventListener('message', this.listener);\n this.#onDisconnect = onDisconnect;\n }\n\n override disconnect(): void {\n super.disconnect();\n if (this.listener == null || this.#onDisconnect == null) {\n throw new InternalError('Expected to not happen, required for TS');\n }\n this.#self.removeEventListener('message', this.listener);\n delete this.listener;\n this.#onDisconnect();\n this.#onDisconnect = undefined;\n }\n\n override sendMessage(msg: any): void {\n if (this.#target == null) throw new RpcConnectionError('Can\\'t send messages without target');\n const message = this.sendDirection != null ? { type: this.sendDirection, data: msg } : msg;\n super.sendMessage(message);\n this.#target.postMessage(message, this.origin ?? '*');\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,OAiBOA,iBAAiB;AAAA,SACfC,iBAAiB;AAAA,SACjBC,aAAa,EAAEC,kBAAkB;AAAA;AAAA;AAAA;AAI1C;AACA;AACA;AACA;AACA,eAAe,MAAMC,8BAA8B,SAASJ,iBAAiB,CAAC;EAe5E;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,WAAW,GAcH;IAAA,IAdI;MACVC,MAAM;MACNC,IAAI,GAAGC,MAAM;MACbC,MAAM;MACNC,aAAa;MACbC,gBAAgB,GAAGV,iBAAiB,CAACW,OAAO;MAC5C,GAAGC;IAQL,CAAC,uEAAG,CAAC,CAAC;IACJ,KAAK,CAACA,OAAO,CAAC;IAAC;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IACf,0BAAI,WAAWP,MAAM;IACrB,0BAAI,SAASC,IAAI;IACjB,IAAI,CAACE,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;EAC1C;EAEAG,WAAW,GAAY;IACrB,OAAO,IAAI,CAACC,QAAQ,IAAI,IAAI;EAC9B;EAESC,OAAO,CACdC,SAAoF,EACpFC,YAAwB,EAClB;IACN,KAAK,CAACF,OAAO,CAACC,SAAS,EAAEC,YAAY,CAAC;IACtC,IAAI,CAACH,QAAQ,GAAII,OAA0B,IAAK;MAAA;MAC9C;MACA,IACE,OAAOA,OAAO,CAACC,IAAI,KAAK,QA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F,MAAMgB,OAAO,GAAG,IAAI,CAACT,aAAa,IAAI,IAAI,GAAG;MAAEc,IAAI,EAAE,IAAI,CAACd,aAAa;MAAEU,IAAI,EAAEU;IAAI,CAAC,GAAGA,GAAG;IAC1F,KAAK,CAACD,WAAW,CAACV,OAAO,CAAC;IAC1B,0BAAI,WAASY,WAAW,CAACZ,OAAO,kBAAE,IAAI,CAACV,MAAM,uDAAI,GAAG,CAAC;EACvD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-proxy.mjs","names":["con1","con2","connect","msg","sendMessage","disconnect"],"sources":["../../src/aepp-wallet-communication/connection-proxy.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport BrowserConnection from './connection/Browser';\n\n/**\n * Browser connection proxy\n * Provide functionality to easily forward messages from one connection to another and back\n * @category aepp wallet communication\n * @param con1 - first connection\n * @param con2 - second connection\n * @returns a function to stop proxying\n */\nexport default (con1: BrowserConnection, con2: BrowserConnection): () => void => {\n con1.connect((msg: any) => con2.sendMessage(msg), () => con2.disconnect());\n con2.connect((msg: any) => con1.sendMessage(msg), () => con1.disconnect());\n\n return () => {\n con1.disconnect();\n con2.disconnect();\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CAACA,
|
|
1
|
+
{"version":3,"file":"connection-proxy.mjs","names":["con1","con2","connect","msg","sendMessage","disconnect"],"sources":["../../src/aepp-wallet-communication/connection-proxy.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport BrowserConnection from './connection/Browser';\n\n/**\n * Browser connection proxy\n * Provide functionality to easily forward messages from one connection to another and back\n * @category aepp wallet communication\n * @param con1 - first connection\n * @param con2 - second connection\n * @returns a function to stop proxying\n */\nexport default (con1: BrowserConnection, con2: BrowserConnection): () => void => {\n con1.connect((msg: any) => con2.sendMessage(msg), () => con2.disconnect());\n con2.connect((msg: any) => con1.sendMessage(msg), () => con1.disconnect());\n\n return () => {\n con1.disconnect();\n con2.disconnect();\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CAACA,IAAuB,EAAEC,IAAuB,KAAiB;EAC/ED,IAAI,CAACE,OAAO,CAAEC,GAAQ,IAAKF,IAAI,CAACG,WAAW,CAACD,GAAG,CAAC,EAAE,MAAMF,IAAI,CAACI,UAAU,EAAE,CAAC;EAC1EJ,IAAI,CAACC,OAAO,CAAEC,GAAQ,IAAKH,IAAI,CAACI,WAAW,CAACD,GAAG,CAAC,EAAE,MAAMH,IAAI,CAACK,UAAU,EAAE,CAAC;EAE1E,OAAO,MAAM;IACXL,IAAI,CAACK,UAAU,EAAE;IACjBJ,IAAI,CAACI,UAAU,EAAE;EACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import BrowserConnection from '../connection/Browser';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type RpcApiHandler = (p?: any) => any | undefined;
|
|
3
|
+
type RpcApi<Api> = {
|
|
4
4
|
[k in keyof Api]: RpcApiHandler;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type WithOrigin<Api extends RpcApi<Api>> = {
|
|
7
7
|
[k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
|
|
2
2
|
import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/classPrivateFieldSet";
|
|
3
|
-
|
|
4
3
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
5
|
-
|
|
6
4
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
6
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
11
|
-
|
|
12
7
|
import { RpcError, RpcInternalError, RpcMethodNotFoundError } from "../schema.mjs";
|
|
13
8
|
import { InvalidRpcMessageError, MissingCallbackError } from "../../utils/errors.mjs";
|
|
14
|
-
|
|
15
9
|
var _callbacks = /*#__PURE__*/new WeakMap();
|
|
16
|
-
|
|
17
10
|
var _messageId = /*#__PURE__*/new WeakMap();
|
|
18
|
-
|
|
19
11
|
var _methods = /*#__PURE__*/new WeakMap();
|
|
20
|
-
|
|
21
12
|
var _handleMessage = /*#__PURE__*/new WeakSet();
|
|
22
|
-
|
|
23
13
|
var _sendRequest = /*#__PURE__*/new WeakSet();
|
|
24
|
-
|
|
25
14
|
var _sendResponse = /*#__PURE__*/new WeakSet();
|
|
26
|
-
|
|
27
15
|
var _processResponse = /*#__PURE__*/new WeakSet();
|
|
28
|
-
|
|
29
16
|
/**
|
|
30
17
|
* Contain functionality for using RPC conection
|
|
31
18
|
* @category aepp wallet communication
|
|
@@ -36,35 +23,25 @@ var _processResponse = /*#__PURE__*/new WeakSet();
|
|
|
36
23
|
export default class RpcClient {
|
|
37
24
|
constructor(connection, onDisconnect, methods) {
|
|
38
25
|
_classPrivateMethodInitSpec(this, _processResponse);
|
|
39
|
-
|
|
40
26
|
_classPrivateMethodInitSpec(this, _sendResponse);
|
|
41
|
-
|
|
42
27
|
_classPrivateMethodInitSpec(this, _sendRequest);
|
|
43
|
-
|
|
44
28
|
_classPrivateMethodInitSpec(this, _handleMessage);
|
|
45
|
-
|
|
46
29
|
_classPrivateFieldInitSpec(this, _callbacks, {
|
|
47
30
|
writable: true,
|
|
48
31
|
value: new Map()
|
|
49
32
|
});
|
|
50
|
-
|
|
51
33
|
_classPrivateFieldInitSpec(this, _messageId, {
|
|
52
34
|
writable: true,
|
|
53
35
|
value: 0
|
|
54
36
|
});
|
|
55
|
-
|
|
56
37
|
_classPrivateFieldInitSpec(this, _methods, {
|
|
57
38
|
writable: true,
|
|
58
39
|
value: void 0
|
|
59
40
|
});
|
|
60
|
-
|
|
61
41
|
this.connection = connection;
|
|
62
|
-
|
|
63
42
|
_classPrivateFieldSet(this, _methods, methods);
|
|
64
|
-
|
|
65
43
|
connection.connect(_classPrivateMethodGet(this, _handleMessage, _handleMessage2).bind(this), onDisconnect);
|
|
66
44
|
}
|
|
67
|
-
|
|
68
45
|
/**
|
|
69
46
|
* Make a request
|
|
70
47
|
* @param name - Method name
|
|
@@ -73,7 +50,6 @@ export default class RpcClient {
|
|
|
73
50
|
*/
|
|
74
51
|
async request(name, params) {
|
|
75
52
|
_classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, _classPrivateFieldSet(this, _messageId, _classPrivateFieldGet(this, _messageId) + 1), name, params);
|
|
76
|
-
|
|
77
53
|
return new Promise((resolve, reject) => {
|
|
78
54
|
_classPrivateFieldGet(this, _callbacks).set(_classPrivateFieldGet(this, _messageId), {
|
|
79
55
|
resolve,
|
|
@@ -81,37 +57,30 @@ export default class RpcClient {
|
|
|
81
57
|
});
|
|
82
58
|
});
|
|
83
59
|
}
|
|
60
|
+
|
|
84
61
|
/**
|
|
85
62
|
* Make a notification
|
|
86
63
|
* @param name - Method name
|
|
87
64
|
* @param params - Method params
|
|
88
65
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
66
|
notify(name, params) {
|
|
92
67
|
_classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, undefined, name, params);
|
|
93
68
|
}
|
|
69
|
+
|
|
94
70
|
/**
|
|
95
71
|
* Process response message
|
|
96
72
|
* @param msg - Message object
|
|
97
73
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
74
|
}
|
|
101
|
-
|
|
102
75
|
async function _handleMessage2(msg, origin) {
|
|
103
76
|
if ((msg === null || msg === void 0 ? void 0 : msg.jsonrpc) !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));
|
|
104
|
-
|
|
105
77
|
if ('result' in msg || 'error' in msg) {
|
|
106
78
|
_classPrivateMethodGet(this, _processResponse, _processResponse2).call(this, msg);
|
|
107
|
-
|
|
108
79
|
return;
|
|
109
80
|
}
|
|
110
|
-
|
|
111
81
|
const request = msg;
|
|
112
82
|
let result;
|
|
113
83
|
let error;
|
|
114
|
-
|
|
115
84
|
try {
|
|
116
85
|
if (!(request.method in _classPrivateFieldGet(this, _methods))) throw new RpcMethodNotFoundError();
|
|
117
86
|
const methodName = request.method;
|
|
@@ -119,12 +88,10 @@ async function _handleMessage2(msg, origin) {
|
|
|
119
88
|
} catch (e) {
|
|
120
89
|
error = e instanceof RpcError ? e : new RpcInternalError();
|
|
121
90
|
}
|
|
122
|
-
|
|
123
91
|
if (request.id != null) {
|
|
124
92
|
_classPrivateMethodGet(this, _sendResponse, _sendResponse2).call(this, request.id, request.method, result, error);
|
|
125
93
|
}
|
|
126
94
|
}
|
|
127
|
-
|
|
128
95
|
function _sendRequest2(id, method, params) {
|
|
129
96
|
this.connection.sendMessage({
|
|
130
97
|
jsonrpc: '2.0',
|
|
@@ -137,8 +104,8 @@ function _sendRequest2(id, method, params) {
|
|
|
137
104
|
} : {})
|
|
138
105
|
});
|
|
139
106
|
}
|
|
140
|
-
|
|
141
|
-
|
|
107
|
+
function _sendResponse2(id, method,
|
|
108
|
+
// TODO: remove as far it is not required in JSON RPC
|
|
142
109
|
result, error) {
|
|
143
110
|
this.connection.sendMessage({
|
|
144
111
|
jsonrpc: '2.0',
|
|
@@ -151,19 +118,15 @@ result, error) {
|
|
|
151
118
|
})
|
|
152
119
|
});
|
|
153
120
|
}
|
|
154
|
-
|
|
155
121
|
function _processResponse2(_ref) {
|
|
156
122
|
let {
|
|
157
123
|
id,
|
|
158
124
|
error,
|
|
159
125
|
result
|
|
160
126
|
} = _ref;
|
|
161
|
-
|
|
162
127
|
const callbacks = _classPrivateFieldGet(this, _callbacks).get(id);
|
|
163
|
-
|
|
164
128
|
if (callbacks == null) throw new MissingCallbackError(id);
|
|
165
129
|
if (error != null) callbacks.reject(RpcError.deserialize(error));else callbacks.resolve(result);
|
|
166
|
-
|
|
167
130
|
_classPrivateFieldGet(this, _callbacks).delete(id);
|
|
168
131
|
}
|
|
169
132
|
//# sourceMappingURL=RpcClient.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","RpcClient","constructor","connection","onDisconnect","methods","Map","connect","bind","request","name","params","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","result","error","method","methodName","e","id","sendMessage","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result
|
|
1
|
+
{"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","RpcClient","constructor","connection","onDisconnect","methods","Map","connect","bind","request","name","params","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","result","error","method","methodName","e","id","sendMessage","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result;\n let error;\n try {\n if (!(request.method in this.#methods)) throw new RpcMethodNotFoundError();\n const methodName = request.method as keyof LocalApi;\n result = await this.#methods[methodName](request.params, origin);\n } catch (e) {\n error = e instanceof RpcError ? e : new RpcInternalError();\n }\n if (request.id != null) {\n this.#sendResponse(request.id, request.method as keyof LocalApi, result, error);\n }\n }\n\n #sendRequest(\n id: number | undefined,\n method: keyof RemoteApi | keyof LocalApi,\n params?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n ...id != null ? { id } : {},\n method,\n ...params != null ? { params } : {},\n });\n }\n\n #sendResponse(\n id: number,\n method: keyof RemoteApi | keyof LocalApi, // TODO: remove as far it is not required in JSON RPC\n result?: any,\n error?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n id,\n method,\n ...error != null ? { error } : { result },\n });\n }\n\n /**\n * Make a request\n * @param name - Method name\n * @param params - Method params\n * @returns Promise which will be resolved after receiving response message\n */\n async request<Name extends keyof RemoteApi>(\n name: Name,\n params: Parameters<RemoteApi[Name]>[0],\n ): Promise<ReturnType<RemoteApi[Name]>> {\n this.#sendRequest(this.#messageId += 1, name, params);\n return new Promise((resolve, reject) => {\n this.#callbacks.set(this.#messageId, { resolve, reject });\n });\n }\n\n /**\n * Make a notification\n * @param name - Method name\n * @param params - Method params\n */\n notify<Name extends keyof RemoteApi>(name: Name, params: Parameters<RemoteApi[Name]>[0]): void {\n this.#sendRequest(undefined, name, params);\n }\n\n /**\n * Process response message\n * @param msg - Message object\n */\n #processResponse({ id, error, result }: { id: number; error?: any; result?: any }): void {\n const callbacks = this.#callbacks.get(id);\n if (callbacks == null) throw new MissingCallbackError(id);\n if (error != null) callbacks.reject(RpcError.deserialize(error));\n else callbacks.resolve(result);\n this.#callbacks.delete(id);\n }\n}\n"],"mappings":";;;;;;SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,sBAAsB;AAAA,SAElDC,sBAAsB,EAAEC,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,SAAS,CAE5B;EASAC,WAAW,CACTC,UAA6B,EAC7BC,YAAwB,EACxBC,OAA6B,EAC7B;IAAA;IAAA;IAAA;IAAA;IAAA;MAAA;MAAA,OAVW,IAAIC,GAAG;IAAqE;IAAA;MAAA;MAAA,OAE5E;IAAC;IAAA;MAAA;MAAA;IAAA;IASZ,IAAI,CAACH,UAAU,GAAGA,UAAU;IAC5B,0BAAI,YAAYE,OAAO;IACvBF,UAAU,CAACI,OAAO,CAAC,2BAAI,mCAAgBC,IAAI,CAAC,IAAI,CAAC,EAAEJ,YAAY,CAAC;EAClE;EAmDA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMK,OAAO,CACXC,IAAU,EACVC,MAAsC,EACA;IACtC,2BAAI,oCAAJ,IAAI,wBAAc,IAAI,oCAAJ,IAAI,gBAAe,CAAC,GAAED,IAAI,EAAEC,MAAM;IACpD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,0BAAI,cAAYC,GAAG,uBAAC,IAAI,eA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,MAAY,EACN;EACN,IAAI,CAACR,UAAU,CAAC0B,WAAW,CAAC;IAC1BT,OAAO,EAAE,KAAK;IACd,IAAGQ,EAAE,IAAI,IAAI,GAAG;MAAEA;IAAG,CAAC,GAAG,CAAC,CAAC;IAC3BH,MAAM;IACN,IAAGd,MAAM,IAAI,IAAI,GAAG;MAAEA;IAAO,CAAC,GAAG,CAAC,CAAC;EACrC,CAAC,CAAC;AACJ;AAAC,wBAGCiB,EAAU,EACVH,MAAwC;AAAE;AAC1CF,MAAY,EACZC,KAAW,EACL;EACN,IAAI,CAACrB,UAAU,CAAC0B,WAAW,CAAC;IAC1BT,OAAO,EAAE,KAAK;IACdQ,EAAE;IACFH,MAAM;IACN,IAAGD,KAAK,IAAI,IAAI,GAAG;MAAEA;IAAM,CAAC,GAAG;MAAED;IAAO,CAAC;EAC3C,CAAC,CAAC;AACJ;AAAC,iCA+BwF;EAAA,IAAxE;IAAEK,EAAE;IAAEJ,KAAK;IAAED;EAAkD,CAAC;EAC/E,MAAMO,SAAS,GAAG,0BAAI,cAAYC,GAAG,CAACH,EAAE,CAAC;EACzC,IAAIE,SAAS,IAAI,IAAI,EAAE,MAAM,IAAI9B,oBAAoB,CAAC4B,EAAE,CAAC;EACzD,IAAIJ,KAAK,IAAI,IAAI,EAAEM,SAAS,CAAChB,MAAM,CAAClB,QAAQ,CAACoC,WAAW,CAACR,KAAK,CAAC,CAAC,CAAC,KAC5DM,SAAS,CAACjB,OAAO,CAACU,MAAM,CAAC;EAC9B,0BAAI,cAAYU,MAAM,CAACL,EAAE,CAAC;AAC5B"}
|
|
@@ -24,7 +24,7 @@ export interface Network {
|
|
|
24
24
|
networkId: string;
|
|
25
25
|
node?: Node;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
type Icons = Array<{
|
|
28
28
|
src: string;
|
|
29
29
|
sizes?: string;
|
|
30
30
|
type?: string;
|
|
@@ -53,6 +53,12 @@ export interface WalletApi {
|
|
|
53
53
|
tx: Encoded.Transaction;
|
|
54
54
|
onAccount: Encoded.AccountAddress;
|
|
55
55
|
returnSigned: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Wallet provided networkId will be used (current network)
|
|
58
|
+
* required to maintain backward compatibility with wallets using SDK v11.0.1 and below
|
|
59
|
+
* @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
|
|
60
|
+
*/
|
|
61
|
+
networkId: string;
|
|
56
62
|
}) => Promise<{
|
|
57
63
|
/**
|
|
58
64
|
* @deprecated this is not a hash at all, will be removed later at the same time
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { send } from '../../spend';\nimport { Encoded } from '../../utils/encoder';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: {
|
|
1
|
+
{"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { send } from '../../spend';\nimport { Encoded } from '../../utils/encoder';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: {\n tx: Encoded.Transaction;\n onAccount: Encoded.AccountAddress;\n returnSigned: boolean;\n /**\n * @deprecated Wallet provided networkId will be used (current network)\n * required to maintain backward compatibility with wallets using SDK v11.0.1 and below\n * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}\n */\n networkId: string;\n }\n ) => Promise<{\n /**\n * @deprecated this is not a hash at all, will be removed later at the same time\n * as dropping ability to broadcast transaction by wallet\n */\n transactionHash?: Awaited<ReturnType<typeof send>>;\n signedTransaction?: Encoded.Transaction;\n }>);\n\n [METHODS.signMessage]: (\n p: { message: string; onAccount: Encoded.AccountAddress }\n ) => Promise<{ signature: string }>;\n}\n\nexport interface AeppApi {\n [METHODS.updateAddress]: (a: Accounts) => void;\n [METHODS.updateNetwork]: (a: Network) => void;\n [METHODS.readyToConnect]: (w: WalletInfo) => void;\n [METHODS.closeConnection]: (p: any) => void;\n}\n"],"mappings":"SAESA,OAAO;AA2BhB,OAAO,MAAMC,WAAW,GAAG,CAAC"}
|
|
@@ -4,42 +4,38 @@ import { BaseError, InternalError } from "../utils/errors.mjs";
|
|
|
4
4
|
/**
|
|
5
5
|
* @category aepp wallet communication
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
export let MESSAGE_DIRECTION;
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
10
|
* @category aepp wallet communication
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
(function (MESSAGE_DIRECTION) {
|
|
14
13
|
MESSAGE_DIRECTION["to_waellet"] = "to_waellet";
|
|
15
14
|
MESSAGE_DIRECTION["to_aepp"] = "to_aepp";
|
|
16
15
|
})(MESSAGE_DIRECTION || (MESSAGE_DIRECTION = {}));
|
|
17
|
-
|
|
18
16
|
export let WALLET_TYPE;
|
|
17
|
+
|
|
19
18
|
/**
|
|
20
19
|
* @category aepp wallet communication
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
21
|
(function (WALLET_TYPE) {
|
|
24
22
|
WALLET_TYPE["window"] = "window";
|
|
25
23
|
WALLET_TYPE["extension"] = "extension";
|
|
26
24
|
})(WALLET_TYPE || (WALLET_TYPE = {}));
|
|
27
|
-
|
|
28
25
|
export let SUBSCRIPTION_TYPES;
|
|
26
|
+
|
|
29
27
|
/**
|
|
30
28
|
* @category aepp wallet communication
|
|
31
29
|
*/
|
|
32
|
-
|
|
33
30
|
(function (SUBSCRIPTION_TYPES) {
|
|
34
31
|
SUBSCRIPTION_TYPES["subscribe"] = "subscribe";
|
|
35
32
|
SUBSCRIPTION_TYPES["unsubscribe"] = "unsubscribe";
|
|
36
33
|
})(SUBSCRIPTION_TYPES || (SUBSCRIPTION_TYPES = {}));
|
|
37
|
-
|
|
38
34
|
export let METHODS;
|
|
35
|
+
|
|
39
36
|
/**
|
|
40
37
|
* @category aepp wallet communication
|
|
41
38
|
*/
|
|
42
|
-
|
|
43
39
|
(function (METHODS) {
|
|
44
40
|
METHODS["readyToConnect"] = "connection.announcePresence";
|
|
45
41
|
METHODS["updateAddress"] = "address.update";
|
|
@@ -51,20 +47,17 @@ export let METHODS;
|
|
|
51
47
|
METHODS["updateNetwork"] = "networkId.update";
|
|
52
48
|
METHODS["closeConnection"] = "connection.close";
|
|
53
49
|
})(METHODS || (METHODS = {}));
|
|
54
|
-
|
|
55
50
|
export let RPC_STATUS;
|
|
56
|
-
|
|
57
51
|
(function (RPC_STATUS) {
|
|
58
52
|
RPC_STATUS["CONNECTED"] = "CONNECTED";
|
|
59
53
|
RPC_STATUS["DISCONNECTED"] = "DISCONNECTED";
|
|
60
54
|
RPC_STATUS["WAITING_FOR_CONNECTION_REQUEST"] = "WAITING_FOR_CONNECTION_REQUEST";
|
|
61
55
|
})(RPC_STATUS || (RPC_STATUS = {}));
|
|
62
|
-
|
|
63
56
|
const rpcErrors = [];
|
|
57
|
+
|
|
64
58
|
/**
|
|
65
59
|
* @category exception
|
|
66
60
|
*/
|
|
67
|
-
|
|
68
61
|
export class RpcError extends BaseError {
|
|
69
62
|
toJSON() {
|
|
70
63
|
return {
|
|
@@ -73,179 +66,132 @@ export class RpcError extends BaseError {
|
|
|
73
66
|
data: this.data
|
|
74
67
|
};
|
|
75
68
|
}
|
|
76
|
-
|
|
77
69
|
static deserialize(json) {
|
|
78
70
|
const RpcErr = rpcErrors.find(cl => cl.code === json.code);
|
|
79
71
|
if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);
|
|
80
72
|
return new RpcErr(json.data);
|
|
81
73
|
}
|
|
82
|
-
|
|
83
74
|
}
|
|
75
|
+
|
|
84
76
|
/**
|
|
85
77
|
* @category exception
|
|
86
78
|
*/
|
|
87
|
-
|
|
88
79
|
export class RpcInvalidTransactionError extends RpcError {
|
|
89
80
|
constructor(data) {
|
|
90
81
|
super('Invalid transaction');
|
|
91
|
-
|
|
92
82
|
_defineProperty(this, "code", 2);
|
|
93
|
-
|
|
94
83
|
this.data = data;
|
|
95
84
|
this.name = 'RpcInvalidTransactionError';
|
|
96
85
|
}
|
|
97
|
-
|
|
98
86
|
}
|
|
99
|
-
|
|
100
87
|
_defineProperty(RpcInvalidTransactionError, "code", 2);
|
|
101
|
-
|
|
102
88
|
rpcErrors.push(RpcInvalidTransactionError);
|
|
89
|
+
|
|
103
90
|
/**
|
|
104
91
|
* @category exception
|
|
105
92
|
*/
|
|
106
|
-
|
|
107
93
|
export class RpcBroadcastError extends RpcError {
|
|
108
94
|
constructor(data) {
|
|
109
95
|
super('Broadcast failed');
|
|
110
|
-
|
|
111
96
|
_defineProperty(this, "code", 3);
|
|
112
|
-
|
|
113
97
|
this.data = data;
|
|
114
98
|
this.name = 'RpcBroadcastError';
|
|
115
99
|
}
|
|
116
|
-
|
|
117
100
|
}
|
|
118
|
-
|
|
119
101
|
_defineProperty(RpcBroadcastError, "code", 3);
|
|
120
|
-
|
|
121
102
|
rpcErrors.push(RpcBroadcastError);
|
|
103
|
+
|
|
122
104
|
/**
|
|
123
105
|
* @category exception
|
|
124
106
|
*/
|
|
125
|
-
|
|
126
107
|
export class RpcRejectedByUserError extends RpcError {
|
|
127
108
|
constructor(data) {
|
|
128
109
|
super('Operation rejected by user');
|
|
129
|
-
|
|
130
110
|
_defineProperty(this, "code", 4);
|
|
131
|
-
|
|
132
111
|
this.data = data;
|
|
133
112
|
this.name = 'RpcRejectedByUserError';
|
|
134
113
|
}
|
|
135
|
-
|
|
136
114
|
}
|
|
137
|
-
|
|
138
115
|
_defineProperty(RpcRejectedByUserError, "code", 4);
|
|
139
|
-
|
|
140
116
|
rpcErrors.push(RpcRejectedByUserError);
|
|
117
|
+
|
|
141
118
|
/**
|
|
142
119
|
* @category exception
|
|
143
120
|
*/
|
|
144
|
-
|
|
145
121
|
export class RpcUnsupportedProtocolError extends RpcError {
|
|
146
122
|
constructor() {
|
|
147
123
|
super('Unsupported Protocol Version');
|
|
148
|
-
|
|
149
124
|
_defineProperty(this, "code", 5);
|
|
150
|
-
|
|
151
125
|
this.name = 'RpcUnsupportedProtocolError';
|
|
152
126
|
}
|
|
153
|
-
|
|
154
127
|
}
|
|
155
|
-
|
|
156
128
|
_defineProperty(RpcUnsupportedProtocolError, "code", 5);
|
|
157
|
-
|
|
158
129
|
rpcErrors.push(RpcUnsupportedProtocolError);
|
|
130
|
+
|
|
159
131
|
/**
|
|
160
132
|
* @category exception
|
|
161
133
|
*/
|
|
162
|
-
|
|
163
134
|
export class RpcConnectionDenyError extends RpcError {
|
|
164
135
|
constructor(data) {
|
|
165
136
|
super('Wallet deny your connection request');
|
|
166
|
-
|
|
167
137
|
_defineProperty(this, "code", 9);
|
|
168
|
-
|
|
169
138
|
this.data = data;
|
|
170
139
|
this.name = 'RpcConnectionDenyError';
|
|
171
140
|
}
|
|
172
|
-
|
|
173
141
|
}
|
|
174
|
-
|
|
175
142
|
_defineProperty(RpcConnectionDenyError, "code", 9);
|
|
176
|
-
|
|
177
143
|
rpcErrors.push(RpcConnectionDenyError);
|
|
144
|
+
|
|
178
145
|
/**
|
|
179
146
|
* @category exception
|
|
180
147
|
*/
|
|
181
|
-
|
|
182
148
|
export class RpcNotAuthorizeError extends RpcError {
|
|
183
149
|
constructor() {
|
|
184
150
|
super('You are not connected to the wallet');
|
|
185
|
-
|
|
186
151
|
_defineProperty(this, "code", 10);
|
|
187
|
-
|
|
188
152
|
this.name = 'RpcNotAuthorizeError';
|
|
189
153
|
}
|
|
190
|
-
|
|
191
154
|
}
|
|
192
|
-
|
|
193
155
|
_defineProperty(RpcNotAuthorizeError, "code", 10);
|
|
194
|
-
|
|
195
156
|
rpcErrors.push(RpcNotAuthorizeError);
|
|
157
|
+
|
|
196
158
|
/**
|
|
197
159
|
* @category exception
|
|
198
160
|
*/
|
|
199
|
-
|
|
200
161
|
export class RpcPermissionDenyError extends RpcError {
|
|
201
162
|
constructor(address) {
|
|
202
163
|
super(`You are not subscribed for account ${address}`);
|
|
203
|
-
|
|
204
164
|
_defineProperty(this, "code", 11);
|
|
205
|
-
|
|
206
165
|
this.data = address;
|
|
207
166
|
this.name = 'RpcPermissionDenyError';
|
|
208
167
|
}
|
|
209
|
-
|
|
210
168
|
}
|
|
211
|
-
|
|
212
169
|
_defineProperty(RpcPermissionDenyError, "code", 11);
|
|
213
|
-
|
|
214
170
|
rpcErrors.push(RpcPermissionDenyError);
|
|
171
|
+
|
|
215
172
|
/**
|
|
216
173
|
* @category exception
|
|
217
174
|
*/
|
|
218
|
-
|
|
219
175
|
export class RpcInternalError extends RpcError {
|
|
220
176
|
constructor() {
|
|
221
177
|
super('The peer failed to execute your request due to unknown error');
|
|
222
|
-
|
|
223
178
|
_defineProperty(this, "code", 12);
|
|
224
|
-
|
|
225
179
|
this.name = 'RpcInternalError';
|
|
226
180
|
}
|
|
227
|
-
|
|
228
181
|
}
|
|
229
|
-
|
|
230
182
|
_defineProperty(RpcInternalError, "code", 12);
|
|
231
|
-
|
|
232
183
|
rpcErrors.push(RpcInternalError);
|
|
184
|
+
|
|
233
185
|
/**
|
|
234
186
|
* @category exception
|
|
235
187
|
*/
|
|
236
|
-
|
|
237
188
|
export class RpcMethodNotFoundError extends RpcError {
|
|
238
189
|
constructor() {
|
|
239
190
|
super('Method not found');
|
|
240
|
-
|
|
241
191
|
_defineProperty(this, "code", -32601);
|
|
242
|
-
|
|
243
192
|
this.name = 'RpcMethodNotFoundError';
|
|
244
193
|
}
|
|
245
|
-
|
|
246
194
|
}
|
|
247
|
-
|
|
248
195
|
_defineProperty(RpcMethodNotFoundError, "code", -32601);
|
|
249
|
-
|
|
250
196
|
rpcErrors.push(RpcMethodNotFoundError);
|
|
251
197
|
//# sourceMappingURL=schema.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":["BaseError","InternalError","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","rpcErrors","RpcError","toJSON","code","message","data","deserialize","json","RpcErr","find","cl","RpcInvalidTransactionError","constructor","name","push","RpcBroadcastError","RpcRejectedByUserError","RpcUnsupportedProtocolError","RpcConnectionDenyError","RpcNotAuthorizeError","RpcPermissionDenyError","address","RpcInternalError","RpcMethodNotFoundError"],"sources":["../../src/aepp-wallet-communication/schema.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Encoded } from '../utils/encoder';\nimport { BaseError, InternalError } from '../utils/errors';\n\n/**\n * @category aepp wallet communication\n */\nexport const enum MESSAGE_DIRECTION {\n to_waellet = 'to_waellet',\n to_aepp = 'to_aepp',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum WALLET_TYPE {\n window = 'window',\n extension = 'extension',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum SUBSCRIPTION_TYPES {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum METHODS {\n readyToConnect = 'connection.announcePresence',\n updateAddress = 'address.update',\n address = 'address.get',\n connect = 'connection.open',\n sign = 'transaction.sign',\n signMessage = 'message.sign',\n subscribeAddress = 'address.subscribe',\n updateNetwork = 'networkId.update',\n closeConnection = 'connection.close',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum RPC_STATUS {\n CONNECTED = 'CONNECTED',\n DISCONNECTED = 'DISCONNECTED',\n WAITING_FOR_CONNECTION_REQUEST = 'WAITING_FOR_CONNECTION_REQUEST',\n}\n\ninterface RpcErrorAsJson {\n code: number;\n message: string;\n data?: any;\n}\n\nconst rpcErrors: Array<(new (data?: any) => RpcError) & { code: number }> = [];\n\n/**\n * @category exception\n */\nexport abstract class RpcError extends BaseError {\n static code: number;\n\n code: number;\n\n data?: any;\n\n toJSON(): RpcErrorAsJson {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n\n static deserialize(json: RpcErrorAsJson): RpcError {\n const RpcErr = rpcErrors.find((cl) => cl.code === json.code);\n if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);\n return new RpcErr(json.data);\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcInvalidTransactionError extends RpcError {\n static code = 2;\n\n code = 2;\n\n constructor(data?: any) {\n super('Invalid transaction');\n this.data = data;\n this.name = 'RpcInvalidTransactionError';\n }\n}\nrpcErrors.push(RpcInvalidTransactionError);\n\n/**\n * @category exception\n */\nexport class RpcBroadcastError extends RpcError {\n static code = 3;\n\n code = 3;\n\n constructor(data?: any) {\n super('Broadcast failed');\n this.data = data;\n this.name = 'RpcBroadcastError';\n }\n}\nrpcErrors.push(RpcBroadcastError);\n\n/**\n * @category exception\n */\nexport class RpcRejectedByUserError extends RpcError {\n static code = 4;\n\n code = 4;\n\n constructor(data?: any) {\n super('Operation rejected by user');\n this.data = data;\n this.name = 'RpcRejectedByUserError';\n }\n}\nrpcErrors.push(RpcRejectedByUserError);\n\n/**\n * @category exception\n */\nexport class RpcUnsupportedProtocolError extends RpcError {\n static code = 5;\n\n code = 5;\n\n constructor() {\n super('Unsupported Protocol Version');\n this.name = 'RpcUnsupportedProtocolError';\n }\n}\nrpcErrors.push(RpcUnsupportedProtocolError);\n\n/**\n * @category exception\n */\nexport class RpcConnectionDenyError extends RpcError {\n static code = 9;\n\n code = 9;\n\n constructor(data?: any) {\n super('Wallet deny your connection request');\n this.data = data;\n this.name = 'RpcConnectionDenyError';\n }\n}\nrpcErrors.push(RpcConnectionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcNotAuthorizeError extends RpcError {\n static code = 10;\n\n code = 10;\n\n constructor() {\n super('You are not connected to the wallet');\n this.name = 'RpcNotAuthorizeError';\n }\n}\nrpcErrors.push(RpcNotAuthorizeError);\n\n/**\n * @category exception\n */\nexport class RpcPermissionDenyError extends RpcError {\n static code = 11;\n\n code = 11;\n\n constructor(address: Encoded.AccountAddress) {\n super(`You are not subscribed for account ${address}`);\n this.data = address;\n this.name = 'RpcPermissionDenyError';\n }\n}\nrpcErrors.push(RpcPermissionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcInternalError extends RpcError {\n static code = 12;\n\n code = 12;\n\n constructor() {\n super('The peer failed to execute your request due to unknown error');\n this.name = 'RpcInternalError';\n }\n}\nrpcErrors.push(RpcInternalError);\n\n/**\n * @category exception\n */\nexport class RpcMethodNotFoundError extends RpcError {\n static code = -32601;\n\n code = -32601;\n\n constructor() {\n super('Method not found');\n this.name = 'RpcMethodNotFoundError';\n }\n}\nrpcErrors.push(RpcMethodNotFoundError);\n"],"mappings":";AAAA;SAESA,
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":["BaseError","InternalError","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","rpcErrors","RpcError","toJSON","code","message","data","deserialize","json","RpcErr","find","cl","RpcInvalidTransactionError","constructor","name","push","RpcBroadcastError","RpcRejectedByUserError","RpcUnsupportedProtocolError","RpcConnectionDenyError","RpcNotAuthorizeError","RpcPermissionDenyError","address","RpcInternalError","RpcMethodNotFoundError"],"sources":["../../src/aepp-wallet-communication/schema.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Encoded } from '../utils/encoder';\nimport { BaseError, InternalError } from '../utils/errors';\n\n/**\n * @category aepp wallet communication\n */\nexport const enum MESSAGE_DIRECTION {\n to_waellet = 'to_waellet',\n to_aepp = 'to_aepp',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum WALLET_TYPE {\n window = 'window',\n extension = 'extension',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum SUBSCRIPTION_TYPES {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum METHODS {\n readyToConnect = 'connection.announcePresence',\n updateAddress = 'address.update',\n address = 'address.get',\n connect = 'connection.open',\n sign = 'transaction.sign',\n signMessage = 'message.sign',\n subscribeAddress = 'address.subscribe',\n updateNetwork = 'networkId.update',\n closeConnection = 'connection.close',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum RPC_STATUS {\n CONNECTED = 'CONNECTED',\n DISCONNECTED = 'DISCONNECTED',\n WAITING_FOR_CONNECTION_REQUEST = 'WAITING_FOR_CONNECTION_REQUEST',\n}\n\ninterface RpcErrorAsJson {\n code: number;\n message: string;\n data?: any;\n}\n\nconst rpcErrors: Array<(new (data?: any) => RpcError) & { code: number }> = [];\n\n/**\n * @category exception\n */\nexport abstract class RpcError extends BaseError {\n static code: number;\n\n code: number;\n\n data?: any;\n\n toJSON(): RpcErrorAsJson {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n\n static deserialize(json: RpcErrorAsJson): RpcError {\n const RpcErr = rpcErrors.find((cl) => cl.code === json.code);\n if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);\n return new RpcErr(json.data);\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcInvalidTransactionError extends RpcError {\n static override code = 2;\n\n override code = 2;\n\n constructor(data?: any) {\n super('Invalid transaction');\n this.data = data;\n this.name = 'RpcInvalidTransactionError';\n }\n}\nrpcErrors.push(RpcInvalidTransactionError);\n\n/**\n * @category exception\n */\nexport class RpcBroadcastError extends RpcError {\n static override code = 3;\n\n override code = 3;\n\n constructor(data?: any) {\n super('Broadcast failed');\n this.data = data;\n this.name = 'RpcBroadcastError';\n }\n}\nrpcErrors.push(RpcBroadcastError);\n\n/**\n * @category exception\n */\nexport class RpcRejectedByUserError extends RpcError {\n static override code = 4;\n\n override code = 4;\n\n constructor(data?: any) {\n super('Operation rejected by user');\n this.data = data;\n this.name = 'RpcRejectedByUserError';\n }\n}\nrpcErrors.push(RpcRejectedByUserError);\n\n/**\n * @category exception\n */\nexport class RpcUnsupportedProtocolError extends RpcError {\n static override code = 5;\n\n override code = 5;\n\n constructor() {\n super('Unsupported Protocol Version');\n this.name = 'RpcUnsupportedProtocolError';\n }\n}\nrpcErrors.push(RpcUnsupportedProtocolError);\n\n/**\n * @category exception\n */\nexport class RpcConnectionDenyError extends RpcError {\n static override code = 9;\n\n override code = 9;\n\n constructor(data?: any) {\n super('Wallet deny your connection request');\n this.data = data;\n this.name = 'RpcConnectionDenyError';\n }\n}\nrpcErrors.push(RpcConnectionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcNotAuthorizeError extends RpcError {\n static override code = 10;\n\n override code = 10;\n\n constructor() {\n super('You are not connected to the wallet');\n this.name = 'RpcNotAuthorizeError';\n }\n}\nrpcErrors.push(RpcNotAuthorizeError);\n\n/**\n * @category exception\n */\nexport class RpcPermissionDenyError extends RpcError {\n static override code = 11;\n\n override code = 11;\n\n constructor(address: Encoded.AccountAddress) {\n super(`You are not subscribed for account ${address}`);\n this.data = address;\n this.name = 'RpcPermissionDenyError';\n }\n}\nrpcErrors.push(RpcPermissionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcInternalError extends RpcError {\n static override code = 12;\n\n override code = 12;\n\n constructor() {\n super('The peer failed to execute your request due to unknown error');\n this.name = 'RpcInternalError';\n }\n}\nrpcErrors.push(RpcInternalError);\n\n/**\n * @category exception\n */\nexport class RpcMethodNotFoundError extends RpcError {\n static override code = -32601;\n\n override code = -32601;\n\n constructor() {\n super('Method not found');\n this.name = 'RpcMethodNotFoundError';\n }\n}\nrpcErrors.push(RpcMethodNotFoundError);\n"],"mappings":";AAAA;AAAA,SAESA,SAAS,EAAEC,aAAa;AAEjC;AACA;AACA;AACA,WAAkBC,iBAAiB;;AAKnC;AACA;AACA;AAFA,WALkBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,KAAjBA,iBAAiB;AAQnC,WAAkBC,WAAW;;AAK7B;AACA;AACA;AAFA,WALkBA,WAAW;EAAXA,WAAW;EAAXA,WAAW;AAAA,GAAXA,WAAW,KAAXA,WAAW;AAQ7B,WAAkBC,kBAAkB;;AAKpC;AACA;AACA;AAFA,WALkBA,kBAAkB;EAAl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