@metamask-previews/keyring-internal-api 0.0.1-67f3b77 → 0.0.1-7befa45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eth/EthKeyring.cjs +3 -0
- package/dist/eth/EthKeyring.cjs.map +1 -0
- package/dist/{internal/eth/EthKeyring.d.ts → eth/EthKeyring.d.cts} +4 -4
- package/dist/eth/EthKeyring.d.cts.map +1 -0
- package/dist/eth/EthKeyring.d.mts +33 -0
- package/dist/eth/EthKeyring.d.mts.map +1 -0
- package/dist/eth/EthKeyring.mjs +2 -0
- package/dist/eth/EthKeyring.mjs.map +1 -0
- package/dist/{internal/eth/EthKeyring.js → eth/index.cjs} +1 -1
- package/dist/eth/index.cjs.map +1 -0
- package/dist/eth/index.d.cts +2 -0
- package/dist/eth/index.d.cts.map +1 -0
- package/dist/eth/index.d.mts +2 -0
- package/dist/eth/index.d.mts.map +1 -0
- package/dist/eth/index.mjs +2 -0
- package/dist/eth/index.mjs.map +1 -0
- package/dist/{btc/index.js → index.cjs} +2 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{internal/types.js → types.cjs} +23 -19
- package/dist/types.cjs.map +1 -0
- package/dist/{internal/types.d.ts → types.d.cts} +131 -69
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +392 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +50 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +31 -20
- package/dist/btc/index.d.ts +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/btc/types.d.ts +0 -33
- package/dist/btc/types.js +0 -40
- package/dist/btc/types.js.map +0 -1
- package/dist/eth/erc4337/index.d.ts +0 -1
- package/dist/eth/erc4337/index.js +0 -18
- package/dist/eth/erc4337/index.js.map +0 -1
- package/dist/eth/erc4337/types.d.ts +0 -97
- package/dist/eth/erc4337/types.js +0 -61
- package/dist/eth/erc4337/types.js.map +0 -1
- package/dist/eth/index.d.ts +0 -3
- package/dist/eth/index.js +0 -20
- package/dist/eth/index.js.map +0 -1
- package/dist/eth/types.d.ts +0 -80
- package/dist/eth/types.js +0 -73
- package/dist/eth/types.js.map +0 -1
- package/dist/eth/utils.d.ts +0 -8
- package/dist/eth/utils.js +0 -15
- package/dist/eth/utils.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/internal/api.d.ts +0 -415
- package/dist/internal/api.js +0 -138
- package/dist/internal/api.js.map +0 -1
- package/dist/internal/eth/EthKeyring.js.map +0 -1
- package/dist/internal/eth/index.d.ts +0 -1
- package/dist/internal/eth/index.js +0 -18
- package/dist/internal/eth/index.js.map +0 -1
- package/dist/internal/events.d.ts +0 -169
- package/dist/internal/events.js +0 -83
- package/dist/internal/events.js.map +0 -1
- package/dist/internal/index.d.ts +0 -5
- package/dist/internal/index.js +0 -22
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/rpc.d.ts +0 -25
- package/dist/internal/rpc.js +0 -33
- package/dist/internal/rpc.js.map +0 -1
- package/dist/internal/types.js.map +0 -1
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { BtcAccountType, EthAccountType, SolAccountType } from "@metamask/keyring-api";
|
|
2
|
+
import type { Infer, Struct } from "@metamask/superstruct";
|
|
3
|
+
export type InternalAccountType = EthAccountType | BtcAccountType | SolAccountType;
|
|
4
|
+
export declare const InternalAccountMetadataStruct: Struct<{
|
|
5
|
+
metadata: {
|
|
6
|
+
name: string;
|
|
7
|
+
importTime: number;
|
|
8
|
+
keyring: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
nameLastUpdatedAt?: number;
|
|
12
|
+
snap?: {
|
|
13
|
+
name: string;
|
|
14
|
+
id: string;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
};
|
|
17
|
+
lastSelected?: number;
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
metadata: Struct<{
|
|
21
|
+
name: string;
|
|
22
|
+
importTime: number;
|
|
23
|
+
keyring: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
nameLastUpdatedAt?: number;
|
|
27
|
+
snap?: {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
};
|
|
32
|
+
lastSelected?: number;
|
|
33
|
+
}, {
|
|
34
|
+
name: Struct<string, null>;
|
|
35
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
36
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
37
|
+
name: string;
|
|
38
|
+
id: string;
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
}, {
|
|
41
|
+
id: Struct<string, null>;
|
|
42
|
+
enabled: Struct<boolean, null>;
|
|
43
|
+
name: Struct<string, null>;
|
|
44
|
+
}>;
|
|
45
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
46
|
+
importTime: Struct<number, null>;
|
|
47
|
+
keyring: Struct<{
|
|
48
|
+
type: string;
|
|
49
|
+
}, {
|
|
50
|
+
type: Struct<string, null>;
|
|
51
|
+
}>;
|
|
52
|
+
}>;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const InternalEthEoaAccountStruct: Struct<{
|
|
55
|
+
type: "eip155:eoa";
|
|
56
|
+
id: string;
|
|
57
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
58
|
+
metadata: {
|
|
59
|
+
name: string;
|
|
60
|
+
importTime: number;
|
|
61
|
+
keyring: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
nameLastUpdatedAt?: number;
|
|
65
|
+
snap?: {
|
|
66
|
+
name: string;
|
|
67
|
+
id: string;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
lastSelected?: number;
|
|
71
|
+
};
|
|
72
|
+
address: string;
|
|
73
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
|
74
|
+
}, {
|
|
75
|
+
metadata: Struct<{
|
|
76
|
+
name: string;
|
|
77
|
+
importTime: number;
|
|
78
|
+
keyring: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
nameLastUpdatedAt?: number;
|
|
82
|
+
snap?: {
|
|
83
|
+
name: string;
|
|
84
|
+
id: string;
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
};
|
|
87
|
+
lastSelected?: number;
|
|
88
|
+
}, {
|
|
89
|
+
name: Struct<string, null>;
|
|
90
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
91
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
92
|
+
name: string;
|
|
93
|
+
id: string;
|
|
94
|
+
enabled: boolean;
|
|
95
|
+
}, {
|
|
96
|
+
id: Struct<string, null>;
|
|
97
|
+
enabled: Struct<boolean, null>;
|
|
98
|
+
name: Struct<string, null>;
|
|
99
|
+
}>;
|
|
100
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
101
|
+
importTime: Struct<number, null>;
|
|
102
|
+
keyring: Struct<{
|
|
103
|
+
type: string;
|
|
104
|
+
}, {
|
|
105
|
+
type: Struct<string, null>;
|
|
106
|
+
}>;
|
|
107
|
+
}>;
|
|
108
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
109
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa", "eip155:eoa">;
|
|
110
|
+
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
|
111
|
+
personal_sign: "personal_sign";
|
|
112
|
+
eth_sign: "eth_sign";
|
|
113
|
+
eth_signTransaction: "eth_signTransaction";
|
|
114
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
|
115
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
|
116
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
|
117
|
+
}>>;
|
|
118
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
119
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
120
|
+
}>;
|
|
121
|
+
export declare const InternalEthErc4337AccountStruct: Struct<{
|
|
122
|
+
type: "eip155:erc4337";
|
|
123
|
+
id: string;
|
|
124
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
125
|
+
metadata: {
|
|
126
|
+
name: string;
|
|
127
|
+
importTime: number;
|
|
128
|
+
keyring: {
|
|
129
|
+
type: string;
|
|
130
|
+
};
|
|
131
|
+
nameLastUpdatedAt?: number;
|
|
132
|
+
snap?: {
|
|
133
|
+
name: string;
|
|
134
|
+
id: string;
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
};
|
|
137
|
+
lastSelected?: number;
|
|
138
|
+
};
|
|
139
|
+
address: string;
|
|
140
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
|
141
|
+
}, {
|
|
142
|
+
metadata: Struct<{
|
|
143
|
+
name: string;
|
|
144
|
+
importTime: number;
|
|
145
|
+
keyring: {
|
|
146
|
+
type: string;
|
|
147
|
+
};
|
|
148
|
+
nameLastUpdatedAt?: number;
|
|
149
|
+
snap?: {
|
|
150
|
+
name: string;
|
|
151
|
+
id: string;
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
};
|
|
154
|
+
lastSelected?: number;
|
|
155
|
+
}, {
|
|
156
|
+
name: Struct<string, null>;
|
|
157
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
158
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
159
|
+
name: string;
|
|
160
|
+
id: string;
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
}, {
|
|
163
|
+
id: Struct<string, null>;
|
|
164
|
+
enabled: Struct<boolean, null>;
|
|
165
|
+
name: Struct<string, null>;
|
|
166
|
+
}>;
|
|
167
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
168
|
+
importTime: Struct<number, null>;
|
|
169
|
+
keyring: Struct<{
|
|
170
|
+
type: string;
|
|
171
|
+
}, {
|
|
172
|
+
type: Struct<string, null>;
|
|
173
|
+
}>;
|
|
174
|
+
}>;
|
|
175
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
176
|
+
type: import("@metamask/superstruct").Struct<"eip155:erc4337", "eip155:erc4337">;
|
|
177
|
+
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
|
|
178
|
+
personal_sign: "personal_sign";
|
|
179
|
+
eth_sign: "eth_sign";
|
|
180
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
|
181
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
|
182
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
|
183
|
+
eth_prepareUserOperation: "eth_prepareUserOperation";
|
|
184
|
+
eth_patchUserOperation: "eth_patchUserOperation";
|
|
185
|
+
eth_signUserOperation: "eth_signUserOperation";
|
|
186
|
+
}>>;
|
|
187
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
188
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
189
|
+
}>;
|
|
190
|
+
export declare const InternalBtcP2wpkhAccountStruct: Struct<{
|
|
191
|
+
type: "bip122:p2wpkh";
|
|
192
|
+
id: string;
|
|
193
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
194
|
+
metadata: {
|
|
195
|
+
name: string;
|
|
196
|
+
importTime: number;
|
|
197
|
+
keyring: {
|
|
198
|
+
type: string;
|
|
199
|
+
};
|
|
200
|
+
nameLastUpdatedAt?: number;
|
|
201
|
+
snap?: {
|
|
202
|
+
name: string;
|
|
203
|
+
id: string;
|
|
204
|
+
enabled: boolean;
|
|
205
|
+
};
|
|
206
|
+
lastSelected?: number;
|
|
207
|
+
};
|
|
208
|
+
address: string;
|
|
209
|
+
methods: "sendBitcoin"[];
|
|
210
|
+
}, {
|
|
211
|
+
metadata: Struct<{
|
|
212
|
+
name: string;
|
|
213
|
+
importTime: number;
|
|
214
|
+
keyring: {
|
|
215
|
+
type: string;
|
|
216
|
+
};
|
|
217
|
+
nameLastUpdatedAt?: number;
|
|
218
|
+
snap?: {
|
|
219
|
+
name: string;
|
|
220
|
+
id: string;
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
};
|
|
223
|
+
lastSelected?: number;
|
|
224
|
+
}, {
|
|
225
|
+
name: Struct<string, null>;
|
|
226
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
227
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
228
|
+
name: string;
|
|
229
|
+
id: string;
|
|
230
|
+
enabled: boolean;
|
|
231
|
+
}, {
|
|
232
|
+
id: Struct<string, null>;
|
|
233
|
+
enabled: Struct<boolean, null>;
|
|
234
|
+
name: Struct<string, null>;
|
|
235
|
+
}>;
|
|
236
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
237
|
+
importTime: Struct<number, null>;
|
|
238
|
+
keyring: Struct<{
|
|
239
|
+
type: string;
|
|
240
|
+
}, {
|
|
241
|
+
type: Struct<string, null>;
|
|
242
|
+
}>;
|
|
243
|
+
}>;
|
|
244
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
245
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
|
246
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
|
247
|
+
sendBitcoin: "sendBitcoin";
|
|
248
|
+
}>>;
|
|
249
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
250
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
251
|
+
}>;
|
|
252
|
+
export declare const InternalSolDataAccountStruct: Struct<{
|
|
253
|
+
type: "solana:data-account";
|
|
254
|
+
id: string;
|
|
255
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
256
|
+
metadata: {
|
|
257
|
+
name: string;
|
|
258
|
+
importTime: number;
|
|
259
|
+
keyring: {
|
|
260
|
+
type: string;
|
|
261
|
+
};
|
|
262
|
+
nameLastUpdatedAt?: number;
|
|
263
|
+
snap?: {
|
|
264
|
+
name: string;
|
|
265
|
+
id: string;
|
|
266
|
+
enabled: boolean;
|
|
267
|
+
};
|
|
268
|
+
lastSelected?: number;
|
|
269
|
+
};
|
|
270
|
+
address: string;
|
|
271
|
+
methods: "sendAndConfirmTransaction"[];
|
|
272
|
+
}, {
|
|
273
|
+
metadata: Struct<{
|
|
274
|
+
name: string;
|
|
275
|
+
importTime: number;
|
|
276
|
+
keyring: {
|
|
277
|
+
type: string;
|
|
278
|
+
};
|
|
279
|
+
nameLastUpdatedAt?: number;
|
|
280
|
+
snap?: {
|
|
281
|
+
name: string;
|
|
282
|
+
id: string;
|
|
283
|
+
enabled: boolean;
|
|
284
|
+
};
|
|
285
|
+
lastSelected?: number;
|
|
286
|
+
}, {
|
|
287
|
+
name: Struct<string, null>;
|
|
288
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
289
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
290
|
+
name: string;
|
|
291
|
+
id: string;
|
|
292
|
+
enabled: boolean;
|
|
293
|
+
}, {
|
|
294
|
+
id: Struct<string, null>;
|
|
295
|
+
enabled: Struct<boolean, null>;
|
|
296
|
+
name: Struct<string, null>;
|
|
297
|
+
}>;
|
|
298
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
299
|
+
importTime: Struct<number, null>;
|
|
300
|
+
keyring: Struct<{
|
|
301
|
+
type: string;
|
|
302
|
+
}, {
|
|
303
|
+
type: Struct<string, null>;
|
|
304
|
+
}>;
|
|
305
|
+
}>;
|
|
306
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
307
|
+
type: import("@metamask/superstruct").Struct<"solana:data-account", "solana:data-account">;
|
|
308
|
+
methods: import("@metamask/superstruct").Struct<"sendAndConfirmTransaction"[], import("@metamask/superstruct").Struct<"sendAndConfirmTransaction", {
|
|
309
|
+
sendAndConfirmTransaction: "sendAndConfirmTransaction";
|
|
310
|
+
}>>;
|
|
311
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
312
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
313
|
+
}>;
|
|
314
|
+
export type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
|
|
315
|
+
export type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
|
|
316
|
+
export type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
|
|
317
|
+
export type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;
|
|
318
|
+
export declare const InternalAccountStructs: Record<string, Struct<InternalEthEoaAccount> | Struct<InternalEthErc4337Account> | Struct<InternalBtcP2wpkhAccount> | Struct<InternalSolDataAccount>>;
|
|
319
|
+
export type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2wpkhAccount | InternalSolDataAccount;
|
|
320
|
+
export declare const InternalAccountStruct: Struct<{
|
|
321
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
322
|
+
id: string;
|
|
323
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
324
|
+
metadata: {
|
|
325
|
+
name: string;
|
|
326
|
+
importTime: number;
|
|
327
|
+
keyring: {
|
|
328
|
+
type: string;
|
|
329
|
+
};
|
|
330
|
+
nameLastUpdatedAt?: number;
|
|
331
|
+
snap?: {
|
|
332
|
+
name: string;
|
|
333
|
+
id: string;
|
|
334
|
+
enabled: boolean;
|
|
335
|
+
};
|
|
336
|
+
lastSelected?: number;
|
|
337
|
+
};
|
|
338
|
+
address: string;
|
|
339
|
+
methods: string[];
|
|
340
|
+
}, {
|
|
341
|
+
metadata: Struct<{
|
|
342
|
+
name: string;
|
|
343
|
+
importTime: number;
|
|
344
|
+
keyring: {
|
|
345
|
+
type: string;
|
|
346
|
+
};
|
|
347
|
+
nameLastUpdatedAt?: number;
|
|
348
|
+
snap?: {
|
|
349
|
+
name: string;
|
|
350
|
+
id: string;
|
|
351
|
+
enabled: boolean;
|
|
352
|
+
};
|
|
353
|
+
lastSelected?: number;
|
|
354
|
+
}, {
|
|
355
|
+
name: Struct<string, null>;
|
|
356
|
+
nameLastUpdatedAt: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
357
|
+
snap: Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
358
|
+
name: string;
|
|
359
|
+
id: string;
|
|
360
|
+
enabled: boolean;
|
|
361
|
+
}, {
|
|
362
|
+
id: Struct<string, null>;
|
|
363
|
+
enabled: Struct<boolean, null>;
|
|
364
|
+
name: Struct<string, null>;
|
|
365
|
+
}>;
|
|
366
|
+
lastSelected: Struct<number | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
367
|
+
importTime: Struct<number, null>;
|
|
368
|
+
keyring: Struct<{
|
|
369
|
+
type: string;
|
|
370
|
+
}, {
|
|
371
|
+
type: Struct<string, null>;
|
|
372
|
+
}>;
|
|
373
|
+
}>;
|
|
374
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
375
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
376
|
+
"eip155:eoa": "eip155:eoa";
|
|
377
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
378
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
379
|
+
"solana:data-account": "solana:data-account";
|
|
380
|
+
}>;
|
|
381
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
382
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
383
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Internal account representation.
|
|
387
|
+
*
|
|
388
|
+
* This type is used internally by MetaMask to add additional metadata to the
|
|
389
|
+
* account object. It's should not be used by external applications.
|
|
390
|
+
*/
|
|
391
|
+
export type InternalAccount = Infer<typeof InternalAccountStruct>;
|
|
392
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,cAAc,EAEd,cAAc,EAKf,8BAA8B;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAG3D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,cAAc,GACd,cAAc,CAAC;AAEnB,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAC1C,OAAO,8BAA8B,CACtC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,MAAM,EACJ,MAAM,CAAC,qBAAqB,CAAC,GAC7B,MAAM,CAAC,yBAAyB,CAAC,GACjC,MAAM,CAAC,wBAAwB,CAAC,GAChC,MAAM,CAAC,sBAAsB,CAAC,CAMjC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,sBAAsB,CAAC;AAE3B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
|
|
3
|
+
// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`
|
|
4
|
+
// and `InternalAccountTypes`.
|
|
5
|
+
import { BtcAccountType, EthAccountType, KeyringAccountStruct, SolAccountType, BtcP2wpkhAccountStruct, EthEoaAccountStruct, EthErc4337AccountStruct, SolDataAccountStruct } from "@metamask/keyring-api";
|
|
6
|
+
import { exactOptional, object } from "@metamask/keyring-utils";
|
|
7
|
+
import { boolean, string, number } from "@metamask/superstruct";
|
|
8
|
+
export const InternalAccountMetadataStruct = object({
|
|
9
|
+
metadata: object({
|
|
10
|
+
name: string(),
|
|
11
|
+
nameLastUpdatedAt: exactOptional(number()),
|
|
12
|
+
snap: exactOptional(object({
|
|
13
|
+
id: string(),
|
|
14
|
+
enabled: boolean(),
|
|
15
|
+
name: string(),
|
|
16
|
+
})),
|
|
17
|
+
lastSelected: exactOptional(number()),
|
|
18
|
+
importTime: number(),
|
|
19
|
+
keyring: object({
|
|
20
|
+
type: string(),
|
|
21
|
+
}),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
export const InternalEthEoaAccountStruct = object({
|
|
25
|
+
...EthEoaAccountStruct.schema,
|
|
26
|
+
...InternalAccountMetadataStruct.schema,
|
|
27
|
+
});
|
|
28
|
+
export const InternalEthErc4337AccountStruct = object({
|
|
29
|
+
...EthErc4337AccountStruct.schema,
|
|
30
|
+
...InternalAccountMetadataStruct.schema,
|
|
31
|
+
});
|
|
32
|
+
export const InternalBtcP2wpkhAccountStruct = object({
|
|
33
|
+
...BtcP2wpkhAccountStruct.schema,
|
|
34
|
+
...InternalAccountMetadataStruct.schema,
|
|
35
|
+
});
|
|
36
|
+
export const InternalSolDataAccountStruct = object({
|
|
37
|
+
...SolDataAccountStruct.schema,
|
|
38
|
+
...InternalAccountMetadataStruct.schema,
|
|
39
|
+
});
|
|
40
|
+
export const InternalAccountStructs = {
|
|
41
|
+
[`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,
|
|
42
|
+
[`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,
|
|
43
|
+
[`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,
|
|
44
|
+
[`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,
|
|
45
|
+
};
|
|
46
|
+
export const InternalAccountStruct = object({
|
|
47
|
+
...KeyringAccountStruct.schema,
|
|
48
|
+
...InternalAccountMetadataStruct.schema,
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4FAA4F;AAC5F,8BAA8B;AAE9B,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACrB,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAOhE,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,EAAE;QACd,iBAAiB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAI,EAAE,aAAa,CACjB,MAAM,CAAC;YACL,EAAE,EAAE,MAAM,EAAE;YACZ,OAAO,EAAE,OAAO,EAAE;YAClB,IAAI,EAAE,MAAM,EAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QACrC,UAAU,EAAE,MAAM,EAAE;QACpB,OAAO,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,EAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;IAChD,GAAG,mBAAmB,CAAC,MAAM;IAC7B,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;IACpD,GAAG,uBAAuB,CAAC,MAAM;IACjC,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC;IACnD,GAAG,sBAAsB,CAAC,MAAM;IAChC,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;IACjD,GAAG,oBAAoB,CAAC,MAAM;IAC9B,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC;AAcH,MAAM,CAAC,MAAM,sBAAsB,GAM/B;IACF,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,2BAA2B;IACtD,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE,+BAA+B;IAC9D,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,8BAA8B;IAC5D,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,EAAE,4BAA4B;CAChE,CAAC;AAQF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;IAC1C,GAAG,oBAAoB,CAAC,MAAM;IAC9B,GAAG,6BAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`\n// and `InternalAccountTypes`.\n\nimport {\n BtcAccountType,\n EthAccountType,\n KeyringAccountStruct,\n SolAccountType,\n BtcP2wpkhAccountStruct,\n EthEoaAccountStruct,\n EthErc4337AccountStruct,\n SolDataAccountStruct,\n} from '@metamask/keyring-api';\nimport { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nexport type InternalAccountType =\n | EthAccountType\n | BtcAccountType\n | SolAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalSolDataAccountStruct = object({\n ...SolDataAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n | Struct<InternalSolDataAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n [`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount\n | InternalSolDataAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/keyring-internal-api",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-7befa45",
|
|
4
4
|
"description": "MetaMask Keyring Internal API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"metamask",
|
|
@@ -14,51 +14,59 @@
|
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "https://github.com/MetaMask/accounts.git"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"default": "./dist/index.mjs"
|
|
22
|
+
},
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./dist/index.d.cts",
|
|
25
|
+
"default": "./dist/index.cjs"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"types": "./dist/index.d.cts",
|
|
19
31
|
"files": [
|
|
20
32
|
"dist/"
|
|
21
33
|
],
|
|
22
34
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"build:clean": "
|
|
35
|
+
"build": "ts-bridge --project tsconfig.build.json --no-references",
|
|
36
|
+
"build:clean": "yarn build --clean",
|
|
25
37
|
"build:docs": "typedoc",
|
|
26
|
-
"build:force": "tsc --build tsconfig.build.json --force",
|
|
27
38
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-internal-api",
|
|
28
39
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-internal-api",
|
|
29
40
|
"publish:preview": "yarn npm publish --tag preview",
|
|
30
41
|
"test": "yarn test:source && yarn test:types",
|
|
31
42
|
"test:clean": "jest --clearCache",
|
|
32
43
|
"test:source": "jest && jest-it-up",
|
|
33
|
-
"test:types": "tsd",
|
|
34
|
-
"test:verbose": "jest --verbose",
|
|
44
|
+
"test:types": "../../scripts/tsd-test.sh ./src",
|
|
35
45
|
"test:watch": "jest --watch"
|
|
36
46
|
},
|
|
37
47
|
"dependencies": {
|
|
38
|
-
"@metamask/keyring-api": "
|
|
48
|
+
"@metamask/keyring-api": "11.1.0",
|
|
39
49
|
"@metamask/keyring-utils": "0.0.1",
|
|
40
|
-
"@metamask/snaps-sdk": "^6.1.0",
|
|
41
50
|
"@metamask/superstruct": "^3.1.0",
|
|
42
|
-
"@metamask/utils": "^9.
|
|
43
|
-
"bech32": "^2.0.0",
|
|
44
|
-
"deepmerge": "^4.2.2"
|
|
51
|
+
"@metamask/utils": "^9.3.0"
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
|
-
"@lavamoat/allow-scripts": "^3.
|
|
48
|
-
"@lavamoat/preinstall-always-fail": "^2.
|
|
54
|
+
"@lavamoat/allow-scripts": "^3.2.1",
|
|
55
|
+
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
|
49
56
|
"@metamask/auto-changelog": "^3.4.4",
|
|
50
|
-
"@
|
|
57
|
+
"@ts-bridge/cli": "^0.6.1",
|
|
51
58
|
"@types/jest": "^29.5.12",
|
|
52
59
|
"@types/node": "^20.12.12",
|
|
60
|
+
"deepmerge": "^4.2.2",
|
|
53
61
|
"depcheck": "^1.4.7",
|
|
54
|
-
"jest": "^
|
|
62
|
+
"jest": "^29.5.0",
|
|
55
63
|
"jest-it-up": "^3.1.0",
|
|
56
64
|
"rimraf": "^5.0.7",
|
|
57
|
-
"ts-jest": "^
|
|
65
|
+
"ts-jest": "^29.0.5",
|
|
58
66
|
"ts-node": "^10.9.2",
|
|
59
67
|
"tsd": "^0.31.0",
|
|
60
68
|
"typedoc": "^0.25.13",
|
|
61
|
-
"typescript": "~
|
|
69
|
+
"typescript": "~5.6.3"
|
|
62
70
|
},
|
|
63
71
|
"engines": {
|
|
64
72
|
"node": "^18.18 || >=20"
|
|
@@ -73,6 +81,9 @@
|
|
|
73
81
|
}
|
|
74
82
|
},
|
|
75
83
|
"tsd": {
|
|
76
|
-
"directory": "src"
|
|
84
|
+
"directory": "src",
|
|
85
|
+
"compilerOptions": {
|
|
86
|
+
"composite": "false"
|
|
87
|
+
}
|
|
77
88
|
}
|
|
78
89
|
}
|
package/dist/btc/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
package/dist/btc/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/btc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from './types';\n"]}
|
package/dist/btc/types.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Infer } from '@metamask/superstruct';
|
|
2
|
-
export declare const BtcP2wpkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
3
|
-
/**
|
|
4
|
-
* Supported Bitcoin methods.
|
|
5
|
-
*/
|
|
6
|
-
export declare enum BtcMethod {
|
|
7
|
-
SendMany = "btc_sendmany"
|
|
8
|
-
}
|
|
9
|
-
export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Struct<{
|
|
10
|
-
id: string;
|
|
11
|
-
options: Record<string, import("@metamask/utils").Json>;
|
|
12
|
-
address: string;
|
|
13
|
-
type: "bip122:p2wpkh";
|
|
14
|
-
methods: "btc_sendmany"[];
|
|
15
|
-
}, {
|
|
16
|
-
/**
|
|
17
|
-
* Account address.
|
|
18
|
-
*/
|
|
19
|
-
address: import("@metamask/superstruct").Struct<string, null>;
|
|
20
|
-
/**
|
|
21
|
-
* Account type.
|
|
22
|
-
*/
|
|
23
|
-
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
|
24
|
-
/**
|
|
25
|
-
* Account supported methods.
|
|
26
|
-
*/
|
|
27
|
-
methods: import("@metamask/superstruct").Struct<"btc_sendmany"[], import("@metamask/superstruct").Struct<"btc_sendmany", {
|
|
28
|
-
btc_sendmany: "btc_sendmany";
|
|
29
|
-
}>>;
|
|
30
|
-
id: import("@metamask/superstruct").Struct<string, null>;
|
|
31
|
-
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
32
|
-
}>;
|
|
33
|
-
export declare type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;
|
package/dist/btc/types.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BtcP2wpkhAccountStruct = exports.BtcMethod = exports.BtcP2wpkhAddressStruct = void 0;
|
|
4
|
-
const keyring_api_1 = require("@metamask/keyring-api");
|
|
5
|
-
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
6
|
-
const superstruct_1 = require("@metamask/superstruct");
|
|
7
|
-
const bech32_1 = require("bech32");
|
|
8
|
-
exports.BtcP2wpkhAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2wpkhAddressStruct', (address) => {
|
|
9
|
-
try {
|
|
10
|
-
bech32_1.bech32.decode(address);
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
return new Error(`Could not decode P2WPKH address: ${error.message}`);
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
});
|
|
17
|
-
/**
|
|
18
|
-
* Supported Bitcoin methods.
|
|
19
|
-
*/
|
|
20
|
-
var BtcMethod;
|
|
21
|
-
(function (BtcMethod) {
|
|
22
|
-
// General transaction methods
|
|
23
|
-
BtcMethod["SendMany"] = "btc_sendmany";
|
|
24
|
-
})(BtcMethod = exports.BtcMethod || (exports.BtcMethod = {}));
|
|
25
|
-
exports.BtcP2wpkhAccountStruct = (0, keyring_utils_1.object)({
|
|
26
|
-
...keyring_api_1.KeyringAccountStruct.schema,
|
|
27
|
-
/**
|
|
28
|
-
* Account address.
|
|
29
|
-
*/
|
|
30
|
-
address: exports.BtcP2wpkhAddressStruct,
|
|
31
|
-
/**
|
|
32
|
-
* Account type.
|
|
33
|
-
*/
|
|
34
|
-
type: (0, superstruct_1.literal)(`${keyring_api_1.BtcAccountType.P2wpkh}`),
|
|
35
|
-
/**
|
|
36
|
-
* Account supported methods.
|
|
37
|
-
*/
|
|
38
|
-
methods: (0, superstruct_1.array)((0, superstruct_1.enums)([`${BtcMethod.SendMany}`])),
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=types.js.map
|
package/dist/btc/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,uDAA6E;AAC7E,2DAAiD;AAEjD,uDAA8E;AAC9E,mCAAgC;AAEnB,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAC1C,IAAA,oBAAM,GAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI;QACF,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,sCAAyB,CAAA;AAC3B,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAEY,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,GAAG,kCAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;CACjD,CAAC,CAAC","sourcesContent":["import { KeyringAccountStruct, BtcAccountType } from '@metamask/keyring-api';\nimport { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { string, array, enums, refine, literal } from '@metamask/superstruct';\nimport { bech32 } from 'bech32';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendMany = 'btc_sendmany',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendMany}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eth/erc4337/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from './types';\n"]}
|