@metamask/keyring-api 11.1.0 → 12.0.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/CHANGELOG.md +14 -1
- package/dist/api/account.cjs +3 -4
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +1 -1
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +1 -1
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +1 -2
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +5 -6
- package/dist/api/asset.cjs.map +1 -1
- package/dist/api/asset.d.cts +2 -2
- package/dist/api/asset.d.cts.map +1 -1
- package/dist/api/asset.d.mts +2 -2
- package/dist/api/asset.d.mts.map +1 -1
- package/dist/api/asset.mjs +1 -2
- package/dist/api/asset.mjs.map +1 -1
- package/dist/api/balance.cjs +3 -4
- package/dist/api/balance.cjs.map +1 -1
- package/dist/api/balance.d.cts.map +1 -1
- package/dist/api/balance.d.mts.map +1 -1
- package/dist/api/balance.mjs +1 -2
- package/dist/api/balance.mjs.map +1 -1
- package/dist/api/caip.cjs +3 -3
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +1 -1
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs +2 -0
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +2 -0
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/{utils → api}/pagination.cjs +3 -3
- package/dist/api/pagination.cjs.map +1 -0
- package/dist/{utils → api}/pagination.d.cts +1 -1
- package/dist/api/pagination.d.cts.map +1 -0
- package/dist/{utils → api}/pagination.d.mts +1 -1
- package/dist/api/pagination.d.mts.map +1 -0
- package/dist/{utils → api}/pagination.mjs +1 -1
- package/dist/api/pagination.mjs.map +1 -0
- package/dist/api/request.cjs +6 -7
- package/dist/api/request.cjs.map +1 -1
- package/dist/api/request.d.cts +5 -5
- package/dist/api/request.d.cts.map +1 -1
- package/dist/api/request.d.mts +5 -5
- package/dist/api/request.d.mts.map +1 -1
- package/dist/api/request.mjs +1 -2
- package/dist/api/request.mjs.map +1 -1
- package/dist/api/response.cjs +6 -6
- package/dist/api/response.cjs.map +1 -1
- package/dist/api/response.d.cts +1 -1
- package/dist/api/response.d.cts.map +1 -1
- package/dist/api/response.d.mts +1 -1
- package/dist/api/response.d.mts.map +1 -1
- package/dist/api/response.mjs +1 -1
- package/dist/api/response.mjs.map +1 -1
- package/dist/api/transaction.cjs +7 -8
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +65 -65
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +65 -65
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +1 -2
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/btc/types.cjs +2 -2
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +1 -1
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +1 -1
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +2 -2
- package/dist/btc/types.mjs.map +1 -1
- package/dist/eth/erc4337/types.cjs +10 -11
- package/dist/eth/erc4337/types.cjs.map +1 -1
- package/dist/eth/erc4337/types.d.cts +5 -5
- package/dist/eth/erc4337/types.d.cts.map +1 -1
- package/dist/eth/erc4337/types.d.mts +5 -5
- package/dist/eth/erc4337/types.d.mts.map +1 -1
- package/dist/eth/erc4337/types.mjs +1 -2
- package/dist/eth/erc4337/types.mjs.map +1 -1
- package/dist/eth/types.cjs +6 -6
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +2 -2
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +2 -2
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/utils.cjs.map +1 -1
- package/dist/eth/utils.d.cts.map +1 -1
- package/dist/eth/utils.d.mts.map +1 -1
- package/dist/eth/utils.mjs.map +1 -1
- package/dist/events.cjs +67 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +161 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +161 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +66 -0
- package/dist/events.mjs.map +1 -1
- package/dist/index.cjs +2 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{internal/api.cjs → rpc.cjs} +71 -42
- package/dist/rpc.cjs.map +1 -0
- package/dist/{internal/api.d.cts → rpc.d.cts} +130 -104
- package/dist/rpc.d.cts.map +1 -0
- package/dist/{internal/api.d.mts → rpc.d.mts} +130 -104
- package/dist/rpc.d.mts.map +1 -0
- package/dist/{internal/api.mjs → rpc.mjs} +33 -5
- package/dist/rpc.mjs.map +1 -0
- package/dist/sol/types.cjs +3 -3
- package/dist/sol/types.cjs.map +1 -1
- package/dist/sol/types.d.cts +1 -1
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +1 -1
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/sol/types.mjs +1 -1
- package/dist/sol/types.mjs.map +1 -1
- package/package.json +10 -13
- package/dist/JsonRpcRequest.cjs +0 -13
- package/dist/JsonRpcRequest.cjs.map +0 -1
- package/dist/JsonRpcRequest.d.cts +0 -17
- package/dist/JsonRpcRequest.d.cts.map +0 -1
- package/dist/JsonRpcRequest.d.mts +0 -17
- package/dist/JsonRpcRequest.d.mts.map +0 -1
- package/dist/JsonRpcRequest.mjs +0 -10
- package/dist/JsonRpcRequest.mjs.map +0 -1
- package/dist/KeyringClient.cjs +0 -130
- package/dist/KeyringClient.cjs.map +0 -1
- package/dist/KeyringClient.d.cts +0 -31
- package/dist/KeyringClient.d.cts.map +0 -1
- package/dist/KeyringClient.d.mts +0 -31
- package/dist/KeyringClient.d.mts.map +0 -1
- package/dist/KeyringClient.mjs +0 -126
- package/dist/KeyringClient.mjs.map +0 -1
- package/dist/KeyringSnapRpcClient.cjs +0 -68
- package/dist/KeyringSnapRpcClient.cjs.map +0 -1
- package/dist/KeyringSnapRpcClient.d.cts +0 -40
- package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
- package/dist/KeyringSnapRpcClient.d.mts +0 -40
- package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
- package/dist/KeyringSnapRpcClient.mjs +0 -63
- package/dist/KeyringSnapRpcClient.mjs.map +0 -1
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.d.cts.map +0 -1
- package/dist/internal/api.d.mts.map +0 -1
- package/dist/internal/api.mjs.map +0 -1
- package/dist/internal/eth/EthKeyring.cjs +0 -3
- package/dist/internal/eth/EthKeyring.cjs.map +0 -1
- package/dist/internal/eth/EthKeyring.d.cts +0 -34
- package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
- package/dist/internal/eth/EthKeyring.d.mts +0 -34
- package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
- package/dist/internal/eth/EthKeyring.mjs +0 -2
- package/dist/internal/eth/EthKeyring.mjs.map +0 -1
- package/dist/internal/eth/index.cjs +0 -3
- package/dist/internal/eth/index.cjs.map +0 -1
- package/dist/internal/eth/index.d.cts +0 -2
- package/dist/internal/eth/index.d.cts.map +0 -1
- package/dist/internal/eth/index.d.mts +0 -2
- package/dist/internal/eth/index.d.mts.map +0 -1
- package/dist/internal/eth/index.mjs +0 -2
- package/dist/internal/eth/index.mjs.map +0 -1
- package/dist/internal/events.cjs +0 -72
- package/dist/internal/events.cjs.map +0 -1
- package/dist/internal/events.d.cts +0 -162
- package/dist/internal/events.d.cts.map +0 -1
- package/dist/internal/events.d.mts +0 -162
- package/dist/internal/events.d.mts.map +0 -1
- package/dist/internal/events.mjs +0 -69
- package/dist/internal/events.mjs.map +0 -1
- package/dist/internal/index.cjs +0 -21
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.d.cts +0 -6
- package/dist/internal/index.d.cts.map +0 -1
- package/dist/internal/index.d.mts +0 -6
- package/dist/internal/index.d.mts.map +0 -1
- package/dist/internal/index.mjs +0 -5
- package/dist/internal/index.mjs.map +0 -1
- package/dist/internal/rpc.cjs +0 -34
- package/dist/internal/rpc.cjs.map +0 -1
- package/dist/internal/rpc.d.cts +0 -27
- package/dist/internal/rpc.d.cts.map +0 -1
- package/dist/internal/rpc.d.mts +0 -27
- package/dist/internal/rpc.d.mts.map +0 -1
- package/dist/internal/rpc.mjs +0 -30
- package/dist/internal/rpc.mjs.map +0 -1
- package/dist/internal/types.cjs +0 -52
- package/dist/internal/types.cjs.map +0 -1
- package/dist/internal/types.d.cts +0 -392
- package/dist/internal/types.d.cts.map +0 -1
- package/dist/internal/types.d.mts +0 -392
- package/dist/internal/types.d.mts.map +0 -1
- package/dist/internal/types.mjs +0 -49
- package/dist/internal/types.mjs.map +0 -1
- package/dist/rpc-handler.cjs +0 -143
- package/dist/rpc-handler.cjs.map +0 -1
- package/dist/rpc-handler.d.cts +0 -30
- package/dist/rpc-handler.d.cts.map +0 -1
- package/dist/rpc-handler.d.mts +0 -30
- package/dist/rpc-handler.d.mts.map +0 -1
- package/dist/rpc-handler.mjs +0 -138
- package/dist/rpc-handler.mjs.map +0 -1
- package/dist/snap-utils.cjs +0 -20
- package/dist/snap-utils.cjs.map +0 -1
- package/dist/snap-utils.d.cts +0 -12
- package/dist/snap-utils.d.cts.map +0 -1
- package/dist/snap-utils.d.mts +0 -12
- package/dist/snap-utils.d.mts.map +0 -1
- package/dist/snap-utils.mjs +0 -17
- package/dist/snap-utils.mjs.map +0 -1
- package/dist/superstruct.cjs +0 -109
- package/dist/superstruct.cjs.map +0 -1
- package/dist/superstruct.d.cts +0 -102
- package/dist/superstruct.d.cts.map +0 -1
- package/dist/superstruct.d.mts +0 -102
- package/dist/superstruct.d.mts.map +0 -1
- package/dist/superstruct.mjs +0 -102
- package/dist/superstruct.mjs.map +0 -1
- package/dist/utils/index.cjs +0 -20
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.cts +0 -4
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.mts +0 -4
- package/dist/utils/index.d.mts.map +0 -1
- package/dist/utils/index.mjs +0 -4
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/pagination.cjs.map +0 -1
- package/dist/utils/pagination.d.cts.map +0 -1
- package/dist/utils/pagination.d.mts.map +0 -1
- package/dist/utils/pagination.mjs.map +0 -1
- package/dist/utils/types.cjs +0 -29
- package/dist/utils/types.cjs.map +0 -1
- package/dist/utils/types.d.cts +0 -42
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.mts +0 -42
- package/dist/utils/types.d.mts.map +0 -1
- package/dist/utils/types.mjs +0 -26
- package/dist/utils/types.mjs.map +0 -1
- package/dist/utils/typing.cjs +0 -20
- package/dist/utils/typing.cjs.map +0 -1
- package/dist/utils/typing.d.cts +0 -33
- package/dist/utils/typing.d.cts.map +0 -1
- package/dist/utils/typing.d.mts +0 -33
- package/dist/utils/typing.d.mts.map +0 -1
- package/dist/utils/typing.mjs +0 -17
- package/dist/utils/typing.mjs.map +0 -1
package/dist/KeyringClient.mjs
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
-
};
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
-
};
|
12
|
-
var _KeyringClient_instances, _KeyringClient_sender, _KeyringClient_send;
|
13
|
-
import { assert } from "@metamask/superstruct";
|
14
|
-
import { v4 as uuid } from "uuid";
|
15
|
-
import { ApproveRequestResponseStruct, CreateAccountResponseStruct, DeleteAccountResponseStruct, ExportAccountResponseStruct, FilterAccountChainsResponseStruct, GetAccountBalancesResponseStruct, GetAccountResponseStruct, GetRequestResponseStruct, ListAccountsResponseStruct, ListAccountTransactionsResponseStruct, ListRequestsResponseStruct, RejectRequestResponseStruct, SubmitRequestResponseStruct, UpdateAccountResponseStruct } from "./internal/api.mjs";
|
16
|
-
import { KeyringRpcMethod } from "./internal/rpc.mjs";
|
17
|
-
import { strictMask } from "./superstruct.mjs";
|
18
|
-
export class KeyringClient {
|
19
|
-
/**
|
20
|
-
* Create a new instance of `KeyringClient`.
|
21
|
-
*
|
22
|
-
* @param sender - The `Sender` instance to use to send requests to the snap.
|
23
|
-
*/
|
24
|
-
constructor(sender) {
|
25
|
-
_KeyringClient_instances.add(this);
|
26
|
-
_KeyringClient_sender.set(this, void 0);
|
27
|
-
__classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
|
28
|
-
}
|
29
|
-
async listAccounts() {
|
30
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
31
|
-
method: KeyringRpcMethod.ListAccounts,
|
32
|
-
}), ListAccountsResponseStruct);
|
33
|
-
}
|
34
|
-
async getAccount(id) {
|
35
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
36
|
-
method: KeyringRpcMethod.GetAccount,
|
37
|
-
params: { id },
|
38
|
-
}), GetAccountResponseStruct);
|
39
|
-
}
|
40
|
-
async getAccountBalances(id, assets) {
|
41
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
42
|
-
method: KeyringRpcMethod.GetAccountBalances,
|
43
|
-
params: { id, assets },
|
44
|
-
}), GetAccountBalancesResponseStruct);
|
45
|
-
}
|
46
|
-
async createAccount(options = {}) {
|
47
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
48
|
-
method: KeyringRpcMethod.CreateAccount,
|
49
|
-
params: { options },
|
50
|
-
}), CreateAccountResponseStruct);
|
51
|
-
}
|
52
|
-
async listAccountTransactions(id, pagination) {
|
53
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
54
|
-
method: KeyringRpcMethod.ListAccountTransactions,
|
55
|
-
params: { id, pagination },
|
56
|
-
}), ListAccountTransactionsResponseStruct);
|
57
|
-
}
|
58
|
-
async filterAccountChains(id, chains) {
|
59
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
60
|
-
method: KeyringRpcMethod.FilterAccountChains,
|
61
|
-
params: { id, chains },
|
62
|
-
}), FilterAccountChainsResponseStruct);
|
63
|
-
}
|
64
|
-
async updateAccount(account) {
|
65
|
-
assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
66
|
-
method: KeyringRpcMethod.UpdateAccount,
|
67
|
-
params: { account },
|
68
|
-
}), UpdateAccountResponseStruct);
|
69
|
-
}
|
70
|
-
async deleteAccount(id) {
|
71
|
-
assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
72
|
-
method: KeyringRpcMethod.DeleteAccount,
|
73
|
-
params: { id },
|
74
|
-
}), DeleteAccountResponseStruct);
|
75
|
-
}
|
76
|
-
async exportAccount(id) {
|
77
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
78
|
-
method: KeyringRpcMethod.ExportAccount,
|
79
|
-
params: { id },
|
80
|
-
}), ExportAccountResponseStruct);
|
81
|
-
}
|
82
|
-
async listRequests() {
|
83
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
84
|
-
method: KeyringRpcMethod.ListRequests,
|
85
|
-
}), ListRequestsResponseStruct);
|
86
|
-
}
|
87
|
-
async getRequest(id) {
|
88
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
89
|
-
method: KeyringRpcMethod.GetRequest,
|
90
|
-
params: { id },
|
91
|
-
}), GetRequestResponseStruct);
|
92
|
-
}
|
93
|
-
async submitRequest(request) {
|
94
|
-
return strictMask(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
95
|
-
method: KeyringRpcMethod.SubmitRequest,
|
96
|
-
params: request,
|
97
|
-
}), SubmitRequestResponseStruct);
|
98
|
-
}
|
99
|
-
async approveRequest(id, data = {}) {
|
100
|
-
assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
101
|
-
method: KeyringRpcMethod.ApproveRequest,
|
102
|
-
params: { id, data },
|
103
|
-
}), ApproveRequestResponseStruct);
|
104
|
-
}
|
105
|
-
async rejectRequest(id) {
|
106
|
-
assert(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
|
107
|
-
method: KeyringRpcMethod.RejectRequest,
|
108
|
-
params: { id },
|
109
|
-
}), RejectRequestResponseStruct);
|
110
|
-
}
|
111
|
-
}
|
112
|
-
_KeyringClient_sender = new WeakMap(), _KeyringClient_instances = new WeakSet(), _KeyringClient_send =
|
113
|
-
/**
|
114
|
-
* Send a request to the snap and return the response.
|
115
|
-
*
|
116
|
-
* @param partial - A partial JSON-RPC request (method and params).
|
117
|
-
* @returns A promise that resolves to the response to the request.
|
118
|
-
*/
|
119
|
-
async function _KeyringClient_send(partial) {
|
120
|
-
return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
|
121
|
-
jsonrpc: '2.0',
|
122
|
-
id: uuid(),
|
123
|
-
...partial,
|
124
|
-
});
|
125
|
-
};
|
126
|
-
//# sourceMappingURL=KeyringClient.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KeyringClient.mjs","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAYlC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,qCAAqC,EACrC,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC5B,2BAAuB;AACxB,OAAO,EAAE,gBAAgB,EAAE,2BAAuB;AAElD,OAAO,EAAE,UAAU,EAAE,0BAAsB;AAO3C,MAAM,OAAO,aAAa;IAGxB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,MAAM,EAAE,gBAAgB,CAAC,UAAU;YACnC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,OAAO,UAAU,CACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,OAAO;SAChB,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,OAA6B,EAAE;QAE/B,MAAM,CACJ,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,cAAc;YACvC,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;SACrB,CAAC,EACF,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,MAAM,CACJ,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,gBAAgB,CAAC,aAAa;YACtC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,2BAA2B,CAC5B,CAAC;IACJ,CAAC;CACF;;AAlKC;;;;;GAKG;AACH,KAAK,8BAAO,OAA+C;IACzD,OAAO,uBAAA,IAAI,6BAAQ,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,IAAI,EAAE;QACV,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n TransactionsPage,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListAccountTransactionsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\nimport type { Pagination } from './utils';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async listAccountTransactions(\n id: string,\n pagination: Pagination,\n ): Promise<TransactionsPage> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccountTransactions,\n params: { id, pagination },\n }),\n ListAccountTransactionsResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
7
|
-
};
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12
|
-
};
|
13
|
-
var _SnapRpcSender_origin, _SnapRpcSender_provider;
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
exports.KeyringSnapRpcClient = exports.SnapRpcSender = void 0;
|
16
|
-
const KeyringClient_1 = require("./KeyringClient.cjs");
|
17
|
-
/**
|
18
|
-
* Implementation of the `Sender` interface that can be used to send requests
|
19
|
-
* to a snap through the snap JSON-RPC API.
|
20
|
-
*/
|
21
|
-
class SnapRpcSender {
|
22
|
-
/**
|
23
|
-
* Create a new instance of `SnapRpcSender`.
|
24
|
-
*
|
25
|
-
* @param origin - The caller's origin.
|
26
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
27
|
-
*/
|
28
|
-
constructor(origin, provider) {
|
29
|
-
_SnapRpcSender_origin.set(this, void 0);
|
30
|
-
_SnapRpcSender_provider.set(this, void 0);
|
31
|
-
__classPrivateFieldSet(this, _SnapRpcSender_origin, origin, "f");
|
32
|
-
__classPrivateFieldSet(this, _SnapRpcSender_provider, provider, "f");
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* Send a request to the snap and return the response.
|
36
|
-
*
|
37
|
-
* @param request - The JSON-RPC request to send to the snap.
|
38
|
-
* @returns A promise that resolves to the response of the request.
|
39
|
-
*/
|
40
|
-
async send(request) {
|
41
|
-
return __classPrivateFieldGet(this, _SnapRpcSender_provider, "f").request({
|
42
|
-
method: 'wallet_invokeKeyring',
|
43
|
-
params: {
|
44
|
-
snapId: __classPrivateFieldGet(this, _SnapRpcSender_origin, "f"),
|
45
|
-
request,
|
46
|
-
},
|
47
|
-
});
|
48
|
-
}
|
49
|
-
}
|
50
|
-
exports.SnapRpcSender = SnapRpcSender;
|
51
|
-
_SnapRpcSender_origin = new WeakMap(), _SnapRpcSender_provider = new WeakMap();
|
52
|
-
/**
|
53
|
-
* A `KeyringClient` that allows the communication with a snap through the snap
|
54
|
-
* JSON-RPC API.
|
55
|
-
*/
|
56
|
-
class KeyringSnapRpcClient extends KeyringClient_1.KeyringClient {
|
57
|
-
/**
|
58
|
-
* Create a new instance of `KeyringSnapRpcClient`.
|
59
|
-
*
|
60
|
-
* @param origin - Caller's origin.
|
61
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
62
|
-
*/
|
63
|
-
constructor(origin, provider) {
|
64
|
-
super(new SnapRpcSender(origin, provider));
|
65
|
-
}
|
66
|
-
}
|
67
|
-
exports.KeyringSnapRpcClient = KeyringSnapRpcClient;
|
68
|
-
//# sourceMappingURL=KeyringSnapRpcClient.cjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KeyringSnapRpcClient.cjs","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,uDAAgD;AAEhD;;;GAGG;AACH,MAAa,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAVnD,wCAAgB;QAEhB,0CAAkC;QASzC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;AA/BD,sCA+BC;;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,6BAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAVD,oDAUC","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n readonly #origin: string;\n\n readonly #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeKeyring',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import type { MetaMaskInpageProvider } from "@metamask/providers";
|
2
|
-
import type { Json } from "@metamask/utils";
|
3
|
-
import type { JsonRpcRequest } from "./JsonRpcRequest.cjs";
|
4
|
-
import type { Sender } from "./KeyringClient.cjs";
|
5
|
-
import { KeyringClient } from "./KeyringClient.cjs";
|
6
|
-
/**
|
7
|
-
* Implementation of the `Sender` interface that can be used to send requests
|
8
|
-
* to a snap through the snap JSON-RPC API.
|
9
|
-
*/
|
10
|
-
export declare class SnapRpcSender implements Sender {
|
11
|
-
#private;
|
12
|
-
/**
|
13
|
-
* Create a new instance of `SnapRpcSender`.
|
14
|
-
*
|
15
|
-
* @param origin - The caller's origin.
|
16
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
17
|
-
*/
|
18
|
-
constructor(origin: string, provider: MetaMaskInpageProvider);
|
19
|
-
/**
|
20
|
-
* Send a request to the snap and return the response.
|
21
|
-
*
|
22
|
-
* @param request - The JSON-RPC request to send to the snap.
|
23
|
-
* @returns A promise that resolves to the response of the request.
|
24
|
-
*/
|
25
|
-
send(request: JsonRpcRequest): Promise<Json>;
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* A `KeyringClient` that allows the communication with a snap through the snap
|
29
|
-
* JSON-RPC API.
|
30
|
-
*/
|
31
|
-
export declare class KeyringSnapRpcClient extends KeyringClient {
|
32
|
-
/**
|
33
|
-
* Create a new instance of `KeyringSnapRpcClient`.
|
34
|
-
*
|
35
|
-
* @param origin - Caller's origin.
|
36
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
37
|
-
*/
|
38
|
-
constructor(origin: string, provider: MetaMaskInpageProvider);
|
39
|
-
}
|
40
|
-
//# sourceMappingURL=KeyringSnapRpcClient.d.cts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KeyringSnapRpcClient.d.cts","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,qBAAa,aAAc,YAAW,MAAM;;IAK1C;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;IAK5D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;CAG7D"}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import type { MetaMaskInpageProvider } from "@metamask/providers";
|
2
|
-
import type { Json } from "@metamask/utils";
|
3
|
-
import type { JsonRpcRequest } from "./JsonRpcRequest.mjs";
|
4
|
-
import type { Sender } from "./KeyringClient.mjs";
|
5
|
-
import { KeyringClient } from "./KeyringClient.mjs";
|
6
|
-
/**
|
7
|
-
* Implementation of the `Sender` interface that can be used to send requests
|
8
|
-
* to a snap through the snap JSON-RPC API.
|
9
|
-
*/
|
10
|
-
export declare class SnapRpcSender implements Sender {
|
11
|
-
#private;
|
12
|
-
/**
|
13
|
-
* Create a new instance of `SnapRpcSender`.
|
14
|
-
*
|
15
|
-
* @param origin - The caller's origin.
|
16
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
17
|
-
*/
|
18
|
-
constructor(origin: string, provider: MetaMaskInpageProvider);
|
19
|
-
/**
|
20
|
-
* Send a request to the snap and return the response.
|
21
|
-
*
|
22
|
-
* @param request - The JSON-RPC request to send to the snap.
|
23
|
-
* @returns A promise that resolves to the response of the request.
|
24
|
-
*/
|
25
|
-
send(request: JsonRpcRequest): Promise<Json>;
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* A `KeyringClient` that allows the communication with a snap through the snap
|
29
|
-
* JSON-RPC API.
|
30
|
-
*/
|
31
|
-
export declare class KeyringSnapRpcClient extends KeyringClient {
|
32
|
-
/**
|
33
|
-
* Create a new instance of `KeyringSnapRpcClient`.
|
34
|
-
*
|
35
|
-
* @param origin - Caller's origin.
|
36
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
37
|
-
*/
|
38
|
-
constructor(origin: string, provider: MetaMaskInpageProvider);
|
39
|
-
}
|
40
|
-
//# sourceMappingURL=KeyringSnapRpcClient.d.mts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KeyringSnapRpcClient.d.mts","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,4BAAwB;AAC9C,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,qBAAa,aAAc,YAAW,MAAM;;IAK1C;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;IAK5D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB;CAG7D"}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
-
};
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
-
};
|
12
|
-
var _SnapRpcSender_origin, _SnapRpcSender_provider;
|
13
|
-
import { KeyringClient } from "./KeyringClient.mjs";
|
14
|
-
/**
|
15
|
-
* Implementation of the `Sender` interface that can be used to send requests
|
16
|
-
* to a snap through the snap JSON-RPC API.
|
17
|
-
*/
|
18
|
-
export class SnapRpcSender {
|
19
|
-
/**
|
20
|
-
* Create a new instance of `SnapRpcSender`.
|
21
|
-
*
|
22
|
-
* @param origin - The caller's origin.
|
23
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
24
|
-
*/
|
25
|
-
constructor(origin, provider) {
|
26
|
-
_SnapRpcSender_origin.set(this, void 0);
|
27
|
-
_SnapRpcSender_provider.set(this, void 0);
|
28
|
-
__classPrivateFieldSet(this, _SnapRpcSender_origin, origin, "f");
|
29
|
-
__classPrivateFieldSet(this, _SnapRpcSender_provider, provider, "f");
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Send a request to the snap and return the response.
|
33
|
-
*
|
34
|
-
* @param request - The JSON-RPC request to send to the snap.
|
35
|
-
* @returns A promise that resolves to the response of the request.
|
36
|
-
*/
|
37
|
-
async send(request) {
|
38
|
-
return __classPrivateFieldGet(this, _SnapRpcSender_provider, "f").request({
|
39
|
-
method: 'wallet_invokeKeyring',
|
40
|
-
params: {
|
41
|
-
snapId: __classPrivateFieldGet(this, _SnapRpcSender_origin, "f"),
|
42
|
-
request,
|
43
|
-
},
|
44
|
-
});
|
45
|
-
}
|
46
|
-
}
|
47
|
-
_SnapRpcSender_origin = new WeakMap(), _SnapRpcSender_provider = new WeakMap();
|
48
|
-
/**
|
49
|
-
* A `KeyringClient` that allows the communication with a snap through the snap
|
50
|
-
* JSON-RPC API.
|
51
|
-
*/
|
52
|
-
export class KeyringSnapRpcClient extends KeyringClient {
|
53
|
-
/**
|
54
|
-
* Create a new instance of `KeyringSnapRpcClient`.
|
55
|
-
*
|
56
|
-
* @param origin - Caller's origin.
|
57
|
-
* @param provider - The `MetaMaskInpageProvider` instance to use.
|
58
|
-
*/
|
59
|
-
constructor(origin, provider) {
|
60
|
-
super(new SnapRpcSender(origin, provider));
|
61
|
-
}
|
62
|
-
}
|
63
|
-
//# sourceMappingURL=KeyringSnapRpcClient.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"KeyringSnapRpcClient.mjs","sourceRoot":"","sources":["../src/KeyringSnapRpcClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAEhD;;;GAGG;AACH,MAAM,OAAO,aAAa;IAKxB;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAVnD,wCAAgB;QAEhB,0CAAkC;QASzC,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,2BAAa,QAAQ,MAAA,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,+BAAU,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,MAAM,EAAE;gBACN,MAAM,EAAE,uBAAA,IAAI,6BAAQ;gBACpB,OAAO;aACR;SACF,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,QAAgC;QAC1D,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import type { MetaMaskInpageProvider } from '@metamask/providers';\nimport type { Json } from '@metamask/utils';\n\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport type { Sender } from './KeyringClient';\nimport { KeyringClient } from './KeyringClient';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through the snap JSON-RPC API.\n */\nexport class SnapRpcSender implements Sender {\n readonly #origin: string;\n\n readonly #provider: MetaMaskInpageProvider;\n\n /**\n * Create a new instance of `SnapRpcSender`.\n *\n * @param origin - The caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n this.#origin = origin;\n this.#provider = provider;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - The JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#provider.request({\n method: 'wallet_invokeKeyring',\n params: {\n snapId: this.#origin,\n request,\n },\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the snap\n * JSON-RPC API.\n */\nexport class KeyringSnapRpcClient extends KeyringClient {\n /**\n * Create a new instance of `KeyringSnapRpcClient`.\n *\n * @param origin - Caller's origin.\n * @param provider - The `MetaMaskInpageProvider` instance to use.\n */\n constructor(origin: string, provider: MetaMaskInpageProvider) {\n super(new SnapRpcSender(origin, provider));\n }\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"api.cjs","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,mCAAyC;AACzC,0CAQgB;AAChB,oDAAwC;AACxC,8CAAwD;AAExD,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACxC,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,mBAAK,EAAC,0BAAoB,CAAC,CAAC;AAItE,+EAA+E;AAC/E,cAAc;AAED,QAAA,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACrC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,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BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,0BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,2BAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { PaginationStruct, UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List account transactions\n\nexport const ListAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountTransactions'),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type ListAccountTransactionsRequest = Infer<\n typeof ListAccountTransactionsRequestStruct\n>;\n\nexport const ListAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type ListAccountTransactionsResponse = Infer<\n typeof ListAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"api.d.cts","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAgCnD,eAAO,MAAM,yBAAyB;;;;;;;;EAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE1E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;GAA8B,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAK5E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;EAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;EAAuB,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAKxE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;EAAuB,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IACxC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAElB,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { PaginationStruct, UuidStruct } from '../utils';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List account transactions\n\nexport const ListAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountTransactions'),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type ListAccountTransactionsRequest = Infer<\n typeof ListAccountTransactionsRequestStruct\n>;\n\nexport const ListAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type ListAccountTransactionsResponse = Infer<\n typeof ListAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EthKeyring.cjs","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, Keyring } from '@metamask/utils';\n\nimport type { KeyringExecutionContext } from '../../contexts';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '../../eth';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import type { Json, Keyring } from "@metamask/utils";
|
2
|
-
import type { KeyringExecutionContext } from "../../contexts.cjs";
|
3
|
-
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "../../eth/index.cjs";
|
4
|
-
export type EthKeyring<State extends Json> = Keyring<State> & {
|
5
|
-
/**
|
6
|
-
* Convert a base transaction to a base UserOperation.
|
7
|
-
*
|
8
|
-
* @param address - Address of the sender.
|
9
|
-
* @param transactions - Base transactions to include in the UserOperation.
|
10
|
-
* @param context - Keyring execution context.
|
11
|
-
* @returns A pseudo-UserOperation that can be used to construct a real.
|
12
|
-
*/
|
13
|
-
prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
|
14
|
-
/**
|
15
|
-
* Patches properties of a UserOperation. Currently, only the
|
16
|
-
* `paymasterAndData` can be patched.
|
17
|
-
*
|
18
|
-
* @param address - Address of the sender.
|
19
|
-
* @param userOp - UserOperation to patch.
|
20
|
-
* @param context - Keyring execution context.
|
21
|
-
* @returns A patch to apply to the UserOperation.
|
22
|
-
*/
|
23
|
-
patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
|
24
|
-
/**
|
25
|
-
* Signs an UserOperation.
|
26
|
-
*
|
27
|
-
* @param address - Address of the sender.
|
28
|
-
* @param userOp - UserOperation to sign.
|
29
|
-
* @param context - Keyring execution context.
|
30
|
-
* @returns The signature of the UserOperation.
|
31
|
-
*/
|
32
|
-
signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
|
33
|
-
};
|
34
|
-
//# sourceMappingURL=EthKeyring.d.cts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EthKeyring.d.cts","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,4BAAkB;AAEnB,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import type { Json, Keyring } from "@metamask/utils";
|
2
|
-
import type { KeyringExecutionContext } from "../../contexts.mjs";
|
3
|
-
import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from "../../eth/index.mjs";
|
4
|
-
export type EthKeyring<State extends Json> = Keyring<State> & {
|
5
|
-
/**
|
6
|
-
* Convert a base transaction to a base UserOperation.
|
7
|
-
*
|
8
|
-
* @param address - Address of the sender.
|
9
|
-
* @param transactions - Base transactions to include in the UserOperation.
|
10
|
-
* @param context - Keyring execution context.
|
11
|
-
* @returns A pseudo-UserOperation that can be used to construct a real.
|
12
|
-
*/
|
13
|
-
prepareUserOperation?(address: string, transactions: EthBaseTransaction[], context: KeyringExecutionContext): Promise<EthBaseUserOperation>;
|
14
|
-
/**
|
15
|
-
* Patches properties of a UserOperation. Currently, only the
|
16
|
-
* `paymasterAndData` can be patched.
|
17
|
-
*
|
18
|
-
* @param address - Address of the sender.
|
19
|
-
* @param userOp - UserOperation to patch.
|
20
|
-
* @param context - Keyring execution context.
|
21
|
-
* @returns A patch to apply to the UserOperation.
|
22
|
-
*/
|
23
|
-
patchUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<EthUserOperationPatch>;
|
24
|
-
/**
|
25
|
-
* Signs an UserOperation.
|
26
|
-
*
|
27
|
-
* @param address - Address of the sender.
|
28
|
-
* @param userOp - UserOperation to sign.
|
29
|
-
* @param context - Keyring execution context.
|
30
|
-
* @returns The signature of the UserOperation.
|
31
|
-
*/
|
32
|
-
signUserOperation?(address: string, userOp: EthUserOperation, context: KeyringExecutionContext): Promise<string>;
|
33
|
-
};
|
34
|
-
//# sourceMappingURL=EthKeyring.d.mts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EthKeyring.d.mts","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAAuB;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACtB,4BAAkB;AAEnB,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG;IAC5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,CACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,iBAAiB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EthKeyring.mjs","sourceRoot":"","sources":["../../../src/internal/eth/EthKeyring.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, Keyring } from '@metamask/utils';\n\nimport type { KeyringExecutionContext } from '../../contexts';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthUserOperation,\n EthUserOperationPatch,\n} from '../../eth';\n\nexport type EthKeyring<State extends Json> = Keyring<State> & {\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param address - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param context - Keyring execution context.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n prepareUserOperation?(\n address: string,\n transactions: EthBaseTransaction[],\n context: KeyringExecutionContext,\n ): Promise<EthBaseUserOperation>;\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param context - Keyring execution context.\n * @returns A patch to apply to the UserOperation.\n */\n patchUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<EthUserOperationPatch>;\n\n /**\n * Signs an UserOperation.\n *\n * @param address - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param context - Keyring execution context.\n * @returns The signature of the UserOperation.\n */\n signUserOperation?(\n address: string,\n userOp: EthUserOperation,\n context: KeyringExecutionContext,\n ): Promise<string>;\n};\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
|