@wormhole-foundation/wormhole-connect 2.5.0-beta.8-development → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/aptos-Cutllx5i.js +3 -0
- package/dist/assets/{ccip-DoYNnipC.js → ccip-C6cz5NqJ.js} +1 -1
- package/dist/assets/events-MYC_Tkdh.js +1 -0
- package/dist/assets/{evm-Cg9_Z6ON.js → evm-DzwJdvcV.js} +2 -2
- package/dist/assets/{evm-DSNDNefN.js → evm-LJDXipdh.js} +3 -3
- package/dist/assets/{index-Bhi-Ol-W.js → index-BECoIARf.js} +1 -1
- package/dist/assets/{index-TVGCRxSf.js → index-BO5vFz_J.js} +1 -1
- package/dist/assets/{index-IFf5IHmZ.js → index-BVJL1orJ.js} +1 -1
- package/dist/assets/{index-CuW_tQti.js → index-BwNyYZxM.js} +1 -1
- package/dist/assets/{index-CLAfmegc.js → index-C6UKJUdm.js} +1 -1
- package/dist/assets/index-CJZzjIow.js +1 -0
- package/dist/assets/{index-CItGJ_dO.js → index-CSiH4dly.js} +1 -1
- package/dist/assets/{index-CrZXNnmG.js → index-CqEHg303.js} +1 -1
- package/dist/assets/{index-Ba5OrqB6.js → index-D3R8fZfr.js} +1 -1
- package/dist/assets/{index-DPi-hS0A.js → index-Ds_BlDdN.js} +2 -2
- package/dist/assets/{index-7lgoK4KP.js → index-DwJjUFus.js} +1 -1
- package/dist/assets/{index-mE5izIg0.js → index-Dxpp9NXJ.js} +1 -1
- package/dist/assets/{index-DShwbc4p.js → index-EvC_Tjca.js} +1 -1
- package/dist/assets/{index-TctZ2EQK.js → index-RZp63Yuv.js} +1 -1
- package/dist/assets/{index-CD-O7bSQ.js → index-iiAA6CTH.js} +1 -1
- package/dist/assets/{index-CmR0e8xk.js → index-m7pOREIu.js} +1 -1
- package/dist/assets/{index-D2Ev-0A_.js → index-wwvQRwKh.js} +1 -1
- package/dist/assets/{index.es-e2znZrg8.js → index.es-C9O0OD76.js} +6 -6
- package/dist/assets/solana-B0Eox3vZ.js +2 -0
- package/dist/assets/{solana-DCCw_nmt.js → solana-BGWrrBcM.js} +2 -2
- package/dist/assets/solanaEmbed.esm-C9Mwa0DJ.js +37 -0
- package/dist/assets/{sui-ByNmqUgP.js → sui-COEHPNCD.js} +2 -2
- package/dist/assets/{tokens-BSV7gluG.js → tokens-CzZADlQh.js} +1 -1
- package/dist/main.js +54 -54
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/components/v2/Button.d.ts.map +1 -1
- package/dist/src/config/tokens.d.ts +2 -2
- package/dist/src/config/tokens.d.ts.map +1 -1
- package/dist/src/hooks/useAmountValidation.d.ts +1 -1
- package/dist/src/hooks/useAmountValidation.d.ts.map +1 -1
- package/dist/src/hooks/useComputeDestinationTokens.d.ts.map +1 -1
- package/dist/src/hooks/useFetchQuotes.d.ts +1 -1
- package/dist/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/dist/src/hooks/useSortedRoutesWithQuotes.d.ts +1 -1
- package/dist/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
- package/dist/src/icons/Chains/APT.d.ts.map +1 -1
- package/dist/src/icons/Chains/OSMO.d.ts.map +1 -1
- package/dist/src/icons/Chains/SOL.d.ts.map +1 -1
- package/dist/src/icons/Chains/SUI.d.ts.map +1 -1
- package/dist/src/icons/Chains/UNI.d.ts.map +1 -1
- package/dist/src/icons/Chains/XLAYER.d.ts.map +1 -1
- package/dist/src/icons/Routes/CCTP.d.ts.map +1 -1
- package/dist/src/icons/SvgDefs.d.ts +4 -0
- package/dist/src/icons/SvgDefs.d.ts.map +1 -0
- package/dist/src/icons/Tokens/BNB.d.ts.map +1 -1
- package/dist/src/icons/Tokens/BUSD.d.ts.map +1 -1
- package/dist/src/icons/Tokens/DAI.d.ts.map +1 -1
- package/dist/src/icons/Tokens/INJ.d.ts.map +1 -1
- package/dist/src/icons/Tokens/NTT.d.ts.map +1 -1
- package/dist/src/icons/Tokens/OSMO.d.ts.map +1 -1
- package/dist/src/icons/Tokens/POLY.d.ts.map +1 -1
- package/dist/src/icons/Tokens/SOL.d.ts.map +1 -1
- package/dist/src/icons/Tokens/USDT.d.ts.map +1 -1
- package/dist/src/icons/Tokens/WBTC.d.ts.map +1 -1
- package/dist/src/routes/operator.d.ts +1 -1
- package/dist/src/routes/operator.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/theme.d.ts +1 -0
- package/dist/src/theme.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts +2 -0
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/WalletConnector/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/{aptos-CzXBQ5wx.mjs → aptos-B90d2PTP.mjs} +2 -2
- package/lib/{aptos-BG8ndPcW.mjs → aptos-C_FrT7AS.mjs} +58 -42
- package/lib/aptos-DCwlKmza.js +2 -0
- package/lib/{aptos-DxDdKfid.js → aptos-DqvJ9s4T.js} +1 -1
- package/lib/{base64-B0sAJgP2.js → base64-__Ifj5MR.js} +1 -1
- package/lib/{base64-BFLeU3MK.mjs → base64-pJGiNLFW.mjs} +1 -1
- package/lib/{ccip-Bm7IOUCL.mjs → ccip-BHcaFKBP.mjs} +1 -1
- package/lib/{ccip-Cbpf1wJo.js → ccip-CXTtFoDa.js} +1 -1
- package/lib/{chunk-IMTC3J2M-DwURKwAV.mjs → chunk-IMTC3J2M-C55Jso7e.mjs} +3 -3
- package/lib/{chunk-IMTC3J2M-BGGrA_WC.js → chunk-IMTC3J2M-D0RBa4sC.js} +1 -1
- package/lib/{evm-l6ukE6CV.mjs → evm-BXk_Na9K.mjs} +6 -6
- package/lib/{evm-defRIE54.js → evm-CJ5QSLD2.js} +2 -2
- package/lib/{evm-1rdXpiv3.mjs → evm-D10FMflO.mjs} +5 -5
- package/lib/{evm-DJcjc-_C.js → evm-DpZu6gRr.js} +3 -3
- package/lib/{index-NgGkgCpa.mjs → index-6T4B560h.mjs} +1 -1
- package/lib/{index-CPcdt_MH.js → index-6fgWKB7X.js} +1 -1
- package/lib/{index-DcKSwYsA.js → index-86IwsVGJ.js} +1 -1
- package/lib/{index-BgOfWrzS.mjs → index-BHPYfzOB.mjs} +3 -3
- package/lib/{index-BsOOcqS5.js → index-BNKGL3iv.js} +1 -1
- package/lib/{index-5NBqfbfS.mjs → index-BPe5meha.mjs} +1 -1
- package/lib/{index-Dxs-J9dD.mjs → index-BVpbj0Tj.mjs} +1 -1
- package/lib/{index-mZitl_HA.mjs → index-BZ29iqdD.mjs} +2 -2
- package/lib/{index-OVEyrgEm.js → index-BkRMdfYl.js} +1 -1
- package/lib/{index-B2xDzy7A.js → index-BoNkxlCs.js} +1 -1
- package/lib/{index-B-3CdahH.js → index-Byf4HvjQ.js} +71 -71
- package/lib/{index-DW-aptRt.mjs → index-C-xYmrin.mjs} +2 -2
- package/lib/{index-pNMjrl4H.js → index-C2Q--ZqR.js} +1 -1
- package/lib/{index-BWOiAGve.js → index-C2ejTmxN.js} +1 -1
- package/lib/{index-DJLQFXCy.js → index-C3h0Dfd5.js} +1 -1
- package/lib/{index-BxQJKr_h.js → index-CM0Su2aL.js} +1 -1
- package/lib/{index-lPrZfOXi.mjs → index-COqG2J4V.mjs} +2 -2
- package/lib/{index-CDRjrfnz.mjs → index-CT3jDbNB.mjs} +1 -1
- package/lib/{index-B2xZ6kt4.mjs → index-C_jwGx2-.mjs} +15720 -13712
- package/lib/{index-DicZFeR7.mjs → index-Cc13Eu8K.mjs} +2 -2
- package/lib/{index-VhqEeF9I.mjs → index-CebPNw3m.mjs} +2 -2
- package/lib/{index-BmCFLdEX.js → index-CecBLn6U.js} +1 -1
- package/lib/{index-BwAyuZmy.mjs → index-ChaEETit.mjs} +1 -1
- package/lib/{index-BloVXId9.js → index-CqJCTEYm.js} +1 -1
- package/lib/{index-Cx9TS0XH.mjs → index-CzpUSFAu.mjs} +8 -10
- package/lib/{index-DYb7vb-V.js → index-D-DskOkz.js} +1 -1
- package/lib/{index-D6N53skz.js → index-D1Cr8uoN.js} +1 -1
- package/lib/{index-CelSnuJI.mjs → index-D1wdtvCl.mjs} +1 -1
- package/lib/{index-Dh8BTmR_.mjs → index-D7QLchCD.mjs} +2 -2
- package/lib/{index-EyD8yuwm.mjs → index-DFp32sYl.mjs} +2 -2
- package/lib/{index-BtsATNxk.js → index-DPk7O7q3.js} +1 -1
- package/lib/index-DU7IijQJ.js +1 -0
- package/lib/{index-IjHFzfzT.mjs → index-Dct0dNGF.mjs} +6 -6
- package/lib/{index-CFJ0wajU.mjs → index-Df-5S1Iv.mjs} +1 -1
- package/lib/{index-BMEVNQXB.js → index-Dhq7Pqaa.js} +1 -1
- package/lib/{index-CVoCwjDl.js → index-DnO1h07I.js} +1 -1
- package/lib/{index-DtqirkNJ.js → index-Dpw575di.js} +1 -1
- package/lib/{index-Bq9Xcog1.js → index-DuNtk_Lq.js} +1 -1
- package/lib/{index-B_MUS6zc.mjs → index-Dv30dU3D.mjs} +1 -1
- package/lib/{index-EDktb6S4.js → index-DyRsrKiv.js} +1 -1
- package/lib/{index-CIC3ywMJ.js → index-DyxZ0b9m.js} +1 -1
- package/lib/{index-8FtdcDhM.mjs → index-PEFZLehv.mjs} +3 -3
- package/lib/{index-CVlcHpc6.mjs → index-R-_MpR3F.mjs} +4 -4
- package/lib/{index-BegFjogX.mjs → index-RI1RY4Ud.mjs} +1 -1
- package/lib/{index-C3dHeQ6j.js → index-Tppnb03H.js} +1 -1
- package/lib/{index-BI7xYeBM.mjs → index-Y21tTELG.mjs} +34 -34
- package/lib/{index-BQqU6Wly.js → index-q9Cykg6J.js} +1 -1
- package/lib/{index-CNIZSAFU.mjs → index-uC7wsV3k.mjs} +1 -1
- package/lib/{index.es-DCm0D4jx.js → index.es-CuL-ucDn.js} +2 -2
- package/lib/{index.es-B_1fLcW-.mjs → index.es-RFQKvkba.mjs} +5 -5
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{signer-9vI5B7UW.mjs → signer-BtFJ4Ldr.mjs} +3 -3
- package/lib/{signer-BQc7Wphd.js → signer-C7H-eJ3E.js} +1 -1
- package/lib/solana-BFj16l4H.js +1 -0
- package/lib/solana-BKAwRoAY.mjs +17 -0
- package/lib/{solana-CjANz7Fi.mjs → solana-BexPR6DZ.mjs} +4 -4
- package/lib/{solana-DuIMWd_Y.js → solana-YoWC3nvp.js} +1 -1
- package/lib/{solanaEmbed.esm-CIh3hnnF.js → solanaEmbed.esm-CFcNAqXS.js} +1 -1
- package/lib/{solanaEmbed.esm-Ck3n8zZh.mjs → solanaEmbed.esm-YmIZqr64.mjs} +2 -2
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/components/v2/Button.d.ts.map +1 -1
- package/lib/src/config/tokens.d.ts +2 -2
- package/lib/src/config/tokens.d.ts.map +1 -1
- package/lib/src/hooks/useAmountValidation.d.ts +1 -1
- package/lib/src/hooks/useAmountValidation.d.ts.map +1 -1
- package/lib/src/hooks/useComputeDestinationTokens.d.ts.map +1 -1
- package/lib/src/hooks/useFetchQuotes.d.ts +1 -1
- package/lib/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/lib/src/hooks/useSortedRoutesWithQuotes.d.ts +1 -1
- package/lib/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
- package/lib/src/icons/Chains/APT.d.ts.map +1 -1
- package/lib/src/icons/Chains/OSMO.d.ts.map +1 -1
- package/lib/src/icons/Chains/SOL.d.ts.map +1 -1
- package/lib/src/icons/Chains/SUI.d.ts.map +1 -1
- package/lib/src/icons/Chains/UNI.d.ts.map +1 -1
- package/lib/src/icons/Chains/XLAYER.d.ts.map +1 -1
- package/lib/src/icons/Routes/CCTP.d.ts.map +1 -1
- package/lib/src/icons/SvgDefs.d.ts +4 -0
- package/lib/src/icons/SvgDefs.d.ts.map +1 -0
- package/lib/src/icons/Tokens/BNB.d.ts.map +1 -1
- package/lib/src/icons/Tokens/BUSD.d.ts.map +1 -1
- package/lib/src/icons/Tokens/DAI.d.ts.map +1 -1
- package/lib/src/icons/Tokens/INJ.d.ts.map +1 -1
- package/lib/src/icons/Tokens/NTT.d.ts.map +1 -1
- package/lib/src/icons/Tokens/OSMO.d.ts.map +1 -1
- package/lib/src/icons/Tokens/POLY.d.ts.map +1 -1
- package/lib/src/icons/Tokens/SOL.d.ts.map +1 -1
- package/lib/src/icons/Tokens/USDT.d.ts.map +1 -1
- package/lib/src/icons/Tokens/WBTC.d.ts.map +1 -1
- package/lib/src/routes/operator.d.ts +1 -1
- package/lib/src/routes/operator.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/theme.d.ts +1 -0
- package/lib/src/theme.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts +2 -0
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/WalletConnector/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/{sui-C3Hk0XoB.js → sui-BjId2Esa.js} +1 -1
- package/lib/{sui-BaNlF5eU.mjs → sui-Bo2iKsrP.mjs} +5 -5
- package/lib/{sui-BDz0ND8Q.js → sui-DXfYVsKj.js} +1 -1
- package/lib/{sui-DXobmCof.mjs → sui-MCAoyjYK.mjs} +1 -1
- package/lib/{tokens-BMcb2BBp.mjs → tokens-CAe3W-fq.mjs} +2 -2
- package/lib/{tokens-Dr0VPGjM.js → tokens-CFa-QGSb.js} +1 -1
- package/package.json +19 -18
- package/dist/assets/aptos-h3S6O6Gp.js +0 -3
- package/dist/assets/index-BMLcq4no.js +0 -1
- package/dist/assets/solana-BNhbIgt5.js +0 -2
- package/dist/assets/solanaEmbed.esm-D6aTKNPa.js +0 -37
- package/dist/src/utils/theme.d.ts +0 -11
- package/dist/src/utils/theme.d.ts.map +0 -1
- package/lib/aptos-BI3SOFlh.js +0 -2
- package/lib/index-BjH74c5e.js +0 -1
- package/lib/solana-3AW1_2QL.js +0 -1
- package/lib/solana-DyGkYgAN.mjs +0 -17
- package/lib/src/utils/theme.d.ts +0 -11
- package/lib/src/utils/theme.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var oe = Object.defineProperty;
|
|
2
2
|
var se = (k, t, e) => t in k ? oe(k, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : k[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { cY as N, cZ as F, c_ as ae, c$ as Z, d0 as W, d1 as $, d2 as S, bM as ie, aD as I, c5 as R, d3 as b, c6 as q, bR as ce, bK as j, aF as O, am as v, bO as de, cb as H, c8 as le, d4 as _, d5 as C, d6 as ge, d7 as ue, d8 as M, d9 as fe, bS as V, da as D, db as Q, dc as
|
|
5
|
-
import "./index-
|
|
3
|
+
var h = (k, t, e) => se(k, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { cY as N, cZ as F, c_ as ae, c$ as Z, d0 as W, d1 as $, d2 as S, bM as ie, aD as I, c5 as R, d3 as b, c6 as q, bR as ce, bK as j, aF as O, am as v, bO as de, cb as H, c8 as le, d4 as _, d5 as C, d6 as ge, d7 as ue, d8 as M, d9 as fe, bS as V, da as D, db as Q, dc as pe, dd as x, de as he, df as we, ap as U, dg as ye, dh as X, cP as ke, di as me, cC as Y, dj as be, dk as Ie, dl as G, bW as ee } from "./index-C_jwGx2-.mjs";
|
|
5
|
+
import "./index-RI1RY4Ud.mjs";
|
|
6
6
|
const L = async (k, t, e) => {
|
|
7
7
|
var d, r, n;
|
|
8
8
|
if (!N(e))
|
|
@@ -60,13 +60,13 @@ const L = async (k, t, e) => {
|
|
|
60
60
|
};
|
|
61
61
|
class z {
|
|
62
62
|
constructor(t, e, i, o) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
h(this, "network");
|
|
64
|
+
h(this, "chain");
|
|
65
|
+
h(this, "provider");
|
|
66
|
+
h(this, "contracts");
|
|
67
|
+
h(this, "coreBridgeObjectId");
|
|
68
|
+
h(this, "tokenBridgeObjectId");
|
|
69
|
+
h(this, "chainId");
|
|
70
70
|
this.network = t, this.chain = e, this.provider = i, this.contracts = o, this.chainId = ie.get(t, e);
|
|
71
71
|
const a = this.contracts.tokenBridge;
|
|
72
72
|
if (!a)
|
|
@@ -226,15 +226,15 @@ class z {
|
|
|
226
226
|
yield this.createUnsignedTx(n, "Sui.TokenBridge.PrepareCreateWrapped");
|
|
227
227
|
let l = "", s = "", u = "", f = "", w = "", y = !1;
|
|
228
228
|
for (; !y; ) {
|
|
229
|
-
await new Promise((
|
|
229
|
+
await new Promise((p) => setTimeout(p, 500));
|
|
230
230
|
const B = await this.provider.queryTransactionBlocks({
|
|
231
231
|
filter: { FromAddress: a },
|
|
232
232
|
options: { showObjectChanges: !0 },
|
|
233
233
|
limit: 3
|
|
234
234
|
});
|
|
235
|
-
for (const
|
|
236
|
-
if ("objectChanges" in
|
|
237
|
-
for (const g of
|
|
235
|
+
for (const p of B.data)
|
|
236
|
+
if ("objectChanges" in p) {
|
|
237
|
+
for (const g of p.objectChanges)
|
|
238
238
|
ue(g) && g.packageId !== void 0 ? l = g.packageId : M(g) && g.objectType.includes("WrappedAssetSetup") ? (s = g.objectId, w = g.objectType.split(", ")[1].replace(">", "")) : M(g) && g.objectType.includes("UpgradeCap") ? u = g.objectId : M(g) && g.objectType.includes("CoinMetadata") && (f = g.objectId);
|
|
239
239
|
if (l !== "" && s !== "" && u !== "" && f !== "") {
|
|
240
240
|
y = !0;
|
|
@@ -267,15 +267,15 @@ class z {
|
|
|
267
267
|
}), yield this.createUnsignedTx(c, "Sui.TokenBridge.SubmitAttestation");
|
|
268
268
|
}
|
|
269
269
|
async *transfer(t, e, i, o, a) {
|
|
270
|
-
const d = 0n, r = 0n, l = t.toString(), s = (v(i) ? D : i).toString(), u = await I.getCoins(this.provider, t, s), [f, ...w] = u.filter((
|
|
270
|
+
const d = 0n, r = 0n, l = t.toString(), s = (v(i) ? D : i).toString(), u = await I.getCoins(this.provider, t, s), [f, ...w] = u.filter((p) => Q(p.coinType, s));
|
|
271
271
|
if (f === void 0)
|
|
272
272
|
throw new Error(`Coins array doesn't contain any coins of type ${s}`);
|
|
273
273
|
const [y, m] = await this.getPackageIds(), c = new _(), [A] = (() => {
|
|
274
274
|
if (s === D)
|
|
275
275
|
return c.splitCoins(c.gas, [c.pure.u64(o)]);
|
|
276
276
|
{
|
|
277
|
-
const
|
|
278
|
-
return w.length && c.mergeCoins(
|
|
277
|
+
const p = c.object(f.coinObjectId);
|
|
278
|
+
return w.length && c.mergeCoins(p, w.map((g) => c.object(g.coinObjectId))), c.splitCoins(p, [c.pure.u64(o)]);
|
|
279
279
|
}
|
|
280
280
|
})(), [E] = c.splitCoins(c.gas, [c.pure.u64(d)]), [B] = c.moveCall({
|
|
281
281
|
target: `${m}::state::verified_asset`,
|
|
@@ -285,9 +285,9 @@ class z {
|
|
|
285
285
|
if (a) {
|
|
286
286
|
if (!l)
|
|
287
287
|
throw new Error("senderAddress is required for transfer with payload");
|
|
288
|
-
let
|
|
288
|
+
let p = !1;
|
|
289
289
|
const g = await (async () => {
|
|
290
|
-
const K = await
|
|
290
|
+
const K = await pe(this.provider, y, l);
|
|
291
291
|
if (K !== null)
|
|
292
292
|
return c.object(K);
|
|
293
293
|
{
|
|
@@ -295,7 +295,7 @@ class z {
|
|
|
295
295
|
target: `${y}::emitter::new`,
|
|
296
296
|
arguments: [c.object(this.coreBridgeObjectId)]
|
|
297
297
|
});
|
|
298
|
-
return
|
|
298
|
+
return p = !0, ne;
|
|
299
299
|
}
|
|
300
300
|
})(), [T, te] = c.moveCall({
|
|
301
301
|
target: `${m}::transfer_tokens_with_payload::prepare_transfer`,
|
|
@@ -328,9 +328,9 @@ class z {
|
|
|
328
328
|
re,
|
|
329
329
|
c.object(C)
|
|
330
330
|
]
|
|
331
|
-
}),
|
|
331
|
+
}), p && c.transferObjects([g], c.pure.address(l)), yield this.createUnsignedTx(c, "Sui.TokenBridge.TransferWithPayload");
|
|
332
332
|
} else {
|
|
333
|
-
const [
|
|
333
|
+
const [p, g] = c.moveCall({
|
|
334
334
|
target: `${m}::transfer_tokens::prepare_transfer`,
|
|
335
335
|
arguments: [
|
|
336
336
|
B,
|
|
@@ -349,7 +349,7 @@ class z {
|
|
|
349
349
|
});
|
|
350
350
|
const [T] = c.moveCall({
|
|
351
351
|
target: `${m}::transfer_tokens::transfer_tokens`,
|
|
352
|
-
arguments: [c.object(this.tokenBridgeObjectId),
|
|
352
|
+
arguments: [c.object(this.tokenBridgeObjectId), p],
|
|
353
353
|
typeArguments: [s]
|
|
354
354
|
});
|
|
355
355
|
c.moveCall({
|
|
@@ -405,7 +405,7 @@ class z {
|
|
|
405
405
|
var r;
|
|
406
406
|
if (i > 8)
|
|
407
407
|
throw new Error("Decimals is capped at 8");
|
|
408
|
-
const o = (r = await
|
|
408
|
+
const o = (r = await he(this.provider, this.tokenBridgeObjectId)) == null ? void 0 : r.replace("0x", "");
|
|
409
409
|
if (!o)
|
|
410
410
|
throw new Error(`Original token bridge package ID not found for object ID ${this.tokenBridgeObjectId}`);
|
|
411
411
|
const a = "a11ceb0b060000000901000a020a14031e1704350405392d07669f01088502600ae502050cea02160004010b010c0205020d000002000201020003030c020001000104020700000700010001090801010c020a050600030803040202000302010702080007080100020800080303090002070801010b020209000901010608010105010b0202080008030209000504434f494e095478436f6e7465787408565f5f305f325f3011577261707065644173736574536574757004636f696e0e6372656174655f777261707065640b64756d6d795f6669656c6404696e697414707265706172655f726567697374726174696f6e0f7075626c69635f7472616e736665720673656e646572087472616e736665720a74785f636f6e746578740f76657273696f6e5f636f6e74726f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002" + o + "00020106010000000001090b0031" + i.toString(16).padStart(2, "0") + "0a0138000b012e110238010200";
|
|
@@ -420,14 +420,14 @@ class z {
|
|
|
420
420
|
}
|
|
421
421
|
class J {
|
|
422
422
|
constructor(t, e, i, o) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
423
|
+
h(this, "network");
|
|
424
|
+
h(this, "chain");
|
|
425
|
+
h(this, "connection");
|
|
426
|
+
h(this, "contracts");
|
|
427
|
+
h(this, "tokenBridgeRelayerObjectId");
|
|
428
|
+
h(this, "coreBridgeObjectId");
|
|
429
|
+
h(this, "tokenBridgeObjectId");
|
|
430
|
+
h(this, "fields");
|
|
431
431
|
this.network = t, this.chain = e, this.connection = i, this.contracts = o;
|
|
432
432
|
const { tokenBridge: a, tokenBridgeRelayer: d, coreBridge: r } = o;
|
|
433
433
|
if (!a || !d || !r)
|
|
@@ -445,11 +445,11 @@ class J {
|
|
|
445
445
|
if (v(i))
|
|
446
446
|
return s.splitCoins(s.gas, [s.pure.u64(o)]);
|
|
447
447
|
{
|
|
448
|
-
const E = await I.getCoins(this.connection, t, r), [B, ...
|
|
448
|
+
const E = await I.getCoins(this.connection, t, r), [B, ...p] = E.filter((T) => T.coinType === r);
|
|
449
449
|
if (B === void 0)
|
|
450
450
|
throw new Error(`Coins array doesn't contain any coins of type ${r}`);
|
|
451
451
|
const g = s.object(B.coinObjectId);
|
|
452
|
-
return
|
|
452
|
+
return p.length && s.mergeCoins(g, p.map((T) => s.object(T.coinObjectId))), s.splitCoins(g, [s.pure.u64(o)]);
|
|
453
453
|
}
|
|
454
454
|
})(), [y] = s.moveCall({
|
|
455
455
|
target: `${l}::state::verified_asset`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-Tppnb03H.js"),ko=require("./dijkstra-CtFxn7S9.js"),Mo=require("./index-Byf4HvjQ.js");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index-Byf4HvjQ.js"),ze=require("./evm-DpZu6gRr.js"),j=require("./index-C3h0Dfd5.js"),E=require("./index-86IwsVGJ.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function sr(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=sr;function Cr(a){const t=sr(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=Cr;function tw(){return Cr("document")}ne.getDocumentOrThrow=tw;function rw(){return sr("document")}ne.getDocument=rw;function iw(){return Cr("navigator")}ne.getNavigatorOrThrow=iw;function sw(){return sr("navigator")}ne.getNavigator=sw;function nw(){return Cr("location")}ne.getLocationOrThrow=nw;function ow(){return sr("location")}ne.getLocation=ow;function aw(){return Cr("crypto")}ne.getCryptoOrThrow=aw;function cw(){return sr("crypto")}ne.getCrypto=cw;function uw(){return Cr("localStorage")}ne.getLocalStorageOrThrow=uw;function hw(){return sr("localStorage")}ne.getLocalStorage=hw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const lu=ne;function lw(){let a,t;try{a=lu.getDocumentOrThrow(),t=lu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const x=O[q],B=x.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const D=x.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let Q=t.protocol+"//"+t.host;if(D.indexOf("/")===0)Q+=D;else{const fe=t.pathname.split("/");fe.pop();const Z=fe.join("/");Q+=Z+"/"+D}N.push(Q)}else if(D.indexOf("//")===0){const Q=t.protocol+D;N.push(Q)}else N.push(D)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const x=N[q],B=["itemprop","property","name"].map(D=>x.getAttribute(D)).filter(D=>D?O.includes(D):!1);if(B.length&&B){const D=x.getAttribute("content");if(D)return D}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),g=u(),w=t.origin,b=r();return{description:g,url:w,icons:b,name:l}}bo.getWindowMetadata=lw;function pw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const fw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function dw(a,t){const{message:r,code:s}=fw[a];return{message:r,code:s}}function co(a,t){return!!Array.isArray(a)}var $r={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
|
|
|
43
43
|
function print() { __p += __j.call(arguments, '') }
|
|
44
44
|
`:`;
|
|
45
45
|
`)+R+`return __p
|
|
46
|
-
}`;var K=cu(function(){return X(f,F+"return "+R).apply(r,d)});if(K.source=R,Un(K))throw K;return K}function cm(e){return te(e).toLowerCase()}function um(e){return te(e).toUpperCase()}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return va(e);if(!e||!(i=Ke(i)))return e;var c=at(e),h=at(i),f=ma(c,h),d=wa(c,h)+1;return Lt(c,f,d).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,ba(e)+1);if(!e||!(i=Ke(i)))return e;var c=at(e),h=wa(c,at(i))+1;return Lt(c,0,h).join("")}function pm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ke(i)))return e;var c=at(e),h=ma(c,at(i));return Lt(c,h).join("")}function fm(e,i){var n=nl,c=ol;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Ke(i.omission):c}e=te(e);var f=e.length;if(fr(e)){var d=at(e);f=d.length}if(n>=f)return e;var y=n-dr(c);if(y<1)return c;var m=d?Lt(d,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(d&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Mo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ke(h),y)!=y){var T=m.lastIndexOf(h);T>-1&&(m=m.slice(0,T))}return m+c}function dm(e){return e=te(e),e&&Pl.test(e)?e.replace(jo,zp):e}var gm=br(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=uc("toUpperCase");function au(e,i,n){return e=te(e),i=n?r:i,i===r?qp(e)?Kp(e):Np(e):e.match(i)||[]}var cu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new z(n)}}),ym=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function vm(e){var i=e==null?0:e.length,n=M();return e=i?ce(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var f=e[h];if(He(f[0],this,c))return He(f[1],this,c)}})}function mm(e){return Hf(et(e,O))}function Hn(e){return function(){return e}}function wm(e,i){return e==null||e!==e?i:e}var _m=lc(),bm=lc(!0);function Me(e){return e}function Vn(e){return ka(typeof e=="function"?e:et(e,O))}function Em(e){return Ha(et(e,O))}function Im(e,i){return Va(e,et(i,O))}var Pm=W(function(e,i){return function(n){return Qr(n,e,i)}}),Sm=W(function(e,i){return function(n){return Qr(e,n,i)}});function Kn(e,i,n){var c=be(i),h=Bi(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Bi(i,be(i)));var f=!(le(n)&&"chain"in n)||!!n.chain,d=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,d&&(e.prototype[y]=function(){var P=this.__chain__;if(f||P){var S=e(this.__wrapped__),R=S.__actions__=je(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Dt([this.value()],arguments))})}),e}function Om(){return Ie._===this&&(Ie._=Yp),this}function Bn(){}function Rm(e){return e=V(e),W(function(i){return Ka(i,e)})}var Nm=In(ce),Cm=In(pa),$m=In(Ws);function uu(e){return $n(e)?Js(yt(e)):od(e)}function Tm(e){return function(i){return e==null?r:Yt(e,i)}}var Am=fc(),xm=fc(!0);function Wn(){return[]}function Jn(){return!1}function Dm(){return{}}function Fm(){return""}function jm(){return!0}function qm(e,i){if(e=V(e),e<1||e>cr)return[];var n=ft,c=Oe(e,ft);i=M(i),e-=ft;for(var h=Ys(c,i);++n<e;)i(n);return h}function Um(e){return H(e)?ce(e,yt):Be(e)?[e]:je(Cc(te(e)))}function Mm(e){var i=++Gp;return te(e)+i}var Lm=Zi(function(e,i){return e+i},0),km=Pn("ceil"),zm=Zi(function(e,i){return e/i},1),Hm=Pn("floor");function Vm(e){return e&&e.length?Ki(e,Me,un):r}function Km(e,i){return e&&e.length?Ki(e,M(i,2),un):r}function Bm(e){return ga(e,Me)}function Wm(e,i){return ga(e,M(i,2))}function Jm(e){return e&&e.length?Ki(e,Me,fn):r}function Gm(e,i){return e&&e.length?Ki(e,M(i,2),fn):r}var Qm=Zi(function(e,i){return e*i},1),Ym=Pn("round"),Zm=Zi(function(e,i){return e-i},0);function Xm(e){return e&&e.length?Qs(e,Me):0}function ew(e,i){return e&&e.length?Qs(e,M(i,2)):0}return p.after=Ey,p.ary=Lc,p.assign=uv,p.assignIn=eu,p.assignInWith=ls,p.assignWith=hv,p.at=lv,p.before=kc,p.bind=jn,p.bindAll=ym,p.bindKey=zc,p.castArray=Dy,p.chain=qc,p.chunk=Hd,p.compact=Vd,p.concat=Kd,p.cond=vm,p.conforms=mm,p.constant=Hn,p.countBy=Xg,p.create=pv,p.curry=Hc,p.curryRight=Vc,p.debounce=Kc,p.defaults=fv,p.defaultsDeep=dv,p.defer=Iy,p.delay=Py,p.difference=Bd,p.differenceBy=Wd,p.differenceWith=Jd,p.drop=Gd,p.dropRight=Qd,p.dropRightWhile=Yd,p.dropWhile=Zd,p.fill=Xd,p.filter=ty,p.flatMap=sy,p.flatMapDeep=ny,p.flatMapDepth=oy,p.flatten=xc,p.flattenDeep=eg,p.flattenDepth=tg,p.flip=Sy,p.flow=_m,p.flowRight=bm,p.fromPairs=rg,p.functions=bv,p.functionsIn=Ev,p.groupBy=ay,p.initial=sg,p.intersection=ng,p.intersectionBy=og,p.intersectionWith=ag,p.invert=Pv,p.invertBy=Sv,p.invokeMap=uy,p.iteratee=Vn,p.keyBy=hy,p.keys=be,p.keysIn=Ue,p.map=ns,p.mapKeys=Rv,p.mapValues=Nv,p.matches=Em,p.matchesProperty=Im,p.memoize=as,p.merge=Cv,p.mergeWith=tu,p.method=Pm,p.methodOf=Sm,p.mixin=Kn,p.negate=cs,p.nthArg=Rm,p.omit=$v,p.omitBy=Tv,p.once=Oy,p.orderBy=ly,p.over=Nm,p.overArgs=Ry,p.overEvery=Cm,p.overSome=$m,p.partial=qn,p.partialRight=Bc,p.partition=py,p.pick=Av,p.pickBy=ru,p.property=uu,p.propertyOf=Tm,p.pull=lg,p.pullAll=Fc,p.pullAllBy=pg,p.pullAllWith=fg,p.pullAt=dg,p.range=Am,p.rangeRight=xm,p.rearg=Ny,p.reject=gy,p.remove=gg,p.rest=Cy,p.reverse=Dn,p.sampleSize=vy,p.set=Dv,p.setWith=Fv,p.shuffle=my,p.slice=yg,p.sortBy=by,p.sortedUniq=Ig,p.sortedUniqBy=Pg,p.split=sm,p.spread=$y,p.tail=Sg,p.take=Og,p.takeRight=Rg,p.takeRightWhile=Ng,p.takeWhile=Cg,p.tap=Vg,p.throttle=Ty,p.thru=ss,p.toArray=Yc,p.toPairs=iu,p.toPairsIn=su,p.toPath=Um,p.toPlainObject=Xc,p.transform=jv,p.unary=Ay,p.union=$g,p.unionBy=Tg,p.unionWith=Ag,p.uniq=xg,p.uniqBy=Dg,p.uniqWith=Fg,p.unset=qv,p.unzip=Fn,p.unzipWith=jc,p.update=Uv,p.updateWith=Mv,p.values=Pr,p.valuesIn=Lv,p.without=jg,p.words=au,p.wrap=xy,p.xor=qg,p.xorBy=Ug,p.xorWith=Mg,p.zip=Lg,p.zipObject=kg,p.zipObjectDeep=zg,p.zipWith=Hg,p.entries=iu,p.entriesIn=su,p.extend=eu,p.extendWith=ls,Kn(p,p),p.add=Lm,p.attempt=cu,p.camelCase=Vv,p.capitalize=nu,p.ceil=km,p.clamp=kv,p.clone=Fy,p.cloneDeep=qy,p.cloneDeepWith=Uy,p.cloneWith=jy,p.conformsTo=My,p.deburr=ou,p.defaultTo=wm,p.divide=zm,p.endsWith=Kv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Wv,p.every=ey,p.find=ry,p.findIndex=Tc,p.findKey=gv,p.findLast=iy,p.findLastIndex=Ac,p.findLastKey=yv,p.floor=Hm,p.forEach=Uc,p.forEachRight=Mc,p.forIn=vv,p.forInRight=mv,p.forOwn=wv,p.forOwnRight=_v,p.get=Ln,p.gt=Ly,p.gte=ky,p.has=Iv,p.hasIn=kn,p.head=Dc,p.identity=Me,p.includes=cy,p.indexOf=ig,p.inRange=zv,p.invoke=Ov,p.isArguments=er,p.isArray=H,p.isArrayBuffer=zy,p.isArrayLike=qe,p.isArrayLikeObject=ge,p.isBoolean=Hy,p.isBuffer=kt,p.isDate=Vy,p.isElement=Ky,p.isEmpty=By,p.isEqual=Wy,p.isEqualWith=Jy,p.isError=Un,p.isFinite=Gy,p.isFunction=St,p.isInteger=Wc,p.isLength=us,p.isMap=Jc,p.isMatch=Qy,p.isMatchWith=Yy,p.isNaN=Zy,p.isNative=Xy,p.isNil=tv,p.isNull=ev,p.isNumber=Gc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ri,p.isRegExp=Mn,p.isSafeInteger=rv,p.isSet=Qc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Ir,p.isUndefined=iv,p.isWeakMap=sv,p.isWeakSet=nv,p.join=cg,p.kebabCase=Jv,p.last=rt,p.lastIndexOf=ug,p.lowerCase=Gv,p.lowerFirst=Qv,p.lt=ov,p.lte=av,p.max=Vm,p.maxBy=Km,p.mean=Bm,p.meanBy=Wm,p.min=Jm,p.minBy=Gm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=Dm,p.stubString=Fm,p.stubTrue=jm,p.multiply=Qm,p.nth=hg,p.noConflict=Om,p.noop=Bn,p.now=os,p.pad=Yv,p.padEnd=Zv,p.padStart=Xv,p.parseInt=em,p.random=Hv,p.reduce=fy,p.reduceRight=dy,p.repeat=tm,p.replace=rm,p.result=xv,p.round=Ym,p.runInContext=v,p.sample=yy,p.size=wy,p.snakeCase=im,p.some=_y,p.sortedIndex=vg,p.sortedIndexBy=mg,p.sortedIndexOf=wg,p.sortedLastIndex=_g,p.sortedLastIndexBy=bg,p.sortedLastIndexOf=Eg,p.startCase=nm,p.startsWith=om,p.subtract=Zm,p.sum=Xm,p.sumBy=ew,p.template=am,p.times=qm,p.toFinite=Ot,p.toInteger=V,p.toLength=Zc,p.toLower=cm,p.toNumber=it,p.toSafeInteger=cv,p.toString=te,p.toUpper=um,p.trim=hm,p.trimEnd=lm,p.trimStart=pm,p.truncate=fm,p.unescape=dm,p.uniqueId=Mm,p.upperCase=gm,p.upperFirst=zn,p.each=Uc,p.eachRight=Mc,p.first=Dc,Kn(p,function(){var e={};return dt(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){G.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new G(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,ft),type:e+(c.__dir__<0?"Right":"")}),c},G.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==xo||n==hl;G.prototype[e]=function(h){var f=this.clone();return f.__iteratees__.push({iteratee:M(h,3),type:n}),f.__filtered__=f.__filtered__||c,f}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");G.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");G.prototype[e]=function(){return this.__filtered__?new G(this):this[n](1)}}),G.prototype.compact=function(){return this.filter(Me)},G.prototype.find=function(e){return this.filter(e).head()},G.prototype.findLast=function(e){return this.reverse().find(e)},G.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new G(this):this.map(function(n){return Qr(n,e,i)})}),G.prototype.reject=function(e){return this.filter(cs(M(e)))},G.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new G(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},G.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},G.prototype.toArray=function(){return this.take(ft)},dt(G.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],f=c||/^find/.test(i);h&&(p.prototype[i]=function(){var d=this.__wrapped__,y=c?[1]:arguments,m=d instanceof G,P=y[0],S=m||H(d),R=function(J){var Y=h.apply(p,Dt([J],y));return c&&T?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var T=this.__chain__,F=!!this.__actions__.length,L=f&&!T,K=m&&!F;if(!f&&S){d=K?d:new G(this);var k=e.apply(d,y);return k.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(k,T)}return L&&K?e.apply(this,y):(k=this.thru(R),L?c?k.value()[0]:k.value():k)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var f=this.value();return i.apply(H(f)?f:[],h)}return this[n](function(d){return i.apply(H(d)?d:[],h)})}}),dt(G.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(mr,c)||(mr[c]=[]),mr[c].push({name:i,func:n})}}),mr[Yi(r,Q).name]=[{name:"wrapper",func:r}],G.prototype.clone=df,G.prototype.reverse=gf,G.prototype.value=yf,p.prototype.at=Kg,p.prototype.chain=Bg,p.prototype.commit=Wg,p.prototype.next=Jg,p.prototype.plant=Qg,p.prototype.reverse=Yg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Zg,p.prototype.first=p.prototype.head,Hr&&(p.prototype[Hr]=Gg),p},gr=Bp();Bt?((Bt.exports=gr)._=gr,Hs._=gr):Ie._=gr}).call(ui)})(_o,_o.exports);var ME=Object.defineProperty,LE=Object.defineProperties,kE=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,HE=Object.prototype.propertyIsEnumerable,lh=(a,t,r)=>t in a?ME(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ds=(a,t)=>{for(var r in t||(t={}))zE.call(t,r)&&lh(a,r,t[r]);if(hh)for(var r of hh(t))HE.call(t,r)&&lh(a,r,t[r]);return a},VE=(a,t)=>LE(a,kE(t));function Vt(a,t,r){var s;const o=p_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${UE}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ar(a){return a.includes(":")?a.split(":")[1]:a}function tl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function KE(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function BE(a={},t={}){const r=ph(a),s=ph(t);return _o.exports.merge(r,s)}function ph(a){var t,r,s,o;const u={};if(!Nr(a))return u;for(const[l,g]of Object.entries(a)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=hi(l);u[N]=VE(ds(ds({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:ds(ds({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function WE(a){return a.includes(":")?a.split(":")[2]:a}function JE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:tl(s.accounts);t[r]={chains:g,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const rl={},ue=a=>rl[a],no=(a,t)=>{rl[a]=t};class GE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class QE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Vt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ar(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class YE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class ZE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class XE{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ar(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class eI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class tI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class rI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Vt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,ue("disableProviderPing")))}}var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,dh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&dh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&dh(a,r,t[r]);return a},oo=(a,t)=>sI(a,nI(t));class Ao{constructor(t){this.events=new U.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ch})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ao(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=JE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Xh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ir(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await PE.init({logger:this.providerOpts.logger||ch,relayUrl:this.providerOpts.relayUrl||FE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>hi(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=KE(r,this.session),o=tl(s),u=BE(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new QE({namespace:l});break;case"solana":this.rpcProviders[r]=new YE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new ZE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new GE({namespace:l});break;case"cip34":this.rpcProviders[r]=new XE({namespace:l});break;case"elrond":this.rpcProviders[r]=new eI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new tI({namespace:l});break;case"near":this.rpcProviders[r]=new rI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&ir(o)&&this.events.emit("accountsChanged",o.map(WE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=hi(o),g=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Tt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>hi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=hi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${uh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${uh}/${t}`)}}const cI=Ao,uI="wc",hI="ethereum_provider",lI=`${uI}@2:${hI}:`,pI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],il=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],sl=["chainChanged","accountsChanged","message","disconnect","connect"];var fI=Object.defineProperty,dI=Object.defineProperties,gI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,yI=Object.prototype.hasOwnProperty,vI=Object.prototype.propertyIsEnumerable,yh=(a,t,r)=>t in a?fI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,pi=(a,t)=>{for(var r in t||(t={}))yI.call(t,r)&&yh(a,r,t[r]);if(gh)for(var r of gh(t))vI.call(t,r)&&yh(a,r,t[r]);return a},vh=(a,t)=>dI(a,gI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function mI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:g}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:pi({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:il))],events:[...new Set(w.events.concat(l!=null&&l.length?l:sl))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new U.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=lI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=mI(this.rpc);try{const o=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(vh(pi({namespaces:pi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!o)return;const u=pw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",vh(pi({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await cI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-C3dHeQ6j.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(pi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${pI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const wI=Os;exports.EthereumProvider=wI;exports.OPTIONAL_EVENTS=sl;exports.OPTIONAL_METHODS=il;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
|
|
46
|
+
}`;var K=cu(function(){return X(f,F+"return "+R).apply(r,d)});if(K.source=R,Un(K))throw K;return K}function cm(e){return te(e).toLowerCase()}function um(e){return te(e).toUpperCase()}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return va(e);if(!e||!(i=Ke(i)))return e;var c=at(e),h=at(i),f=ma(c,h),d=wa(c,h)+1;return Lt(c,f,d).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,ba(e)+1);if(!e||!(i=Ke(i)))return e;var c=at(e),h=wa(c,at(i))+1;return Lt(c,0,h).join("")}function pm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ke(i)))return e;var c=at(e),h=ma(c,at(i));return Lt(c,h).join("")}function fm(e,i){var n=nl,c=ol;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Ke(i.omission):c}e=te(e);var f=e.length;if(fr(e)){var d=at(e);f=d.length}if(n>=f)return e;var y=n-dr(c);if(y<1)return c;var m=d?Lt(d,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(d&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Mo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ke(h),y)!=y){var T=m.lastIndexOf(h);T>-1&&(m=m.slice(0,T))}return m+c}function dm(e){return e=te(e),e&&Pl.test(e)?e.replace(jo,zp):e}var gm=br(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=uc("toUpperCase");function au(e,i,n){return e=te(e),i=n?r:i,i===r?qp(e)?Kp(e):Np(e):e.match(i)||[]}var cu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new z(n)}}),ym=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function vm(e){var i=e==null?0:e.length,n=M();return e=i?ce(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var f=e[h];if(He(f[0],this,c))return He(f[1],this,c)}})}function mm(e){return Hf(et(e,O))}function Hn(e){return function(){return e}}function wm(e,i){return e==null||e!==e?i:e}var _m=lc(),bm=lc(!0);function Me(e){return e}function Vn(e){return ka(typeof e=="function"?e:et(e,O))}function Em(e){return Ha(et(e,O))}function Im(e,i){return Va(e,et(i,O))}var Pm=W(function(e,i){return function(n){return Qr(n,e,i)}}),Sm=W(function(e,i){return function(n){return Qr(e,n,i)}});function Kn(e,i,n){var c=be(i),h=Bi(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Bi(i,be(i)));var f=!(le(n)&&"chain"in n)||!!n.chain,d=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,d&&(e.prototype[y]=function(){var P=this.__chain__;if(f||P){var S=e(this.__wrapped__),R=S.__actions__=je(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Dt([this.value()],arguments))})}),e}function Om(){return Ie._===this&&(Ie._=Yp),this}function Bn(){}function Rm(e){return e=V(e),W(function(i){return Ka(i,e)})}var Nm=In(ce),Cm=In(pa),$m=In(Ws);function uu(e){return $n(e)?Js(yt(e)):od(e)}function Tm(e){return function(i){return e==null?r:Yt(e,i)}}var Am=fc(),xm=fc(!0);function Wn(){return[]}function Jn(){return!1}function Dm(){return{}}function Fm(){return""}function jm(){return!0}function qm(e,i){if(e=V(e),e<1||e>cr)return[];var n=ft,c=Oe(e,ft);i=M(i),e-=ft;for(var h=Ys(c,i);++n<e;)i(n);return h}function Um(e){return H(e)?ce(e,yt):Be(e)?[e]:je(Cc(te(e)))}function Mm(e){var i=++Gp;return te(e)+i}var Lm=Zi(function(e,i){return e+i},0),km=Pn("ceil"),zm=Zi(function(e,i){return e/i},1),Hm=Pn("floor");function Vm(e){return e&&e.length?Ki(e,Me,un):r}function Km(e,i){return e&&e.length?Ki(e,M(i,2),un):r}function Bm(e){return ga(e,Me)}function Wm(e,i){return ga(e,M(i,2))}function Jm(e){return e&&e.length?Ki(e,Me,fn):r}function Gm(e,i){return e&&e.length?Ki(e,M(i,2),fn):r}var Qm=Zi(function(e,i){return e*i},1),Ym=Pn("round"),Zm=Zi(function(e,i){return e-i},0);function Xm(e){return e&&e.length?Qs(e,Me):0}function ew(e,i){return e&&e.length?Qs(e,M(i,2)):0}return p.after=Ey,p.ary=Lc,p.assign=uv,p.assignIn=eu,p.assignInWith=ls,p.assignWith=hv,p.at=lv,p.before=kc,p.bind=jn,p.bindAll=ym,p.bindKey=zc,p.castArray=Dy,p.chain=qc,p.chunk=Hd,p.compact=Vd,p.concat=Kd,p.cond=vm,p.conforms=mm,p.constant=Hn,p.countBy=Xg,p.create=pv,p.curry=Hc,p.curryRight=Vc,p.debounce=Kc,p.defaults=fv,p.defaultsDeep=dv,p.defer=Iy,p.delay=Py,p.difference=Bd,p.differenceBy=Wd,p.differenceWith=Jd,p.drop=Gd,p.dropRight=Qd,p.dropRightWhile=Yd,p.dropWhile=Zd,p.fill=Xd,p.filter=ty,p.flatMap=sy,p.flatMapDeep=ny,p.flatMapDepth=oy,p.flatten=xc,p.flattenDeep=eg,p.flattenDepth=tg,p.flip=Sy,p.flow=_m,p.flowRight=bm,p.fromPairs=rg,p.functions=bv,p.functionsIn=Ev,p.groupBy=ay,p.initial=sg,p.intersection=ng,p.intersectionBy=og,p.intersectionWith=ag,p.invert=Pv,p.invertBy=Sv,p.invokeMap=uy,p.iteratee=Vn,p.keyBy=hy,p.keys=be,p.keysIn=Ue,p.map=ns,p.mapKeys=Rv,p.mapValues=Nv,p.matches=Em,p.matchesProperty=Im,p.memoize=as,p.merge=Cv,p.mergeWith=tu,p.method=Pm,p.methodOf=Sm,p.mixin=Kn,p.negate=cs,p.nthArg=Rm,p.omit=$v,p.omitBy=Tv,p.once=Oy,p.orderBy=ly,p.over=Nm,p.overArgs=Ry,p.overEvery=Cm,p.overSome=$m,p.partial=qn,p.partialRight=Bc,p.partition=py,p.pick=Av,p.pickBy=ru,p.property=uu,p.propertyOf=Tm,p.pull=lg,p.pullAll=Fc,p.pullAllBy=pg,p.pullAllWith=fg,p.pullAt=dg,p.range=Am,p.rangeRight=xm,p.rearg=Ny,p.reject=gy,p.remove=gg,p.rest=Cy,p.reverse=Dn,p.sampleSize=vy,p.set=Dv,p.setWith=Fv,p.shuffle=my,p.slice=yg,p.sortBy=by,p.sortedUniq=Ig,p.sortedUniqBy=Pg,p.split=sm,p.spread=$y,p.tail=Sg,p.take=Og,p.takeRight=Rg,p.takeRightWhile=Ng,p.takeWhile=Cg,p.tap=Vg,p.throttle=Ty,p.thru=ss,p.toArray=Yc,p.toPairs=iu,p.toPairsIn=su,p.toPath=Um,p.toPlainObject=Xc,p.transform=jv,p.unary=Ay,p.union=$g,p.unionBy=Tg,p.unionWith=Ag,p.uniq=xg,p.uniqBy=Dg,p.uniqWith=Fg,p.unset=qv,p.unzip=Fn,p.unzipWith=jc,p.update=Uv,p.updateWith=Mv,p.values=Pr,p.valuesIn=Lv,p.without=jg,p.words=au,p.wrap=xy,p.xor=qg,p.xorBy=Ug,p.xorWith=Mg,p.zip=Lg,p.zipObject=kg,p.zipObjectDeep=zg,p.zipWith=Hg,p.entries=iu,p.entriesIn=su,p.extend=eu,p.extendWith=ls,Kn(p,p),p.add=Lm,p.attempt=cu,p.camelCase=Vv,p.capitalize=nu,p.ceil=km,p.clamp=kv,p.clone=Fy,p.cloneDeep=qy,p.cloneDeepWith=Uy,p.cloneWith=jy,p.conformsTo=My,p.deburr=ou,p.defaultTo=wm,p.divide=zm,p.endsWith=Kv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Wv,p.every=ey,p.find=ry,p.findIndex=Tc,p.findKey=gv,p.findLast=iy,p.findLastIndex=Ac,p.findLastKey=yv,p.floor=Hm,p.forEach=Uc,p.forEachRight=Mc,p.forIn=vv,p.forInRight=mv,p.forOwn=wv,p.forOwnRight=_v,p.get=Ln,p.gt=Ly,p.gte=ky,p.has=Iv,p.hasIn=kn,p.head=Dc,p.identity=Me,p.includes=cy,p.indexOf=ig,p.inRange=zv,p.invoke=Ov,p.isArguments=er,p.isArray=H,p.isArrayBuffer=zy,p.isArrayLike=qe,p.isArrayLikeObject=ge,p.isBoolean=Hy,p.isBuffer=kt,p.isDate=Vy,p.isElement=Ky,p.isEmpty=By,p.isEqual=Wy,p.isEqualWith=Jy,p.isError=Un,p.isFinite=Gy,p.isFunction=St,p.isInteger=Wc,p.isLength=us,p.isMap=Jc,p.isMatch=Qy,p.isMatchWith=Yy,p.isNaN=Zy,p.isNative=Xy,p.isNil=tv,p.isNull=ev,p.isNumber=Gc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ri,p.isRegExp=Mn,p.isSafeInteger=rv,p.isSet=Qc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Ir,p.isUndefined=iv,p.isWeakMap=sv,p.isWeakSet=nv,p.join=cg,p.kebabCase=Jv,p.last=rt,p.lastIndexOf=ug,p.lowerCase=Gv,p.lowerFirst=Qv,p.lt=ov,p.lte=av,p.max=Vm,p.maxBy=Km,p.mean=Bm,p.meanBy=Wm,p.min=Jm,p.minBy=Gm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=Dm,p.stubString=Fm,p.stubTrue=jm,p.multiply=Qm,p.nth=hg,p.noConflict=Om,p.noop=Bn,p.now=os,p.pad=Yv,p.padEnd=Zv,p.padStart=Xv,p.parseInt=em,p.random=Hv,p.reduce=fy,p.reduceRight=dy,p.repeat=tm,p.replace=rm,p.result=xv,p.round=Ym,p.runInContext=v,p.sample=yy,p.size=wy,p.snakeCase=im,p.some=_y,p.sortedIndex=vg,p.sortedIndexBy=mg,p.sortedIndexOf=wg,p.sortedLastIndex=_g,p.sortedLastIndexBy=bg,p.sortedLastIndexOf=Eg,p.startCase=nm,p.startsWith=om,p.subtract=Zm,p.sum=Xm,p.sumBy=ew,p.template=am,p.times=qm,p.toFinite=Ot,p.toInteger=V,p.toLength=Zc,p.toLower=cm,p.toNumber=it,p.toSafeInteger=cv,p.toString=te,p.toUpper=um,p.trim=hm,p.trimEnd=lm,p.trimStart=pm,p.truncate=fm,p.unescape=dm,p.uniqueId=Mm,p.upperCase=gm,p.upperFirst=zn,p.each=Uc,p.eachRight=Mc,p.first=Dc,Kn(p,function(){var e={};return dt(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){G.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new G(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,ft),type:e+(c.__dir__<0?"Right":"")}),c},G.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==xo||n==hl;G.prototype[e]=function(h){var f=this.clone();return f.__iteratees__.push({iteratee:M(h,3),type:n}),f.__filtered__=f.__filtered__||c,f}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");G.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");G.prototype[e]=function(){return this.__filtered__?new G(this):this[n](1)}}),G.prototype.compact=function(){return this.filter(Me)},G.prototype.find=function(e){return this.filter(e).head()},G.prototype.findLast=function(e){return this.reverse().find(e)},G.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new G(this):this.map(function(n){return Qr(n,e,i)})}),G.prototype.reject=function(e){return this.filter(cs(M(e)))},G.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new G(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},G.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},G.prototype.toArray=function(){return this.take(ft)},dt(G.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],f=c||/^find/.test(i);h&&(p.prototype[i]=function(){var d=this.__wrapped__,y=c?[1]:arguments,m=d instanceof G,P=y[0],S=m||H(d),R=function(J){var Y=h.apply(p,Dt([J],y));return c&&T?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var T=this.__chain__,F=!!this.__actions__.length,L=f&&!T,K=m&&!F;if(!f&&S){d=K?d:new G(this);var k=e.apply(d,y);return k.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(k,T)}return L&&K?e.apply(this,y):(k=this.thru(R),L?c?k.value()[0]:k.value():k)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var f=this.value();return i.apply(H(f)?f:[],h)}return this[n](function(d){return i.apply(H(d)?d:[],h)})}}),dt(G.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(mr,c)||(mr[c]=[]),mr[c].push({name:i,func:n})}}),mr[Yi(r,Q).name]=[{name:"wrapper",func:r}],G.prototype.clone=df,G.prototype.reverse=gf,G.prototype.value=yf,p.prototype.at=Kg,p.prototype.chain=Bg,p.prototype.commit=Wg,p.prototype.next=Jg,p.prototype.plant=Qg,p.prototype.reverse=Yg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Zg,p.prototype.first=p.prototype.head,Hr&&(p.prototype[Hr]=Gg),p},gr=Bp();Bt?((Bt.exports=gr)._=gr,Hs._=gr):Ie._=gr}).call(ui)})(_o,_o.exports);var ME=Object.defineProperty,LE=Object.defineProperties,kE=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,HE=Object.prototype.propertyIsEnumerable,lh=(a,t,r)=>t in a?ME(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ds=(a,t)=>{for(var r in t||(t={}))zE.call(t,r)&&lh(a,r,t[r]);if(hh)for(var r of hh(t))HE.call(t,r)&&lh(a,r,t[r]);return a},VE=(a,t)=>LE(a,kE(t));function Vt(a,t,r){var s;const o=p_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${UE}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ar(a){return a.includes(":")?a.split(":")[1]:a}function tl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function KE(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function BE(a={},t={}){const r=ph(a),s=ph(t);return _o.exports.merge(r,s)}function ph(a){var t,r,s,o;const u={};if(!Nr(a))return u;for(const[l,g]of Object.entries(a)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=hi(l);u[N]=VE(ds(ds({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:ds(ds({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function WE(a){return a.includes(":")?a.split(":")[2]:a}function JE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:tl(s.accounts);t[r]={chains:g,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const rl={},ue=a=>rl[a],no=(a,t)=>{rl[a]=t};class GE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class QE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Vt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ar(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class YE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class ZE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class XE{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ar(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class eI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class tI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ar(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,ue("disableProviderPing")))}}class rI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Vt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Vt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,ue("disableProviderPing")))}}var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,dh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&dh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&dh(a,r,t[r]);return a},oo=(a,t)=>sI(a,nI(t));class Ao{constructor(t){this.events=new U.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ch})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ao(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=JE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Xh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(ir(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await PE.init({logger:this.providerOpts.logger||ch,relayUrl:this.providerOpts.relayUrl||FE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>hi(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=KE(r,this.session),o=tl(s),u=BE(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new QE({namespace:l});break;case"solana":this.rpcProviders[r]=new YE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new ZE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new GE({namespace:l});break;case"cip34":this.rpcProviders[r]=new XE({namespace:l});break;case"elrond":this.rpcProviders[r]=new eI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new tI({namespace:l});break;case"near":this.rpcProviders[r]=new rI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&ir(o)&&this.events.emit("accountsChanged",o.map(WE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=hi(o),g=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Tt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>hi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=hi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${uh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${uh}/${t}`)}}const cI=Ao,uI="wc",hI="ethereum_provider",lI=`${uI}@2:${hI}:`,pI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],il=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],sl=["chainChanged","accountsChanged","message","disconnect","connect"];var fI=Object.defineProperty,dI=Object.defineProperties,gI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,yI=Object.prototype.hasOwnProperty,vI=Object.prototype.propertyIsEnumerable,yh=(a,t,r)=>t in a?fI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,pi=(a,t)=>{for(var r in t||(t={}))yI.call(t,r)&&yh(a,r,t[r]);if(gh)for(var r of gh(t))vI.call(t,r)&&yh(a,r,t[r]);return a},vh=(a,t)=>dI(a,gI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function mI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:g}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:pi({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:il))],events:[...new Set(w.events.concat(l!=null&&l.length?l:sl))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new U.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=lI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=mI(this.rpc);try{const o=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(vh(pi({namespaces:pi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!o)return;const u=pw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",vh(pi({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await cI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-Tppnb03H.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(pi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${pI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const wI=Os;exports.EthereumProvider=wI;exports.OPTIONAL_EVENTS=sl;exports.OPTIONAL_METHODS=il;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as xo, dr as ot, d as Z, aI as Ow, ds as Do, dm as $u } from "./index-
|
|
2
|
-
import { s as Fo, x as Lh, r as kh, H as Rw, c as zh, q as Ss } from "./evm-
|
|
3
|
-
import { c as F } from "./index-
|
|
4
|
-
import { I as ur, f as gt, t as nt, c as Cu, C as $w, d as Cw, r as Nw, a as xr, g as Hh, i as bt, b as Cs, e as Nu, h as Tw, j as Aw, k as Ns, p as Vh, T as Ts, l as As, E as ke, m as xw, y as Qe, P as Tu, Q as Dw, n as Fw, o as qo, q as xs, s as Bt, _ as qw, u as jw, v as Au } from "./index-
|
|
1
|
+
import { g as xo, dr as ot, d as Z, aI as Ow, ds as Do, dm as $u } from "./index-C_jwGx2-.mjs";
|
|
2
|
+
import { s as Fo, x as Lh, r as kh, H as Rw, c as zh, q as Ss } from "./evm-D10FMflO.mjs";
|
|
3
|
+
import { c as F } from "./index-BPe5meha.mjs";
|
|
4
|
+
import { I as ur, f as gt, t as nt, c as Cu, C as $w, d as Cw, r as Nw, a as xr, g as Hh, i as bt, b as Cs, e as Nu, h as Tw, j as Aw, k as Ns, p as Vh, T as Ts, l as As, E as ke, m as xw, y as Qe, P as Tu, Q as Dw, n as Fw, o as qo, q as xs, s as Bt, _ as qw, u as jw, v as Au } from "./index-Cc13Eu8K.mjs";
|
|
5
5
|
var se = {};
|
|
6
6
|
Object.defineProperty(se, "__esModule", { value: !0 });
|
|
7
7
|
se.getLocalStorage = se.getLocalStorageOrThrow = se.getCrypto = se.getCryptoOrThrow = se.getLocation = se.getLocationOrThrow = se.getNavigator = se.getNavigatorOrThrow = se.getDocument = se.getDocumentOrThrow = se.getFromWindowOrThrow = se.getFromWindow = void 0;
|
|
@@ -7673,7 +7673,7 @@ class Qo {
|
|
|
7673
7673
|
if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? $s(this.rpc.chains) : $s(this.rpc.optionalChains), this.signer = await KI.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
|
|
7674
7674
|
let r;
|
|
7675
7675
|
try {
|
|
7676
|
-
const { WalletConnectModal: s } = await import("./index-
|
|
7676
|
+
const { WalletConnectModal: s } = await import("./index-6T4B560h.mjs").then((o) => o.i);
|
|
7677
7677
|
r = s;
|
|
7678
7678
|
} catch {
|
|
7679
7679
|
throw new Error("To use QR modal, please install @walletconnect/modal package");
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("./index-Byf4HvjQ.js");exports.AutomaticCCTPRoute=R.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=R.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=R.AutomaticTokenBridgeRoute;exports.CCTPRoute=R.CCTPRoute;exports.DEFAULT_ROUTES=R.DEFAULT_ROUTES;exports.ERR_AMOUNT_TOO_LARGE=R.ERR_AMOUNT_TOO_LARGE;exports.ERR_AMOUNT_TOO_SMALL=R.ERR_AMOUNT_TOO_SMALL;exports.ERR_DESTINATION_CONTRACT_PAUSED=R.ERR_DESTINATION_CONTRACT_PAUSED;exports.ERR_INSUFFICIENT_ALLOWANCE=R.ERR_INSUFFICIENT_ALLOWANCE;exports.ERR_INSUFFICIENT_GAS=R.ERR_INSUFFICIENT_GAS;exports.ERR_NOT_ENOUGH_CAPACITY=R.ERR_NOT_ENOUGH_CAPACITY;exports.ERR_RELAY_FAILED=R.ERR_RELAY_FAILED;exports.ERR_SOURCE_CONTRACT_PAUSED=R.ERR_SOURCE_CONTRACT_PAUSED;exports.ERR_TIMEOUT=R.ERR_TIMEOUT;exports.ERR_UNKNOWN=R.ERR_UNKNOWN;exports.ERR_UNSUPPORTED_ABI_VERSION=R.ERR_UNSUPPORTED_ABI_VERSION;exports.ERR_USER_REJECTED=R.ERR_USER_REJECTED;exports.MAINNET=R.MAINNET;exports.MayanRoute=R.MayanRoute;exports.MayanRouteMCTP=R.MayanRouteMCTP;exports.MayanRouteSHUTTLE=R.MayanRouteSHUTTLE;exports.MayanRouteSWIFT=R.MayanRouteSWIFT;exports.MayanRouteWH=R.MayanRouteWH;exports.TESTNET=R.TESTNET;exports.Token=R.Token;exports.TokenBridgeRoute=R.TokenBridgeRoute;exports.buildConfig=R.buildConfig;exports.default=R.WormholeConnect;exports.getTokenDetails=R.getTokenDetails;exports.getTransferDetails=R.getTransferDetails;exports.nttAutomaticRoute=R.nttAutomaticRoute;exports.nttManualRoute=R.nttManualRoute;exports.nttRoutes=R.nttRoutes;exports.wormholeConnectHosted=R.wormholeConnectHosted;
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dO as s, dQ as e, dM as E, dP as t, dI as T, e3 as d, e4 as o, e0 as _, dZ as A, e2 as N, d_ as u, e8 as O, d$ as C, e6 as n, e7 as U, e1 as I, e5 as S, dE as M, dR as i, dT as D, dV as L, dU as P, dS as r, dF as F, dH as c, dN as l, dG as m, dD as g, dX as y, dY as H, dK as W, dL as f, dJ as k, dW as G } from "./index-
|
|
1
|
+
import { dO as s, dQ as e, dM as E, dP as t, dI as T, e3 as d, e4 as o, e0 as _, dZ as A, e2 as N, d_ as u, e8 as O, d$ as C, e6 as n, e7 as U, e1 as I, e5 as S, dE as M, dR as i, dT as D, dV as L, dU as P, dS as r, dF as F, dH as c, dN as l, dG as m, dD as g, dX as y, dY as H, dK as W, dL as f, dJ as k, dW as G } from "./index-C_jwGx2-.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as AutomaticCCTPRoute,
|
|
4
4
|
e as AutomaticPorticoRoute,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var x = (i, t, e) => t in i ? S(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var m = (i, t, e) => x(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { b6 as I, b7 as R, b0 as y, ad as _, K as A, b8 as M, b9 as L, ba as U, b1 as O, b2 as w,
|
|
4
|
+
import { b6 as I, b7 as R, b0 as y, ad as _, K as A, b8 as M, b9 as L, ba as U, b1 as O, b2 as w, ap as C } from "./index-C_jwGx2-.mjs";
|
|
5
5
|
const b = 0.5, F = 1, E = 1, T = 1e8, k = 5, D = 25e4;
|
|
6
6
|
async function N(i, t, e) {
|
|
7
7
|
const [s, r] = await _.chainFromRpc(i), n = typeof t == "string" ? A.fromSecretKey(M.decode(t)) : t;
|
|
@@ -157,7 +157,7 @@ async function v(i, t, e = b, s = F, r = E, n = T) {
|
|
|
157
157
|
}
|
|
158
158
|
return Math.min(Math.max(a, r), n);
|
|
159
159
|
}
|
|
160
|
-
async function
|
|
160
|
+
async function Y(i, t, e = b, s = F, r = E, n = T) {
|
|
161
161
|
const a = e * 1e4;
|
|
162
162
|
if (a < 1 || a > 1e4)
|
|
163
163
|
throw new Error("percentile must be between 0.0001 and 1");
|
|
@@ -177,6 +177,6 @@ async function q(i, t, e = b, s = F, r = E, n = T) {
|
|
|
177
177
|
}
|
|
178
178
|
export {
|
|
179
179
|
v as a,
|
|
180
|
-
|
|
180
|
+
Y as d,
|
|
181
181
|
N as g
|
|
182
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var B=(i,t,e)=>t in i?k(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var f=(i,t,e)=>B(i,typeof t!="symbol"?t+"":t,e);const a=require("./index-
|
|
1
|
+
"use strict";var k=Object.defineProperty;var B=(i,t,e)=>t in i?k(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var f=(i,t,e)=>B(i,typeof t!="symbol"?t+"":t,e);const a=require("./index-Byf4HvjQ.js"),y=.5,F=1,b=1,E=1e8,T=5,x=25e4;async function I(i,t,e){const[n,r]=await a.SolanaPlatform.chainFromRpc(i),s=typeof t=="string"?a.Keypair.fromSecretKey(a.b58.decode(t)):t;if(e!=null&&e.priorityFee&&e.priorityFee.percentile&&e.priorityFee.percentile>1)throw new Error("priorityFeePercentile must be a number between 0 and 1");return new R(i,r,s,(e==null?void 0:e.debug)??!1,(e==null?void 0:e.priorityFee)??{},(e==null?void 0:e.retries)??T,e==null?void 0:e.sendOpts)}class R{constructor(t,e,n,r=!1,s,c=T,d){f(this,"_rpc");f(this,"_chain");f(this,"_keypair");f(this,"_debug");f(this,"_priorityFee");f(this,"_maxResubmits");f(this,"_sendOpts");this._rpc=t,this._chain=e,this._keypair=n,this._debug=r,this._priorityFee=s,this._maxResubmits=c,this._sendOpts=d,this._sendOpts=this._sendOpts??{preflightCommitment:this._rpc.commitment}}chain(){return this._chain}address(){return this._keypair.publicKey.toBase58()}retryable(t){var n;if(t instanceof a.TransactionExpiredBlockheightExceededError)return!0;if(!(t instanceof a.SendTransactionError)||!t.message.includes("Transaction simulation failed"))return!1;if(t.message.includes("Blockhash not found"))return!0;const e=(n=t.logs)==null?void 0:n.find(r=>r.startsWith("Program log: Error: "));return e?!!(e.includes("Not enough bytes")||e.includes("Unexpected length of input")):!1}async signAndSend(t){var d;let{blockhash:e,lastValidBlockHeight:n}=await a.SolanaPlatform.latestBlock(this._rpc);const r=[];for(const l of t){const{description:g,transaction:{transaction:o,signers:u}}=l;this._debug&&console.log(`Signing: ${g} for ${this.address()}`);let h;(d=this._priorityFee)!=null&&d.percentile&&this._priorityFee.percentile>0&&(h=await M(this._rpc,o,this._priorityFee.percentile,this._priorityFee.percentileMultiple,this._priorityFee.min,this._priorityFee.max)),this._debug&&A(o);for(let m=0;m<this._maxResubmits;m++)try{if(a.isVersionedTransaction(o)){if(h&&m===0){const _=a.TransactionMessage.decompile(o.message);_.instructions.push(...h),o.message=_.compileToV0Message()}o.message.recentBlockhash=e,o.sign([this._keypair,...u??[]])}else h&&m===0&&o.add(...h),o.recentBlockhash=e,o.lastValidBlockHeight=n,o.partialSign(this._keypair,...u??[]);this._debug&&console.log("Submitting transactions ");const{signature:p}=await a.SolanaPlatform.sendTxWithRetry(this._rpc,o.serialize(),this._sendOpts);r.push(p);break}catch(p){if(m===this._maxResubmits-1||!this.retryable(p))throw p;this._debug&&console.log(`Failed to send transaction on attempt ${m}, retrying: `,p);const{blockhash:_,lastValidBlockHeight:S}=await a.SolanaPlatform.latestBlock(this._rpc);n=S,e=_}}this._debug&&console.log("Waiting for confirmation for: ",r);const c=(await Promise.all(r.map(async l=>{try{return await this._rpc.confirmTransaction({signature:l,blockhash:e,lastValidBlockHeight:n},this._rpc.commitment)}catch(g){throw console.error("Failed to confirm transaction: ",g),g}}))).filter(l=>l.value.err).map(l=>l.value.err);if(c.length>0)throw new Error(`Failed to confirm transaction: ${c}`);return r}}function A(i){if(a.isVersionedTransaction(i)){console.log(i.signatures);const t=i.message,e=t.getAccountKeys();t.compiledInstructions.forEach(n=>{console.log("Program",e.get(n.programIdIndex).toBase58()),console.log("Data: ",a.hex.encode(n.data)),console.log("Keys: ",n.accountKeyIndexes.map(r=>[r,e.get(r).toBase58()]))})}else console.log(i.signatures),console.log(i.feePayer),i.instructions.forEach(t=>{console.log("Program",t.programId.toBase58()),console.log("Data: ",t.data.toString("hex")),console.log("Keys: ",t.keys.map(e=>[e,e.pubkey.toBase58()]))})}async function M(i,t,e=y,n=F,r=b,s=E){const[c,d]=await Promise.all([L(i,t),P(i,t,e,n,r,s)]);return[a.ComputeBudgetProgram.setComputeUnitLimit({units:c}),a.ComputeBudgetProgram.setComputeUnitPrice({microLamports:d})]}async function L(i,t){var n;let e=x;try{const r=await(a.isVersionedTransaction(t),i.simulateTransaction(t));r.value.err&&console.error(`Error simulating Solana transaction: ${r.value.err}`),(n=r==null?void 0:r.value)!=null&&n.unitsConsumed&&(e=Math.round(r.value.unitsConsumed*1.2))}catch(r){console.error(`Failed to calculate compute unit limit for Solana transaction: ${r}`)}return e}async function w(i,t){if(a.isVersionedTransaction(t)){const e=(await Promise.all(t.message.addressTableLookups.map(s=>i.getAddressLookupTable(s.accountKey)))).map(s=>s.value).filter(s=>s!==null),n=t.message,r=n.getAccountKeys({addressLookupTableAccounts:e??void 0});return n.compiledInstructions.flatMap(s=>s.accountKeyIndexes).map(s=>n.isAccountWritable(s)?r.get(s):null).filter(Boolean)}else return t.instructions.flatMap(e=>e.keys).map(e=>e.isWritable?e.pubkey:null).filter(Boolean)}async function P(i,t,e=y,n=F,r=b,s=E){let c=r;const d=await w(i,t);try{const l=await i.getRecentPrioritizationFees({lockedWritableAccounts:d});if(l){const g=l.map(u=>u.prioritizationFee).sort((u,h)=>u-h),o=Math.ceil(g.length*e);if(g.length>o){let u=g[o];n>0&&(u*=n),c=Math.max(c,u)}}}catch(l){console.error("Error fetching Solana recent fees",l)}return Math.min(Math.max(c,r),s)}async function U(i,t,e=y,n=F,r=b,s=E){const c=e*1e4;if(c<1||c>1e4)throw new Error("percentile must be between 0.0001 and 1");const d=i._rpcRequest,g=[await w(i,t),{percentile:c}],o=await d("getRecentPrioritizationFees",g);if(o.error)throw new Error(o.error);const u=o.result.map(m=>m.prioritizationFee);if(u.length===0)return r;const h=Math.floor(a.median(u)*(n>0?n:1));return a.bound(h,r,s)}exports.determinePriorityFee=P;exports.determinePriorityFeeTritonOne=U;exports.getSolanaSignAndSendSigner=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Byf4HvjQ.js"),i=require("./signer-C7H-eJ3E.js"),a={Address:e.SolanaAddress,Platform:e.SolanaPlatform,getSigner:i.getSolanaSignAndSendSigner,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-Byf4HvjQ.js")).then(r=>r.index$2),TokenBridge:()=>Promise.resolve().then(()=>require("./index-Dhq7Pqaa.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-6fgWKB7X.js")),TBTCBridge:()=>Promise.resolve().then(()=>require("./index-D1Cr8uoN.js"))},getChain:(r,o,n)=>new e.SolanaChain(o,new e.SolanaPlatform(r,e.applyChainsConfigConfigOverrides(r,e._platform$1,{[o]:n})))};exports.default=a;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ac as i, ad as r, ae as n, aa as s, af as t } from "./index-C_jwGx2-.mjs";
|
|
2
|
+
import { g as l } from "./signer-BtFJ4Ldr.mjs";
|
|
3
|
+
const m = {
|
|
4
|
+
Address: n,
|
|
5
|
+
Platform: r,
|
|
6
|
+
getSigner: l,
|
|
7
|
+
protocols: {
|
|
8
|
+
WormholeCore: () => import("./index-C_jwGx2-.mjs").then((a) => a.ea),
|
|
9
|
+
TokenBridge: () => import("./index-Dv30dU3D.mjs"),
|
|
10
|
+
CircleBridge: () => import("./index-ChaEETit.mjs"),
|
|
11
|
+
TBTCBridge: () => import("./index-DFp32sYl.mjs")
|
|
12
|
+
},
|
|
13
|
+
getChain: (a, o, e) => new i(o, new r(a, s(a, t, { [o]: e })))
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
m as default
|
|
17
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { aI as Zt, P as O, aZ as st, aK as Yt, a_ as It, aO as ht, aS as $, V as Nt, a$ as wt, b0 as ct, b1 as Qt, aX as dt, b2 as Dt, aY as Z, b3 as Ut, b4 as kt, C as St, b5 as Wt } from "./index-
|
|
1
|
+
import { aI as Zt, P as O, aZ as st, aK as Yt, a_ as It, aO as ht, aS as $, V as Nt, a$ as wt, b0 as ct, b1 as Qt, aX as dt, b2 as Dt, aY as Z, b3 as Ut, b4 as kt, C as St, b5 as Wt } from "./index-C_jwGx2-.mjs";
|
|
2
2
|
import { a as Gt } from "./util--bw7gFPs.mjs";
|
|
3
3
|
import { g as _t } from "./wallets-B2tqS5lZ.mjs";
|
|
4
|
-
import { d as vt, a as Pt } from "./signer-
|
|
4
|
+
import { d as vt, a as Pt } from "./signer-BtFJ4Ldr.mjs";
|
|
5
5
|
var xt = { exports: {} };
|
|
6
6
|
(function(s) {
|
|
7
7
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
@@ -769,7 +769,7 @@ class oe extends q {
|
|
|
769
769
|
this._connecting = !0;
|
|
770
770
|
let e;
|
|
771
771
|
try {
|
|
772
|
-
e = (await import("./solanaEmbed.esm-
|
|
772
|
+
e = (await import("./solanaEmbed.esm-YmIZqr64.mjs")).default;
|
|
773
773
|
} catch (a) {
|
|
774
774
|
throw new Et(a == null ? void 0 : a.message, a);
|
|
775
775
|
}
|
|
@@ -925,7 +925,7 @@ class ge extends gt {
|
|
|
925
925
|
this._connecting = !0;
|
|
926
926
|
let e, t;
|
|
927
927
|
try {
|
|
928
|
-
({ WalletConnectWallet: e, WalletConnectChainID: t } = await import("./index-
|
|
928
|
+
({ WalletConnectWallet: e, WalletConnectChainID: t } = await import("./index-R-_MpR3F.mjs"));
|
|
929
929
|
} catch (a) {
|
|
930
930
|
throw new Et(a == null ? void 0 : a.message, a);
|
|
931
931
|
}
|