@metamask-previews/keyring-api 21.5.0-fd40efd → 22.0.0-5c366be
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 +23 -1
- package/dist/api/account-options.cjs +0 -4
- package/dist/api/account-options.cjs.map +1 -1
- package/dist/api/account-options.d.cts +0 -4
- package/dist/api/account-options.d.cts.map +1 -1
- package/dist/api/account-options.d.mts +0 -4
- package/dist/api/account-options.d.mts.map +1 -1
- package/dist/api/account-options.mjs +0 -4
- package/dist/api/account-options.mjs.map +1 -1
- package/dist/api/v2/index.cjs +1 -1
- package/dist/api/v2/index.cjs.map +1 -1
- package/dist/api/v2/index.d.cts +1 -1
- package/dist/api/v2/index.d.cts.map +1 -1
- package/dist/api/v2/index.d.mts +1 -1
- package/dist/api/v2/index.d.mts.map +1 -1
- package/dist/api/v2/index.mjs +1 -1
- package/dist/api/v2/index.mjs.map +1 -1
- package/dist/api/v2/keyring-rpc.cjs +93 -0
- package/dist/api/v2/keyring-rpc.cjs.map +1 -0
- package/dist/api/v2/keyring-rpc.d.cts +440 -0
- package/dist/api/v2/keyring-rpc.d.cts.map +1 -0
- package/dist/api/v2/keyring-rpc.d.mts +440 -0
- package/dist/api/v2/keyring-rpc.d.mts.map +1 -0
- package/dist/api/v2/keyring-rpc.mjs +89 -0
- package/dist/api/v2/keyring-rpc.mjs.map +1 -0
- package/dist/api/v2/keyring-type.cjs +4 -0
- package/dist/api/v2/keyring-type.cjs.map +1 -1
- package/dist/api/v2/keyring-type.d.cts +5 -1
- package/dist/api/v2/keyring-type.d.cts.map +1 -1
- package/dist/api/v2/keyring-type.d.mts +5 -1
- package/dist/api/v2/keyring-type.d.mts.map +1 -1
- package/dist/api/v2/keyring-type.mjs +4 -0
- package/dist/api/v2/keyring-type.mjs.map +1 -1
- package/dist/eth/index.cjs +0 -1
- package/dist/eth/index.cjs.map +1 -1
- package/dist/eth/index.d.cts +0 -1
- package/dist/eth/index.d.cts.map +1 -1
- package/dist/eth/index.d.mts +0 -1
- package/dist/eth/index.d.mts.map +1 -1
- package/dist/eth/index.mjs +0 -1
- package/dist/eth/index.mjs.map +1 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +1 -1
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs.map +1 -1
- package/package.json +3 -8
- package/dist/api/v2/wrapper/index.cjs +0 -19
- package/dist/api/v2/wrapper/index.cjs.map +0 -1
- package/dist/api/v2/wrapper/index.d.cts +0 -3
- package/dist/api/v2/wrapper/index.d.cts.map +0 -1
- package/dist/api/v2/wrapper/index.d.mts +0 -3
- package/dist/api/v2/wrapper/index.d.mts.map +0 -1
- package/dist/api/v2/wrapper/index.mjs +0 -3
- package/dist/api/v2/wrapper/index.mjs.map +0 -1
- package/dist/api/v2/wrapper/keyring-account-registry.cjs +0 -135
- package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +0 -1
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts +0 -88
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +0 -1
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts +0 -88
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +0 -1
- package/dist/api/v2/wrapper/keyring-account-registry.mjs +0 -131
- package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +0 -1
- package/dist/api/v2/wrapper/keyring-wrapper.cjs +0 -134
- package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +0 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts +0 -154
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +0 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts +0 -154
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +0 -1
- package/dist/api/v2/wrapper/keyring-wrapper.mjs +0 -130
- package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +0 -1
- package/dist/eth/v2/eth-keyring-wrapper.cjs +0 -165
- package/dist/eth/v2/eth-keyring-wrapper.cjs.map +0 -1
- package/dist/eth/v2/eth-keyring-wrapper.d.cts +0 -54
- package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +0 -1
- package/dist/eth/v2/eth-keyring-wrapper.d.mts +0 -54
- package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +0 -1
- package/dist/eth/v2/eth-keyring-wrapper.mjs +0 -161
- package/dist/eth/v2/eth-keyring-wrapper.mjs.map +0 -1
- package/dist/eth/v2/index.cjs +0 -18
- package/dist/eth/v2/index.cjs.map +0 -1
- package/dist/eth/v2/index.d.cts +0 -2
- package/dist/eth/v2/index.d.cts.map +0 -1
- package/dist/eth/v2/index.d.mts +0 -2
- package/dist/eth/v2/index.d.mts.map +0 -1
- package/dist/eth/v2/index.mjs +0 -2
- package/dist/eth/v2/index.mjs.map +0 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
import type { KeyringV2 } from "./keyring.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Keyring interface for keyring methods that can be invoked through
|
|
5
|
+
* RPC calls.
|
|
6
|
+
*/
|
|
7
|
+
export type KeyringRpcV2 = {
|
|
8
|
+
getAccount: KeyringV2['getAccount'];
|
|
9
|
+
getAccounts: KeyringV2['getAccounts'];
|
|
10
|
+
createAccounts: KeyringV2['createAccounts'];
|
|
11
|
+
deleteAccount: KeyringV2['deleteAccount'];
|
|
12
|
+
submitRequest: KeyringV2['submitRequest'];
|
|
13
|
+
exportAccount?: KeyringV2['exportAccount'];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Keyring RPC methods used by the API.
|
|
17
|
+
*/
|
|
18
|
+
export declare const KeyringRpcV2Method: {
|
|
19
|
+
readonly GetAccounts: "keyring_getAccounts";
|
|
20
|
+
readonly CreateAccounts: "keyring_createAccounts";
|
|
21
|
+
readonly GetAccount: "keyring_getAccount";
|
|
22
|
+
readonly DeleteAccount: "keyring_deleteAccount";
|
|
23
|
+
readonly ExportAccount: "keyring_exportAccount";
|
|
24
|
+
readonly SubmitRequest: "keyring_submitRequest";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Keyring RPC methods used by the API.
|
|
28
|
+
*/
|
|
29
|
+
export type KeyringRpcV2Method = (typeof KeyringRpcV2Method)[keyof typeof KeyringRpcV2Method];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a method is a keyring RPC method (v2).
|
|
32
|
+
*
|
|
33
|
+
* @param method - Method to check.
|
|
34
|
+
* @returns Whether the method is a keyring RPC method (v2).
|
|
35
|
+
*/
|
|
36
|
+
export declare function isKeyringRpcV2Method(method: string): method is KeyringRpcV2Method;
|
|
37
|
+
export declare const GetAccountsV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
38
|
+
method: "keyring_getAccounts";
|
|
39
|
+
id: string | number | null;
|
|
40
|
+
jsonrpc: "2.0";
|
|
41
|
+
}, {
|
|
42
|
+
method: import("@metamask/superstruct").Struct<"keyring_getAccounts", "keyring_getAccounts">;
|
|
43
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
44
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
45
|
+
}>;
|
|
46
|
+
export type GetAccountsV2Request = Infer<typeof GetAccountsV2RequestStruct>;
|
|
47
|
+
export declare const GetAccountsV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
48
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
49
|
+
id: string;
|
|
50
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
51
|
+
entropy?: {
|
|
52
|
+
type: "mnemonic";
|
|
53
|
+
id: string;
|
|
54
|
+
derivationPath: string;
|
|
55
|
+
groupIndex: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: "private-key";
|
|
58
|
+
} | {
|
|
59
|
+
type: "custom";
|
|
60
|
+
};
|
|
61
|
+
exportable?: boolean;
|
|
62
|
+
};
|
|
63
|
+
address: string;
|
|
64
|
+
scopes: `${string}:${string}`[];
|
|
65
|
+
methods: string[];
|
|
66
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
67
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
68
|
+
id: string;
|
|
69
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
70
|
+
entropy?: {
|
|
71
|
+
type: "mnemonic";
|
|
72
|
+
id: string;
|
|
73
|
+
derivationPath: string;
|
|
74
|
+
groupIndex: number;
|
|
75
|
+
} | {
|
|
76
|
+
type: "private-key";
|
|
77
|
+
} | {
|
|
78
|
+
type: "custom";
|
|
79
|
+
};
|
|
80
|
+
exportable?: boolean;
|
|
81
|
+
};
|
|
82
|
+
address: string;
|
|
83
|
+
scopes: `${string}:${string}`[];
|
|
84
|
+
methods: string[];
|
|
85
|
+
}, {
|
|
86
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
87
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
88
|
+
"eip155:eoa": "eip155:eoa";
|
|
89
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
90
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
91
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
92
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
93
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
94
|
+
"solana:data-account": "solana:data-account";
|
|
95
|
+
"tron:eoa": "tron:eoa";
|
|
96
|
+
"any:account": "any:account";
|
|
97
|
+
}>;
|
|
98
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
99
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
100
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
101
|
+
entropy?: {
|
|
102
|
+
type: "mnemonic";
|
|
103
|
+
id: string;
|
|
104
|
+
derivationPath: string;
|
|
105
|
+
groupIndex: number;
|
|
106
|
+
} | {
|
|
107
|
+
type: "private-key";
|
|
108
|
+
} | {
|
|
109
|
+
type: "custom";
|
|
110
|
+
};
|
|
111
|
+
exportable?: boolean;
|
|
112
|
+
}, null>;
|
|
113
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
114
|
+
}>>;
|
|
115
|
+
export type GetAccountsV2Response = Infer<typeof GetAccountsV2ResponseStruct>;
|
|
116
|
+
export declare const GetAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
117
|
+
method: "keyring_getAccount";
|
|
118
|
+
id: string | number | null;
|
|
119
|
+
jsonrpc: "2.0";
|
|
120
|
+
params: {
|
|
121
|
+
id: string;
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
method: import("@metamask/superstruct").Struct<"keyring_getAccount", "keyring_getAccount">;
|
|
125
|
+
params: import("@metamask/superstruct").Struct<{
|
|
126
|
+
id: string;
|
|
127
|
+
}, {
|
|
128
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
129
|
+
}>;
|
|
130
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
131
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
132
|
+
}>;
|
|
133
|
+
export type GetAccountV2Request = Infer<typeof GetAccountV2RequestStruct>;
|
|
134
|
+
export declare const GetAccountV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
135
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
136
|
+
id: string;
|
|
137
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
138
|
+
entropy?: {
|
|
139
|
+
type: "mnemonic";
|
|
140
|
+
id: string;
|
|
141
|
+
derivationPath: string;
|
|
142
|
+
groupIndex: number;
|
|
143
|
+
} | {
|
|
144
|
+
type: "private-key";
|
|
145
|
+
} | {
|
|
146
|
+
type: "custom";
|
|
147
|
+
};
|
|
148
|
+
exportable?: boolean;
|
|
149
|
+
};
|
|
150
|
+
address: string;
|
|
151
|
+
scopes: `${string}:${string}`[];
|
|
152
|
+
methods: string[];
|
|
153
|
+
}, {
|
|
154
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
155
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
156
|
+
"eip155:eoa": "eip155:eoa";
|
|
157
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
158
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
159
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
160
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
161
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
162
|
+
"solana:data-account": "solana:data-account";
|
|
163
|
+
"tron:eoa": "tron:eoa";
|
|
164
|
+
"any:account": "any:account";
|
|
165
|
+
}>;
|
|
166
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
167
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
168
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
169
|
+
entropy?: {
|
|
170
|
+
type: "mnemonic";
|
|
171
|
+
id: string;
|
|
172
|
+
derivationPath: string;
|
|
173
|
+
groupIndex: number;
|
|
174
|
+
} | {
|
|
175
|
+
type: "private-key";
|
|
176
|
+
} | {
|
|
177
|
+
type: "custom";
|
|
178
|
+
};
|
|
179
|
+
exportable?: boolean;
|
|
180
|
+
}, null>;
|
|
181
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
182
|
+
}>;
|
|
183
|
+
export type GetAccountV2Response = Infer<typeof GetAccountV2ResponseStruct>;
|
|
184
|
+
export declare const CreateAccountsV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
185
|
+
method: "keyring_createAccounts";
|
|
186
|
+
id: string | number | null;
|
|
187
|
+
jsonrpc: "2.0";
|
|
188
|
+
params: {
|
|
189
|
+
type: "bip44:derive-path";
|
|
190
|
+
derivationPath: `m/${string}`;
|
|
191
|
+
entropySource: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "bip44:derive-index";
|
|
194
|
+
groupIndex: number;
|
|
195
|
+
entropySource: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: "bip44:discover";
|
|
198
|
+
groupIndex: number;
|
|
199
|
+
entropySource: string;
|
|
200
|
+
} | {
|
|
201
|
+
type: "bip44:derive-index-range";
|
|
202
|
+
range: {
|
|
203
|
+
from: number;
|
|
204
|
+
to: number;
|
|
205
|
+
};
|
|
206
|
+
entropySource: string;
|
|
207
|
+
} | {
|
|
208
|
+
type: "custom";
|
|
209
|
+
} | {
|
|
210
|
+
type: "private-key:import";
|
|
211
|
+
encoding: "hexadecimal" | "base58";
|
|
212
|
+
privateKey: string;
|
|
213
|
+
accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
214
|
+
};
|
|
215
|
+
}, {
|
|
216
|
+
method: import("@metamask/superstruct").Struct<"keyring_createAccounts", "keyring_createAccounts">;
|
|
217
|
+
params: import("@metamask/superstruct").Struct<{
|
|
218
|
+
type: "bip44:derive-path";
|
|
219
|
+
derivationPath: `m/${string}`;
|
|
220
|
+
entropySource: string;
|
|
221
|
+
} | {
|
|
222
|
+
type: "bip44:derive-index";
|
|
223
|
+
groupIndex: number;
|
|
224
|
+
entropySource: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: "bip44:discover";
|
|
227
|
+
groupIndex: number;
|
|
228
|
+
entropySource: string;
|
|
229
|
+
} | {
|
|
230
|
+
type: "bip44:derive-index-range";
|
|
231
|
+
range: {
|
|
232
|
+
from: number;
|
|
233
|
+
to: number;
|
|
234
|
+
};
|
|
235
|
+
entropySource: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "custom";
|
|
238
|
+
} | {
|
|
239
|
+
type: "private-key:import";
|
|
240
|
+
encoding: "hexadecimal" | "base58";
|
|
241
|
+
privateKey: string;
|
|
242
|
+
accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
243
|
+
}, null>;
|
|
244
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
245
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
246
|
+
}>;
|
|
247
|
+
export type CreateAccountsV2Request = Infer<typeof CreateAccountsV2RequestStruct>;
|
|
248
|
+
export declare const CreateAccountsV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
249
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
250
|
+
id: string;
|
|
251
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
252
|
+
entropy?: {
|
|
253
|
+
type: "mnemonic";
|
|
254
|
+
id: string;
|
|
255
|
+
derivationPath: string;
|
|
256
|
+
groupIndex: number;
|
|
257
|
+
} | {
|
|
258
|
+
type: "private-key";
|
|
259
|
+
} | {
|
|
260
|
+
type: "custom";
|
|
261
|
+
};
|
|
262
|
+
exportable?: boolean;
|
|
263
|
+
};
|
|
264
|
+
address: string;
|
|
265
|
+
scopes: `${string}:${string}`[];
|
|
266
|
+
methods: string[];
|
|
267
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
268
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
269
|
+
id: string;
|
|
270
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
271
|
+
entropy?: {
|
|
272
|
+
type: "mnemonic";
|
|
273
|
+
id: string;
|
|
274
|
+
derivationPath: string;
|
|
275
|
+
groupIndex: number;
|
|
276
|
+
} | {
|
|
277
|
+
type: "private-key";
|
|
278
|
+
} | {
|
|
279
|
+
type: "custom";
|
|
280
|
+
};
|
|
281
|
+
exportable?: boolean;
|
|
282
|
+
};
|
|
283
|
+
address: string;
|
|
284
|
+
scopes: `${string}:${string}`[];
|
|
285
|
+
methods: string[];
|
|
286
|
+
}, {
|
|
287
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
288
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account", {
|
|
289
|
+
"eip155:eoa": "eip155:eoa";
|
|
290
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
291
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
|
292
|
+
"bip122:p2sh": "bip122:p2sh";
|
|
293
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
294
|
+
"bip122:p2tr": "bip122:p2tr";
|
|
295
|
+
"solana:data-account": "solana:data-account";
|
|
296
|
+
"tron:eoa": "tron:eoa";
|
|
297
|
+
"any:account": "any:account";
|
|
298
|
+
}>;
|
|
299
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
300
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
|
301
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> & {
|
|
302
|
+
entropy?: {
|
|
303
|
+
type: "mnemonic";
|
|
304
|
+
id: string;
|
|
305
|
+
derivationPath: string;
|
|
306
|
+
groupIndex: number;
|
|
307
|
+
} | {
|
|
308
|
+
type: "private-key";
|
|
309
|
+
} | {
|
|
310
|
+
type: "custom";
|
|
311
|
+
};
|
|
312
|
+
exportable?: boolean;
|
|
313
|
+
}, null>;
|
|
314
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
315
|
+
}>>;
|
|
316
|
+
export type CreateAccountsV2Response = Infer<typeof CreateAccountsV2ResponseStruct>;
|
|
317
|
+
export declare const DeleteAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
318
|
+
method: "keyring_deleteAccount";
|
|
319
|
+
id: string | number | null;
|
|
320
|
+
jsonrpc: "2.0";
|
|
321
|
+
params: {
|
|
322
|
+
id: string;
|
|
323
|
+
};
|
|
324
|
+
}, {
|
|
325
|
+
method: import("@metamask/superstruct").Struct<"keyring_deleteAccount", "keyring_deleteAccount">;
|
|
326
|
+
params: import("@metamask/superstruct").Struct<{
|
|
327
|
+
id: string;
|
|
328
|
+
}, {
|
|
329
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
330
|
+
}>;
|
|
331
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
332
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
333
|
+
}>;
|
|
334
|
+
export type DeleteAccountV2Request = Infer<typeof DeleteAccountV2RequestStruct>;
|
|
335
|
+
export declare const DeleteAccountV2ResponseStruct: import("@metamask/superstruct").Struct<null, null>;
|
|
336
|
+
export type DeleteAccountV2Response = Infer<typeof DeleteAccountV2ResponseStruct>;
|
|
337
|
+
export declare const ExportAccountV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
338
|
+
method: "keyring_exportAccount";
|
|
339
|
+
id: string | number | null;
|
|
340
|
+
jsonrpc: "2.0";
|
|
341
|
+
params: {
|
|
342
|
+
id: string;
|
|
343
|
+
options?: {
|
|
344
|
+
type: "private-key";
|
|
345
|
+
encoding: "hexadecimal" | "base58";
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
}, {
|
|
349
|
+
method: import("@metamask/superstruct").Struct<"keyring_exportAccount", "keyring_exportAccount">;
|
|
350
|
+
params: import("@metamask/superstruct").Struct<{
|
|
351
|
+
id: string;
|
|
352
|
+
options?: {
|
|
353
|
+
type: "private-key";
|
|
354
|
+
encoding: "hexadecimal" | "base58";
|
|
355
|
+
};
|
|
356
|
+
}, {
|
|
357
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
358
|
+
options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
359
|
+
type: "private-key";
|
|
360
|
+
encoding: "hexadecimal" | "base58";
|
|
361
|
+
}, {
|
|
362
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
363
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
364
|
+
hexadecimal: "hexadecimal";
|
|
365
|
+
base58: "base58";
|
|
366
|
+
}>;
|
|
367
|
+
}>;
|
|
368
|
+
}>;
|
|
369
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
370
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
371
|
+
}>;
|
|
372
|
+
export type ExportAccountV2Request = Infer<typeof ExportAccountV2RequestStruct>;
|
|
373
|
+
export declare const ExportAccountV2ResponseStruct: import("@metamask/superstruct").Struct<{
|
|
374
|
+
type: "private-key";
|
|
375
|
+
encoding: "hexadecimal" | "base58";
|
|
376
|
+
privateKey: string;
|
|
377
|
+
}, {
|
|
378
|
+
type: import("@metamask/superstruct").Struct<"private-key", "private-key">;
|
|
379
|
+
privateKey: import("@metamask/superstruct").Struct<string, null>;
|
|
380
|
+
encoding: import("@metamask/superstruct").Struct<"hexadecimal" | "base58", {
|
|
381
|
+
hexadecimal: "hexadecimal";
|
|
382
|
+
base58: "base58";
|
|
383
|
+
}>;
|
|
384
|
+
}>;
|
|
385
|
+
export type ExportAccountV2Response = Infer<typeof ExportAccountV2ResponseStruct>;
|
|
386
|
+
export declare const SubmitRequestV2RequestStruct: import("@metamask/superstruct").Struct<{
|
|
387
|
+
method: "keyring_submitRequest";
|
|
388
|
+
id: string | number | null;
|
|
389
|
+
jsonrpc: "2.0";
|
|
390
|
+
params: {
|
|
391
|
+
id: string;
|
|
392
|
+
origin: string;
|
|
393
|
+
request: {
|
|
394
|
+
method: string;
|
|
395
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
396
|
+
};
|
|
397
|
+
scope: string;
|
|
398
|
+
account: string;
|
|
399
|
+
};
|
|
400
|
+
}, {
|
|
401
|
+
method: import("@metamask/superstruct").Struct<"keyring_submitRequest", "keyring_submitRequest">;
|
|
402
|
+
params: import("@metamask/superstruct").Struct<{
|
|
403
|
+
id: string;
|
|
404
|
+
origin: string;
|
|
405
|
+
request: {
|
|
406
|
+
method: string;
|
|
407
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
408
|
+
};
|
|
409
|
+
scope: string;
|
|
410
|
+
account: string;
|
|
411
|
+
}, {
|
|
412
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
413
|
+
scope: import("@metamask/superstruct").Struct<string, null>;
|
|
414
|
+
account: import("@metamask/superstruct").Struct<string, null>;
|
|
415
|
+
origin: import("@metamask/superstruct").Struct<string, null>;
|
|
416
|
+
request: import("@metamask/superstruct").Struct<{
|
|
417
|
+
method: string;
|
|
418
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
|
|
419
|
+
}, {
|
|
420
|
+
method: import("@metamask/superstruct").Struct<string, null>;
|
|
421
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
422
|
+
}>;
|
|
423
|
+
}>;
|
|
424
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
|
425
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
|
426
|
+
}>;
|
|
427
|
+
export type SubmitRequestV2Request = Infer<typeof SubmitRequestV2RequestStruct>;
|
|
428
|
+
export declare const SubmitRequestV2ResponseStruct: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
|
429
|
+
export type SubmitRequestV2Response = Infer<typeof SubmitRequestV2ResponseStruct>;
|
|
430
|
+
/**
|
|
431
|
+
* Keyring RPC requests.
|
|
432
|
+
*/
|
|
433
|
+
export type KeyringRpcV2Requests = GetAccountsV2Request | GetAccountV2Request | CreateAccountsV2Request | DeleteAccountV2Request | ExportAccountV2Request | SubmitRequestV2Request;
|
|
434
|
+
/**
|
|
435
|
+
* Extract the proper request type for a given `KeyringRpcV2Method`.
|
|
436
|
+
*/
|
|
437
|
+
export type KeyringRpcV2Request<RpcMethod extends KeyringRpcV2Method> = Extract<KeyringRpcV2Requests, {
|
|
438
|
+
method: `${RpcMethod}`;
|
|
439
|
+
}>;
|
|
440
|
+
//# sourceMappingURL=keyring-rpc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-rpc.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AASnD,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAkB;AAI3C;;;GAGG;AACH,MAAM,MA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AsB,GACtB,sBAAsB,GACtB,sBAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,SAAS,SAAS,kBAAkB,IAAI,OAAO,CAC7E,oBAAoB,EACpB;IAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;CAAE,CAC3B,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { object, exactOptional, UuidStruct } from "@metamask/keyring-utils";
|
|
2
|
+
import { array, literal, number, string, union } from "@metamask/superstruct";
|
|
3
|
+
import { JsonStruct } from "@metamask/utils";
|
|
4
|
+
import { CreateAccountOptionsStruct } from "./create-account/index.mjs";
|
|
5
|
+
import { ExportAccountOptionsStruct, PrivateKeyExportedAccountStruct } from "./export-account/index.mjs";
|
|
6
|
+
import { KeyringAccountStruct } from "../account.mjs";
|
|
7
|
+
import { KeyringRequestStruct } from "../request.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Keyring RPC methods used by the API.
|
|
10
|
+
*/
|
|
11
|
+
export const KeyringRpcV2Method = {
|
|
12
|
+
GetAccounts: 'keyring_getAccounts',
|
|
13
|
+
CreateAccounts: 'keyring_createAccounts',
|
|
14
|
+
// Inherited from v1 (but method signatures may differ...):
|
|
15
|
+
// NOTE: We use literals here to avoid circular dependencies.
|
|
16
|
+
GetAccount: 'keyring_getAccount',
|
|
17
|
+
DeleteAccount: 'keyring_deleteAccount',
|
|
18
|
+
ExportAccount: 'keyring_exportAccount',
|
|
19
|
+
SubmitRequest: 'keyring_submitRequest',
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Check if a method is a keyring RPC method (v2).
|
|
23
|
+
*
|
|
24
|
+
* @param method - Method to check.
|
|
25
|
+
* @returns Whether the method is a keyring RPC method (v2).
|
|
26
|
+
*/
|
|
27
|
+
export function isKeyringRpcV2Method(method) {
|
|
28
|
+
return Object.values(KeyringRpcV2Method).includes(method);
|
|
29
|
+
}
|
|
30
|
+
// ----------------------------------------------------------------------------
|
|
31
|
+
const CommonHeader = {
|
|
32
|
+
jsonrpc: literal('2.0'),
|
|
33
|
+
id: union([string(), number(), literal(null)]),
|
|
34
|
+
};
|
|
35
|
+
// ----------------------------------------------------------------------------
|
|
36
|
+
// Get accounts
|
|
37
|
+
export const GetAccountsV2RequestStruct = object({
|
|
38
|
+
...CommonHeader,
|
|
39
|
+
method: literal(`${KeyringRpcV2Method.GetAccounts}`),
|
|
40
|
+
});
|
|
41
|
+
export const GetAccountsV2ResponseStruct = array(KeyringAccountStruct);
|
|
42
|
+
// ----------------------------------------------------------------------------
|
|
43
|
+
// Get account
|
|
44
|
+
export const GetAccountV2RequestStruct = object({
|
|
45
|
+
...CommonHeader,
|
|
46
|
+
method: literal(`${KeyringRpcV2Method.GetAccount}`),
|
|
47
|
+
params: object({
|
|
48
|
+
id: UuidStruct,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
export const GetAccountV2ResponseStruct = KeyringAccountStruct;
|
|
52
|
+
// ----------------------------------------------------------------------------
|
|
53
|
+
// Create accounts
|
|
54
|
+
export const CreateAccountsV2RequestStruct = object({
|
|
55
|
+
...CommonHeader,
|
|
56
|
+
method: literal(`${KeyringRpcV2Method.CreateAccounts}`),
|
|
57
|
+
params: CreateAccountOptionsStruct,
|
|
58
|
+
});
|
|
59
|
+
export const CreateAccountsV2ResponseStruct = array(KeyringAccountStruct);
|
|
60
|
+
// ----------------------------------------------------------------------------
|
|
61
|
+
// Delete account
|
|
62
|
+
export const DeleteAccountV2RequestStruct = object({
|
|
63
|
+
...CommonHeader,
|
|
64
|
+
method: literal(`${KeyringRpcV2Method.DeleteAccount}`),
|
|
65
|
+
params: object({
|
|
66
|
+
id: UuidStruct,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
export const DeleteAccountV2ResponseStruct = literal(null);
|
|
70
|
+
// ----------------------------------------------------------------------------
|
|
71
|
+
// Export account
|
|
72
|
+
export const ExportAccountV2RequestStruct = object({
|
|
73
|
+
...CommonHeader,
|
|
74
|
+
method: literal(`${KeyringRpcV2Method.ExportAccount}`),
|
|
75
|
+
params: object({
|
|
76
|
+
id: UuidStruct,
|
|
77
|
+
options: exactOptional(ExportAccountOptionsStruct),
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
export const ExportAccountV2ResponseStruct = PrivateKeyExportedAccountStruct;
|
|
81
|
+
// ----------------------------------------------------------------------------
|
|
82
|
+
// Submit request
|
|
83
|
+
export const SubmitRequestV2RequestStruct = object({
|
|
84
|
+
...CommonHeader,
|
|
85
|
+
method: literal(`${KeyringRpcV2Method.SubmitRequest}`),
|
|
86
|
+
params: KeyringRequestStruct,
|
|
87
|
+
});
|
|
88
|
+
export const SubmitRequestV2ResponseStruct = JsonStruct;
|
|
89
|
+
//# sourceMappingURL=keyring-rpc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-rpc.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC9E,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,0BAA0B,EAAE,mCAAyB;AAC9D,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAChC,mCAAyB;AAE1B,OAAO,EAAE,oBAAoB,EAAE,uBAAmB;AAClD,OAAO,EAAE,oBAAoB,EAAE,uBAAmB;AAelD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAA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/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAM3D,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,OAAO,EAAE,aAAa,CAAC,0BAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAC;AAM7E,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAAC,aAAa,EAAE,CAAC;IACtD,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { KeyringV2 } from './keyring';\nimport { KeyringAccountStruct } from '../account';\nimport { KeyringRequestStruct } from '../request';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpcV2 = {\n getAccount: KeyringV2['getAccount'];\n getAccounts: KeyringV2['getAccounts'];\n createAccounts: KeyringV2['createAccounts'];\n deleteAccount: KeyringV2['deleteAccount'];\n submitRequest: KeyringV2['submitRequest'];\n exportAccount?: KeyringV2['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcV2Method = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcV2Method =\n (typeof KeyringRpcV2Method)[keyof typeof KeyringRpcV2Method];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcV2Method(\n method: string,\n): method is KeyringRpcV2Method {\n return Object.values(KeyringRpcV2Method).includes(\n method as KeyringRpcV2Method,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccounts}`),\n});\n\nexport type GetAccountsV2Request = Infer<typeof GetAccountsV2RequestStruct>;\n\nexport const GetAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsV2Response = Infer<typeof GetAccountsV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountV2Request = Infer<typeof GetAccountV2RequestStruct>;\n\nexport const GetAccountV2ResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountV2Response = Infer<typeof GetAccountV2ResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsV2Request = Infer<\n typeof CreateAccountsV2RequestStruct\n>;\n\nexport const CreateAccountsV2ResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsV2Response = Infer<\n typeof CreateAccountsV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountV2Request = Infer<typeof DeleteAccountV2RequestStruct>;\n\nexport const DeleteAccountV2ResponseStruct = literal(null);\n\nexport type DeleteAccountV2Response = Infer<\n typeof DeleteAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountV2Request = Infer<typeof ExportAccountV2RequestStruct>;\n\nexport const ExportAccountV2ResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountV2Response = Infer<\n typeof ExportAccountV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestV2RequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcV2Method.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestV2Request = Infer<typeof SubmitRequestV2RequestStruct>;\n\nexport const SubmitRequestV2ResponseStruct = JsonStruct;\n\nexport type SubmitRequestV2Response = Infer<\n typeof SubmitRequestV2ResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcV2Requests =\n | GetAccountsV2Request\n | GetAccountV2Request\n | CreateAccountsV2Request\n | DeleteAccountV2Request\n | ExportAccountV2Request\n | SubmitRequestV2Request;\n\n/**\n * Extract the proper request type for a given `KeyringRpcV2Method`.\n */\nexport type KeyringRpcV2Request<RpcMethod extends KeyringRpcV2Method> = Extract<\n KeyringRpcV2Requests,\n { method: `${RpcMethod}` }\n>;\n"]}
|
|
@@ -40,5 +40,9 @@ var KeyringType;
|
|
|
40
40
|
* Represents keyring backed by a OneKey hardware wallet.
|
|
41
41
|
*/
|
|
42
42
|
KeyringType["OneKey"] = "onekey";
|
|
43
|
+
/**
|
|
44
|
+
* Represents keyring for money accounts.
|
|
45
|
+
*/
|
|
46
|
+
KeyringType["Money"] = "money";
|
|
43
47
|
})(KeyringType || (exports.KeyringType = KeyringType = {}));
|
|
44
48
|
//# sourceMappingURL=keyring-type.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-type.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"keyring-type.cjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WA+CX;AA/CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,8BAAe,CAAA;AACjB,CAAC,EA/CW,WAAW,2BAAX,WAAW,QA+CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n\n /**\n * Represents keyring for money accounts.\n */\n Money = 'money',\n}\n"]}
|
|
@@ -35,6 +35,10 @@ export declare enum KeyringType {
|
|
|
35
35
|
/**
|
|
36
36
|
* Represents keyring backed by a OneKey hardware wallet.
|
|
37
37
|
*/
|
|
38
|
-
OneKey = "onekey"
|
|
38
|
+
OneKey = "onekey",
|
|
39
|
+
/**
|
|
40
|
+
* Represents keyring for money accounts.
|
|
41
|
+
*/
|
|
42
|
+
Money = "money"
|
|
39
43
|
}
|
|
40
44
|
//# sourceMappingURL=keyring-type.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-type.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"keyring-type.d.cts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,KAAK,UAAU;CAChB"}
|
|
@@ -35,6 +35,10 @@ export declare enum KeyringType {
|
|
|
35
35
|
/**
|
|
36
36
|
* Represents keyring backed by a OneKey hardware wallet.
|
|
37
37
|
*/
|
|
38
|
-
OneKey = "onekey"
|
|
38
|
+
OneKey = "onekey",
|
|
39
|
+
/**
|
|
40
|
+
* Represents keyring for money accounts.
|
|
41
|
+
*/
|
|
42
|
+
Money = "money"
|
|
39
43
|
}
|
|
40
44
|
//# sourceMappingURL=keyring-type.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-type.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"keyring-type.d.mts","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB;;OAEG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;;OAIG;IACH,EAAE,OAAO;IAET;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,KAAK,UAAU;CAChB"}
|
|
@@ -37,5 +37,9 @@ export var KeyringType;
|
|
|
37
37
|
* Represents keyring backed by a OneKey hardware wallet.
|
|
38
38
|
*/
|
|
39
39
|
KeyringType["OneKey"] = "onekey";
|
|
40
|
+
/**
|
|
41
|
+
* Represents keyring for money accounts.
|
|
42
|
+
*/
|
|
43
|
+
KeyringType["Money"] = "money";
|
|
40
44
|
})(KeyringType || (KeyringType = {}));
|
|
41
45
|
//# sourceMappingURL=keyring-type.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-type.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"keyring-type.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WA+CX;AA/CD,WAAY,WAAW;IACrB;;OAEG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,yCAA0B,CAAA;IAE1B;;;;OAIG;IACH,wBAAS,CAAA;IAET;;OAEG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,kCAAmB,CAAA;IAEnB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,gCAAiB,CAAA;IAEjB;;OAEG;IACH,8BAAe,CAAA;AACjB,CAAC,EA/CW,WAAW,KAAX,WAAW,QA+CtB","sourcesContent":["/**\n * Enum representing the different types of keyrings supported.\n */\nexport enum KeyringType {\n /**\n * Represents a hierarchical deterministic (HD) keyring.\n */\n Hd = 'hd',\n\n /**\n * Represents a keyring that directly stores private keys.\n */\n PrivateKey = 'private-key',\n\n /**\n * Represents a keyring that implements the QR protocol.\n *\n * See: https://eips.ethereum.org/EIPS/eip-4527\n */\n Qr = 'qr',\n\n /**\n * Represents keyring backed by a Snap.\n */\n Snap = 'snap',\n\n /**\n * Represents keyring backed by a Ledger hardware wallet.\n */\n Ledger = 'ledger',\n\n /**\n * Represents keyring backed by a Lattice hardware wallet.\n */\n Lattice = 'lattice',\n\n /**\n * Represents keyring backed by a Trezor hardware wallet.\n */\n Trezor = 'trezor',\n\n /**\n * Represents keyring backed by a OneKey hardware wallet.\n */\n OneKey = 'onekey',\n\n /**\n * Represents keyring for money accounts.\n */\n Money = 'money',\n}\n"]}
|
package/dist/eth/index.cjs
CHANGED
|
@@ -19,5 +19,4 @@ __exportStar(require("./erc4337/index.cjs"), exports);
|
|
|
19
19
|
__exportStar(require("./rpc/index.cjs"), exports);
|
|
20
20
|
__exportStar(require("./types.cjs"), exports);
|
|
21
21
|
__exportStar(require("./utils.cjs"), exports);
|
|
22
|
-
__exportStar(require("./v2/index.cjs"), exports);
|
|
23
22
|
//# sourceMappingURL=index.cjs.map
|
package/dist/eth/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,sDAA0B;AAC1B,kDAAsB;AACtB,8CAAwB;AACxB,8CAAwB
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,sDAA0B;AAC1B,kDAAsB;AACtB,8CAAwB;AACxB,8CAAwB","sourcesContent":["export * from './constants';\nexport * from './erc4337';\nexport * from './rpc';\nexport * from './types';\nexport * from './utils';\n"]}
|