@lydianpay/lydianconnect 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -13
- package/dist/index.cjs +550 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +550 -98
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -73,7 +73,9 @@ var ConnectManager = class {
|
|
|
73
73
|
this.connections.delete(walletId);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
await Promise.allSettled(
|
|
76
|
+
await Promise.allSettled(
|
|
77
|
+
[...this.connections.values()].map((c) => c.disconnect())
|
|
78
|
+
);
|
|
77
79
|
this.connections.clear();
|
|
78
80
|
}
|
|
79
81
|
async reset() {
|
|
@@ -105,7 +107,11 @@ var NAMESPACE_DEFAULTS = {
|
|
|
105
107
|
events: ["chainChanged", "accountsChanged"]
|
|
106
108
|
},
|
|
107
109
|
solana: {
|
|
108
|
-
methods: [
|
|
110
|
+
methods: [
|
|
111
|
+
"solana_signTransaction",
|
|
112
|
+
"solana_signMessage",
|
|
113
|
+
"solana_signAndSendTransaction"
|
|
114
|
+
],
|
|
109
115
|
events: []
|
|
110
116
|
},
|
|
111
117
|
bip122: {
|
|
@@ -123,11 +129,17 @@ function buildNamespace(chainId) {
|
|
|
123
129
|
);
|
|
124
130
|
}
|
|
125
131
|
if (name === "eip155" && !(/^\d+$/.test(reference) && Number(reference) > 0)) {
|
|
126
|
-
throw new Error(
|
|
132
|
+
throw new Error(
|
|
133
|
+
`Invalid eip155 chain "${caip}" \u2014 the reference must be a positive integer.`
|
|
134
|
+
);
|
|
127
135
|
}
|
|
128
136
|
return {
|
|
129
137
|
name,
|
|
130
|
-
value: {
|
|
138
|
+
value: {
|
|
139
|
+
chains: [caip],
|
|
140
|
+
methods: defaults.methods,
|
|
141
|
+
events: defaults.events
|
|
142
|
+
}
|
|
131
143
|
};
|
|
132
144
|
}
|
|
133
145
|
|
|
@@ -292,22 +304,34 @@ var MetaMaskConnector = class extends BaseConnector {
|
|
|
292
304
|
if (this.listenersBound) return;
|
|
293
305
|
this.listenersBound = true;
|
|
294
306
|
provider.on("chainChanged", (hex) => {
|
|
295
|
-
this.emit({
|
|
307
|
+
this.emit({
|
|
308
|
+
type: "chainChanged",
|
|
309
|
+
walletId: WALLET_ID,
|
|
310
|
+
chainId: toCaip(String(hex))
|
|
311
|
+
});
|
|
296
312
|
});
|
|
297
313
|
provider.on("accountsChanged", (accounts) => {
|
|
298
314
|
const account = Array.isArray(accounts) ? accounts[0] : void 0;
|
|
299
|
-
if (account)
|
|
315
|
+
if (account)
|
|
316
|
+
this.emit({ type: "accountsChanged", walletId: WALLET_ID, account });
|
|
300
317
|
else this.emit({ type: "disconnect", walletId: WALLET_ID });
|
|
301
318
|
});
|
|
302
|
-
provider.on(
|
|
319
|
+
provider.on(
|
|
320
|
+
"disconnect",
|
|
321
|
+
() => this.emit({ type: "disconnect", walletId: WALLET_ID })
|
|
322
|
+
);
|
|
303
323
|
}
|
|
304
324
|
async connect(req) {
|
|
305
325
|
const provider = await this.getProvider();
|
|
306
|
-
const accounts = await provider.request({
|
|
326
|
+
const accounts = await provider.request({
|
|
327
|
+
method: "eth_requestAccounts"
|
|
328
|
+
});
|
|
307
329
|
const account = accounts?.[0];
|
|
308
330
|
if (!account) throw new Error("MetaMask returned no account");
|
|
309
331
|
await this.ensureChain(provider, req);
|
|
310
|
-
const chainId = toCaip(
|
|
332
|
+
const chainId = toCaip(
|
|
333
|
+
await provider.request({ method: "eth_chainId" })
|
|
334
|
+
);
|
|
311
335
|
return this.toConnection(provider, account, chainId);
|
|
312
336
|
}
|
|
313
337
|
async restore() {
|
|
@@ -347,7 +371,10 @@ var MetaMaskConnector = class extends BaseConnector {
|
|
|
347
371
|
walletId: WALLET_ID,
|
|
348
372
|
account,
|
|
349
373
|
chainId,
|
|
350
|
-
request: async (args) => await provider.request({
|
|
374
|
+
request: async (args) => await provider.request({
|
|
375
|
+
method: args.method,
|
|
376
|
+
params: args.params
|
|
377
|
+
}),
|
|
351
378
|
openWallet: () => {
|
|
352
379
|
},
|
|
353
380
|
// MetaMask SDK foregrounds the wallet on request
|
|
@@ -368,7 +395,10 @@ function toCaip(hexChainId) {
|
|
|
368
395
|
|
|
369
396
|
// src/connectors/coinbase/connector.ts
|
|
370
397
|
function rpc(provider, method, params) {
|
|
371
|
-
return provider.request({
|
|
398
|
+
return provider.request({
|
|
399
|
+
method,
|
|
400
|
+
params
|
|
401
|
+
});
|
|
372
402
|
}
|
|
373
403
|
var WALLET_ID2 = "coinbase";
|
|
374
404
|
var CoinbaseConnector = class extends BaseConnector {
|
|
@@ -404,14 +434,22 @@ var CoinbaseConnector = class extends BaseConnector {
|
|
|
404
434
|
if (this.listenersBound) return;
|
|
405
435
|
this.listenersBound = true;
|
|
406
436
|
provider.on("chainChanged", (hex) => {
|
|
407
|
-
this.emit({
|
|
437
|
+
this.emit({
|
|
438
|
+
type: "chainChanged",
|
|
439
|
+
walletId: WALLET_ID2,
|
|
440
|
+
chainId: toCaip2(String(hex))
|
|
441
|
+
});
|
|
408
442
|
});
|
|
409
443
|
provider.on("accountsChanged", (accounts) => {
|
|
410
444
|
const account = Array.isArray(accounts) ? accounts[0] : void 0;
|
|
411
|
-
if (account)
|
|
445
|
+
if (account)
|
|
446
|
+
this.emit({ type: "accountsChanged", walletId: WALLET_ID2, account });
|
|
412
447
|
else this.emit({ type: "disconnect", walletId: WALLET_ID2 });
|
|
413
448
|
});
|
|
414
|
-
provider.on(
|
|
449
|
+
provider.on(
|
|
450
|
+
"disconnect",
|
|
451
|
+
() => this.emit({ type: "disconnect", walletId: WALLET_ID2 })
|
|
452
|
+
);
|
|
415
453
|
}
|
|
416
454
|
async connect(req) {
|
|
417
455
|
const provider = await this.getProvider(evmChainIds(req));
|
|
@@ -425,10 +463,14 @@ var CoinbaseConnector = class extends BaseConnector {
|
|
|
425
463
|
async restore() {
|
|
426
464
|
const provider = await this.getProvider().catch(() => null);
|
|
427
465
|
if (!provider) return [];
|
|
428
|
-
const accounts = await rpc(provider, "eth_accounts").catch(
|
|
466
|
+
const accounts = await rpc(provider, "eth_accounts").catch(
|
|
467
|
+
() => []
|
|
468
|
+
);
|
|
429
469
|
const account = accounts?.[0];
|
|
430
470
|
if (!account) return [];
|
|
431
|
-
const chainId = toCaip2(
|
|
471
|
+
const chainId = toCaip2(
|
|
472
|
+
await rpc(provider, "eth_chainId").catch(() => "0x1")
|
|
473
|
+
);
|
|
432
474
|
return [this.toConnection(provider, account, chainId)];
|
|
433
475
|
}
|
|
434
476
|
async reset() {
|
|
@@ -446,10 +488,10 @@ var CoinbaseConnector = class extends BaseConnector {
|
|
|
446
488
|
16
|
|
447
489
|
);
|
|
448
490
|
if (current === wantedNum) return;
|
|
449
|
-
await rpc(provider, "wallet_switchEthereumChain", [
|
|
450
|
-
()
|
|
451
|
-
|
|
452
|
-
);
|
|
491
|
+
await rpc(provider, "wallet_switchEthereumChain", [
|
|
492
|
+
{ chainId: `0x${wantedNum.toString(16)}` }
|
|
493
|
+
]).catch(() => {
|
|
494
|
+
});
|
|
453
495
|
}
|
|
454
496
|
toConnection(provider, account, chainId) {
|
|
455
497
|
return {
|
|
@@ -507,7 +549,8 @@ var InjectedConnector = class extends BaseConnector {
|
|
|
507
549
|
this.listening = true;
|
|
508
550
|
window.addEventListener("eip6963:announceProvider", (event) => {
|
|
509
551
|
const detail = event.detail;
|
|
510
|
-
if (detail?.info?.rdns && detail.provider)
|
|
552
|
+
if (detail?.info?.rdns && detail.provider)
|
|
553
|
+
this.discovered.set(detail.info.rdns, detail);
|
|
511
554
|
});
|
|
512
555
|
window.dispatchEvent(new Event("eip6963:requestProvider"));
|
|
513
556
|
}
|
|
@@ -526,16 +569,20 @@ var InjectedConnector = class extends BaseConnector {
|
|
|
526
569
|
}
|
|
527
570
|
async connect(req) {
|
|
528
571
|
const provider = this.providerFor(req.walletId);
|
|
529
|
-
if (!provider)
|
|
572
|
+
if (!provider)
|
|
573
|
+
throw new Error(`No injected provider announced for "${req.walletId}"`);
|
|
530
574
|
const accounts = await withSignal(
|
|
531
575
|
provider.request({ method: "eth_requestAccounts" }),
|
|
532
576
|
// triggers the extension popup
|
|
533
577
|
req.signal
|
|
534
578
|
);
|
|
535
579
|
const account = accounts?.[0];
|
|
536
|
-
if (!account)
|
|
580
|
+
if (!account)
|
|
581
|
+
throw new Error(`${req.walletId} extension returned no account`);
|
|
537
582
|
await this.ensureChain(provider, req);
|
|
538
|
-
const chainId = toCaip3(
|
|
583
|
+
const chainId = toCaip3(
|
|
584
|
+
await provider.request({ method: "eth_chainId" })
|
|
585
|
+
);
|
|
539
586
|
this.bindEvents(provider, req.walletId);
|
|
540
587
|
return this.toConnection(provider, req.walletId, account, chainId);
|
|
541
588
|
}
|
|
@@ -568,14 +615,21 @@ var InjectedConnector = class extends BaseConnector {
|
|
|
568
615
|
if (this.bound.has(provider)) return;
|
|
569
616
|
this.bound.add(provider);
|
|
570
617
|
provider.on("chainChanged", (hex) => {
|
|
571
|
-
this.emit({
|
|
618
|
+
this.emit({
|
|
619
|
+
type: "chainChanged",
|
|
620
|
+
walletId,
|
|
621
|
+
chainId: toCaip3(String(hex))
|
|
622
|
+
});
|
|
572
623
|
});
|
|
573
624
|
provider.on("accountsChanged", (accounts) => {
|
|
574
625
|
const account = Array.isArray(accounts) ? accounts[0] : void 0;
|
|
575
626
|
if (account) this.emit({ type: "accountsChanged", walletId, account });
|
|
576
627
|
else this.emit({ type: "disconnect", walletId });
|
|
577
628
|
});
|
|
578
|
-
provider.on(
|
|
629
|
+
provider.on(
|
|
630
|
+
"disconnect",
|
|
631
|
+
() => this.emit({ type: "disconnect", walletId })
|
|
632
|
+
);
|
|
579
633
|
}
|
|
580
634
|
/** Best-effort switch to the requested chain; leaves the wallet as-is if it's unknown to it. */
|
|
581
635
|
async ensureChain(provider, req) {
|
|
@@ -598,12 +652,18 @@ var InjectedConnector = class extends BaseConnector {
|
|
|
598
652
|
walletId,
|
|
599
653
|
account,
|
|
600
654
|
chainId,
|
|
601
|
-
request: async (args) => await provider.request({
|
|
655
|
+
request: async (args) => await provider.request({
|
|
656
|
+
method: args.method,
|
|
657
|
+
params: args.params
|
|
658
|
+
}),
|
|
602
659
|
openWallet: () => {
|
|
603
660
|
},
|
|
604
661
|
// the extension foregrounds its own popup on request
|
|
605
662
|
disconnect: async () => {
|
|
606
|
-
await provider.request({
|
|
663
|
+
await provider.request({
|
|
664
|
+
method: "wallet_revokePermissions",
|
|
665
|
+
params: [{ eth_accounts: {} }]
|
|
666
|
+
}).catch(() => {
|
|
607
667
|
});
|
|
608
668
|
this.emit({ type: "disconnect", walletId });
|
|
609
669
|
}
|
|
@@ -617,7 +677,8 @@ function toCaip3(hexChainId) {
|
|
|
617
677
|
}
|
|
618
678
|
function withSignal(promise, signal) {
|
|
619
679
|
if (!signal) return promise;
|
|
620
|
-
if (signal.aborted)
|
|
680
|
+
if (signal.aborted)
|
|
681
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
621
682
|
return new Promise((resolve, reject) => {
|
|
622
683
|
const onAbort = () => reject(new DOMException("Aborted", "AbortError"));
|
|
623
684
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -636,65 +697,435 @@ function withSignal(promise, signal) {
|
|
|
636
697
|
|
|
637
698
|
// src/connectors/walletconnect/wallet-links.ts
|
|
638
699
|
var WALLET_LINKS = {
|
|
639
|
-
metamask: {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
700
|
+
metamask: {
|
|
701
|
+
native: "metamask://",
|
|
702
|
+
scheme: "metamask://wc",
|
|
703
|
+
universal: "https://metamask.app.link/wc",
|
|
704
|
+
store: {
|
|
705
|
+
ios: "https://apps.apple.com/us/app/metamask/id1438144202",
|
|
706
|
+
android: "https://play.google.com/store/apps/details?id=io.metamask"
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
trust: {
|
|
710
|
+
native: "trust://",
|
|
711
|
+
scheme: "trust://wc",
|
|
712
|
+
universal: "https://link.trustwallet.com/wc",
|
|
713
|
+
store: {
|
|
714
|
+
ios: "https://apps.apple.com/app/apple-store/id1288339409",
|
|
715
|
+
android: "https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
rainbow: {
|
|
719
|
+
native: "rainbow://",
|
|
720
|
+
scheme: "rainbow://wc",
|
|
721
|
+
universal: "https://rnbwapp.com/wc",
|
|
722
|
+
store: {
|
|
723
|
+
ios: "https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=wc&mt=8",
|
|
724
|
+
android: "https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Dwc%26utm_medium%3Dconnector%26utm_campaign%3Dwc"
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
coinbase: {
|
|
728
|
+
store: {
|
|
729
|
+
ios: "https://apps.apple.com/us/app/base-formerly-coinbase-wallet/id1278383455"
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
zerion: {
|
|
733
|
+
native: "zerion://",
|
|
734
|
+
scheme: "zerion://wc",
|
|
735
|
+
universal: "https://wallet.zerion.io/wc/wc",
|
|
736
|
+
store: {
|
|
737
|
+
ios: "https://apps.apple.com/app/id1456732565",
|
|
738
|
+
android: "https://play.google.com/store/apps/details?id=io.zerion.android&hl=en&gl=US"
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
tokenpocket: {
|
|
742
|
+
native: "tpoutside://",
|
|
743
|
+
scheme: "tpoutside://wc",
|
|
744
|
+
store: {
|
|
745
|
+
ios: "https://apps.apple.com/us/app/tp-wallet/id6444625622?l=en",
|
|
746
|
+
android: "https://play.google.com/store/apps/details?id=vip.mytokenpocket"
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
blockchaincom: {
|
|
750
|
+
native: "blockchain-wallet://",
|
|
751
|
+
scheme: "blockchain-wallet://wc",
|
|
752
|
+
universal: "https://login.blockchain.com/app/wc",
|
|
753
|
+
store: {
|
|
754
|
+
ios: "https://apps.apple.com/us/app/blockchain-bitcoin-wallet/id493253309",
|
|
755
|
+
android: "https://play.google.com/store/apps/details?id=piuk.blockchain.android"
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
exodus: {
|
|
759
|
+
native: "exodus://",
|
|
760
|
+
scheme: "exodus://wc",
|
|
761
|
+
universal: "https://exodus.com/m/wc",
|
|
762
|
+
store: {
|
|
763
|
+
ios: "https://apps.apple.com/us/app/exodus-crypto-bitcoin-wallet/id1414384820",
|
|
764
|
+
android: "https://play.google.com/store/apps/details?id=exodusmovement.exodus&hl=en&gl=US"
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
phantom: {
|
|
768
|
+
store: {
|
|
769
|
+
ios: "https://apps.apple.com/us/app/phantom-crypto-wallet/id1598432977",
|
|
770
|
+
android: "https://play.google.com/store/apps/details?id=app.phantom&hl=en"
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
okx: {
|
|
774
|
+
native: "okxwallet://main",
|
|
775
|
+
scheme: "okxwallet://main/wc",
|
|
776
|
+
store: {
|
|
777
|
+
ios: "https://apps.apple.com/us/app/okx-buy-bitcoin-eth-crypto/id1327268470",
|
|
778
|
+
android: "https://play.google.com/store/apps/details?id=com.okinc.okex.gp"
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
cryptocom: {
|
|
782
|
+
native: "cryptowallet://",
|
|
783
|
+
scheme: "cryptowallet://wc",
|
|
784
|
+
store: {
|
|
785
|
+
ios: "https://apps.apple.com/US/app/id1512048310?mt=8",
|
|
786
|
+
android: "https://play.google.com/store/apps/details?id=com.defi.wallet"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
argent: {
|
|
790
|
+
native: "argent://app/",
|
|
791
|
+
scheme: "argent://app/wc",
|
|
792
|
+
universal: "https://www.argent.xyz/app/wc",
|
|
793
|
+
store: {
|
|
794
|
+
ios: "https://apps.apple.com/us/app/argent-defi-in-a-tap/id1358741926",
|
|
795
|
+
android: "https://play.google.com/store/apps/details?id=im.argent.contractwalletclient&hl=en&gl=US&pli=1"
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
safepal: {
|
|
799
|
+
native: "safepalwallet://",
|
|
800
|
+
scheme: "safepalwallet://wc",
|
|
801
|
+
universal: "https://link.safepal.io/wc",
|
|
802
|
+
store: {
|
|
803
|
+
ios: "https://apps.apple.com/app/safepal-wallet/id1548297139",
|
|
804
|
+
android: "https://play.google.com/store/apps/details?id=io.safepal.wallet"
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
imtoken: {
|
|
808
|
+
native: "imtokenv2://",
|
|
809
|
+
scheme: "imtokenv2://wc",
|
|
810
|
+
store: {
|
|
811
|
+
ios: "https://apps.apple.com/us/app/imtoken2/id1384798940",
|
|
812
|
+
android: "https://play.google.com/store/apps/details?id=im.token.app"
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
ronin: {
|
|
816
|
+
native: "roninwallet://",
|
|
817
|
+
scheme: "roninwallet://wc",
|
|
818
|
+
universal: "https://wallet.roninchain.com/wc",
|
|
819
|
+
store: {
|
|
820
|
+
ios: "https://apps.apple.com/us/app/ronin-wallet/id1592675001",
|
|
821
|
+
android: "https://play.google.com/store/apps/details?id=com.skymavis.genesis"
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
coin98: {
|
|
825
|
+
native: "coin98://",
|
|
826
|
+
scheme: "coin98://wc",
|
|
827
|
+
universal: "https://coin98.com/wc",
|
|
828
|
+
store: {
|
|
829
|
+
ios: "https://apps.apple.com/vn/app/coin98-wallet/id1561969966",
|
|
830
|
+
android: "https://play.google.com/store/apps/details?id=coin98.crypto.finance.media&hl=vi&gl=US"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
bitkeep: {
|
|
834
|
+
native: "bitkeep://",
|
|
835
|
+
scheme: "bitkeep://wc",
|
|
836
|
+
universal: "https://bkapp.vip/wc",
|
|
837
|
+
store: {
|
|
838
|
+
ios: "https://web3.bitget.com/en/wallet-download?type=0",
|
|
839
|
+
android: "https://web3.bitget.com/en/wallet-download?type=0"
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
"1inch": {
|
|
843
|
+
native: "oneinch://open/nobodywilleveruseit",
|
|
844
|
+
scheme: "oneinch://open/nobodywilleveruseit/wc",
|
|
845
|
+
universal: "https://wallet.1inch.io/app/nobodywilleveruseit/wc",
|
|
846
|
+
store: {
|
|
847
|
+
ios: "https://apps.apple.com/us/app/1inch-defi-wallet/id1546049391",
|
|
848
|
+
android: "https://play.google.com/store/apps/details?id=io.oneinch.android"
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
ledgerlive: {
|
|
852
|
+
native: "ledgerlive://",
|
|
853
|
+
scheme: "ledgerlive://wc",
|
|
854
|
+
store: {
|
|
855
|
+
ios: "https://itunes.apple.com/app/id1361671700",
|
|
856
|
+
android: "https://play.google.com/store/apps/details?id=com.ledger.live"
|
|
857
|
+
}
|
|
858
|
+
},
|
|
859
|
+
atomic: {
|
|
860
|
+
native: "atomicwallet://",
|
|
861
|
+
scheme: "atomicwallet://wc",
|
|
862
|
+
store: {
|
|
863
|
+
ios: "https://apps.apple.com/us/app/atomic-wallet/id1478257827",
|
|
864
|
+
android: "https://play.google.com/store/apps/details?id=io.atomicwallet"
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
alpha: {
|
|
868
|
+
native: "awallet://",
|
|
869
|
+
scheme: "awallet://wc",
|
|
870
|
+
universal: "https://aw.app/wc",
|
|
871
|
+
store: {
|
|
872
|
+
ios: "https://apps.apple.com/us/app/alphawallet-eth-wallet/id1358230430",
|
|
873
|
+
android: "https://play.google.com/store/apps/details?id=io.stormbird.wallet"
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
math: {
|
|
877
|
+
native: "mathwallet://",
|
|
878
|
+
scheme: "mathwallet://wc",
|
|
879
|
+
universal: "https://www.mathwallet.org/wc",
|
|
880
|
+
store: {
|
|
881
|
+
ios: "https://apps.apple.com/us/app/mathwallet5/id1582612388",
|
|
882
|
+
android: "https://play.google.com/store/apps/details?id=com.mathwallet.android"
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
bitpay: {
|
|
886
|
+
native: "bitpay://",
|
|
887
|
+
scheme: "bitpay://wc",
|
|
888
|
+
universal: "https://link.bitpay.com/wc",
|
|
889
|
+
store: {
|
|
890
|
+
ios: "https://bitpay.onelink.me/Cenw/ejjaw7bs",
|
|
891
|
+
android: "https://bitpay.onelink.me/Cenw/ejjaw7bs"
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
rabby: {
|
|
895
|
+
native: "rabby://",
|
|
896
|
+
scheme: "rabby://wc",
|
|
897
|
+
store: {
|
|
898
|
+
ios: "https://apps.apple.com/us/app/rabby-wallet-crypto-evm/id6474381673",
|
|
899
|
+
android: "https://play.google.com/store/apps/details?id=com.debank.rabbymobile"
|
|
900
|
+
}
|
|
901
|
+
},
|
|
663
902
|
// Bybit's WC deep link nests the uri inside a targetUrl wrapper (bybitapp://open/route?targetUrl=by://web3/walletconnect/wc?uri=...), which the `${scheme}?uri=` builder can't express — QR/scan connect only.
|
|
664
|
-
bybit: {
|
|
665
|
-
|
|
666
|
-
|
|
903
|
+
bybit: {
|
|
904
|
+
store: {
|
|
905
|
+
ios: "https://apps.apple.com/us/app/bybit-buy-trade-crypto/id1488296980",
|
|
906
|
+
android: "https://play.google.com/store/apps/details?id=com.bybit.app"
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
binance: {
|
|
910
|
+
native: "bnc://app.binance.com/cedefi/",
|
|
911
|
+
scheme: "bnc://app.binance.com/cedefi/wc",
|
|
912
|
+
store: {
|
|
913
|
+
ios: "https://apps.apple.com/us/app/id1436799971",
|
|
914
|
+
android: "https://play.google.com/store/apps/details?id=com.binance.dev"
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
gate: {
|
|
918
|
+
native: "gtweb3wallet://",
|
|
919
|
+
scheme: "gtweb3wallet://wc",
|
|
920
|
+
store: {
|
|
921
|
+
ios: "https://apps.apple.com/us/app/gate-io-buy-bitcoin-crypto/id1294998195",
|
|
922
|
+
android: "https://play.google.com/store/apps/details?id=com.gateio.gateio"
|
|
923
|
+
}
|
|
924
|
+
},
|
|
667
925
|
// Core: `core://` scheme not corroborated to 2 sources — QR/scan connect only.
|
|
668
|
-
core: {
|
|
926
|
+
core: {
|
|
927
|
+
store: {
|
|
928
|
+
ios: "https://apps.apple.com/us/app/core-wallet/id6443685999",
|
|
929
|
+
android: "https://play.google.com/store/apps/details?id=com.avaxwallet"
|
|
930
|
+
}
|
|
931
|
+
},
|
|
669
932
|
// Backpack: `backpack://` scheme not corroborated to 2 sources — QR/scan connect only.
|
|
670
|
-
backpack: {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
933
|
+
backpack: {
|
|
934
|
+
store: {
|
|
935
|
+
ios: "https://apps.apple.com/us/app/backpack-wallet-exchange/id6445964121",
|
|
936
|
+
android: "https://play.google.com/store/apps/details?id=app.backpack.mobile"
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
frontier: {
|
|
940
|
+
native: "frontier://",
|
|
941
|
+
scheme: "frontier://wc",
|
|
942
|
+
store: {
|
|
943
|
+
ios: "https://apps.apple.com/us/app/frontier-crypto-defi-wallet/id1482380988",
|
|
944
|
+
android: "https://play.google.com/store/apps/details?id=com.frontierwallet"
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
onekey: {
|
|
948
|
+
native: "onekey-wallet://",
|
|
949
|
+
scheme: "onekey-wallet://wc",
|
|
950
|
+
store: {
|
|
951
|
+
ios: "https://apps.apple.com/us/app/onekey-open-source-wallet/id1609559473",
|
|
952
|
+
android: "https://play.google.com/store/apps/details?id=so.onekey.app.wallet"
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
kraken: {
|
|
956
|
+
native: "krakenwallet://",
|
|
957
|
+
scheme: "krakenwallet://wc",
|
|
958
|
+
store: {
|
|
959
|
+
ios: "https://apps.apple.com/us/app/kraken-wallet/id1626327149",
|
|
960
|
+
android: "https://play.google.com/store/apps/details?id=com.kraken.superwallet"
|
|
961
|
+
}
|
|
962
|
+
},
|
|
963
|
+
uniswap: {
|
|
964
|
+
native: "uniswap://",
|
|
965
|
+
scheme: "uniswap://wc",
|
|
966
|
+
store: {
|
|
967
|
+
ios: "https://apps.apple.com/us/app/uniswap-crypto-nft-wallet/id6443944476",
|
|
968
|
+
android: "https://play.google.com/store/apps/details?id=com.uniswap.mobile"
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
omni: {
|
|
972
|
+
native: "omni://",
|
|
973
|
+
scheme: "omni://wc",
|
|
974
|
+
store: {
|
|
975
|
+
ios: "https://apps.apple.com/us/app/omni-web3-wallet/id1569375204",
|
|
976
|
+
android: "https://play.google.com/store/apps/details?id=fi.steakwallet.app"
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
mew: {
|
|
980
|
+
universal: "https://mewwallet.com/wc",
|
|
981
|
+
store: {
|
|
982
|
+
ios: "https://apps.apple.com/app/id1464614025",
|
|
983
|
+
android: "https://play.google.com/store/apps/details?id=com.myetherwallet.mewwallet"
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
foxwallet: {
|
|
987
|
+
native: "foxwallet://",
|
|
988
|
+
scheme: "foxwallet://wc",
|
|
989
|
+
universal: "https://link.foxwallet.com/wc",
|
|
990
|
+
store: {
|
|
991
|
+
ios: "https://apps.apple.com/app/foxwallet-crypto-web3/id1590983231",
|
|
992
|
+
android: "https://play.google.com/store/apps/details?id=com.foxwallet.play"
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
nova: {
|
|
996
|
+
native: "novawallet://",
|
|
997
|
+
scheme: "novawallet://wc",
|
|
998
|
+
store: {
|
|
999
|
+
ios: "https://apps.apple.com/us/app/nova-polkadot-wallet/id1597119355",
|
|
1000
|
+
android: "https://play.google.com/store/apps/details?id=io.novafoundation.nova.market"
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
subwallet: {
|
|
1004
|
+
native: "subwallet://",
|
|
1005
|
+
scheme: "subwallet://wc",
|
|
1006
|
+
store: {
|
|
1007
|
+
ios: "https://apps.apple.com/us/app/subwallet-polkadot-wallet/id1633050285",
|
|
1008
|
+
android: "https://play.google.com/store/apps/details?id=app.subwallet.mobile"
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
safe: {
|
|
1012
|
+
native: "safe://",
|
|
1013
|
+
scheme: "safe://wc",
|
|
1014
|
+
store: {
|
|
1015
|
+
ios: "https://apps.apple.com/us/app/safe-mobile/id6748754793",
|
|
1016
|
+
android: "https://play.google.com/store/apps/details?id=global.safe.mobileapp"
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
robinhood: {
|
|
1020
|
+
native: "robinhood-wallet://",
|
|
1021
|
+
scheme: "robinhood-wallet://wc",
|
|
1022
|
+
store: {
|
|
1023
|
+
ios: "https://apps.apple.com/us/app/robinhood-wallet-swap-crypto/id1634080733",
|
|
1024
|
+
android: "https://play.google.com/store/apps/details?id=com.robinhood.gateway"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
tangem: {
|
|
1028
|
+
native: "tangem://",
|
|
1029
|
+
scheme: "tangem://wc",
|
|
1030
|
+
store: {
|
|
1031
|
+
ios: "https://apps.apple.com/app/tangem/id1354868448",
|
|
1032
|
+
android: "https://play.google.com/store/apps/details?id=com.tangem.wallet"
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
683
1035
|
// Trezor Suite: WalletConnect pairing is QR/paste-into-Suite (no corroborated custom scheme) — QR connect only.
|
|
684
|
-
trezor: {
|
|
685
|
-
|
|
1036
|
+
trezor: {
|
|
1037
|
+
store: {
|
|
1038
|
+
ios: "https://apps.apple.com/us/app/trezor-suite/id1631884497",
|
|
1039
|
+
android: "https://play.google.com/store/apps/details?id=io.trezor.suite"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
kucoin: {
|
|
1043
|
+
native: "kucoin://",
|
|
1044
|
+
scheme: "kucoin:///wallet/walletConnect",
|
|
1045
|
+
store: {
|
|
1046
|
+
ios: "https://apps.apple.com/app/kucoin-buy-bitcoin-crypto/id1378956601",
|
|
1047
|
+
android: "https://play.google.com/store/apps/details?id=com.kubi.kucoin"
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
686
1050
|
// Jupiter (Solana): no corroborated WC deep-link scheme — QR connect only.
|
|
687
|
-
jupiter: {
|
|
688
|
-
|
|
1051
|
+
jupiter: {
|
|
1052
|
+
store: {
|
|
1053
|
+
ios: "https://apps.apple.com/us/app/jupiter-solana-swap-wallet/id6484069059",
|
|
1054
|
+
android: "https://play.google.com/store/apps/details?id=ag.jup.jupiter.android"
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
zengo: {
|
|
1058
|
+
native: "zengo://get.zengo.com/",
|
|
1059
|
+
scheme: "zengo://get.zengo.com/wc",
|
|
1060
|
+
store: {
|
|
1061
|
+
ios: "https://apps.apple.com/us/app/zengo-crypto-bitcoin-wallet/id1440147115",
|
|
1062
|
+
android: "https://play.google.com/store/apps/details?id=com.zengo.wallet"
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
689
1065
|
// Bitcoin.com Wallet: no corroborated WC deep-link scheme — QR connect only.
|
|
690
|
-
bitcoincom: {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
1066
|
+
bitcoincom: {
|
|
1067
|
+
store: {
|
|
1068
|
+
ios: "https://apps.apple.com/us/app/bitcoin-wallet-by-bitcoin-com/id1252903728",
|
|
1069
|
+
android: "https://play.google.com/store/apps/details?id=com.bitcoin.mwallet"
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
keplr: {
|
|
1073
|
+
native: "keplrwallet://",
|
|
1074
|
+
scheme: "keplrwallet://wcV2",
|
|
1075
|
+
store: {
|
|
1076
|
+
ios: "https://apps.apple.com/us/app/keplr-wallet/id1567851089",
|
|
1077
|
+
android: "https://play.google.com/store/apps/details?id=com.chainapsis.keplr"
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
cake: {
|
|
1081
|
+
native: "cakewallet://",
|
|
1082
|
+
scheme: "cakewallet://wc",
|
|
1083
|
+
store: {
|
|
1084
|
+
ios: "https://apps.apple.com/us/app/cake-wallet/id1334702542",
|
|
1085
|
+
android: "https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet"
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
unstoppable: {
|
|
1089
|
+
native: "unstoppable.money://",
|
|
1090
|
+
scheme: "unstoppable.money://wc",
|
|
1091
|
+
store: {
|
|
1092
|
+
ios: "https://apps.apple.com/us/app/unstoppable-crypto-wallet/id1447619907",
|
|
1093
|
+
android: "https://play.google.com/store/apps/details?id=io.horizontalsystems.bankwallet"
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
bifrost: {
|
|
1097
|
+
native: "bifrostwallet://",
|
|
1098
|
+
scheme: "bifrostwallet://wc",
|
|
1099
|
+
store: {
|
|
1100
|
+
ios: "https://apps.apple.com/us/app/bifrost-wallet/id1577198351",
|
|
1101
|
+
android: "https://play.google.com/store/apps/details?id=com.bifrostwallet.app"
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
pintu: {
|
|
1105
|
+
native: "pintu://web3wallet",
|
|
1106
|
+
scheme: "pintu://web3wallet/wc",
|
|
1107
|
+
store: {
|
|
1108
|
+
ios: "https://apps.apple.com/id/app/pintu-buy-invest-crypto/id1494119678",
|
|
1109
|
+
android: "https://play.google.com/store/apps/details?id=com.valar.pintu"
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
hot: {
|
|
1113
|
+
native: "hotwallet://",
|
|
1114
|
+
scheme: "hotwallet://wc",
|
|
1115
|
+
store: {
|
|
1116
|
+
ios: "https://apps.apple.com/us/app/hot-wallet/id6740916148",
|
|
1117
|
+
android: "https://play.google.com/store/apps/details?id=app.herewallet.hot"
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
arculus: {
|
|
1121
|
+
native: "arculuswc://",
|
|
1122
|
+
scheme: "arculuswc://wc",
|
|
1123
|
+
universal: "https://gw.arculus.co/app/wc",
|
|
1124
|
+
store: {
|
|
1125
|
+
ios: "https://apps.apple.com/us/app/arculus-wallet/id1575425801",
|
|
1126
|
+
android: "https://play.google.com/store/apps/details?id=co.arculus.wallet.android"
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
698
1129
|
};
|
|
699
1130
|
|
|
700
1131
|
// src/connectors/walletconnect/registry.ts
|
|
@@ -820,15 +1251,17 @@ var WalletConnectConnector = class extends BaseConnector {
|
|
|
820
1251
|
const link = this.links[req.walletId];
|
|
821
1252
|
if (link) {
|
|
822
1253
|
openWallet(link, uri);
|
|
823
|
-
void detectAppOpen(this.options.openTimeoutMs ?? 2e3).then(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1254
|
+
void detectAppOpen(this.options.openTimeoutMs ?? 2e3).then(
|
|
1255
|
+
(opened) => {
|
|
1256
|
+
if (!opened)
|
|
1257
|
+
this.emit({
|
|
1258
|
+
type: "wallet_open_failed",
|
|
1259
|
+
walletId: req.walletId,
|
|
1260
|
+
uri,
|
|
1261
|
+
store: link.store
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
);
|
|
832
1265
|
}
|
|
833
1266
|
}
|
|
834
1267
|
const pairingTopic = parseUri(uri).topic;
|
|
@@ -836,7 +1269,12 @@ var WalletConnectConnector = class extends BaseConnector {
|
|
|
836
1269
|
void client.core.pairing.disconnect({ topic: pairingTopic }).catch(() => {
|
|
837
1270
|
});
|
|
838
1271
|
});
|
|
839
|
-
const connection = this.toConnection(
|
|
1272
|
+
const connection = this.toConnection(
|
|
1273
|
+
client,
|
|
1274
|
+
req.walletId,
|
|
1275
|
+
session,
|
|
1276
|
+
req.namespace
|
|
1277
|
+
);
|
|
840
1278
|
this.topics.set(req.walletId, session.topic);
|
|
841
1279
|
this.persist();
|
|
842
1280
|
return connection;
|
|
@@ -860,7 +1298,12 @@ var WalletConnectConnector = class extends BaseConnector {
|
|
|
860
1298
|
const client = this.client;
|
|
861
1299
|
if (client) {
|
|
862
1300
|
await Promise.allSettled(
|
|
863
|
-
client.session.getAll().map(
|
|
1301
|
+
client.session.getAll().map(
|
|
1302
|
+
(s) => client.disconnect({
|
|
1303
|
+
topic: s.topic,
|
|
1304
|
+
reason: getSdkError("USER_DISCONNECTED")
|
|
1305
|
+
})
|
|
1306
|
+
)
|
|
864
1307
|
);
|
|
865
1308
|
}
|
|
866
1309
|
this.topics.clear();
|
|
@@ -928,7 +1371,8 @@ var WalletConnectConnector = class extends BaseConnector {
|
|
|
928
1371
|
load() {
|
|
929
1372
|
try {
|
|
930
1373
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
931
|
-
if (raw)
|
|
1374
|
+
if (raw)
|
|
1375
|
+
this.topics = new Map(JSON.parse(raw));
|
|
932
1376
|
} catch {
|
|
933
1377
|
}
|
|
934
1378
|
}
|
|
@@ -938,7 +1382,10 @@ function firstNamespace(session) {
|
|
|
938
1382
|
if (!name) return null;
|
|
939
1383
|
const v = session.namespaces[name];
|
|
940
1384
|
if (!v) return null;
|
|
941
|
-
return {
|
|
1385
|
+
return {
|
|
1386
|
+
name,
|
|
1387
|
+
value: { chains: v.chains, methods: v.methods, events: v.events }
|
|
1388
|
+
};
|
|
942
1389
|
}
|
|
943
1390
|
function withSignal2(promise, signal, onAbort) {
|
|
944
1391
|
if (!signal) return promise;
|
|
@@ -969,7 +1416,8 @@ function withSignal2(promise, signal, onAbort) {
|
|
|
969
1416
|
function injectedRdnsMap(sdkServed) {
|
|
970
1417
|
const map = {};
|
|
971
1418
|
for (const w of WALLET_CATALOG) {
|
|
972
|
-
if (w.rdns && w.namespaces.includes("eip155") && !sdkServed.has(w.id))
|
|
1419
|
+
if (w.rdns && w.namespaces.includes("eip155") && !sdkServed.has(w.id))
|
|
1420
|
+
map[w.id] = w.rdns;
|
|
973
1421
|
}
|
|
974
1422
|
return map;
|
|
975
1423
|
}
|
|
@@ -984,7 +1432,9 @@ function createConnectors(config) {
|
|
|
984
1432
|
return [
|
|
985
1433
|
...sdk,
|
|
986
1434
|
new InjectedConnector(injectedRdnsMap(sdkServed)),
|
|
987
|
-
new WalletConnectConnector(app, {
|
|
1435
|
+
new WalletConnectConnector(app, {
|
|
1436
|
+
projectId: config.walletConnectProjectId
|
|
1437
|
+
})
|
|
988
1438
|
];
|
|
989
1439
|
}
|
|
990
1440
|
var LydianConnect = class {
|
|
@@ -996,7 +1446,9 @@ var LydianConnect = class {
|
|
|
996
1446
|
}
|
|
997
1447
|
async connect(input) {
|
|
998
1448
|
if (input.chainId === void 0 || input.chainId === null) {
|
|
999
|
-
throw new Error(
|
|
1449
|
+
throw new Error(
|
|
1450
|
+
'connect() requires a chainId (a number like 137 or an "eip155:<id>" string)'
|
|
1451
|
+
);
|
|
1000
1452
|
}
|
|
1001
1453
|
return this.manager.connect({
|
|
1002
1454
|
walletId: input.walletId,
|