@aegis-engine/core 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- var Me = Object.defineProperty;
2
- var Ue = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var I = (e, t, n) => Ue(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { encodeAbiParameters as T, keccak256 as Ne, encodeFunctionData as q, getAddress as m, createWalletClient as P, custom as D, erc20Abi as z, http as Fe, createPublicClient as Be, fallback as We, isAddress as Ge } from "viem";
5
- import { mainnet as Ke } from "viem/chains";
1
+ var Pe = Object.defineProperty;
2
+ var ke = (e, t, n) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var S = (e, t, n) => ke(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { encodeAbiParameters as C, keccak256 as Me, encodeFunctionData as $, getAddress as m, createWalletClient as P, custom as k, erc20Abi as q, http as Re, createPublicClient as De, fallback as Ne, isAddress as Fe } from "viem";
5
+ import { mainnet as Be } from "viem/chains";
6
6
  function K(e) {
7
7
  return (e == null ? void 0 : e.toLowerCase()) ?? "";
8
8
  }
9
- function A(e, t) {
9
+ function b(e, t) {
10
10
  return e.toLowerCase() === t.toLowerCase();
11
11
  }
12
- function Le(e, t) {
13
- return e === null || t === null ? e === t : A(e, t);
12
+ function Ue(e, t) {
13
+ return e === null || t === null ? e === t : b(e, t);
14
14
  }
15
- function oe(e, t) {
15
+ function ne(e, t) {
16
16
  return e.toLowerCase() === t.toLowerCase();
17
17
  }
18
- const V = [
18
+ const z = [
19
19
  {
20
20
  type: "function",
21
21
  name: "execute",
@@ -69,7 +69,7 @@ const V = [
69
69
  ],
70
70
  outputs: []
71
71
  }
72
- ], ae = [
72
+ ], oe = [
73
73
  {
74
74
  type: "function",
75
75
  name: "approve",
@@ -97,7 +97,7 @@ const V = [
97
97
  { name: "nonce", type: "uint48" }
98
98
  ]
99
99
  }
100
- ], Z = [
100
+ ], J = [
101
101
  {
102
102
  type: "function",
103
103
  name: "quoteExactInputSingle",
@@ -160,13 +160,13 @@ const V = [
160
160
  { name: "gasEstimate", type: "uint256" }
161
161
  ]
162
162
  }
163
- ], ie = 0n, $e = 2n ** 128n - 1n, O = {
163
+ ], ae = 0n, Ge = 2n ** 128n - 1n, O = {
164
164
  SWAP_EXACT_IN_SINGLE: 6,
165
165
  SWAP_EXACT_OUT_SINGLE: 8,
166
166
  SETTLE: 11,
167
167
  TAKE: 14,
168
168
  TAKE_PORTION: 16
169
- }, re = {
169
+ }, ie = {
170
170
  name: "poolKey",
171
171
  type: "tuple",
172
172
  components: [
@@ -176,75 +176,75 @@ const V = [
176
176
  { name: "tickSpacing", type: "int24" },
177
177
  { name: "hooks", type: "address" }
178
178
  ]
179
- }, qe = [
179
+ }, Ke = [
180
180
  {
181
181
  name: "params",
182
182
  type: "tuple",
183
183
  components: [
184
- re,
184
+ ie,
185
185
  { name: "zeroForOne", type: "bool" },
186
186
  { name: "amountIn", type: "uint128" },
187
187
  { name: "amountOutMinimum", type: "uint128" },
188
188
  { name: "hookData", type: "bytes" }
189
189
  ]
190
190
  }
191
- ], ze = [
191
+ ], We = [
192
192
  {
193
193
  name: "params",
194
194
  type: "tuple",
195
195
  components: [
196
- re,
196
+ ie,
197
197
  { name: "zeroForOne", type: "bool" },
198
198
  { name: "amountOut", type: "uint128" },
199
199
  { name: "amountInMaximum", type: "uint128" },
200
200
  { name: "hookData", type: "bytes" }
201
201
  ]
202
202
  }
203
- ], Ve = [
203
+ ], Le = [
204
204
  { name: "currency", type: "address" },
205
205
  { name: "amount", type: "uint256" },
206
206
  { name: "payerIsUser", type: "bool" }
207
- ], ce = [
207
+ ], re = [
208
208
  { name: "currency", type: "address" },
209
209
  { name: "recipient", type: "address" },
210
210
  { name: "amount", type: "uint256" }
211
- ], He = [
211
+ ], $e = [
212
212
  { name: "currency", type: "address" },
213
213
  { name: "recipient", type: "address" },
214
214
  { name: "bips", type: "uint256" }
215
215
  ];
216
- function je(e) {
216
+ function qe(e) {
217
217
  return `0x${e.map((t) => t.toString(16).padStart(2, "0")).join("")}`;
218
218
  }
219
- function Xe(e, t) {
219
+ function ze(e, t) {
220
220
  return {
221
221
  requiresV4Unlock: !0,
222
- actions: je(e),
222
+ actions: qe(e),
223
223
  params: t
224
224
  };
225
225
  }
226
- function Qe(e, t) {
227
- return q({
228
- abi: V,
226
+ function Ve(e, t) {
227
+ return $({
228
+ abi: z,
229
229
  functionName: "execute",
230
230
  args: [e, t]
231
231
  });
232
232
  }
233
- function Ye(e) {
234
- return q({
235
- abi: V,
233
+ function He(e) {
234
+ return $({
235
+ abi: z,
236
236
  functionName: "permitBatch",
237
237
  args: [e.owner, e.permitBatch, e.signature]
238
238
  });
239
239
  }
240
- function Je(e) {
241
- return q({
242
- abi: V,
240
+ function je(e) {
241
+ return $({
242
+ abi: z,
243
243
  functionName: "multicall",
244
244
  args: [e]
245
245
  });
246
246
  }
247
- function Ze(e) {
247
+ function Xe(e) {
248
248
  if (!e) return !1;
249
249
  if ("bips" in e) {
250
250
  if (!Number.isInteger(e.bips) || e.bips < 0 || e.bips > 1e4)
@@ -253,25 +253,25 @@ function Ze(e) {
253
253
  }
254
254
  return e.amount > 0n;
255
255
  }
256
- function ge(e, t) {
256
+ function Qe(e, t) {
257
257
  return "bips" in e ? {
258
258
  action: O.TAKE_PORTION,
259
- params: T(He, [t, e.recipient, BigInt(e.bips)])
259
+ params: C($e, [t, e.recipient, BigInt(e.bips)])
260
260
  } : {
261
261
  action: O.TAKE,
262
- params: T(ce, [t, e.recipient, e.amount])
262
+ params: C(re, [t, e.recipient, e.amount])
263
263
  };
264
264
  }
265
- function k(e, t = "Amount") {
266
- if (e < 0n || e > $e)
265
+ function M(e, t = "Amount") {
266
+ if (e < 0n || e > Ge)
267
267
  throw new Error(`${t} is too large for a single V4 swap.`);
268
268
  }
269
- function et(e, t) {
270
- return t ? Je([Ye(t), e]) : e;
269
+ function Ye(e, t) {
270
+ return t ? je([He(t), e]) : e;
271
271
  }
272
- function ue(e) {
273
- return Ne(
274
- T(
272
+ function ce(e) {
273
+ return Me(
274
+ C(
275
275
  [
276
276
  { name: "currency0", type: "address" },
277
277
  { name: "currency1", type: "address" },
@@ -289,8 +289,8 @@ function ue(e) {
289
289
  )
290
290
  );
291
291
  }
292
- function le(e) {
293
- const t = e.zeroForOne ? e.poolKey.currency0 : e.poolKey.currency1, n = e.zeroForOne ? e.poolKey.currency1 : e.poolKey.currency0, o = Ze(e.fee) ? e.fee : null, a = o ? ge(o, n) : null, i = Xe(
292
+ function ue(e) {
293
+ const t = e.zeroForOne ? e.poolKey.currency0 : e.poolKey.currency1, n = e.zeroForOne ? e.poolKey.currency1 : e.poolKey.currency0, o = Xe(e.fee) ? e.fee : null, a = o ? Qe(o, n) : null, i = ze(
294
294
  [
295
295
  e.swapAction,
296
296
  O.SETTLE,
@@ -299,20 +299,20 @@ function le(e) {
299
299
  ],
300
300
  [
301
301
  e.encodedSwapParams,
302
- T(Ve, [t, e.settleAmount, !0]),
302
+ C(Le, [t, e.settleAmount, !0]),
303
303
  ...a ? [a.params] : [],
304
- T(ce, [n, e.recipient, ie])
304
+ C(re, [n, e.recipient, ae])
305
305
  ]
306
306
  );
307
307
  return {
308
- calldata: et(Qe([i], e.deadline), e.permit),
308
+ calldata: Ye(Ve([i], e.deadline), e.permit),
309
309
  value: 0n
310
310
  };
311
311
  }
312
- function tt(e) {
313
- return k(e.amountIn, "Swap input amount"), k(e.amountOutMinimum, "Swap minimum output"), le({
312
+ function Je(e) {
313
+ return M(e.amountIn, "Swap input amount"), M(e.amountOutMinimum, "Swap minimum output"), ue({
314
314
  swapAction: O.SWAP_EXACT_IN_SINGLE,
315
- encodedSwapParams: T(qe, [
315
+ encodedSwapParams: C(Ke, [
316
316
  {
317
317
  poolKey: e.poolKey,
318
318
  zeroForOne: e.zeroForOne,
@@ -330,10 +330,10 @@ function tt(e) {
330
330
  fee: e.fee
331
331
  });
332
332
  }
333
- function nt(e) {
334
- return k(e.amountOut, "Swap output amount"), k(e.amountInMaximum, "Swap maximum input"), le({
333
+ function Ze(e) {
334
+ return M(e.amountOut, "Swap output amount"), M(e.amountInMaximum, "Swap maximum input"), ue({
335
335
  swapAction: O.SWAP_EXACT_OUT_SINGLE,
336
- encodedSwapParams: T(ze, [
336
+ encodedSwapParams: C(We, [
337
337
  {
338
338
  poolKey: e.poolKey,
339
339
  zeroForOne: e.zeroForOne,
@@ -344,39 +344,39 @@ function nt(e) {
344
344
  ]),
345
345
  poolKey: e.poolKey,
346
346
  zeroForOne: e.zeroForOne,
347
- settleAmount: ie,
347
+ settleAmount: ae,
348
348
  recipient: e.recipient,
349
349
  deadline: e.deadline,
350
350
  permit: e.permit,
351
351
  fee: e.fee
352
352
  });
353
353
  }
354
- function se(e, t) {
354
+ function le(e, t) {
355
355
  var n;
356
356
  return ((n = t.explorerTxUrl) == null ? void 0 : n.call(t, e)) ?? "#";
357
357
  }
358
- const E = 1, me = m("0x00581261a1200956ea05d1810fF28ffd66D8E254"), ot = m("0x8f29BD5c8429730fA4C46e6295c4e679eDEdd0cC"), at = 8388608, it = 50, pe = m(
358
+ const y = 1, ge = m("0x00581261a1200956ea05d1810fF28ffd66D8E254"), On = m("0x8f29BD5c8429730fA4C46e6295c4e679eDEdd0cC"), Pn = 8388608, et = 50, pe = m(
359
359
  "0x8ea2C7de60ef1Cd4dcE64ea2DDDe2f99F0127eFC"
360
360
  );
361
- function x(e) {
361
+ function _(e) {
362
362
  return e ? m(e) : void 0;
363
363
  }
364
- function C(e) {
364
+ function I(e) {
365
365
  if (!e.permit2 || !e.quoter)
366
366
  throw new Error("Missing Permit2 or V4 Quoter contract address.");
367
367
  return {
368
368
  permit2: m(e.permit2),
369
369
  quoter: m(e.quoter),
370
- poolManager: x(e.poolManager),
371
- positionDescriptor: x(e.positionDescriptor),
372
- positionManager: x(e.positionManager),
373
- stateView: x(e.stateView),
374
- universalRouter: x(e.universalRouter),
375
- universalRouterV2_1_1: x(e.universalRouterV2_1_1)
370
+ poolManager: _(e.poolManager),
371
+ positionDescriptor: _(e.positionDescriptor),
372
+ positionManager: _(e.positionManager),
373
+ stateView: _(e.stateView),
374
+ universalRouter: _(e.universalRouter),
375
+ universalRouterV2_1_1: _(e.universalRouterV2_1_1)
376
376
  };
377
377
  }
378
- const de = {
379
- 1: C({
378
+ const me = {
379
+ 1: I({
380
380
  poolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90",
381
381
  positionDescriptor: "0xd1428ba554f4c8450b763a0b2040a4935c63f06c",
382
382
  positionManager: "0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",
@@ -386,7 +386,7 @@ const de = {
386
386
  universalRouterV2_1_1: "0x4c82d1fbfe28c977cbb58d8c7ff8fcf9f70a2cca",
387
387
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
388
388
  }),
389
- 10: C({
389
+ 10: I({
390
390
  poolManager: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3",
391
391
  positionDescriptor: "0xedd81496169c46df161b8513a52ffecaaaa66743",
392
392
  positionManager: "0x3c3ea4b57a46241e54610e5f022e5c45859a1017",
@@ -396,7 +396,7 @@ const de = {
396
396
  universalRouterV2_1_1: "0x8b844f885672f333bc0042cb669255f93a4c1e6b",
397
397
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
398
398
  }),
399
- 130: C({
399
+ 130: I({
400
400
  poolManager: "0x1f98400000000000000000000000000000000004",
401
401
  positionDescriptor: "0x9fb28449a191cd8c03a1b7abfb0f5996ecf7f722",
402
402
  positionManager: "0x4529a01c7a0410167c5740c487a8de60232617bf",
@@ -406,7 +406,7 @@ const de = {
406
406
  universalRouterV2_1_1: "0xfdf682f51fe81aa4898f0ae2163d8a55c127fbc7",
407
407
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
408
408
  }),
409
- 137: C({
409
+ 137: I({
410
410
  poolManager: "0x67366782805870060151383f4bbff9dab53e5cd6",
411
411
  positionDescriptor: "0x0892771f0c1b78ad6013d6e5536007e1c16e6794",
412
412
  positionManager: "0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9",
@@ -416,7 +416,7 @@ const de = {
416
416
  universalRouterV2_1_1: "0x8b844f885672f333bc0042cb669255f93a4c1e6b",
417
417
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
418
418
  }),
419
- 8453: C({
419
+ 8453: I({
420
420
  poolManager: "0x498581ff718922c3f8e6a244956af099b2652b2b",
421
421
  positionDescriptor: "0x25d093633990dc94bedeed76c8f3cdaa75f3e7d5",
422
422
  positionManager: "0x7c5f5a4bbd8fd63184577525326123b519429bdc",
@@ -426,7 +426,7 @@ const de = {
426
426
  universalRouterV2_1_1: "0xfdf682f51fe81aa4898f0ae2163d8a55c127fbc7",
427
427
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
428
428
  }),
429
- 42161: C({
429
+ 42161: I({
430
430
  poolManager: "0x360e68faccca8ca495c1b759fd9eee466db9fb32",
431
431
  positionDescriptor: "0xe2023f3fa515cf070e07fd9d51c1d236e07843f4",
432
432
  positionManager: "0xd88f38f930b7952f2db2432cb002e7abbf3dd869",
@@ -436,59 +436,59 @@ const de = {
436
436
  universalRouterV2_1_1: "0x8b844f885672f333bc0042cb669255f93a4c1e6b",
437
437
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
438
438
  })
439
- }, H = de[E], fe = H.permit2, he = H.quoter, rt = [
439
+ }, V = me[y], tt = V.permit2, nt = V.quoter, ot = [
440
440
  "https://eth.drpc.org",
441
441
  "https://ethereum-rpc.publicnode.com",
442
442
  "https://cloudflare-eth.com"
443
- ], ct = "https://aegis.markets/graphql/meta", ut = {
444
- chainId: E,
445
- chain: Ke,
443
+ ], at = "https://aegis.markets/graphql/meta", it = {
444
+ chainId: y,
445
+ chain: Be,
446
446
  name: "Ethereum",
447
- router: me,
448
- permit2: fe,
449
- quoter: he,
450
- v4Contracts: H,
451
- rpcUrls: rt,
447
+ router: ge,
448
+ permit2: tt,
449
+ quoter: nt,
450
+ v4Contracts: V,
451
+ rpcUrls: ot,
452
452
  explorerTxUrl: (e) => `https://etherscan.io/tx/${e}`,
453
453
  poolExplorerUrl: (e) => `https://app.uniswap.org/explore/pools/ethereum/${e}`,
454
- metadataEndpoint: ct,
454
+ metadataEndpoint: at,
455
455
  fee: {
456
- bps: it,
456
+ bps: et,
457
457
  recipient: pe
458
458
  }
459
- }, j = {
460
- [E]: ut
461
- }, y = {
459
+ }, H = {
460
+ [y]: it
461
+ }, x = {
462
462
  USDC: {
463
- chainId: E,
463
+ chainId: y,
464
464
  address: m("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
465
465
  name: "USD Coin",
466
466
  symbol: "USDC",
467
467
  decimals: 6
468
468
  },
469
469
  WATER: {
470
- chainId: E,
470
+ chainId: y,
471
471
  address: m("0x828B22c9ea1c20B551EeFC6198174C4bb7a8CBF6"),
472
472
  name: "WATER",
473
473
  symbol: "WATER",
474
474
  decimals: 18
475
475
  },
476
476
  WOOD: {
477
- chainId: E,
477
+ chainId: y,
478
478
  address: m("0x670AfdD7226e73d3CC55B5cd83933E46aF22DECd"),
479
479
  name: "WOOD",
480
480
  symbol: "WOOD",
481
481
  decimals: 18
482
482
  },
483
483
  GRASS: {
484
- chainId: E,
484
+ chainId: y,
485
485
  address: m("0xF06Ad052b0d8D511D0B6f00100b8e402639209EF"),
486
486
  name: "GRASS",
487
487
  symbol: "GRASS",
488
488
  decimals: 18
489
489
  },
490
490
  STONE: {
491
- chainId: E,
491
+ chainId: y,
492
492
  address: m("0xCabcc33D9Ff7e24F413d939773D232C0d50dCc7f"),
493
493
  name: "STONE",
494
494
  symbol: "STONE",
@@ -498,125 +498,65 @@ const de = {
498
498
  // mark stays correct even when the metadata service is unreachable.
499
499
  iconUrl: "https://ichi-images.s3.us-east-1.amazonaws.com/tokens/logo_256_stone_2.svg"
500
500
  }
501
- };
502
- function B(e, t, n, o, a, i) {
503
- return {
504
- id: e,
505
- chainId: E,
506
- symbol: t,
507
- poolId: n,
508
- poolKey: {
509
- currency0: o,
510
- currency1: a,
511
- fee: at,
512
- tickSpacing: i,
513
- hooks: ot
514
- },
515
- token: y[t],
516
- counterToken: y.USDC,
517
- router: me,
518
- permit2: fe,
519
- quoter: he,
520
- label: `${y.USDC.symbol} / ${t}`
521
- };
522
- }
523
- const lt = B(
524
- "WATER_USDC",
525
- "WATER",
526
- "0x01409fc6f1bf49e20bf05df5d4dcb96ed3977ea717bc4a135e9deacd92ebc0af",
527
- y.WATER.address,
528
- y.USDC.address,
529
- 60
530
- ), st = B(
531
- "WOOD_USDC",
532
- "WOOD",
533
- "0x0f8a98e3fdb7ea4438a3f7342f040cbc9d1eced1b90a876d38f3453100243356",
534
- y.WOOD.address,
535
- y.USDC.address,
536
- 60
537
- ), mt = B(
538
- "GRASS_USDC",
539
- "GRASS",
540
- "0xd0194ad1f57730361b93ecf8da86e18590bd5e1f64e4a35f3a5b5bd666e48ae1",
541
- y.USDC.address,
542
- y.GRASS.address,
543
- 60
544
- ), pt = B(
545
- "STONE_USDC",
546
- "STONE",
547
- "0x3fa06e44e4bee9539887681eab6b608b646784e2027ea6292198cde0690aff54",
548
- y.USDC.address,
549
- y.STONE.address,
550
- 60
551
- ), Un = {
552
- WATER_USDC: lt,
553
- WOOD_USDC: st,
554
- GRASS_USDC: mt,
555
- STONE_USDC: pt
556
- }, Nn = [
557
- "WATER_USDC",
558
- "WOOD_USDC",
559
- "GRASS_USDC",
560
- "STONE_USDC"
561
- ], we = 50, ye = pe, X = {
562
- USDC: y.USDC,
501
+ }, se = 50, de = pe, j = {
502
+ USDC: x.USDC,
563
503
  USDT: {
564
- chainId: E,
504
+ chainId: y,
565
505
  address: m("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
566
506
  name: "Tether USD",
567
507
  symbol: "USDT",
568
508
  decimals: 6
569
509
  },
570
510
  WETH: {
571
- chainId: E,
511
+ chainId: y,
572
512
  address: m("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
573
513
  name: "Wrapped Ether",
574
514
  symbol: "WETH",
575
515
  decimals: 18
576
516
  },
577
517
  ETH: {
578
- chainId: E,
518
+ chainId: y,
579
519
  address: m("0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"),
580
520
  name: "Ether",
581
521
  symbol: "ETH",
582
522
  decimals: 18
583
523
  },
584
524
  WBTC: {
585
- chainId: E,
525
+ chainId: y,
586
526
  address: m("0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"),
587
527
  name: "Wrapped Bitcoin",
588
528
  symbol: "WBTC",
589
529
  decimals: 8
590
530
  },
591
531
  STETH: {
592
- chainId: E,
532
+ chainId: y,
593
533
  address: m("0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"),
594
534
  name: "Lido Staked Ether",
595
535
  symbol: "stETH",
596
536
  decimals: 18
597
537
  }
598
- }, dt = {
599
- USDC: y.USDC,
600
- ETH: X.ETH,
601
- WATER: y.WATER,
602
- WOOD: y.WOOD,
603
- GRASS: y.GRASS,
604
- STONE: y.STONE
605
- }, ft = Object.values(
606
- X
607
- ), ht = Object.values(
608
- dt
609
- ), Fn = {
610
- default: ft,
611
- wolfgame: ht
612
- }, Bn = X;
613
- function g(e) {
538
+ }, rt = {
539
+ USDC: x.USDC,
540
+ ETH: j.ETH,
541
+ WATER: x.WATER,
542
+ WOOD: x.WOOD,
543
+ GRASS: x.GRASS,
544
+ STONE: x.STONE
545
+ }, ct = Object.values(
546
+ j
547
+ ), ut = Object.values(
548
+ rt
549
+ ), kn = {
550
+ default: ct,
551
+ wolfgame: ut
552
+ }, Mn = j;
553
+ function Z(e) {
614
554
  return {
615
555
  ...e,
616
556
  address: m(e.address)
617
557
  };
618
558
  }
619
- function wt(e) {
559
+ function lt(e) {
620
560
  const t = m(e.currency0), n = m(e.currency1);
621
561
  if (t.toLowerCase() >= n.toLowerCase())
622
562
  throw new Error(
@@ -630,9 +570,9 @@ function wt(e) {
630
570
  hooks: m(e.hooks)
631
571
  };
632
572
  }
633
- function yt(e, t) {
573
+ function pt(e, t) {
634
574
  var o, a;
635
- const n = de[e.chainId];
575
+ const n = me[e.chainId];
636
576
  return {
637
577
  ...n,
638
578
  ...t == null ? void 0 : t.v4Contracts,
@@ -641,14 +581,14 @@ function yt(e, t) {
641
581
  quoter: ((a = e.v4Contracts) == null ? void 0 : a.quoter) ?? e.quoter ?? (t == null ? void 0 : t.quoter) ?? (n == null ? void 0 : n.quoter)
642
582
  };
643
583
  }
644
- function Et(e, t) {
584
+ function mt(e, t) {
645
585
  var a;
646
- const n = yt(e, t);
586
+ const n = pt(e, t);
647
587
  if (!t && (!e.chain || !e.router || !((a = e.rpcUrls) != null && a.length)))
648
588
  throw new Error(
649
589
  `Missing viem chain, Aegis router, or RPC URLs for chain ${e.chainId}.`
650
590
  );
651
- const o = C(n);
591
+ const o = I(n);
652
592
  return {
653
593
  chainId: e.chainId,
654
594
  chain: e.chain ?? t.chain,
@@ -661,31 +601,31 @@ function Et(e, t) {
661
601
  explorerTxUrl: e.explorerTxUrl ?? (t == null ? void 0 : t.explorerTxUrl),
662
602
  poolExplorerUrl: e.poolExplorerUrl ?? (t == null ? void 0 : t.poolExplorerUrl),
663
603
  metadataEndpoint: e.metadataEndpoint ?? (t == null ? void 0 : t.metadataEndpoint),
664
- // Fee stays internal: it is never read from host input, only inherited from
604
+ // Fee stays Aegis-controlled: it is never read from host input, only inherited from
665
605
  // the bundled base chain config (e.g. mainnet keeps its 50 bps fee).
666
606
  fee: t == null ? void 0 : t.fee
667
607
  };
668
608
  }
669
- function Wn(e) {
670
- const t = { ...j };
609
+ function Rn(e) {
610
+ const t = { ...H };
671
611
  if (!e) return t;
672
612
  for (const [n, o] of Object.entries(e)) {
673
613
  if (!o) continue;
674
614
  const a = o.chainId ?? Number(n);
675
- t[a] = Et(
615
+ t[a] = mt(
676
616
  { ...o, chainId: a },
677
617
  t[a]
678
618
  );
679
619
  }
680
620
  return t;
681
621
  }
682
- function bt(e, t = j) {
683
- const n = g(e.token), o = g(e.counterToken), a = e.chainId ?? n.chainId ?? o.chainId ?? E, i = t[a];
622
+ function st(e, t = H) {
623
+ const n = Z(e.token), o = Z(e.counterToken), a = e.chainId ?? n.chainId ?? o.chainId ?? y, i = t[a];
684
624
  if (!i) throw new Error(`No Aegis swap chain config found for chain ${a}.`);
685
625
  if (n.chainId !== a || o.chainId !== a)
686
626
  throw new Error(`Pool token chain ids must match chain ${a}.`);
687
- const c = wt(e.poolKey), r = ue(c);
688
- if (e.poolId && !oe(e.poolId, r))
627
+ const c = lt(e.poolKey), r = ce(c);
628
+ if (e.poolId && !ne(e.poolId, r))
689
629
  throw new Error("Configured pool id does not match the pool key.");
690
630
  return {
691
631
  id: e.id,
@@ -701,52 +641,52 @@ function bt(e, t = j) {
701
641
  label: e.label ?? `${o.symbol} / ${n.symbol}`
702
642
  };
703
643
  }
704
- function Gn(e, t = j) {
644
+ function Dn(e, t = H) {
705
645
  return e != null && e.length ? Object.fromEntries(
706
646
  e.map((n) => {
707
- const o = bt(n, t);
647
+ const o = st(n, t);
708
648
  return [o.id, o];
709
649
  })
710
650
  ) : {};
711
651
  }
712
- function Ee(e) {
652
+ function fe(e) {
713
653
  if (!Number.isFinite(e) || e < 0 || e > 2e3)
714
654
  throw new Error("Slippage must be between 0% and 20%.");
715
655
  }
716
- function At(e, t) {
717
- return Ee(t), e * BigInt(1e4 - Math.round(t)) / 10000n;
656
+ function dt(e, t) {
657
+ return fe(t), e * BigInt(1e4 - Math.round(t)) / 10000n;
718
658
  }
719
- function St(e, t) {
720
- return Ee(t), (e * BigInt(1e4 + Math.round(t)) + 9999n) / 10000n;
659
+ function ft(e, t) {
660
+ return fe(t), (e * BigInt(1e4 + Math.round(t)) + 9999n) / 10000n;
721
661
  }
722
- function It(e, t) {
662
+ function ht(e, t) {
723
663
  return t <= 0 ? 0n : e * BigInt(t) / 10000n;
724
664
  }
725
- function Ct(e, t) {
665
+ function wt(e, t) {
726
666
  return t <= 0 ? e : (e * 10000n + BigInt(1e4 - t - 1)) / BigInt(1e4 - t);
727
667
  }
728
- function Tt(e, t) {
668
+ function yt(e, t) {
729
669
  if (t <= 0) return e;
730
670
  const n = BigInt(1e4 - t);
731
671
  return (e * 10000n + n - 1n) / n;
732
672
  }
733
- function M(e) {
734
- return k(e), e;
673
+ function D(e) {
674
+ return M(e), e;
735
675
  }
736
- function _t(e, t) {
737
- if (A(t.address, e.currency0)) return !0;
738
- if (A(t.address, e.currency1)) return !1;
676
+ function Et(e, t) {
677
+ if (b(t.address, e.currency0)) return !0;
678
+ if (b(t.address, e.currency1)) return !1;
739
679
  throw new Error("Input token is not part of this pool.");
740
680
  }
741
- function vt(e, t, n) {
742
- const o = ue(e.poolKey);
743
- if (!oe(o, e.poolId))
681
+ function bt(e, t, n) {
682
+ const o = ce(e.poolKey);
683
+ if (!ne(o, e.poolId))
744
684
  throw new Error("Configured pool id does not match the pool key.");
745
- const a = A(t.address, e.poolKey.currency0) || A(t.address, e.poolKey.currency1), i = A(n.address, e.poolKey.currency0) || A(n.address, e.poolKey.currency1);
746
- if (!a || !i || A(t.address, n.address))
685
+ const a = b(t.address, e.poolKey.currency0) || b(t.address, e.poolKey.currency1), i = b(n.address, e.poolKey.currency0) || b(n.address, e.poolKey.currency1);
686
+ if (!a || !i || b(t.address, n.address))
747
687
  throw new Error("Selected tokens do not match this direct pool.");
748
688
  }
749
- function xt(e, t) {
689
+ function At(e, t) {
750
690
  if (Array.isArray(e)) {
751
691
  const a = e[0], i = e[1];
752
692
  if (typeof a == "bigint" && typeof i == "bigint")
@@ -758,56 +698,56 @@ function xt(e, t) {
758
698
  return { amount: o, gasEstimate: n.gasEstimate };
759
699
  throw new Error("Unexpected V4 Quoter response.");
760
700
  }
761
- async function Ot(e) {
762
- var d, f, w, S;
701
+ async function St(e) {
702
+ var d, f, w, A;
763
703
  if ((d = e.signal) != null && d.aborted) throw new DOMException("Quote request aborted", "AbortError");
764
704
  if (e.amount <= 0n) throw new Error("Enter an amount to swap.");
765
- M(e.amount), vt(e.market, e.tokenIn, e.tokenOut);
766
- const t = e.market.poolKey, n = _t(t, e.tokenIn), o = ((f = e.fee) == null ? void 0 : f.bps) ?? 0;
705
+ D(e.amount), bt(e.market, e.tokenIn, e.tokenOut);
706
+ const t = e.market.poolKey, n = Et(t, e.tokenIn), o = ((f = e.fee) == null ? void 0 : f.bps) ?? 0;
767
707
  if (!Number.isInteger(o) || o < 0 || o >= 1e4)
768
708
  throw new Error("Fee must be an integer between 0 and 9999 bps.");
769
- const a = e.mode === "exactOut" ? M(Ct(e.amount, o)) : e.amount, i = e.mode === "exactOut" ? await e.publicClient.simulateContract({
709
+ const a = e.mode === "exactOut" ? D(wt(e.amount, o)) : e.amount, i = e.mode === "exactOut" ? await e.publicClient.simulateContract({
770
710
  address: e.market.quoter,
771
- abi: Z,
711
+ abi: J,
772
712
  functionName: "quoteExactOutputSingle",
773
713
  args: [{ poolKey: t, zeroForOne: n, exactAmount: a, hookData: "0x" }],
774
714
  account: e.account
775
715
  }) : await e.publicClient.simulateContract({
776
716
  address: e.market.quoter,
777
- abi: Z,
717
+ abi: J,
778
718
  functionName: "quoteExactInputSingle",
779
719
  args: [{ poolKey: t, zeroForOne: n, exactAmount: e.amount, hookData: "0x" }],
780
720
  account: e.account
781
721
  });
782
722
  if ((w = e.signal) != null && w.aborted) throw new DOMException("Quote request aborted", "AbortError");
783
- const c = xt(
723
+ const c = At(
784
724
  i.result,
785
725
  e.mode === "exactOut" ? "amountIn" : "amountOut"
786
- ), r = e.mode === "exactOut" ? c.amount : e.amount, u = e.mode === "exactOut" ? a : c.amount, l = e.mode === "exactOut" ? u - e.amount : It(u, o), s = u - l, p = e.mode === "exactOut" ? s : At(s, e.slippageBps);
726
+ ), r = e.mode === "exactOut" ? c.amount : e.amount, u = e.mode === "exactOut" ? a : c.amount, l = e.mode === "exactOut" ? u - e.amount : ht(u, o), p = u - l, s = e.mode === "exactOut" ? p : dt(p, e.slippageBps);
787
727
  return {
788
728
  mode: e.mode,
789
729
  poolKey: t,
790
730
  zeroForOne: n,
791
731
  amountIn: r,
792
- amountOut: s,
732
+ amountOut: p,
793
733
  grossAmountOut: u,
794
- amountOutMinimum: e.mode === "exactOut" ? u : M(Tt(p, o)),
795
- amountInMaximum: e.mode === "exactOut" ? M(St(r, e.slippageBps)) : r,
796
- userAmountOutMinimum: p,
734
+ amountOutMinimum: e.mode === "exactOut" ? u : D(yt(s, o)),
735
+ amountInMaximum: e.mode === "exactOut" ? D(ft(r, e.slippageBps)) : r,
736
+ userAmountOutMinimum: s,
797
737
  feeAmount: l,
798
738
  feeBps: o,
799
- feeRecipient: o > 0 ? ((S = e.fee) == null ? void 0 : S.recipient) ?? null : null,
739
+ feeRecipient: o > 0 ? ((A = e.fee) == null ? void 0 : A.recipient) ?? null : null,
800
740
  gasEstimate: c.gasEstimate
801
741
  };
802
742
  }
803
- function be(e, t) {
804
- return e.mode === t.mode && e.zeroForOne === t.zeroForOne && A(e.poolKey.currency0, t.poolKey.currency0) && A(e.poolKey.currency1, t.poolKey.currency1) && e.poolKey.fee === t.poolKey.fee && e.poolKey.tickSpacing === t.poolKey.tickSpacing && A(e.poolKey.hooks, t.poolKey.hooks) && e.feeBps === t.feeBps && Le(e.feeRecipient, t.feeRecipient);
743
+ function he(e, t) {
744
+ return e.mode === t.mode && e.zeroForOne === t.zeroForOne && b(e.poolKey.currency0, t.poolKey.currency0) && b(e.poolKey.currency1, t.poolKey.currency1) && e.poolKey.fee === t.poolKey.fee && e.poolKey.tickSpacing === t.poolKey.tickSpacing && b(e.poolKey.hooks, t.poolKey.hooks) && e.feeBps === t.feeBps && Ue(e.feeRecipient, t.feeRecipient);
805
745
  }
806
- function Kn(e, t) {
807
- return be(e, t) && e.amountIn === t.amountIn && e.amountOut === t.amountOut && e.grossAmountOut === t.grossAmountOut && e.amountOutMinimum === t.amountOutMinimum && e.amountInMaximum === t.amountInMaximum && e.userAmountOutMinimum === t.userAmountOutMinimum && e.feeAmount === t.feeAmount;
746
+ function Nn(e, t) {
747
+ return he(e, t) && e.amountIn === t.amountIn && e.amountOut === t.amountOut && e.grossAmountOut === t.grossAmountOut && e.amountOutMinimum === t.amountOutMinimum && e.amountInMaximum === t.amountInMaximum && e.userAmountOutMinimum === t.userAmountOutMinimum && e.feeAmount === t.feeAmount;
808
748
  }
809
- function Pt(e, t) {
810
- return !e || !be(e, t) ? { quote: t, priceMovedBeyondTolerance: !1 } : t.mode === "exactIn" ? t.amountOut < e.userAmountOutMinimum ? { quote: t, priceMovedBeyondTolerance: !0 } : {
749
+ function It(e, t) {
750
+ return !e || !he(e, t) ? { quote: t, priceMovedBeyondTolerance: !1 } : t.mode === "exactIn" ? t.amountOut < e.userAmountOutMinimum ? { quote: t, priceMovedBeyondTolerance: !0 } : {
811
751
  quote: {
812
752
  ...t,
813
753
  amountOutMinimum: t.amountOutMinimum > e.amountOutMinimum ? t.amountOutMinimum : e.amountOutMinimum,
@@ -822,28 +762,28 @@ function Pt(e, t) {
822
762
  priceMovedBeyondTolerance: !1
823
763
  };
824
764
  }
825
- function Dt(e) {
765
+ function Ct(e) {
826
766
  return e.mode === "exactOut" ? e.amountInMaximum : e.amountIn;
827
767
  }
828
- function kt(e) {
768
+ function Tt(e) {
829
769
  return e.feeRecipient ? e.mode === "exactIn" ? e.feeBps > 0 ? { recipient: e.feeRecipient, bips: e.feeBps } : null : e.feeAmount > 0n ? { recipient: e.feeRecipient, amount: e.feeAmount } : null : null;
830
770
  }
831
- function Ae(e) {
771
+ function we(e) {
832
772
  for (let n = e; n && typeof n == "object"; n = n.cause)
833
773
  if (n.code === 4001) return !0;
834
774
  const t = e instanceof Error ? e.message.toLowerCase() : "";
835
775
  return t.includes("user rejected") || t.includes("user denied") || t.includes("rejected the request") || t.includes("request rejected");
836
776
  }
837
- const Rt = "Request rejected.";
838
- function Mt(e, t) {
839
- if (Ae(e))
840
- return Rt;
777
+ const vt = "Request rejected.";
778
+ function _t(e, t) {
779
+ if (we(e))
780
+ return vt;
841
781
  const n = e instanceof Error ? e.message : "";
842
782
  if (!n) return t;
843
783
  const o = n.toLowerCase();
844
784
  return o.includes("wallet_switchethereumchain") || o.includes("wallet_addethereumchain") ? "Network switch failed." : o.includes("insufficient funds") ? "Insufficient funds for gas." : o.includes("execution reverted") || o.includes("swap reverted") ? "Swap reverted on-chain." : o.includes("token not found") ? "Token is not supported by KyberSwap." : o.includes("kyberswap api error") ? "KyberSwap could not build this route. Try again." : t;
845
785
  }
846
- class Se extends Error {
786
+ class ye extends Error {
847
787
  constructor({
848
788
  status: n,
849
789
  statusText: o,
@@ -852,14 +792,14 @@ class Se extends Error {
852
792
  body: c
853
793
  }) {
854
794
  super(i);
855
- I(this, "status");
856
- I(this, "statusText");
857
- I(this, "code");
858
- I(this, "body");
795
+ S(this, "status");
796
+ S(this, "statusText");
797
+ S(this, "code");
798
+ S(this, "body");
859
799
  this.name = "KyberSwapApiError", this.status = n, this.statusText = o, this.code = a, this.body = c;
860
800
  }
861
801
  }
862
- const Ie = "https://aggregator-api.kyberswap.com", L = "Aegis", Ut = {
802
+ const Ee = "https://aggregator-api.kyberswap.com", W = "Aegis", xt = {
863
803
  1: "ethereum",
864
804
  10: "optimism",
865
805
  56: "bsc",
@@ -880,13 +820,13 @@ const Ie = "https://aggregator-api.kyberswap.com", L = "Aegis", Ut = {
880
820
  59144: "linea",
881
821
  80094: "berachain"
882
822
  };
883
- function Ce(e) {
884
- const t = Ut[e];
823
+ function be(e) {
824
+ const t = xt[e];
885
825
  if (!t)
886
826
  throw new Error(`KyberSwap does not support chain ${e}.`);
887
827
  return t;
888
828
  }
889
- async function Te(e) {
829
+ async function Ae(e) {
890
830
  const t = e.clone();
891
831
  let n, o, a;
892
832
  try {
@@ -900,7 +840,7 @@ async function Te(e) {
900
840
  }
901
841
  }
902
842
  const i = a ? `: ${a.slice(0, 300)}` : "", c = o !== void 0 ? ` ${o}` : "", r = e.statusText || "Request failed";
903
- return new Se({
843
+ return new ye({
904
844
  status: e.status,
905
845
  statusText: r,
906
846
  code: o,
@@ -908,10 +848,10 @@ async function Te(e) {
908
848
  body: n
909
849
  });
910
850
  }
911
- function _e(e) {
912
- return e instanceof Se && (e.status === 429 || e.status >= 500);
851
+ function Se(e) {
852
+ return e instanceof ye && (e.status === 429 || e.status >= 500);
913
853
  }
914
- function Nt(e) {
854
+ function Ot(e) {
915
855
  if (!(e != null && e.routeSummary) || !(e != null && e.routerAddress))
916
856
  throw new Error("Invalid response from KyberSwap API");
917
857
  return {
@@ -922,7 +862,7 @@ function Nt(e) {
922
862
  routeSummary: e.routeSummary
923
863
  };
924
864
  }
925
- function Ft(e) {
865
+ function Pt(e) {
926
866
  if (!(e != null && e.data) || !(e != null && e.routerAddress))
927
867
  throw new Error("Invalid encoded route from KyberSwap API");
928
868
  return {
@@ -931,7 +871,7 @@ function Ft(e) {
931
871
  routerAddress: m(e.routerAddress)
932
872
  };
933
873
  }
934
- async function Bt({
874
+ async function kt({
935
875
  tokenIn: e,
936
876
  tokenOut: t,
937
877
  amountIn: n,
@@ -948,21 +888,21 @@ async function Bt({
948
888
  });
949
889
  a && r.set("origin", a), i && (r.set("feeAmount", i.feeAmount), r.set("chargeFeeBy", i.chargeFeeBy), r.set("isInBps", String(i.isInBps)), r.set("feeReceiver", i.feeReceiver));
950
890
  const u = await fetch(
951
- `${Ie}/${Ce(o)}/api/v1/routes?${r}`,
891
+ `${Ee}/${be(o)}/api/v1/routes?${r}`,
952
892
  {
953
893
  method: "GET",
954
894
  headers: {
955
895
  Accept: "application/json",
956
- "X-Client-Id": L
896
+ "X-Client-Id": W
957
897
  },
958
898
  signal: c
959
899
  }
960
900
  );
961
- if (!u.ok) throw await Te(u);
901
+ if (!u.ok) throw await Ae(u);
962
902
  const l = await u.json();
963
- return Nt(l.data);
903
+ return Ot(l.data);
964
904
  }
965
- async function Wt({
905
+ async function Mt({
966
906
  routeSummary: e,
967
907
  sender: t,
968
908
  recipient: n,
@@ -971,13 +911,13 @@ async function Wt({
971
911
  signal: i
972
912
  }) {
973
913
  const c = await fetch(
974
- `${Ie}/${Ce(a)}/api/v1/route/build`,
914
+ `${Ee}/${be(a)}/api/v1/route/build`,
975
915
  {
976
916
  method: "POST",
977
917
  headers: {
978
918
  Accept: "application/json",
979
919
  "Content-Type": "application/json",
980
- "X-Client-Id": L
920
+ "X-Client-Id": W
981
921
  },
982
922
  body: JSON.stringify({
983
923
  routeSummary: e,
@@ -987,38 +927,38 @@ async function Wt({
987
927
  slippageTolerance: o,
988
928
  deadline: Math.floor(Date.now() / 1e3 + 600),
989
929
  enableGasEstimation: !1,
990
- source: L
930
+ source: W
991
931
  }),
992
932
  signal: i
993
933
  }
994
934
  );
995
- if (!c.ok) throw await Te(c);
935
+ if (!c.ok) throw await Ae(c);
996
936
  const r = await c.json();
997
- return Ft(r.data);
937
+ return Pt(r.data);
998
938
  }
999
- const Gt = 2, Kt = "Route temporarily unavailable. Refresh the quote and try again.";
1000
- function Ln(e, t) {
1001
- return _e(e) ? Kt : Mt(e, t);
939
+ const Rt = 2, Dt = "Route temporarily unavailable. Refresh the quote and try again.";
940
+ function Fn(e, t) {
941
+ return Se(e) ? Dt : _t(e, t);
1002
942
  }
1003
- function Lt(e, t) {
943
+ function Nt(e, t) {
1004
944
  if (!Number.isFinite(t) || t < 0 || t > 2e3)
1005
945
  throw new Error("Slippage must be between 0% and 20%.");
1006
946
  return e * BigInt(1e4 - Math.round(t)) / 10000n;
1007
947
  }
1008
- function $t(e, t) {
948
+ function Ft(e, t) {
1009
949
  if (t <= 0) return 0n;
1010
950
  const n = BigInt(1e4 - t);
1011
951
  return (e * 10000n + n - 1n) / n - e;
1012
952
  }
1013
- function qt(e) {
1014
- return e !== E ? null : {
1015
- feeAmount: String(we),
953
+ function Bt(e) {
954
+ return e !== y ? null : {
955
+ feeAmount: String(se),
1016
956
  chargeFeeBy: "currency_out",
1017
957
  isInBps: !0,
1018
- feeReceiver: ye
958
+ feeReceiver: de
1019
959
  };
1020
960
  }
1021
- function zt(e) {
961
+ function Ut(e) {
1022
962
  const t = e.routeSummary.gasEstimate ?? e.routeSummary.gas ?? "0";
1023
963
  try {
1024
964
  return BigInt(t);
@@ -1026,12 +966,12 @@ function zt(e) {
1026
966
  return 0n;
1027
967
  }
1028
968
  }
1029
- function Vt(e) {
969
+ function Gt(e) {
1030
970
  var t;
1031
971
  return ((t = e.routeSummary.route) == null ? void 0 : t.flat()) ?? [];
1032
972
  }
1033
- function Ht(e, t, n) {
1034
- const o = Vt(e);
973
+ function Kt(e, t, n) {
974
+ const o = Gt(e);
1035
975
  return o.length ? o.map((a) => ({
1036
976
  dex: a.exchange || a.poolType || "Unknown",
1037
977
  inputToken: t,
@@ -1044,17 +984,17 @@ function Ht(e, t, n) {
1044
984
  part: a.part || 0
1045
985
  }));
1046
986
  }
1047
- async function ee(e, t, n, o, a = "exactIn", i, c, r) {
987
+ async function g(e, t, n, o, a = "exactIn", i, c, r) {
1048
988
  if (a === "exactOut")
1049
989
  throw new Error("Exact output is not supported for aggregated routes.");
1050
990
  if (e.chainId !== t.chainId)
1051
991
  throw new Error("Input and output tokens must be on the same chain.");
1052
992
  if (n <= 0n)
1053
993
  throw new Error("Enter an amount to swap.");
1054
- const u = qt(e.chainId), l = i ? Gt : 1;
1055
- let s;
1056
- for (let p = 0; p < l; p += 1) {
1057
- const d = await Bt({
994
+ const u = Bt(e.chainId), l = i ? Rt : 1;
995
+ let p;
996
+ for (let s = 0; s < l; s += 1) {
997
+ const d = await kt({
1058
998
  tokenIn: e.address,
1059
999
  tokenOut: t.address,
1060
1000
  amountIn: n.toString(),
@@ -1062,10 +1002,10 @@ async function ee(e, t, n, o, a = "exactIn", i, c, r) {
1062
1002
  origin: i,
1063
1003
  fee: u,
1064
1004
  signal: c
1065
- }), f = BigInt(d.routeSummary.amountOut), w = u ? we : 0, S = $t(f, w), b = Lt(f, o);
1005
+ }), f = BigInt(d.routeSummary.amountOut), w = u ? se : 0, A = Ft(f, w), E = Nt(f, o);
1066
1006
  let h = null;
1067
1007
  try {
1068
- h = i ? await Wt({
1008
+ h = i ? await Mt({
1069
1009
  routeSummary: d.routeSummary,
1070
1010
  sender: i,
1071
1011
  recipient: i,
@@ -1073,32 +1013,32 @@ async function ee(e, t, n, o, a = "exactIn", i, c, r) {
1073
1013
  chainId: e.chainId,
1074
1014
  signal: c
1075
1015
  }) : null;
1076
- } catch (_) {
1077
- if (s = _, i && p < l - 1 && _e(_))
1016
+ } catch (T) {
1017
+ if (p = T, i && s < l - 1 && Se(T))
1078
1018
  continue;
1079
- throw _;
1019
+ throw T;
1080
1020
  }
1081
1021
  return {
1082
1022
  inputToken: e,
1083
1023
  outputToken: t,
1084
1024
  amountIn: n,
1085
1025
  amountOut: f,
1086
- gasEstimate: h != null && h.gas ? BigInt(h.gas) : zt(d),
1087
- hops: Ht(d, e, t),
1026
+ gasEstimate: h != null && h.gas ? BigInt(h.gas) : Ut(d),
1027
+ hops: Kt(d, e, t),
1088
1028
  routerAddress: (h == null ? void 0 : h.routerAddress) ?? d.routerAddress,
1089
1029
  calldata: (h == null ? void 0 : h.data) ?? null,
1090
1030
  transactionValue: h != null && h.transactionValue ? BigInt(h.transactionValue) : 0n,
1091
1031
  priceImpact: d.routeSummary.priceImpact ?? 0,
1092
- feeAmount: S,
1032
+ feeAmount: A,
1093
1033
  feeBps: w,
1094
- feeRecipient: u ? ye : null,
1095
- userAmountOutMinimum: b,
1096
- amountOutMinimum: b
1034
+ feeRecipient: u ? de : null,
1035
+ userAmountOutMinimum: E,
1036
+ amountOutMinimum: E
1097
1037
  };
1098
1038
  }
1099
- throw s instanceof Error ? s : new Error("Swap route could not be encoded. Try again.");
1039
+ throw p instanceof Error ? p : new Error("Swap route could not be encoded. Try again.");
1100
1040
  }
1101
- const N = 2n ** 160n - 1n, ve = 2n ** 256n - 1n, xe = 600, jt = 1800, Oe = 1800, Xt = xe, Qt = 2 ** 48 - 1, Yt = {
1041
+ const F = 2n ** 160n - 1n, Ie = 2n ** 256n - 1n, Ce = 600, Wt = 1800, Te = 1800, Lt = Ce, $t = 2 ** 48 - 1, qt = {
1102
1042
  PermitBatch: [
1103
1043
  { name: "details", type: "PermitDetails[]" },
1104
1044
  { name: "spender", type: "address" },
@@ -1111,14 +1051,14 @@ const N = 2n ** 160n - 1n, ve = 2n ** 256n - 1n, xe = 600, jt = 1800, Oe = 1800,
1111
1051
  { name: "nonce", type: "uint48" }
1112
1052
  ]
1113
1053
  };
1114
- async function Jt(e) {
1115
- const t = e.amount ?? ve, n = P({
1054
+ async function zt(e) {
1055
+ const t = e.amount ?? Ie, n = P({
1116
1056
  account: e.account,
1117
1057
  chain: e.chain,
1118
- transport: D(e.provider)
1058
+ transport: k(e.provider)
1119
1059
  }), { request: o } = await e.publicClient.simulateContract({
1120
1060
  address: e.token,
1121
- abi: z,
1061
+ abi: q,
1122
1062
  functionName: "approve",
1123
1063
  args: [e.permit2, t],
1124
1064
  account: e.account
@@ -1129,22 +1069,22 @@ async function Jt(e) {
1129
1069
  if ((await e.publicClient.waitForTransactionReceipt({ hash: a })).status === "reverted") throw new Error("Token approval reverted.");
1130
1070
  return a;
1131
1071
  }
1132
- function F(e) {
1072
+ function B(e) {
1133
1073
  return e.publicClient.readContract({
1134
1074
  address: e.token,
1135
- abi: z,
1075
+ abi: q,
1136
1076
  functionName: "allowance",
1137
1077
  args: [e.owner, e.spender]
1138
1078
  });
1139
1079
  }
1140
- async function te(e) {
1141
- const t = e.amount ?? ve, o = await P({
1080
+ async function ee(e) {
1081
+ const t = e.amount ?? Ie, o = await P({
1142
1082
  account: e.account,
1143
1083
  chain: e.chain,
1144
- transport: D(e.provider)
1084
+ transport: k(e.provider)
1145
1085
  }).writeContract({
1146
1086
  address: e.token,
1147
- abi: z,
1087
+ abi: q,
1148
1088
  functionName: "approve",
1149
1089
  args: [e.spender, t],
1150
1090
  account: e.account,
@@ -1153,14 +1093,14 @@ async function te(e) {
1153
1093
  if ((await e.publicClient.waitForTransactionReceipt({ hash: o })).status === "reverted") throw new Error("Token approval reverted.");
1154
1094
  return o;
1155
1095
  }
1156
- async function Zt(e) {
1157
- const t = e.amount && e.amount < N ? e.amount : N, n = e.expiration ?? Qt, o = P({
1096
+ async function Vt(e) {
1097
+ const t = e.amount && e.amount < F ? e.amount : F, n = e.expiration ?? $t, o = P({
1158
1098
  account: e.account,
1159
1099
  chain: e.chain,
1160
- transport: D(e.provider)
1100
+ transport: k(e.provider)
1161
1101
  }), { request: a } = await e.publicClient.simulateContract({
1162
1102
  address: e.permit2,
1163
- abi: ae,
1103
+ abi: oe,
1164
1104
  functionName: "approve",
1165
1105
  args: [e.token, e.router, t, n],
1166
1106
  account: e.account
@@ -1171,33 +1111,33 @@ async function Zt(e) {
1171
1111
  if ((await e.publicClient.waitForTransactionReceipt({ hash: i })).status === "reverted") throw new Error("Permit2 approval reverted.");
1172
1112
  return i;
1173
1113
  }
1174
- function Pe(e) {
1114
+ function ve(e) {
1175
1115
  return e.publicClient.readContract({
1176
1116
  address: e.permit2,
1177
- abi: ae,
1117
+ abi: oe,
1178
1118
  functionName: "allowance",
1179
1119
  args: [e.account, e.token, e.router]
1180
1120
  });
1181
1121
  }
1182
- async function gt(e) {
1183
- const [t, n, o] = await (e.allowanceRead ?? Pe(e)), a = Math.floor(Date.now() / 1e3);
1184
- if (t >= e.amount && Number(n) > a + Xt)
1122
+ async function Ht(e) {
1123
+ const [t, n, o] = await (e.allowanceRead ?? ve(e)), a = Math.floor(Date.now() / 1e3);
1124
+ if (t >= e.amount && Number(n) > a + Lt)
1185
1125
  return null;
1186
1126
  const i = {
1187
1127
  details: [
1188
1128
  {
1189
1129
  token: e.token,
1190
- amount: e.sizing === "max" || e.amount > N ? N : e.amount,
1191
- expiration: a + Oe,
1130
+ amount: e.sizing === "max" || e.amount > F ? F : e.amount,
1131
+ expiration: a + Te,
1192
1132
  nonce: Number(o)
1193
1133
  }
1194
1134
  ],
1195
1135
  spender: e.router,
1196
- sigDeadline: BigInt(a + jt)
1136
+ sigDeadline: BigInt(a + Wt)
1197
1137
  }, r = await P({
1198
1138
  account: e.account,
1199
1139
  chain: e.chain,
1200
- transport: D(e.provider)
1140
+ transport: k(e.provider)
1201
1141
  }).signTypedData({
1202
1142
  account: e.account,
1203
1143
  domain: {
@@ -1205,7 +1145,7 @@ async function gt(e) {
1205
1145
  chainId: e.chainId,
1206
1146
  verifyingContract: e.permit2
1207
1147
  },
1208
- types: Yt,
1148
+ types: qt,
1209
1149
  primaryType: "PermitBatch",
1210
1150
  message: i
1211
1151
  });
@@ -1215,51 +1155,51 @@ async function gt(e) {
1215
1155
  signature: r
1216
1156
  };
1217
1157
  }
1218
- const en = "https://ichi-images.s3.us-east-1.amazonaws.com/tokens", G = /* @__PURE__ */ new Map();
1219
- function ne(e, t, n) {
1158
+ const jt = "https://ichi-images.s3.us-east-1.amazonaws.com/tokens", G = /* @__PURE__ */ new Map();
1159
+ function te(e, t, n) {
1220
1160
  return `${e}|evm_${t}_${n.toLowerCase()}`;
1221
1161
  }
1222
- function tn(e, t) {
1162
+ function Xt(e, t) {
1223
1163
  return `evm_${e}_${t.toLowerCase()}`;
1224
1164
  }
1225
- function nn(e) {
1165
+ function Qt(e) {
1226
1166
  const t = e == null ? void 0 : e.trim();
1227
1167
  if (!t) return null;
1228
1168
  const n = t.split("-"), a = (n.length > 1 ? n[n.length - 1] : t).trim().toLowerCase();
1229
1169
  return !a || !/^[a-z0-9]+$/.test(a) ? null : a;
1230
1170
  }
1231
- function on(e) {
1232
- const t = nn(e);
1233
- return t ? `${en}/logo_256_${t}.svg` : null;
1171
+ function Yt(e) {
1172
+ const t = Qt(e);
1173
+ return t ? `${jt}/logo_256_${t}.svg` : null;
1234
1174
  }
1235
- function $n(e, t) {
1175
+ function Bn(e, t) {
1236
1176
  var n, o;
1237
- return ((n = e.iconUrl) != null && n.trim() ? e.iconUrl : null) ?? ((o = t[K(e.address)]) == null ? void 0 : o.iconURL) ?? on(e.symbol);
1177
+ return ((n = e.iconUrl) != null && n.trim() ? e.iconUrl : null) ?? ((o = t[K(e.address)]) == null ? void 0 : o.iconURL) ?? Yt(e.symbol);
1238
1178
  }
1239
- function an(e, t) {
1240
- return `query AegisSwapWidgetTokenMetadata { ${t.map((o, a) => `t${a}: getGlobalToken(id: ${JSON.stringify(tn(e, o))}) { chainId address symbol displayName fullName decimals iconURL }`).join(" ")} }`;
1179
+ function Jt(e, t) {
1180
+ return `query AegisSwapWidgetTokenMetadata { ${t.map((o, a) => `t${a}: getGlobalToken(id: ${JSON.stringify(Xt(e, o))}) { chainId address symbol displayName fullName decimals iconURL }`).join(" ")} }`;
1241
1181
  }
1242
- async function qn(e) {
1182
+ async function Un(e) {
1243
1183
  var r, u;
1244
1184
  const t = e.endpoint.trim(), n = [
1245
1185
  ...new Map(
1246
1186
  e.addresses.map((l) => {
1247
- const s = m(l);
1248
- return [s.toLowerCase(), s];
1187
+ const p = m(l);
1188
+ return [p.toLowerCase(), p];
1249
1189
  })
1250
1190
  ).values()
1251
1191
  ], o = /* @__PURE__ */ new Map(), a = n.filter((l) => {
1252
- const s = ne(t, e.chainId, l);
1253
- if (!G.has(s)) return !0;
1254
- const p = G.get(s);
1255
- return p && o.set(K(l), p), !1;
1192
+ const p = te(t, e.chainId, l);
1193
+ if (!G.has(p)) return !0;
1194
+ const s = G.get(p);
1195
+ return s && o.set(K(l), s), !1;
1256
1196
  });
1257
1197
  if (!a.length || typeof fetch != "function") return o;
1258
1198
  const i = await fetch(t, {
1259
1199
  method: "POST",
1260
1200
  headers: { "Content-Type": "application/json" },
1261
1201
  body: JSON.stringify({
1262
- query: an(e.chainId, a)
1202
+ query: Jt(e.chainId, a)
1263
1203
  }),
1264
1204
  signal: e.signal
1265
1205
  });
@@ -1268,63 +1208,63 @@ async function qn(e) {
1268
1208
  const c = await i.json();
1269
1209
  if ((r = c.errors) != null && r.length)
1270
1210
  throw new Error(((u = c.errors[0]) == null ? void 0 : u.message) ?? "Token metadata request failed.");
1271
- return a.forEach((l, s) => {
1211
+ return a.forEach((l, p) => {
1272
1212
  var d;
1273
- const p = ((d = c.data) == null ? void 0 : d[`t${s}`]) ?? null;
1274
- G.set(ne(t, e.chainId, l), p), p && o.set(K(l), p);
1213
+ const s = ((d = c.data) == null ? void 0 : d[`t${p}`]) ?? null;
1214
+ G.set(te(t, e.chainId, l), s), s && o.set(K(l), s);
1275
1215
  }), o;
1276
1216
  }
1277
- function rn() {
1217
+ function Zt() {
1278
1218
  return typeof window > "u" ? null : window.ethereum ?? null;
1279
1219
  }
1280
- function W(e) {
1281
- return typeof e != "string" || !Ge(e) ? null : m(e);
1220
+ function U(e) {
1221
+ return typeof e != "string" || !Fe(e) ? null : m(e);
1282
1222
  }
1283
- function cn(e) {
1223
+ function gt(e) {
1284
1224
  return !!(e && typeof e == "object" && typeof e.request == "function");
1285
1225
  }
1286
- function un(e) {
1287
- return cn(e) ? { provider: e, account: null } : !e || typeof e != "object" ? { provider: null, account: null } : {
1226
+ function en(e) {
1227
+ return gt(e) ? { provider: e, account: null } : !e || typeof e != "object" ? { provider: null, account: null } : {
1288
1228
  provider: e.provider ?? null,
1289
- account: W(e.account)
1229
+ account: U(e.account)
1290
1230
  };
1291
1231
  }
1292
- async function ln(e) {
1232
+ async function tn(e) {
1293
1233
  const t = await e.request({ method: "eth_accounts" });
1294
- return W(t == null ? void 0 : t[0]);
1234
+ return U(t == null ? void 0 : t[0]);
1295
1235
  }
1296
- async function sn(e) {
1236
+ async function nn(e) {
1297
1237
  const t = await e.request({ method: "eth_requestAccounts" });
1298
- return W(t == null ? void 0 : t[0]);
1238
+ return U(t == null ? void 0 : t[0]);
1299
1239
  }
1300
- async function $(e) {
1240
+ async function L(e) {
1301
1241
  const t = await e.request({ method: "eth_chainId" });
1302
1242
  if (typeof t != "string" || !/^0x[0-9a-f]+$/i.test(t)) return null;
1303
1243
  const n = Number.parseInt(t, 16);
1304
1244
  return Number.isSafeInteger(n) ? n : null;
1305
1245
  }
1306
- function mn(e) {
1246
+ function on(e) {
1307
1247
  return `0x${e.toString(16)}`;
1308
1248
  }
1309
- function pn(e) {
1249
+ function an(e) {
1310
1250
  const t = e, n = [t.message, t.shortMessage, t.details].filter((o) => typeof o == "string").join(" ").toLowerCase();
1311
1251
  return t.code === 4902 || n.includes("unrecognized chain") || n.includes("unknown chain") || n.includes("chain has not been added") || n.includes("not added to wallet");
1312
1252
  }
1313
- function dn(e) {
1253
+ function rn(e) {
1314
1254
  return typeof e == "number" ? { chainId: e } : e;
1315
1255
  }
1316
- function fn(e) {
1256
+ function cn(e) {
1317
1257
  var t, n;
1318
1258
  return (t = e.rpcUrls) != null && t.length ? e.rpcUrls : ((n = e.chain) == null ? void 0 : n.rpcUrls.default.http) ?? [];
1319
1259
  }
1320
- function hn(e) {
1260
+ function un(e) {
1321
1261
  var n, o;
1322
1262
  const t = (o = (n = e.chain) == null ? void 0 : n.blockExplorers) == null ? void 0 : o.default.url;
1323
1263
  return t ? [t] : [];
1324
1264
  }
1325
- async function wn(e, t) {
1265
+ async function ln(e, t) {
1326
1266
  var i, c;
1327
- const n = dn(t), o = mn(n.chainId), a = {
1267
+ const n = rn(t), o = on(n.chainId), a = {
1328
1268
  method: "wallet_switchEthereumChain",
1329
1269
  params: [{ chainId: o }]
1330
1270
  };
@@ -1332,10 +1272,10 @@ async function wn(e, t) {
1332
1272
  await e.request(a);
1333
1273
  return;
1334
1274
  } catch (r) {
1335
- if (!pn(r)) throw r;
1336
- const u = fn(n);
1275
+ if (!an(r)) throw r;
1276
+ const u = cn(n);
1337
1277
  if (u.length === 0) throw r;
1338
- const l = hn(n);
1278
+ const l = un(n);
1339
1279
  await e.request({
1340
1280
  method: "wallet_addEthereumChain",
1341
1281
  params: [
@@ -1358,21 +1298,21 @@ async function wn(e, t) {
1358
1298
  params: [{ chainId: o }]
1359
1299
  });
1360
1300
  }
1361
- function zn(e, t) {
1301
+ function Gn(e, t) {
1362
1302
  const n = t.map(
1363
- (o) => Fe(o, {
1303
+ (o) => Re(o, {
1364
1304
  batch: !0,
1365
1305
  retryCount: 2,
1366
1306
  retryDelay: 150,
1367
1307
  timeout: 1e4
1368
1308
  })
1369
1309
  );
1370
- return Be({
1310
+ return De({
1371
1311
  chain: e,
1372
- transport: n.length === 1 ? n[0] : We(n)
1312
+ transport: n.length === 1 ? n[0] : Ne(n)
1373
1313
  });
1374
1314
  }
1375
- function Vn(e, t) {
1315
+ function Kn(e, t) {
1376
1316
  const n = e;
1377
1317
  if (!n.on || !n.removeListener) return () => {
1378
1318
  };
@@ -1388,7 +1328,7 @@ function Vn(e, t) {
1388
1328
  (i = n.removeListener) == null || i.call(n, "accountsChanged", o), (c = n.removeListener) == null || c.call(n, "chainChanged", a);
1389
1329
  };
1390
1330
  }
1391
- async function yn({
1331
+ async function pn({
1392
1332
  wallet: e,
1393
1333
  publicClient: t,
1394
1334
  activeChain: n,
@@ -1399,24 +1339,24 @@ async function yn({
1399
1339
  permit: r,
1400
1340
  setStatus: u,
1401
1341
  setTxHash: l,
1402
- onSubmitted: s
1342
+ onSubmitted: p
1403
1343
  }) {
1404
- const p = BigInt(Math.floor(Date.now() / 1e3) + xe), d = kt(c), f = c.mode === "exactOut" ? nt({
1344
+ const s = BigInt(Math.floor(Date.now() / 1e3) + Ce), d = Tt(c), f = c.mode === "exactOut" ? Ze({
1405
1345
  poolKey: c.poolKey,
1406
1346
  zeroForOne: c.zeroForOne,
1407
1347
  amountOut: c.grossAmountOut,
1408
1348
  amountInMaximum: c.amountInMaximum,
1409
1349
  recipient: e.account,
1410
- deadline: p,
1350
+ deadline: s,
1411
1351
  permit: r,
1412
1352
  fee: d
1413
- }) : tt({
1353
+ }) : Je({
1414
1354
  poolKey: c.poolKey,
1415
1355
  zeroForOne: c.zeroForOne,
1416
1356
  amountIn: c.amountIn,
1417
1357
  amountOutMinimum: c.amountOutMinimum,
1418
1358
  recipient: e.account,
1419
- deadline: p,
1359
+ deadline: s,
1420
1360
  permit: r,
1421
1361
  fee: d
1422
1362
  });
@@ -1424,17 +1364,17 @@ async function yn({
1424
1364
  const w = P({
1425
1365
  account: e.account,
1426
1366
  chain: n.chain,
1427
- transport: D(e.provider)
1428
- }), S = await t.estimateGas({
1367
+ transport: k(e.provider)
1368
+ }), A = await t.estimateGas({
1429
1369
  account: e.account,
1430
1370
  to: o.router,
1431
1371
  data: f.calldata,
1432
1372
  value: f.value
1433
- }), b = await w.sendTransaction({
1373
+ }), E = await w.sendTransaction({
1434
1374
  to: o.router,
1435
1375
  data: f.calldata,
1436
1376
  value: f.value,
1437
- gas: S * 12n / 10n
1377
+ gas: A * 12n / 10n
1438
1378
  }), h = {
1439
1379
  mode: c.mode,
1440
1380
  inputSymbol: a.symbol,
@@ -1444,31 +1384,31 @@ async function yn({
1444
1384
  feeAmount: c.feeAmount,
1445
1385
  feeBps: c.feeBps
1446
1386
  };
1447
- l(b);
1387
+ l(E);
1448
1388
  try {
1449
- s == null || s(b, h);
1389
+ p == null || p(E, h);
1450
1390
  } catch (R) {
1451
1391
  console.warn("[AegisSwapWidget] onSubmitted callback failed", R);
1452
1392
  }
1453
- let _ = null;
1393
+ let T = null;
1454
1394
  const v = await t.waitForTransactionReceipt({
1455
- hash: b,
1395
+ hash: E,
1456
1396
  onReplaced: (R) => {
1457
- _ = R.reason, l(R.transaction.hash);
1397
+ T = R.reason, l(R.transaction.hash);
1458
1398
  }
1459
1399
  });
1460
- if (_ === "cancelled") throw new Error("Swap was cancelled in the wallet.");
1400
+ if (T === "cancelled") throw new Error("Swap was cancelled in the wallet.");
1461
1401
  if (v.status === "reverted") throw new Error("Swap reverted on-chain.");
1462
- const Y = v.gasUsed ?? 0n, J = v.effectiveGasPrice ?? 0n, Re = {
1402
+ const Q = v.gasUsed ?? 0n, Y = v.effectiveGasPrice ?? 0n, Oe = {
1463
1403
  transactionHash: v.transactionHash,
1464
1404
  blockNumber: v.blockNumber ?? 0n,
1465
- gasUsed: Y,
1466
- effectiveGasPrice: J,
1467
- feeWei: Y * J
1405
+ gasUsed: Q,
1406
+ effectiveGasPrice: Y,
1407
+ feeWei: Q * Y
1468
1408
  };
1469
- return { receipt: v, summary: Re, swapDetails: h };
1409
+ return { receipt: v, summary: Oe, swapDetails: h };
1470
1410
  }
1471
- async function En({
1411
+ async function mn({
1472
1412
  wallet: e,
1473
1413
  publicClient: t,
1474
1414
  activeChain: n,
@@ -1481,7 +1421,7 @@ async function En({
1481
1421
  setStatus: l
1482
1422
  }) {
1483
1423
  try {
1484
- return await gt({
1424
+ return await Ht({
1485
1425
  provider: e.provider,
1486
1426
  publicClient: t,
1487
1427
  account: e.account,
@@ -1494,9 +1434,9 @@ async function En({
1494
1434
  sizing: r,
1495
1435
  allowanceRead: u
1496
1436
  });
1497
- } catch (s) {
1498
- if (Ae(s)) throw s;
1499
- return l("approving"), await Zt({
1437
+ } catch (p) {
1438
+ if (we(p)) throw p;
1439
+ return l("approving"), await Vt({
1500
1440
  provider: e.provider,
1501
1441
  publicClient: t,
1502
1442
  account: e.account,
@@ -1506,14 +1446,14 @@ async function En({
1506
1446
  router: a,
1507
1447
  // undefined -> MAX_UINT160, mirroring the 'max' permit sizing above.
1508
1448
  amount: r === "max" ? void 0 : c,
1509
- expiration: Math.floor(Date.now() / 1e3) + Oe
1449
+ expiration: Math.floor(Date.now() / 1e3) + Te
1510
1450
  }), null;
1511
1451
  }
1512
1452
  }
1513
- function Hn() {
1453
+ function Wn() {
1514
1454
  return typeof document > "u" ? !0 : document.visibilityState !== "hidden";
1515
1455
  }
1516
- async function jn(e, t, n, o) {
1456
+ async function Ln(e, t, n, o) {
1517
1457
  let a;
1518
1458
  for (let i = 0; i < t; i += 1) {
1519
1459
  i > 0 && await new Promise((c) => setTimeout(c, n));
@@ -1525,53 +1465,67 @@ async function jn(e, t, n, o) {
1525
1465
  }
1526
1466
  throw a ?? new Error("retryOnError was called with attempts < 1.");
1527
1467
  }
1528
- async function Q(e, t, n, o) {
1468
+ async function X(e, t, n, o) {
1529
1469
  let a = await e();
1530
1470
  for (let i = 1; i < n && !t(a); i += 1)
1531
1471
  await new Promise((c) => setTimeout(c, o)), a = await e();
1532
1472
  return a;
1533
1473
  }
1534
- async function bn(e, t, n = 12, o = 250) {
1535
- return await Q(
1536
- () => $(e),
1474
+ async function sn(e, t, n = 12, o = 250) {
1475
+ return await X(
1476
+ () => L(e),
1537
1477
  (i) => i === t,
1538
1478
  n,
1539
1479
  o
1540
1480
  ) === t;
1541
1481
  }
1542
- async function De(e) {
1482
+ async function _e(e) {
1543
1483
  var a, i;
1544
- const t = await $(e.provider);
1484
+ const t = await L(e.provider);
1545
1485
  if ((a = e.onChainId) == null || a.call(e, t), t === e.chain.chainId) return;
1546
- await wn(e.provider, e.chain);
1547
- const n = await bn(e.provider, e.chain.chainId), o = n ? e.chain.chainId : await $(e.provider);
1486
+ await ln(e.provider, e.chain);
1487
+ const n = await sn(e.provider, e.chain.chainId), o = n ? e.chain.chainId : await L(e.provider);
1548
1488
  if ((i = e.onChainId) == null || i.call(e, o), !n)
1549
1489
  throw new Error("Network switch did not complete. Switch to the correct network and try again.");
1550
1490
  }
1551
- async function Xn(e = {}) {
1491
+ async function $n(e = {}) {
1552
1492
  var o;
1553
- let t = e.provider ?? await ((o = e.getProvider) == null ? void 0 : o.call(e)) ?? rn(), n = W(e.account);
1493
+ let t = e.provider ?? await ((o = e.getProvider) == null ? void 0 : o.call(e)) ?? Zt(), n = U(e.account);
1554
1494
  if ((!t || !n) && e.connectWallet) {
1555
- const a = un(await e.connectWallet());
1495
+ const a = en(await e.connectWallet());
1556
1496
  t = a.provider ?? t, n = n ?? a.account;
1557
1497
  }
1558
1498
  if (!t) throw new Error("No wallet provider found.");
1559
- if (n || (n = e.requestAccount === !1 ? await ln(t) : await sn(t)), !n) throw new Error("Wallet connection was not completed.");
1499
+ if (n || (n = e.requestAccount === !1 ? await tn(t) : await nn(t)), !n) throw new Error("Wallet connection was not completed.");
1560
1500
  return { provider: t, account: n };
1561
1501
  }
1562
- class An extends Error {
1502
+ class dn extends Error {
1563
1503
  constructor(n) {
1564
1504
  super("Price moved beyond your slippage tolerance. Review the updated quote and try again.");
1565
- I(this, "quote");
1505
+ S(this, "quote");
1566
1506
  this.name = "DirectPoolSwapPriceMovedError", this.quote = n;
1567
1507
  }
1568
1508
  }
1569
- async function Sn(e, t) {
1570
- return Q(e, (n) => n >= t, 5, 300);
1509
+ function fn(e) {
1510
+ return St({
1511
+ publicClient: e.publicClient,
1512
+ account: e.account,
1513
+ market: e.market,
1514
+ tokenIn: e.inputToken,
1515
+ tokenOut: e.outputToken,
1516
+ mode: e.mode,
1517
+ amount: e.amount,
1518
+ slippageBps: e.slippageBps,
1519
+ fee: e.activeChain.fee ?? null,
1520
+ signal: e.signal
1521
+ });
1571
1522
  }
1572
- async function In(e) {
1523
+ async function hn(e, t) {
1524
+ return X(e, (n) => n >= t, 5, 300);
1525
+ }
1526
+ async function wn(e) {
1573
1527
  var a;
1574
- const t = () => F({
1528
+ const t = () => B({
1575
1529
  publicClient: e.publicClient,
1576
1530
  token: e.token.address,
1577
1531
  owner: e.wallet.account,
@@ -1580,7 +1534,7 @@ async function In(e) {
1580
1534
  let n = await t();
1581
1535
  if (n >= e.amount) return { approvalHash: null, allowance: n };
1582
1536
  (a = e.onStatus) == null || a.call(e, "approving");
1583
- const o = await Jt({
1537
+ const o = await zt({
1584
1538
  provider: e.wallet.provider,
1585
1539
  publicClient: e.publicClient,
1586
1540
  account: e.wallet.account,
@@ -1589,23 +1543,23 @@ async function In(e) {
1589
1543
  permit2: e.permit2,
1590
1544
  amount: e.approvalMode === "exact" ? e.amount : void 0
1591
1545
  });
1592
- if (n = await Sn(t, e.amount), n < e.amount)
1546
+ if (n = await hn(t, e.amount), n < e.amount)
1593
1547
  throw new Error("Approval confirmed, but allowance is still below this quote. Try again.");
1594
1548
  return { approvalHash: o, allowance: n };
1595
1549
  }
1596
- async function Qn(e) {
1597
- var s, p, d;
1598
- await De({
1550
+ async function qn(e) {
1551
+ var p, s, d;
1552
+ await _e({
1599
1553
  provider: e.wallet.provider,
1600
1554
  chain: e.activeChain,
1601
1555
  onChainId: e.onWalletChainId
1602
1556
  });
1603
- const t = F({
1557
+ const t = B({
1604
1558
  publicClient: e.publicClient,
1605
1559
  token: e.inputToken.address,
1606
1560
  owner: e.wallet.account,
1607
1561
  spender: e.market.permit2
1608
- }).catch(() => null), n = Pe({
1562
+ }).catch(() => null), n = ve({
1609
1563
  publicClient: e.publicClient,
1610
1564
  permit2: e.market.permit2,
1611
1565
  account: e.wallet.account,
@@ -1614,29 +1568,29 @@ async function Qn(e) {
1614
1568
  });
1615
1569
  n.catch(() => {
1616
1570
  });
1617
- const o = await Ot({
1571
+ const o = await fn({
1618
1572
  publicClient: e.publicClient,
1619
1573
  account: e.wallet.account,
1574
+ activeChain: e.activeChain,
1620
1575
  market: e.market,
1621
- tokenIn: e.inputToken,
1622
- tokenOut: e.outputToken,
1576
+ inputToken: e.inputToken,
1577
+ outputToken: e.outputToken,
1623
1578
  mode: e.mode,
1624
1579
  amount: e.amount,
1625
1580
  slippageBps: e.slippageBps,
1626
- fee: e.fee ?? e.activeChain.fee ?? null,
1627
1581
  signal: e.signal
1628
- }), a = Pt(e.displayedQuote ?? null, o);
1582
+ }), a = It(e.displayedQuote ?? null, o);
1629
1583
  if (a.priceMovedBeyondTolerance)
1630
- throw (s = e.onStatus) == null || s.call(e, "idle"), new An(o);
1631
- const i = a.quote, c = Dt(i);
1584
+ throw (p = e.onStatus) == null || p.call(e, "idle"), new dn(o);
1585
+ const i = a.quote, c = Ct(i);
1632
1586
  if (c <= 0n) throw new Error("Quote returned an empty amount. Try again.");
1633
- let r = await t ?? await F({
1587
+ let r = await t ?? await B({
1634
1588
  publicClient: e.publicClient,
1635
1589
  token: e.inputToken.address,
1636
1590
  owner: e.wallet.account,
1637
1591
  spender: e.market.permit2
1638
1592
  });
1639
- if (r < c && (r = (await In({
1593
+ if (r < c && (r = (await wn({
1640
1594
  wallet: e.wallet,
1641
1595
  publicClient: e.publicClient,
1642
1596
  activeChain: e.activeChain,
@@ -1647,8 +1601,8 @@ async function Qn(e) {
1647
1601
  onStatus: e.onStatus
1648
1602
  })).allowance), r < c)
1649
1603
  throw new Error(`Approve ${e.inputToken.symbol} before swapping.`);
1650
- (p = e.onStatus) == null || p.call(e, "signing");
1651
- const u = await En({
1604
+ (s = e.onStatus) == null || s.call(e, "signing");
1605
+ const u = await mn({
1652
1606
  wallet: e.wallet,
1653
1607
  publicClient: e.publicClient,
1654
1608
  activeChain: e.activeChain,
@@ -1662,7 +1616,7 @@ async function Qn(e) {
1662
1616
  var w;
1663
1617
  return (w = e.onStatus) == null ? void 0 : w.call(e, f);
1664
1618
  }
1665
- }), l = await yn({
1619
+ }), l = await pn({
1666
1620
  wallet: e.wallet,
1667
1621
  publicClient: e.publicClient,
1668
1622
  activeChain: e.activeChain,
@@ -1683,34 +1637,34 @@ async function Qn(e) {
1683
1637
  });
1684
1638
  return (d = e.onStatus) == null || d.call(e, "success"), {
1685
1639
  hash: l.receipt.transactionHash,
1686
- explorerUrl: se(l.receipt.transactionHash, e.activeChain),
1640
+ explorerUrl: le(l.receipt.transactionHash, e.activeChain),
1687
1641
  quote: i,
1688
1642
  receiptSummary: l.summary,
1689
1643
  swap: l.swapDetails
1690
1644
  };
1691
1645
  }
1692
- async function Cn(e, t) {
1646
+ async function yn(e, t) {
1693
1647
  try {
1694
1648
  return await e.estimateGas(t) * 12n / 10n;
1695
1649
  } catch {
1696
1650
  return;
1697
1651
  }
1698
1652
  }
1699
- const Tn = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
1700
- function ke(e) {
1701
- return e.address.toLowerCase() === Tn.toLowerCase();
1653
+ const En = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
1654
+ function xe(e) {
1655
+ return e.address.toLowerCase() === En.toLowerCase();
1702
1656
  }
1703
- class _n extends Error {
1657
+ class bn extends Error {
1704
1658
  constructor(n) {
1705
1659
  super("Price moved beyond your slippage tolerance. Review the updated quote and try again.");
1706
- I(this, "quote");
1660
+ S(this, "quote");
1707
1661
  this.name = "KyberSwapPriceMovedError", this.quote = n;
1708
1662
  }
1709
1663
  }
1710
- async function vn(e) {
1664
+ async function An(e) {
1711
1665
  var a;
1712
- if (ke(e.inputToken)) return { approvalHashes: [], allowance: e.amount };
1713
- const t = () => F({
1666
+ if (xe(e.inputToken)) return { approvalHashes: [], allowance: e.amount };
1667
+ const t = () => B({
1714
1668
  publicClient: e.publicClient,
1715
1669
  token: e.inputToken.address,
1716
1670
  owner: e.wallet.account,
@@ -1721,7 +1675,7 @@ async function vn(e) {
1721
1675
  (a = e.onStatus) == null || a.call(e, "approving");
1722
1676
  const o = [];
1723
1677
  if (n > 0n && o.push(
1724
- await te({
1678
+ await ee({
1725
1679
  provider: e.wallet.provider,
1726
1680
  publicClient: e.publicClient,
1727
1681
  account: e.wallet.account,
@@ -1731,7 +1685,7 @@ async function vn(e) {
1731
1685
  amount: 0n
1732
1686
  })
1733
1687
  ), o.push(
1734
- await te({
1688
+ await ee({
1735
1689
  provider: e.wallet.provider,
1736
1690
  publicClient: e.publicClient,
1737
1691
  account: e.wallet.account,
@@ -1740,11 +1694,11 @@ async function vn(e) {
1740
1694
  spender: e.spender,
1741
1695
  amount: e.approvalMode === "max" ? void 0 : e.amount
1742
1696
  })
1743
- ), n = await Q(t, (i) => i >= e.amount, 5, 300), n < e.amount)
1697
+ ), n = await X(t, (i) => i >= e.amount, 5, 300), n < e.amount)
1744
1698
  throw new Error("Approval confirmed, but allowance is still below this quote. Try again.");
1745
1699
  return { approvalHashes: o, allowance: n };
1746
1700
  }
1747
- function xn(e) {
1701
+ function Sn(e) {
1748
1702
  return {
1749
1703
  mode: "exactIn",
1750
1704
  inputSymbol: e.inputToken.symbol,
@@ -1755,7 +1709,7 @@ function xn(e) {
1755
1709
  feeBps: e.feeBps
1756
1710
  };
1757
1711
  }
1758
- function On(e) {
1712
+ function In(e) {
1759
1713
  const t = e.gasUsed ?? 0n, n = e.effectiveGasPrice ?? 0n;
1760
1714
  return {
1761
1715
  transactionHash: e.transactionHash,
@@ -1765,14 +1719,14 @@ function On(e) {
1765
1719
  feeWei: t * n
1766
1720
  };
1767
1721
  }
1768
- async function Yn(e) {
1769
- var p, d, f, w, S;
1770
- await De({
1722
+ async function zn(e) {
1723
+ var s, d, f, w, A;
1724
+ await _e({
1771
1725
  provider: e.wallet.provider,
1772
1726
  chain: e.activeChain,
1773
1727
  onChainId: e.onWalletChainId
1774
1728
  });
1775
- const t = e.displayedQuote ?? await ee(
1729
+ const t = e.displayedQuote ?? await g(
1776
1730
  e.inputToken,
1777
1731
  e.outputToken,
1778
1732
  e.amount,
@@ -1781,7 +1735,7 @@ async function Yn(e) {
1781
1735
  null,
1782
1736
  e.signal
1783
1737
  );
1784
- await vn({
1738
+ await An({
1785
1739
  wallet: e.wallet,
1786
1740
  publicClient: e.publicClient,
1787
1741
  activeChain: e.activeChain,
@@ -1790,8 +1744,8 @@ async function Yn(e) {
1790
1744
  amount: t.amountIn,
1791
1745
  approvalMode: e.approvalMode ?? "exact",
1792
1746
  onStatus: e.onStatus
1793
- }), (p = e.onStatus) == null || p.call(e, "submitting");
1794
- const n = await ee(
1747
+ }), (s = e.onStatus) == null || s.call(e, "submitting");
1748
+ const n = await g(
1795
1749
  e.inputToken,
1796
1750
  e.outputToken,
1797
1751
  e.amount,
@@ -1801,13 +1755,13 @@ async function Yn(e) {
1801
1755
  e.signal
1802
1756
  );
1803
1757
  if (e.displayedQuote && n.amountOut < e.displayedQuote.userAmountOutMinimum)
1804
- throw (d = e.onStatus) == null || d.call(e, "idle"), new _n(n);
1758
+ throw (d = e.onStatus) == null || d.call(e, "idle"), new bn(n);
1805
1759
  if (!n.calldata) throw new Error("Swap route could not be encoded. Try again.");
1806
- const o = n.transactionValue || (ke(e.inputToken) ? n.amountIn : 0n), a = P({
1760
+ const o = n.transactionValue || (xe(e.inputToken) ? n.amountIn : 0n), a = P({
1807
1761
  account: e.wallet.account,
1808
1762
  chain: e.activeChain.chain,
1809
- transport: D(e.wallet.provider)
1810
- }), i = await Cn(e.publicClient, {
1763
+ transport: k(e.wallet.provider)
1764
+ }), i = await yn(e.publicClient, {
1811
1765
  account: e.wallet.account,
1812
1766
  to: n.routerAddress,
1813
1767
  data: n.calldata,
@@ -1819,43 +1773,43 @@ async function Yn(e) {
1819
1773
  ...i ? { gas: i } : {}
1820
1774
  });
1821
1775
  (f = e.onTxHash) == null || f.call(e, c);
1822
- const r = xn(n);
1776
+ const r = Sn(n);
1823
1777
  try {
1824
1778
  (w = e.onSubmitted) == null || w.call(e, c, r);
1825
- } catch (b) {
1826
- console.warn("[AegisCore] onSubmitted callback failed", b);
1779
+ } catch (E) {
1780
+ console.warn("[AegisCore] onSubmitted callback failed", E);
1827
1781
  }
1828
1782
  let u = null;
1829
1783
  const l = await e.publicClient.waitForTransactionReceipt({
1830
1784
  hash: c,
1831
- onReplaced: (b) => {
1785
+ onReplaced: (E) => {
1832
1786
  var h;
1833
- u = b.reason, (h = e.onTxHash) == null || h.call(e, b.transaction.hash);
1787
+ u = E.reason, (h = e.onTxHash) == null || h.call(e, E.transaction.hash);
1834
1788
  }
1835
1789
  });
1836
1790
  if (u === "cancelled") throw new Error("Swap was cancelled in the wallet.");
1837
1791
  if (l.status === "reverted") throw new Error("Swap reverted on-chain.");
1838
- const s = On(l);
1839
- return (S = e.onStatus) == null || S.call(e, "success"), {
1792
+ const p = In(l);
1793
+ return (A = e.onStatus) == null || A.call(e, "success"), {
1840
1794
  hash: l.transactionHash,
1841
- explorerUrl: se(l.transactionHash, e.activeChain),
1795
+ explorerUrl: le(l.transactionHash, e.activeChain),
1842
1796
  quote: n,
1843
- receiptSummary: s,
1797
+ receiptSummary: p,
1844
1798
  swap: r
1845
1799
  };
1846
1800
  }
1847
- function Jn(e) {
1801
+ function Vn(e) {
1848
1802
  return e === "approving" || e === "signing" || e === "submitting";
1849
1803
  }
1850
- const Pn = {
1804
+ const Cn = {
1851
1805
  total: 0,
1852
1806
  completed: 0,
1853
1807
  active: null
1854
1808
  };
1855
- function U({ total: e, completed: t }) {
1809
+ function N({ total: e, completed: t }) {
1856
1810
  return e <= 0 ? 0 : t / e * 100;
1857
1811
  }
1858
- function Dn({
1812
+ function Tn({
1859
1813
  status: e,
1860
1814
  txHash: t,
1861
1815
  approvalRequired: n,
@@ -1863,7 +1817,7 @@ function Dn({
1863
1817
  authorizationRequired: a
1864
1818
  }) {
1865
1819
  const i = n || o, c = a, r = e === "idle" && !o ? 0 : 1 + (i ? 1 : 0) + (c ? 1 : 0);
1866
- if (r === 0) return Pn;
1820
+ if (r === 0) return Cn;
1867
1821
  if (e === "success") return { total: r, completed: r, active: null };
1868
1822
  if (e === "idle")
1869
1823
  return {
@@ -1873,8 +1827,8 @@ function Dn({
1873
1827
  };
1874
1828
  if (e === "approving") {
1875
1829
  if (o && c) {
1876
- const s = i ? 1 : 0;
1877
- return { total: r, completed: s, active: s + 1 };
1830
+ const p = i ? 1 : 0;
1831
+ return { total: r, completed: p, active: p + 1 };
1878
1832
  }
1879
1833
  return {
1880
1834
  total: r,
@@ -1896,7 +1850,7 @@ function Dn({
1896
1850
  active: t ? null : r
1897
1851
  };
1898
1852
  }
1899
- function Zn({
1853
+ function Hn({
1900
1854
  status: e,
1901
1855
  inputSymbol: t,
1902
1856
  txHash: n,
@@ -1905,7 +1859,7 @@ function Zn({
1905
1859
  approvalDone: i,
1906
1860
  authorizationRequired: c
1907
1861
  }) {
1908
- const r = Dn({
1862
+ const r = Tn({
1909
1863
  status: e,
1910
1864
  txHash: n,
1911
1865
  approvalRequired: a,
@@ -1928,116 +1882,114 @@ function Zn({
1928
1882
  state: "pending",
1929
1883
  label: `ERC20 approval complete · ready to swap · ${r.completed} of ${r.total} prompts done`,
1930
1884
  walletPrompts: r,
1931
- completePct: U(r),
1885
+ completePct: N(r),
1932
1886
  activeWidthPct: 0
1933
1887
  } : null : e === "approving" ? {
1934
1888
  state: "pending",
1935
1889
  label: i && c ? `Approving Permit2 router · wallet prompt ${r.active ?? 1} of ${r.total}` : `Approving ${t} for Permit2 · wallet prompt ${r.active ?? 1} of ${r.total}`,
1936
1890
  walletPrompts: r,
1937
- completePct: U(r),
1891
+ completePct: N(r),
1938
1892
  activeWidthPct: 100
1939
1893
  } : a || i ? {
1940
1894
  state: e === "submitting" && n ? "mining" : "pending",
1941
1895
  label: e === "signing" ? `ERC20 approval complete · sign Permit2 permit · wallet prompt ${r.active ?? 2} of ${r.total}` : n ? `Confirming swap · ${r.completed} of ${r.total} wallet prompts complete` : `Approve complete · submitting swap · wallet prompt ${r.active ?? r.total} of ${r.total}`,
1942
1896
  walletPrompts: r,
1943
- completePct: U(r),
1897
+ completePct: N(r),
1944
1898
  activeWidthPct: 100
1945
1899
  } : {
1946
1900
  state: e === "submitting" && n ? "mining" : "pending",
1947
1901
  label: e === "signing" ? c ? `Signing Permit2 spending permit · wallet prompt ${r.active ?? 1} of ${r.total}` : "Preparing swap" : n ? `Confirming swap on-chain · ${r.completed} of ${r.total} wallet prompts complete` : `Submitting swap · wallet prompt ${r.active ?? r.total} of ${r.total}`,
1948
1902
  walletPrompts: r,
1949
- completePct: U(r),
1903
+ completePct: N(r),
1950
1904
  activeWidthPct: 100
1951
1905
  };
1952
1906
  }
1953
1907
  export {
1954
- at as AEGIS_DYNAMIC_FEE_FLAG,
1955
- j as AEGIS_SWAP_CHAINS,
1956
- E as AEGIS_SWAP_CHAIN_ID,
1957
- it as AEGIS_SWAP_DEFAULT_FEE_BPS,
1908
+ Pn as AEGIS_DYNAMIC_FEE_FLAG,
1909
+ H as AEGIS_SWAP_CHAINS,
1910
+ y as AEGIS_SWAP_CHAIN_ID,
1911
+ et as AEGIS_SWAP_DEFAULT_FEE_BPS,
1958
1912
  pe as AEGIS_SWAP_DEFAULT_FEE_RECIPIENT,
1959
- ct as AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT,
1960
- Nn as AEGIS_SWAP_DEFAULT_POOL_IDS,
1961
- rt as AEGIS_SWAP_DEFAULT_RPC_URLS,
1962
- ot as AEGIS_SWAP_HOOK,
1963
- ut as AEGIS_SWAP_MAINNET_CHAIN,
1964
- H as AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS,
1965
- Un as AEGIS_SWAP_MARKETS,
1966
- fe as AEGIS_SWAP_PERMIT2,
1967
- me as AEGIS_SWAP_ROUTER,
1968
- y as AEGIS_SWAP_TOKENS,
1969
- he as AEGIS_SWAP_V4_QUOTER,
1970
- Bn as AGGREGATED_SWAP_CURATED_TOKENS,
1971
- X as AGGREGATED_SWAP_DEFAULT_TOKENS,
1972
- ft as AGGREGATED_SWAP_DEFAULT_TOKEN_LIST,
1973
- Fn as AGGREGATED_SWAP_TOKEN_PRESETS,
1974
- dt as AGGREGATED_SWAP_WOLFGAME_TOKENS,
1975
- ht as AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
1976
- Oe as DEFAULT_PERMIT_EXPIRATION_SECONDS,
1977
- An as DirectPoolSwapPriceMovedError,
1978
- Se as KyberSwapApiError,
1979
- _n as KyberSwapPriceMovedError,
1980
- $e as MAX_UINT128,
1981
- N as MAX_UINT160,
1982
- ve as MAX_UINT256,
1983
- Tn as NATIVE_TOKEN_ADDRESS,
1984
- Qt as PERMIT2_FAR_FUTURE_EXPIRATION,
1985
- xe as SWAP_TX_DEADLINE_SECONDS,
1986
- de as UNISWAP_V4_CONTRACTS_BY_CHAIN,
1987
- Ln as aggregatedSwapErrorMessage,
1988
- In as approveDirectPoolSwapInput,
1989
- te as approveErc20Spender,
1990
- Jt as approveErc20ToPermit2,
1991
- vn as approveKyberSwapInput,
1992
- Zt as approvePermit2ToRouter,
1993
- k as assertUint128,
1994
- tt as buildExactInSwapTransaction,
1995
- nt as buildExactOutSwapTransaction,
1996
- Wt as buildKyberSwapRoute,
1997
- gt as buildSignedPermitBatch,
1998
- ue as computePoolId,
1999
- Et as createAegisSwapChainConfig,
2000
- Wn as createAegisSwapChains,
2001
- Gn as createAegisSwapMarketsFromPools,
2002
- bt as createAegisSwapPoolMarket,
2003
- C as createAegisSwapUniswapV4Contracts,
2004
- zn as createSwapPublicClient,
2005
- De as ensureWalletChain,
2006
- Mt as errorMessage,
2007
- Cn as estimateSwapGasWithBuffer,
2008
- Qn as executeDirectPoolSwap,
2009
- Yn as executeKyberSwap,
2010
- ee as fetchAggregatedSwapQuote,
2011
- Ot as fetchDirectSwapQuote,
2012
- qn as fetchGlobalTokenMetadata,
2013
- Bt as fetchKyberSwapRoute,
2014
- se as getExplorerUrl,
2015
- on as getIchiIconGuess,
2016
- rn as getInjectedProvider,
2017
- ln as getProviderAccount,
2018
- $ as getProviderChainId,
2019
- _t as getZeroForOne,
2020
- Jn as isBusy,
2021
- Hn as isDocumentVisible,
2022
- cn as isEip1193Provider,
2023
- ke as isNativeToken,
2024
- _e as isRetryableKyberSwapError,
2025
- Ae as isUserRejectedError,
2026
- W as normalizeAccount,
2027
- un as normalizeWalletConnection,
2028
- kt as outputFeeForQuote,
2029
- Q as pollUntil,
2030
- Dt as quoteSpendAmount,
2031
- F as readErc20Allowance,
2032
- Pe as readPermit2RouterAllowance,
2033
- Pt as reconcileSubmitQuote,
2034
- sn as requestProviderAccount,
2035
- $n as resolveTokenIconUrl,
2036
- Xn as resolveWalletSession,
2037
- jn as retryOnError,
2038
- Kn as sameQuote,
2039
- Vn as subscribeProvider,
2040
- wn as switchProviderChain,
2041
- Zn as transactionProgressView,
2042
- bn as waitForProviderChain
1913
+ at as AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT,
1914
+ ot as AEGIS_SWAP_DEFAULT_RPC_URLS,
1915
+ On as AEGIS_SWAP_HOOK,
1916
+ it as AEGIS_SWAP_MAINNET_CHAIN,
1917
+ V as AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS,
1918
+ tt as AEGIS_SWAP_PERMIT2,
1919
+ ge as AEGIS_SWAP_ROUTER,
1920
+ x as AEGIS_SWAP_TOKENS,
1921
+ nt as AEGIS_SWAP_V4_QUOTER,
1922
+ Mn as AGGREGATED_SWAP_CURATED_TOKENS,
1923
+ j as AGGREGATED_SWAP_DEFAULT_TOKENS,
1924
+ ct as AGGREGATED_SWAP_DEFAULT_TOKEN_LIST,
1925
+ kn as AGGREGATED_SWAP_TOKEN_PRESETS,
1926
+ rt as AGGREGATED_SWAP_WOLFGAME_TOKENS,
1927
+ ut as AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
1928
+ Te as DEFAULT_PERMIT_EXPIRATION_SECONDS,
1929
+ dn as DirectPoolSwapPriceMovedError,
1930
+ ye as KyberSwapApiError,
1931
+ bn as KyberSwapPriceMovedError,
1932
+ Ge as MAX_UINT128,
1933
+ F as MAX_UINT160,
1934
+ Ie as MAX_UINT256,
1935
+ En as NATIVE_TOKEN_ADDRESS,
1936
+ $t as PERMIT2_FAR_FUTURE_EXPIRATION,
1937
+ Ce as SWAP_TX_DEADLINE_SECONDS,
1938
+ me as UNISWAP_V4_CONTRACTS_BY_CHAIN,
1939
+ Fn as aggregatedSwapErrorMessage,
1940
+ wn as approveDirectPoolSwapInput,
1941
+ ee as approveErc20Spender,
1942
+ zt as approveErc20ToPermit2,
1943
+ An as approveKyberSwapInput,
1944
+ Vt as approvePermit2ToRouter,
1945
+ M as assertUint128,
1946
+ Je as buildExactInSwapTransaction,
1947
+ Ze as buildExactOutSwapTransaction,
1948
+ Mt as buildKyberSwapRoute,
1949
+ Ht as buildSignedPermitBatch,
1950
+ ce as computePoolId,
1951
+ mt as createAegisSwapChainConfig,
1952
+ Rn as createAegisSwapChains,
1953
+ Dn as createAegisSwapMarketsFromPools,
1954
+ st as createAegisSwapPoolMarket,
1955
+ I as createAegisSwapUniswapV4Contracts,
1956
+ Gn as createSwapPublicClient,
1957
+ _e as ensureWalletChain,
1958
+ _t as errorMessage,
1959
+ yn as estimateSwapGasWithBuffer,
1960
+ qn as executeDirectPoolSwap,
1961
+ zn as executeKyberSwap,
1962
+ g as fetchAggregatedSwapQuote,
1963
+ fn as fetchDirectPoolSwapQuote,
1964
+ Un as fetchGlobalTokenMetadata,
1965
+ kt as fetchKyberSwapRoute,
1966
+ le as getExplorerUrl,
1967
+ Yt as getIchiIconGuess,
1968
+ Zt as getInjectedProvider,
1969
+ tn as getProviderAccount,
1970
+ L as getProviderChainId,
1971
+ Et as getZeroForOne,
1972
+ Vn as isBusy,
1973
+ Wn as isDocumentVisible,
1974
+ gt as isEip1193Provider,
1975
+ xe as isNativeToken,
1976
+ Se as isRetryableKyberSwapError,
1977
+ we as isUserRejectedError,
1978
+ U as normalizeAccount,
1979
+ en as normalizeWalletConnection,
1980
+ Tt as outputFeeForQuote,
1981
+ X as pollUntil,
1982
+ Ct as quoteSpendAmount,
1983
+ B as readErc20Allowance,
1984
+ ve as readPermit2RouterAllowance,
1985
+ It as reconcileSubmitQuote,
1986
+ nn as requestProviderAccount,
1987
+ Bn as resolveTokenIconUrl,
1988
+ $n as resolveWalletSession,
1989
+ Ln as retryOnError,
1990
+ Nn as sameQuote,
1991
+ Kn as subscribeProvider,
1992
+ ln as switchProviderChain,
1993
+ Hn as transactionProgressView,
1994
+ sn as waitForProviderChain
2043
1995
  };