@aeternity/aepp-sdk 12.0.0 → 12.1.2
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.LICENSE.txt +0 -15
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +2 -1
- package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +20765 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +7 -7
- package/es/AeSdk.mjs.map +1 -1
- package/es/AeSdkAepp.d.ts +4 -3
- package/es/AeSdkAepp.mjs +2 -1
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/AeSdkBase.d.ts +22 -21
- package/es/AeSdkBase.mjs +25 -21
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkWallet.d.ts +4 -3
- package/es/AeSdkWallet.mjs +5 -1
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Node.d.ts +7 -10
- package/es/Node.mjs +63 -57
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +7 -4
- package/es/account/Base.mjs +3 -3
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Memory.d.ts +5 -4
- package/es/account/Memory.mjs +24 -2
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +6 -6
- package/es/account/Rpc.mjs +3 -2
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +27 -14
- package/es/aens.mjs +27 -21
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/Browser.d.ts +2 -1
- package/es/aepp-wallet-communication/connection/Browser.mjs +5 -2
- 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 +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +5 -1
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection-proxy.d.ts +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs +1 -0
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -5
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +8 -8
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +17 -2
- package/es/aepp-wallet-communication/schema.mjs +54 -17
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.d.ts +2 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +2 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/node/models/index.d.ts +6 -2
- package/es/apis/node/models/index.mjs.map +1 -1
- package/es/apis/node/models/mappers.mjs +4 -2
- package/es/apis/node/models/mappers.mjs.map +1 -1
- package/es/chain.d.ts +92 -64
- package/es/chain.mjs +190 -154
- package/es/chain.mjs.map +1 -1
- package/es/channel/handlers.d.ts +3 -3
- package/es/channel/handlers.mjs +42 -44
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/index.d.ts +43 -52
- package/es/channel/index.mjs +46 -49
- package/es/channel/index.mjs.map +1 -1
- package/es/channel/internal.d.ts +16 -15
- package/es/channel/internal.mjs +67 -62
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Compiler.d.ts +1 -0
- package/es/contract/Compiler.mjs +5 -4
- package/es/contract/Compiler.mjs.map +1 -1
- package/es/contract/aci.d.ts +17 -15
- package/es/contract/aci.mjs +58 -45
- package/es/contract/aci.mjs.map +1 -1
- package/es/contract/ga.d.ts +16 -15
- package/es/contract/ga.mjs +12 -7
- package/es/contract/ga.mjs.map +1 -1
- package/es/contract/methods.d.ts +9 -6
- package/es/contract/methods.mjs +9 -6
- package/es/contract/methods.mjs.map +1 -1
- package/es/deprecated/index.d.ts +143 -0
- package/es/deprecated/index.mjs +162 -0
- package/es/deprecated/index.mjs.map +1 -0
- package/es/deprecated/methods.d.ts +18 -0
- package/es/deprecated/methods.mjs +26 -0
- package/es/deprecated/methods.mjs.map +1 -0
- package/es/index.d.ts +4 -1
- package/es/index.mjs +4 -1
- package/es/index.mjs.map +1 -1
- package/es/oracle.d.ts +69 -62
- package/es/oracle.mjs +121 -103
- package/es/oracle.mjs.map +1 -1
- package/es/spend.d.ts +16 -15
- package/es/spend.mjs +19 -30
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/address.d.ts +25 -0
- package/es/tx/builder/address.mjs +45 -0
- package/es/tx/builder/address.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +55 -26
- package/es/tx/builder/constants.mjs +60 -38
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
- package/es/tx/builder/field-types/coin-amount.mjs +26 -0
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +15 -0
- package/es/tx/builder/field-types/deposit.mjs +19 -0
- package/es/tx/builder/field-types/deposit.mjs.map +1 -0
- package/es/tx/builder/field-types/fee.d.ts +25 -0
- package/es/tx/{min-fee.mjs → builder/field-types/fee.mjs} +62 -60
- package/es/tx/builder/field-types/fee.mjs.map +1 -0
- package/es/tx/builder/field-types/field.d.ts +6 -0
- package/es/tx/builder/field-types/field.mjs +15 -0
- package/es/tx/builder/field-types/field.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
- package/es/tx/builder/field-types/gas-limit.mjs +33 -0
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
- package/es/tx/builder/field-types/gas-price.d.ts +8 -0
- package/es/tx/builder/field-types/gas-price.mjs +18 -0
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
- package/es/tx/builder/field-types/index.d.ts +70 -0
- package/es/tx/builder/field-types/index.mjs +25 -0
- package/es/tx/builder/field-types/index.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +20 -0
- package/es/tx/builder/field-types/name-fee.mjs +24 -0
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
- package/es/tx/builder/field-types/name-id.d.ts +14 -0
- package/es/tx/builder/field-types/name-id.mjs +19 -0
- package/es/tx/builder/field-types/name-id.mjs.map +1 -0
- package/es/tx/builder/field-types/name.d.ts +13 -0
- package/es/tx/builder/field-types/name.mjs +18 -0
- package/es/tx/builder/field-types/name.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
- package/es/tx/builder/field-types/short-u-int.mjs +12 -0
- package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +8 -0
- package/es/tx/builder/field-types/u-int.mjs +14 -0
- package/es/tx/builder/field-types/u-int.mjs.map +1 -0
- package/es/tx/builder/helpers.d.ts +27 -33
- package/es/tx/builder/helpers.mjs +41 -47
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +25 -12
- package/es/tx/builder/index.mjs +74 -83
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +995 -144
- package/es/tx/builder/schema.mjs +121 -170
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +28 -27
- package/es/tx/index.mjs +97 -117
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +4 -3
- package/es/tx/validator.mjs +79 -92
- package/es/tx/validator.mjs.map +1 -1
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -1
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -1
- package/es/typings/bip32-path/index.d.mjs.map +1 -1
- package/es/typings/blakejs/index.d.mjs.map +1 -1
- package/es/typings/sha-js/index.d.mjs +2 -0
- package/es/typings/sha-js/index.d.mjs.map +1 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -1
- package/es/utils/amount-formatter.d.ts +9 -9
- package/es/utils/amount-formatter.mjs +17 -17
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs +7 -7
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/bignumber.mjs +2 -1
- package/es/utils/bignumber.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/crypto.d.ts +8 -23
- package/es/utils/crypto.mjs +15 -41
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/encoder-types.d.ts +61 -0
- package/es/utils/encoder-types.mjs +36 -0
- package/es/utils/encoder-types.mjs.map +1 -0
- package/es/utils/encoder.d.ts +6 -7
- package/es/utils/encoder.mjs +42 -26
- package/es/utils/encoder.mjs.map +1 -1
- package/es/utils/errors.d.ts +1 -11
- package/es/utils/errors.mjs +4 -20
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/hd-wallet.d.ts +18 -2
- package/es/utils/hd-wallet.mjs +64 -34
- package/es/utils/hd-wallet.mjs.map +1 -1
- package/es/utils/json-big.mjs +2 -2
- package/es/utils/json-big.mjs.map +1 -1
- package/es/utils/keystore.mjs +4 -2
- package/es/utils/keystore.mjs.map +1 -1
- package/es/utils/mptree.d.ts +2 -2
- package/es/utils/mptree.mjs +11 -6
- package/es/utils/mptree.mjs.map +1 -1
- package/es/utils/other.d.ts +8 -2
- package/es/utils/other.mjs +15 -3
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/semver-satisfies.d.ts +1 -1
- package/es/utils/semver-satisfies.mjs +2 -2
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/es/utils/string.mjs.map +1 -1
- package/package.json +36 -34
- package/src/AeSdk.ts +30 -27
- package/src/AeSdkAepp.ts +93 -84
- package/src/AeSdkBase.ts +148 -130
- package/src/AeSdkWallet.ts +172 -156
- package/src/Node.ts +108 -102
- package/src/account/Base.ts +42 -32
- package/src/account/Memory.ts +45 -30
- package/src/account/Rpc.ts +32 -30
- package/src/aens.ts +124 -108
- package/src/aepp-wallet-communication/connection/Browser.ts +18 -15
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +22 -21
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +63 -52
- package/src/aepp-wallet-communication/connection-proxy.ts +8 -7
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +67 -61
- package/src/aepp-wallet-communication/rpc/types.ts +32 -32
- package/src/aepp-wallet-communication/schema.ts +117 -74
- package/src/aepp-wallet-communication/wallet-detector.ts +29 -28
- package/src/apis/node/code-model-v4.yaml +54 -20
- package/src/apis/node/models/index.ts +6 -2
- package/src/apis/node/models/mappers.ts +4 -2
- package/src/chain.ts +286 -228
- package/src/channel/handlers.ts +424 -372
- package/src/channel/index.ts +285 -251
- package/src/channel/internal.ts +248 -232
- package/src/contract/Compiler.ts +22 -21
- package/src/contract/aci.ts +267 -258
- package/src/contract/ga.ts +93 -72
- package/src/contract/methods.ts +32 -27
- package/src/deprecated/index.ts +172 -0
- package/src/deprecated/methods.ts +25 -0
- package/src/index.ts +37 -32
- package/src/oracle.ts +211 -189
- package/src/spend.ts +82 -70
- package/src/tx/builder/address.ts +50 -0
- package/src/tx/builder/constants.ts +82 -52
- package/src/tx/builder/field-types/coin-amount.ts +27 -0
- package/src/tx/builder/field-types/deposit.ts +21 -0
- package/src/tx/builder/field-types/fee.ts +143 -0
- package/src/tx/builder/field-types/field.ts +9 -0
- package/src/tx/builder/field-types/gas-limit.ts +41 -0
- package/src/tx/builder/field-types/gas-price.ts +16 -0
- package/src/tx/builder/field-types/index.ts +45 -0
- package/src/tx/builder/field-types/name-fee.ts +32 -0
- package/src/tx/builder/field-types/name-id.ts +20 -0
- package/src/tx/builder/field-types/name.ts +18 -0
- package/src/tx/builder/field-types/short-u-int.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +16 -0
- package/src/tx/builder/helpers.ts +112 -117
- package/src/tx/builder/index.ts +203 -197
- package/src/tx/builder/schema.ts +421 -465
- package/src/tx/index.ts +128 -135
- package/src/tx/validator.ts +165 -161
- package/src/typings/@aeternity__argon2-browser/index.d.ts +1 -1
- package/src/typings/@aeternity__uuid/index.d.ts +3 -1
- package/src/typings/bip32-path/index.d.ts +6 -6
- package/src/typings/blakejs/index.d.ts +4 -32
- package/src/typings/sha-js/index.d.ts +5 -0
- package/src/typings/tweetnacl-auth/index.d.ts +2 -2
- package/src/utils/amount-formatter.ts +41 -41
- package/src/utils/autorest.ts +57 -54
- package/src/utils/bignumber.ts +7 -6
- package/src/utils/bytes.ts +19 -19
- package/src/utils/crypto.ts +82 -94
- package/src/utils/encoder-types.ts +63 -0
- package/src/utils/encoder.ts +104 -56
- package/src/utils/errors.ts +246 -264
- package/src/utils/hd-wallet.ts +114 -82
- package/src/utils/json-big.ts +16 -15
- package/src/utils/keystore.ts +65 -62
- package/src/utils/mptree.ts +59 -56
- package/src/utils/other.ts +26 -18
- package/src/utils/semver-satisfies.ts +15 -11
- package/src/utils/string.ts +10 -10
- package/es/tx/builder/field-types.d.ts +0 -62
- package/es/tx/builder/field-types.mjs +0 -126
- package/es/tx/builder/field-types.mjs.map +0 -1
- package/es/tx/min-fee.d.ts +0 -20
- package/es/tx/min-fee.mjs.map +0 -1
- package/src/tx/builder/field-types.ts +0 -111
- package/src/tx/min-fee.ts +0 -136
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
/**
|
|
19
19
|
* Browser connection proxy
|
|
20
20
|
* Provide functionality to easily forward messages from one connection to another and back
|
|
21
|
+
* @category aepp wallet communication
|
|
21
22
|
* @param con1 - first connection
|
|
22
23
|
* @param con2 - second connection
|
|
23
24
|
* @returns a function to stop proxying
|
|
@@ -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'
|
|
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,IAAD,EAA0BC,IAA1B,KAAkE;EAC/ED,IAAI,CAACE,OAAL,CAAcC,GAAD,IAAcF,IAAI,CAACG,WAAL,CAAiBD,GAAjB,CAA3B,EAAkD,MAAMF,IAAI,CAACI,UAAL,EAAxD;EACAJ,IAAI,CAACC,OAAL,CAAcC,GAAD,IAAcH,IAAI,CAACI,WAAL,CAAiBD,GAAjB,CAA3B,EAAkD,MAAMH,IAAI,CAACK,UAAL,EAAxD;EAEA,OAAO,MAAM;IACXL,IAAI,CAACK,UAAL;IACAJ,IAAI,CAACI,UAAL;EACD,CAHD;AAID,CARD"}
|
|
@@ -8,6 +8,7 @@ declare type WithOrigin<Api extends RpcApi<Api>> = {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Contain functionality for using RPC conection
|
|
11
|
+
* @category aepp wallet communication
|
|
11
12
|
* @param connection - Connection object
|
|
12
13
|
* @param onDisconnect - Disconnect callback
|
|
13
14
|
* @param methods - Object containing handlers for each request by name
|
|
@@ -28,6 +28,7 @@ var _processResponse = /*#__PURE__*/new WeakSet();
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Contain functionality for using RPC conection
|
|
31
|
+
* @category aepp wallet communication
|
|
31
32
|
* @param connection - Connection object
|
|
32
33
|
* @param onDisconnect - Disconnect callback
|
|
33
34
|
* @param methods - Object containing handlers for each request by name
|
|
@@ -71,11 +72,9 @@ export default class RpcClient {
|
|
|
71
72
|
* @returns Promise which will be resolved after receiving response message
|
|
72
73
|
*/
|
|
73
74
|
async request(name, params) {
|
|
74
|
-
|
|
75
|
+
_classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, _classPrivateFieldSet(this, _messageId, _classPrivateFieldGet(this, _messageId) + 1), name, params);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return await new Promise((resolve, reject) => {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
79
78
|
_classPrivateFieldGet(this, _callbacks).set(_classPrivateFieldGet(this, _messageId), {
|
|
80
79
|
resolve,
|
|
81
80
|
reject
|
|
@@ -110,7 +109,8 @@ async function _handleMessage2(msg, origin) {
|
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
const request = msg;
|
|
113
|
-
let result
|
|
112
|
+
let result;
|
|
113
|
+
let error;
|
|
114
114
|
|
|
115
115
|
try {
|
|
116
116
|
if (!(request.method in _classPrivateFieldGet(this, _methods))) throw new RpcMethodNotFoundError();
|
|
@@ -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'
|
|
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; let\n 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":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { send } from '../../spend';
|
|
2
|
-
import {
|
|
2
|
+
import { Encoded } from '../../utils/encoder';
|
|
3
3
|
import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
|
|
4
4
|
export interface WalletInfo {
|
|
5
5
|
id: string;
|
|
@@ -10,10 +10,10 @@ export interface WalletInfo {
|
|
|
10
10
|
}
|
|
11
11
|
export interface Accounts {
|
|
12
12
|
connected: {
|
|
13
|
-
[pub:
|
|
13
|
+
[pub: Encoded.AccountAddress]: {};
|
|
14
14
|
};
|
|
15
15
|
current: {
|
|
16
|
-
[pub:
|
|
16
|
+
[pub: Encoded.AccountAddress]: {};
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export interface Node {
|
|
@@ -48,10 +48,10 @@ export interface WalletApi {
|
|
|
48
48
|
subscription: Array<'connected' | 'current'>;
|
|
49
49
|
address: Accounts;
|
|
50
50
|
}>;
|
|
51
|
-
[METHODS.address]: () => Promise<
|
|
51
|
+
[METHODS.address]: () => Promise<Encoded.AccountAddress[]>;
|
|
52
52
|
[METHODS.sign]: ((p: {
|
|
53
|
-
tx:
|
|
54
|
-
onAccount:
|
|
53
|
+
tx: Encoded.Transaction;
|
|
54
|
+
onAccount: Encoded.AccountAddress;
|
|
55
55
|
returnSigned: boolean;
|
|
56
56
|
}) => Promise<{
|
|
57
57
|
/**
|
|
@@ -59,11 +59,11 @@ export interface WalletApi {
|
|
|
59
59
|
* as dropping ability to broadcast transaction by wallet
|
|
60
60
|
*/
|
|
61
61
|
transactionHash?: Awaited<ReturnType<typeof send>>;
|
|
62
|
-
signedTransaction?:
|
|
62
|
+
signedTransaction?: Encoded.Transaction;
|
|
63
63
|
}>);
|
|
64
64
|
[METHODS.signMessage]: (p: {
|
|
65
65
|
message: string;
|
|
66
|
-
onAccount:
|
|
66
|
+
onAccount: Encoded.AccountAddress;
|
|
67
67
|
}) => Promise<{
|
|
68
68
|
signature: string;
|
|
69
69
|
}>;
|
|
@@ -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'
|
|
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: { tx: Encoded.Transaction; onAccount: Encoded.AccountAddress; returnSigned: boolean }\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,O;AA2BT,OAAO,MAAMC,WAAW,GAAG,CAApB"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Encoded } from '../utils/encoder';
|
|
2
2
|
import { BaseError } from '../utils/errors';
|
|
3
|
+
/**
|
|
4
|
+
* @category aepp wallet communication
|
|
5
|
+
*/
|
|
3
6
|
export declare const enum MESSAGE_DIRECTION {
|
|
4
7
|
to_waellet = "to_waellet",
|
|
5
8
|
to_aepp = "to_aepp"
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @category aepp wallet communication
|
|
12
|
+
*/
|
|
7
13
|
export declare const enum WALLET_TYPE {
|
|
8
14
|
window = "window",
|
|
9
15
|
extension = "extension"
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @category aepp wallet communication
|
|
19
|
+
*/
|
|
11
20
|
export declare const enum SUBSCRIPTION_TYPES {
|
|
12
21
|
subscribe = "subscribe",
|
|
13
22
|
unsubscribe = "unsubscribe"
|
|
14
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @category aepp wallet communication
|
|
26
|
+
*/
|
|
15
27
|
export declare const enum METHODS {
|
|
16
28
|
readyToConnect = "connection.announcePresence",
|
|
17
29
|
updateAddress = "address.update",
|
|
@@ -23,6 +35,9 @@ export declare const enum METHODS {
|
|
|
23
35
|
updateNetwork = "networkId.update",
|
|
24
36
|
closeConnection = "connection.close"
|
|
25
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @category aepp wallet communication
|
|
40
|
+
*/
|
|
26
41
|
export declare const enum RPC_STATUS {
|
|
27
42
|
CONNECTED = "CONNECTED",
|
|
28
43
|
DISCONNECTED = "DISCONNECTED",
|
|
@@ -97,7 +112,7 @@ export declare class RpcNotAuthorizeError extends RpcError {
|
|
|
97
112
|
export declare class RpcPermissionDenyError extends RpcError {
|
|
98
113
|
static code: number;
|
|
99
114
|
code: number;
|
|
100
|
-
constructor(address:
|
|
115
|
+
constructor(address: Encoded.AccountAddress);
|
|
101
116
|
}
|
|
102
117
|
/**
|
|
103
118
|
* @category exception
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
|
+
// eslint-disable-next-line max-classes-per-file
|
|
2
3
|
import { BaseError, InternalError } from "../utils/errors.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* @category aepp wallet communication
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
export let MESSAGE_DIRECTION;
|
|
9
|
+
/**
|
|
10
|
+
* @category aepp wallet communication
|
|
11
|
+
*/
|
|
4
12
|
|
|
5
13
|
(function (MESSAGE_DIRECTION) {
|
|
6
14
|
MESSAGE_DIRECTION["to_waellet"] = "to_waellet";
|
|
@@ -8,6 +16,9 @@ export let MESSAGE_DIRECTION;
|
|
|
8
16
|
})(MESSAGE_DIRECTION || (MESSAGE_DIRECTION = {}));
|
|
9
17
|
|
|
10
18
|
export let WALLET_TYPE;
|
|
19
|
+
/**
|
|
20
|
+
* @category aepp wallet communication
|
|
21
|
+
*/
|
|
11
22
|
|
|
12
23
|
(function (WALLET_TYPE) {
|
|
13
24
|
WALLET_TYPE["window"] = "window";
|
|
@@ -15,6 +26,9 @@ export let WALLET_TYPE;
|
|
|
15
26
|
})(WALLET_TYPE || (WALLET_TYPE = {}));
|
|
16
27
|
|
|
17
28
|
export let SUBSCRIPTION_TYPES;
|
|
29
|
+
/**
|
|
30
|
+
* @category aepp wallet communication
|
|
31
|
+
*/
|
|
18
32
|
|
|
19
33
|
(function (SUBSCRIPTION_TYPES) {
|
|
20
34
|
SUBSCRIPTION_TYPES["subscribe"] = "subscribe";
|
|
@@ -22,6 +36,9 @@ export let SUBSCRIPTION_TYPES;
|
|
|
22
36
|
})(SUBSCRIPTION_TYPES || (SUBSCRIPTION_TYPES = {}));
|
|
23
37
|
|
|
24
38
|
export let METHODS;
|
|
39
|
+
/**
|
|
40
|
+
* @category aepp wallet communication
|
|
41
|
+
*/
|
|
25
42
|
|
|
26
43
|
(function (METHODS) {
|
|
27
44
|
METHODS["readyToConnect"] = "connection.announcePresence";
|
|
@@ -43,9 +60,11 @@ export let RPC_STATUS;
|
|
|
43
60
|
RPC_STATUS["WAITING_FOR_CONNECTION_REQUEST"] = "WAITING_FOR_CONNECTION_REQUEST";
|
|
44
61
|
})(RPC_STATUS || (RPC_STATUS = {}));
|
|
45
62
|
|
|
63
|
+
const rpcErrors = [];
|
|
46
64
|
/**
|
|
47
65
|
* @category exception
|
|
48
66
|
*/
|
|
67
|
+
|
|
49
68
|
export class RpcError extends BaseError {
|
|
50
69
|
toJSON() {
|
|
51
70
|
return {
|
|
@@ -56,7 +75,7 @@ export class RpcError extends BaseError {
|
|
|
56
75
|
}
|
|
57
76
|
|
|
58
77
|
static deserialize(json) {
|
|
59
|
-
const RpcErr =
|
|
78
|
+
const RpcErr = rpcErrors.find(cl => cl.code === json.code);
|
|
60
79
|
if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);
|
|
61
80
|
return new RpcErr(json.data);
|
|
62
81
|
}
|
|
@@ -77,12 +96,14 @@ export class RpcInvalidTransactionError extends RpcError {
|
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
}
|
|
99
|
+
|
|
100
|
+
_defineProperty(RpcInvalidTransactionError, "code", 2);
|
|
101
|
+
|
|
102
|
+
rpcErrors.push(RpcInvalidTransactionError);
|
|
80
103
|
/**
|
|
81
104
|
* @category exception
|
|
82
105
|
*/
|
|
83
106
|
|
|
84
|
-
_defineProperty(RpcInvalidTransactionError, "code", 2);
|
|
85
|
-
|
|
86
107
|
export class RpcBroadcastError extends RpcError {
|
|
87
108
|
constructor(data) {
|
|
88
109
|
super('Broadcast failed');
|
|
@@ -94,12 +115,14 @@ export class RpcBroadcastError extends RpcError {
|
|
|
94
115
|
}
|
|
95
116
|
|
|
96
117
|
}
|
|
118
|
+
|
|
119
|
+
_defineProperty(RpcBroadcastError, "code", 3);
|
|
120
|
+
|
|
121
|
+
rpcErrors.push(RpcBroadcastError);
|
|
97
122
|
/**
|
|
98
123
|
* @category exception
|
|
99
124
|
*/
|
|
100
125
|
|
|
101
|
-
_defineProperty(RpcBroadcastError, "code", 3);
|
|
102
|
-
|
|
103
126
|
export class RpcRejectedByUserError extends RpcError {
|
|
104
127
|
constructor(data) {
|
|
105
128
|
super('Operation rejected by user');
|
|
@@ -111,12 +134,14 @@ export class RpcRejectedByUserError extends RpcError {
|
|
|
111
134
|
}
|
|
112
135
|
|
|
113
136
|
}
|
|
137
|
+
|
|
138
|
+
_defineProperty(RpcRejectedByUserError, "code", 4);
|
|
139
|
+
|
|
140
|
+
rpcErrors.push(RpcRejectedByUserError);
|
|
114
141
|
/**
|
|
115
142
|
* @category exception
|
|
116
143
|
*/
|
|
117
144
|
|
|
118
|
-
_defineProperty(RpcRejectedByUserError, "code", 4);
|
|
119
|
-
|
|
120
145
|
export class RpcUnsupportedProtocolError extends RpcError {
|
|
121
146
|
constructor() {
|
|
122
147
|
super('Unsupported Protocol Version');
|
|
@@ -127,12 +152,14 @@ export class RpcUnsupportedProtocolError extends RpcError {
|
|
|
127
152
|
}
|
|
128
153
|
|
|
129
154
|
}
|
|
155
|
+
|
|
156
|
+
_defineProperty(RpcUnsupportedProtocolError, "code", 5);
|
|
157
|
+
|
|
158
|
+
rpcErrors.push(RpcUnsupportedProtocolError);
|
|
130
159
|
/**
|
|
131
160
|
* @category exception
|
|
132
161
|
*/
|
|
133
162
|
|
|
134
|
-
_defineProperty(RpcUnsupportedProtocolError, "code", 5);
|
|
135
|
-
|
|
136
163
|
export class RpcConnectionDenyError extends RpcError {
|
|
137
164
|
constructor(data) {
|
|
138
165
|
super('Wallet deny your connection request');
|
|
@@ -144,12 +171,14 @@ export class RpcConnectionDenyError extends RpcError {
|
|
|
144
171
|
}
|
|
145
172
|
|
|
146
173
|
}
|
|
174
|
+
|
|
175
|
+
_defineProperty(RpcConnectionDenyError, "code", 9);
|
|
176
|
+
|
|
177
|
+
rpcErrors.push(RpcConnectionDenyError);
|
|
147
178
|
/**
|
|
148
179
|
* @category exception
|
|
149
180
|
*/
|
|
150
181
|
|
|
151
|
-
_defineProperty(RpcConnectionDenyError, "code", 9);
|
|
152
|
-
|
|
153
182
|
export class RpcNotAuthorizeError extends RpcError {
|
|
154
183
|
constructor() {
|
|
155
184
|
super('You are not connected to the wallet');
|
|
@@ -160,12 +189,14 @@ export class RpcNotAuthorizeError extends RpcError {
|
|
|
160
189
|
}
|
|
161
190
|
|
|
162
191
|
}
|
|
192
|
+
|
|
193
|
+
_defineProperty(RpcNotAuthorizeError, "code", 10);
|
|
194
|
+
|
|
195
|
+
rpcErrors.push(RpcNotAuthorizeError);
|
|
163
196
|
/**
|
|
164
197
|
* @category exception
|
|
165
198
|
*/
|
|
166
199
|
|
|
167
|
-
_defineProperty(RpcNotAuthorizeError, "code", 10);
|
|
168
|
-
|
|
169
200
|
export class RpcPermissionDenyError extends RpcError {
|
|
170
201
|
constructor(address) {
|
|
171
202
|
super(`You are not subscribed for account ${address}`);
|
|
@@ -177,12 +208,14 @@ export class RpcPermissionDenyError extends RpcError {
|
|
|
177
208
|
}
|
|
178
209
|
|
|
179
210
|
}
|
|
211
|
+
|
|
212
|
+
_defineProperty(RpcPermissionDenyError, "code", 11);
|
|
213
|
+
|
|
214
|
+
rpcErrors.push(RpcPermissionDenyError);
|
|
180
215
|
/**
|
|
181
216
|
* @category exception
|
|
182
217
|
*/
|
|
183
218
|
|
|
184
|
-
_defineProperty(RpcPermissionDenyError, "code", 11);
|
|
185
|
-
|
|
186
219
|
export class RpcInternalError extends RpcError {
|
|
187
220
|
constructor() {
|
|
188
221
|
super('The peer failed to execute your request due to unknown error');
|
|
@@ -193,12 +226,14 @@ export class RpcInternalError extends RpcError {
|
|
|
193
226
|
}
|
|
194
227
|
|
|
195
228
|
}
|
|
229
|
+
|
|
230
|
+
_defineProperty(RpcInternalError, "code", 12);
|
|
231
|
+
|
|
232
|
+
rpcErrors.push(RpcInternalError);
|
|
196
233
|
/**
|
|
197
234
|
* @category exception
|
|
198
235
|
*/
|
|
199
236
|
|
|
200
|
-
_defineProperty(RpcInternalError, "code", 12);
|
|
201
|
-
|
|
202
237
|
export class RpcMethodNotFoundError extends RpcError {
|
|
203
238
|
constructor() {
|
|
204
239
|
super('Method not found');
|
|
@@ -211,4 +246,6 @@ export class RpcMethodNotFoundError extends RpcError {
|
|
|
211
246
|
}
|
|
212
247
|
|
|
213
248
|
_defineProperty(RpcMethodNotFoundError, "code", -32601);
|
|
249
|
+
|
|
250
|
+
rpcErrors.push(RpcMethodNotFoundError);
|
|
214
251
|
//# sourceMappingURL=schema.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":["BaseError","InternalError","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","RpcError","toJSON","code","message","data","deserialize","json","RpcErr","
|
|
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":"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"}
|
|
@@ -13,11 +13,12 @@ interface Wallets {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* A function to detect available wallets
|
|
16
|
+
* @category aepp wallet communication
|
|
16
17
|
* @param connection - connection to use to detect wallets
|
|
17
18
|
* @param onDetected - call-back function which trigger on new wallet
|
|
18
19
|
* @returns a function to stop scanning
|
|
19
20
|
*/
|
|
20
|
-
declare const _default: (connection: BrowserConnection
|
|
21
|
+
declare const _default: (connection: BrowserConnection, onDetected: ({ wallets, newWallet }: {
|
|
21
22
|
wallets: Wallets;
|
|
22
23
|
newWallet?: Wallet | undefined;
|
|
23
24
|
}) => void) => () => void;
|
|
@@ -20,13 +20,12 @@ import { UnsupportedPlatformError } from "../utils/errors.mjs";
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* A function to detect available wallets
|
|
23
|
+
* @category aepp wallet communication
|
|
23
24
|
* @param connection - connection to use to detect wallets
|
|
24
25
|
* @param onDetected - call-back function which trigger on new wallet
|
|
25
26
|
* @returns a function to stop scanning
|
|
26
27
|
*/
|
|
27
|
-
export default (
|
|
28
|
-
let connection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new BrowserWindowMessageConnection();
|
|
29
|
-
let onDetected = arguments.length > 1 ? arguments[1] : undefined;
|
|
28
|
+
export default ((connection, onDetected) => {
|
|
30
29
|
if (window == null) throw new UnsupportedPlatformError('Window object not found, you can run wallet detector only in browser');
|
|
31
30
|
const wallets = {};
|
|
32
31
|
connection.connect((_ref, origin, source) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-detector.mjs","names":["BrowserWindowMessageConnection","MESSAGE_DIRECTION","METHODS","UnsupportedPlatformError","connection","onDetected","window","wallets","connect","origin","source","method","params","readyToConnect","id","wallet","info","getConnection","isExtension","type","sendDirection","to_waellet","undefined","receiveDirection","to_aepp","target","newWallet","Object","keys","length","disconnect"],"sources":["../../src/aepp-wallet-communication/wallet-detector.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'
|
|
1
|
+
{"version":3,"file":"wallet-detector.mjs","names":["BrowserWindowMessageConnection","MESSAGE_DIRECTION","METHODS","UnsupportedPlatformError","connection","onDetected","window","wallets","connect","origin","source","method","params","readyToConnect","id","wallet","info","getConnection","isExtension","type","sendDirection","to_waellet","undefined","receiveDirection","to_aepp","target","newWallet","Object","keys","length","disconnect"],"sources":["../../src/aepp-wallet-communication/wallet-detector.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';\nimport BrowserWindowMessageConnection from './connection/BrowserWindowMessage';\nimport { MESSAGE_DIRECTION, METHODS } from './schema';\nimport { UnsupportedPlatformError } from '../utils/errors';\n\ninterface Wallet {\n info: {\n id: string;\n type: string;\n origin: string;\n };\n getConnection: () => BrowserWindowMessageConnection;\n}\ninterface Wallets { [key: string]: Wallet }\n\n/**\n * A function to detect available wallets\n * @category aepp wallet communication\n * @param connection - connection to use to detect wallets\n * @param onDetected - call-back function which trigger on new wallet\n * @returns a function to stop scanning\n */\nexport default (\n connection: BrowserConnection,\n onDetected: ({ wallets, newWallet }: { wallets: Wallets; newWallet?: Wallet }) => void,\n): () => void => {\n if (window == null) throw new UnsupportedPlatformError('Window object not found, you can run wallet detector only in browser');\n const wallets: Wallets = {};\n\n connection.connect((\n { method, params }: { method: string; params: Wallet['info'] },\n origin: string,\n source: Window,\n ) => {\n if (method !== METHODS.readyToConnect || wallets[params.id] != null) return;\n\n const wallet = {\n info: params,\n getConnection() {\n const isExtension = params.type === 'extension';\n return new BrowserWindowMessageConnection({\n sendDirection: isExtension ? MESSAGE_DIRECTION.to_waellet : undefined,\n receiveDirection: isExtension ? MESSAGE_DIRECTION.to_aepp : undefined,\n target: source,\n origin: isExtension ? window.origin : params.origin,\n });\n },\n };\n wallets[wallet.info.id] = wallet;\n onDetected({ wallets, newWallet: wallet });\n }, () => {});\n if (Object.keys(wallets).length > 0) onDetected({ wallets });\n\n return () => connection.disconnect();\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;OAGOA,8B;SACEC,iB,EAAmBC,O;SACnBC,wB;;AAYT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CACbC,UADa,EAEbC,UAFa,KAGE;EACf,IAAIC,MAAM,IAAI,IAAd,EAAoB,MAAM,IAAIH,wBAAJ,CAA6B,sEAA7B,CAAN;EACpB,MAAMI,OAAgB,GAAG,EAAzB;EAEAH,UAAU,CAACI,OAAX,CAAmB,OAEjBC,MAFiB,EAGjBC,MAHiB,KAId;IAAA,IAHH;MAAEC,MAAF;MAAUC;IAAV,CAGG;IACH,IAAID,MAAM,KAAKT,OAAO,CAACW,cAAnB,IAAqCN,OAAO,CAACK,MAAM,CAACE,EAAR,CAAP,IAAsB,IAA/D,EAAqE;IAErE,MAAMC,MAAM,GAAG;MACbC,IAAI,EAAEJ,MADO;;MAEbK,aAAa,GAAG;QACd,MAAMC,WAAW,GAAGN,MAAM,CAACO,IAAP,KAAgB,WAApC;QACA,OAAO,IAAInB,8BAAJ,CAAmC;UACxCoB,aAAa,EAAEF,WAAW,GAAGjB,iBAAiB,CAACoB,UAArB,GAAkCC,SADpB;UAExCC,gBAAgB,EAAEL,WAAW,GAAGjB,iBAAiB,CAACuB,OAArB,GAA+BF,SAFpB;UAGxCG,MAAM,EAAEf,MAHgC;UAIxCD,MAAM,EAAES,WAAW,GAAGZ,MAAM,CAACG,MAAV,GAAmBG,MAAM,CAACH;QAJL,CAAnC,CAAP;MAMD;;IAVY,CAAf;IAYAF,OAAO,CAACQ,MAAM,CAACC,IAAP,CAAYF,EAAb,CAAP,GAA0BC,MAA1B;IACAV,UAAU,CAAC;MAAEE,OAAF;MAAWmB,SAAS,EAAEX;IAAtB,CAAD,CAAV;EACD,CArBD,EAqBG,MAAM,CAAE,CArBX;EAsBA,IAAIY,MAAM,CAACC,IAAP,CAAYrB,OAAZ,EAAqBsB,MAArB,GAA8B,CAAlC,EAAqCxB,UAAU,CAAC;IAAEE;EAAF,CAAD,CAAV;EAErC,OAAO,MAAMH,UAAU,CAAC0B,UAAX,EAAb;AACD,CAhCD"}
|
|
@@ -294,7 +294,7 @@ export interface ContractCallObject {
|
|
|
294
294
|
/** Base64Check encoded tagged byte array */
|
|
295
295
|
returnValue: string;
|
|
296
296
|
/** The status of the call 'ok | error | revert'. */
|
|
297
|
-
returnType:
|
|
297
|
+
returnType: ContractCallReturnType;
|
|
298
298
|
}
|
|
299
299
|
export interface Event {
|
|
300
300
|
/** Base58Check encoded tagged pubkey */
|
|
@@ -318,7 +318,7 @@ export interface GAObject {
|
|
|
318
318
|
/** Base64Check encoded tagged byte array */
|
|
319
319
|
returnValue: string;
|
|
320
320
|
/** The status of the call 'ok | error'. */
|
|
321
|
-
returnType:
|
|
321
|
+
returnType: GAReturnType;
|
|
322
322
|
innerObject?: TxInfoObject;
|
|
323
323
|
}
|
|
324
324
|
export interface EncodedTx {
|
|
@@ -869,6 +869,10 @@ export declare type TxType = "SpendTx" | "ChannelCreateTx" | "ChannelDepositTx"
|
|
|
869
869
|
export declare type AccountKind = "basic" | "generalized";
|
|
870
870
|
/** Defines values for NextNonceStrategy. */
|
|
871
871
|
export declare type NextNonceStrategy = "max" | "continuity";
|
|
872
|
+
/** Defines values for ContractCallReturnType. */
|
|
873
|
+
export declare type ContractCallReturnType = "ok" | "error" | "revert";
|
|
874
|
+
/** Defines values for GAReturnType. */
|
|
875
|
+
export declare type GAReturnType = "ok" | "error";
|
|
872
876
|
/** Defines values for OracleQueryType. */
|
|
873
877
|
export declare type OracleQueryType = "open" | "closed" | "all";
|
|
874
878
|
/** Optional parameters. */
|