-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.html
More file actions
1082 lines (942 loc) · 37.1 KB
/
Copy pathdocs.html
File metadata and controls
1082 lines (942 loc) · 37.1 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="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Magic Money Wallet Docs | ChainLens</title>
<link rel="icon" href="/favicon/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<link rel="manifest" href="/favicon/site.webmanifest">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;700&family=Syne:wght@700;800&display=swap" rel="stylesheet">
<style>
:root {
color-scheme: dark;
--bg: #020617;
--panel: rgba(15, 23, 42, 0.78);
--panel-strong: #0f172a;
--line: rgba(148, 163, 184, 0.22);
--text: #f8fafc;
--muted: #94a3b8;
--soft: #cbd5e1;
--cyan: #22d3ee;
--blue: #3b82f6;
--emerald: #34d399;
--amber: #fbbf24;
--rose: #fb7185;
--code: #050816;
--shadow: 0 24px 90px rgba(0, 0, 0, 0.36);
}
[data-theme="light"] {
color-scheme: light;
--bg: #f8fafc;
--panel: rgba(255, 255, 255, 0.9);
--panel-strong: #ffffff;
--line: rgba(15, 23, 42, 0.12);
--text: #0f172a;
--muted: #64748b;
--soft: #334155;
--code: #0f172a;
--shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
margin: 0;
min-height: 100vh;
background:
radial-gradient(circle at top left, rgba(34, 211, 238, 0.12), transparent 34rem),
radial-gradient(circle at 85% 12%, rgba(52, 211, 153, 0.1), transparent 26rem),
var(--bg);
color: var(--text);
font-family: "Space Grotesk", sans-serif;
-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.font-heading { font-family: "Syne", sans-serif; }
.shell {
width: min(1180px, calc(100% - 32px));
margin: 0 auto;
}
.topbar {
position: sticky;
top: 0;
z-index: 20;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
background: color-mix(in srgb, var(--bg) 78%, transparent);
border-bottom: 1px solid var(--line);
}
.topbar-inner {
min-height: 76px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
min-width: 0;
}
.brand img {
width: 42px;
height: 42px;
object-fit: contain;
}
.brand-title {
display: flex;
flex-direction: column;
line-height: 1.1;
min-width: 0;
}
.brand-title strong {
font-family: "Syne", sans-serif;
font-size: 1rem;
letter-spacing: 0;
white-space: nowrap;
}
.brand-title span {
color: var(--muted);
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.top-actions {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
justify-content: flex-end;
}
.pill,
.theme-btn,
.copy-btn {
border: 1px solid var(--line);
background: var(--panel);
color: var(--text);
border-radius: 14px;
min-height: 42px;
padding: 0 14px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
font-size: 0.72rem;
font-weight: 900;
letter-spacing: 0.12em;
text-transform: uppercase;
cursor: pointer;
transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.pill:hover,
.theme-btn:hover,
.copy-btn:hover {
transform: translateY(-1px);
border-color: var(--cyan);
color: var(--cyan);
}
.hero {
padding: 64px 0 38px;
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
gap: 34px;
align-items: end;
}
.eyebrow {
display: inline-flex;
align-items: center;
gap: 10px;
color: var(--emerald);
font-size: 0.72rem;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
margin-bottom: 18px;
}
.eyebrow::before {
content: "";
width: 8px;
height: 8px;
border-radius: 99px;
background: var(--emerald);
box-shadow: 0 0 24px var(--emerald);
}
h1 {
margin: 0;
max-width: 820px;
font-family: "Syne", sans-serif;
font-size: clamp(2.5rem, 8vw, 6.8rem);
line-height: 0.88;
letter-spacing: 0;
text-transform: uppercase;
}
.hero-copy {
color: var(--soft);
font-size: clamp(1rem, 1.8vw, 1.2rem);
line-height: 1.75;
max-width: 760px;
margin: 24px 0 0;
}
.status-card {
border: 1px solid var(--line);
background: var(--panel);
border-radius: 24px;
padding: 22px;
box-shadow: var(--shadow);
}
.status-card img {
width: 70px;
height: 70px;
object-fit: contain;
display: block;
margin-bottom: 16px;
}
.status-grid {
display: grid;
grid-template-columns: 1fr;
gap: 10px;
margin-top: 18px;
}
.metric {
border: 1px solid var(--line);
border-radius: 16px;
padding: 14px;
background: color-mix(in srgb, var(--panel-strong) 70%, transparent);
}
.metric span {
display: block;
color: var(--muted);
font-size: 0.66rem;
font-weight: 900;
letter-spacing: 0.13em;
text-transform: uppercase;
margin-bottom: 7px;
}
.metric strong {
font-family: "Syne", sans-serif;
font-size: 1.5rem;
}
.layout {
display: grid;
grid-template-columns: 260px minmax(0, 1fr);
gap: 28px;
align-items: start;
padding: 24px 0 80px;
}
.toc {
position: sticky;
top: 96px;
border: 1px solid var(--line);
background: var(--panel);
border-radius: 22px;
padding: 14px;
}
.toc strong {
display: block;
color: var(--muted);
font-size: 0.68rem;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
padding: 8px 10px 12px;
}
.toc a {
display: block;
color: var(--soft);
border-radius: 12px;
padding: 10px;
font-size: 0.88rem;
font-weight: 700;
}
.toc a:hover {
background: color-mix(in srgb, var(--cyan) 12%, transparent);
color: var(--cyan);
}
.content {
display: flex;
flex-direction: column;
gap: 22px;
min-width: 0;
}
section {
border: 1px solid var(--line);
background: var(--panel);
border-radius: 24px;
padding: clamp(22px, 4vw, 34px);
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
scroll-margin-top: 96px;
}
h2 {
margin: 0 0 16px;
font-family: "Syne", sans-serif;
font-size: clamp(1.65rem, 3vw, 2.45rem);
line-height: 1;
letter-spacing: 0;
text-transform: uppercase;
}
h3 {
margin: 26px 0 10px;
font-size: 1rem;
color: var(--text);
}
p {
color: var(--soft);
line-height: 1.7;
margin: 0 0 14px;
}
ul {
margin: 12px 0 0;
padding-left: 20px;
color: var(--soft);
line-height: 1.75;
}
li + li { margin-top: 6px; }
code {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
font-size: 0.9em;
}
:not(pre) > code {
color: var(--cyan);
background: color-mix(in srgb, var(--cyan) 12%, transparent);
border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
border-radius: 7px;
padding: 0.12rem 0.35rem;
}
.code-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 16px;
border: 1px solid rgba(148, 163, 184, 0.2);
border-bottom: 0;
border-radius: 16px 16px 0 0;
background: color-mix(in srgb, var(--code) 92%, white 8%);
color: #cbd5e1;
padding: 10px 12px;
}
.code-head span {
font-size: 0.68rem;
font-weight: 900;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.copy-btn {
min-height: 30px;
padding: 0 10px;
background: rgba(255, 255, 255, 0.04);
color: #cbd5e1;
}
pre {
margin: 0;
overflow-x: auto;
border: 1px solid rgba(148, 163, 184, 0.2);
border-radius: 0 0 16px 16px;
background: var(--code);
color: #e2e8f0;
padding: 18px;
line-height: 1.65;
}
.cards {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
margin-top: 18px;
}
.mini-card {
border: 1px solid var(--line);
background: color-mix(in srgb, var(--panel-strong) 68%, transparent);
border-radius: 18px;
padding: 18px;
}
.mini-card span {
color: var(--muted);
display: block;
font-size: 0.66rem;
font-weight: 900;
letter-spacing: 0.13em;
text-transform: uppercase;
margin-bottom: 8px;
}
.mini-card strong {
display: block;
font-size: 1.02rem;
margin-bottom: 8px;
}
.mini-card p {
font-size: 0.9rem;
margin: 0;
}
.table-wrap {
overflow-x: auto;
border: 1px solid var(--line);
border-radius: 18px;
margin-top: 16px;
}
table {
width: 100%;
border-collapse: collapse;
min-width: 720px;
background: color-mix(in srgb, var(--panel-strong) 70%, transparent);
}
th,
td {
text-align: left;
padding: 13px 15px;
border-bottom: 1px solid var(--line);
vertical-align: top;
color: var(--soft);
font-size: 0.92rem;
}
th {
color: var(--muted);
font-size: 0.68rem;
font-weight: 900;
letter-spacing: 0.14em;
text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 14px;
}
.tag {
border: 1px solid var(--line);
border-radius: 999px;
padding: 7px 10px;
color: var(--soft);
font-size: 0.72rem;
font-weight: 800;
}
.callout {
border: 1px solid color-mix(in srgb, var(--amber) 36%, transparent);
background: color-mix(in srgb, var(--amber) 10%, transparent);
border-radius: 18px;
padding: 16px;
color: var(--soft);
margin-top: 16px;
}
.callout strong { color: var(--amber); }
footer {
border-top: 1px solid var(--line);
padding: 28px 0 40px;
color: var(--muted);
font-size: 0.9rem;
}
@media (max-width: 920px) {
.hero,
.layout {
grid-template-columns: 1fr;
}
.toc {
position: static;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.toc strong { grid-column: 1 / -1; }
.cards { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
.topbar-inner {
align-items: flex-start;
flex-direction: column;
padding: 14px 0;
}
.top-actions {
width: 100%;
justify-content: stretch;
}
.pill,
.theme-btn {
flex: 1;
}
.hero { padding-top: 42px; }
.toc { grid-template-columns: 1fr; }
section { border-radius: 18px; }
pre { font-size: 0.82rem; }
}
</style>
</head>
<body>
<header class="topbar">
<div class="shell topbar-inner">
<a class="brand" href="/" aria-label="Back to ChainLens">
<img src="/MagicMoney_icon.svg" alt="Magic Money Wallet">
<span class="brand-title">
<strong>Magic Money Wallet</strong>
<span>Developer Docs</span>
</span>
</a>
<nav class="top-actions" aria-label="Docs actions">
<a class="pill" href="/">ChainLens</a>
<a class="pill" href="https://github.com/M2AF/Magic-Money-Wallet" target="_blank" rel="noopener noreferrer">GitHub</a>
<a class="pill" href="/audit/FINAL-AUDIT.html">Audit</a>
<a class="pill" href="#quick-start">Quick Start</a>
<button class="theme-btn" type="button" id="themeToggle">Dark</button>
</nav>
</div>
</header>
<main class="shell">
<div class="hero">
<div>
<div class="eyebrow">Developer preview</div>
<h1>Magic Money Wallet Docs</h1>
<p class="hero-copy">
Integration notes for dApp developers building against Magic Money Wallet across EVM, Solana, Cardano, Bitcoin, and WalletConnect. Use this page to detect the wallet, request accounts, submit signing requests, and understand the security boundaries.
</p>
</div>
<aside class="status-card" aria-label="Magic Money Wallet status">
<img src="/MagicMoney_icon.svg" alt="">
<p><strong>One wallet surface for many ecosystems.</strong></p>
<p>Magic Money is a self-custody wallet designed for ChainLens, desktop, and browser extension workflows.</p>
<div class="status-grid">
<div class="metric"><span>Networks</span><strong>22</strong></div>
</div>
</aside>
</div>
<div class="layout">
<aside class="toc" aria-label="Documentation sections">
<strong>On This Page</strong>
<a href="#overview">Overview</a>
<a href="#quick-start">Quick Start</a>
<a href="#detect">Detect Wallet</a>
<a href="#evm">EVM Provider</a>
<a href="#solana">Solana Provider</a>
<a href="#cardano">Cardano CIP-30</a>
<a href="#bitcoin">Bitcoin Provider</a>
<a href="#walletconnect">WalletConnect</a>
<a href="#networks">Networks</a>
<a href="#security">Security</a>
<a href="#proxy">API Proxy</a>
<a href="#build">Build Notes</a>
<a href="#troubleshooting">Troubleshooting</a>
</aside>
<div class="content">
<section id="overview">
<h2>Overview</h2>
<p>
Magic Money Wallet exposes standard wallet interfaces instead of a custom-only API. EVM dApps use EIP-1193 and EIP-6963, Solana dApps use the Wallet Standard and legacy <code>window.solana</code>, Cardano dApps use <code>window.cardano.magicmoney</code>, Bitcoin and Ordinals dApps use <code>window.unisat</code> or <code>window.btc_providers</code>, and QR or URI based flows use WalletConnect v2.
</p>
<div class="cards">
<div class="mini-card">
<span>EVM</span>
<strong>EIP-1193 + EIP-6963</strong>
<p>Detect Magic Money alongside MetaMask, Rabby, Coinbase Wallet, and other injected wallets.</p>
</div>
<div class="mini-card">
<span>Solana</span>
<strong>Wallet Standard</strong>
<p>Supports connect, message signing, transaction signing, and sign-and-send flows.</p>
</div>
<div class="mini-card">
<span>Cardano</span>
<strong>CIP-30</strong>
<p>Connect at <code>window.cardano.magicmoney</code> with UTxO, balance, signing, and submit methods.</p>
</div>
<div class="mini-card">
<span>Bitcoin</span>
<strong>UniSat + WBIP</strong>
<p>Connect payment and ordinals addresses, sign messages, sign PSBTs, broadcast, and send BTC.</p>
</div>
</div>
</section>
<section id="quick-start">
<h2>Quick Start</h2>
<p>
For the widest compatibility, detect Magic Money through standards first and only fall back to direct globals when the dApp framework requires it.
</p>
<div class="code-head">
<span>EVM connect</span>
<button class="copy-btn" type="button" data-copy="evm-connect">Copy</button>
</div>
<pre><code id="evm-connect">async function connectMagicMoneyEvm() {
const provider = window.ethereum;
if (!provider) throw new Error("No EVM wallet found");
const accounts = await provider.request({
method: "eth_requestAccounts"
});
const chainId = await provider.request({ method: "eth_chainId" });
return { address: accounts[0], chainId };
}</code></pre>
<div class="code-head">
<span>Cardano connect</span>
<button class="copy-btn" type="button" data-copy="cardano-connect">Copy</button>
</div>
<pre><code id="cardano-connect">async function connectMagicMoneyCardano() {
const wallet = window.cardano?.magicmoney;
if (!wallet) throw new Error("Magic Money Cardano provider not found");
const api = await wallet.enable();
const networkId = await api.getNetworkId();
const changeAddressHex = await api.getChangeAddress();
return { api, networkId, changeAddressHex };
}</code></pre>
<div class="code-head">
<span>Bitcoin connect</span>
<button class="copy-btn" type="button" data-copy="bitcoin-connect">Copy</button>
</div>
<pre><code id="bitcoin-connect">async function connectMagicMoneyBitcoin() {
const provider = window.unisat;
if (!provider?.isMagicMoney) throw new Error("Magic Money Bitcoin provider not found");
const [paymentAddress] = await provider.requestAccounts();
const publicKey = await provider.getPublicKey();
const balance = await provider.getBalance();
return { paymentAddress, publicKey, balance };
}</code></pre>
</section>
<section id="detect">
<h2>Detect Wallet</h2>
<p>
On EVM pages, prefer EIP-6963. Magic Money announces with the reverse DNS identifier <code>info.chainlens.magicmoney</code>. If multiple wallets are installed, show the user a picker.
</p>
<div class="code-head">
<span>EIP-6963 discovery</span>
<button class="copy-btn" type="button" data-copy="eip6963">Copy</button>
</div>
<pre><code id="eip6963">const discoveredWallets = [];
window.addEventListener("eip6963:announceProvider", (event) => {
const { info, provider } = event.detail;
discoveredWallets.push({ info, provider });
if (info.rdns === "info.chainlens.magicmoney") {
console.log("Magic Money Wallet found", info.name);
}
});
window.dispatchEvent(new Event("eip6963:requestProvider"));</code></pre>
<div class="callout">
<strong>Tip:</strong> Do not assume <code>window.ethereum</code> belongs to Magic Money. Browser users may have several wallets installed, and another extension can own that global.
</div>
</section>
<section id="evm">
<h2>EVM Provider</h2>
<p>
Magic Money implements the common EIP-1193 request shape. User consent is required for account access and signing requests.
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>Method</th><th>Use</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td><code>eth_requestAccounts</code></td><td>Connect wallet</td><td>Prompts the user for origin approval.</td></tr>
<tr><td><code>eth_accounts</code></td><td>Read connected accounts</td><td>Returns an empty array until approved.</td></tr>
<tr><td><code>eth_chainId</code></td><td>Read active chain</td><td>Returns a hex chain ID such as <code>0x1</code>.</td></tr>
<tr><td><code>wallet_switchEthereumChain</code></td><td>Switch chain</td><td>Supports configured EVM chains in Magic Money.</td></tr>
<tr><td><code>wallet_addEthereumChain</code></td><td>Add or select chain</td><td>Used for dApps that provide chain metadata.</td></tr>
<tr><td><code>personal_sign</code></td><td>Message signing</td><td>Shown to the user before signing.</td></tr>
<tr><td><code>eth_signTypedData_v4</code></td><td>EIP-712 typed data</td><td>Use this for structured login and permit flows.</td></tr>
<tr><td><code>eth_sendTransaction</code></td><td>Send transaction</td><td>Transaction is reviewed, signed locally, then broadcast.</td></tr>
</tbody>
</table>
</div>
<div class="code-head">
<span>Switch chain</span>
<button class="copy-btn" type="button" data-copy="switch-chain">Copy</button>
</div>
<pre><code id="switch-chain">await provider.request({
method: "wallet_switchEthereumChain",
params: [{ chainId: "0x2105" }] // Base mainnet
});</code></pre>
</section>
<section id="solana">
<h2>Solana Provider</h2>
<p>
Magic Money supports Solana dApps through Wallet Standard discovery and a legacy provider shape compatible with common Solana wallet adapter flows.
</p>
<div class="code-head">
<span>Legacy Solana connect</span>
<button class="copy-btn" type="button" data-copy="solana-connect">Copy</button>
</div>
<pre><code id="solana-connect">async function connectMagicMoneySolana() {
const provider = window.solana;
if (!provider) throw new Error("No Solana wallet found");
const result = await provider.connect();
const publicKey = result.publicKey.toString();
const message = new TextEncoder().encode("Sign in to my dApp");
const signed = await provider.signMessage(message, "utf8");
return { publicKey, signature: signed.signature };
}</code></pre>
<p>
Transaction flows should use <code>signTransaction</code>, <code>signAllTransactions</code>, or <code>signAndSendTransaction</code> depending on whether your app or the wallet should broadcast.
</p>
</section>
<section id="cardano">
<h2>Cardano CIP-30</h2>
<p>
Cardano is exposed at <code>window.cardano.magicmoney</code>. The provider follows the CIP-30 pattern where <code>enable()</code> returns the full API object after user approval.
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>Method</th><th>Purpose</th></tr>
</thead>
<tbody>
<tr><td><code>isEnabled()</code></td><td>Check if the current origin has permission.</td></tr>
<tr><td><code>enable()</code></td><td>Request access and return the full wallet API.</td></tr>
<tr><td><code>getNetworkId()</code></td><td>Returns <code>1</code> for mainnet.</td></tr>
<tr><td><code>getBalance()</code></td><td>Returns balance CBOR hex.</td></tr>
<tr><td><code>getUtxos()</code></td><td>Returns UTxO CBOR hex values.</td></tr>
<tr><td><code>getChangeAddress()</code></td><td>Returns the change address as hex.</td></tr>
<tr><td><code>getRewardAddresses()</code></td><td>Returns staking reward addresses as hex.</td></tr>
<tr><td><code>signTx(txHex, partialSign)</code></td><td>Returns witness set CBOR hex.</td></tr>
<tr><td><code>signData(addressHex, payloadHex)</code></td><td>Returns a signed data payload.</td></tr>
<tr><td><code>submitTx(txHex)</code></td><td>Submits a signed transaction.</td></tr>
</tbody>
</table>
</div>
<div class="code-head">
<span>CIP-30 signing</span>
<button class="copy-btn" type="button" data-copy="cip30-sign">Copy</button>
</div>
<pre><code id="cip30-sign">const wallet = window.cardano?.magicmoney;
const api = await wallet.enable();
const txHex = "84a4..."; // unsigned transaction CBOR hex
const witnessSetHex = await api.signTx(txHex, true);
console.log({ witnessSetHex });</code></pre>
</section>
<section id="bitcoin">
<h2>Bitcoin Provider</h2>
<p>
Magic Money exposes Bitcoin dApp connectivity for payment, Ordinals, Runes, and BRC-20 style apps. It supports a UniSat-compatible <code>window.unisat</code> surface and a sats-connect/WBIP style provider through <code>window.btc_providers</code>.
</p>
<p>
Bitcoin access is approval-gated by origin. The wallet returns a native SegWit payment address for BTC transfers and a Taproot address for ordinals workflows.
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>Address</th><th>Purpose</th><th>Type</th></tr>
</thead>
<tbody>
<tr><td>Payment</td><td>BTC send/receive, PSBT payment inputs</td><td><code>p2wpkh</code> native SegWit, <code>bc1q...</code></td></tr>
<tr><td>Ordinals</td><td>Ordinals, inscriptions, Runes, BRC-20</td><td><code>p2tr</code> Taproot, <code>bc1p...</code></td></tr>
</tbody>
</table>
</div>
<h3>UniSat-compatible API</h3>
<p>
Use <code>window.unisat</code> when your dApp already supports UniSat-style Bitcoin wallets. Magic Money only claims this global when another Bitcoin wallet has not already locked it, so dApps should still allow wallet selection when multiple wallets are available.
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>Method</th><th>Purpose</th></tr>
</thead>
<tbody>
<tr><td><code>requestAccounts()</code></td><td>Prompt the user and return the payment address array.</td></tr>
<tr><td><code>getAccounts()</code></td><td>Return connected payment accounts after approval.</td></tr>
<tr><td><code>getPublicKey()</code></td><td>Return the payment public key as hex.</td></tr>
<tr><td><code>getNetwork()</code></td><td>Returns <code>livenet</code>.</td></tr>
<tr><td><code>getBalance()</code></td><td>Returns confirmed, unconfirmed, and total satoshi balances.</td></tr>
<tr><td><code>signMessage(message, type)</code></td><td>Sign a message after user approval. Default type is <code>ecdsa</code>.</td></tr>
<tr><td><code>signPsbt(psbtHex, options)</code></td><td>Sign one PSBT and return signed PSBT hex.</td></tr>
<tr><td><code>signPsbts(psbtHexArray, options)</code></td><td>Sign multiple PSBTs.</td></tr>
<tr><td><code>pushPsbt(psbtHex)</code></td><td>Broadcast an extracted raw transaction hex.</td></tr>
<tr><td><code>pushTx(rawtx)</code></td><td>Broadcast a raw transaction hex.</td></tr>
<tr><td><code>sendBitcoin(to, satoshis)</code></td><td>Build, sign, and broadcast a BTC transfer from the payment address.</td></tr>
</tbody>
</table>
</div>
<div class="code-head">
<span>Bitcoin message signing</span>
<button class="copy-btn" type="button" data-copy="bitcoin-message">Copy</button>
</div>
<pre><code id="bitcoin-message">const provider = window.unisat;
const [address] = await provider.requestAccounts();
const signature = await provider.signMessage(
"Sign in to my Bitcoin dApp",
"ecdsa"
);
console.log({ address, signature });</code></pre>
<div class="code-head">
<span>Bitcoin PSBT signing</span>
<button class="copy-btn" type="button" data-copy="bitcoin-psbt">Copy</button>
</div>
<pre><code id="bitcoin-psbt">const signedPsbtHex = await window.unisat.signPsbt(psbtHex, {
autoFinalized: true,
broadcast: false
});
// If your app extracts a raw transaction from the signed PSBT:
const txid = await window.unisat.pushTx({ rawtx: rawTxHex });</code></pre>
<div class="code-head">
<span>Send BTC</span>
<button class="copy-btn" type="button" data-copy="bitcoin-send">Copy</button>
</div>
<pre><code id="bitcoin-send">const sats = 25_000;
const txid = await window.unisat.sendBitcoin(
"bc1qexamplepaymentaddress...",
sats
);</code></pre>
<h3>sats-connect / WBIP provider</h3>
<p>
Apps that use WBIP-style providers can discover Magic Money through <code>window.btc_providers</code> and then call the matching provider from <code>window.MagicMoneyProviders.BitcoinProvider</code> or <code>window.BitcoinProvider</code>.
</p>
<div class="code-head">
<span>WBIP discovery</span>
<button class="copy-btn" type="button" data-copy="bitcoin-wbip">Copy</button>
</div>
<pre><code id="bitcoin-wbip">const entry = window.btc_providers?.find(
(provider) => provider.id === "MagicMoneyProviders.BitcoinProvider"
);
if (!entry) throw new Error("Magic Money Bitcoin provider not found");
const provider = window.MagicMoneyProviders.BitcoinProvider;
const addressesResult = await provider.request("getAddresses", {
purposes: ["payment", "ordinals"]
});
const psbtResult = await provider.request("signPsbt", {
psbt: psbtBase64,
signInputs: {},
broadcast: false,
finalize: true
});</code></pre>
<div class="callout">
<strong>Developer note:</strong> Magic Money avoids spending Taproot ordinals outputs as ordinary payment change. Build PSBTs with explicit inputs and outputs, and show the user clear intent when requesting ordinal or rune transfers.
</div>
</section>
<section id="walletconnect">
<h2>WalletConnect</h2>
<p>
Magic Money uses WalletConnect v2 for dApps that prefer URI based pairing or for embedded ChainLens contexts where direct provider injection is not available.
</p>
<div class="table-wrap">
<table>
<thead>
<tr><th>Namespace</th><th>Chains</th><th>Typical methods</th></tr>
</thead>
<tbody>
<tr><td><code>eip155</code></td><td>All supported EVM chains</td><td><code>personal_sign</code>, <code>eth_sendTransaction</code>, <code>eth_signTypedData_v4</code></td></tr>
<tr><td><code>solana</code></td><td>Solana mainnet-beta</td><td>Sign message, sign transaction, sign and send</td></tr>
<tr><td><code>cardano</code></td><td>Planned for finalized WC Cardano namespace support</td><td>CIP-30 remains the primary Cardano browser path.</td></tr>
</tbody>
</table>
</div>
</section>
<section id="networks">
<h2>Networks</h2>
<p>
Magic Money derives addresses from one seed phrase and groups them into one portfolio. EVM networks share the same EOA; non-EVM ecosystems have their own derivation paths and address formats.
</p>
<div class="tag-row">
<span class="tag">Ethereum</span>
<span class="tag">Arbitrum</span>
<span class="tag">Optimism</span>
<span class="tag">Base</span>
<span class="tag">Polygon</span>
<span class="tag">Avalanche</span>
<span class="tag">Blast</span>
<span class="tag">Gnosis</span>
<span class="tag">Abstract</span>
<span class="tag">ApeChain</span>
<span class="tag">Ronin</span>
<span class="tag">Soneium</span>
<span class="tag">WorldChain</span>
<span class="tag">Zora</span>
<span class="tag">Monad</span>
<span class="tag">HyperEVM</span>
<span class="tag">Solana</span>
<span class="tag">Cardano</span>
<span class="tag">Bitcoin</span>
<span class="tag">Polkadot</span>
<span class="tag">Tron</span>
<span class="tag">Dogecoin</span>
</div>
</section>
<section id="security">
<h2>Security Model</h2>
<ul>
<li>The renderer, popup, and dApp pages only receive public addresses, balances, metadata, and user-approved signatures.</li>
<li>Private keys are derived transiently inside the privileged runtime for signing and are not exposed to dApp JavaScript.</li>
<li>Desktop runs with <code>contextIsolation</code>, sandboxing, and no renderer <code>nodeIntegration</code>.</li>
<li>The extension inject script provides wallet APIs in the page, but storage and signing live behind the extension message bridge.</li>
<li>Each origin must be approved before account access or signing requests can proceed.</li>
</ul>
</section>
<section id="proxy">
<h2>API Proxy</h2>
<p>
Keyed providers are routed through a hosted Cloudflare Worker so API secrets are not shipped in the desktop app or browser extension bundle. The Worker injects provider keys server side, adds cache behavior for expensive reads, and keeps normal users from needing any local configuration.
</p>
<p>
Advanced operators can self-host the Worker and point Magic Money at their own endpoint. Public, keyless services like CoinGecko, DexScreener, DefiLlama, mempool.space, and Magic Eden can remain direct to avoid collapsing all users onto one shared proxy IP.
</p>
</section>
<section id="build">
<h2>Build Notes</h2>
<p>
The wallet codebase ships as Electron desktop and Chrome Manifest V3 extension builds. Node.js 20+ and npm 10+ are expected for local development.
</p>