web3-tools-mcp 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +51 -4
  2. package/dist/anvil.d.ts +34 -0
  3. package/dist/anvil.d.ts.map +1 -0
  4. package/dist/anvil.js +254 -0
  5. package/dist/anvil.js.map +1 -0
  6. package/dist/client.d.ts +3 -0
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +13 -2
  9. package/dist/client.js.map +1 -1
  10. package/dist/index.js +25 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/preview.d.ts +55 -0
  13. package/dist/preview.d.ts.map +1 -0
  14. package/dist/preview.js +233 -0
  15. package/dist/preview.js.map +1 -0
  16. package/dist/tools/advanced.d.ts +67 -9
  17. package/dist/tools/advanced.d.ts.map +1 -1
  18. package/dist/tools/advanced.js +206 -67
  19. package/dist/tools/advanced.js.map +1 -1
  20. package/dist/tools/balance.d.ts +5 -5
  21. package/dist/tools/contract-info.d.ts +9 -9
  22. package/dist/tools/contract.d.ts +8 -8
  23. package/dist/tools/contract.d.ts.map +1 -1
  24. package/dist/tools/contract.js +3 -0
  25. package/dist/tools/contract.js.map +1 -1
  26. package/dist/tools/ens.d.ts +15 -15
  27. package/dist/tools/gas.d.ts +18 -18
  28. package/dist/tools/logs.d.ts +3 -3
  29. package/dist/tools/transactions.d.ts +9 -9
  30. package/dist/tools/transactions.d.ts.map +1 -1
  31. package/dist/tools/transactions.js +92 -113
  32. package/dist/tools/transactions.js.map +1 -1
  33. package/dist/utils.d.ts +13 -0
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +76 -0
  36. package/dist/utils.js.map +1 -1
  37. package/dist/wallet-client.d.ts +83 -0
  38. package/dist/wallet-client.d.ts.map +1 -0
  39. package/dist/wallet-client.js +357 -0
  40. package/dist/wallet-client.js.map +1 -0
  41. package/package.json +9 -8
  42. package/src/anvil.ts +323 -0
  43. package/src/client.ts +16 -2
  44. package/src/index.ts +26 -5
  45. package/src/preview.ts +320 -0
  46. package/src/tools/advanced.ts +239 -70
  47. package/src/tools/contract.ts +3 -0
  48. package/src/tools/transactions.ts +98 -125
  49. package/src/utils.ts +95 -0
  50. package/src/wallet-client.ts +380 -0
  51. package/dist/wallet-server.d.ts +0 -35
  52. package/dist/wallet-server.d.ts.map +0 -1
  53. package/dist/wallet-server.js +0 -232
  54. package/dist/wallet-server.js.map +0 -1
  55. package/public/wallet-app.js +0 -677
  56. package/public/wallet.html +0 -723
  57. package/src/wallet-server.ts +0 -283
@@ -1,723 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Web3 Tools MCP - Wallet Connection</title>
7
- <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👾</text></svg>">
8
- <style>
9
- * {
10
- margin: 0;
11
- padding: 0;
12
- box-sizing: border-box;
13
- }
14
-
15
- body {
16
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
17
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
18
- min-height: 100vh;
19
- padding: 20px;
20
- transition: background 0.3s, color 0.3s;
21
- }
22
-
23
- body.dark-mode {
24
- background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
25
- color: #e4e4e4;
26
- }
27
-
28
- .container {
29
- background: white;
30
- border-radius: 20px;
31
- padding: 40px;
32
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
33
- max-width: 800px;
34
- margin: 0 auto;
35
- transition: background 0.3s, color 0.3s;
36
- }
37
-
38
- body.dark-mode .container {
39
- background: #1e1e2e;
40
- color: #e4e4e4;
41
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
42
- }
43
-
44
- /* Header with Chain Badge */
45
- .header {
46
- display: flex;
47
- justify-content: space-between;
48
- align-items: center;
49
- margin-bottom: 30px;
50
- }
51
-
52
- .chain-badge {
53
- position: relative;
54
- display: inline-flex;
55
- align-items: center;
56
- gap: 8px;
57
- padding: 8px 16px;
58
- border-radius: 20px;
59
- font-size: 14px;
60
- font-weight: 600;
61
- background: #f8f9fa;
62
- border: 2px solid #dee2e6;
63
- cursor: pointer;
64
- transition: all 0.2s;
65
- }
66
-
67
- body.dark-mode .chain-badge {
68
- background: #2a2a3a;
69
- border-color: #4a4a5a;
70
- color: #e4e4e4;
71
- }
72
-
73
- .chain-badge:hover {
74
- border-color: #adb5bd;
75
- }
76
-
77
- body.dark-mode .chain-badge:hover {
78
- border-color: #667eea;
79
- }
80
-
81
- .chain-badge.connected {
82
- background: #d4edda;
83
- border-color: #28a745;
84
- color: #155724;
85
- }
86
-
87
- body.dark-mode .chain-badge.connected {
88
- background: #1a3a1a;
89
- border-color: #28a745;
90
- color: #7fff7f;
91
- }
92
-
93
- .chain-badge.connected:hover {
94
- border-color: #1e7e34;
95
- }
96
-
97
- .chain-dropdown {
98
- position: absolute;
99
- top: 100%;
100
- right: 0;
101
- margin-top: 8px;
102
- background: white;
103
- border: 2px solid #dee2e6;
104
- border-radius: 12px;
105
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
106
- min-width: 200px;
107
- max-height: 400px;
108
- overflow-y: auto;
109
- z-index: 1000;
110
- display: none;
111
- transition: background 0.3s, border-color 0.3s;
112
- }
113
-
114
- body.dark-mode .chain-dropdown {
115
- background: #2a2a3a;
116
- border-color: #4a4a5a;
117
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
118
- }
119
-
120
- .chain-dropdown.show {
121
- display: block;
122
- }
123
-
124
- .chain-option {
125
- padding: 12px 16px;
126
- cursor: pointer;
127
- transition: background 0.2s, color 0.2s;
128
- border-bottom: 1px solid #f1f3f5;
129
- }
130
-
131
- body.dark-mode .chain-option {
132
- border-bottom-color: #3a3a4a;
133
- color: #e4e4e4;
134
- }
135
-
136
- .chain-option:last-child {
137
- border-bottom: none;
138
- }
139
-
140
- .chain-option:hover {
141
- background: #f8f9fa;
142
- }
143
-
144
- body.dark-mode .chain-option:hover {
145
- background: #3a3a4a;
146
- }
147
-
148
- .chain-option.active {
149
- background: #e7f5ff;
150
- font-weight: 600;
151
- color: #0c8599;
152
- }
153
-
154
- body.dark-mode .chain-option.active {
155
- background: #1a3a4a;
156
- color: #5dade2;
157
- }
158
-
159
- .chain-arrow {
160
- font-size: 10px;
161
- transition: transform 0.2s;
162
- }
163
-
164
- .chain-badge.open .chain-arrow {
165
- transform: rotate(180deg);
166
- }
167
-
168
- .chain-indicator {
169
- width: 10px;
170
- height: 10px;
171
- border-radius: 50%;
172
- background: #ccc;
173
- }
174
-
175
- .chain-indicator.active {
176
- background: #28a745;
177
- animation: pulse 2s infinite;
178
- }
179
-
180
- @keyframes pulse {
181
- 0%, 100% { opacity: 1; }
182
- 50% { opacity: 0.5; }
183
- }
184
-
185
- h1 {
186
- color: #333;
187
- font-size: 28px;
188
- transition: color 0.3s;
189
- }
190
-
191
- body.dark-mode h1 {
192
- color: #e4e4e4;
193
- }
194
-
195
- .subtitle {
196
- color: #666;
197
- font-size: 14px;
198
- margin-top: 5px;
199
- transition: color 0.3s;
200
- }
201
-
202
- body.dark-mode .subtitle {
203
- color: #a0a0a0;
204
- }
205
-
206
- /* Status Messages */
207
- .status {
208
- padding: 15px;
209
- border-radius: 10px;
210
- margin-bottom: 20px;
211
- font-weight: 500;
212
- display: flex;
213
- align-items: center;
214
- gap: 10px;
215
- }
216
-
217
- .status.error {
218
- background: #f8d7da;
219
- color: #721c24;
220
- border: 1px solid #f5c6cb;
221
- }
222
-
223
- .status.success {
224
- background: #d4edda;
225
- color: #155724;
226
- border: 1px solid #c3e6cb;
227
- }
228
-
229
- .status.warning {
230
- background: #fff3cd;
231
- color: #856404;
232
- border: 1px solid #ffeaa7;
233
- }
234
-
235
- .status.info {
236
- background: #d1ecf1;
237
- color: #0c5460;
238
- border: 1px solid #bee5eb;
239
- }
240
-
241
- /* Buttons */
242
- button {
243
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
244
- color: white;
245
- border: none;
246
- padding: 15px 30px;
247
- border-radius: 10px;
248
- font-size: 16px;
249
- font-weight: 600;
250
- cursor: pointer;
251
- width: 100%;
252
- transition: transform 0.2s, box-shadow 0.2s;
253
- }
254
-
255
- button:hover:not(:disabled) {
256
- transform: translateY(-2px);
257
- box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
258
- }
259
-
260
- button:disabled {
261
- opacity: 0.5;
262
- cursor: not-allowed;
263
- }
264
-
265
- .btn-approve {
266
- background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
267
- }
268
-
269
- .btn-reject {
270
- background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
271
- }
272
-
273
- /* Wallet Info */
274
- .wallet-info {
275
- background: #f8f9fa;
276
- padding: 20px;
277
- border-radius: 10px;
278
- margin: 20px 0;
279
- transition: background 0.3s;
280
- }
281
-
282
- body.dark-mode .wallet-info {
283
- background: #2a2a3a;
284
- }
285
-
286
- .info-row {
287
- display: flex;
288
- justify-content: space-between;
289
- margin: 10px 0;
290
- font-size: 14px;
291
- }
292
-
293
- .info-label {
294
- color: #666;
295
- font-weight: 600;
296
- transition: color 0.3s;
297
- }
298
-
299
- body.dark-mode .info-label {
300
- color: #a0a0a0;
301
- }
302
-
303
- .info-value {
304
- color: #333;
305
- font-family: 'Courier New', monospace;
306
- word-break: break-all;
307
- transition: color 0.3s;
308
- }
309
-
310
- body.dark-mode .info-value {
311
- color: #e4e4e4;
312
- }
313
-
314
- /* Transaction Preview */
315
- .tx-preview {
316
- background: #fff;
317
- border: 2px solid #667eea;
318
- padding: 20px;
319
- border-radius: 10px;
320
- margin: 20px 0;
321
- transition: background 0.3s, border-color 0.3s;
322
- }
323
-
324
- body.dark-mode .tx-preview {
325
- background: #2a2a3a;
326
- border-color: #667eea;
327
- }
328
-
329
- .tx-preview h3 {
330
- color: #667eea;
331
- margin-bottom: 15px;
332
- display: flex;
333
- align-items: center;
334
- gap: 10px;
335
- }
336
-
337
- .tx-details {
338
- background: #f8f9fa;
339
- padding: 15px;
340
- border-radius: 8px;
341
- margin: 10px 0;
342
- transition: background 0.3s;
343
- }
344
-
345
- body.dark-mode .tx-details {
346
- background: #1e1e2e;
347
- }
348
-
349
- .tx-param {
350
- margin: 8px 0;
351
- padding: 8px;
352
- background: white;
353
- border-radius: 4px;
354
- font-size: 13px;
355
- transition: background 0.3s;
356
- }
357
-
358
- body.dark-mode .tx-param {
359
- background: #2a2a3a;
360
- }
361
-
362
- .tx-param-name {
363
- color: #667eea;
364
- font-weight: 600;
365
- margin-right: 8px;
366
- }
367
-
368
- .tx-param-value {
369
- color: #333;
370
- font-family: 'Courier New', monospace;
371
- word-break: break-all;
372
- transition: color 0.3s;
373
- }
374
-
375
- body.dark-mode .tx-param-value {
376
- color: #e4e4e4;
377
- }
378
-
379
- .tx-actions {
380
- display: flex;
381
- gap: 10px;
382
- margin-top: 15px;
383
- }
384
-
385
- .tx-actions button {
386
- flex: 1;
387
- }
388
-
389
- /* Transaction History */
390
- .tx-history {
391
- margin-top: 30px;
392
- }
393
-
394
- .tx-history h3 {
395
- color: #333;
396
- margin-bottom: 15px;
397
- font-size: 18px;
398
- transition: color 0.3s;
399
- }
400
-
401
- body.dark-mode .tx-history h3 {
402
- color: #e4e4e4;
403
- }
404
-
405
- .tx-history-item {
406
- background: #f8f9fa;
407
- padding: 15px;
408
- border-radius: 8px;
409
- margin: 10px 0;
410
- border-left: 4px solid #dee2e6;
411
- transition: transform 0.2s, background 0.3s;
412
- }
413
-
414
- body.dark-mode .tx-history-item {
415
- background: #2a2a3a;
416
- border-left-color: #4a4a5a;
417
- }
418
-
419
- .tx-history-item:hover {
420
- transform: translateX(5px);
421
- }
422
-
423
- .tx-history-item.success {
424
- border-left-color: #28a745;
425
- }
426
-
427
- .tx-history-item.failed {
428
- border-left-color: #dc3545;
429
- }
430
-
431
- .tx-history-item.pending {
432
- border-left-color: #ffc107;
433
- }
434
-
435
- .tx-history-header {
436
- display: flex;
437
- justify-content: space-between;
438
- align-items: center;
439
- margin-bottom: 8px;
440
- }
441
-
442
- .tx-history-function {
443
- font-weight: 600;
444
- color: #333;
445
- transition: color 0.3s;
446
- }
447
-
448
- body.dark-mode .tx-history-function {
449
- color: #e4e4e4;
450
- }
451
-
452
- .tx-history-status {
453
- font-size: 12px;
454
- padding: 4px 8px;
455
- border-radius: 4px;
456
- font-weight: 600;
457
- }
458
-
459
- .tx-history-status.success {
460
- background: #d4edda;
461
- color: #155724;
462
- }
463
-
464
- body.dark-mode .tx-history-status.success {
465
- background: #1a3a1a;
466
- color: #7fff7f;
467
- }
468
-
469
- .tx-history-status.failed {
470
- background: #f8d7da;
471
- color: #721c24;
472
- }
473
-
474
- body.dark-mode .tx-history-status.failed {
475
- background: #3a1a1a;
476
- color: #ff7f7f;
477
- }
478
-
479
- .tx-history-status.pending {
480
- background: #fff3cd;
481
- color: #856404;
482
- }
483
-
484
- body.dark-mode .tx-history-status.pending {
485
- background: #3a3a1a;
486
- color: #ffdf7f;
487
- }
488
-
489
- .tx-history-details {
490
- font-size: 12px;
491
- color: #666;
492
- margin-top: 8px;
493
- transition: color 0.3s;
494
- }
495
-
496
- body.dark-mode .tx-history-details {
497
- color: #a0a0a0;
498
- }
499
-
500
- .tx-history-link {
501
- color: #667eea;
502
- text-decoration: none;
503
- font-size: 12px;
504
- margin-top: 8px;
505
- display: inline-block;
506
- }
507
-
508
- .tx-history-link:hover {
509
- text-decoration: underline;
510
- }
511
-
512
- /* Log */
513
- .log {
514
- background: #f8f9fa;
515
- border: 1px solid #dee2e6;
516
- border-radius: 8px;
517
- padding: 15px;
518
- max-height: 200px;
519
- overflow-y: auto;
520
- font-family: 'Courier New', monospace;
521
- font-size: 12px;
522
- margin-top: 20px;
523
- transition: background 0.3s, border-color 0.3s;
524
- }
525
-
526
- body.dark-mode .log {
527
- background: #2a2a3a;
528
- border-color: #4a4a5a;
529
- }
530
-
531
- .log-entry {
532
- padding: 4px 0;
533
- color: #495057;
534
- transition: color 0.3s;
535
- }
536
-
537
- body.dark-mode .log-entry {
538
- color: #a0a0a0;
539
- }
540
-
541
- .log-entry.error {
542
- color: #dc3545;
543
- }
544
-
545
- body.dark-mode .log-entry.error {
546
- color: #ff7f7f;
547
- }
548
-
549
- .log-entry.success {
550
- color: #28a745;
551
- }
552
-
553
- body.dark-mode .log-entry.success {
554
- color: #7fff7f;
555
- }
556
-
557
- .log-entry.info {
558
- color: #0c5460;
559
- }
560
-
561
- body.dark-mode .log-entry.info {
562
- color: #5dade2;
563
- }
564
-
565
- /* Dark Mode Toggle */
566
- .dark-mode-toggle {
567
- width: 40px;
568
- height: 40px;
569
- min-width: 40px;
570
- min-height: 40px;
571
- flex-shrink: 0;
572
- border-radius: 50%;
573
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
574
- border: none;
575
- color: white;
576
- font-size: 20px;
577
- cursor: pointer;
578
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
579
- transition: transform 0.2s, box-shadow 0.2s;
580
- display: flex;
581
- align-items: center;
582
- justify-content: center;
583
- padding: 0;
584
- }
585
-
586
- .dark-mode-toggle:hover {
587
- transform: scale(1.1);
588
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
589
- }
590
-
591
- /* GitHub Link */
592
- .github-link {
593
- width: 40px;
594
- height: 40px;
595
- min-width: 40px;
596
- min-height: 40px;
597
- flex-shrink: 0;
598
- border-radius: 50%;
599
- background: #24292e;
600
- border: none;
601
- color: white;
602
- font-size: 20px;
603
- cursor: pointer;
604
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
605
- transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
606
- display: flex;
607
- align-items: center;
608
- justify-content: center;
609
- padding: 0;
610
- text-decoration: none;
611
- }
612
-
613
- body.dark-mode .github-link {
614
- background: #ffffff;
615
- color: #24292e;
616
- }
617
-
618
- .github-link:hover {
619
- transform: scale(1.1);
620
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
621
- }
622
-
623
- /* Empty State */
624
- .empty-state {
625
- text-align: center;
626
- padding: 40px 20px;
627
- color: #999;
628
- }
629
-
630
- .empty-state-icon {
631
- font-size: 48px;
632
- margin-bottom: 16px;
633
- }
634
-
635
- /* Utilities */
636
- .hidden {
637
- display: none !important;
638
- }
639
-
640
- .flex {
641
- display: flex;
642
- gap: 10px;
643
- }
644
-
645
- .flex-center {
646
- display: flex;
647
- align-items: center;
648
- justify-content: center;
649
- gap: 10px;
650
- }
651
- </style>
652
- </head>
653
- <body>
654
- <div class="container">
655
- <div class="header">
656
- <div>
657
- <h1>🔐 Web3 Tools MCP</h1>
658
- <p class="subtitle">Secure transaction signing with browser wallet</p>
659
- </div>
660
- <div style="display: flex; gap: 10px; align-items: center;">
661
- <div id="chainBadge" class="chain-badge" onclick="toggleChainDropdown(event)">
662
- <span class="chain-indicator"></span>
663
- <span id="chainName">Not Connected</span>
664
- <span class="chain-arrow">▼</span>
665
- <div id="chainDropdown" class="chain-dropdown" onclick="event.stopPropagation()">
666
- <!-- Network options will be populated here -->
667
- </div>
668
- </div>
669
- <a href="https://github.com/hajnalben/web3-tools-mcp" target="_blank" class="github-link" title="View on GitHub">
670
- <svg width="20" height="20" viewBox="0 0 16 16" fill="currentColor">
671
- <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/>
672
- </svg>
673
- </a>
674
- <button class="dark-mode-toggle" onclick="toggleDarkMode()" title="Toggle Dark Mode">
675
- 🌙
676
- </button>
677
- </div>
678
- </div>
679
-
680
- <div id="statusMessage" class="hidden"></div>
681
-
682
- <button id="connectBtn" onclick="connectWallet()">
683
- Connect Wallet
684
- </button>
685
-
686
- <div id="walletInfo" class="wallet-info hidden">
687
- <div class="info-row">
688
- <span class="info-label">Address:</span>
689
- <span id="address" class="info-value"></span>
690
- </div>
691
- <div class="info-row">
692
- <span class="info-label">Network:</span>
693
- <span id="networkName" class="info-value"></span>
694
- </div>
695
- <div class="info-row">
696
- <span class="info-label">Balance:</span>
697
- <span id="balance" class="info-value"></span>
698
- </div>
699
- </div>
700
-
701
- <div id="txPreview" class="tx-preview hidden">
702
- <h3>
703
- <span>⏳</span>
704
- <span>Transaction Request</span>
705
- </h3>
706
- <div id="txDetails" class="tx-details"></div>
707
- <div class="tx-actions">
708
- <button class="btn-approve" onclick="approveTx()">✓ Approve & Sign</button>
709
- <button class="btn-reject" onclick="rejectTx()">✗ Reject</button>
710
- </div>
711
- </div>
712
-
713
- <div id="txHistory" class="tx-history hidden">
714
- <h3>📜 Recent Transactions</h3>
715
- <div id="txHistoryList"></div>
716
- </div>
717
-
718
- <div id="log" class="log"></div>
719
- </div>
720
-
721
- <script src="wallet-app.js"></script>
722
- </body>
723
- </html>