Repository navigation
Expand file tree
/
Copy pathup-wallet.html
More file actions
4960 lines (4828 loc) · 366 KB
/
Copy pathup-wallet.html
File metadata and controls
4960 lines (4828 loc) · 366 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://cdnjs.cloudflare.com/ajax/libs/ethers/6.13.4/ 'sha256-MaEFwcKO1ilAb8qPhQN6XyGOAn695ydHt2FA1fY4BbU='">
<script src="theme.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:type" content="website">
<meta property="og:image" content="https://crosschain-lukso.chainintegrate.it/og-image.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://crosschain-lukso.chainintegrate.it/og-image.png">
<meta name="referrer" content="no-referrer">
<meta name="robots" content="noindex, nofollow">
<title>UP Wallet — ChainIntegrate</title>
<meta name="description" content="Il wallet della tua Universal Profile su LUKSO e su ogni rete dove l'hai rideployata, con lo stesso indirizzo: vedi e invii i tuoi asset, usi le dApp con WalletConnect.">
<link rel="icon" href="favicon.ico">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ethers/6.13.4/ethers.umd.min.js" integrity="sha384-6Zl0Pc8zjSz8KvmNeXRvUQgY4ryFb+BwDvKCmLYcBME0joAaru491tQgi9B7zsMM" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="chains.js"></script>
<script src="asset-list.js"></script>
<script src="usd-price.js"></script>
<script src="token-image.js"></script>
<script src="backup-check.js"></script>
<script src="gas-relay-client.js"></script>
<script src="call-decode.js"></script>
<script src="abi-decode.js"></script>
<script src="vendor/walletkit-1.6.0.min.js" integrity="sha384-o1OPho4aXup6dZTxTsaL+hXbLbZ9dmbU0j/hlmpw5t0P/k91PxXHqIdLkQWag92X"></script>
<script src="vendor/qrcode-generator-1.4.4.js" integrity="sha384-8FWZA6BGMXhsfO+BLtrJK0We6gg5o1JyO8xQm6peWDEUs17ACA5ziE/NIAkl9z2k"></script>
<!-- Site configuration, created on the server from config.example.js (not in the repository). -->
<script src="config.js"></script>
<style>
:root {
--bg: #0f1115; --panel: #171a21; --border: #2a2f3a; --field: #10131a; --chip: #2a2f3a; --disabled: #3a3f4b; --raised: #1d2330;
--text: #e6e8ec; --text-dim: #9aa1ad;
--accent: #5b8cff; --ok: #3fbf6f; --warn: #e0a83c; --err: #e05a5a;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }
h1 { font-size: 20px; margin-bottom: 4px; }
.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 28px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 14px; margin: 0 0 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.note { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
select, input { width: 100%; background: var(--field); border: 1px solid var(--border); color: var(--text);
border-radius: 6px; padding: 10px 12px; font-size: 14px; font-family: inherit; }
button { width: 100%; background: var(--accent); color: white; border: none; border-radius: 6px;
padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 12px; }
button:disabled { background: var(--disabled); cursor: not-allowed; }
button.danger { background: var(--err); }
button.secondary { background: var(--chip); }
.status-box { background: var(--field); border: 1px solid var(--border); border-radius: 6px; padding: 12px;
font-family: monospace; font-size: 12.5px; margin-top: 12px; overflow-wrap: anywhere; }
.status-box .empty { color: var(--text-dim); }
#log { font-family: monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.line-ok { color: var(--ok); } .line-warn { color: var(--warn); } .line-err { color: var(--err); } .line-dim { color: var(--text-dim); }
.line-compare { color: var(--warn); font-weight: 700; border: 1px solid var(--warn); border-radius: 6px; padding: 8px 10px; margin: 6px 0; }
.line-danger { color: var(--err); font-weight: 700; border: 1px solid var(--err); border-radius: 6px; padding: 8px 10px; margin: 6px 0; }
.brand-row { margin-bottom: 24px; }
.brand-logo { display: block; width: 100%; height: auto; border-radius: 10px; }
.top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lang-btn { width: auto; background: var(--chip); padding: 6px 14px; font-size: 12px; margin-top: 0; flex-shrink: 0; }
.site-footer { margin-top: 40px; padding: 18px 20px; background: #f5f6f8; border: 1px solid #e3e5ea; border-radius: 10px; color: #4b4f58; }
.footer-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-logo { height: 48px; width: auto; flex-shrink: 0; }
.footer-text { font-size: 13px; line-height: 1.6; }
.footer-li { display: inline-flex; vertical-align: middle; margin: 0 2px; }
.footer-version { margin-top: 10px; font-size: 12px; color: #6b7080; font-family: ui-monospace, Menlo, Consolas, monospace; }
.site-footer a { color: #2563eb; text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 12px; font-size: 13px; margin-top: 10px; }
.kv .k { color: var(--text-dim); }
.kv .v { font-family: monospace; word-break: break-all; }
.kv .v.ok { color: var(--ok); } .kv .v.warn { color: var(--warn); } .kv .v.err { color: var(--err); }
.kv pre { margin: 0; white-space: pre-wrap; word-break: break-all; font-size: 12px; max-height: 320px; overflow: auto; }
.kv details summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.kv details pre { margin-top: 6px; }
.verdict { margin-top: 12px; font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; }
.check-row input { width: auto; }
/* Pending request: a modal window with everything needed to decide, and the buttons. */
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--panel); border: 2px solid var(--warn); border-radius: 12px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.modal-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--warn); }
.modal-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.modal-body { padding: 12px 18px; overflow: auto; flex: 1; }
.modal-notes { font-family: monospace; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.modal-foot { padding: 12px 18px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.modal-foot button { margin-top: 0; }
.modal-foot button[hidden] { display: none; }
body.modal-open { overflow: hidden; }
/* Menu: the UP card, then big buttons; each opens its section. "All" shows every panel (classic page). */
.up-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--raised); color: var(--text);
border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-weight: 400; }
.up-card-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.up-card-addr { font-family: monospace; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.up-card-sub { font-size: 12.5px; color: var(--text-dim); }
.up-card { cursor: pointer; }
.up-card-pic { width: 40px; height: 40px; border-radius: 50%; }
.up-card-state { font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Simulation on/off, in the UP card: a tap opens a small window to change it. */
.sim-chip { width: auto; margin: 0; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: transparent; }
.sim-chip.on { border: 1px solid var(--warn); color: var(--warn); }
.sim-chip.off { border: 1px solid var(--err); color: var(--err); }
.sim-chip.site { border: 1px solid var(--ok); color: var(--ok); }
.sim-chip.ctl { border: 1px solid var(--text-dim); color: var(--text-dim); }
.sim-modal { border-color: var(--warn); width: min(520px, 100%); }
.send-btns { display: flex; gap: 10px; }
/* An unrecognised call: its data ready to copy, or to e-mail, to have it decoded in a next version. */
.decode-help { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 13px; line-height: 1.5; }
.decode-help .send-btns button { margin-top: 8px; }
.decode-mail { display: none; }
.send-btns #sendClearBtn { flex: 0 0 30%; }
/* Back to the menu from the bottom of a long section (or to the top, in the full view). */
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 15; width: 52px; height: 52px; margin: 0; padding: 0; border-radius: 50%;
font-size: 22px; box-shadow: 0 4px 16px rgba(0,0,0,0.45); display: none; }
.fab.on { display: block; }
body.modal-open .fab { display: none; }
body:has(#busyToast.on) .fab { bottom: 96px; }
/* The explanation under the title only on the menu; in the app the banner is left out (the app has its icon),
so the menu starts near the top of the phone screen. */
body:not([data-view="home"]) .subtitle { display: none; }
html.in-app .brand-row { display: none; }
html.in-app h1 { font-size: 18px; }
html.in-app .subtitle { margin-bottom: 16px; }
.setup-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--warn); border-radius: 10px;
padding: 10px 12px; margin-bottom: 14px; font-size: 13.5px; }
.setup-banner[hidden] { display: none; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; padding: 14px 12px; min-height: 104px; text-align: left;
background: var(--panel); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 400; }
.tile:hover { border-color: var(--accent); }
.tile-ico { font-size: 20px; line-height: 1; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.tile-t { font-size: 14px; font-weight: 700; }
.tile-s { font-size: 11.5px; color: var(--text-dim); line-height: 1.35; }
.tile.wide { grid-column: 1 / -1; min-height: 0; }
#ovBox { font-family: inherit; font-size: 14px; }
.ov-total { font-size: 20px; font-weight: 700; margin: 4px 0; }
.ov-net { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.ov-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ov-line { display: flex; gap: 10px; font-size: 13px; padding: 3px 0; overflow-wrap: anywhere; }
.ov-usd { margin-left: auto; color: var(--text-dim); white-space: nowrap; font-weight: 400; }
.ov-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }
.ov-line { align-items: center; }
.ups-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.ups-row .ups-main { flex: 1; min-width: 0; }
.ups-row .ups-name { font-weight: 700; overflow-wrap: anywhere; }
.ups-row .ups-addr { font-family: monospace; font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }
.ups-row button { width: auto; margin: 0; padding: 4px 10px; font-size: 12.5px; }
.ups-row .ov-thumb { border-radius: 50%; }
.ups-cur { font-size: 12px; font-weight: 700; color: var(--ok); }
.ov-thumb { width: 28px; height: 28px; flex: none; border-radius: 6px; background: var(--field) center / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-dim); overflow: hidden; }
.ov-thumb.has-img { color: transparent; }
.ov-thumb.img-ask { cursor: pointer; outline: 1px dashed var(--accent); outline-offset: -1px; color: var(--accent); }
.ov-thumb .net-logo { width: 28px; height: 28px; }
#sendToInfo { overflow-wrap: anywhere; }
.contacts-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.contacts-row button { padding: 6px 10px; width: auto; margin: 0; }
.contacts-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 13px; }
.contacts-box .ct-row { display: flex; gap: 6px; align-items: stretch; margin: 4px 0; }
.contacts-box .ct-row > button { margin: 0; }
.contacts-box .ct-row > button:first-child { flex: 1 1 auto; width: auto; text-align: left; padding: 8px 10px; min-width: 0; }
.contacts-box .ct-row > button:not(:first-child) { flex: 0 0 auto; width: auto; padding: 6px 10px; }
.contacts-box .ct-addr { font-size: 11.5px; opacity: 0.8; overflow-wrap: anywhere; }
.contacts-box textarea { width: 100%; min-height: 90px; font-size: 11.5px; box-sizing: border-box; }
.contacts-box .ct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.contacts-box .ct-actions button { padding: 6px 10px; width: auto; margin: 0; }
.send-chosen { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.view-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.view-title { font-size: 16px; font-weight: 700; }
body[data-view="home"] .panel { display: none; }
body:not([data-view="home"]) .tiles, body:not([data-view="home"]) .setup-banner { display: none; }
body[data-view="home"] .view-bar, body[data-view="all"] .view-bar { display: none; }
body[data-view="send"] .panel:not([data-view="send"]), body[data-view="receive"] .panel:not([data-view="receive"]),
body[data-view="dapp"] .panel:not([data-view="dapp"]), body[data-view="activity"] .panel:not([data-view="activity"]),
body[data-view="settings"] .panel:not([data-view="settings"]), body[data-view="help"] .panel:not([data-view="help"]),
body[data-view="overview"] .panel:not([data-view="overview"]) { display: none; }
/* Networks: the main ones as buttons with their logo; a green dot where the UP exists. */
.net-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 560px) { .net-picker { grid-template-columns: repeat(2, 1fr); } }
.net-btn { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 10px; background: var(--field); color: var(--text);
border: 1px solid var(--border); border-radius: 10px; font-size: 13px; font-weight: 600; text-align: left; position: relative; }
.net-btn.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.net-logo { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
font-size: 13px; font-weight: 800; color: #fff; }
.net-logo img { width: 100%; height: 100%; display: block; }
.net-dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--disabled); }
.net-dot.yes { background: var(--ok); }
#netMore { margin-top: 10px; }
#netMore summary { cursor: pointer; font-size: 13px; color: var(--accent); margin-bottom: 8px; }
/* Receive: the QR on white (scanners need contrast), the address, the network. */
.receive-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
#receiveQr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
#receiveQr svg { width: 220px; height: 220px; }
.receive-addr { font-family: monospace; font-size: 13px; text-align: center; overflow-wrap: anywhere; }
.receive-net { font-size: 12.5px; color: var(--text-dim); text-align: center; }
/* Warnings: a window at start, until accepted (remembered in this browser); panel 0 can open it again. */
.risk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13.5px; }
button.small { width: auto; margin-top: 0; padding: 7px 12px; font-size: 12.5px; }
.risk-modal { border-color: var(--err); }
.risk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.risk-modal .modal-title { color: var(--err); }
.risk-text { font-size: 13.5px; line-height: 1.55; }
.risk-foot { flex-direction: column; align-items: stretch; gap: 8px; }
.risk-foot .check-row { margin-top: 0; }
.risk-btns { display: flex; gap: 10px; }
/* Messages: the whole list, or only the last one (the default in the app). */
.log-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.log-title { font-size: 13px; color: var(--text-dim); font-weight: 600; }
#log { margin-top: 6px; }
#log.last-only > :not(:last-child) { display: none; }
/* The current request's last error stays visible in the short log too, until the next request or a tap. */
#log.last-only > .sticky-err:not(:last-child) { display: block; cursor: pointer; }
.warn-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--err); border-radius: 8px; background: rgba(224,90,90,0.08); font-size: 13px; line-height: 1.5; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } }
/* While the page works (a dApp request, a connection, a send): a fixed box with the current step. */
#busyToast { display: none; position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 70;
width: calc(100% - 32px); max-width: 720px; background: var(--raised); border: 2px solid var(--warn); border-radius: 10px;
padding: 12px 16px; font-size: 14px; line-height: 1.5; color: var(--text); box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
#busyToast.on { display: flex; gap: 12px; align-items: center; }
#busyToast .spin { width: 18px; height: 18px; flex: 0 0 18px; border: 3px solid var(--warn); border-top-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
#busyToast .msg { word-break: break-word; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #busyToast .spin { animation: none; } }
</style>
</head>
<body>
<div class="brand-row">
<img src="banner.png" alt="ChainIntegrate" class="brand-logo">
</div>
<div class="top-row">
<div>
<h1 data-i18n="h1">UP Wallet (sperimentale)</h1>
<div class="subtitle" data-i18n="subtitle"></div>
</div>
<button class="lang-btn" id="langToggle" data-i18n="langToggleBtn">English</button>
</div>
<div id="nav">
<div class="up-card" id="upCard" role="button" tabindex="0">
<span class="ov-thumb up-card-pic" id="upCardPic" hidden></span>
<span class="net-logo" id="upCardLogo"></span>
<span class="up-card-main"><span class="up-card-addr" id="upCardAddr"></span><span class="up-card-sub" id="upCardSub"></span><span class="up-card-state" id="upCardState"><span id="upCardStateText"></span><button type="button" class="sim-chip" id="simChip"></button><button type="button" class="sim-chip" id="gasChip"></button><button type="button" class="sim-chip ctl" id="upChip" data-i18n="upChip">⇄ UP</button></span></span>
</div>
<div class="setup-banner" id="setupBanner" hidden><span data-i18n="setupBanner"></span><button type="button" class="small" data-go="settings" data-i18n="setupGoBtn">Configura</button></div>
<div class="tiles">
<button type="button" class="tile" data-go="send"><span class="tile-ico">↗</span><span class="tile-t" data-i18n="tileSend">Invia</span><span class="tile-s" data-i18n="tileSendSub"></span></button>
<button type="button" class="tile" data-go="receive"><span class="tile-ico">↙</span><span class="tile-t" data-i18n="tileReceive">Ricevi</span><span class="tile-s" data-i18n="tileReceiveSub"></span></button>
<button type="button" class="tile" data-go="overview"><span class="tile-ico">◎</span><span class="tile-t" data-i18n="tileOverview">Tutte le reti</span><span class="tile-s" data-i18n="tileOverviewSub"></span></button>
<button type="button" class="tile" data-go="dapp"><span class="tile-ico">⇄</span><span class="tile-t" data-i18n="tileDapp">Collega una dApp</span><span class="tile-s" data-i18n="tileDappSub"></span></button>
<button type="button" class="tile" data-go="activity"><span class="tile-ico">☰</span><span class="tile-t" data-i18n="tileActivity">Attività</span><span class="tile-s" data-i18n="tileActivitySub"></span></button>
<button type="button" class="tile" data-go="settings"><span class="tile-ico">⚙</span><span class="tile-t" data-i18n="tileSettings">Impostazioni</span><span class="tile-s" data-i18n="tileSettingsSub"></span></button>
<button type="button" class="tile wide" data-go="help"><span class="tile-ico">?</span><span class="tile-t" data-i18n="tileHelp">Cos'è e come funziona</span><span class="tile-s" data-i18n="tileHelpSub"></span></button>
</div>
</div>
<div class="view-bar" id="viewBar"><button type="button" id="backHome" class="secondary small" data-i18n="backBtn">← Menu</button><span class="view-title" id="viewTitle"></span></div>
<div class="panel" data-view="help">
<h2 data-i18n="panel0Title">0 · Cos'è e come funziona</h2>
<div class="note" data-i18n-html="panel0Note"></div>
<div class="risk-row"><span id="riskState" class="line-warn"></span><button id="riskReopen" type="button" class="secondary small" data-i18n="riskReopenBtn">Leggi le avvertenze</button></div>
</div>
<div class="panel" data-view="settings">
<h2 data-i18n="panel1Title">1 · Rete</h2>
<div class="note" data-i18n="panel1Note"></div>
<div class="net-picker" id="netPicker"></div>
<div class="note" id="netPresenceNote" style="margin-top:6px;"></div>
<details id="netMore">
<summary data-i18n="netMoreSummary">Altre reti e RPC personalizzato</summary>
<input type="text" id="networkFilter" data-i18n-placeholder="networkFilterPlaceholder" placeholder="Filtra per nome...">
<select id="network" style="margin-top:8px;"></select>
<div id="customRpcWrap" style="display:none;">
<label data-i18n="customRpcLabel">RPC URL custom</label>
<input type="text" id="customRpc" placeholder="https://...">
<label data-i18n="customExplorerLabel">Explorer URL custom (opzionale)</label>
<input type="text" id="customExplorer" placeholder="https://.../tx/">
</div>
</details>
</div>
<div class="panel" data-view="settings">
<h2 data-i18n="panel2Title">2 · La tua UP</h2>
<button id="connectUp" class="secondary" data-i18n="connectUpBtn">Leggi l'indirizzo dall'estensione UP</button>
<label for="upAddress" data-i18n="upAddressLabel">Indirizzo o nome della UP</label>
<input type="text" id="upAddress" placeholder="0x… / nome#abcd" autocomplete="off">
<div id="upAddressResults"></div>
<div id="backupAlert"></div>
</div>
<div class="panel" data-view="settings">
<h2 data-i18n="panel3Title">3 · Controller (MetaMask) e verifica</h2>
<div class="note" data-i18n="panel3Note"></div>
<button id="connectSigner" data-i18n="connectSignerBtn">Connetti MetaMask (controller)</button>
<div class="status-box" id="complianceBox"><span class="empty" data-i18n="complianceIdle">La verifica parte da sola quando rete, UP e MetaMask sono impostati.</span></div>
<button id="recheckBtn" class="secondary" data-i18n="recheckBtn">Ricontrolla</button>
<div id="relayBox"></div>
</div>
<div class="panel" data-view="settings">
<h2 data-i18n="panelViewTitle">Vista</h2>
<div class="check-row"><input type="checkbox" id="viewAll"><label for="viewAll" style="margin:0;" data-i18n="viewAllLabel">Vista completa: tutti i pannelli in una pagina</label></div>
<div class="note" style="margin-top:6px;" data-i18n="viewAllNote"></div>
</div>
<div class="panel" data-view="overview">
<h2 data-i18n="panelOverviewTitle">Tutte le reti</h2>
<div class="note" data-i18n="overviewNote"></div>
<button type="button" id="ovRefresh" class="secondary" data-i18n="ovRefresh">Aggiorna</button>
<div id="ovBox" class="status-box"><span class="empty" data-i18n="ovNoUp">Imposta la UP nelle Impostazioni.</span></div>
</div>
<div class="panel" data-view="receive">
<h2 data-i18n="panelReceiveTitle">Ricevi</h2>
<div class="note" data-i18n="receiveNote"></div>
<div class="receive-box">
<div id="receiveQr"></div>
<div id="receiveAddr" class="receive-addr"></div>
<div id="receiveNet" class="receive-net"></div>
<div id="receiveWarn"></div>
</div>
<button type="button" id="receiveCopy" class="secondary" data-i18n="receiveCopyBtn">Copia l'indirizzo</button>
<button type="button" id="receiveShare" class="secondary" data-i18n="receiveShareBtn">Condividi il link</button>
<div class="note" id="receiveLink" style="margin-top:8px; overflow-wrap:anywhere;"></div>
</div>
<div class="panel" data-view="dapp">
<h2 data-i18n="panel4Title">4 · Collega una dApp con WalletConnect</h2>
<div class="note" data-i18n-html="panel4Note"></div>
<label for="wcUri" data-i18n="wcUriLabel">Link WalletConnect (wc:...)</label>
<input type="text" id="wcUri" placeholder="wc:...">
<button id="pairBtn" disabled data-i18n="pairBtn">Collega</button>
<div class="status-box" id="wcStatus"><span class="empty" data-i18n="wcIdle">Nessuna sessione.</span></div>
<button id="disconnectBtn" class="secondary" disabled data-i18n="disconnectBtn">Disconnetti tutte le sessioni</button>
</div>
<div class="panel" data-view="activity">
<h2 data-i18n="panel5Title">5 · Richieste (dApp e invii)</h2>
<div class="check-row"><input type="checkbox" id="simulateOnly" checked><label for="simulateOnly" style="margin:0;" data-i18n="simulateOnlyLabel">Solo simulazione (non inviare nulla)</label></div>
<div class="note" style="margin-top:6px;" data-i18n="simulateOnlyNote"></div>
<div id="requestBox" class="status-box"><span class="empty" data-i18n="noRequest">Nessuna richiesta in attesa.</span></div>
<div id="decodeHelp" class="decode-help" hidden></div>
<div class="log-bar"><span class="log-title" data-i18n="logTitle">Messaggi</span><button id="logToggle" type="button" class="secondary small"></button></div>
<div id="log" class="line-dim"></div>
</div>
<div class="panel" data-view="send">
<h2 data-i18n="panelSendTitle">6 · Invia dalla UP</h2>
<div class="note" data-i18n-html="panelSendNote"></div>
<div class="status-box" id="holdBox"><span class="empty" data-i18n="holdIdle">Il saldo della UP compare quando la verifica del pannello 3 è verde.</span></div>
<button id="holdRefresh" class="secondary" disabled data-i18n="holdRefreshBtn">Aggiorna i saldi</button>
<label for="sendAsset" data-i18n="sendAssetLabel">Cosa inviare</label>
<select id="sendAsset">
<option value="native" data-i18n="sendAssetNative">La valuta della rete</option>
<option value="token" data-i18n="sendAssetToken">Un token o un NFT: incolla l'indirizzo del contratto</option>
</select>
<div id="sendChosen" class="send-chosen" hidden></div>
<div id="sendTokenWrap" hidden>
<label for="sendToken" data-i18n="sendTokenLabel">Indirizzo del token</label>
<input type="text" id="sendToken" placeholder="0x...">
<div class="note" id="sendTokenInfo" style="margin-top:6px;"></div>
<div id="sendIdWrap" hidden>
<label for="sendId" data-i18n="sendIdLabel">ID del token (NFT)</label>
<input type="text" id="sendId" placeholder="1">
<div id="sendIdPick"></div>
</div>
</div>
<label for="sendTo" data-i18n="sendToLabel">Destinatario</label>
<input type="text" id="sendTo" data-i18n-placeholder="sendToPlaceholder" placeholder="0x… oppure il nome di una Universal Profile">
<div class="contacts-row">
<button id="contactsBtn" type="button" class="secondary" data-i18n="contactsBtn">📇 Contatti</button>
<button id="contactSaveBtn" type="button" class="secondary" hidden data-i18n="contactSaveBtn">Salva come contatto</button>
</div>
<div id="contactsBox" class="contacts-box" hidden></div>
<div id="sendToResults"></div>
<div class="note" id="sendToInfo" style="margin-top:6px;"></div>
<div id="sendAmountWrap">
<label for="sendAmount" id="sendAmountLabel" data-i18n="sendAmountLabel">Importo</label>
<input type="text" id="sendAmount" inputmode="decimal" placeholder="0.0">
<button id="sendMaxBtn" type="button" class="secondary" data-i18n="sendMaxBtn">Tutto</button>
</div>
<div class="send-btns">
<button id="sendPrepareBtn" disabled data-i18n="sendPrepareBtn">Prepara l'invio</button>
<button id="sendClearBtn" type="button" class="secondary" data-i18n="sendClearBtn">Pulisci</button>
</div>
</div>
<div class="modal-backdrop" id="riskModal" hidden>
<div class="modal risk-modal" role="dialog" aria-modal="true" aria-labelledby="riskTitle">
<div class="modal-head risk-head"><div class="modal-title" id="riskTitle" data-i18n="riskTitle">Avvertenze</div><button type="button" class="lang-btn" id="riskLang" data-i18n="langToggleBtn">English</button></div>
<div class="modal-body"><div class="risk-text" data-i18n-html="disclaimer"></div></div>
<div class="modal-foot risk-foot">
<div class="check-row"><input type="checkbox" id="ackRisk"><label for="ackRisk" style="margin:0; color: var(--text);" data-i18n="ackLabel">Ho letto e accetto</label></div>
<div class="risk-btns">
<button id="riskOk" type="button" disabled data-i18n="riskOkBtn">Continua</button>
<button id="riskLater" type="button" class="secondary" data-i18n="riskLaterBtn">Non ora</button>
</div>
</div>
</div>
</div>
<div class="modal-backdrop" id="simModal" hidden>
<div class="modal sim-modal" role="dialog" aria-modal="true" aria-labelledby="simTitle">
<div class="modal-head"><div class="modal-title" id="simTitle" data-i18n="simTitle">Modalità simulazione</div></div>
<div class="modal-body">
<div class="check-row" style="margin-top:0;"><input type="checkbox" id="simToggle"><label for="simToggle" style="margin:0; color: var(--text);" data-i18n="simulateOnlyLabel">Solo simulazione (non inviare nulla)</label></div>
<div class="note" style="margin-top:8px;" data-i18n="simulateOnlyNote"></div>
<div id="simWarn"></div>
</div>
<div class="modal-foot"><button id="simClose" type="button" data-i18n="simCloseBtn">Fatto</button></div>
</div>
</div>
<div class="modal-backdrop" id="upsModal" hidden>
<div class="modal sim-modal" role="dialog" aria-modal="true" aria-labelledby="upsTitle">
<div class="modal-head"><div class="modal-title" id="upsTitle" data-i18n="upsTitle">Le tue UP</div></div>
<div class="modal-body">
<div id="upsList"></div>
<label for="upsAdd" data-i18n="upsAddLabel">Aggiungi una UP: indirizzo o nome</label>
<input type="text" id="upsAdd" placeholder="0x… / nome#abcd" autocomplete="off">
<div id="upsAddResults"></div>
<div class="note" style="margin-top:8px;" data-i18n="upsNote"></div>
</div>
<div class="modal-foot"><button id="upsClose" type="button" data-i18n="simCloseBtn">Fatto</button></div>
</div>
</div>
<div class="modal-backdrop" id="gasModal" hidden>
<div class="modal sim-modal" role="dialog" aria-modal="true" aria-labelledby="gasTitle">
<div class="modal-head"><div class="modal-title" id="gasTitle" data-i18n="gasTitle">⛽ Chi paga il gas</div></div>
<div class="modal-body">
<div class="check-row" style="margin-top:0;"><input type="checkbox" id="gasToggle"><label for="gasToggle" style="margin:0; color: var(--text);" data-i18n="gasToggleLabel">Paga il gas con il relayer del sito</label></div>
<div class="note" style="margin-top:8px;" id="gasNote"></div>
</div>
<div class="modal-foot"><button id="gasClose" type="button" data-i18n="simCloseBtn">Fatto</button></div>
</div>
</div>
<button type="button" id="fabMenu" class="fab" aria-label="Menu"></button>
<div class="modal-backdrop" id="requestModal" hidden>
<div class="modal" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
<div class="modal-head">
<div class="modal-title" id="modalTitle"></div>
<div class="modal-sub" data-i18n="modalSub">Leggi tutto prima di decidere.</div>
</div>
<div class="modal-body">
<div class="modal-notes" id="modalNotes"></div>
<div id="modalDetails"></div>
<div id="modalDecodeHelp" class="decode-help" hidden></div>
</div>
<div class="modal-foot">
<button id="sendBtn" class="danger" disabled hidden data-i18n="sendBtn">Firma e invia la transazione (irreversibile)</button>
<button id="signBtn" class="danger" disabled hidden data-i18n="signBtn">Firma il messaggio per la UP</button>
<button id="rejectBtn" class="secondary" disabled data-i18n="rejectBtn">Rifiuta la richiesta</button>
</div>
</div>
</div>
<div id="busyToast" role="status" aria-live="polite"><div class="spin"></div><div class="msg" id="busyMsg"></div></div>
<div class="site-footer">
<div class="footer-row">
<img src="logo.png" alt="ChainIntegrate" class="footer-logo">
<div class="footer-text" data-i18n-html="footerHtml"></div>
</div>
<div class="footer-version" id="pageVersion"></div>
</div>
<script>
const $ = (id) => document.getElementById(id);
// ==================== CONFIG ====================
// WalletConnect (Reown) Project ID, read from config.js, which exists only on the server
// (see config.example.js). It is a public identifier; its protection is the Reown domain allowlist.
const WALLETCONNECT_PROJECT_ID = (window.CROSSCHAIN_CONFIG && window.CROSSCHAIN_CONFIG.walletConnectProjectId) || "";
// Built-in chains: shared chains.js. Explorer links to transactions use the "/tx/" path.
const EXPLORER_PATH = "/tx/";
// LSP6 permission bits, as in @lukso/lsp6-contracts LSP6Constants.sol (bits 0..22), plus ERC4337 (bit 23).
const PERMISSION_BITS = [
"CHANGEOWNER","ADDCONTROLLER","EDITPERMISSIONS","ADDEXTENSIONS","CHANGEEXTENSIONS",
"ADDUNIVERSALRECEIVERDELEGATE","CHANGEUNIVERSALRECEIVERDELEGATE","REENTRANCY",
"SUPER_TRANSFERVALUE","TRANSFERVALUE","SUPER_CALL","CALL","SUPER_STATICCALL","STATICCALL",
"SUPER_DELEGATECALL","DELEGATECALL","DEPLOY","SUPER_SETDATA","SETDATA","ENCRYPT","DECRYPT",
"SIGN","EXECUTE_RELAY_CALL","ERC4337"
];
const P = Object.fromEntries(PERMISSION_BITS.map((n, i) => [n, 1n << BigInt(i)]));
// ERC4337: a 32-byte personal_sign by this controller authorizes an operation of the UP (AUDIT 2026-10-02 H-2).
const PRIVILEGED = P.CHANGEOWNER | P.ADDCONTROLLER | P.EDITPERMISSIONS | P.SUPER_DELEGATECALL | P.DELEGATECALL | P.ERC4337;
const PERM_PREFIX = "0x4b80742de2bf82acb3630000"; // LSP6 AddressPermissions:Permissions:<address>
const ERC1271_MAGIC = "0x1626ba7e";
const PERMIT2 = "0x000000000022d473030f116ddee9f6b43ac78ba3";
// Contracts deployed at the same address on every chain where they exist, checked on the block
// explorers and in each project's own documentation. Only used as a label, and only when the address
// has code on the chosen network: the name says who receives the call, not what the call does.
const KNOWN_CONTRACTS = {
"0x000000000022d473030f116ddee9f6b43ac78ba3": { name: "Permit2 (Uniswap)", role: "rolePermit2" },
"0x00000000000000adc04c56bf30ac9d3c0aaf14dc": { name: "Seaport 1.5 (OpenSea)", role: "roleMarket" },
"0x0000000000000068f116a894984e2db1123eb395": { name: "Seaport 1.6 (OpenSea)", role: "roleMarket" },
"0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae": { name: "LI.FI Diamond", role: "roleSwapBridge" },
"0x89c6340b1a1f4b25d36cd8b063d49045caf3f818": { name: "LI.FI Permit2 Proxy", role: "roleLifiPermit2" },
"0x0000000000001ff3684f28c67538d4d072c22734": { name: "0x AllowanceHolder", role: "roleSwap" },
"0x4200000000000000000000000000000000000006": { name: "WETH", role: "roleWrapped" }, // OP-stack predeploy (Base, Optimism, …)
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": { name: "WETH", role: "roleWrapped" }, // Ethereum
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1": { name: "WETH", role: "roleWrapped" }, // Arbitrum One
"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270": { name: "WPOL", role: "roleWrapped" }, // Polygon
};
// dApp contracts with a different address on each network, keyed "chainId:address". Their calls are
// decoded only when sent to these addresses: a generic name such as create() means nothing elsewhere.
// hup.social: the contracts are not verified on the explorers. The layout of create() was read from
// hup.social's own transactions and their ContentCreated events (creator, cType, metadata, parentId,
// allowedComments); batchLike() from a like sent on LUKSO (the UP, then the liked content IDs). Each
// signature's selector matches the one hup.social sends, so name and argument types are exact.
const DAPP_CONTRACTS = {
"8453:0xe401af10caa79f9bb6945c87ee196503e5de6bea": "hup.social", // Base
"5042:0xa5e73b15c1c3ee477aed682741f0324c6787bbb8": "hup.social", // Arc
"42:0xf6eec4e32a532b23acc56b72865e79c79877cec8": "hup.social", // LUKSO
"1:0xd1aec7bb7679fa30e74ab30877fbdf96d51333d4": "hup.social", // Ethereum (a reply from hup.social, 2026-10-22)
"42:0x7a5134435e029b5bbff0d4eb5aebcf0255d76d88": "hup.social", // LUKSO, polls
// ChainIntegrate's Supplier Trust Registry (SupplierRegistry V3, source verified on LUKSO's explorer).
"42:0xfa143308d85b81ed57547049f4a7718c3117a064": "Supplier Trust Registry",
// LUKSO's LSP26 Follower System (the standard's own contract; hup.social uses it for follows).
"42:0xf01103e5a9909fc0dbe8166da7085e0285daddca": "LSP26 Follower System",
// Morpho's VaultBundlesV1, which Morpho's app calls to deposit into, withdraw from or migrate between
// its vaults (source verified on the explorer). On Arc it is the address the app asks to approve.
"8453:0x2b08a911f48de25a7e305d910afb5597abe8ea7b": "Morpho VaultBundlesV1", // Base
"5042:0x76c1deefae48523e14903085081bda2999450b68": "Morpho VaultBundlesV1", // Arc
// Arbitrum One: the address Morpho's app sent a deposit to, the shares then in Morpho's portfolio
// (2026-10-28); source verified on Arbiscan as VaultBundlesV1.
"42161:0x5afab0b2414e30c92a708234ea1b383ce6317ed5": "Morpho VaultBundlesV1",
"43114:0x5c0401e81bc07ca70fad469b451682c0d747ef1c": "BENQI qiAVAX", // Avalanche: lending market (Compound-style)
"43114:0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be": "BENQI sAVAX", // Avalanche: liquid staking
"43114:0x435272ceff93a1e657e8abfdf0a13e95900a3a56": "Aave Spoke", // Avalanche, pro.aave.com: the market (user positions)
"43114:0xe4c7183a5f22c365140f41d733d8a8bad5a1a6ba": "Aave gateway (AVAX)", // Avalanche, pro.aave.com: native AVAX in and out
"43114:0x24dbafb8611c6639316b17edd2ecf3f91424b26b": "Yield Yak", // Avalanche, yieldyak.com: a strategy (vault)
};
// Morpho VaultBundlesV1. vaultBundlesV1Deposit's selector (0x6bbba4e0) matches the calls Morpho's app
// sends, so its types are exact (TokenPermit = (uint8 kind, bytes data)). Permit, used by withdraw and
// migrate, is not in the verified main file: the usual layouts are listed, and a call is decoded only
// when its selector matches one of them exactly. The shares or assets always go to the caller, the UP.
const MORPHO_BUNDLES_IFACE = new ethers.Interface([
"function vaultBundlesV1Deposit(address vault, uint256 assets, uint256 maxSharePriceE27, (uint8 kind, bytes data) assetPermit, uint256 referralFeePct, address referralFeeRecipient, uint256 deadline) payable",
...["(uint8 kind, bytes data)", "(uint256 deadline, uint8 v, bytes32 r, bytes32 s)", "(uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)", "(bool submit, uint256 deadline, uint8 v, bytes32 r, bytes32 s)"].flatMap((perm) => [
`function vaultBundlesV1Withdraw(address vault, uint256 assets, uint256 shares, ${perm} sharesPermit, uint256 referralFeePct, address referralFeeRecipient, uint256 deadline)`,
`function vaultBundlesV1Migrate(address sourceVault, address destVault, uint256 assetsWithdrawn, uint256 sharesRedeemed, uint256 destMaxSharePriceE27, ${perm} sharesPermit, uint256 referralFeePct, address referralFeeRecipient, uint256 deadline)`,
]),
]);
// LSP26: the follower is always the caller (msg.sender), here the UP itself.
const LSP26_IFACE = new ethers.Interface([
"function follow(address addr)", "function unfollow(address addr)",
"function followBatch(address[] addresses)", "function unfollowBatch(address[] addresses)",
]);
// ChainIntegrate's Traceability Registry, on LUKSO only. Each company's registry is created by the Factory,
// which answers isRegistry(address): a call is read with these signatures (from the public source,
// github.com/ChainIntegrate/traceability-registry) only at the Factory or at a registry it confirms.
// ChainIntegrate's Supplier Trust Registry (LUKSO, V3): each registry is a soulbound LSP8 token of the company's
// UP, and every call names it by its tokenId; only its holder may write in it (onlyRegistryOwner). From the
// public source, github.com/ChainIntegrate/supplier-trust-registry, contracts/SupplierRegistry-v3.sol.
const SUPPLIER_IFACE = new ethers.Interface([
"function mintRegistry(string label)",
"function defineSchema(bytes32 tokenId, string[] paramNames, int256 minValue, int256 maxValue)",
"function addSupplier(bytes32 tokenId, bytes32 nameHash, string nameUri, bool isNamePublic)",
"function addEvaluation(bytes32 tokenId, uint256 supplierId, uint256 schemaVersion, bytes32 contentHash, string uri, bool isPublic, uint256 supersedes)",
"function discloseEvaluation(bytes32 tokenId, uint256 supplierId, uint256 evaluationId, string disclosureUri, bytes32 disclosureHash)",
"function proposeSuccessor(bytes32 oldTokenId, bytes32 newTokenId)",
"function confirmSuccessor(bytes32 newTokenId, bytes32 oldTokenId)",
"function setRegistryImage(bytes32 tokenId, string uri, bytes32 hash)",
"function addMembershipContract(address membershipContract)",
"function removeMembershipContract(address membershipContract)",
"function setTierLimits(address membershipContract, uint8 tier, uint256 maxSuppliers, uint256 maxParams, bool canDiscloseSelectively, uint256 maxRegistries, bool canCustomizeImage)",
"function tokenOwnerOf(bytes32 tokenId) view returns (address)",
"function owner() view returns (address)",
]);
const TRACE_FACTORY = { 42: "0x54c3a7c31c4eca1f1997f5e6f19197f3a82b88a3" };
const TRACE_FACTORY_IFACE = new ethers.Interface([
"function deployRegistry(string name_, string symbol_)",
"function setSector(address account, bytes32 sector)",
"function setMembershipCorporate(address newMembershipCorporate)",
"function isRegistry(address) view returns (bool)",
]);
const TRACE_IFACE = new ethers.Interface([
"function mintRawMaterialLot(bytes32 tokenId, bytes lsp4MetadataValue, uint256 indexDate)",
"function mintRawMaterialLotBatch(bytes32[] tokenIds, bytes[] lsp4MetadataValues, uint256[] indexDates)",
"function mintProductionBatch(bytes32 tokenId, bytes lsp4MetadataValue, bytes32[] usedLotTokenIds, uint256 indexDate)",
"function invalidateEntry(bytes32 tokenId, string reason)",
"function setDocumentHash(bytes32 tokenId, bytes32 documentHash)",
"function setDocumentHashBatch(bytes32[] tokenIds, bytes32 documentHash)",
"function correctDocumentHash(bytes32 tokenId, bytes32 newHash, string reason)",
"function addDelegate(address delegate)",
"function removeDelegate(address delegate)",
"function setRegistryMetadata(bytes lsp4MetadataValue)",
"function setRegistryAdmin(address newAdmin)",
"function setMembershipCorporate(address newMembershipCorporate)",
"function registryAdmin() view returns (address)",
"function delegates(address) view returns (bool)",
"function owner() view returns (address)",
"function getData(bytes32) view returns (bytes)",
]);
// hup.social poll vote: the function's name is not known (the contract is not verified), only its selector
// and its layout, read from a vote sent from hup.social on LUKSO: the voter (the UP), the content holding the
// poll, the option counted from 0 (the sixth option was 5), then bytes (empty). Recognised by the selector,
// and only at hup.social's addresses.
const HUP_VOTE_SELECTOR = "0x57941004";
const HUP_VOTE_TYPES = ["address", "uint256", "uint256", "bytes"];
const HUP_IFACE = new ethers.Interface([
"function create(address creator, uint8 cType, string metadata, uint256 parentId, bool allowedComments)",
// Editing a post: selector 0x34c31991, seen on hup.social on LUKSO (the UP, the post, its new metadata, comments).
"function update(address creator, uint256 contentId, string metadata, bool allowedComments)",
"function batchLike(address user, uint256[] contentIds)",
"function batchUnlike(address user, uint256[] contentIds)",
]);
// "0x… (Name)" when the address is a known contract with code on this network, else the bare address.
async function labelAddress(provider, addr, chainId = null) {
const d = chainId !== null ? DAPP_CONTRACTS[`${chainId}:${String(addr).toLowerCase()}`] : null;
const k = KNOWN_CONTRACTS[String(addr).toLowerCase()] || (d ? { name: d } : null);
// Otherwise, a contract is named as the network's explorer names it (abi-decode.js, where an explorer is
// enabled). Plain accounts are not looked up there.
if (!k) {
if (chainId === null || !window.AbiDecode) return String(addr);
try {
if ((await provider.getCode(addr)) === "0x") return String(addr);
const x = await AbiDecode.labelOf(chainId, addr);
return x ? `${addr} (${x.short})` : String(addr);
} catch (e) { return String(addr); }
}
try { return (await provider.getCode(addr)) !== "0x" ? `${addr} (${k.name})` : String(addr); } catch (e) { return String(addr); }
}
// LSP17 extension data key: bytes10 prefix + 0x0000 + function selector + zero padding.
const LSP17_KEY = (selector) => "0xcee78b4094da860110960000" + selector.slice(2) + "00".repeat(16);
// Receiver hooks called by "safe" ERC-721 / ERC-1155 transfers: a UP answers them only through an LSP17 extension.
const NFT_HOOKS = { erc721: ["0x150b7a02"], erc1155: ["0xf23a6e61", "0xbc197c81"] };
// Calls the page can decode. Anything else is shown as raw data with a warning.
const KNOWN_IFACE = new ethers.Interface([
"function transfer(address to, uint256 amount)",
"function approve(address spender, uint256 amount)",
"function transferFrom(address from, address to, uint256 amount)",
"function increaseAllowance(address spender, uint256 addedValue)",
"function setApprovalForAll(address operator, bool approved)",
"function safeTransferFrom(address from, address to, uint256 tokenId)",
"function safeTransferFrom(address from, address to, uint256 tokenId, bytes data)",
"function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data)",
"function approve(address token, address spender, uint160 amount, uint48 expiration)",
"function transfer(address from, address to, uint256 amount, bool force, bytes data)",
"function authorizeOperator(address operator, uint256 amount, bytes operatorNotificationData)",
"function transfer(address from, address to, bytes32 tokenId, bool force, bytes data)",
"function authorizeOperator(address operator, bytes32 tokenId, bytes operatorNotificationData)",
"function deposit() payable",
"function withdraw(uint256 amount)",
]);
// ERC-4626 tokenized vaults (Morpho vaults among them): deposit an asset, get vault shares, and back.
// Recognised only when the target answers asset() with a contract: the selectors alone are not enough.
const VAULT_IFACE = new ethers.Interface([
"function deposit(uint256 assets, address receiver)",
"function mint(uint256 shares, address receiver)",
"function withdraw(uint256 assets, address receiver, address owner)",
"function redeem(uint256 shares, address receiver, address owner)",
]);
const VAULT_READ = [
"function asset() view returns (address)", "function name() view returns (string)", "function symbol() view returns (string)",
"function decimals() view returns (uint8)", "function previewDeposit(uint256) view returns (uint256)",
"function previewMint(uint256) view returns (uint256)", "function previewWithdraw(uint256) view returns (uint256)",
"function previewRedeem(uint256) view returns (uint256)",
];
// LSP6 errors, to explain why a simulation fails.
const KM_ERRORS = new ethers.Interface([
"error NotAuthorised(address from, string permission)",
"error NoPermissionsSet(address from)",
"error NoCallsAllowed(address from)",
"error NotAllowedCall(address from, address to, bytes4 selector)",
"error InvalidEncodedAllowedCalls(bytes allowedCallsValue)",
]);
const UP_IFACE = new ethers.Interface(["function execute(uint256 operationType, address target, uint256 value, bytes data) payable returns (bytes)"]);
const KM_IFACE = new ethers.Interface(["function execute(bytes payload) payable returns (bytes)"]);
// The signing window of the browser extension and of the app (sign-plan.js) decodes by itself only the token
// calls; for the other calls of a request it asks this page which function each selector is: the page's own
// decoders, then the verified ABI of the called contract (abi-decode.js). The window uses a signature only if
// its selector is the call's and it decodes the call data exactly; it shows the function's name and arguments,
// and warns from what they say. A signature is given here only when it decodes the call too.
// req: the request for the window ({ kind: "tx", tx } or { kind: "userop", op, chainId }, with up). Returns
// { selector: "function name(type name, ...)" }, at most 64.
const BATCH_IFACE = new ethers.Interface(["function executeBatch(uint256[] operationsType, address[] targets, uint256[] values, bytes[] datas) payable returns (bytes[])"]);
window.__upwalletSignatureHints = async function signatureHints(req) {
const calls = [];
const up = req && typeof req.up === "string" && ethers.isAddress(req.up) ? ethers.getAddress(req.up) : null;
const ofUp = (data, depth) => {
let d = null;
try { d = UP_IFACE.parseTransaction({ data }) || BATCH_IFACE.parseTransaction({ data }); } catch (e) { return false; }
if (!d) return false;
if (d.name === "execute") add(d.args[1], d.args[3], depth + 1);
else d.args[1].forEach((to, i) => add(to, d.args[3][i], depth + 1));
return true;
};
const add = (to, data, depth) => {
if (depth > 3 || calls.length >= 64 || !to || typeof data !== "string" || !ethers.isHexString(data) || ethers.dataLength(data) < 4) return;
if (up && ethers.getAddress(to) === up && ofUp(data, depth)) return; // LSP20: the UP calling itself
calls.push({ to: ethers.getAddress(to), data });
};
if (req && req.kind === "tx" && req.tx) {
let done = false;
try { const k = KM_IFACE.parseTransaction({ data: req.tx.data }); if (k) done = ofUp(k.args[0], 0); } catch (e) { /* not the Key Manager */ }
if (!done && req.tx.to) add(req.tx.to, req.tx.data, 0);
} else if (req && req.kind === "userop" && req.op) ofUp(req.op.callData, 0);
const chainId = Number(req && (req.kind === "tx" ? req.tx && req.tx.chainId : req.chainId));
const known = {};
const learn = (frags) => {
for (const f of frags) {
try { const g = ethers.FunctionFragment.from(f); if (!(g.selector in known)) known[g.selector] = g; } catch (e) { /* not a function */ }
}
};
const fns = (i) => i.fragments.filter((f) => f.type === "function");
const hints = {};
// Only when the signature decodes this call: the selector, then the arguments encoded again are the data.
const fits = (g, data) => {
try {
const args = ethers.AbiCoder.defaultAbiCoder().decode(g.inputs, ethers.dataSlice(data, 4));
return data.toLowerCase().startsWith((g.selector + ethers.AbiCoder.defaultAbiCoder().encode(g.inputs, args).slice(2)).toLowerCase());
} catch (e) { return false; }
};
for (const { to, data } of calls) {
const s = ethers.dataSlice(data, 0, 4);
if (s in hints) continue;
// The called contract's verified ABI first (it is this contract's), then the page's decoders.
let g = null;
if (window.AbiDecode && AbiDecode.functionsOf && chainId) {
const abi = await Promise.race([AbiDecode.functionsOf(chainId, to).catch(() => null), new Promise((r) => setTimeout(() => r(null), 4000))]);
for (const f of abi || []) { try { const x = ethers.FunctionFragment.from(f); if (x.selector === s) { g = x; break; } } catch (e) { /* skip */ } }
}
if (!g) {
if (!Object.keys(known).length) {
for (const i of [KNOWN_IFACE, VAULT_IFACE, MORPHO_BUNDLES_IFACE, LSP26_IFACE, SUPPLIER_IFACE, TRACE_FACTORY_IFACE, TRACE_IFACE, HUP_IFACE, AVAX_DEFI_IFACE, SEND_IFACE, POS_IFACE]) learn(fns(i));
if (window.CallDecode && CallDecode.signatures) learn(CallDecode.signatures().map((x) => "function " + x));
}
g = known[s] || null;
}
if (g && fits(g, data)) hints[s] = g.format("full");
if (Object.keys(hints).length >= 64) break;
}
return hints;
};
// ==================== I18N ====================
// Language: the one chosen before on this browser or app, else the browser's or phone's own (Italian for
// Italian, English for anything else).
const LANG_KEY = "upwallet.lang";
let LANG = (() => {
try { const v = localStorage.getItem(LANG_KEY); if (v === "it" || v === "en") return v; } catch (e) { /* none stored */ }
return /^it\b/i.test(navigator.language || "") ? "it" : "en";
})();
const I18N = {
it: {
pageTitle: "UP Wallet — ChainIntegrate",
h1: "UP Wallet (sperimentale)",
subtitle: "Il wallet della tua Universal Profile su LUKSO e su ogni rete dove l'hai rideployata, con lo stesso indirizzo: vedi e invii i tuoi asset, usi le dApp con WalletConnect. Firmi con MetaMask.",
langToggleBtn: "English",
panel0Title: "0 · Cos'è e come funziona",
panel0Note: "<b>Cos'è.</b> UP Wallet è il portafoglio della tua Universal Profile su <b>tutte le reti dove la UP esiste</b>: LUKSO e le reti dove l'hai rideployata con questo sito (Base, Polygon, Arbitrum, Avalanche, Arc…), con lo <b>stesso indirizzo</b> ovunque. Fa quello che su LUKSO fanno l'estensione e l'app UP, anche sulle altre reti, dove quelle non arrivano.<ul style=\"margin:8px 0; padding-left:20px;\"><li><b>Vedi cosa possiede la UP</b> e <b>invii</b> valuta, token e NFT (pannello 6), anche a una UP cercata per nome.</li><li><b>Usi le dApp</b> che si collegano con WalletConnect (OpenSea, Uniswap, hup.social…): la dApp vede la tua UP come account, e quello che compri o ricevi arriva alla UP. Quasi tutte funzionano; qualcuna non accetta un account smart contract come la UP.</li><li><b>Il gas</b> lo paga il tuo controller, oppure il sito, sulle reti e per i profili dove il gas pagato dal sito è attivo.</li></ul><b>Cosa ti serve.</b> L'indirizzo della UP, <b>MetaMask con il controller della UP</b> (la chiave che firma per la UP: la guida spiega come importarla) e la UP già presente sulla rete scelta. Si lavora su una rete alla volta. Sul telefono c'è l'app Android, sul computer l'estensione del browser: firmano con una chiave propria, senza MetaMask.<br><b>Rispetto all'estensione UP.</b> Firmi in MetaMask invece che nell'estensione. Prima di ogni firma la pagina ti mostra in chiaro cosa stai facendo, controlla e simula. È sperimentale: parti con la modalità simulazione e con importi piccoli.<details style=\"margin-top:8px;\"><summary>Come funziona sotto</summary>Questa pagina fa da <b>ponte WalletConnect</b> tra una dApp e la tua UP. La dApp vede come account l'indirizzo della UP. Ogni <b>transazione</b> viene incapsulata in <code>KeyManager.execute(UP.execute(...))</code> e firmata dal tuo controller in MetaMask: la chiamata parte dalla UP e il valore esce dal saldo della UP, il gas lo paga il controller. Ogni <b>firma di messaggio</b> la fa il controller e la UP la riconosce come propria (ERC-1271). Prima di tutto la pagina verifica che UP e controller siano compatibili sulla rete scelta. Ogni richiesta viene mostrata per intero, controllata e (per le transazioni) simulata; niente parte senza il tuo clic e la tua conferma in MetaMask.</details>",
disclaimer: "<b>⚠️ Leggi prima di usare questa pagina</b><ul style=\"margin:8px 0 0; padding-left:20px;\"><li><b>Strumento sperimentale, non sottoposto ad audit.</b> Può contenere errori.</li><li><b>Transazioni reali e irreversibili.</b> Nessuno può annullare una transazione confermata. Usa importi minimi e parti sempre in modalità simulazione.</li><li><b>La pagina non conosce le dApp.</b> Decodifica solo una parte delle chiamate (token standard e casi comuni); per il resto ti mostra i dati grezzi. Se non capisci cosa fa una richiesta, <b>rifiutala</b>.</li><li><b>Firme di messaggi.</b> Una firma può autorizzare azioni anche senza transazione: accessi, ordini, permessi a spendere token. La pagina mostra il contenuto e l'esito dei controlli, ma non può sapere a cosa servirà la firma.</li><li><b>Le approvazioni di token restano valide</b> anche dopo aver chiuso la pagina: chi le riceve può spostare i token della UP finché non le revochi.</li><li><b>Responsabilità.</b> ChainIntegrate non si assume alcuna responsabilità per firme o transazioni approvate su contenuto poco chiaro, né per l'uso che le dApp ne fanno. Il software è fornito \"così com'è\" (licenza MIT), senza garanzie: lo usi a tuo rischio.</li><li><b>Da cosa dipende la sicurezza:</b> dall'architettura (firmi sempre tu nel tuo wallet, i permessi li applica il Key Manager della UP) e dai servizi usati (la verifica del dominio di WalletConnect/Reown, gli RPC della rete). La pagina mostra l'esito di queste verifiche ma non può garantirle.</li><li><b>Un controller per ogni UP.</b> Se lo stesso controller governa più UP, una firma valida per questa UP vale anche per le altre.</li><li><b>Questa pagina non chiede mai chiavi private</b> né seed phrase.</li><li><b>Privacy:</b> la connessione WalletConnect passa dai server di Reown, che vedono i metadati della sessione (indirizzi, rete). Le verifiche usano l'RPC pubblico della rete scelta.</li><li><b>Nessuna affiliazione</b> con LUKSO, WalletConnect/Reown, MetaMask o le dApp che colleghi. Non è una consulenza finanziaria.</li></ul><div style=\"margin-top:8px;\">Sempre rifiutati: <code>eth_sign</code> e i formati di firma vecchi, la creazione di contratti, le transazioni della UP verso se stessa o verso il proprio Key Manager (potrebbero cambiarne controller e permessi), le richieste su una rete diversa da quella scelta.</div>",
ackLabel: "Ho letto e accetto: uso questo strumento a mio rischio.",
setupBanner: "Per iniziare imposta rete, UP e MetaMask: tre passi.",
setupGoBtn: "Configura",
tileSend: "Invia", tileSendSub: "Valuta, token e NFT dalla UP",
tileOverview: "Tutte le reti", tileOverviewSub: "Cosa possiede la UP su ogni rete",
panelOverviewTitle: "Tutte le reti",
overviewNote: "Cosa possiede la UP su ogni rete principale dove esiste, letto dalle reti e dagli indici (Alchemy o Blockscout), in sola lettura. Il valore in dollari è una stima: c'è solo per la valuta della rete (prezzo Chainlink), per l'USDC nativo di Circle e per gli euro digitali EURe ed EURC (cambio EUR/USD di Chainlink); gli altri token sono elencati senza prezzo e non entrano nel totale. I token segnalati come spam non sono contati.",
ovRefresh: "Aggiorna", ovNoUp: "Imposta la UP nelle Impostazioni.",
ovReading: (v) => `Lettura delle reti: ${v.done} di ${v.total}…`,
ovTotal: (v) => `≈ ${v.usd} USD`, ovTotalLabel: "Totale stimato (valuta delle reti, USDC e stablecoin in euro)",
ovReadAt: (v) => `Letto alle ${v.time}. Per rileggere: Aggiorna.`,
ovNoPrice: "senza prezzo", ovNftCount: (v) => `${v.count} NFT`, ovNative: "valuta della rete",
ovSpam: (v) => `${v.n} segnalati come spam, non contati`,
ovIxFail: (v) => `Indice ${v.ix} non disponibile (${v.err}): mancano i token che solo lui elenca.`,
ovIxSrc: (v) => `Altri token letti da ${v.ix}.`,
ovNftFail: (v) => `NFT non letti (${v.err}): riprova con Aggiorna.`,
ixFallback: (v) => `Alchemy non ha risposto (${v.err}): gli altri token sono letti da Blockscout, che può elencarne meno.`,
ovNothing: (v) => `Niente su: ${v.list}.`, ovAbsent: (v) => `La UP non esiste su: ${v.list}.`,
ovFailed: (v) => `Non lette: ${v.list}. Riprova con Aggiorna.`,
ovUnpriced: "contiene anche token senza prezzo",
ovAToken: (v) => `deposito Aave v3 di ${v.amount} ${v.sym}`, ovVault: (v) => `quote di un vault, valgono ≈ ${v.amount} ${v.sym}`,
ovSpoke: "deposito Aave v4 (pro.aave.com), non è un token nella UP",
ovImgAsk: "Immagine su un server esterno: toccala per caricarla. Quel server vedrà il tuo indirizzo IP e quando guardi questa UP.",
tileReceive: "Ricevi", tileReceiveSub: "Indirizzo e QR della UP",
tileDapp: "Collega una dApp", tileDappSub: "Usa una dApp con la UP (WalletConnect)",
tileActivity: "Attività", tileActivitySub: "Richieste, simulazione e messaggi",
tileSettings: "Impostazioni", tileSettingsSub: "Rete, UP, MetaMask, gas",
tileHelp: "Cos'è e come funziona", tileHelpSub: "Cosa fa il wallet, avvertenze",
backBtn: "← Menu",
viewTitle_home: "", viewTitle_all: "", viewTitle_send: "Invia", viewTitle_receive: "Ricevi", viewTitle_overview: "Tutte le reti", viewTitle_dapp: "Collega una dApp",
viewTitle_activity: "Attività", viewTitle_settings: "Impostazioni", viewTitle_help: "Cos'è e come funziona",
netMoreSummary: "Altre reti e RPC personalizzato",
netPresenceChecking: "Controllo su quali reti esiste la UP…",
netPresenceNote: "Bollino verde: la UP esiste su quella rete. Grigio: non c'è, o la rete non ha risposto.",
netUpHere: "La UP esiste su questa rete", netUpNotHere: "La UP non esiste su questa rete", netUpUnknown: "La rete non ha risposto",
panelViewTitle: "Vista",
viewAllLabel: "Vista completa: tutti i pannelli in una pagina",
viewAllNote: "Per chi preferisce la pagina classica, con tutti i pannelli uno sotto l'altro. Togli la spunta per tornare al menù.",
panelReceiveTitle: "Ricevi",
receiveNote: "Mostra il QR o manda il link a chi deve inviarti qualcosa. L'indirizzo della UP è lo stesso su ogni rete, ma chi invia deve usare una rete dove la UP esiste: altrimenti i fondi arrivano a un indirizzo che lì non controlli.",
receiveCopyBtn: "Copia l'indirizzo", receiveShareBtn: "Condividi il link", receiveCopied: "Copiato",
receiveNoUp: "Imposta prima la UP (Impostazioni).",
receiveNetLine: (v) => `Rete: ${v.net}. Il QR indica anche la rete (chainId ${v.id}) al wallet che lo legge.`,
receiveAbsent: (v) => `⚠️ Su ${v.net} questa UP non esiste: non farti mandare fondi su questa rete.`,
receiveShareText: "Il mio Universal Profile",
cardNoUp: "UP non impostata", cardReady: "pronta", cardNotReady: "da configurare", cardSim: "🧪 simulazione", cardNotHere: "la UP qui non esiste",
decodeIntro: "La pagina non conosce questa chiamata. Per farla riconoscere in una prossima versione: copia i dati, oppure mandali per e-mail a ChainIntegrate (si apre la tua app di posta, decidi tu se inviare). Aggiungi cosa stavi facendo sul sito.",
decodeCopyBtn: "Copia i dati", decodeMailBtn: "Invia per e-mail",
decodeHead: "UP Wallet: chiamata non riconosciuta", decodeContract: "Contratto", decodeSelector: "Selettore", decodeData: "Dati",
decodeDoing: "Cosa stavo facendo sul sito: ",
decodeCut: "(tagliati: usa \"Copia i dati\" per averli interi)",
decodePasteHint: "(Se i dati qui sotto risultano tagliati, cancellali e incolla qui il testo completo con Ctrl+V o \"Incolla\": UP Wallet l'ha già copiato.)",
decodeSubject: (v) => `UP Wallet: chiamata da decodificare ${v.sel} su ${v.net}`,
decodePrivacy: "Nota: i dati della chiamata possono contenere l'indirizzo della tua UP o altri indirizzi. Se la transazione viene inviata diventano comunque pubblici sulla rete.",
cardReal: "⚡ invio reale", simChipTitle: "Tocca per cambiare la modalità simulazione",
gasChipSite: "⛽ gas: sito", gasChipCtl: "⛽ gas: controller", gasChipTitle: "Tocca per scegliere chi paga il gas",
gasTitle: "⛽ Chi paga il gas", gasToggleLabel: "Paga il gas con il relayer del sito",
gasNoteNone: "Su questa rete, per questa UP, il relayer del sito non è disponibile: il gas lo paga il controller (l'account MetaMask che firma).",
gasNoteNotReady: "La UP è sulla lista del relayer del sito, ma manca qualcosa: vedi la nota nelle Impostazioni (opzione del relayer). Finché non è pronta, il gas lo paga il controller.",
gasNoteOff: "Opzione spenta: il gas lo paga il controller (l'account MetaMask che firma).",
simTitle: "🧪 Modalità simulazione", simCloseBtn: "Fatto",
upChip: "⇄ UP", upsTitle: "⇄ Le tue UP", upsAddLabel: "Aggiungi una UP: indirizzo o nome", upsCurrent: "in uso", upsUse: "Usa", upsRemove: "Togli",
upsEmpty: "Nessuna UP salvata: aggiungine una qui sotto.", upsAddBtn: "Aggiungi", upsBad: "Indirizzo non valido.", upsSearching: "Ricerca…", upsNone: "Nessun profilo con questo nome.",
upsNote: "L'elenco resta su questo dispositivo: solo gli indirizzi, niente va al server. Per firmare per una UP, il controller che usi deve essere suo controller su quella rete: per ogni UP, autorizzalo dalla pagina Backup.",
upsSwitchAsk: (v) => `Passare a ${v.label}? ${v.n ? `Le ${v.n} sessioni WalletConnect aperte si chiudono: ogni dApp è collegata a una UP precisa.` : ""}${v.req ? " La richiesta in attesa viene rifiutata." : ""}`,
upsSwitched: (v) => `⇄ UP in uso: ${v.label}.`,
simOffWarn: "Spunta tolta: dopo la tua conferma in MetaMask le transazioni partono davvero e sono irreversibili. Usa importi piccoli.",
sendClearBtn: "Pulisci",
fabMenu: "Torna al menù", fabTop: "Torna in cima",
riskTitle: "⚠️ Prima di iniziare",
riskOkBtn: "Continua",
riskLaterBtn: "Non ora",
riskReopenBtn: "Leggi le avvertenze",
riskAccepted: "✅ Avvertenze accettate.",
riskPending: "⚠️ Avvertenze non ancora accettate: finché non le accetti la pagina non collega dApp e non invia nulla.",
logTitle: "Messaggi",
logAll: (v) => `Mostra tutti (${v.n})`,
logLast: "Solo l'ultimo",
ackRequired: "Prima accetta le avvertenze (pannello 0, \"Leggi le avvertenze\").",
panel1Title: "1 · Rete",
panel1Note: "La rete su cui la UP è deployata e su cui vuoi usare la dApp. Una rete alla volta: cambiarla chiude le sessioni WalletConnect attive.",
networkFilterPlaceholder: "Filtra per nome... (es. base, polygon, arbitrum)",
customRpcLabel: "RPC URL custom",
customExplorerLabel: "Explorer URL custom (opzionale)",
customNetName: "Rete custom",
panel2Title: "2 · La tua UP",
connectUpBtn: "Leggi l'indirizzo dall'estensione UP",
upAddressLabel: "Indirizzo o nome della UP",
panel3Title: "3 · Controller (MetaMask) e verifica",
panel3Note: "MetaMask con la chiave del controller della UP, sulla rete scelta. Paga il gas: deve avere un po' della moneta della rete. La verifica di compatibilità tra UP e controller parte da sola e si ripete se cambi rete, UP, account o rete in MetaMask.",
connectSignerBtn: "Connetti MetaMask (controller)",
complianceIdle: "La verifica parte da sola quando rete, UP e MetaMask sono impostati.",
recheckBtn: "Ricontrolla",
panelSendTitle: "6 · Invia dalla UP",
panelSendNote: "Invia dalla UP la valuta della rete, un token (ERC-20 o LSP7) o un NFT (LSP8, ERC-721 o ERC-1155), senza dApp. L'invio segue lo stesso percorso delle richieste delle dApp: lo vedi nella finestra di conferma, viene simulato, il gas lo paga il relayer del sito dove l'opzione è attiva (pannello 3), altrimenti il controller, e firmi in MetaMask. Con <b>Solo simulazione</b> attivo (pannello 5) viene solo simulato; il registro dell'invio è nel pannello 5. Tocca una riga dei saldi per sceglierla.",
sendAssetLabel: "Cosa inviare", sendAssetNative: "La valuta della rete", sendAssetToken: "Un token o un NFT: incolla l'indirizzo del contratto",
sendIdLabel: "ID del token (NFT)", sendCopiesLabel: "Numero di copie (ERC-1155)", sendMaxBtn: "Tutto",
sendMaxNoToken: "Per \"Tutto\" scegli prima un token (o per un ERC-1155 l'ID del token).",
sendAfterBalance: (v) => `Dopo l'invio la UP ha ${v.have} ${v.sym} (attesi ${v.want}).`,
sendAfterBalanceOff: "Il saldo letto ora non è quello atteso: può arrivare altro sulla UP nel frattempo, o l'RPC può essere indietro di qualche secondo. Controlla sull'explorer.",
sendAfterNftOk: "✅ Verificato sulla catena: il token ora appartiene al destinatario.",
sendAfterNftWarn: (v) => `⚠️ Il proprietario del token letto ora è ${v.owner}, non il destinatario (l'RPC può essere indietro di qualche secondo). Controlla sull'explorer.`,
sendNftRecipientHint: "Il destinatario è un contratto: se è una Universal Profile su una rete diversa da LUKSO, potrebbe non accettare ancora NFT ERC-721 / ERC-1155. La ricezione si abilita con la pagina Ricezione NFT (up-nft-receiver.html).",
sendNftOk: (v) => `${v.kind} · ${v.name}: scegli l'ID del token da inviare.`,
sendIdsHeld: "ID della UP (tocca per sceglierlo):",
sendBadId: "❌ ID del token non valido: un numero, oppure 0x seguito da 64 cifre esadecimali (LSP8).",
sendBadCopies: "❌ Numero di copie non valido: un numero intero maggiore di zero.",
sendNotOwner: (v) => `❌ La UP non possiede il token ${v.id} (proprietario: ${v.owner}).`,
sendNoCopies: (v) => `❌ La UP ha ${v.have} copie del token ${v.id}, ne servono ${v.need}.`,
sendNftOwned: "La UP possiede il token: verificato sulla catena.",
sendSafeNote: "Trasferimento con safeTransferFrom: se il destinatario è un contratto che non accetta NFT, la transazione fallisce (la simulazione lo mostra) invece di bloccarlo lì.",
sendTokenLabel: "Indirizzo del token", sendToLabel: "Destinatario",
sendToPlaceholder: "0x… oppure il nome di una Universal Profile",
nameSearching: "Ricerca del nome nell'indice dei profili di LUKSO…",
nameNone: "Nessun profilo con questo nome nell'indice di LUKSO.",
nameFail: (v) => `Ricerca non riuscita (${v.err}): scrivi l'indirizzo 0x.`,
contactsBtn: "📇 Contatti", contactSaveBtn: "Salva come contatto",
ctEmpty: "Nessun contatto salvato. Scrivi o incolla un indirizzo nel destinatario, poi \"Salva come contatto\".",
ctIntro: "Contatti salvati solo su questo dispositivo, mai inviati altrove. Tocca un contatto per usarlo come destinatario.",
ctOnly: (v) => `solo ${v.nets}`,
ctName: "Nome del contatto", ctNamePh: "es. Mario · Bleap",
ctOnlyHere: (v) => `Solo su ${v.net}`,
ctSave: "Salva", ctCancel: "Annulla", ctRename: "✏️", ctDelete: "🗑",
ctRenameTitle: "Rinomina", ctDeleteTitle: "Elimina",
ctExport: "Esporta (copia)", ctImport: "Importa…", ctImportGo: "Importa questi contatti",
ctImportPh: "Incolla qui l'elenco esportato da un altro dispositivo",
ctExported: "✅ Elenco copiato negli appunti (è anche qui sotto): incollalo in \"Importa\" sull'altro dispositivo.",
ctBadName: "❌ Scrivi un nome (al massimo 40 caratteri).",
ctBadImport: "❌ Il testo non è un elenco di contatti esportato da UP Wallet.",
ctImportAsk: (v) => `Importare ${v.n} contatti? Quelli con un indirizzo già salvato restano come sono.`,
ctImported: (v) => `✅ Importati ${v.n} contatti (${v.skip} già presenti).`,
ctSaveAsk: (v) => `Salvare ${v.addr} come "${v.name}"? Controlla prima l'indirizzo carattere per carattere con chi te lo ha dato.`,
ctRenameAsk: (v) => `Rinominare "${v.old}" in "${v.name}"?`,
ctDeleteAsk: (v) => `Eliminare il contatto "${v.name}" (${v.addr})?`,
ctFull: "❌ La rubrica è piena (200 contatti).",
ctIs: (v) => `📇 Contatto: ${v.name}.`,
ctOtherNet: (v) => `⚠️ Il contatto "${v.name}" è salvato solo per ${v.nets}, non per ${v.net}: controlla che il destinatario usi davvero questa rete.`,
ctLookalike: (v) => `🛑 Questo indirizzo assomiglia al contatto "${v.name}" (${v.addr}) ma è DIVERSO: stessi caratteri all'inizio e alla fine, il resto no. È il trucco dell'address poisoning: un indirizzo finto copiato dalla cronologia. Non inviare: usa il contatto dalla rubrica.`,
namePicked: (v) => `Scelto: ${v.label} — ${v.addr}. Il nome viene dall'indice di LUKSO e non è unico: chiunque può chiamarsi così. Conta solo l'indirizzo: confrontalo con quello che ti ha dato il destinatario.`,
nameUpHere: "✅ Su questa rete a questo indirizzo c'è una Universal Profile.",
nameNoUpHere: (v) => `⚠️ Su ${v.net} questa Universal Profile non esiste (ancora): l'indirizzo è lo stesso su ogni rete, ma il proprietario non l'ha creata qui. La valuta della rete arriverebbe comunque, ma la potrebbe usare solo ricreando la UP su ${v.net}; i token LSP7 verrebbero rifiutati.`,
nameOtherHere: (v) => `⚠️ Su ${v.net} a questo indirizzo c'è un contratto che non risulta una Universal Profile.`, sendAmountLabel: "Importo", sendPrepareBtn: "Prepara l'invio",
sendReading: "Lettura del token…",
sendTokenOk: (v) => `${v.kind} · ${v.name} · la UP ha ${v.balance} ${v.symbol}`,
sendStart: (v) => `Invio dalla UP: ${v.what} a ${v.to}`,
sendBadRecipient: "❌ Destinatario non valido: scrivi un indirizzo 0x di 40 caratteri esadecimali, oppure cerca un nome e scegli un profilo dall'elenco.",
sendZeroRecipient: "❌ Il destinatario è l'indirizzo zero: i fondi andrebbero persi.",
sendSelfRecipient: "❌ Il destinatario è la UP stessa o il suo Key Manager.",
sendSystemRecipient: (v) => `❌ Il destinatario è ${v.name}, un contratto del gas relay: i fondi non tornerebbero indietro.`,
sendBadAmount: "❌ Importo non valido: scrivi un numero maggiore di zero (punto per i decimali).",
sendBadToken: "❌ Indirizzo del token non valido.",
sendTokenIsRecipient: "❌ Il destinatario è il contratto del token stesso.",
sendNotToken: "❌ A questo indirizzo non c'è un token ERC-20, LSP7, LSP8, ERC-721 o ERC-1155 leggibile.",
sendNoTokens: (v) => `❌ La UP ha ${v.have} ${v.symbol}, non ${v.need}.`,
sendContractRecipient: "⚠️ Il destinatario è un contratto: controlla che sia proprio lui a dover ricevere (molti contratti non sanno restituire i fondi).",
sendUpRecipient: "✅ Il destinatario è una Universal Profile (LSP0).",
sendLspForce: "Destinatario senza codice (wallet normale): il trasferimento LSP7/LSP8 usa force = true, necessario per gli indirizzi senza Universal Receiver.",
sendLspNoForce: "Destinatario contratto: il trasferimento LSP7/LSP8 usa force = false, quindi riesce solo se il destinatario implementa LSP1 (per esempio una UP). La simulazione lo verifica.",
localSite: "UP Wallet (invio dalla UP)",
holdIdle: "Il saldo della UP compare quando la verifica del pannello 3 è verde.", holdRefreshBtn: "Aggiorna i saldi",
holdReading: "Lettura dei saldi…",
holdNative: "valuta della rete",
holdNft: (v) => `${v.count} NFT`,
holdNone: "Nessun token trovato oltre alla valuta della rete.",
holdSpam: (v) => `Mostra ${v.n} token segnalati come spam dall'indice`,
holdSpamNote: "Segnalati come spam dall'indice: di solito arrivano senza averli chiesti. Si possono inviare (per esempio per toglierli dalla UP), ma non aprire siti o link scritti nel loro nome.",
sendSpamWarn: "⚠️ Questo token è segnalato come spam dall'indice. Inviarlo è possibile, ma non aprire siti o link scritti nel suo nome o nella sua descrizione: è la truffa tipica di questi token.",
holdGone: (v) => `${v.n} NFT che l'indice ${v.ix} elenca ancora non sono più della UP (verificato sulla blockchain): non sono mostrati.`,
holdSrc: (v) => v.ix ? `Fonti: la blockchain (valuta, token LSP7/LSP8 registrati nella UP) e l'indice ${v.ix} (gli altri token; può essere incompleto).` : "Fonte: la blockchain (valuta, token LSP7/LSP8 registrati nella UP). Su questa rete non c'è un indice per gli altri token: incolla l'indirizzo del token.",
holdIxFail: (v) => `L'indice ${v.ix} non ha risposto (${v.err}): mostrati solo valuta e token registrati nella UP.`,
panel4Title: "4 · Collega una dApp con WalletConnect",
panel4Note: "Sulla dApp scegli di connetterti con <b>WalletConnect</b>, copia il link di connessione (sotto il QR code, inizia con <code>wc:</code>) e incollalo qui. Si attiva solo quando la verifica del pannello 3 è verde. Tieni aperta questa pagina mentre usi la dApp.",
wcUriLabel: "Link WalletConnect (wc:...)",
pairBtn: "Collega",
wcIdle: "Nessuna sessione.",
disconnectBtn: "Disconnetti tutte le sessioni",
panel5Title: "5 · Richieste (dApp e invii)",
simulateOnlyLabel: "Solo simulazione (non inviare nulla)",
simulateOnlyNote: "Con la spunta, le transazioni vengono controllate e simulate, poi alla dApp si risponde che è una simulazione: non si invia e non si spende nulla. Le firme di messaggi non si possono simulare: vengono sempre mostrate e firmate solo se premi \"Firma il messaggio\".",
noRequest: "Nessuna richiesta in attesa.",
sendBtn: "Firma e invia la transazione (irreversibile)",
signBtn: "Firma il messaggio per la UP",
rejectBtn: "Rifiuta la richiesta",
modalSub: "Leggi tutto prima di decidere: controlli, avvisi e dettagli della richiesta. Niente parte senza il tuo clic e la conferma in MetaMask. La richiesta resta anche nello storico della pagina.",
knownSpender: (v) => `ℹ️ Il permesso è per un contratto noto: ${v.addr} (${v.name} — ${v.role}). Controlla comunque token, importo e scadenza.`,
knownContract: (v) => `ℹ️ Destinatario noto: ${v.name} — ${v.role}. Il nome dice chi riceve la chiamata, non cosa fa: controlla importi e rete sul sito.`,
roleWrapped: "token 1:1 della valuta nativa della rete (wrap/unwrap)", roleSwapBridge: "aggregatore di swap e bridge tra reti", roleSwap: "contratto degli swap dell'API 0x", roleMarket: "marketplace di OpenSea", rolePermit2: "gestore delle approvazioni di token", roleLifiPermit2: "contratto di LI.FI che usa le firme Permit2 per swap e bridge",
actionTitleTx: (v) => `Transazione in attesa della tua decisione — ${v.site}`,
actionTitleSign: (v) => `Firma in attesa della tua decisione — ${v.site}`,
// compliance
cNetwork: "Rete", cRpc: "RPC", cWallet: "MetaMask", cUp: "UP", cKm: "Key Manager", cPerms: "Permessi del controller",
cCanCall: "Chiamate a contratti", cCanValue: "Invio di valore", cCanSign: "Firme di messaggi", cNft721: "Ricezione NFT ERC-721", cNft1155: "Ricezione NFT ERC-1155", cUpBal: "Saldo della UP", cGasBal: "Saldo del controller (gas)",
full: "sì", limited: "solo verso le AllowedCalls", none: "no",
rpcOk: (v) => `✅ chainId ${v.id}`,
rpcWrong: (v) => `❌ l'RPC risponde con chainId ${v.id}, atteso ${v.exp}`,
rpcFail: (v) => `❌ RPC non raggiungibile: ${v.err}`,
walletMissing: "❌ non connesso",
walletOk: (v) => `✅ ${v.addr} · chainId ${v.id}`,
walletWrong: (v) => `❌ ${v.addr} è sulla rete con chainId ${v.id}: passa a chainId ${v.exp} in MetaMask`,
switchWalletBtn: (v) => `Passa a ${v.name} in MetaMask`,
switchWalletFail: (v) => `❌ Cambio di rete non riuscito: ${v.err}. Cambia rete a mano in MetaMask.`,
walletUnknown: "❌ impossibile leggere la rete di MetaMask",
upMissing: "❌ indirizzo mancante o non valido",
upNotDeployed: "❌ non deployata su questa rete",
upOk: (v) => `✅ ${v.addr}`,
kmBad: (v) => `❌ l'owner della UP (${v.addr}) non è un contratto su questa rete`,
kmOk: (v) => `✅ ${v.addr}`,
permsNone: "❌ nessuno: questo account non è un controller della UP. Controlla di aver importato in MetaMask la chiave del controller di QUESTA UP.",
permsList: (v) => `${v.hex} · ${v.names}`,
nftYes: (v) => `sì (estensione ${v.ext})`,
nftNoExt: "no: la UP non ha un'estensione per ricevere questi NFT. Gli acquisti e i trasferimenti \"sicuri\" verso la UP falliranno (per esempio su OpenSea). Token ERC-20 e moneta della rete funzionano. Per abilitarla usa la pagina «Ricezione NFT sulla UP» (up-nft-receiver.html).",
nftNoCode: (v) => `no: l'estensione registrata (${v.ext}) non ha codice su questa rete. Gli acquisti e i trasferimenti \"sicuri\" verso la UP falliranno. Vedi la pagina «Ricezione NFT sulla UP» (up-nft-receiver.html).`,
gasLow: (v) => `⚠️ ${v.bal}: senza moneta della rete il controller non può pagare il gas`,
verdictOk: "✅ UP e controller compatibili su questa rete: puoi collegare una dApp.",
verdictPrivileged: "ℹ️ Questo controller ha anche permessi di amministrazione della UP (controller e permessi): proteggi bene la sua chiave.",
verdict4337Only: "ℹ️ Questo controller ha il permesso 4337: una sua firma basta ad autorizzare operazioni della UP (con il gas pagato dal sito). Non può gestire controller o permessi, ma può muovere i fondi: proteggi bene la sua chiave.",
verdictNoUse: "❌ Il controller non ha permessi utili per le dApp (né chiamate, né invio di valore, né firme).",
verdictFail: "❌ Verifica non superata: correggi il punto in rosso qui sopra. Il collegamento a una dApp resta disattivato.",
verdictMissing: "Completa i campi mancanti: la verifica ripartirà da sola.",
complianceRunning: "Verifica in corso...",
// WalletConnect
extNotFound: "Estensione Universal Profile non trovata.",
connectionRejected: "Connessione rifiutata o fallita.",
noSignerFound: "Nessun wallet firmatario trovato (es. MetaMask).",
noProjectId: "Manca il Project ID di WalletConnect: sul server va creato il file config.js (vedi config.example.js).",
invalidUri: "Il link deve iniziare con wc:",
complianceFirst: "Prima la verifica del pannello 3 deve essere verde.",
pairing: "Collegamento in corso... conferma sulla dApp se richiesto.",
proposalFrom: (v) => `Richiesta di connessione da: ${v.name} (${v.url}) — verifica del dominio: ${v.verify}`,