@marigoldlabs/web3-tester 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +317 -11
  2. package/dist/anvil.d.ts.map +1 -1
  3. package/dist/anvil.js.map +1 -1
  4. package/dist/benchmark.d.ts +55 -0
  5. package/dist/benchmark.d.ts.map +1 -0
  6. package/dist/benchmark.js +168 -0
  7. package/dist/benchmark.js.map +1 -0
  8. package/dist/fixtures.js +2 -2
  9. package/dist/fixtures.js.map +1 -1
  10. package/dist/index.d.ts +13 -4
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +5 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/injected-provider.d.ts.map +1 -1
  15. package/dist/injected-provider.js +748 -25
  16. package/dist/injected-provider.js.map +1 -1
  17. package/dist/mock-wallet-controller.d.ts +150 -2
  18. package/dist/mock-wallet-controller.d.ts.map +1 -1
  19. package/dist/mock-wallet-controller.js +613 -24
  20. package/dist/mock-wallet-controller.js.map +1 -1
  21. package/dist/private-key-rpc-client.d.ts +144 -132
  22. package/dist/private-key-rpc-client.d.ts.map +1 -1
  23. package/dist/private-key-rpc-client.js +142 -20
  24. package/dist/private-key-rpc-client.js.map +1 -1
  25. package/dist/real-wallet-cache.d.ts +38 -0
  26. package/dist/real-wallet-cache.d.ts.map +1 -1
  27. package/dist/real-wallet-cache.js +143 -57
  28. package/dist/real-wallet-cache.js.map +1 -1
  29. package/dist/real-wallet-extension-fixtures.d.ts +35 -0
  30. package/dist/real-wallet-extension-fixtures.d.ts.map +1 -0
  31. package/dist/real-wallet-extension-fixtures.js +96 -0
  32. package/dist/real-wallet-extension-fixtures.js.map +1 -0
  33. package/dist/real-wallet-extension.d.ts +86 -0
  34. package/dist/real-wallet-extension.d.ts.map +1 -0
  35. package/dist/real-wallet-extension.js +245 -0
  36. package/dist/real-wallet-extension.js.map +1 -0
  37. package/dist/real-wallet-fixtures.d.ts.map +1 -1
  38. package/dist/real-wallet-fixtures.js +46 -31
  39. package/dist/real-wallet-fixtures.js.map +1 -1
  40. package/dist/real-wallet.d.ts +5 -14
  41. package/dist/real-wallet.d.ts.map +1 -1
  42. package/dist/real-wallet.js +668 -435
  43. package/dist/real-wallet.js.map +1 -1
  44. package/dist/safe.d.ts +311 -0
  45. package/dist/safe.d.ts.map +1 -0
  46. package/dist/safe.js +743 -0
  47. package/dist/safe.js.map +1 -0
  48. package/dist/types.d.ts +35 -1
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/wallet-personas.d.ts +99 -0
  51. package/dist/wallet-personas.d.ts.map +1 -0
  52. package/dist/wallet-personas.js +666 -0
  53. package/dist/wallet-personas.js.map +1 -0
  54. package/dist/walletconnect.d.ts +176 -9
  55. package/dist/walletconnect.d.ts.map +1 -1
  56. package/dist/walletconnect.js +514 -74
  57. package/dist/walletconnect.js.map +1 -1
  58. package/examples/playwright.config.ts +8 -0
  59. package/package.json +29 -3
@@ -0,0 +1,666 @@
1
+ const svgIcon = (label, background, foreground = 'ffffff') => {
2
+ const initials = encodeURIComponent(label.slice(0, 3).toUpperCase());
3
+ return ('data:image/svg+xml,' +
4
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">` +
5
+ `<rect width="64" height="64" rx="14" fill="%23${background}"/>` +
6
+ `<text x="32" y="38" text-anchor="middle" font-family="Arial,sans-serif" font-size="18" font-weight="700" fill="%23${foreground}">${initials}</text>` +
7
+ `</svg>`);
8
+ };
9
+ export const mockWalletPersona = (overrides = {}) => createWalletPersona({
10
+ uuid: '00000000-0000-4000-8000-000000000001',
11
+ name: 'Mock Wallet',
12
+ icon: svgIcon('Mock', '111827', '38bdf8'),
13
+ rdns: 'dev.invisible-wallet.mock',
14
+ flags: { isMetaMask: true, isMock: true },
15
+ walletConnect: {
16
+ name: 'web3-tester Wallet',
17
+ description: 'Headless wallet for E2E tests',
18
+ url: 'https://github.com/AndyMarigoldLabs/web3-tester',
19
+ icons: [],
20
+ },
21
+ ...overrides,
22
+ });
23
+ export const walletPersonas = {
24
+ mock: mockWalletPersona,
25
+ metamask: (overrides = {}) => createWalletPersona({
26
+ uuid: '00000000-0000-4000-8000-000000000101',
27
+ name: 'MetaMask',
28
+ icon: svgIcon('MM', 'f6851b'),
29
+ rdns: 'io.metamask',
30
+ flags: { isMetaMask: true },
31
+ walletConnect: {
32
+ name: 'MetaMask',
33
+ description: 'MetaMask-compatible test wallet',
34
+ url: 'https://metamask.io',
35
+ icons: [],
36
+ links: {
37
+ mobile: 'https://metamask.app.link/wc?uri={uri}',
38
+ qrCode: 'https://metamask.app.link/wc?uri={uri}',
39
+ },
40
+ },
41
+ ...overrides,
42
+ }),
43
+ rabby: (overrides = {}) => createWalletPersona({
44
+ uuid: '00000000-0000-4000-8000-000000000102',
45
+ name: 'Rabby Wallet',
46
+ icon: svgIcon('Rabby', '8697ff'),
47
+ rdns: 'io.rabby',
48
+ flags: { isRabby: true },
49
+ walletConnect: {
50
+ name: 'Rabby Wallet',
51
+ description: 'Rabby-compatible test wallet',
52
+ url: 'https://rabby.io',
53
+ icons: [],
54
+ },
55
+ ...overrides,
56
+ }),
57
+ coinbase: (overrides = {}) => createWalletPersona({
58
+ uuid: '00000000-0000-4000-8000-000000000103',
59
+ name: 'Coinbase Wallet',
60
+ icon: svgIcon('CB', '0052ff'),
61
+ rdns: 'io.coinbase',
62
+ flags: { isCoinbaseWallet: true },
63
+ aliases: ['coinbaseWalletExtension'],
64
+ walletConnect: {
65
+ name: 'Coinbase Wallet',
66
+ description: 'Coinbase Wallet-compatible test wallet',
67
+ url: 'https://wallet.coinbase.com',
68
+ icons: [],
69
+ links: {
70
+ qrCode: '{rawUri}',
71
+ },
72
+ },
73
+ ...overrides,
74
+ }),
75
+ phantomEvm: (overrides = {}) => createWalletPersona({
76
+ uuid: '00000000-0000-4000-8000-000000000104',
77
+ name: 'Phantom',
78
+ icon: svgIcon('PH', 'ab9ff2'),
79
+ rdns: 'app.phantom',
80
+ flags: { isPhantom: true },
81
+ aliases: ['phantom.ethereum'],
82
+ solana: {
83
+ publicKey: '26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo',
84
+ flags: { isPhantom: true },
85
+ aliases: ['phantom.solana', 'solana'],
86
+ },
87
+ walletConnect: {
88
+ name: 'Phantom',
89
+ description: 'Phantom EVM-compatible test wallet',
90
+ url: 'https://phantom.com',
91
+ icons: [],
92
+ },
93
+ ...overrides,
94
+ }),
95
+ rainbow: (overrides = {}) => createWalletPersona({
96
+ uuid: '00000000-0000-4000-8000-000000000105',
97
+ name: 'Rainbow',
98
+ icon: svgIcon('RBW', 'ff5bcb'),
99
+ rdns: 'me.rainbow',
100
+ flags: { isRainbow: true },
101
+ walletConnect: {
102
+ name: 'Rainbow',
103
+ description: 'Rainbow-compatible test wallet',
104
+ url: 'https://rainbow.me',
105
+ icons: [],
106
+ links: {
107
+ mobile: 'rainbow://wc?uri={uri}&connector=web3-tester',
108
+ qrCode: 'https://rnbwapp.com/wc?uri={uri}&connector=web3-tester',
109
+ },
110
+ },
111
+ ...overrides,
112
+ }),
113
+ okx: (overrides = {}) => createWalletPersona({
114
+ uuid: '00000000-0000-4000-8000-000000000106',
115
+ name: 'OKX Wallet',
116
+ icon: svgIcon('OKX', '000000'),
117
+ rdns: 'com.okex.wallet',
118
+ flags: { isOkxWallet: true, isOKExWallet: true },
119
+ aliases: ['okxwallet'],
120
+ walletConnect: {
121
+ name: 'OKX Wallet',
122
+ description: 'OKX Wallet-compatible test wallet',
123
+ url: 'https://www.okx.com/web3',
124
+ icons: [],
125
+ links: {
126
+ mobile: 'okex://main/wc?uri={uri}',
127
+ qrCode: '{rawUri}',
128
+ },
129
+ },
130
+ ...overrides,
131
+ }),
132
+ trust: (overrides = {}) => createWalletPersona({
133
+ uuid: '00000000-0000-4000-8000-000000000107',
134
+ name: 'Trust Wallet',
135
+ icon: svgIcon('TR', '0500ff'),
136
+ rdns: 'com.trustwallet.app',
137
+ flags: { isTrust: true, isTrustWallet: true },
138
+ aliases: ['trustwallet'],
139
+ walletConnect: {
140
+ name: 'Trust Wallet',
141
+ description: 'Trust Wallet-compatible test wallet',
142
+ url: 'https://trustwallet.com',
143
+ icons: [],
144
+ links: {
145
+ mobile: 'trust://wc?uri={uri}',
146
+ qrCode: '{rawUri}',
147
+ },
148
+ },
149
+ ...overrides,
150
+ }),
151
+ brave: (overrides = {}) => createWalletPersona({
152
+ uuid: '00000000-0000-4000-8000-000000000108',
153
+ name: 'Brave Wallet',
154
+ icon: svgIcon('BRV', 'fb542b'),
155
+ rdns: 'com.brave.wallet',
156
+ flags: { isBraveWallet: true, isMetaMask: true },
157
+ walletConnect: {
158
+ name: 'Brave Wallet',
159
+ description: 'Brave Wallet-compatible test wallet',
160
+ url: 'https://brave.com/wallet',
161
+ icons: [],
162
+ },
163
+ ...overrides,
164
+ }),
165
+ zerion: (overrides = {}) => createWalletPersona({
166
+ uuid: '00000000-0000-4000-8000-000000000109',
167
+ name: 'Zerion Wallet',
168
+ icon: svgIcon('ZER', '2962ef'),
169
+ rdns: 'io.zerion.wallet',
170
+ flags: { isZerion: true },
171
+ walletConnect: {
172
+ name: 'Zerion Wallet',
173
+ description: 'Zerion-compatible test wallet',
174
+ url: 'https://zerion.io',
175
+ icons: [],
176
+ },
177
+ ...overrides,
178
+ }),
179
+ backpack: (overrides = {}) => createWalletPersona({
180
+ uuid: '00000000-0000-4000-8000-000000000110',
181
+ name: 'Backpack',
182
+ icon: svgIcon('BP', 'e33e3f'),
183
+ rdns: 'app.backpack',
184
+ flags: { isBackpack: true },
185
+ aliases: ['backpack.ethereum'],
186
+ solana: {
187
+ publicKey: '8xX7qT9N4z2Wm6YQNz3dLqHpspRrQ2Xrcrk22eL8D4sP',
188
+ flags: { isBackpack: true },
189
+ aliases: ['backpack.solana'],
190
+ },
191
+ walletConnect: {
192
+ name: 'Backpack',
193
+ description: 'Backpack EVM-compatible test wallet',
194
+ url: 'https://backpack.app',
195
+ icons: [],
196
+ },
197
+ ...overrides,
198
+ }),
199
+ solflare: (overrides = {}) => createWalletPersona({
200
+ uuid: '00000000-0000-4000-8000-000000000126',
201
+ name: 'Solflare',
202
+ icon: svgIcon('SOL', 'ffdf46', '2a1557'),
203
+ rdns: 'com.solflare',
204
+ evm: false,
205
+ flags: { isSolflare: true },
206
+ aliases: ['solflare'],
207
+ solana: {
208
+ publicKey: '9xQeWvG816bUx9EPjHmaT23yvVM2ZWkDD5DdnYwB5xP',
209
+ flags: { isSolflare: true },
210
+ aliases: ['solflare'],
211
+ },
212
+ walletConnect: {
213
+ name: 'Solflare',
214
+ description: 'Solflare-compatible test wallet',
215
+ url: 'https://solflare.com',
216
+ icons: [],
217
+ },
218
+ ...overrides,
219
+ }),
220
+ ledger: (overrides = {}) => createWalletPersona({
221
+ uuid: '00000000-0000-4000-8000-000000000111',
222
+ name: 'Ledger Wallet',
223
+ icon: svgIcon('LED', '1a1a1a'),
224
+ rdns: 'com.ledger',
225
+ flags: { isLedger: true, isLedgerWallet: true },
226
+ walletConnect: {
227
+ name: 'Ledger Wallet',
228
+ description: 'Ledger-compatible test wallet',
229
+ url: 'https://www.ledger.com',
230
+ icons: [],
231
+ },
232
+ ...overrides,
233
+ }),
234
+ trezor: (overrides = {}) => createWalletPersona({
235
+ uuid: '00000000-0000-4000-8000-000000000112',
236
+ name: 'Trezor',
237
+ icon: svgIcon('TRZ', '0f6148'),
238
+ rdns: 'io.trezor',
239
+ flags: { isTrezor: true },
240
+ walletConnect: {
241
+ name: 'Trezor',
242
+ description: 'Trezor-compatible test wallet',
243
+ url: 'https://trezor.io',
244
+ icons: [],
245
+ },
246
+ ...overrides,
247
+ }),
248
+ safe: (overrides = {}) => createWalletPersona({
249
+ uuid: '00000000-0000-4000-8000-000000000113',
250
+ name: 'Safe',
251
+ icon: svgIcon('SAFE', '12ff80', '111827'),
252
+ rdns: 'global.safe',
253
+ flags: { isSafe: true },
254
+ walletConnect: {
255
+ name: 'Safe',
256
+ description: 'Safe-compatible test wallet',
257
+ url: 'https://safe.global',
258
+ icons: [],
259
+ },
260
+ ...overrides,
261
+ }),
262
+ bitget: (overrides = {}) => createWalletPersona({
263
+ uuid: '00000000-0000-4000-8000-000000000114',
264
+ name: 'Bitget Wallet',
265
+ icon: svgIcon('BG', '00f0ff', '111827'),
266
+ rdns: 'com.bitget.web3',
267
+ flags: { isBitKeep: true, isBitgetWallet: true },
268
+ aliases: ['bitkeep', 'bitkeep.ethereum'],
269
+ walletConnect: {
270
+ name: 'Bitget Wallet',
271
+ description: 'Bitget Wallet-compatible test wallet',
272
+ url: 'https://web3.bitget.com',
273
+ icons: [],
274
+ links: {
275
+ mobile: 'bitkeep://wc?uri={uri}',
276
+ qrCode: '{rawUri}',
277
+ },
278
+ },
279
+ ...overrides,
280
+ }),
281
+ tokenPocket: (overrides = {}) => createWalletPersona({
282
+ uuid: '00000000-0000-4000-8000-000000000115',
283
+ name: 'TokenPocket',
284
+ icon: svgIcon('TP', '2980fe'),
285
+ rdns: 'pro.tokenpocket',
286
+ flags: { isTokenPocket: true },
287
+ aliases: ['tokenpocket', 'tokenpocket.ethereum'],
288
+ walletConnect: {
289
+ name: 'TokenPocket',
290
+ description: 'TokenPocket-compatible test wallet',
291
+ url: 'https://www.tokenpocket.pro',
292
+ icons: [],
293
+ links: {
294
+ mobile: 'tpoutside://wc?uri={uri}',
295
+ },
296
+ },
297
+ ...overrides,
298
+ }),
299
+ safePal: (overrides = {}) => createWalletPersona({
300
+ uuid: '00000000-0000-4000-8000-000000000116',
301
+ name: 'SafePal',
302
+ icon: svgIcon('SP', '4a21ef'),
303
+ rdns: 'com.safepal',
304
+ flags: { isSafePal: true },
305
+ aliases: ['safepalProvider'],
306
+ solana: {
307
+ publicKey: '7uLt9S3qJbXf6YoTvtWKybB7FKYSMNmV7oyG4iXKPrHM',
308
+ flags: { isSafePal: true },
309
+ aliases: ['safepal'],
310
+ },
311
+ walletConnect: {
312
+ name: 'SafePal',
313
+ description: 'SafePal-compatible test wallet',
314
+ url: 'https://www.safepal.com',
315
+ icons: [],
316
+ links: {
317
+ mobile: 'safepalwallet://wc?uri={uri}',
318
+ qrCode: '{rawUri}',
319
+ },
320
+ },
321
+ ...overrides,
322
+ }),
323
+ binance: (overrides = {}) => createWalletPersona({
324
+ uuid: '00000000-0000-4000-8000-000000000117',
325
+ name: 'Binance Wallet',
326
+ icon: svgIcon('BNB', 'f3ba2f', '111827'),
327
+ rdns: 'com.binance.wallet',
328
+ flags: { isBinance: true, isExtension: true },
329
+ aliases: ['binancew3w', 'binancew3w.ethereum'],
330
+ walletConnect: {
331
+ name: 'Binance Wallet',
332
+ description: 'Binance Wallet-compatible test wallet',
333
+ url: 'https://www.binance.com/en/binancewallet',
334
+ icons: [],
335
+ links: {
336
+ mobile: 'bnc://app.binance.com/cedefi/wc?uri={uri}',
337
+ qrCode: '{rawUri}',
338
+ },
339
+ },
340
+ ...overrides,
341
+ }),
342
+ imToken: (overrides = {}) => createWalletPersona({
343
+ uuid: '00000000-0000-4000-8000-000000000118',
344
+ name: 'imToken',
345
+ icon: svgIcon('IM', '098de6'),
346
+ rdns: 'im.token',
347
+ flags: { isImToken: true },
348
+ aliases: ['imToken'],
349
+ walletConnect: {
350
+ name: 'imToken',
351
+ description: 'imToken-compatible test wallet',
352
+ url: 'https://token.im',
353
+ icons: [],
354
+ links: {
355
+ mobile: 'imtokenv2://wc?uri={uri}',
356
+ qrCode: '{rawUri}',
357
+ },
358
+ },
359
+ ...overrides,
360
+ }),
361
+ mathWallet: (overrides = {}) => createWalletPersona({
362
+ uuid: '00000000-0000-4000-8000-000000000119',
363
+ name: 'MathWallet',
364
+ icon: svgIcon('MTH', '2f72ff'),
365
+ rdns: 'org.mathwallet',
366
+ flags: { isMathWallet: true },
367
+ walletConnect: {
368
+ name: 'MathWallet',
369
+ description: 'MathWallet-compatible test wallet',
370
+ url: 'https://mathwallet.org',
371
+ icons: [],
372
+ },
373
+ ...overrides,
374
+ }),
375
+ frame: (overrides = {}) => createWalletPersona({
376
+ uuid: '00000000-0000-4000-8000-000000000120',
377
+ name: 'Frame',
378
+ icon: svgIcon('FRM', '121c20'),
379
+ rdns: 'sh.frame',
380
+ flags: { isFrame: true },
381
+ walletConnect: {
382
+ name: 'Frame',
383
+ description: 'Frame-compatible test wallet',
384
+ url: 'https://frame.sh',
385
+ icons: [],
386
+ },
387
+ ...overrides,
388
+ }),
389
+ enkrypt: (overrides = {}) => createWalletPersona({
390
+ uuid: '00000000-0000-4000-8000-000000000121',
391
+ name: 'Enkrypt Wallet',
392
+ icon: svgIcon('ENK', '111827', 'f3ff68'),
393
+ rdns: 'com.enkrypt',
394
+ flags: { isEnkrypt: true },
395
+ aliases: ['enkrypt.providers.ethereum'],
396
+ walletConnect: {
397
+ name: 'Enkrypt Wallet',
398
+ description: 'Enkrypt-compatible test wallet',
399
+ url: 'https://www.enkrypt.com',
400
+ icons: [],
401
+ },
402
+ ...overrides,
403
+ }),
404
+ core: (overrides = {}) => createWalletPersona({
405
+ uuid: '00000000-0000-4000-8000-000000000122',
406
+ name: 'Core',
407
+ icon: svgIcon('COR', 'e84142'),
408
+ rdns: 'app.core.extension',
409
+ flags: { isAvalanche: true, isCoreWallet: true },
410
+ aliases: ['avalanche'],
411
+ walletConnect: {
412
+ name: 'Core',
413
+ description: 'Core Wallet-compatible test wallet',
414
+ url: 'https://core.app',
415
+ icons: [],
416
+ links: {
417
+ qrCode: '{rawUri}',
418
+ },
419
+ },
420
+ ...overrides,
421
+ }),
422
+ frontier: (overrides = {}) => createWalletPersona({
423
+ uuid: '00000000-0000-4000-8000-000000000123',
424
+ name: 'Frontier Wallet',
425
+ icon: svgIcon('FRT', 'cc703c'),
426
+ rdns: 'xyz.frontier.wallet',
427
+ flags: { isFrontier: true },
428
+ aliases: ['frontier', 'frontier.ethereum'],
429
+ walletConnect: {
430
+ name: 'Frontier Wallet',
431
+ description: 'Frontier Wallet-compatible test wallet',
432
+ url: 'https://www.frontier.xyz',
433
+ icons: [],
434
+ links: {
435
+ mobile: 'frontier://wc?uri={uri}',
436
+ qrCode: '{rawUri}',
437
+ },
438
+ },
439
+ ...overrides,
440
+ }),
441
+ oneKey: (overrides = {}) => createWalletPersona({
442
+ uuid: '00000000-0000-4000-8000-000000000124',
443
+ name: 'OneKey',
444
+ icon: svgIcon('1K', '00b812', '111827'),
445
+ rdns: 'so.onekey.app.wallet',
446
+ flags: { isOneKey: true },
447
+ aliases: ['$onekey', '$onekey.ethereum'],
448
+ walletConnect: {
449
+ name: 'OneKey',
450
+ description: 'OneKey-compatible test wallet',
451
+ url: 'https://www.onekey.so',
452
+ icons: [],
453
+ },
454
+ ...overrides,
455
+ }),
456
+ ctrl: (overrides = {}) => createWalletPersona({
457
+ uuid: '00000000-0000-4000-8000-000000000125',
458
+ name: 'CTRL Wallet',
459
+ icon: svgIcon('CTRL', 'f7f7f7', '111827'),
460
+ rdns: 'xyz.ctrl',
461
+ flags: { isCTRL: true, isXDEFI: true },
462
+ aliases: ['ctrl', 'ctrl.ethereum', 'xfi', 'xfi.ethereum'],
463
+ walletConnect: {
464
+ name: 'CTRL Wallet',
465
+ description: 'CTRL/XDEFI-compatible test wallet',
466
+ url: 'https://ctrl.xyz',
467
+ icons: [],
468
+ },
469
+ ...overrides,
470
+ }),
471
+ uniswap: (overrides = {}) => createWalletPersona({
472
+ uuid: '00000000-0000-4000-8000-000000000127',
473
+ name: 'Uniswap Wallet',
474
+ icon: svgIcon('UNI', 'ff007a'),
475
+ rdns: 'org.uniswap',
476
+ flags: { isUniswapWallet: true },
477
+ walletConnect: {
478
+ name: 'Uniswap Wallet',
479
+ description: 'Uniswap Wallet-compatible test wallet',
480
+ url: 'https://wallet.uniswap.org',
481
+ icons: [],
482
+ },
483
+ ...overrides,
484
+ }),
485
+ argent: (overrides = {}) => createWalletPersona({
486
+ uuid: '00000000-0000-4000-8000-000000000128',
487
+ name: 'Argent',
488
+ icon: svgIcon('ARG', 'ff875b', '111827'),
489
+ rdns: 'xyz.argent',
490
+ flags: { isArgent: true },
491
+ walletConnect: {
492
+ name: 'Argent',
493
+ description: 'Argent-compatible test wallet',
494
+ url: 'https://www.argent.xyz',
495
+ icons: [],
496
+ },
497
+ ...overrides,
498
+ }),
499
+ exodus: (overrides = {}) => createWalletPersona({
500
+ uuid: '00000000-0000-4000-8000-000000000129',
501
+ name: 'Exodus Web3 Wallet',
502
+ icon: svgIcon('EXO', '7b3ff2'),
503
+ rdns: 'com.exodus',
504
+ flags: { isExodus: true },
505
+ walletConnect: {
506
+ name: 'Exodus Web3 Wallet',
507
+ description: 'Exodus-compatible test wallet',
508
+ url: 'https://www.exodus.com/web3-wallet',
509
+ icons: [],
510
+ },
511
+ ...overrides,
512
+ }),
513
+ fireblocks: (overrides = {}) => createWalletPersona({
514
+ uuid: '00000000-0000-4000-8000-000000000130',
515
+ name: 'Fireblocks DeFi',
516
+ icon: svgIcon('FIR', '4f46e5'),
517
+ rdns: 'com.fireblocks',
518
+ flags: { isFireblocks: true },
519
+ walletConnect: {
520
+ name: 'Fireblocks DeFi',
521
+ description: 'Fireblocks DeFi-compatible test wallet',
522
+ url: 'https://www.fireblocks.com',
523
+ icons: [],
524
+ },
525
+ ...overrides,
526
+ }),
527
+ };
528
+ export const majorWalletPersonas = () => [
529
+ walletPersonas.metamask(),
530
+ walletPersonas.rabby(),
531
+ walletPersonas.coinbase(),
532
+ walletPersonas.phantomEvm(),
533
+ walletPersonas.rainbow(),
534
+ walletPersonas.okx(),
535
+ walletPersonas.trust(),
536
+ walletPersonas.brave(),
537
+ walletPersonas.zerion(),
538
+ walletPersonas.backpack(),
539
+ walletPersonas.solflare(),
540
+ walletPersonas.ledger(),
541
+ walletPersonas.trezor(),
542
+ walletPersonas.safe(),
543
+ walletPersonas.bitget(),
544
+ walletPersonas.tokenPocket(),
545
+ walletPersonas.safePal(),
546
+ walletPersonas.binance(),
547
+ walletPersonas.imToken(),
548
+ walletPersonas.mathWallet(),
549
+ walletPersonas.frame(),
550
+ walletPersonas.enkrypt(),
551
+ walletPersonas.core(),
552
+ walletPersonas.frontier(),
553
+ walletPersonas.oneKey(),
554
+ walletPersonas.ctrl(),
555
+ walletPersonas.uniswap(),
556
+ walletPersonas.argent(),
557
+ walletPersonas.exodus(),
558
+ walletPersonas.fireblocks(),
559
+ ];
560
+ const personaProfile = (persona) => ({ persona });
561
+ export const walletProfiles = {
562
+ mock: (options = {}) => personaProfile(walletPersonas.mock(options.persona)),
563
+ metamask: (options = {}) => personaProfile(walletPersonas.metamask(options.persona)),
564
+ rabby: (options = {}) => personaProfile(walletPersonas.rabby(options.persona)),
565
+ coinbase: (options = {}) => ({
566
+ persona: walletPersonas.coinbase(options.persona),
567
+ ...(options.coinbase !== undefined ? { coinbase: options.coinbase } : {}),
568
+ }),
569
+ phantomEvm: (options = {}) => personaProfile(walletPersonas.phantomEvm(options.persona)),
570
+ rainbow: (options = {}) => personaProfile(walletPersonas.rainbow(options.persona)),
571
+ okx: (options = {}) => personaProfile(walletPersonas.okx(options.persona)),
572
+ trust: (options = {}) => personaProfile(walletPersonas.trust(options.persona)),
573
+ brave: (options = {}) => personaProfile(walletPersonas.brave(options.persona)),
574
+ zerion: (options = {}) => personaProfile(walletPersonas.zerion(options.persona)),
575
+ backpack: (options = {}) => personaProfile(walletPersonas.backpack(options.persona)),
576
+ solflare: (options = {}) => personaProfile(walletPersonas.solflare(options.persona)),
577
+ ledger: (options = {}) => ({
578
+ persona: walletPersonas.ledger(options.persona),
579
+ hardwareWallet: options.hardwareWallet ?? true,
580
+ }),
581
+ trezor: (options = {}) => ({
582
+ persona: walletPersonas.trezor(options.persona),
583
+ hardwareWallet: options.hardwareWallet ?? true,
584
+ }),
585
+ safe: (options = {}) => personaProfile(walletPersonas.safe(options.persona)),
586
+ bitget: (options = {}) => personaProfile(walletPersonas.bitget(options.persona)),
587
+ tokenPocket: (options = {}) => personaProfile(walletPersonas.tokenPocket(options.persona)),
588
+ safePal: (options = {}) => personaProfile(walletPersonas.safePal(options.persona)),
589
+ binance: (options = {}) => personaProfile(walletPersonas.binance(options.persona)),
590
+ imToken: (options = {}) => personaProfile(walletPersonas.imToken(options.persona)),
591
+ mathWallet: (options = {}) => personaProfile(walletPersonas.mathWallet(options.persona)),
592
+ frame: (options = {}) => personaProfile(walletPersonas.frame(options.persona)),
593
+ enkrypt: (options = {}) => personaProfile(walletPersonas.enkrypt(options.persona)),
594
+ core: (options = {}) => personaProfile(walletPersonas.core(options.persona)),
595
+ frontier: (options = {}) => personaProfile(walletPersonas.frontier(options.persona)),
596
+ oneKey: (options = {}) => personaProfile(walletPersonas.oneKey(options.persona)),
597
+ ctrl: (options = {}) => personaProfile(walletPersonas.ctrl(options.persona)),
598
+ uniswap: (options = {}) => personaProfile(walletPersonas.uniswap(options.persona)),
599
+ argent: (options = {}) => personaProfile(walletPersonas.argent(options.persona)),
600
+ exodus: (options = {}) => personaProfile(walletPersonas.exodus(options.persona)),
601
+ fireblocks: (options = {}) => personaProfile(walletPersonas.fireblocks(options.persona)),
602
+ };
603
+ export function createWalletPersona(input) {
604
+ const baseInfo = {
605
+ uuid: input.uuid ?? '00000000-0000-4000-8000-ffffffffffff',
606
+ name: input.name ?? 'Mock Wallet',
607
+ icon: input.icon ?? svgIcon(input.name ?? 'Wallet', '111827'),
608
+ rdns: input.rdns ?? 'dev.invisible-wallet.mock',
609
+ };
610
+ return {
611
+ ...baseInfo,
612
+ ...(input.evm !== undefined ? { evm: input.evm } : {}),
613
+ ...(input.flags ? { flags: { ...input.flags } } : {}),
614
+ ...(input.aliases ? { aliases: [...input.aliases] } : {}),
615
+ ...(input.solana
616
+ ? {
617
+ solana: {
618
+ ...input.solana,
619
+ ...(input.solana.chains ? { chains: [...input.solana.chains] } : {}),
620
+ ...(input.solana.flags ? { flags: { ...input.solana.flags } } : {}),
621
+ ...(input.solana.aliases ? { aliases: [...input.solana.aliases] } : {}),
622
+ },
623
+ }
624
+ : {}),
625
+ ...(input.walletConnect
626
+ ? {
627
+ walletConnect: {
628
+ ...input.walletConnect,
629
+ ...(input.walletConnect.links ? { links: { ...input.walletConnect.links } } : {}),
630
+ },
631
+ }
632
+ : {}),
633
+ };
634
+ }
635
+ export function walletPersonaToProviderInfo(persona) {
636
+ return {
637
+ uuid: persona.uuid,
638
+ name: persona.name,
639
+ icon: persona.icon,
640
+ rdns: persona.rdns,
641
+ };
642
+ }
643
+ export function walletConnectMetadataForPersona(persona) {
644
+ return {
645
+ name: persona.walletConnect?.name ?? persona.name,
646
+ description: persona.walletConnect?.description ?? `${persona.name} test wallet powered by web3-tester`,
647
+ url: persona.walletConnect?.url ?? 'https://github.com/AndyMarigoldLabs/web3-tester',
648
+ icons: persona.walletConnect?.icons ?? (persona.icon ? [persona.icon] : []),
649
+ };
650
+ }
651
+ export function walletConnectLinksForPersona(persona) {
652
+ return { ...(persona.walletConnect?.links ?? {}) };
653
+ }
654
+ export function formatWalletConnectUriForPersona(uri, persona, target = 'mobile') {
655
+ const links = persona.walletConnect?.links;
656
+ const template = links?.[target] ??
657
+ (target === 'mobile' ? links?.universal ?? links?.native : undefined) ??
658
+ (target === 'qrCode' ? links?.qrCode : undefined);
659
+ if (!template) {
660
+ return uri;
661
+ }
662
+ return template
663
+ .replaceAll('{rawUri}', uri)
664
+ .replaceAll('{uri}', encodeURIComponent(uri));
665
+ }
666
+ //# sourceMappingURL=wallet-personas.js.map