aegis-swap-widget 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as p, jsx as i, Fragment as yn } from "react/jsx-runtime";
|
|
2
2
|
import { memo as ft, useState as T, useSyncExternalStore as ut, useRef as $, useEffect as F, useLayoutEffect as ai, useCallback as D, useMemo as J, useId as Ve } from "react";
|
|
3
3
|
import { Box as ii, Flame as ri, Gauge as si, Coins as oi } from "lucide-react";
|
|
4
|
-
import { a3 as li, T as ze, a9 as ci, R as qn, w as ui, W as di, s as pi, D as fi, S as Gn, Z as hi, v as gi, u as mi, O as Ke, a7 as wi, a0 as zn, H as Kn, a1 as bi, G as Re, $ as Tt, J as jn, r as yi, _ as Xn, aa as Me, a5 as vi, a4 as vn, ab as At, I as _i, L as Et, a6 as Ii, Y as Si, a2 as Ai, N as Ei, b as _n, z as xi, a as Ni, B as Pi, k as Ti, f as In, F as Ci, X as Mi, n as Sn, a8 as Ri } from "./polling-
|
|
5
|
-
import { A as $s, c as Ws, d as Hs, e as Vs, g as qs, h as Gs, i as zs, j as Ks, l as js, m as Xs, o as Ys, M as Qs, p as Zs, q as Js, P as eo, U as to, t as no, x as ao, y as io, C as ro, E as so, K as oo, Q as lo, V as co } from "./polling-
|
|
4
|
+
import { a3 as li, T as ze, a9 as ci, R as qn, w as ui, W as di, s as pi, D as fi, S as Gn, Z as hi, v as gi, u as mi, O as Ke, a7 as wi, a0 as zn, H as Kn, a1 as bi, G as Re, $ as Tt, J as jn, r as yi, _ as Xn, aa as Me, a5 as vi, a4 as vn, ab as At, I as _i, L as Et, a6 as Ii, Y as Si, a2 as Ai, N as Ei, b as _n, z as xi, a as Ni, B as Pi, k as Ti, f as In, F as Ci, X as Mi, n as Sn, a8 as Ri } from "./polling-e6X8l7pt.js";
|
|
5
|
+
import { A as $s, c as Ws, d as Hs, e as Vs, g as qs, h as Gs, i as zs, j as Ks, l as js, m as Xs, o as Ys, M as Qs, p as Zs, q as Js, P as eo, U as to, t as no, x as ao, y as io, C as ro, E as so, K as oo, Q as lo, V as co } from "./polling-e6X8l7pt.js";
|
|
6
6
|
import { createPortal as Di } from "react-dom";
|
|
7
7
|
import { parseUnits as Oi, formatUnits as kt, formatEther as Bi, formatGwei as ki, createWalletClient as Li, custom as Fi, WaitForTransactionReceiptTimeoutError as An, erc20Abi as Yn } from "viem";
|
|
8
8
|
const Ui = {
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, a as A, b as r, c as _, d as t, e as o, f as S, g as E, h as i, i as I, j as P, k as n, l as c, m as T, n as l, o as u, D as N, M as U, p, q as C, P as G, S as R, U as W, r as d, s as D, t as O, u as F, v as g, w as M, x as m, y as w, z as v, B as L, C as b, E as h, F as V, G as X, H, I as Q, J as f, K as k, L as x, N as B, O as K, Q as j, R as q, T as y, V as z, W as Y, X as Z, Y as J, Z as $, _ as aa, $ as sa, a0 as ea, a1 as Aa, a2 as ra, a3 as _a, a4 as ta, a5 as oa, a6 as Sa, a7 as Ea, a8 as ia } from "./polling-
|
|
1
|
+
import { A as e, a as A, b as r, c as _, d as t, e as o, f as S, g as E, h as i, i as I, j as P, k as n, l as c, m as T, n as l, o as u, D as N, M as U, p, q as C, P as G, S as R, U as W, r as d, s as D, t as O, u as F, v as g, w as M, x as m, y as w, z as v, B as L, C as b, E as h, F as V, G as X, H, I as Q, J as f, K as k, L as x, N as B, O as K, Q as j, R as q, T as y, V as z, W as Y, X as Z, Y as J, Z as $, _ as aa, $ as sa, a0 as ea, a1 as Aa, a2 as ra, a3 as _a, a4 as ta, a5 as oa, a6 as Sa, a7 as Ea, a8 as ia } from "./polling-e6X8l7pt.js";
|
|
2
2
|
export {
|
|
3
3
|
e as AEGIS_DYNAMIC_FEE_FLAG,
|
|
4
4
|
A as AEGIS_SWAP_CHAINS,
|
|
@@ -157,7 +157,7 @@ const v = [
|
|
|
157
157
|
{ name: "gasEstimate", type: "uint256" }
|
|
158
158
|
]
|
|
159
159
|
}
|
|
160
|
-
], $ = 0n, ue = 2n ** 128n - 1n,
|
|
160
|
+
], $ = 0n, ue = 2n ** 128n - 1n, b = {
|
|
161
161
|
SWAP_EXACT_IN_SINGLE: 6,
|
|
162
162
|
SWAP_EXACT_OUT_SINGLE: 8,
|
|
163
163
|
SETTLE: 11,
|
|
@@ -250,12 +250,12 @@ function Ae(e) {
|
|
|
250
250
|
}
|
|
251
251
|
return e.amount > 0n;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function be(e, t) {
|
|
254
254
|
return "bips" in e ? {
|
|
255
|
-
action:
|
|
255
|
+
action: b.TAKE_PORTION,
|
|
256
256
|
params: h(de, [t, e.recipient, BigInt(e.bips)])
|
|
257
257
|
} : {
|
|
258
|
-
action:
|
|
258
|
+
action: b.TAKE,
|
|
259
259
|
params: h(V, [t, e.recipient, e.amount])
|
|
260
260
|
};
|
|
261
261
|
}
|
|
@@ -263,7 +263,7 @@ function S(e, t = "Amount") {
|
|
|
263
263
|
if (e < 0n || e > ue)
|
|
264
264
|
throw new Error(`${t} is too large for a single V4 swap.`);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function we(e, t) {
|
|
267
267
|
return t ? he([Ee(t), e]) : e;
|
|
268
268
|
}
|
|
269
269
|
function z(e) {
|
|
@@ -287,12 +287,12 @@ function z(e) {
|
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
function j(e) {
|
|
290
|
-
const t = e.zeroForOne ? e.poolKey.currency0 : e.poolKey.currency1, n = e.zeroForOne ? e.poolKey.currency1 : e.poolKey.currency0, o = Ae(e.fee) ? e.fee : null, a = o ?
|
|
290
|
+
const t = e.zeroForOne ? e.poolKey.currency0 : e.poolKey.currency1, n = e.zeroForOne ? e.poolKey.currency1 : e.poolKey.currency0, o = Ae(e.fee) ? e.fee : null, a = o ? be(o, n) : null, i = fe(
|
|
291
291
|
[
|
|
292
292
|
e.swapAction,
|
|
293
|
-
|
|
293
|
+
b.SETTLE,
|
|
294
294
|
...a ? [a.action] : [],
|
|
295
|
-
|
|
295
|
+
b.TAKE
|
|
296
296
|
],
|
|
297
297
|
[
|
|
298
298
|
e.encodedSwapParams,
|
|
@@ -302,13 +302,13 @@ function j(e) {
|
|
|
302
302
|
]
|
|
303
303
|
);
|
|
304
304
|
return {
|
|
305
|
-
calldata:
|
|
305
|
+
calldata: we(ye([i], e.deadline), e.permit),
|
|
306
306
|
value: 0n
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
function yt(e) {
|
|
310
310
|
return S(e.amountIn, "Swap input amount"), S(e.amountOutMinimum, "Swap minimum output"), j({
|
|
311
|
-
swapAction:
|
|
311
|
+
swapAction: b.SWAP_EXACT_IN_SINGLE,
|
|
312
312
|
encodedSwapParams: h(se, [
|
|
313
313
|
{
|
|
314
314
|
poolKey: e.poolKey,
|
|
@@ -329,7 +329,7 @@ function yt(e) {
|
|
|
329
329
|
}
|
|
330
330
|
function Et(e) {
|
|
331
331
|
return S(e.amountOut, "Swap output amount"), S(e.amountInMaximum, "Swap maximum input"), j({
|
|
332
|
-
swapAction:
|
|
332
|
+
swapAction: b.SWAP_EXACT_OUT_SINGLE,
|
|
333
333
|
encodedSwapParams: h(me, [
|
|
334
334
|
{
|
|
335
335
|
poolKey: e.poolKey,
|
|
@@ -534,10 +534,10 @@ const Pe = x(
|
|
|
534
534
|
), Me = x(
|
|
535
535
|
"GRASS_USDC",
|
|
536
536
|
"GRASS",
|
|
537
|
-
"
|
|
537
|
+
"0xc516dba7bd70aa2dcb986bb1c27208ea29ecd097fa0ce636611e88e54ae4444d",
|
|
538
538
|
l.USDC.address,
|
|
539
539
|
l.GRASS.address,
|
|
540
|
-
|
|
540
|
+
30
|
|
541
541
|
), ve = x(
|
|
542
542
|
"STONE_USDC",
|
|
543
543
|
"STONE",
|
|
@@ -550,7 +550,7 @@ const Pe = x(
|
|
|
550
550
|
WOOD_USDC: De,
|
|
551
551
|
GRASS_USDC: Me,
|
|
552
552
|
STONE_USDC: ve
|
|
553
|
-
},
|
|
553
|
+
}, bt = [
|
|
554
554
|
"WATER_USDC",
|
|
555
555
|
"WOOD_USDC",
|
|
556
556
|
"GRASS_USDC",
|
|
@@ -612,7 +612,7 @@ function ke(e, t) {
|
|
|
612
612
|
fee: t == null ? void 0 : t.fee
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function wt(e) {
|
|
616
616
|
const t = { ...R };
|
|
617
617
|
if (!e) return t;
|
|
618
618
|
for (const [n, o] of Object.entries(e)) {
|
|
@@ -705,8 +705,8 @@ function $e(e, t) {
|
|
|
705
705
|
throw new Error("Unexpected V4 Quoter response.");
|
|
706
706
|
}
|
|
707
707
|
async function It(e) {
|
|
708
|
-
var
|
|
709
|
-
if ((
|
|
708
|
+
var w, g, N, F;
|
|
709
|
+
if ((w = e.signal) != null && w.aborted) throw new DOMException("Quote request aborted", "AbortError");
|
|
710
710
|
if (e.amount <= 0n) throw new Error("Enter an amount to swap.");
|
|
711
711
|
I(e.amount), Le(e.market, e.tokenIn, e.tokenOut);
|
|
712
712
|
const t = e.market.poolKey, n = Ke(t, e.tokenIn), o = ((g = e.fee) == null ? void 0 : g.bps) ?? 0;
|
|
@@ -921,8 +921,8 @@ async function vt(e) {
|
|
|
921
921
|
if ((r = c.errors) != null && r.length)
|
|
922
922
|
throw new Error(((s = c.errors[0]) == null ? void 0 : s.message) ?? "Token metadata request failed.");
|
|
923
923
|
return a.forEach((m, p) => {
|
|
924
|
-
var
|
|
925
|
-
const y = ((
|
|
924
|
+
var w;
|
|
925
|
+
const y = ((w = c.data) == null ? void 0 : w[`t${p}`]) ?? null;
|
|
926
926
|
O.set(q(t, e.chainId, m), y), y && o.set(T(m), y);
|
|
927
927
|
}), o;
|
|
928
928
|
}
|
|
@@ -1228,7 +1228,7 @@ export {
|
|
|
1228
1228
|
_e as c,
|
|
1229
1229
|
Ce as d,
|
|
1230
1230
|
Oe as e,
|
|
1231
|
-
|
|
1231
|
+
bt as f,
|
|
1232
1232
|
xe as g,
|
|
1233
1233
|
Se as h,
|
|
1234
1234
|
Te as i,
|
|
@@ -1248,5 +1248,5 @@ export {
|
|
|
1248
1248
|
Dt as w,
|
|
1249
1249
|
z as x,
|
|
1250
1250
|
ke as y,
|
|
1251
|
-
|
|
1251
|
+
wt as z
|
|
1252
1252
|
};
|