@dhedge/trading-widget 6.3.5 → 6.4.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/const.cjs +1 -1
- package/const.js +1 -1
- package/contract-error-log-C66ELh8m.cjs +1 -0
- package/{contract-error-log-B5cBnMzk.js → contract-error-log-CaRlTnoL.js} +133 -128
- package/core-kit/const/gmx.d.ts +1 -0
- package/core-kit/utils/number.d.ts +1 -0
- package/{gmx-DJ0gqvLq.cjs → gmx-BTdr6Yvr.cjs} +1 -1
- package/{gmx-Cyz_GmV5.js → gmx-Dc6vyoji.js} +4 -2
- package/index.cjs +1 -1
- package/index.js +756 -754
- package/limit-orders/common/utils.d.ts +0 -1
- package/package.json +1 -1
- package/utils.cjs +1 -1
- package/utils.js +38 -37
- package/contract-error-log-BK2h_izP.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hyperEvm as H, mainnet as I, polygon as at, optimism as rt, base as ot, arbitrum as it } from "wagmi/chains";
|
|
2
|
-
import { aq as ct, ao as ut, ap as dt, a as
|
|
2
|
+
import { aq as ct, ao as ut, ap as dt, a as N, q as R, ar as pt, as as lt, a5 as mt, ak as yt, a3 as gt, b as At, ae as Et, Z as k, aj as ht, at as V, e as ft, d as St, M as Tt, R as wt, P as _t, au as bt, av as Dt, Q as It, N as Nt, ah as _, _ as Rt, W as Ot, X as Ct, U as xt, aw as q, ax as Bt, ay as Lt, az as Mt, aA as Pt, aB as Ut, ad as $t } from "./gmx-Dc6vyoji.js";
|
|
3
3
|
import d from "bignumber.js";
|
|
4
|
-
import { zeroHash as vt, bytesToHex as Ft, pad as Yt, stringToHex as O, encodeAbiParameters as T, encodeFunctionData as
|
|
4
|
+
import { zeroHash as vt, bytesToHex as Ft, pad as Yt, stringToHex as O, encodeAbiParameters as T, encodeFunctionData as A, maxUint256 as w, erc20Abi as K } from "viem";
|
|
5
5
|
const B = "application/json";
|
|
6
6
|
class j extends Error {
|
|
7
7
|
constructor(e, s, n) {
|
|
@@ -60,14 +60,14 @@ const Xe = (t) => {
|
|
|
60
60
|
timeoutMs: i,
|
|
61
61
|
maxResponseBytes: u
|
|
62
62
|
}) => {
|
|
63
|
-
const l = n !== void 0 && s !== "GET",
|
|
64
|
-
o === "json" && !m.has("Accept") && m.set("Accept", B),
|
|
63
|
+
const l = n !== void 0 && s !== "GET", g = l && !Gt(n), m = new Headers(e);
|
|
64
|
+
o === "json" && !m.has("Accept") && m.set("Accept", B), g && !m.has("Content-Type") && m.set("Content-Type", B);
|
|
65
65
|
const f = i ? Ht(i, r) : void 0, nt = {
|
|
66
66
|
method: s,
|
|
67
67
|
headers: m,
|
|
68
68
|
signal: f?.signal ?? r,
|
|
69
69
|
...c && { cache: c },
|
|
70
|
-
...l && { body:
|
|
70
|
+
...l && { body: g ? JSON.stringify(n) : n }
|
|
71
71
|
};
|
|
72
72
|
try {
|
|
73
73
|
const E = await fetch(Wt(t, a), nt);
|
|
@@ -368,7 +368,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
368
368
|
}, L = (t) => t ? Yt(S(t), { size: 32 }) : vt, me = (t) => {
|
|
369
369
|
if (!t) throw new Error("Cannot decode an empty base64 string");
|
|
370
370
|
return Ft(Uint8Array.from(atob(t), (e) => e.charCodeAt(0)));
|
|
371
|
-
}, ye = (t, e) => dt[e]?.[t] ??
|
|
371
|
+
}, ye = (t, e) => dt[e]?.[t] ?? N, ss = (t) => ut[t], ns = (t) => t && `${t.substring(0, 6)}...${t.substring(
|
|
372
372
|
t.length - 4,
|
|
373
373
|
t.length
|
|
374
374
|
)}`, as = ({
|
|
@@ -380,21 +380,25 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
380
380
|
e
|
|
381
381
|
);
|
|
382
382
|
return p(t, s);
|
|
383
|
-
},
|
|
383
|
+
}, ge = ({
|
|
384
384
|
sourceAddress: t,
|
|
385
385
|
amount: e
|
|
386
386
|
}) => `${t}_${e}`, rs = (t, e) => {
|
|
387
387
|
const s = t.slice(0, e), n = t.slice(e);
|
|
388
388
|
return { firstPart: s, secondPart: n };
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
}, Ae = (t, e) => t / e * 100, os = (t) => t < 1 ? 4 : t < 10 ? 3 : 2, is = (t, e = R) => new d(t.toString()).shiftedBy(e).toFixed(0), cs = (t) => {
|
|
390
|
+
const e = t?.trim();
|
|
391
|
+
return e ? !isNaN(Number(e)) && Number(e) > 0 : !1;
|
|
392
|
+
}, us = (t, e, s, n) => new d(e).dividedBy(s).multipliedBy(t).shiftedBy(-(n || R)).toNumber(), ds = (t) => {
|
|
393
|
+
const e = new d(t || "0").shiftedBy(R);
|
|
394
|
+
return e.isFinite() ? BigInt(e.toFixed(0, d.ROUND_DOWN)) : BigInt(0);
|
|
395
|
+
}, J = (t) => {
|
|
392
396
|
const e = new d(0.01), s = new d(t), n = !s.isZero() && s.lt(e) ? e : s;
|
|
393
397
|
return BigInt(n.multipliedBy(100).toFixed(0));
|
|
394
|
-
},
|
|
398
|
+
}, ps = ({
|
|
395
399
|
chainId: t,
|
|
396
400
|
slippage: e
|
|
397
|
-
}) => t === H.id ? BigInt(0) : J(e),
|
|
401
|
+
}) => t === H.id ? BigInt(0) : J(e), ls = ({
|
|
398
402
|
vaultAddress: t,
|
|
399
403
|
swapData: e,
|
|
400
404
|
sendTokenAddress: s,
|
|
@@ -407,7 +411,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
407
411
|
}) => {
|
|
408
412
|
const u = new d(c).multipliedBy(1 - i / 100).toFixed(0), l = [O(o, { size: 32 }), e];
|
|
409
413
|
return [t, [[s, n, l], [a, u]], r];
|
|
410
|
-
},
|
|
414
|
+
}, ms = ({
|
|
411
415
|
receiveAssetAddress: t,
|
|
412
416
|
assets: e,
|
|
413
417
|
swapData: s,
|
|
@@ -423,9 +427,9 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
423
427
|
const l = [
|
|
424
428
|
O(u.routerKey, { size: 32 }),
|
|
425
429
|
u.rawTransaction.data
|
|
426
|
-
],
|
|
430
|
+
], g = [i.address, i.rawBalance, l];
|
|
427
431
|
return {
|
|
428
|
-
srcData: [...c.srcData,
|
|
432
|
+
srcData: [...c.srcData, g],
|
|
429
433
|
destAmount: c.destAmount.plus(u.destinationAmount)
|
|
430
434
|
};
|
|
431
435
|
}, a) ?? a;
|
|
@@ -449,14 +453,14 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
449
453
|
withdrawData: "",
|
|
450
454
|
slippageTolerance: BigInt(0)
|
|
451
455
|
};
|
|
452
|
-
const { srcData: r, dstData: o } = s, c = r.map(({ asset: l, amount:
|
|
453
|
-
const m = e?.[
|
|
456
|
+
const { srcData: r, dstData: o } = s, c = r.map(({ asset: l, amount: g }) => {
|
|
457
|
+
const m = e?.[ge({
|
|
454
458
|
sourceAddress: l,
|
|
455
|
-
amount:
|
|
459
|
+
amount: g.toString()
|
|
456
460
|
})]?.find((f) => f.routerKey === a);
|
|
457
461
|
return {
|
|
458
462
|
asset: l,
|
|
459
|
-
amount:
|
|
463
|
+
amount: g,
|
|
460
464
|
swapData: {
|
|
461
465
|
routerKey: O(m?.routerKey ?? "", { size: 32 }),
|
|
462
466
|
txData: m?.rawTransaction.data ?? "0x"
|
|
@@ -480,7 +484,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
480
484
|
withdrawData: u,
|
|
481
485
|
slippageTolerance: n
|
|
482
486
|
};
|
|
483
|
-
},
|
|
487
|
+
}, ys = ({
|
|
484
488
|
chainId: t,
|
|
485
489
|
txHash: e,
|
|
486
490
|
error: s
|
|
@@ -489,20 +493,20 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
489
493
|
return !1;
|
|
490
494
|
const n = s instanceof Error ? s.message : String(s);
|
|
491
495
|
return /\bNo Result\b/i.test(n);
|
|
492
|
-
},
|
|
496
|
+
}, gs = ({
|
|
493
497
|
chainId: t,
|
|
494
498
|
action: e,
|
|
495
499
|
isRabbyWallet: s
|
|
496
|
-
}) => e === "update_ondo_prices" && t === I.id && s ? mt : t ? yt[t] ?? 0 : 0, As = (t, e) =>
|
|
500
|
+
}) => e === "update_ondo_prices" && t === I.id && s ? mt : t ? yt[t] ?? 0 : 0, As = (t, e) => At[e]?.nativeTokenSymbol === t, Es = ({
|
|
497
501
|
nativeTokenBalance: t,
|
|
498
502
|
tokenDecimals: e,
|
|
499
503
|
gasPrice: s
|
|
500
504
|
}) => {
|
|
501
|
-
const n = new d(s).multipliedBy(
|
|
505
|
+
const n = new d(s).multipliedBy(gt).shiftedBy(-e), a = new d(t).minus(
|
|
502
506
|
n
|
|
503
507
|
);
|
|
504
508
|
return a.gt("0") ? a : new d("0");
|
|
505
|
-
},
|
|
509
|
+
}, hs = (t) => Et.includes(t), fs = (t) => {
|
|
506
510
|
const e = Object.values(t).reduce(
|
|
507
511
|
(s, { type: n }) => (s[n] = s[n] + 1, s),
|
|
508
512
|
{ string: 0, number: 0 }
|
|
@@ -531,7 +535,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
531
535
|
).test(t)
|
|
532
536
|
);
|
|
533
537
|
return a ? { title: a.title, hint: a.hint } : void 0;
|
|
534
|
-
},
|
|
538
|
+
}, Ss = ({
|
|
535
539
|
errorMessage: t,
|
|
536
540
|
abiErrors: e
|
|
537
541
|
}) => {
|
|
@@ -554,7 +558,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
554
558
|
title: "Transaction failed",
|
|
555
559
|
hint: `${he(r ?? "")} ${s ? `: ${s}` : ""}`
|
|
556
560
|
};
|
|
557
|
-
},
|
|
561
|
+
}, Ts = (t) => typeof t == "number" && Number.isFinite(t), ws = (t) => typeof t == "bigint" && t !== BigInt(0), De = (t, e = V) => new d(t).shiftedBy(-e).toNumber(), Ie = (t) => !isNaN(parseFloat(t)) && !isNaN(t), Ne = ({
|
|
558
562
|
value: t,
|
|
559
563
|
minimumFractionDigits: e = 2,
|
|
560
564
|
maximumFractionDigits: s = 2,
|
|
@@ -566,7 +570,7 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
566
570
|
notation: n ? "compact" : void 0,
|
|
567
571
|
minimumFractionDigits: e,
|
|
568
572
|
maximumFractionDigits: s
|
|
569
|
-
}).format(a ? De(t) : Number(t)), U = (t) => Ie(t) ? new d(t).toFixed() : "", $ = ["₀", "₁", "₂", "₃", "₄", "₅", "₆", "₇", "₈", "₉"],
|
|
573
|
+
}).format(a ? De(t) : Number(t)), U = (t) => Ie(t) ? new d(t).toFixed() : "", $ = ["₀", "₁", "₂", "₃", "₄", "₅", "₆", "₇", "₈", "₉"], Re = ({
|
|
570
574
|
value: t,
|
|
571
575
|
decimals: e = 4
|
|
572
576
|
}) => {
|
|
@@ -580,13 +584,13 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
580
584
|
return `0.0${$[r.length]}${o.slice(0, 3)}`;
|
|
581
585
|
}
|
|
582
586
|
return U(s.toFixed(e));
|
|
583
|
-
}, Oe = (t, e = 0) => `${t.toLocaleString("en-US", { maximumFractionDigits: e })}%`,
|
|
584
|
-
const n =
|
|
587
|
+
}, Oe = (t, e = 0) => `${t.toLocaleString("en-US", { maximumFractionDigits: e })}%`, _s = (t) => t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), bs = (t, e, s = 0) => {
|
|
588
|
+
const n = Ae(+t, e);
|
|
585
589
|
return Oe(n, s);
|
|
586
|
-
},
|
|
590
|
+
}, Ds = ({
|
|
587
591
|
currency: t,
|
|
588
592
|
value: e
|
|
589
|
-
}) => t === "USD" ?
|
|
593
|
+
}) => t === "USD" ? Ne({ value: e }) : `${ft[t]} ${Re({
|
|
590
594
|
value: e,
|
|
591
595
|
decimals: St[t]
|
|
592
596
|
})}`, Ce = (t, e) => new d(
|
|
@@ -596,12 +600,12 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
596
600
|
return t;
|
|
597
601
|
const n = "...";
|
|
598
602
|
return t.length <= e + s + n.length ? t : `${t.slice(0, e)}${n}${t.slice(-s)}`;
|
|
599
|
-
},
|
|
603
|
+
}, Is = ({
|
|
600
604
|
balance: t,
|
|
601
605
|
symbol: e,
|
|
602
606
|
precision: s,
|
|
603
607
|
truncateSymbol: n
|
|
604
|
-
}) => `${Ce(t, s)} ${n ? xe(e) : e}`,
|
|
608
|
+
}) => `${Ce(t, s)} ${n ? xe(e) : e}`, Ns = (t) => {
|
|
605
609
|
if (!t)
|
|
606
610
|
return;
|
|
607
611
|
const e = t.match(/0x[a-fA-F0-9]{64}/);
|
|
@@ -609,13 +613,13 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
609
613
|
return;
|
|
610
614
|
const s = e[0];
|
|
611
615
|
return `${s.slice(0, 4)}...${s.slice(-3)}`;
|
|
612
|
-
}, Rs = (t) => p(bt, t) || p(Dt, t),
|
|
616
|
+
}, Rs = (t) => p(bt, t) || p(Dt, t), Os = (t) => Nt.some(
|
|
613
617
|
(e) => p(e, t)
|
|
614
|
-
),
|
|
618
|
+
), Cs = (t) => Tt[t.toLowerCase()] ?? {
|
|
615
619
|
symbol: "",
|
|
616
620
|
decimals: 18,
|
|
617
|
-
address:
|
|
618
|
-
},
|
|
621
|
+
address: N
|
|
622
|
+
}, xs = (t) => p(t, It) ? wt : _t, Be = (t) => `eth_${t}`, Bs = ({
|
|
619
623
|
action: t,
|
|
620
624
|
log: e,
|
|
621
625
|
symbol: s,
|
|
@@ -627,14 +631,14 @@ const p = (t, e) => t?.toLowerCase() === e?.toLowerCase(), es = (t) => p(t, ct),
|
|
|
627
631
|
[_.CHAIN_ID.NAME]: a,
|
|
628
632
|
[_.ADDRESS.NAME]: Be(n)
|
|
629
633
|
};
|
|
630
|
-
|
|
634
|
+
Rt[t].forEach((o) => {
|
|
631
635
|
e?.(o, r);
|
|
632
636
|
});
|
|
633
|
-
},
|
|
637
|
+
}, Ls = (t) => xt.some((e) => p(e, t)), Ms = (t) => Ot[t.toLowerCase()] ?? {
|
|
634
638
|
symbol: "",
|
|
635
639
|
decimals: 18,
|
|
636
|
-
address:
|
|
637
|
-
},
|
|
640
|
+
address: N
|
|
641
|
+
}, Ps = (t) => Ct[t.toLowerCase()], Le = "0x3333333333333333333333333333333333333333";
|
|
638
642
|
it.id + "", Ut.address, ot.id + "", Pt.address, rt.id + "", Mt.address, at.id + "", Lt.address, I.id + "", Bt.address, H.id + "", q.address;
|
|
639
643
|
const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x2000000000000000000000000000000000000000"), Pe = 10000n, Ue = (t) => p(t, Le), $e = (t) => {
|
|
640
644
|
if (p(t, Me))
|
|
@@ -645,7 +649,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
645
649
|
} catch {
|
|
646
650
|
return !1;
|
|
647
651
|
}
|
|
648
|
-
},
|
|
652
|
+
}, Us = (t) => Ue(t) || $e(t), $s = () => q, vs = /* @__PURE__ */ new Map(), et = (t, e) => !e || e.size === 0 ? t : t.map((s) => {
|
|
649
653
|
const n = e.get(
|
|
650
654
|
s.supportedAsset.toLowerCase()
|
|
651
655
|
);
|
|
@@ -685,14 +689,14 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
685
689
|
return c;
|
|
686
690
|
}
|
|
687
691
|
return null;
|
|
688
|
-
},
|
|
692
|
+
}, Fs = (t, e, s) => {
|
|
689
693
|
const n = (t ?? []).map((a) => ({
|
|
690
694
|
supportedAsset: a,
|
|
691
695
|
withdrawData: "",
|
|
692
696
|
slippageTolerance: e
|
|
693
697
|
}));
|
|
694
698
|
return et(n, s);
|
|
695
|
-
},
|
|
699
|
+
}, Ys = async (t, e, s, n, a) => {
|
|
696
700
|
for (const r of t) {
|
|
697
701
|
const o = J(r);
|
|
698
702
|
try {
|
|
@@ -718,7 +722,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
718
722
|
}
|
|
719
723
|
}
|
|
720
724
|
return null;
|
|
721
|
-
},
|
|
725
|
+
}, Gs = async (t, e, {
|
|
722
726
|
fetchAaveSwapParams: s,
|
|
723
727
|
fetchAaveSwapQuotes: n,
|
|
724
728
|
withdrawAmountD18: a,
|
|
@@ -744,7 +748,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
744
748
|
return console.error(i), { asset: o };
|
|
745
749
|
}
|
|
746
750
|
})
|
|
747
|
-
), F = (t) => Math.round(t * 100) / 100,
|
|
751
|
+
), F = (t) => Math.round(t * 100) / 100, Ws = ({
|
|
748
752
|
maxSlippage: t,
|
|
749
753
|
candidates: e = $t
|
|
750
754
|
}) => {
|
|
@@ -752,7 +756,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
752
756
|
return [];
|
|
753
757
|
const s = F(Math.min(t, 100)), n = e.filter((r) => r > 0 && r <= s).map(F), a = new Set(n);
|
|
754
758
|
return a.add(s), a.add(t), Array.from(a).sort((r, o) => r - o);
|
|
755
|
-
}, x = 1000000000000000000n, Ge = 1000000n, Y = 10000n, G = 100n,
|
|
759
|
+
}, x = 1000000000000000000n, Ge = 1000000n, Y = 10000n, G = 100n, Hs = (t) => ({
|
|
756
760
|
quotes: t.quotes.map(
|
|
757
761
|
(e) => ({
|
|
758
762
|
chainId: y(e.chainId, "chainId"),
|
|
@@ -767,7 +771,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
767
771
|
})
|
|
768
772
|
),
|
|
769
773
|
signatures: t.signatures.map(S)
|
|
770
|
-
}), st = (t, e) => t * e / x, We = x,
|
|
774
|
+
}), st = (t, e) => t * e / x, We = x, ks = (t, e) => !!e && st(t, e) < We, He = (t, e, s) => {
|
|
771
775
|
const n = BigInt(Math.max(0, Math.round(s * 100))), a = n > G ? G : n, r = Y - a, c = st(t, e) * r * Ge, i = Y * x;
|
|
772
776
|
return (c + i - 1n) / i;
|
|
773
777
|
}, ke = (t, e) => ({
|
|
@@ -780,7 +784,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
780
784
|
expiration: y(t.expiration, "expiration"),
|
|
781
785
|
side: Number(t.side),
|
|
782
786
|
additionalData: L(t.additionalData)
|
|
783
|
-
}),
|
|
787
|
+
}), Vs = ({
|
|
784
788
|
attestation: t,
|
|
785
789
|
chainId: e,
|
|
786
790
|
slippagePercent: s
|
|
@@ -797,7 +801,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
797
801
|
)
|
|
798
802
|
}
|
|
799
803
|
]);
|
|
800
|
-
},
|
|
804
|
+
}, qs = (t) => [...t.reduce(
|
|
801
805
|
(s, n) => s.has(n.accountId) ? s : s.set(n.accountId, n),
|
|
802
806
|
/* @__PURE__ */ new Map()
|
|
803
807
|
).values()].map(({ accountId: s, marketId: n }) => ({
|
|
@@ -809,7 +813,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
809
813
|
debt: t.find(
|
|
810
814
|
(a) => a.accountId === s && a.isDebt
|
|
811
815
|
)
|
|
812
|
-
})),
|
|
816
|
+
})), Ks = ({
|
|
813
817
|
collateral: t,
|
|
814
818
|
dytmOffice: e,
|
|
815
819
|
processor: s,
|
|
@@ -825,7 +829,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
825
829
|
// 1 · drain GM collateral out of the split account -> processor with the
|
|
826
830
|
// max-shares sentinel.
|
|
827
831
|
to: e,
|
|
828
|
-
data:
|
|
832
|
+
data: A({
|
|
829
833
|
abi: C,
|
|
830
834
|
functionName: "withdraw",
|
|
831
835
|
args: [
|
|
@@ -843,7 +847,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
843
847
|
{
|
|
844
848
|
// 2 · approve the GM token to Ondo's swap contract
|
|
845
849
|
to: n,
|
|
846
|
-
data:
|
|
850
|
+
data: A({
|
|
847
851
|
abi: K,
|
|
848
852
|
functionName: "approve",
|
|
849
853
|
args: [a, o]
|
|
@@ -852,19 +856,19 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
852
856
|
{
|
|
853
857
|
// 3 · redeem GM -> USDC with the signed attestation
|
|
854
858
|
to: a,
|
|
855
|
-
data:
|
|
859
|
+
data: A({
|
|
856
860
|
abi: jt,
|
|
857
861
|
functionName: "swapExactInWithAttestation",
|
|
858
862
|
args: [n, o, r, c, i, u]
|
|
859
863
|
})
|
|
860
864
|
}
|
|
861
|
-
],
|
|
865
|
+
], js = ({
|
|
862
866
|
collateral: t,
|
|
863
867
|
dytmOffice: e,
|
|
864
868
|
processor: s
|
|
865
869
|
}) => ({
|
|
866
870
|
to: e,
|
|
867
|
-
data:
|
|
871
|
+
data: A({
|
|
868
872
|
abi: C,
|
|
869
873
|
functionName: "withdraw",
|
|
870
874
|
args: [
|
|
@@ -878,7 +882,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
878
882
|
}
|
|
879
883
|
]
|
|
880
884
|
})
|
|
881
|
-
}),
|
|
885
|
+
}), Xs = ({
|
|
882
886
|
accountId: t,
|
|
883
887
|
debtKey: e,
|
|
884
888
|
dytmOffice: s,
|
|
@@ -887,7 +891,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
887
891
|
{
|
|
888
892
|
// approve USDC to the DYTM Office for the repay
|
|
889
893
|
to: n,
|
|
890
|
-
data:
|
|
894
|
+
data: A({
|
|
891
895
|
abi: K,
|
|
892
896
|
functionName: "approve",
|
|
893
897
|
args: [s, w]
|
|
@@ -896,7 +900,7 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
896
900
|
{
|
|
897
901
|
// repay the slice's whole USDC debt
|
|
898
902
|
to: s,
|
|
899
|
-
data:
|
|
903
|
+
data: A({
|
|
900
904
|
abi: C,
|
|
901
905
|
functionName: "repay",
|
|
902
906
|
args: [
|
|
@@ -913,13 +917,13 @@ const Me = "0x2222222222222222222222222222222222222222", v = BigInt("0x200000000
|
|
|
913
917
|
]
|
|
914
918
|
})
|
|
915
919
|
}
|
|
916
|
-
],
|
|
920
|
+
], zs = ({
|
|
917
921
|
actions: t,
|
|
918
922
|
outputAsset: e,
|
|
919
923
|
minOutputAmount: s
|
|
920
924
|
}) => T(Xt, [
|
|
921
925
|
{ actions: t, outputAsset: e, minOutputAmount: s }
|
|
922
|
-
]), W = /* @__PURE__ */ new Set(),
|
|
926
|
+
]), W = /* @__PURE__ */ new Set(), Qs = (t) => {
|
|
923
927
|
const e = t?.message;
|
|
924
928
|
!e || W.has(e) || (W.add(e), console.warn(e));
|
|
925
929
|
};
|
|
@@ -929,90 +933,91 @@ export {
|
|
|
929
933
|
ye as B,
|
|
930
934
|
Z as C,
|
|
931
935
|
os as D,
|
|
932
|
-
|
|
936
|
+
vs as E,
|
|
933
937
|
M as F,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
938
|
+
Cs as G,
|
|
939
|
+
xs as H,
|
|
940
|
+
Ms as I,
|
|
941
|
+
Ps as J,
|
|
942
|
+
$s as K,
|
|
943
|
+
Es as L,
|
|
940
944
|
We as M,
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
945
|
+
Ae as N,
|
|
946
|
+
us as O,
|
|
947
|
+
gs as P,
|
|
944
948
|
J as Q,
|
|
945
|
-
|
|
946
|
-
|
|
949
|
+
Ns as R,
|
|
950
|
+
qs as S,
|
|
947
951
|
D as T,
|
|
948
952
|
as as U,
|
|
949
|
-
|
|
953
|
+
Os as V,
|
|
950
954
|
Rs as W,
|
|
951
|
-
|
|
952
|
-
|
|
955
|
+
Ls as X,
|
|
956
|
+
Us as Y,
|
|
953
957
|
Ue as Z,
|
|
954
958
|
$e as _,
|
|
955
959
|
ce as a,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
960
|
+
cs as a0,
|
|
961
|
+
hs as a1,
|
|
962
|
+
ks as a2,
|
|
963
|
+
Qs as a3,
|
|
964
|
+
Bs as a4,
|
|
965
|
+
ke as a5,
|
|
966
|
+
Hs as a6,
|
|
967
|
+
et as a7,
|
|
968
|
+
ds as a8,
|
|
969
|
+
Ss as a9,
|
|
970
|
+
_s as aA,
|
|
971
|
+
U as aB,
|
|
972
|
+
is as aa,
|
|
973
|
+
ns as ab,
|
|
974
|
+
ys as ac,
|
|
975
|
+
rs as ad,
|
|
976
|
+
y as ae,
|
|
977
|
+
L as af,
|
|
978
|
+
Be as ag,
|
|
979
|
+
xe as ah,
|
|
980
|
+
Ye as ai,
|
|
981
|
+
Ys as aj,
|
|
982
|
+
fs as ak,
|
|
983
|
+
Vt as al,
|
|
984
|
+
Xe as am,
|
|
985
|
+
es as an,
|
|
986
|
+
Ts as ao,
|
|
987
|
+
p as ap,
|
|
988
|
+
Ne as aq,
|
|
989
|
+
ws as ar,
|
|
990
|
+
De as as,
|
|
991
|
+
Ze as at,
|
|
992
|
+
Qe as au,
|
|
993
|
+
Le as av,
|
|
994
|
+
Re as aw,
|
|
995
|
+
ts as ax,
|
|
996
|
+
Oe as ay,
|
|
997
|
+
Ie as az,
|
|
993
998
|
me as b,
|
|
994
999
|
Ee as c,
|
|
995
1000
|
Fe as d,
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
Ks as e,
|
|
1002
|
+
js as f,
|
|
1003
|
+
Xs as g,
|
|
1004
|
+
ge as h,
|
|
1005
|
+
ms as i,
|
|
1006
|
+
ls as j,
|
|
1002
1007
|
ze as k,
|
|
1003
1008
|
He as l,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1009
|
+
Fs as m,
|
|
1010
|
+
Vs as n,
|
|
1011
|
+
zs as o,
|
|
1012
|
+
Gs as p,
|
|
1008
1013
|
Je as q,
|
|
1009
1014
|
S as r,
|
|
1010
1015
|
ve as s,
|
|
1011
1016
|
de as t,
|
|
1012
1017
|
Ce as u,
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
+
Ds as v,
|
|
1019
|
+
bs as w,
|
|
1020
|
+
Is as x,
|
|
1021
|
+
Ws as y,
|
|
1022
|
+
ps as z
|
|
1018
1023
|
};
|
package/core-kit/const/gmx.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const GMX_MARKET_ASSETS_MAP: {
|
|
|
15
15
|
readonly PUMP_ARBITRUM: "0x4c0bb704529fa49a26bd854802d70206982c6f1b";
|
|
16
16
|
readonly GOLD_ARBITRUM: "0xeb28ad1a2e497f4acc5d9b87e7b496623c93061e";
|
|
17
17
|
readonly AAVE_ARBITRUM: "0x1cbba6346f110c8a5ea739ef2d1eb182990e4eb2";
|
|
18
|
+
readonly NEAR_ARBITRUM: "0x63dc80ee90f26363b3fcd609007cc9e14c8991be";
|
|
18
19
|
};
|
|
19
20
|
export type GmxMarketAsset = (typeof GMX_MARKET_ASSETS_MAP)[keyof typeof GMX_MARKET_ASSETS_MAP];
|
|
20
21
|
export declare const GMX_MARKET_ASSETS: GmxMarketAsset[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const getPercent: (numerator: number, denominator: number) => number;
|
|
2
2
|
export declare const getConventionalTokenPriceDecimals: (tokenPrice: number) => number;
|
|
3
3
|
export declare const shiftBy: (value: bigint | string | number, n?: number) => string;
|
|
4
|
+
export declare const isPositiveNumber: (value?: string | null) => boolean;
|
|
4
5
|
export declare const getPoolFraction: (poolTotalValue: string, amountToSell: string, poolTotalSupply: string, precision?: number) => number;
|
|
5
6
|
/**
|
|
6
7
|
* Parses a string amount to a bigint with 18 decimals precision (D18)
|