@web3jskit/walletkit 0.6.2 → 0.6.3
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/CHANGELOG.md +51 -0
- package/CHANGELOG.zh.md +50 -0
- package/README.md +17 -8
- package/README.zh.md +17 -8
- package/dist/{btcConnector-DyocBque.mjs → btcConnector-B-FBz618.mjs} +2 -2
- package/dist/{btcConnector-Ip851Zzx.js → btcConnector-BmBSGGDG.js} +1 -1
- package/dist/{btcConnector-ZZavkQAJ.mjs → btcConnector-CoDLrD-5.mjs} +2 -2
- package/dist/{btcConnector-CLm-gxx3.js → btcConnector-D6hRNl6J.js} +1 -1
- package/dist/core/connectors/connectorLoader.d.ts +1 -1
- package/dist/core/connectors/connectorLoader.d.ts.map +1 -1
- package/dist/core/connectors/createConnector.entry.d.ts +2 -0
- package/dist/core/connectors/createConnector.entry.d.ts.map +1 -0
- package/dist/core/connectors/createEvmConnectors.entry.d.ts +2 -0
- package/dist/core/connectors/createEvmConnectors.entry.d.ts.map +1 -0
- package/dist/createConnector.entry-C2ezrrEW.js +1 -0
- package/dist/createConnector.entry-CxyXzv78.mjs +4 -0
- package/dist/{createConnectors-BlSjbXr8.mjs → createConnectors-ADoTab9F.mjs} +79 -87
- package/dist/{createConnectors-C90GnGoD.mjs → createConnectors-DPb4fTuL.mjs} +174 -179
- package/dist/{createConnectors-DdVhGwOT.js → createConnectors-DvITc7A3.js} +2 -2
- package/dist/{createConnectors-C-XiQWnC.js → createConnectors-DzepxSHv.js} +3 -3
- package/dist/createEvmConnectors.entry-BEhiyNyg.mjs +4 -0
- package/dist/createEvmConnectors.entry-CgqSuemU.js +1 -0
- package/dist/{deepLinkConnector-GKwdlwJL.js → deepLinkConnector-1KSnxkrX.js} +1 -1
- package/dist/{deepLinkConnector-DH_Atv4n.js → deepLinkConnector-7KRiFI0W.js} +1 -1
- package/dist/{deepLinkConnector-DofAIemy.mjs → deepLinkConnector-AI0VLF-8.mjs} +1 -1
- package/dist/{deepLinkConnector-TxdCVtow.js → deepLinkConnector-B-M6QX4q.js} +1 -1
- package/dist/{deepLinkConnector-CtbmZOxo.js → deepLinkConnector-BeJUryP4.js} +1 -1
- package/dist/{deepLinkConnector-BTFq-fy4.mjs → deepLinkConnector-BpalZdJ0.mjs} +4 -4
- package/dist/{deepLinkConnector-8wywxaVw.mjs → deepLinkConnector-CO4p3xsf.mjs} +1 -1
- package/dist/{deepLinkConnector-BXBQDnmz.js → deepLinkConnector-ChrORWtA.js} +1 -1
- package/dist/{deepLinkConnector-CamW__vG.js → deepLinkConnector-D8rPZCzr.js} +1 -1
- package/dist/{deepLinkConnector-DndXk3_X.mjs → deepLinkConnector-DFrTWxB5.mjs} +1 -1
- package/dist/{deepLinkConnector-C_FpxXyQ.js → deepLinkConnector-DQYRdy1s.js} +1 -1
- package/dist/{deepLinkConnector-wZignBF4.mjs → deepLinkConnector-DxnaAx50.mjs} +1 -1
- package/dist/{deepLinkConnector-BoPREuPE.mjs → deepLinkConnector-OWmd-F6h.mjs} +1 -1
- package/dist/{deepLinkConnector-BNSwMCcK.mjs → deepLinkConnector-XCaUTjHC.mjs} +1 -1
- package/dist/{index-BYAhc19j.js → index-B7a9zLt1.js} +1 -1
- package/dist/{index-DcP0pe9L.mjs → index-BJQl8aKg.mjs} +15 -15
- package/dist/index-BNUh90Ws.js +44 -0
- package/dist/{index-Ca5U0KJA.mjs → index-BWBZ1f0K.mjs} +31 -31
- package/dist/{index-CYV63koi.js → index-C9mc2-wq.js} +1 -1
- package/dist/{index-Dyta9O3j.mjs → index-CAgSlROt.mjs} +9 -9
- package/dist/{index-D5CDP-Ja.mjs → index-g3j_3V8c.mjs} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +10 -10
- package/dist/index.js +1 -1
- package/dist/index.umd.js +15 -20
- package/dist/index2.css +1 -1
- package/dist/index3.css +1 -1
- package/dist/{silentConnect-BtDOIOBH.js → silentConnect-Dkz3iVLs.js} +1 -1
- package/dist/{silentConnect-Dwh-OCFz.mjs → silentConnect-Dl9do7n_.mjs} +2 -2
- package/dist/{tronConnector-1MzggiY6.mjs → tronConnector-BSEWGw1J.mjs} +2 -2
- package/dist/{tronConnector-CaAskj-A.mjs → tronConnector-BmK6mYOf.mjs} +2 -2
- package/dist/{tronConnector-D1XjDmX5.mjs → tronConnector-CzhOONmt.mjs} +2 -2
- package/dist/{tronConnector-CK8B1kxW.js → tronConnector-DBUzHKbS.js} +1 -1
- package/dist/{tronConnector-C2XAKGru.js → tronConnector-D_DSkWfc.js} +1 -1
- package/dist/{tronConnector-in2hmjSs.js → tronConnector-Dgq9lokx.js} +1 -1
- package/package.json +4 -2
- package/dist/index-Bo_G8w5V.js +0 -44
- /package/dist/{index-Dqp1KqTh.js → index-DuT-f-Zv.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as g,
|
|
2
|
-
import { B as
|
|
3
|
-
import { n as
|
|
1
|
+
import { a as g, m as j, o as I, C as y, S as v, e as N, g as Y, p as V } from "./index-BWBZ1f0K.mjs";
|
|
2
|
+
import { B as S, U as T, a as X, c as M, E as G } from "./createConnectors-DPb4fTuL.mjs";
|
|
3
|
+
import { n as W, c as Q } from "./walletName-BwayBopz.mjs";
|
|
4
4
|
const E = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
5
5
|
<rect width="32" height="32" rx="8" fill="#5F606B"/>
|
|
6
6
|
<g clip-path="url(#clip0_4076_21521)">
|
|
@@ -91,7 +91,7 @@ const E = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="ht
|
|
|
91
91
|
return o.trim();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
},
|
|
94
|
+
}, k = (t, o) => {
|
|
95
95
|
var n, e, s;
|
|
96
96
|
const i = [
|
|
97
97
|
t == null ? void 0 : t.publicKey,
|
|
@@ -107,7 +107,7 @@ const E = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="ht
|
|
|
107
107
|
if (r) return r;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
class
|
|
110
|
+
class U extends S {
|
|
111
111
|
constructor(o, i) {
|
|
112
112
|
super(o, i), this.addEventListener = async () => {
|
|
113
113
|
const n = await this.getProvider();
|
|
@@ -116,7 +116,7 @@ class F extends V {
|
|
|
116
116
|
const n = await this.getProvider();
|
|
117
117
|
n.off("connect", this.__onConnect), n.off("accountChanged", this.__onAccountsChanged), n.off("chainChanged", this.__onChainChanged), n.off("disconnect", this.__onDisconnect);
|
|
118
118
|
}, this.__onAccountsChanged = (n) => {
|
|
119
|
-
const e =
|
|
119
|
+
const e = k(n);
|
|
120
120
|
e && this.connectSuccess(e), this.walletEventEmitter.emit("accountChanged", e);
|
|
121
121
|
}, this.__onChainChanged = (n, ...e) => {
|
|
122
122
|
this.walletEventEmitter.emit("chainChanged", e);
|
|
@@ -128,7 +128,7 @@ class F extends V {
|
|
|
128
128
|
try {
|
|
129
129
|
const n = await this.getProvider();
|
|
130
130
|
this.addEventListener(), this.beforeConnecting();
|
|
131
|
-
const e = await n.connect(), s =
|
|
131
|
+
const e = await n.connect(), s = k(e, n);
|
|
132
132
|
if (!s)
|
|
133
133
|
throw new Error("Failed to resolve Solana wallet address");
|
|
134
134
|
return this.connectSuccess(s), s;
|
|
@@ -145,7 +145,7 @@ class F extends V {
|
|
|
145
145
|
}
|
|
146
146
|
}, this.getAccounts = async () => {
|
|
147
147
|
const n = await this.getProvider();
|
|
148
|
-
return
|
|
148
|
+
return k(void 0, n);
|
|
149
149
|
}, this.getChainId = async () => await (await this.getProvider()).request({ method: "getClusterNodes", params: [] }), this.switchChain = async () => {
|
|
150
150
|
}, this.signMessage = async (n) => {
|
|
151
151
|
const e = await this.getProvider(), s = new TextEncoder().encode(n);
|
|
@@ -153,13 +153,13 @@ class F extends V {
|
|
|
153
153
|
}, this.signTransaction = async (n) => await (await this.getProvider()).signTransaction(n), this.signAllTransactions = async (n) => await (await this.getProvider()).signAllTransactions(n), this.sendTransaction = async (n, e = {}) => await (await this.getProvider()).signAndSendTransaction(n, e), this.signAndSendAllTransactions = async (n, e = {}) => await (await this.getProvider()).signAndSendAllTransactions(n, e), this.handleNotification = async (n) => await (await this.getProvider()).handleNotification(n), this.removeAllListeners = async (n) => (await this.getProvider()).removeAllListeners(n);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
const tt = "solana:signAndSendTransaction", nt = "solana:signTransaction", et = "standard:connect",
|
|
156
|
+
const tt = "solana:signAndSendTransaction", nt = "solana:signTransaction", et = "standard:connect", A = (t) => {
|
|
157
157
|
if (typeof (t == null ? void 0 : t.address) == "string" && t.address)
|
|
158
158
|
return t.address;
|
|
159
|
-
},
|
|
159
|
+
}, C = (t) => ({
|
|
160
160
|
toString: () => t,
|
|
161
161
|
toBase58: () => t
|
|
162
|
-
}),
|
|
162
|
+
}), B = (t) => {
|
|
163
163
|
if (t instanceof Uint8Array) return t;
|
|
164
164
|
if (t != null && t.serialize) {
|
|
165
165
|
const o = t.serialize({
|
|
@@ -203,10 +203,10 @@ function st(t) {
|
|
|
203
203
|
const r = t.features["standard:connect"];
|
|
204
204
|
if (!(r != null && r.connect))
|
|
205
205
|
throw new Error("Wallet Standard connect is not available");
|
|
206
|
-
const a = await r.connect(), d =
|
|
206
|
+
const a = await r.connect(), d = A(((l = a == null ? void 0 : a.accounts) == null ? void 0 : l[0]) ?? t.accounts[0]);
|
|
207
207
|
if (!d)
|
|
208
208
|
throw new Error("Failed to resolve Solana wallet address");
|
|
209
|
-
return n.publicKey =
|
|
209
|
+
return n.publicKey = C(d), i("connect", { publicKey: n.publicKey }), { publicKey: n.publicKey };
|
|
210
210
|
},
|
|
211
211
|
disconnect: async () => {
|
|
212
212
|
var r, a;
|
|
@@ -222,7 +222,7 @@ function st(t) {
|
|
|
222
222
|
throw new Error("solana:signTransaction is not supported");
|
|
223
223
|
const [{ signedTransaction: d }] = await a.signTransaction({
|
|
224
224
|
account: t.accounts[0],
|
|
225
|
-
transaction:
|
|
225
|
+
transaction: B(r)
|
|
226
226
|
});
|
|
227
227
|
return ot(r, d);
|
|
228
228
|
},
|
|
@@ -233,7 +233,7 @@ function st(t) {
|
|
|
233
233
|
throw new Error("solana:signAndSendTransaction is not supported");
|
|
234
234
|
const [{ signature: l }] = await d.signAndSendTransaction({
|
|
235
235
|
account: t.accounts[0],
|
|
236
|
-
transaction:
|
|
236
|
+
transaction: B(r),
|
|
237
237
|
options: a
|
|
238
238
|
});
|
|
239
239
|
return { signature: l };
|
|
@@ -252,18 +252,18 @@ function st(t) {
|
|
|
252
252
|
},
|
|
253
253
|
handleNotification: async () => {
|
|
254
254
|
}
|
|
255
|
-
}, e =
|
|
256
|
-
return e && (n.publicKey =
|
|
255
|
+
}, e = A(t.accounts[0]);
|
|
256
|
+
return e && (n.publicKey = C(e)), (c = (s = t.features["standard:events"]) == null ? void 0 : s.on) == null || c.call(s, "change", (r) => {
|
|
257
257
|
var d;
|
|
258
|
-
const a =
|
|
258
|
+
const a = A(((d = r == null ? void 0 : r.accounts) == null ? void 0 : d[0]) ?? t.accounts[0]);
|
|
259
259
|
if (a) {
|
|
260
|
-
n.publicKey =
|
|
260
|
+
n.publicKey = C(a), i("accountChanged", { publicKey: n.publicKey });
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
n.publicKey = void 0, i("disconnect");
|
|
264
264
|
}), n;
|
|
265
265
|
}
|
|
266
|
-
class rt extends
|
|
266
|
+
class rt extends U {
|
|
267
267
|
constructor(o) {
|
|
268
268
|
super(
|
|
269
269
|
{
|
|
@@ -287,10 +287,10 @@ async function ct() {
|
|
|
287
287
|
return [];
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
var
|
|
290
|
+
var F = /* @__PURE__ */ ((t) => (t.mainnet = "0x2b6653dc", t.nile = "0xcd8690dc", t.shasta = "0x94a9059e", t))(F || {});
|
|
291
291
|
const at = (t) => {
|
|
292
292
|
const o = typeof t == "string" && t.startsWith("0x") ? t : `0x${Number(t).toString(16)}`;
|
|
293
|
-
return Object.values(
|
|
293
|
+
return Object.values(F).find((i) => i.toLowerCase() === o.toLowerCase()) ?? o;
|
|
294
294
|
}, dt = (t) => typeof t == "string" && t.startsWith("0x") ? Number.parseInt(t, 16) : Number(t), lt = (t) => {
|
|
295
295
|
var e, s;
|
|
296
296
|
const o = [], i = /* @__PURE__ */ new Set(), n = (c) => {
|
|
@@ -300,9 +300,9 @@ const at = (t) => {
|
|
|
300
300
|
return n(t), typeof window < "u" && (n(window.okxwallet), n((e = window.okxwallet) == null ? void 0 : e.tron), n((s = window.okxwallet) == null ? void 0 : s.tronLink), n(window.tron), n(window.tronLink)), o;
|
|
301
301
|
}, ht = (t) => {
|
|
302
302
|
const o = t == null ? void 0 : t.code, i = String((t == null ? void 0 : t.message) || "").toLowerCase();
|
|
303
|
-
return o ===
|
|
304
|
-
},
|
|
305
|
-
class
|
|
303
|
+
return o === X.code || o === -32601 || i.includes("not support") || i.includes("unsupported");
|
|
304
|
+
}, b = (t) => t instanceof Error ? t : new Error((t == null ? void 0 : t.message) || "Switch network failed");
|
|
305
|
+
class R extends S {
|
|
306
306
|
constructor(o, i) {
|
|
307
307
|
super(o, i), this.handleTronLinkEvent = (n) => {
|
|
308
308
|
var s, c, r, a;
|
|
@@ -462,16 +462,16 @@ class z extends V {
|
|
|
462
462
|
await l(u), this.store.getState().setCurrentNetwork(c);
|
|
463
463
|
return;
|
|
464
464
|
} catch (h) {
|
|
465
|
-
if ((h == null ? void 0 : h.code) ===
|
|
466
|
-
throw new b(
|
|
465
|
+
if ((h == null ? void 0 : h.code) === T.code)
|
|
466
|
+
throw new T(b(h));
|
|
467
467
|
if (ht(h)) {
|
|
468
468
|
d = h;
|
|
469
469
|
continue;
|
|
470
470
|
}
|
|
471
471
|
throw h;
|
|
472
472
|
}
|
|
473
|
-
throw new
|
|
474
|
-
|
|
473
|
+
throw new X(
|
|
474
|
+
b(d) || new Error(
|
|
475
475
|
"This wallet does not support switching TRON networks. Please switch to the target network in the wallet."
|
|
476
476
|
),
|
|
477
477
|
{ method: "wallet_switchEthereumChain" }
|
|
@@ -479,7 +479,7 @@ class z extends V {
|
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
const
|
|
482
|
+
const Z = (t) => {
|
|
483
483
|
var o;
|
|
484
484
|
return (t == null ? void 0 : t.tronWeb) ?? ((o = t == null ? void 0 : t.tron) == null ? void 0 : o.tronWeb) ?? (typeof window < "u" ? window.tronWeb : void 0);
|
|
485
485
|
};
|
|
@@ -501,30 +501,30 @@ function ut(t) {
|
|
|
501
501
|
}
|
|
502
502
|
return await i({ method: "tron_requestAccounts" });
|
|
503
503
|
}
|
|
504
|
-
if ((a = (r =
|
|
504
|
+
if ((a = (r = Z(n)) == null ? void 0 : r.defaultAddress) != null && a.base58)
|
|
505
505
|
return { code: 200 };
|
|
506
506
|
throw new Error("TRON wallet is not authorized");
|
|
507
507
|
}
|
|
508
508
|
if (!i)
|
|
509
509
|
throw new Error("TRON provider.request is not available");
|
|
510
510
|
return i(c);
|
|
511
|
-
} : e === "tronWeb" ?
|
|
511
|
+
} : e === "tronWeb" ? Z(n) ?? n.tronWeb : Reflect.get(n, e, s);
|
|
512
512
|
}
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
-
const
|
|
516
|
-
if (t ===
|
|
515
|
+
const z = "Browser Wallet", pt = (t, o) => {
|
|
516
|
+
if (t === z)
|
|
517
517
|
return L;
|
|
518
518
|
if (o)
|
|
519
519
|
return o;
|
|
520
520
|
const i = v.find(
|
|
521
|
-
(n) =>
|
|
521
|
+
(n) => W(n.name) === W(t)
|
|
522
522
|
);
|
|
523
523
|
return (i == null ? void 0 : i.icon) || L;
|
|
524
524
|
};
|
|
525
|
-
class ft extends
|
|
525
|
+
class ft extends R {
|
|
526
526
|
constructor(o, i) {
|
|
527
|
-
const n = o.name ||
|
|
527
|
+
const n = o.name || z;
|
|
528
528
|
super(
|
|
529
529
|
{
|
|
530
530
|
name: n,
|
|
@@ -534,7 +534,7 @@ class ft extends z {
|
|
|
534
534
|
), this.id = o.rdns || o.uuid || n, this.connectorType = g.Installed;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
const
|
|
537
|
+
const K = "TIP6963:announceProvider", wt = "TIP6963:requestProvider", gt = 80, D = () => {
|
|
538
538
|
if (typeof window > "u") return !1;
|
|
539
539
|
const t = window;
|
|
540
540
|
return "tron" in t || "tronLink" in t || "tronWeb" in t;
|
|
@@ -559,11 +559,11 @@ async function vt() {
|
|
|
559
559
|
const e = ((s = n.info) == null ? void 0 : s.rdns) || ((c = n.info) == null ? void 0 : c.uuid) || ((r = n.info) == null ? void 0 : r.name);
|
|
560
560
|
e && t.set(e, n);
|
|
561
561
|
};
|
|
562
|
-
return window.addEventListener(
|
|
562
|
+
return window.addEventListener(K, o), window.dispatchEvent(new Event(wt)), await new Promise((i) => setTimeout(i, gt)), window.removeEventListener(K, o), [...t.values()].map(
|
|
563
563
|
(i) => new ft(i.info ?? {}, i.provider)
|
|
564
564
|
);
|
|
565
565
|
}
|
|
566
|
-
class
|
|
566
|
+
class O extends S {
|
|
567
567
|
constructor(o) {
|
|
568
568
|
var n;
|
|
569
569
|
const i = (n = window.okxwallet) == null ? void 0 : n.bitcoin;
|
|
@@ -630,32 +630,32 @@ class H extends V {
|
|
|
630
630
|
}, this.connectorType = i ? g.Installed : g.More;
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
const
|
|
634
|
-
Bitget_Wallet_DeepLink: () => import("./deepLinkConnector-
|
|
635
|
-
Bitget_Wallet_Tron: () => import("./tronConnector-
|
|
636
|
-
Bitget_Wallet_Bitcoin: () => import("./btcConnector-
|
|
637
|
-
MetaMask_DeepLink: () => import("./deepLinkConnector-
|
|
638
|
-
MetaMask_Tron: () => import("./tronConnector-
|
|
639
|
-
OKX_Wallet_Tron: () => import("./tronConnector-
|
|
640
|
-
OKX_Wallet_Bitcoin: async () => ({ default:
|
|
641
|
-
OKX_Wallet_DeepLink: () => import("./deepLinkConnector-
|
|
642
|
-
Phantom_Bitcoin: () => import("./btcConnector-
|
|
643
|
-
Phantom_DeepLink: () => import("./deepLinkConnector-
|
|
644
|
-
TokenPocket_DeepLink: () => import("./deepLinkConnector-
|
|
645
|
-
TronLink_DeepLink: () => import("./deepLinkConnector-
|
|
646
|
-
Trust_Wallet_DeepLink: () => import("./deepLinkConnector-
|
|
633
|
+
const H = {
|
|
634
|
+
Bitget_Wallet_DeepLink: () => import("./deepLinkConnector-AI0VLF-8.mjs"),
|
|
635
|
+
Bitget_Wallet_Tron: () => import("./tronConnector-CzhOONmt.mjs"),
|
|
636
|
+
Bitget_Wallet_Bitcoin: () => import("./btcConnector-CoDLrD-5.mjs"),
|
|
637
|
+
MetaMask_DeepLink: () => import("./deepLinkConnector-OWmd-F6h.mjs"),
|
|
638
|
+
MetaMask_Tron: () => import("./tronConnector-BSEWGw1J.mjs"),
|
|
639
|
+
OKX_Wallet_Tron: () => import("./tronConnector-BmK6mYOf.mjs"),
|
|
640
|
+
OKX_Wallet_Bitcoin: async () => ({ default: O }),
|
|
641
|
+
OKX_Wallet_DeepLink: () => import("./deepLinkConnector-DFrTWxB5.mjs"),
|
|
642
|
+
Phantom_Bitcoin: () => import("./btcConnector-B-FBz618.mjs"),
|
|
643
|
+
Phantom_DeepLink: () => import("./deepLinkConnector-BpalZdJ0.mjs"),
|
|
644
|
+
TokenPocket_DeepLink: () => import("./deepLinkConnector-DxnaAx50.mjs"),
|
|
645
|
+
TronLink_DeepLink: () => import("./deepLinkConnector-CO4p3xsf.mjs"),
|
|
646
|
+
Trust_Wallet_DeepLink: () => import("./deepLinkConnector-XCaUTjHC.mjs")
|
|
647
647
|
};
|
|
648
|
-
class mt extends
|
|
648
|
+
class mt extends U {
|
|
649
649
|
constructor(o, i = "Browser Wallet", n = L) {
|
|
650
650
|
super({ name: i, icon: n }, o), this.id = i, this.connectorType = o ? g.Installed : g.More;
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
class kt extends
|
|
653
|
+
class kt extends R {
|
|
654
654
|
constructor(o, i = "Browser Wallet", n = L) {
|
|
655
655
|
super({ name: i, icon: n }, o), this.id = i, this.connectorType = o ? g.Installed : g.More;
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
class At extends
|
|
658
|
+
class At extends O {
|
|
659
659
|
constructor(o) {
|
|
660
660
|
super({
|
|
661
661
|
name: "Browser Wallet",
|
|
@@ -663,33 +663,33 @@ class At extends H {
|
|
|
663
663
|
}), this.provider = o, this.connectorType = o ? g.Installed : g.More;
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function J() {
|
|
667
667
|
var t;
|
|
668
668
|
return window.unisat ? window.unisat : window.bitkeep.unisat ? window.bitkeep.unisat : (t = window.okxwallet) != null && t.bitcoin ? window.okxwallet.bitcoin : window.BitcoinProvider ? window.BitcoinProvider : null;
|
|
669
669
|
}
|
|
670
|
-
const
|
|
670
|
+
const x = (t, o, i = "Browser Wallet") => {
|
|
671
671
|
const n = {
|
|
672
672
|
name: i,
|
|
673
673
|
icon: L,
|
|
674
674
|
rdns: "",
|
|
675
675
|
uuid: ""
|
|
676
676
|
};
|
|
677
|
-
return t === y.SOL ? new mt(o ?? window.solana, i) : t === y.Tron ? new kt(o ?? Lt(), i) : t === y.BTC ? new At(o ??
|
|
677
|
+
return t === y.SOL ? new mt(o ?? window.solana, i) : t === y.Tron ? new kt(o ?? Lt(), i) : t === y.BTC ? new At(o ?? J()) : new G({
|
|
678
678
|
info: n,
|
|
679
679
|
provider: o ?? window.ethereum
|
|
680
680
|
}, !0);
|
|
681
681
|
};
|
|
682
|
-
async function
|
|
683
|
-
return t === y.EVM ?
|
|
682
|
+
async function q(t) {
|
|
683
|
+
return t === y.EVM ? M() : t === y.SOL ? ct() : t === y.Tron ? vt() : [];
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const P = async (t, o) => {
|
|
686
686
|
const i = Q(
|
|
687
687
|
v.filter((e) => e.supportedChains.includes(t)),
|
|
688
688
|
o
|
|
689
689
|
);
|
|
690
690
|
return (await Promise.all(
|
|
691
691
|
i.map(async (e) => {
|
|
692
|
-
const s =
|
|
692
|
+
const s = H[`${e.name}_${t}`];
|
|
693
693
|
if (!s)
|
|
694
694
|
return {
|
|
695
695
|
...e,
|
|
@@ -700,29 +700,29 @@ const X = async (t, o) => {
|
|
|
700
700
|
})
|
|
701
701
|
)).filter(Boolean);
|
|
702
702
|
};
|
|
703
|
-
async function
|
|
703
|
+
async function St(t = y.EVM, o) {
|
|
704
704
|
t = t || y.EVM;
|
|
705
705
|
const i = (u) => u.filter(Boolean), n = (u) => {
|
|
706
|
-
const h = i(u), p = h.filter(
|
|
706
|
+
const h = i(u), p = h.filter(V);
|
|
707
707
|
return p.length ? p : h;
|
|
708
708
|
}, e = (u) => n(u);
|
|
709
709
|
if (N() && !Y()) {
|
|
710
|
-
const h = (await
|
|
710
|
+
const h = (await q(t)).filter(V);
|
|
711
711
|
if (h.length)
|
|
712
712
|
return i(h);
|
|
713
713
|
const p = await Promise.all(
|
|
714
714
|
v.filter((w) => w.deepLink).map(async (w) => {
|
|
715
|
-
const f = await
|
|
715
|
+
const f = await H[`${w.name}_DeepLink`]();
|
|
716
716
|
return new f.default(w);
|
|
717
717
|
})
|
|
718
718
|
);
|
|
719
719
|
return e(p);
|
|
720
720
|
}
|
|
721
721
|
if (t === y.EVM) {
|
|
722
|
-
const u = window.ethereum ?
|
|
722
|
+
const u = window.ethereum ? x(t) : null;
|
|
723
723
|
let h = [];
|
|
724
724
|
try {
|
|
725
|
-
h = await
|
|
725
|
+
h = await M();
|
|
726
726
|
} catch (f) {
|
|
727
727
|
console.error("Failed to discover injected EVM wallets", f);
|
|
728
728
|
}
|
|
@@ -735,17 +735,17 @@ async function Ct(t = y.EVM, o) {
|
|
|
735
735
|
return e(i([...h, u, ...w]));
|
|
736
736
|
}
|
|
737
737
|
if (t === y.BTC) {
|
|
738
|
-
const u =
|
|
739
|
-
return p.forEach((
|
|
740
|
-
|
|
738
|
+
const u = J(), h = u ? x(t, u) : null, p = await P(t, []), w = [], f = [];
|
|
739
|
+
return p.forEach((m) => {
|
|
740
|
+
m.connectorType === g.Installed ? w.push(m) : f.push(m);
|
|
741
741
|
}), e(i([...w, h, ...f]));
|
|
742
742
|
}
|
|
743
|
-
const s = await
|
|
743
|
+
const s = await q(t), c = await P(
|
|
744
744
|
t,
|
|
745
745
|
s.map((u) => u.name)
|
|
746
746
|
), a = (t === y.SOL ? !!window.solana && s.length === 0 : D() && !s.some(
|
|
747
|
-
(u) =>
|
|
748
|
-
)) ?
|
|
747
|
+
(u) => W(u.name) === "browserwallet"
|
|
748
|
+
)) ? x(t) : null, d = s.filter(
|
|
749
749
|
(u) => u.connectorType === g.Installed
|
|
750
750
|
), l = [
|
|
751
751
|
...s.filter((u) => u.connectorType !== g.Installed),
|
|
@@ -753,16 +753,8 @@ async function Ct(t = y.EVM, o) {
|
|
|
753
753
|
];
|
|
754
754
|
return e([...d, a, ...l]);
|
|
755
755
|
}
|
|
756
|
-
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
757
|
-
__proto__: null,
|
|
758
|
-
createConnector: Ct,
|
|
759
|
-
discoverInstalled: W,
|
|
760
|
-
getBitcoinProvider: T,
|
|
761
|
-
normalizeWalletKey: m
|
|
762
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
763
756
|
export {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
Ct as c
|
|
757
|
+
F as C,
|
|
758
|
+
R as T,
|
|
759
|
+
St as c
|
|
768
760
|
};
|