@naviprotocol/lending 2.0.4 → 2.0.5-beta.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.
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
- import { Transaction as N } from "@mysten/sui/transactions";
1
+ import { Transaction as q } from "@mysten/sui/transactions";
2
2
  import { bcs as l } from "@mysten/sui/bcs";
3
- import { toHex as Me, fromHex as Ue, normalizeStructTag as K, SUI_CLOCK_OBJECT_ID as Z, fromBase64 as De } from "@mysten/sui/utils";
3
+ import { toHex as Ue, fromHex as Me, normalizeStructTag as Y, SUI_CLOCK_OBJECT_ID as x, fromBase64 as De } from "@mysten/sui/utils";
4
4
  import Fe from "lodash.camelcase";
5
5
  import p from "bignumber.js";
6
6
  import { SuiJsonRpcClient as Ne } from "@mysten/sui/jsonRpc";
7
7
  import { SuiGraphQLClient as Re } from "@mysten/sui/graphql";
8
- import { SuiGrpcClient as ye, GrpcWebFetchTransport as ge } from "@mysten/sui/grpc";
9
- const oe = l.bytes(32).transform({
8
+ import { SuiGrpcClient as he, GrpcWebFetchTransport as be } from "@mysten/sui/grpc";
9
+ const ie = l.bytes(32).transform({
10
10
  // To change the input type, you need to provide a type definition for the input
11
- input: (e) => Ue(e),
12
- output: (e) => Me(e)
11
+ input: (e) => Me(e),
12
+ output: (e) => Ue(e)
13
13
  }), qt = l.struct("IncentiveAPYInfo", {
14
14
  /** Asset identifier */
15
15
  asset_id: l.u8(),
@@ -19,9 +19,9 @@ const oe = l.bytes(32).transform({
19
19
  coin_types: l.vector(l.string())
20
20
  }), Le = l.struct("IncentivePoolInfo", {
21
21
  /** Unique pool identifier */
22
- pool_id: oe,
22
+ pool_id: ie,
23
23
  /** Address holding the incentive funds */
24
- funds: oe,
24
+ funds: ie,
25
25
  /** Current phase of the incentive program */
26
26
  phase: l.u64(),
27
27
  /** Timestamp when the incentive started */
@@ -129,9 +129,9 @@ const oe = l.bytes(32).transform({
129
129
  borrow_balance: l.u256(),
130
130
  /** User's current supply balance */
131
131
  supply_balance: l.u256()
132
- }), Ge = "2.0.4", E = {
132
+ }), Ge = "2.0.5-beta.1", V = {
133
133
  version: Ge
134
- }, We = E.version, He = () => {
134
+ }, We = V.version, He = () => {
135
135
  if (typeof process < "u" && process.versions && process.versions.node) {
136
136
  const e = process.version;
137
137
  return `Node.js ${e.startsWith("v") ? e.substring(1) : e}`;
@@ -140,7 +140,7 @@ const oe = l.bytes(32).transform({
140
140
  }, Je = () => {
141
141
  let e = "";
142
142
  return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${We} (${He()})`), e;
143
- }, ae = Je(), he = "0x2::sui::SUI";
143
+ }, ce = Je(), we = "0x2::sui::SUI";
144
144
  class Ke extends Error {
145
145
  constructor(t) {
146
146
  super(
@@ -148,7 +148,7 @@ class Ke extends Error {
148
148
  ), this.name = "NaviMissingGraphQLClientError";
149
149
  }
150
150
  }
151
- function X(e) {
151
+ function ee(e) {
152
152
  return e == null ? void 0 : String(e);
153
153
  }
154
154
  function Qe(e, t) {
@@ -157,48 +157,48 @@ function Qe(e, t) {
157
157
  function Ye(e, t) {
158
158
  return (BigInt(e) - BigInt(t)).toString();
159
159
  }
160
- function we(e) {
160
+ function ve(e) {
161
161
  const t = e.core;
162
162
  if (typeof t?.getBalance != "function" || typeof t?.listBalances != "function")
163
163
  throw new Error("NAVI Sui balance helpers require a v2 Core API client");
164
164
  return t;
165
165
  }
166
- function be(e, t = he) {
167
- const r = X(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
- let o = X(e.balance ?? e.totalBalance), n = X(e.coinBalance);
166
+ function Ce(e, t = we) {
167
+ const r = ee(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
+ let o = ee(e.balance ?? e.totalBalance), n = ee(e.coinBalance);
169
169
  return !n && o && (n = Ye(o, r)), !o && n && (o = Qe(n, r)), {
170
- coinType: K(e.coinType ?? t),
170
+ coinType: Y(e.coinType ?? t),
171
171
  totalBalance: o ?? "0",
172
172
  coinBalance: n ?? "0",
173
173
  addressBalance: r,
174
174
  ...e.coinObjectCount === null || e.coinObjectCount === void 0 ? {} : { coinObjectCount: e.coinObjectCount }
175
175
  };
176
176
  }
177
- function Ht(e, t = he) {
178
- const r = K(t);
179
- return e.filter((o) => K(o.coinType) === r).reduce((o, n) => o + BigInt(n.balance), 0n).toString();
177
+ function Ht(e, t = we) {
178
+ const r = Y(t);
179
+ return e.filter((o) => Y(o.coinType) === r).reduce((o, n) => o + BigInt(n.balance), 0n).toString();
180
180
  }
181
181
  async function Jt(e, t) {
182
- const r = await we(e).getBalance(t), o = r.balance;
183
- return be((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
182
+ const r = await ve(e).getBalance(t), o = r.balance;
183
+ return Ce((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
184
  }
185
185
  async function Kt(e, t) {
186
- const r = await we(e).listBalances(t), { balances: o = [] } = r;
186
+ const r = await ve(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => be(n)),
188
+ balances: o.map((n) => Ce(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
192
192
  function Ze(e, t) {
193
193
  if ("client" in t)
194
194
  return t.client;
195
- const r = new ge({
195
+ const r = new be({
196
196
  baseUrl: t.url,
197
197
  meta: t.headers,
198
198
  fetchInit: t.fetchInit,
199
199
  fetch: t.fetch
200
200
  });
201
- return new ye({
201
+ return new he({
202
202
  network: e,
203
203
  transport: r
204
204
  });
@@ -211,7 +211,7 @@ function Xe(e, t) {
211
211
  fetch: t.fetch
212
212
  });
213
213
  }
214
- function ve(e, t) {
214
+ function ke(e, t) {
215
215
  return "client" in t ? t.client : new Ne({
216
216
  network: e,
217
217
  url: t.url
@@ -224,7 +224,7 @@ function xe(e) {
224
224
  coreClient: t,
225
225
  grpc: t,
226
226
  graphql: e.graphql ? Xe(e.network, e.graphql) : void 0,
227
- legacyJsonRpc: e.legacyJsonRpc ? ve(e.network, e.legacyJsonRpc) : void 0,
227
+ legacyJsonRpc: e.legacyJsonRpc ? ke(e.network, e.legacyJsonRpc) : void 0,
228
228
  services: e.services
229
229
  };
230
230
  }
@@ -234,22 +234,22 @@ function Qt(e, t) {
234
234
  return e.graphql;
235
235
  }
236
236
  const et = "https://fullnode.mainnet.sui.io:443";
237
- let x;
237
+ let te;
238
238
  function tt() {
239
- return x || (x = new ye({
239
+ return te || (te = new he({
240
240
  network: "mainnet",
241
- transport: new ge({ baseUrl: et })
242
- })), x;
241
+ transport: new be({ baseUrl: et })
242
+ })), te;
243
243
  }
244
244
  function rt(e, t = "mainnet") {
245
- return e ? typeof e == "string" ? ve(t, { url: e }) : xe(e) : tt();
245
+ return e ? typeof e == "string" ? ke(t, { url: e }) : xe(e) : tt();
246
246
  }
247
247
  const nt = 16 * 1024;
248
- function re(e) {
248
+ function oe(e) {
249
249
  return e.replace(/^0x/i, "");
250
250
  }
251
- function ie(e) {
252
- const t = re(e), r = new Uint8Array(t.length / 2);
251
+ function se(e) {
252
+ const t = oe(e), r = new Uint8Array(t.length / 2);
253
253
  for (let o = 0; o < r.length; o += 1)
254
254
  r[o] = parseInt(t.slice(o * 2, o * 2 + 2), 16);
255
255
  return r;
@@ -257,12 +257,12 @@ function ie(e) {
257
257
  function ot(e, t) {
258
258
  return (e[t] << 8) + e[t + 1];
259
259
  }
260
- function ce(e) {
260
+ function ue(e) {
261
261
  return l.vector(l.U8).serialize(Array.from(e), {
262
262
  maxSize: nt
263
263
  });
264
264
  }
265
- function se(e, t) {
265
+ function le(e, t) {
266
266
  return {
267
267
  type: e,
268
268
  bcs: t
@@ -299,7 +299,7 @@ function st(e) {
299
299
  function ut(e) {
300
300
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
301
301
  }
302
- class Ce {
302
+ class Ie {
303
303
  constructor(t, r) {
304
304
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
305
305
  }
@@ -334,7 +334,7 @@ class Ce {
334
334
  for (const [i, s] of Object.entries(o ?? {}))
335
335
  c.searchParams.set(i, s);
336
336
  for (const i of r)
337
- c.searchParams.append("ids[]", re(i));
337
+ c.searchParams.append("ids[]", oe(i));
338
338
  try {
339
339
  const i = await fetch(c, {
340
340
  signal: n.signal
@@ -445,8 +445,8 @@ class lt {
445
445
  target: `${o}::vaa::parse_and_verify`,
446
446
  arguments: [
447
447
  r.object(this.wormholeStateId),
448
- r.pure(ce(n)),
449
- r.object(Z)
448
+ r.pure(ue(n)),
449
+ r.object(x)
450
450
  ]
451
451
  });
452
452
  return a;
@@ -461,9 +461,9 @@ class lt {
461
461
  target: `${o}::pyth::create_authenticated_price_infos_using_accumulator`,
462
462
  arguments: [
463
463
  t.object(this.pythStateId),
464
- t.pure(ce(r[0])),
464
+ t.pure(ue(r[0])),
465
465
  a,
466
- t.object(Z)
466
+ t.object(x)
467
467
  ]
468
468
  });
469
469
  return c;
@@ -481,7 +481,7 @@ class lt {
481
481
  n,
482
482
  t.object(u),
483
483
  a[i],
484
- t.object(Z)
484
+ t.object(x)
485
485
  ]
486
486
  });
487
487
  }
@@ -498,13 +498,13 @@ class lt {
498
498
  return this.pythPackageId || (this.pythPackageId = await this.getPackageId(this.pythStateId)), this.pythPackageId;
499
499
  }
500
500
  async getPriceFeedObjectId(t) {
501
- const r = re(t);
501
+ const r = oe(t);
502
502
  if (!this.priceFeedObjectIdCache.has(r)) {
503
503
  const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = `${n}::price_identifier::PriceIdentifier`, c = this.getCoreProvider();
504
504
  if (c) {
505
505
  const { dynamicField: i } = await c.getDynamicField({
506
506
  parentId: o,
507
- name: se(a, it(ie(r)))
507
+ name: le(a, it(se(r)))
508
508
  }), s = i?.value?.bcs;
509
509
  this.priceFeedObjectIdCache.set(
510
510
  r,
@@ -514,7 +514,7 @@ class lt {
514
514
  const i = await this.getDynamicMoveObjectJson(o, {
515
515
  type: a,
516
516
  value: {
517
- bytes: Array.from(ie(r))
517
+ bytes: Array.from(se(r))
518
518
  }
519
519
  });
520
520
  i?.fields ? this.priceFeedObjectIdCache.set(r, i.fields.value) : this.priceFeedObjectIdCache.set(r, void 0);
@@ -524,7 +524,7 @@ class lt {
524
524
  }
525
525
  async getPriceTableInfo() {
526
526
  if (!this.priceTableInfo) {
527
- const t = this.getCoreProvider() ? se("vector<u8>", at("price_info")) : {
527
+ const t = this.getCoreProvider() ? le("vector<u8>", at("price_info")) : {
528
528
  type: "vector<u8>",
529
529
  value: "price_info"
530
530
  }, r = await this.getDynamicMoveObjectJson(this.pythStateId, t);
@@ -543,32 +543,32 @@ class lt {
543
543
  }
544
544
  }
545
545
  const dt = "https://open-api.naviprotocol.io/api";
546
- let J = {}, je = 0;
546
+ let Q = {}, je = 0;
547
547
  function pt(e) {
548
548
  return e.replace(/\/+$/, "");
549
549
  }
550
550
  function Yt(e) {
551
- J = {
552
- ...J,
551
+ Q = {
552
+ ...Q,
553
553
  ...e,
554
554
  services: {
555
- ...J.services,
555
+ ...Q.services,
556
556
  ...e.services
557
557
  }
558
558
  }, je += 1;
559
559
  }
560
- function ue() {
560
+ function de() {
561
561
  return je;
562
562
  }
563
- function O(e) {
564
- const t = e?.services?.naviOpenApi ?? J.services?.naviOpenApi;
563
+ function U(e) {
564
+ const t = e?.services?.naviOpenApi ?? Q.services?.naviOpenApi;
565
565
  return {
566
566
  baseUrl: pt(t?.baseUrl ?? dt),
567
567
  headers: t?.headers
568
568
  };
569
569
  }
570
- function M(e, t) {
571
- const r = O(t), o = e.startsWith("/") ? e : `/${e}`;
570
+ function F(e, t) {
571
+ const r = U(t), o = e.startsWith("/") ? e : `/${e}`;
572
572
  return `${r.baseUrl}${o}`;
573
573
  }
574
574
  function mt(e) {
@@ -580,14 +580,14 @@ function mt(e) {
580
580
  }
581
581
  return Array.isArray(e) ? Object.fromEntries(e) : e;
582
582
  }
583
- function U(e, t) {
583
+ function N(e, t) {
584
584
  return {
585
585
  ...mt(e),
586
586
  ...t?.headers ?? {}
587
587
  };
588
588
  }
589
- const V = rt();
590
- function le(e) {
589
+ const M = rt();
590
+ function pe(e) {
591
591
  return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(De(e)) : [];
592
592
  }
593
593
  function ft(e) {
@@ -597,21 +597,21 @@ function ft(e) {
597
597
  events: r.events,
598
598
  error: o,
599
599
  results: t.map((n) => ({
600
- returnValues: (n.returnValues ?? []).map((a) => [le(a.bcs), ""]),
600
+ returnValues: (n.returnValues ?? []).map((a) => [pe(a.bcs), ""]),
601
601
  mutableReferenceOutputs: (n.mutatedReferences ?? []).map((a) => [
602
602
  "",
603
- le(a.bcs),
603
+ pe(a.bcs),
604
604
  ""
605
605
  ])
606
606
  }))
607
607
  };
608
608
  }
609
- async function q(e, t) {
609
+ async function W(e, t) {
610
610
  const r = e?.core;
611
611
  if (typeof r?.simulateTransaction != "function")
612
612
  throw new Error("devInspectTransaction requires a Sui v2 Core-capable client");
613
613
  const o = t.transaction ?? t.transactionBlock;
614
- o instanceof N && o.setSenderIfNotSet(t.sender);
614
+ o instanceof q && o.setSenderIfNotSet(t.sender);
615
615
  const n = await r.simulateTransaction({
616
616
  transaction: o,
617
617
  checksEnabled: !1,
@@ -623,7 +623,7 @@ async function q(e, t) {
623
623
  });
624
624
  return ft(n);
625
625
  }
626
- function ke(e) {
626
+ function _e(e) {
627
627
  return {
628
628
  json: !!e?.showContent,
629
629
  display: !!e?.showDisplay,
@@ -631,7 +631,7 @@ function ke(e) {
631
631
  objectBcs: !!e?.showBcs
632
632
  };
633
633
  }
634
- function Ie(e) {
634
+ function Te(e) {
635
635
  return !e || e instanceof Error ? {
636
636
  error: e instanceof Error ? { code: "notFound", error: e.message } : void 0
637
637
  } : {
@@ -657,9 +657,9 @@ async function yt(e, t) {
657
657
  throw new Error("getSuiObject requires a Sui v2 Core-capable client");
658
658
  const { object: o } = await r.getObject({
659
659
  objectId: t.id,
660
- include: ke(t.options)
660
+ include: _e(t.options)
661
661
  });
662
- return Ie(o);
662
+ return Te(o);
663
663
  }
664
664
  async function gt(e, t) {
665
665
  const r = e?.core;
@@ -667,48 +667,48 @@ async function gt(e, t) {
667
667
  throw new Error("multiGetSuiObjects requires a Sui v2 Core-capable client");
668
668
  const { objects: o } = await r.getObjects({
669
669
  objectIds: t.ids,
670
- include: ke(t.options)
670
+ include: _e(t.options)
671
671
  });
672
- return o.map(Ie);
672
+ return o.map(Te);
673
673
  }
674
- function _e(e) {
674
+ function Be(e) {
675
675
  const t = [];
676
676
  let r = !1;
677
677
  return e.forEach((o, n) => {
678
678
  const a = n === e.length - 1;
679
679
  if (typeof o == "object" && o !== null && a) {
680
680
  const { client: c, disableCache: i, cacheTime: s, ...u } = o;
681
- u.__naviSdkServiceConfigVersion = ue(), t.push(u), r = !0;
681
+ u.__naviSdkServiceConfigVersion = de(), t.push(u), r = !0;
682
682
  } else
683
683
  t.push(o);
684
684
  }), r || t.push({
685
- __naviSdkServiceConfigVersion: ue()
685
+ __naviSdkServiceConfigVersion: de()
686
686
  }), JSON.stringify(t);
687
687
  }
688
688
  function A(e) {
689
689
  const t = {};
690
690
  return (...r) => {
691
- const o = _e(r);
691
+ const o = Be(r);
692
692
  return t[o] || (t[o] = e(...r).finally(() => {
693
693
  delete t[o];
694
694
  })), t[o];
695
695
  };
696
696
  }
697
- function $(e) {
697
+ function O(e) {
698
698
  let t = {};
699
699
  return (...r) => {
700
- const o = r[r.length - 1], n = _e(r), a = t[n];
700
+ const o = r[r.length - 1], n = Be(r), a = t[n];
701
701
  return !o?.disableCache && typeof a?.data < "u" && (typeof o?.cacheTime > "u" || o.cacheTime > Date.now() - a.cacheAt) ? Promise.resolve(a.data) : e(...r).then((c) => (t[n] = {
702
702
  data: c,
703
703
  cacheAt: Date.now()
704
704
  }, c));
705
705
  };
706
706
  }
707
- function ee(e) {
708
- return Array.isArray(e) ? e.map((t) => ee(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
707
+ function re(e) {
708
+ return Array.isArray(e) ? e.map((t) => re(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
709
709
  (t, r) => ({
710
710
  ...t,
711
- [Fe(r)]: ee(e[r])
711
+ [Fe(r)]: re(e[r])
712
712
  }),
713
713
  {}
714
714
  ) : e;
@@ -721,7 +721,7 @@ function h(e, t) {
721
721
  function ht(e, t) {
722
722
  return typeof t == "string" ? e.object(t) : typeof t == "object" && t.$kind ? t : e.object(t.contract.pool);
723
723
  }
724
- function Q(e, t, r) {
724
+ function Z(e, t, r) {
725
725
  if (e.results && e.results.length > 0) {
726
726
  if (e.results[0].returnValues && e.results[0].returnValues.length > 0)
727
727
  return e.results[0].returnValues.map((o, n) => (t[n] || t[0]).parse(Uint8Array.from(o[0])));
@@ -730,35 +730,35 @@ function Q(e, t, r) {
730
730
  return [];
731
731
  }
732
732
  function C(e) {
733
- return K(e);
733
+ return Y(e);
734
734
  }
735
- function Te(e) {
735
+ function Pe(e) {
736
736
  const t = (e || 0) / Math.pow(10, 27);
737
737
  return t > Math.pow(10, 5) ? 1 / 0 : t;
738
738
  }
739
- new Ce("https://hermes.pyth.network", {
739
+ new Ie("https://hermes.pyth.network", {
740
740
  timeout: 2e4
741
741
  });
742
- const wt = 27, de = (e, t) => {
742
+ const bt = 27, me = (e, t) => {
743
743
  if (!Number(e) || !Number(t)) return new p(0);
744
- const r = new p(1).shiftedBy(1 * wt), o = r.multipliedBy(new p(0.5));
744
+ const r = new p(1).shiftedBy(1 * bt), o = r.multipliedBy(new p(0.5));
745
745
  return new p(e).multipliedBy(new p(t)).plus(o).dividedBy(r).integerValue(p.ROUND_DOWN);
746
- }, D = ae ? {
747
- "User-Agent": ae
746
+ }, R = ce ? {
747
+ "User-Agent": ce
748
748
  } : {};
749
- function te(e, t = "uniqueId") {
749
+ function ne(e, t = "uniqueId") {
750
750
  return e.reduce(
751
751
  (r, o) => (r[o[t]] = o, r),
752
752
  {}
753
753
  );
754
754
  }
755
- function pe(e, t = "uniqueId") {
755
+ function fe(e, t = "uniqueId") {
756
756
  return e.reduce(
757
757
  (r, o) => (r[o[t]] = o, r),
758
758
  {}
759
759
  );
760
760
  }
761
- function H(e, t) {
761
+ function K(e, t) {
762
762
  const r = e.emodes.find((n) => n.emodeId === t.emodeId);
763
763
  if (!r)
764
764
  throw new Error("EMode not found in pool");
@@ -772,52 +772,52 @@ function H(e, t) {
772
772
  isEMode: !0
773
773
  };
774
774
  }
775
- function bt(e) {
775
+ function wt(e) {
776
776
  const [t, r] = e.split("-");
777
777
  return !t || !r ? null : {
778
778
  marketKey: t,
779
779
  poolId: parseInt(r)
780
780
  };
781
781
  }
782
- function P() {
782
+ function S() {
783
783
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
784
784
  }
785
- var z = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(z || {});
786
- const G = $(
785
+ var H = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(H || {});
786
+ const J = O(
787
787
  A(
788
788
  async (e) => {
789
- const t = (e?.markets || [F.main]).map((a) => _(a)), r = O(e), o = M(
790
- `/navi/pools?env=${e?.env || "prod"}&sdk=${E.version}&market=${t.map(
789
+ const t = (e?.markets || [L.main]).map((a) => P(a)), r = U(e), o = F(
790
+ `/navi/pools?env=${e?.env || "prod"}&sdk=${V.version}&market=${t.map(
791
791
  (a) => a.key
792
792
  )}`,
793
793
  e
794
- ), n = await fetch(o, { headers: U(D, r) }).then(
794
+ ), n = await fetch(o, { headers: N(R, r) }).then(
795
795
  (a) => a.json()
796
796
  );
797
797
  return n.data.forEach((a) => {
798
- const i = n.meta.emodes.filter((b) => {
799
- const k = _(b.marketId);
800
- return a.market === k.key && b.isActive;
801
- }).filter((b) => !!b.assets.find((k) => k.assetId === a.id));
798
+ const i = n.meta.emodes.filter((w) => {
799
+ const k = P(w.marketId);
800
+ return a.market === k.key && w.isActive;
801
+ }).filter((w) => !!w.assets.find((k) => k.assetId === a.id));
802
802
  a.emodes = i;
803
- const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), u = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(), w = p(u).multipliedBy(a.oracle.price).toString(), y = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), g = p.max(
803
+ const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), u = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(), b = p(u).multipliedBy(a.oracle.price).toString(), g = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), y = p.max(
804
804
  p(a.borrowedAmount),
805
805
  p(a.validBorrowAmount)
806
- ).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), d = p(y).multipliedBy(a.oracle.price).toString(), f = p(g).multipliedBy(a.oracle.price).toString();
807
- a.poolSupplyAmount = s, a.poolBorrowAmount = u, a.poolSupplyValue = m, a.poolBorrowValue = w, a.poolSupplyCapAmount = y, a.poolBorrowCapAmount = g, a.poolSupplyCapValue = d, a.poolBorrowCapValue = f;
806
+ ).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), d = p(g).multipliedBy(a.oracle.price).toString(), f = p(y).multipliedBy(a.oracle.price).toString();
807
+ a.poolSupplyAmount = s, a.poolBorrowAmount = u, a.poolSupplyValue = m, a.poolBorrowValue = b, a.poolSupplyCapAmount = g, a.poolBorrowCapAmount = y, a.poolSupplyCapValue = d, a.poolBorrowCapValue = f;
808
808
  }), n.data;
809
809
  }
810
810
  )
811
811
  );
812
- async function S(e, t) {
812
+ async function E(e, t) {
813
813
  let r = t?.market;
814
814
  if (typeof e == "string") {
815
- const a = bt(e);
815
+ const a = wt(e);
816
816
  a && (r = a.marketKey, e = a.poolId);
817
817
  }
818
- const o = await G({
818
+ const o = await J({
819
819
  ...t,
820
- markets: [r || R],
820
+ markets: [r || z],
821
821
  cacheTime: v
822
822
  });
823
823
  if (typeof e == "object")
@@ -827,28 +827,28 @@ async function S(e, t) {
827
827
  throw new Error("Pool not found");
828
828
  return n.isDeprecated && console.log(`The lending pool for coinType ${n.suiCoinType} is going to be deprecated.`), n;
829
829
  }
830
- const Zt = $(
830
+ const Zt = O(
831
831
  A(async (e) => {
832
- const t = O(e), r = M(`/navi/stats?sdk=${E.version}`, e);
832
+ const t = U(e), r = F(`/navi/stats?sdk=${V.version}`, e);
833
833
  return (await fetch(r, {
834
- headers: U(D, t)
834
+ headers: N(R, t)
835
835
  }).then((n) => n.json())).data;
836
836
  })
837
- ), Xt = $(
837
+ ), Xt = O(
838
838
  A(
839
839
  async (e) => {
840
- const t = O(e), r = M(`/navi/fee?sdk=${E.version}`, e);
840
+ const t = U(e), r = F(`/navi/fee?sdk=${V.version}`, e);
841
841
  return await fetch(r, {
842
- headers: U(D, t)
842
+ headers: N(R, t)
843
843
  }).then((n) => n.json());
844
844
  }
845
845
  )
846
846
  );
847
847
  async function vt(e, t, r, o) {
848
- const n = await j({
848
+ const n = await I({
849
849
  ...o,
850
850
  cacheTime: v
851
- }), a = await S(t, o), c = o?.market || R, i = o?.env || "prod";
851
+ }), a = await E(t, o), c = o?.market || z, i = o?.env || "prod";
852
852
  if (a?.deprecatedAt && Date.now() > a.deprecatedAt)
853
853
  throw new Error(`The lending pool for coinType ${a.suiCoinType} has been deprecated.`);
854
854
  if (C(a.suiCoinType) === C("0x2::sui::SUI") && typeof r == "object" && r?.$kind === "GasCoin") {
@@ -893,10 +893,10 @@ async function vt(e, t, r, o) {
893
893
  }), e;
894
894
  }
895
895
  async function xt(e, t, r, o) {
896
- const n = await j({
896
+ const n = await I({
897
897
  ...o,
898
898
  cacheTime: v
899
- }), a = await S(t, o), c = h(r, e.pure.u64);
899
+ }), a = await E(t, o), c = h(r, e.pure.u64);
900
900
  let i;
901
901
  if (n.version === 1)
902
902
  if (o?.accountCap) {
@@ -976,10 +976,10 @@ async function xt(e, t, r, o) {
976
976
  });
977
977
  }
978
978
  async function er(e, t, r, o) {
979
- const n = await j({
979
+ const n = await I({
980
980
  ...o,
981
981
  cacheTime: v
982
- }), a = await S(t, o);
982
+ }), a = await E(t, o);
983
983
  if (a?.deprecatedAt && Date.now() > a.deprecatedAt)
984
984
  throw new Error(`The lending pool for coinType ${a.suiCoinType} has been deprecated.`);
985
985
  const c = h(r, e.pure.u64);
@@ -1062,10 +1062,10 @@ async function er(e, t, r, o) {
1062
1062
  });
1063
1063
  }
1064
1064
  async function tr(e, t, r, o) {
1065
- const n = await j({
1065
+ const n = await I({
1066
1066
  ...o,
1067
1067
  cacheTime: v
1068
- }), a = await S(t, o);
1068
+ }), a = await E(t, o);
1069
1069
  if (C(a.suiCoinType) === C("0x2::sui::SUI") && typeof r == "object" && r?.$kind === "GasCoin") {
1070
1070
  if (!o?.amount)
1071
1071
  throw new Error("Amount is required for sui coin");
@@ -1114,15 +1114,15 @@ async function tr(e, t, r, o) {
1114
1114
  typeArguments: [a.suiCoinType]
1115
1115
  }), e;
1116
1116
  }
1117
- const rr = $(
1117
+ const rr = O(
1118
1118
  A(
1119
1119
  async (e) => {
1120
- const t = await j({
1120
+ const t = await I({
1121
1121
  ...e
1122
- }), r = e?.client ?? V;
1122
+ }), r = e?.client ?? M;
1123
1123
  if (e?.address && typeof e?.asset < "u")
1124
1124
  try {
1125
- const a = await S(e.asset, e), c = new N();
1125
+ const a = await E(e.asset, e), c = new q();
1126
1126
  c.moveCall({
1127
1127
  target: `${t.package}::incentive_v3::get_borrow_fee_v2`,
1128
1128
  arguments: [
@@ -1133,10 +1133,10 @@ const rr = $(
1133
1133
  ],
1134
1134
  typeArguments: []
1135
1135
  });
1136
- const i = await q(r, {
1136
+ const i = await W(r, {
1137
1137
  transactionBlock: c,
1138
1138
  sender: e.address
1139
- }), s = Q(i, [l.u64()]);
1139
+ }), s = Z(i, [l.u64()]);
1140
1140
  return (Number(s[0]) || 0) / 100;
1141
1141
  } catch (a) {
1142
1142
  console.error(
@@ -1151,7 +1151,7 @@ const rr = $(
1151
1151
  return Number(n) / 100;
1152
1152
  }
1153
1153
  )
1154
- ), R = "main", F = {
1154
+ ), z = "main", L = {
1155
1155
  main: {
1156
1156
  id: 0,
1157
1157
  key: "main",
@@ -1171,6 +1171,36 @@ const rr = $(
1171
1171
  id: 3,
1172
1172
  key: "sui-eco",
1173
1173
  name: "Sui Eco Market"
1174
+ },
1175
+ "sui-usdc": {
1176
+ id: 4,
1177
+ key: "sui-usdc",
1178
+ name: "SUI/USDC Market"
1179
+ },
1180
+ "wbtc-usdc": {
1181
+ id: 5,
1182
+ key: "wbtc-usdc",
1183
+ name: "WBTC/USDC Market"
1184
+ },
1185
+ "xbtc-usdc": {
1186
+ id: 6,
1187
+ key: "xbtc-usdc",
1188
+ name: "xBTC/USDC Market"
1189
+ },
1190
+ "vsui-usdc": {
1191
+ id: 7,
1192
+ key: "vsui-usdc",
1193
+ name: "vSUI/USDC Market"
1194
+ },
1195
+ "vsui-sui": {
1196
+ id: 8,
1197
+ key: "vsui-sui",
1198
+ name: "vSUI/SUI Market"
1199
+ },
1200
+ "hasui-sui": {
1201
+ id: 9,
1202
+ key: "hasui-sui",
1203
+ name: "hasSUI/SUI Market"
1174
1204
  }
1175
1205
  };
1176
1206
  class Ct {
@@ -1178,13 +1208,13 @@ class Ct {
1178
1208
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1179
1209
  marketTotalSupplyValue: "0",
1180
1210
  marketTotalBorrowValue: "0"
1181
- }, this.config = _(t), this.initPools(r);
1211
+ }, this.config = P(t), this.initPools(r);
1182
1212
  }
1183
1213
  get overview() {
1184
1214
  return this._overview;
1185
1215
  }
1186
1216
  initPools(t) {
1187
- const r = te(this.pools), o = pe(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1217
+ const r = ne(this.pools), o = fe(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1188
1218
  let c = p(0), i = p(0);
1189
1219
  t.forEach((s) => {
1190
1220
  if (!this.checkMarket(s.market)) {
@@ -1192,13 +1222,13 @@ class Ct {
1192
1222
  return;
1193
1223
  }
1194
1224
  r[s.uniqueId] || this.pools.push(s), s?.emodes?.forEach((m) => {
1195
- o[m.uniqueId] || this.emodes.push(m), m.assets.forEach((w) => {
1196
- w.isDebt && m.assets.find(
1197
- (g) => g.isCollateral && g.ltv > 0 && g.assetId !== s.id
1198
- ) && n.add(s.uniqueId), w.isCollateral && m.assets.find((g) => g.isDebt && g.assetId !== s.id) && a.add(s.uniqueId);
1225
+ o[m.uniqueId] || this.emodes.push(m), m.assets.forEach((b) => {
1226
+ b.isDebt && m.assets.find(
1227
+ (y) => y.isCollateral && y.ltv > 0 && y.assetId !== s.id
1228
+ ) && n.add(s.uniqueId), b.isCollateral && m.assets.find((y) => y.isDebt && y.assetId !== s.id) && a.add(s.uniqueId);
1199
1229
  });
1200
1230
  }), i = i.plus(s.poolBorrowValue), c = c.plus(s.poolSupplyValue);
1201
- }), this.poolMap = te(this.pools, "id"), this.emodeMap = pe(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1231
+ }), this.poolMap = ne(this.pools, "id"), this.emodeMap = fe(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1202
1232
  const u = this.getEModePools(s.emodeId);
1203
1233
  this.emodePools.push(...u);
1204
1234
  }), this._overview = {
@@ -1236,44 +1266,44 @@ class Ct {
1236
1266
  return typeof t == "number" && t === this.config.id && (r = !0), typeof t == "string" && t === this.config.key && (r = !0), typeof t == "object" && t.id === this.config.id && (r = !0), r;
1237
1267
  }
1238
1268
  }
1239
- const _ = (e) => {
1240
- const r = Object.values(F).find((o) => typeof e == "number" ? o.id === e : typeof e == "string" ? o.key === e : o.id === e.id);
1269
+ const P = (e) => {
1270
+ const r = Object.values(L).find((o) => typeof e == "number" ? o.id === e : typeof e == "string" ? o.key === e : o.id === e.id);
1241
1271
  if (!r)
1242
1272
  throw new Error("Market not found");
1243
1273
  return r;
1244
- }, jt = $(
1274
+ }, kt = O(
1245
1275
  A(
1246
1276
  async (e, t) => {
1247
- const r = await G({
1277
+ const r = await J({
1248
1278
  cacheTime: 6e4,
1249
1279
  ...t,
1250
1280
  markets: e
1251
1281
  });
1252
1282
  return e.map((o) => {
1253
- const n = _(o), a = r.filter((c) => c.market === n.key);
1283
+ const n = P(o), a = r.filter((c) => c.market === n.key);
1254
1284
  return new Ct(o, a);
1255
1285
  });
1256
1286
  }
1257
1287
  )
1258
- ), nr = $(
1288
+ ), nr = O(
1259
1289
  A(
1260
- async (e, t) => (await jt([e], t))[0]
1290
+ async (e, t) => (await kt([e], t))[0]
1261
1291
  )
1262
- ), j = $(
1292
+ ), I = O(
1263
1293
  A(
1264
1294
  async (e) => {
1265
- const t = _(e?.market || R), r = O(e), o = M(
1266
- `/navi/config?env=${e?.env || "prod"}&sdk=${E.version}&market=${t.key}`,
1295
+ const t = P(e?.market || z), r = U(e), o = F(
1296
+ `/navi/config?env=${e?.env || "prod"}&sdk=${V.version}&market=${t.key}`,
1267
1297
  e
1268
1298
  );
1269
1299
  return (await fetch(o, {
1270
- headers: U(D, r)
1300
+ headers: N(R, r)
1271
1301
  }).then((a) => a.json())).data;
1272
1302
  }
1273
1303
  )
1274
1304
  ), v = 1e3 * 60 * 5;
1275
- async function kt(e, t) {
1276
- const r = await j({
1305
+ async function It(e, t) {
1306
+ const r = await I({
1277
1307
  cacheTime: v,
1278
1308
  ...t
1279
1309
  });
@@ -1282,8 +1312,8 @@ async function kt(e, t) {
1282
1312
  arguments: []
1283
1313
  });
1284
1314
  }
1285
- async function It(e, t, r) {
1286
- const o = await j({
1315
+ async function jt(e, t, r) {
1316
+ const o = await I({
1287
1317
  cacheTime: v,
1288
1318
  ...r
1289
1319
  });
@@ -1293,7 +1323,7 @@ async function It(e, t, r) {
1293
1323
  });
1294
1324
  }
1295
1325
  async function _t(e, t, r) {
1296
- const o = await j({
1326
+ const o = await I({
1297
1327
  ...r,
1298
1328
  cacheTime: v
1299
1329
  });
@@ -1310,7 +1340,7 @@ async function _t(e, t, r) {
1310
1340
  }), e;
1311
1341
  }
1312
1342
  async function or(e, t) {
1313
- const r = await j({
1343
+ const r = await I({
1314
1344
  ...t,
1315
1345
  cacheTime: v
1316
1346
  });
@@ -1323,15 +1353,15 @@ async function or(e, t) {
1323
1353
  }), e;
1324
1354
  }
1325
1355
  async function ar(e, t, r) {
1326
- const o = await j({
1356
+ const o = await I({
1327
1357
  cacheTime: v,
1328
1358
  ...r
1329
- }), n = await kt(e, r);
1359
+ }), n = await It(e, r);
1330
1360
  await _t(e, t, {
1331
1361
  ...r,
1332
1362
  accountCap: n
1333
1363
  });
1334
- const a = await _(r?.market || R), c = await It(e, n, r);
1364
+ const a = await P(r?.market || z), c = await jt(e, n, r);
1335
1365
  return e.moveCall({
1336
1366
  target: `${o.emode.contract.registryPackage}::registry::register_emode_for_account_cap`,
1337
1367
  arguments: [
@@ -1342,36 +1372,36 @@ async function ar(e, t, r) {
1342
1372
  ]
1343
1373
  }), n;
1344
1374
  }
1345
- const Be = $(
1375
+ const Se = O(
1346
1376
  A(
1347
1377
  async (e, t) => {
1348
- const r = await j({
1378
+ const r = await I({
1349
1379
  cacheTime: v,
1350
1380
  ...t
1351
- }), o = new N(), n = t?.client ?? V;
1381
+ }), o = new q(), n = t?.client ?? M;
1352
1382
  o.moveCall({
1353
1383
  target: `${r.emode.contract.registryPackage}::registry::find_user_emode_account_caps`,
1354
1384
  arguments: [o.object(r.emode.contract.registryObject), o.pure.address(e)]
1355
1385
  });
1356
- const c = (await q(n, {
1386
+ const c = (await W(n, {
1357
1387
  transactionBlock: o,
1358
1388
  sender: e
1359
1389
  })).results[0].returnValues, i = l.vector(l.u64()).parse(Uint8Array.from(c[0][0])), s = l.vector(l.u64()).parse(Uint8Array.from(c[1][0])), u = l.vector(l.Address).parse(Uint8Array.from(c[2][0]));
1360
- return i.map((m, w) => ({
1390
+ return i.map((m, b) => ({
1361
1391
  marketId: Number(m),
1362
- emodeId: Number(s[w]),
1363
- accountCap: u[w].toString()
1392
+ emodeId: Number(s[b]),
1393
+ accountCap: u[b].toString()
1364
1394
  }));
1365
1395
  }
1366
1396
  )
1367
1397
  );
1368
1398
  function ir(e) {
1369
- return `${_(e.marketId).key}-${e.emodeId}`;
1399
+ return `${P(e.marketId).key}-${e.emodeId}`;
1370
1400
  }
1371
1401
  function Tt(e, t) {
1372
1402
  return e.coinType ? e.coinType : t || (typeof e.type == "string" ? e.type.match(/::coin::Coin<(.+)>$/) : null)?.[1];
1373
1403
  }
1374
- function me(e, t) {
1404
+ function ye(e, t) {
1375
1405
  const r = Tt(e, t), o = e.coinObjectId ?? e.objectId;
1376
1406
  return !r || !o || e.balance === void 0 || e.balance === null ? null : {
1377
1407
  ...e,
@@ -1380,29 +1410,55 @@ function me(e, t) {
1380
1410
  };
1381
1411
  }
1382
1412
  function cr(e, t, r) {
1383
- const o = typeof r?.balance == "number", n = o ? r.balance : 0;
1384
- let a = 0;
1385
- const c = [];
1386
- let i = "";
1387
- if (t.sort((s, u) => Number(u.balance) - Number(s.balance)).forEach((s) => {
1388
- if (!(o && a >= n) && Number(s.balance) !== 0) {
1389
- if (i || (i = s.coinType), i !== s.coinType)
1413
+ const o = typeof r?.balance == "number", n = o ? r.balance : 0, a = BigInt(r?.addressBalance ?? 0);
1414
+ let c = 0;
1415
+ const i = [];
1416
+ let s = "", u = 0n;
1417
+ t.sort((B, X) => Number(X.balance) - Number(B.balance)).forEach((B) => {
1418
+ if (u += BigInt(B.balance), !(o && c >= n) && Number(B.balance) !== 0) {
1419
+ if (s || (s = B.coinType), s !== B.coinType)
1390
1420
  throw new Error("All coins must be of the same type");
1391
- a += Number(s.balance), c.push(s.coinObjectId);
1421
+ c += Number(B.balance), i.push(B.coinObjectId);
1422
+ }
1423
+ });
1424
+ const m = r?.coinType, y = ((B) => {
1425
+ if (!B)
1426
+ return !1;
1427
+ try {
1428
+ return C(B) === C("0x2::sui::SUI");
1429
+ } catch {
1430
+ return !1;
1392
1431
  }
1393
- }), c.length === 0)
1432
+ })(s || m || "") && !!r?.useGasCoin, d = BigInt(n), f = !y && !!m, w = f ? a : 0n, k = u + w, _ = !o || u >= d ? 0n : d - u, j = f && _ > 0n && w >= _;
1433
+ if (o && k < d)
1434
+ throw new Error(`Balance is less than the specified balance: ${k} < ${d}`);
1435
+ if (i.length === 0 && !j)
1394
1436
  throw new Error("No coins to merge");
1395
- if (o && a < n)
1396
- throw new Error(
1397
- `Balance is less than the specified balance: ${a} < ${n}`
1398
- );
1399
- return C(i) === C("0x2::sui::SUI") && r?.useGasCoin ? o ? e.splitCoins(e.gas, [e.pure.u64(n)]) : e.gas : (c.length === 1 ? e.object(c[0]) : e.mergeCoins(c[0], c.slice(1)), o ? e.splitCoins(c[0], [e.pure.u64(n)]) : c[0]);
1437
+ if (y)
1438
+ return o ? e.splitCoins(e.gas, [e.pure.u64(n)]) : e.gas;
1439
+ if (!j)
1440
+ return i.length === 1 ? e.object(i[0]) : e.mergeCoins(i[0], i.slice(1)), o ? e.splitCoins(i[0], [e.pure.u64(n)]) : i[0];
1441
+ const T = e.moveCall({
1442
+ target: "0x2::coin::redeem_funds",
1443
+ typeArguments: [m],
1444
+ arguments: [e.withdrawal({ amount: _, type: m })]
1445
+ });
1446
+ let $;
1447
+ const D = [];
1448
+ if (i.length > 0) {
1449
+ $ = e.object(i[0]);
1450
+ for (const B of i.slice(1))
1451
+ D.push(e.object(B));
1452
+ D.push(T);
1453
+ } else
1454
+ $ = T;
1455
+ return D.length > 0 && e.mergeCoins($, D), i.length === 0 ? $ : o ? e.splitCoins($, [e.pure.u64(n)]) : $;
1400
1456
  }
1401
- async function Pe(e, t, r, o, n, a, c) {
1402
- const i = await j({
1457
+ async function Ae(e, t, r, o, n, a, c) {
1458
+ const i = await I({
1403
1459
  ...c,
1404
1460
  cacheTime: v
1405
- }), s = await S(r, c);
1461
+ }), s = await E(r, c);
1406
1462
  return e.moveCall({
1407
1463
  target: `${i.uiGetter}::calculator_unchecked::dynamic_health_factor`,
1408
1464
  arguments: [
@@ -1420,15 +1476,15 @@ async function Pe(e, t, r, o, n, a, c) {
1420
1476
  });
1421
1477
  }
1422
1478
  async function Bt(e, t, r) {
1423
- return Pe(e, t, 0, 0, 0, !1, r);
1479
+ return Ae(e, t, 0, 0, 0, !1, r);
1424
1480
  }
1425
- async function Ae(e, t, r) {
1426
- const o = new N(), n = r?.client ?? V, a = await G({
1481
+ async function $e(e, t, r) {
1482
+ const o = new q(), n = r?.client ?? M, a = await J({
1427
1483
  ...r,
1428
- markets: Object.values(F)
1429
- }), c = te(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
1484
+ markets: Object.values(L)
1485
+ }), c = ne(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => P(d));
1430
1486
  for (const d of s) {
1431
- const f = await j({
1487
+ const f = await I({
1432
1488
  ...r,
1433
1489
  cacheTime: v,
1434
1490
  market: d.key
@@ -1439,7 +1495,7 @@ async function Ae(e, t, r) {
1439
1495
  });
1440
1496
  }
1441
1497
  for (let d of t) {
1442
- const f = await j({
1498
+ const f = await I({
1443
1499
  ...r,
1444
1500
  cacheTime: v,
1445
1501
  market: d.market
@@ -1449,75 +1505,75 @@ async function Ae(e, t, r) {
1449
1505
  arguments: [o.object(f.storage), o.pure.address(d.address)]
1450
1506
  });
1451
1507
  }
1452
- const m = (await q(n, {
1508
+ const m = (await W(n, {
1453
1509
  transactionBlock: o,
1454
1510
  sender: e
1455
- })).results || [], w = {};
1511
+ })).results || [], b = {};
1456
1512
  s.forEach((d, f) => {
1457
1513
  try {
1458
- const b = m[f]?.returnValues?.map((T) => l.vector(qe).parse(Uint8Array.from(T[0])))[0] || [], k = {};
1459
- for (const T of b)
1460
- k[T.id] = {
1461
- supplyIndex: T.supply_index,
1462
- borrowIndex: T.borrow_index
1514
+ const w = m[f]?.returnValues?.map((_) => l.vector(qe).parse(Uint8Array.from(_[0])))[0] || [], k = {};
1515
+ for (const _ of w)
1516
+ k[_.id] = {
1517
+ supplyIndex: _.supply_index,
1518
+ borrowIndex: _.borrow_index
1463
1519
  };
1464
- w[d.key] = k;
1465
- } catch (b) {
1520
+ b[d.key] = k;
1521
+ } catch (w) {
1466
1522
  console.warn(
1467
1523
  `[@naviprotocol/lending] Failed to decode reserve data for market "${d.key}", falling back to open-api pool indices`,
1468
- b
1524
+ w
1469
1525
  );
1470
1526
  }
1471
1527
  });
1472
- const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(ze).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1473
- return y.forEach((d, f) => {
1474
- const b = t[f], k = _(b.market), T = w[k.key] || {};
1475
- d.forEach((I) => {
1476
- if (I.supply_balance === "0" && I.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1528
+ const g = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(ze).parse(Uint8Array.from(f[0])))[0] || []), y = [];
1529
+ return g.forEach((d, f) => {
1530
+ const w = t[f], k = P(w.market), _ = b[k.key] || {};
1531
+ d.forEach((j) => {
1532
+ if (j.supply_balance === "0" && j.borrow_balance === "0" && (w.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1477
1533
  return;
1478
- const B = c[`${k.key}-${I.asset_id}`];
1479
- if (!B)
1534
+ const T = c[`${k.key}-${j.asset_id}`];
1535
+ if (!T)
1480
1536
  return;
1481
- const W = T[I.asset_id], Y = W?.supplyIndex ?? B.currentSupplyIndex, Ee = W?.borrowIndex ?? B.currentBorrowIndex, Oe = de(I.supply_balance, Y).toString(), Ve = de(I.borrow_balance, Ee).toString();
1482
- g.push({
1483
- supplyBalance: Oe,
1537
+ const $ = _[j.asset_id], D = $?.supplyIndex ?? T.currentSupplyIndex, B = $?.borrowIndex ?? T.currentBorrowIndex, X = me(j.supply_balance, D).toString(), Ve = me(j.borrow_balance, B).toString();
1538
+ y.push({
1539
+ supplyBalance: X,
1484
1540
  borrowBalance: Ve,
1485
- assetId: I.asset_id,
1541
+ assetId: j.asset_id,
1486
1542
  market: k.key,
1487
- pool: B,
1488
- emodeId: b.emodeId
1543
+ pool: T,
1544
+ emodeId: w.emodeId
1489
1545
  });
1490
1546
  });
1491
- }), g;
1547
+ }), y;
1492
1548
  }
1493
- const sr = $(
1549
+ const sr = O(
1494
1550
  async (e, t) => {
1495
- const o = (t?.markets || Object.keys(F)).map((n) => _(n)).map((n) => ({
1551
+ const o = (t?.markets || Object.keys(L)).map((n) => P(n)).map((n) => ({
1496
1552
  address: e,
1497
1553
  market: n.key
1498
1554
  }));
1499
- return await Ae(e, o, t);
1555
+ return await $e(e, o, t);
1500
1556
  }
1501
1557
  );
1502
1558
  async function ur(e, t) {
1503
- const r = t?.client ?? V, o = new N();
1559
+ const r = t?.client ?? M, o = new q();
1504
1560
  await Bt(o, e, t);
1505
- const n = await q(r, {
1561
+ const n = await W(r, {
1506
1562
  transactionBlock: o,
1507
1563
  sender: e
1508
- }), a = Q(n, [l.u256()]);
1509
- return Te(Number(a[0]) || 0);
1564
+ }), a = Z(n, [l.u256()]);
1565
+ return Pe(Number(a[0]) || 0);
1510
1566
  }
1511
1567
  async function lr(e, t, r, o) {
1512
- const n = o?.client ?? V, a = new N();
1568
+ const n = o?.client ?? M, a = new q();
1513
1569
  let c = 0, i = 0;
1514
- const s = await S(t, o);
1515
- if (r.forEach((y) => {
1516
- y.type === z.Supply ? c += y.amount : y.type === z.Withdraw ? c -= y.amount : y.type === z.Borrow ? i += y.amount : y.type === z.Repay && (i -= y.amount);
1570
+ const s = await E(t, o);
1571
+ if (r.forEach((g) => {
1572
+ g.type === H.Supply ? c += g.amount : g.type === H.Withdraw ? c -= g.amount : g.type === H.Borrow ? i += g.amount : g.type === H.Repay && (i -= g.amount);
1517
1573
  }), c * i < 0)
1518
1574
  throw new Error("Invalid operations");
1519
1575
  const u = c > 0 || i > 0;
1520
- await Pe(
1576
+ await Ae(
1521
1577
  a,
1522
1578
  e,
1523
1579
  s,
@@ -1526,28 +1582,28 @@ async function lr(e, t, r, o) {
1526
1582
  u,
1527
1583
  o
1528
1584
  );
1529
- const m = await q(n, {
1585
+ const m = await W(n, {
1530
1586
  transactionBlock: a,
1531
1587
  sender: e
1532
- }), w = Q(m, [l.u256()]);
1533
- return Te(Number(w[0]) || 0);
1588
+ }), b = Z(m, [l.u256()]);
1589
+ return Pe(Number(b[0]) || 0);
1534
1590
  }
1535
1591
  const dr = A(
1536
1592
  async (e, t) => {
1537
1593
  const r = new URLSearchParams();
1538
1594
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
1539
- const o = O(t), n = M(
1540
- `/navi/user/transactions?${r.toString()}&sdk=${E.version}`,
1595
+ const o = U(t), n = F(
1596
+ `/navi/user/transactions?${r.toString()}&sdk=${V.version}`,
1541
1597
  t
1542
1598
  );
1543
1599
  return (await fetch(n, {
1544
- headers: U(D, o)
1600
+ headers: N(R, o)
1545
1601
  }).then((c) => c.json())).data;
1546
1602
  }
1547
1603
  );
1548
1604
  async function pr(e, t) {
1549
1605
  let r = null;
1550
- const o = [], n = t?.client ?? V, a = n.core;
1606
+ const o = [], n = t?.client ?? M, a = n.core;
1551
1607
  do {
1552
1608
  let c;
1553
1609
  if (t?.coinType)
@@ -1559,7 +1615,7 @@ async function pr(e, t) {
1559
1615
  limit: 100
1560
1616
  });
1561
1617
  c = {
1562
- data: (i.objects ?? i.data ?? []).map((s) => me(s, t?.coinType)).filter(Boolean),
1618
+ data: (i.objects ?? i.data ?? []).map((s) => ye(s, t?.coinType)).filter(Boolean),
1563
1619
  nextCursor: i.cursor ?? i.nextCursor ?? null,
1564
1620
  hasNextPage: i.hasNextPage ?? !1
1565
1621
  };
@@ -1589,15 +1645,15 @@ async function pr(e, t) {
1589
1645
  for (const u of i) {
1590
1646
  let m = null;
1591
1647
  do {
1592
- const w = await a.listCoins({
1648
+ const b = await a.listCoins({
1593
1649
  owner: e,
1594
1650
  coinType: u,
1595
1651
  cursor: m,
1596
1652
  limit: 100
1597
1653
  });
1598
1654
  o.push(
1599
- ...(w.objects ?? w.data ?? []).map((y) => me(y, u)).filter(Boolean)
1600
- ), m = w.cursor ?? w.nextCursor ?? null;
1655
+ ...(b.objects ?? b.data ?? []).map((g) => ye(g, u)).filter(Boolean)
1656
+ ), m = b.cursor ?? b.nextCursor ?? null;
1601
1657
  } while (m);
1602
1658
  }
1603
1659
  break;
@@ -1618,75 +1674,75 @@ async function pr(e, t) {
1618
1674
  } while (r);
1619
1675
  return o;
1620
1676
  }
1621
- const Pt = $(
1677
+ const Pt = O(
1622
1678
  async (e, t) => {
1623
- const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i)), n = await Be(e, t), a = o.map((i) => ({
1679
+ const r = [], o = (t?.markets || Object.keys(L)).map((i) => P(i)), n = await Se(e, t), a = o.map((i) => ({
1624
1680
  address: e,
1625
1681
  market: i.key
1626
1682
  })).concat(
1627
1683
  n.filter((i) => !!o.find((s) => s.id === i.marketId)).map((i) => ({
1628
1684
  address: i.accountCap,
1629
- market: _(i.marketId).key,
1685
+ market: P(i.marketId).key,
1630
1686
  emodeId: i.emodeId
1631
1687
  }))
1632
1688
  );
1633
- return (await Ae(e, a, t)).forEach((i) => {
1689
+ return (await $e(e, a, t)).forEach((i) => {
1634
1690
  const s = typeof i.emodeId == "number" ? n.find((u) => {
1635
- const m = _(i.market);
1691
+ const m = P(i.market);
1636
1692
  return u.emodeId === i.emodeId && u.marketId === m.id;
1637
1693
  }) : void 0;
1638
1694
  if (s) {
1639
1695
  if (!i.pool.emodes.find((m) => m.emodeId === s.emodeId))
1640
1696
  return;
1641
1697
  if (p(i.supplyBalance).gte(0)) {
1642
- const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1643
- if (m.gt(0) || w.emode.isCollateral)
1698
+ const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), b = K(i.pool, s);
1699
+ if (m.gt(0) || b.emode.isCollateral)
1644
1700
  try {
1645
1701
  r.push({
1646
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${P()}`,
1702
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${S()}`,
1647
1703
  wallet: e,
1648
1704
  protocol: "navi",
1649
1705
  market: i.market,
1650
1706
  type: "navi-lending-emode-supply",
1651
1707
  "navi-lending-emode-supply": {
1652
1708
  amount: m.toString(),
1653
- pool: H(i.pool, s),
1709
+ pool: K(i.pool, s),
1654
1710
  token: i.pool.token,
1655
1711
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1656
1712
  emodeCap: s
1657
1713
  }
1658
1714
  });
1659
- } catch (y) {
1660
- console.error(y);
1715
+ } catch (g) {
1716
+ console.error(g);
1661
1717
  }
1662
1718
  }
1663
1719
  if (p(i.borrowBalance).gte(0)) {
1664
- const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1665
- if (m.gt(0) || w.emode.isDebt)
1720
+ const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), b = K(i.pool, s);
1721
+ if (m.gt(0) || b.emode.isDebt)
1666
1722
  try {
1667
1723
  r.push({
1668
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${P()}`,
1724
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${S()}`,
1669
1725
  wallet: e,
1670
1726
  protocol: "navi",
1671
1727
  market: i.market,
1672
1728
  type: "navi-lending-emode-borrow",
1673
1729
  "navi-lending-emode-borrow": {
1674
1730
  amount: m.toString(),
1675
- pool: H(i.pool, s),
1731
+ pool: K(i.pool, s),
1676
1732
  token: i.pool.token,
1677
1733
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1678
1734
  emodeCap: s
1679
1735
  }
1680
1736
  });
1681
- } catch (y) {
1682
- console.error(y);
1737
+ } catch (g) {
1738
+ console.error(g);
1683
1739
  }
1684
1740
  }
1685
1741
  } else {
1686
1742
  if (p(i.supplyBalance).gt(0)) {
1687
1743
  const u = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1688
1744
  r.push({
1689
- id: `${i.pool.uniqueId}_navi-lending-supply-${P()}`,
1745
+ id: `${i.pool.uniqueId}_navi-lending-supply-${S()}`,
1690
1746
  wallet: e,
1691
1747
  protocol: "navi",
1692
1748
  type: "navi-lending-supply",
@@ -1702,7 +1758,7 @@ const Pt = $(
1702
1758
  if (p(i.borrowBalance).gt(0)) {
1703
1759
  const u = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1704
1760
  r.push({
1705
- id: `${i.pool.uniqueId}_navi-lending-borrow-${P()}`,
1761
+ id: `${i.pool.uniqueId}_navi-lending-borrow-${S()}`,
1706
1762
  wallet: e,
1707
1763
  protocol: "navi",
1708
1764
  market: i.market,
@@ -1719,7 +1775,7 @@ const Pt = $(
1719
1775
  }), r;
1720
1776
  }
1721
1777
  );
1722
- class L {
1778
+ class G {
1723
1779
  constructor(t, r) {
1724
1780
  this._positions = [], this._priceMap = {}, this._overview = {
1725
1781
  hf: 1 / 0,
@@ -1759,7 +1815,7 @@ class L {
1759
1815
  }
1760
1816
  filterPositionsByPool(t) {
1761
1817
  const o = !!t.isEMode ? ["navi-lending-emode-supply", "navi-lending-emode-borrow"] : ["navi-lending-supply", "navi-lending-borrow"];
1762
- return new L(
1818
+ return new G(
1763
1819
  this.positions.filter((n) => {
1764
1820
  const a = n[n.type];
1765
1821
  return o.includes(n.type) && a.pool.uniqueId === t.uniqueId;
@@ -1771,7 +1827,7 @@ class L {
1771
1827
  const o = !!t.isEMode, n = this.getPrice(t);
1772
1828
  let a;
1773
1829
  return o ? a = {
1774
- id: P(),
1830
+ id: S(),
1775
1831
  wallet: "",
1776
1832
  protocol: "navi",
1777
1833
  market: "",
@@ -1784,7 +1840,7 @@ class L {
1784
1840
  emodeCap: {}
1785
1841
  }
1786
1842
  } : a = {
1787
- id: P(),
1843
+ id: S(),
1788
1844
  wallet: "",
1789
1845
  protocol: "navi",
1790
1846
  market: "",
@@ -1795,13 +1851,13 @@ class L {
1795
1851
  token: t.token,
1796
1852
  pool: t
1797
1853
  }
1798
- }, new L([...this.positions, a], this._priceMap);
1854
+ }, new G([...this.positions, a], this._priceMap);
1799
1855
  }
1800
1856
  withdraw(t, r) {
1801
1857
  const o = !!t.isEMode, n = this.getPrice(t);
1802
1858
  let a;
1803
1859
  return o ? a = {
1804
- id: P(),
1860
+ id: S(),
1805
1861
  wallet: "",
1806
1862
  protocol: "navi",
1807
1863
  market: "",
@@ -1814,7 +1870,7 @@ class L {
1814
1870
  emodeCap: {}
1815
1871
  }
1816
1872
  } : a = {
1817
- id: P(),
1873
+ id: S(),
1818
1874
  wallet: "",
1819
1875
  protocol: "navi",
1820
1876
  market: "",
@@ -1825,13 +1881,13 @@ class L {
1825
1881
  token: t.token,
1826
1882
  pool: t
1827
1883
  }
1828
- }, new L([...this.positions, a], this._priceMap);
1884
+ }, new G([...this.positions, a], this._priceMap);
1829
1885
  }
1830
1886
  borrow(t, r) {
1831
1887
  const o = !!t.isEMode, n = this.getPrice(t);
1832
1888
  let a;
1833
1889
  return o ? a = {
1834
- id: P(),
1890
+ id: S(),
1835
1891
  wallet: "",
1836
1892
  protocol: "navi",
1837
1893
  market: "",
@@ -1844,7 +1900,7 @@ class L {
1844
1900
  emodeCap: {}
1845
1901
  }
1846
1902
  } : a = {
1847
- id: P(),
1903
+ id: S(),
1848
1904
  wallet: "",
1849
1905
  protocol: "navi",
1850
1906
  market: "",
@@ -1855,13 +1911,13 @@ class L {
1855
1911
  token: t.token,
1856
1912
  pool: t
1857
1913
  }
1858
- }, new L([...this.positions, a], this._priceMap);
1914
+ }, new G([...this.positions, a], this._priceMap);
1859
1915
  }
1860
1916
  repay(t, r) {
1861
1917
  const o = !!t.isEMode, n = this.getPrice(t);
1862
1918
  let a;
1863
1919
  return o ? a = {
1864
- id: P(),
1920
+ id: S(),
1865
1921
  wallet: "",
1866
1922
  protocol: "navi",
1867
1923
  market: "",
@@ -1874,7 +1930,7 @@ class L {
1874
1930
  emodeCap: {}
1875
1931
  }
1876
1932
  } : a = {
1877
- id: P(),
1933
+ id: S(),
1878
1934
  wallet: "",
1879
1935
  protocol: "navi",
1880
1936
  market: "",
@@ -1885,7 +1941,7 @@ class L {
1885
1941
  token: t.token,
1886
1942
  pool: t
1887
1943
  }
1888
- }, new L([...this.positions, a], this._priceMap);
1944
+ }, new G([...this.positions, a], this._priceMap);
1889
1945
  }
1890
1946
  resolveValueUSD(t) {
1891
1947
  return Object.keys(this._priceMap).length > 0 ? p(t.amount).multipliedBy(this.getPrice(t.pool)).toString() : t.valueUSD;
@@ -1893,58 +1949,58 @@ class L {
1893
1949
  getPositionsOverview(t) {
1894
1950
  const r = {}, o = {};
1895
1951
  let n = new p(0), a = new p(0), c = new p(0), i = new p(0), s = new p(0), u = new p(0);
1896
- t.forEach((g) => {
1897
- if (g.type === "navi-lending-supply") {
1898
- const d = g["navi-lending-supply"], f = this.resolveValueUSD(d);
1952
+ t.forEach((y) => {
1953
+ if (y.type === "navi-lending-supply") {
1954
+ const d = y["navi-lending-supply"], f = this.resolveValueUSD(d);
1899
1955
  n = n.plus(f), s = s.plus(
1900
1956
  new p(f).multipliedBy(d.pool.liquidationFactor.threshold)
1901
1957
  ), u = u.plus(
1902
1958
  new p(f).multipliedBy(d.pool.ltvValue)
1903
1959
  );
1904
- } else if (g.type === "navi-lending-borrow") {
1905
- const d = g["navi-lending-borrow"];
1960
+ } else if (y.type === "navi-lending-borrow") {
1961
+ const d = y["navi-lending-borrow"];
1906
1962
  a = a.plus(this.resolveValueUSD(d));
1907
- } else if (g.type === "navi-lending-emode-supply") {
1908
- const d = g["navi-lending-emode-supply"], f = this.resolveValueUSD(d);
1963
+ } else if (y.type === "navi-lending-emode-supply") {
1964
+ const d = y["navi-lending-emode-supply"], f = this.resolveValueUSD(d);
1909
1965
  n = n.plus(f);
1910
- const b = d.pool.emode;
1966
+ const w = d.pool.emode;
1911
1967
  s = s.plus(
1912
- new p(f).multipliedBy(b.lt)
1968
+ new p(f).multipliedBy(w.lt)
1913
1969
  ), u = u.plus(
1914
- new p(f).multipliedBy(b.ltv)
1970
+ new p(f).multipliedBy(w.ltv)
1915
1971
  );
1916
- } else if (g.type === "navi-lending-emode-borrow") {
1917
- const d = g["navi-lending-emode-borrow"];
1972
+ } else if (y.type === "navi-lending-emode-borrow") {
1973
+ const d = y["navi-lending-emode-borrow"];
1918
1974
  a = a.plus(this.resolveValueUSD(d));
1919
1975
  }
1920
- }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), u = p.max(u, 0), t.forEach((g) => {
1921
- if (g.type === "navi-lending-supply") {
1922
- const d = g["navi-lending-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
1976
+ }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), u = p.max(u, 0), t.forEach((y) => {
1977
+ if (y.type === "navi-lending-supply") {
1978
+ const d = y["navi-lending-supply"], f = this.resolveValueUSD(d), w = d.pool.supplyIncentiveApyInfo.apy;
1923
1979
  n.gt(0) && (c = c.plus(
1924
- new p(f).dividedBy(n).multipliedBy(new p(b).dividedBy(100))
1980
+ new p(f).dividedBy(n).multipliedBy(new p(w).dividedBy(100))
1925
1981
  )), r[d.pool.suiCoinType] = p(r[d.pool.suiCoinType] || 0).plus(d.amount).toString();
1926
- } else if (g.type === "navi-lending-borrow") {
1927
- const d = g["navi-lending-borrow"], f = this.resolveValueUSD(d), b = d.pool.borrowIncentiveApyInfo.apy;
1982
+ } else if (y.type === "navi-lending-borrow") {
1983
+ const d = y["navi-lending-borrow"], f = this.resolveValueUSD(d), w = d.pool.borrowIncentiveApyInfo.apy;
1928
1984
  a.gt(0) && (i = i.plus(
1929
- new p(f).dividedBy(a).multipliedBy(new p(b).dividedBy(100))
1985
+ new p(f).dividedBy(a).multipliedBy(new p(w).dividedBy(100))
1930
1986
  )), o[d.pool.suiCoinType] = p(o[d.pool.suiCoinType] || 0).plus(d.amount).toString();
1931
- } else if (g.type === "navi-lending-emode-supply") {
1932
- const d = g["navi-lending-emode-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
1987
+ } else if (y.type === "navi-lending-emode-supply") {
1988
+ const d = y["navi-lending-emode-supply"], f = this.resolveValueUSD(d), w = d.pool.supplyIncentiveApyInfo.apy;
1933
1989
  n.gt(0) && (c = c.plus(
1934
- new p(f).dividedBy(n).multipliedBy(new p(b).dividedBy(100))
1990
+ new p(f).dividedBy(n).multipliedBy(new p(w).dividedBy(100))
1935
1991
  )), r[d.pool.suiCoinType] = p(r[d.pool.suiCoinType] || 0).plus(d.amount).toString();
1936
- } else if (g.type === "navi-lending-emode-borrow") {
1937
- const d = g["navi-lending-emode-borrow"], f = this.resolveValueUSD(d), b = d.pool.borrowIncentiveApyInfo.apy;
1992
+ } else if (y.type === "navi-lending-emode-borrow") {
1993
+ const d = y["navi-lending-emode-borrow"], f = this.resolveValueUSD(d), w = d.pool.borrowIncentiveApyInfo.apy;
1938
1994
  a.gt(0) && (i = i.plus(
1939
- new p(f).dividedBy(a).multipliedBy(new p(b).dividedBy(100))
1995
+ new p(f).dividedBy(a).multipliedBy(new p(w).dividedBy(100))
1940
1996
  )), o[d.pool.suiCoinType] = p(o[d.pool.suiCoinType] || 0).plus(d.amount).toString();
1941
1997
  }
1942
1998
  });
1943
- const m = n.minus(a), w = n.minus(a).eq(0) ? new p(0) : n.multipliedBy(c).minus(a.multipliedBy(i)).div(n.minus(a));
1999
+ const m = n.minus(a), b = n.minus(a).eq(0) ? new p(0) : n.multipliedBy(c).minus(a.multipliedBy(i)).div(n.minus(a));
1944
2000
  return {
1945
2001
  hf: a.toNumber() !== 0 ? s.dividedBy(a).toNumber() : 1 / 0,
1946
2002
  netVaule: m.toString(),
1947
- netWorthApr: w.toString(),
2003
+ netWorthApr: b.toString(),
1948
2004
  totalSupplyValue: n.toString(),
1949
2005
  totalBorrowValue: a.toString(),
1950
2006
  totalsupplyApy: c.toString(),
@@ -1957,7 +2013,7 @@ class L {
1957
2013
  }
1958
2014
  }
1959
2015
  async function mr(e, t, r, o) {
1960
- const n = await j({
2016
+ const n = await I({
1961
2017
  ...o,
1962
2018
  cacheTime: v
1963
2019
  });
@@ -1972,12 +2028,12 @@ async function mr(e, t, r, o) {
1972
2028
  ]
1973
2029
  });
1974
2030
  }
1975
- const Se = new Ce("https://hermes.pyth.network", {
2031
+ const Ee = new Ie("https://hermes.pyth.network", {
1976
2032
  timeout: 1e4
1977
2033
  });
1978
2034
  async function fr(e) {
1979
2035
  try {
1980
- const t = [], r = await Se.getLatestPriceFeeds(e);
2036
+ const t = [], r = await Ee.getLatestPriceFeeds(e);
1981
2037
  if (!r) return t;
1982
2038
  const o = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
1983
2039
  for (const n of r) {
@@ -1997,8 +2053,8 @@ async function fr(e) {
1997
2053
  throw new Error(`failed to get pyth stale price feed id, msg: ${t.message}`);
1998
2054
  }
1999
2055
  }
2000
- async function At(e, t) {
2001
- const r = [], o = t?.client ?? V, n = e.map((c) => c.priceInfoObject), a = await gt(o, {
2056
+ async function St(e, t) {
2057
+ const r = [], o = t?.client ?? M, n = e.map((c) => c.priceInfoObject), a = await gt(o, {
2002
2058
  ids: Array.from(new Set(n)),
2003
2059
  options: { showContent: !0 }
2004
2060
  });
@@ -2018,21 +2074,21 @@ async function At(e, t) {
2018
2074
  console.warn(`unexpected pyth price struct, priceInfoObject: ${i.objectId}`);
2019
2075
  continue;
2020
2076
  }
2021
- const { magnitude: w, negative: y } = m, g = u.conf, d = u.timestamp;
2077
+ const { magnitude: b, negative: g } = m, y = u.conf, d = u.timestamp;
2022
2078
  r.push({
2023
2079
  priceFeedId: s.priceFeedId,
2024
2080
  priceInfoObject: s.priceInfoObject,
2025
- price: y ? "-" + w : w,
2026
- conf: g,
2081
+ price: g ? "-" + b : b,
2082
+ conf: y,
2027
2083
  publishTime: Number(d),
2028
2084
  expiration: s.expiration
2029
2085
  });
2030
2086
  }
2031
2087
  return r;
2032
2088
  }
2033
- async function St(e, t) {
2089
+ async function At(e, t) {
2034
2090
  try {
2035
- const r = [], o = await At(e, t);
2091
+ const r = [], o = await St(e, t);
2036
2092
  if (!o) return r;
2037
2093
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2038
2094
  for (const a of o) {
@@ -2053,12 +2109,12 @@ async function St(e, t) {
2053
2109
  }
2054
2110
  }
2055
2111
  async function $t(e, t, r) {
2056
- const o = r?.client ?? V, n = await j({
2112
+ const o = r?.client ?? M, n = await I({
2057
2113
  ...r,
2058
2114
  cacheTime: v
2059
2115
  });
2060
2116
  try {
2061
- const a = await Se.getPriceFeedsUpdateData(t);
2117
+ const a = await Ee.getPriceFeedsUpdateData(t);
2062
2118
  return await new lt(
2063
2119
  o,
2064
2120
  n.oracle.pythStateId,
@@ -2068,8 +2124,8 @@ async function $t(e, t, r) {
2068
2124
  throw new Error(`failed to update pyth price feeds, msg: ${a.message}`);
2069
2125
  }
2070
2126
  }
2071
- async function fe(e, t, r) {
2072
- const o = await j({
2127
+ async function ge(e, t, r) {
2128
+ const o = await I({
2073
2129
  ...r,
2074
2130
  cacheTime: v
2075
2131
  });
@@ -2078,7 +2134,7 @@ async function fe(e, t, r) {
2078
2134
  priceFeedId: c.pythPriceFeedId,
2079
2135
  priceInfoObject: c.pythPriceInfoObject,
2080
2136
  expiration: 30
2081
- })), a = await St(n, r);
2137
+ })), a = await At(n, r);
2082
2138
  a.length > 0 && await $t(e, a, r);
2083
2139
  }
2084
2140
  for (const n of t)
@@ -2102,8 +2158,8 @@ async function fe(e, t, r) {
2102
2158
  });
2103
2159
  return e;
2104
2160
  }
2105
- async function $e(e) {
2106
- return (await j({
2161
+ async function Oe(e) {
2162
+ return (await I({
2107
2163
  ...e,
2108
2164
  cacheTime: v
2109
2165
  })).oracle.feeds;
@@ -2124,7 +2180,7 @@ function Et(e, t) {
2124
2180
  async function yr(e, t, r, o) {
2125
2181
  let n;
2126
2182
  try {
2127
- const a = await $e({
2183
+ const a = await Oe({
2128
2184
  ...o
2129
2185
  }), c = [];
2130
2186
  r.forEach((u) => {
@@ -2137,7 +2193,7 @@ async function yr(e, t, r, o) {
2137
2193
  return n = Et(a, {
2138
2194
  lendingPositions: i,
2139
2195
  pools: r
2140
- }), await fe(e, n, {
2196
+ }), await ge(e, n, {
2141
2197
  updatePythPriceFeeds: !0,
2142
2198
  ...o
2143
2199
  });
@@ -2146,7 +2202,7 @@ async function yr(e, t, r, o) {
2146
2202
  throw a;
2147
2203
  if (console.error(a), n)
2148
2204
  try {
2149
- return await fe(e, n, {
2205
+ return await ge(e, n, {
2150
2206
  ...o,
2151
2207
  updatePythPriceFeeds: !1
2152
2208
  });
@@ -2156,14 +2212,14 @@ async function yr(e, t, r, o) {
2156
2212
  return e;
2157
2213
  }
2158
2214
  }
2159
- const ne = $(
2215
+ const ae = O(
2160
2216
  A(
2161
2217
  async (e) => {
2162
- const t = O(e), r = M(
2163
- `/navi/flashloan?env=${e?.env || "prod"}&sdk=${E.version}&market=${e?.market || R}`,
2218
+ const t = U(e), r = F(
2219
+ `/navi/flashloan?env=${e?.env || "prod"}&sdk=${V.version}&market=${e?.market || z}`,
2164
2220
  e
2165
2221
  ), o = await fetch(r, {
2166
- headers: U(D, t)
2222
+ headers: N(R, t)
2167
2223
  }).then((n) => n.json());
2168
2224
  return Object.keys(o.data).map((n) => ({
2169
2225
  ...o.data[n],
@@ -2173,14 +2229,14 @@ const ne = $(
2173
2229
  )
2174
2230
  );
2175
2231
  async function gr(e, t) {
2176
- return (await ne(t)).find((o) => typeof e == "string" ? C(o.coinType) === C(e) : typeof e == "number" ? o.assetId === e : o.assetId === e.id) || null;
2232
+ return (await ae(t)).find((o) => typeof e == "string" ? C(o.coinType) === C(e) : typeof e == "number" ? o.assetId === e : o.assetId === e.id) || null;
2177
2233
  }
2178
2234
  async function hr(e, t, r, o) {
2179
- const n = await j({
2235
+ const n = await I({
2180
2236
  ...o,
2181
2237
  cacheTime: v
2182
- }), a = await S(t, o);
2183
- if (!(await ne({
2238
+ }), a = await E(t, o);
2239
+ if (!(await ae({
2184
2240
  ...o,
2185
2241
  cacheTime: v
2186
2242
  })).some(
@@ -2212,12 +2268,12 @@ async function hr(e, t, r, o) {
2212
2268
  return [s, u];
2213
2269
  }
2214
2270
  }
2215
- async function wr(e, t, r, o, n) {
2216
- const a = await j({
2271
+ async function br(e, t, r, o, n) {
2272
+ const a = await I({
2217
2273
  ...n,
2218
2274
  cacheTime: v
2219
- }), c = await S(t, n);
2220
- if (!(await ne({
2275
+ }), c = await E(t, n);
2276
+ if (!(await ae({
2221
2277
  ...n,
2222
2278
  cacheTime: v
2223
2279
  })).some(
@@ -2237,13 +2293,13 @@ async function wr(e, t, r, o, n) {
2237
2293
  });
2238
2294
  return [u];
2239
2295
  }
2240
- async function br(e, t, r, o, n, a) {
2296
+ async function wr(e, t, r, o, n, a) {
2241
2297
  const c = {
2242
2298
  ...a,
2243
2299
  cacheTime: v
2244
- }, i = await j(c), s = await S(t, c), u = await S(o, c);
2300
+ }, i = await I(c), s = await E(t, c), u = await E(o, c);
2245
2301
  if (i.version === 1) {
2246
- const [m, w] = e.moveCall({
2302
+ const [m, b] = e.moveCall({
2247
2303
  target: `${i.package}::incentive_v3::liquidation`,
2248
2304
  arguments: [
2249
2305
  e.object("0x06"),
@@ -2271,9 +2327,9 @@ async function br(e, t, r, o, n, a) {
2271
2327
  ],
2272
2328
  typeArguments: [s.suiCoinType, u.suiCoinType]
2273
2329
  });
2274
- return [m, w];
2330
+ return [m, b];
2275
2331
  } else {
2276
- const [m, w] = e.moveCall({
2332
+ const [m, b] = e.moveCall({
2277
2333
  target: `${i.package}::incentive_v3::liquidation_v2`,
2278
2334
  arguments: [
2279
2335
  e.object("0x06"),
@@ -2303,23 +2359,23 @@ async function br(e, t, r, o, n, a) {
2303
2359
  ],
2304
2360
  typeArguments: [s.suiCoinType, u.suiCoinType]
2305
2361
  });
2306
- return [m, w];
2362
+ return [m, b];
2307
2363
  }
2308
2364
  }
2309
2365
  async function Ot(e, t, r) {
2310
- const o = r?.client ?? V, n = await G({
2366
+ const o = r?.client ?? M, n = await J({
2311
2367
  ...r,
2312
- markets: Object.values(F),
2368
+ markets: Object.values(L),
2313
2369
  cacheTime: v
2314
- }), a = await $e(r), c = [];
2370
+ }), a = await Oe(r), c = [];
2315
2371
  return await Promise.all(
2316
2372
  t.map(async (i) => {
2317
2373
  try {
2318
- const s = await j({
2374
+ const s = await I({
2319
2375
  ...r,
2320
2376
  cacheTime: v,
2321
2377
  market: i.market
2322
- }), u = new N();
2378
+ }), u = new q();
2323
2379
  u.moveCall({
2324
2380
  target: `${s.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
2325
2381
  arguments: [
@@ -2333,13 +2389,13 @@ async function Ot(e, t, r) {
2333
2389
  // User address
2334
2390
  ]
2335
2391
  });
2336
- const w = (await q(o, {
2392
+ const b = (await W(o, {
2337
2393
  transactionBlock: u,
2338
2394
  sender: e
2339
2395
  }))?.results?.[0];
2340
- if (!w)
2396
+ if (!b)
2341
2397
  return;
2342
- const y = Q({ results: [w] }, [
2398
+ const g = Z({ results: [b] }, [
2343
2399
  l.vector(l.string()),
2344
2400
  // Asset coin types
2345
2401
  l.vector(l.string()),
@@ -2351,21 +2407,21 @@ async function Ot(e, t, r) {
2351
2407
  l.vector(l.u256())
2352
2408
  // Claimable amounts
2353
2409
  ]);
2354
- if (y.length === 5 && Array.isArray(y[0])) {
2355
- const g = y[0].length;
2356
- for (let d = 0; d < g; d++) {
2410
+ if (g.length === 5 && Array.isArray(g[0])) {
2411
+ const y = g[0].length;
2412
+ for (let d = 0; d < y; d++) {
2357
2413
  const f = a.find(
2358
- (k) => C(k.coinType) === C(y[1][d])
2359
- ), b = n.find(
2360
- (k) => C(k.coinType) === C(y[0][d]) && k.market === i.market
2414
+ (k) => C(k.coinType) === C(g[1][d])
2415
+ ), w = n.find(
2416
+ (k) => C(k.coinType) === C(g[0][d]) && k.market === i.market
2361
2417
  );
2362
- !f || !b || c.push({
2363
- assetId: b.id,
2364
- assetCoinType: C(y[0][d]),
2365
- rewardCoinType: C(y[1][d]),
2366
- option: Number(y[2][d]),
2367
- userClaimableReward: Number(y[4][d]) / Math.pow(10, f.priceDecimal),
2368
- ruleIds: Array.isArray(y[3][d]) ? y[3][d] : [y[3][d]],
2418
+ !f || !w || c.push({
2419
+ assetId: w.id,
2420
+ assetCoinType: C(g[0][d]),
2421
+ rewardCoinType: C(g[1][d]),
2422
+ option: Number(g[2][d]),
2423
+ userClaimableReward: Number(g[4][d]) / Math.pow(10, f.priceDecimal),
2424
+ ruleIds: Array.isArray(g[3][d]) ? g[3][d] : [g[3][d]],
2369
2425
  market: i.market,
2370
2426
  owner: i.owner,
2371
2427
  address: i.address,
@@ -2383,13 +2439,13 @@ async function Ot(e, t, r) {
2383
2439
  ), c;
2384
2440
  }
2385
2441
  async function vr(e, t) {
2386
- const r = (t?.markets || [F.main]).map((a) => _(a)), o = await Be(e, t), n = r.map((a) => ({
2442
+ const r = (t?.markets || [L.main]).map((a) => P(a)), o = await Se(e, t), n = r.map((a) => ({
2387
2443
  address: e,
2388
2444
  owner: e,
2389
2445
  market: a.key
2390
2446
  })).concat(
2391
2447
  o.filter((a) => !!r.find((c) => c.id === a.marketId)).map((a) => {
2392
- const c = _(a.marketId);
2448
+ const c = P(a.marketId);
2393
2449
  return {
2394
2450
  address: a.accountCap,
2395
2451
  owner: e,
@@ -2429,72 +2485,72 @@ function Cr(e) {
2429
2485
  }))
2430
2486
  }));
2431
2487
  }
2432
- const jr = A(
2488
+ const kr = A(
2433
2489
  async (e, t) => {
2434
- const r = O(t), o = M(
2435
- `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${E.version}&market=${t?.market || R}`,
2490
+ const r = U(t), o = F(
2491
+ `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${V.version}&market=${t?.market || z}`,
2436
2492
  t
2437
2493
  );
2438
2494
  return (await fetch(o, {
2439
- headers: U(D, r)
2495
+ headers: N(R, r)
2440
2496
  }).then((a) => a.json())).data;
2441
2497
  }
2442
- ), kr = A(
2498
+ ), Ir = A(
2443
2499
  async (e, t) => {
2444
- const r = O(t), o = M(
2445
- `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${E.version}&market=${t?.market || R}`,
2500
+ const r = U(t), o = F(
2501
+ `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${V.version}&market=${t?.market || z}`,
2446
2502
  t
2447
2503
  ), n = await fetch(o, {
2448
- headers: U(D, r)
2504
+ headers: N(R, r)
2449
2505
  }).then((a) => a.json());
2450
- return ee({
2506
+ return re({
2451
2507
  data: n.data.rewards
2452
2508
  });
2453
2509
  }
2454
2510
  );
2455
- async function Ir(e, t, r) {
2456
- const o = await G({
2511
+ async function jr(e, t, r) {
2512
+ const o = await J({
2457
2513
  ...r,
2458
- markets: Object.values(F),
2514
+ markets: Object.values(L),
2459
2515
  cacheTime: v
2460
2516
  }), n = /* @__PURE__ */ new Map();
2461
2517
  for (const c of t) {
2462
- const { rewardCoinType: i, ruleIds: s, market: u, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${u}`;
2518
+ const { rewardCoinType: i, ruleIds: s, market: u, owner: m, address: b, emodeId: g } = c, y = `${i}___${b}__${u}`;
2463
2519
  for (const d of s) {
2464
- n.has(g) || n.set(g, {
2520
+ n.has(y) || n.set(y, {
2465
2521
  assetIds: [],
2466
2522
  ruleIds: [],
2467
2523
  amount: 0,
2468
2524
  market: u,
2469
2525
  owner: m,
2470
- address: w,
2471
- isEMode: typeof y < "u"
2526
+ address: b,
2527
+ isEMode: typeof g < "u"
2472
2528
  });
2473
- const f = n.get(g);
2529
+ const f = n.get(y);
2474
2530
  f.assetIds.push(c.assetCoinType.replace("0x", "")), f.ruleIds.push(d), f.amount += c.userClaimableReward;
2475
2531
  }
2476
2532
  }
2477
2533
  const a = [];
2478
2534
  for (const [
2479
2535
  c,
2480
- { assetIds: i, ruleIds: s, amount: u, market: m, owner: w, address: y, isEMode: g }
2536
+ { assetIds: i, ruleIds: s, amount: u, market: m, owner: b, address: g, isEMode: y }
2481
2537
  ] of n) {
2482
- const d = await j({
2538
+ const d = await I({
2483
2539
  ...r,
2484
2540
  cacheTime: v,
2485
2541
  market: m
2486
- }), f = c.split("___")[0], b = o.filter(
2487
- (I) => C(I.suiCoinType) === C(f)
2542
+ }), f = c.split("___")[0], w = o.filter(
2543
+ (j) => C(j.suiCoinType) === C(f)
2488
2544
  );
2489
- b.sort((I, B) => I.market === m ? -1 : 1);
2490
- const k = b[0], T = d.rewardFunds[C(f)];
2491
- if (!T)
2545
+ w.sort((j, T) => j.market === m ? -1 : 1);
2546
+ const k = w[0], _ = d.rewardFunds[C(f)];
2547
+ if (!_)
2492
2548
  throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
2493
2549
  if (r?.accountCap && !r.customCoinReceive)
2494
2550
  throw new Error("customCoinReceive is required when accountCap is provided");
2495
2551
  if (r?.customCoinReceive) {
2496
- let I;
2497
- r.accountCap ? I = e.moveCall({
2552
+ let j;
2553
+ r.accountCap ? j = e.moveCall({
2498
2554
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2499
2555
  arguments: [
2500
2556
  e.object("0x06"),
@@ -2503,7 +2559,7 @@ async function Ir(e, t, r) {
2503
2559
  // Incentive V3 contract
2504
2560
  e.object(d.storage),
2505
2561
  // Protocol storage
2506
- e.object(T),
2562
+ e.object(_),
2507
2563
  // Reward fund
2508
2564
  e.pure.vector("string", i),
2509
2565
  // Asset IDs
@@ -2513,7 +2569,7 @@ async function Ir(e, t, r) {
2513
2569
  // Account capability
2514
2570
  ],
2515
2571
  typeArguments: [f]
2516
- }) : g ? I = e.moveCall({
2572
+ }) : y ? j = e.moveCall({
2517
2573
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2518
2574
  arguments: [
2519
2575
  e.object("0x06"),
@@ -2522,17 +2578,17 @@ async function Ir(e, t, r) {
2522
2578
  // Incentive V3 contract
2523
2579
  e.object(d.storage),
2524
2580
  // Protocol storage
2525
- e.object(T),
2581
+ e.object(_),
2526
2582
  // Reward fund
2527
2583
  e.pure.vector("string", i),
2528
2584
  // Asset IDs
2529
2585
  e.pure.vector("address", s),
2530
2586
  // Rule IDs
2531
- h(y, e.object)
2587
+ h(g, e.object)
2532
2588
  // Account capability
2533
2589
  ],
2534
2590
  typeArguments: [f]
2535
- }) : I = e.moveCall({
2591
+ }) : j = e.moveCall({
2536
2592
  target: `${d.package}::incentive_v3::claim_reward`,
2537
2593
  arguments: [
2538
2594
  e.object("0x06"),
@@ -2541,7 +2597,7 @@ async function Ir(e, t, r) {
2541
2597
  // Incentive V3 contract
2542
2598
  e.object(d.storage),
2543
2599
  // Protocol storage
2544
- e.object(T),
2600
+ e.object(_),
2545
2601
  // Reward fund
2546
2602
  e.pure.vector("string", i),
2547
2603
  // Asset IDs
@@ -2550,37 +2606,37 @@ async function Ir(e, t, r) {
2550
2606
  ],
2551
2607
  typeArguments: [f]
2552
2608
  });
2553
- const [B] = e.moveCall({
2609
+ const [T] = e.moveCall({
2554
2610
  target: "0x2::coin::from_balance",
2555
- arguments: [I],
2611
+ arguments: [j],
2556
2612
  typeArguments: [f]
2557
2613
  });
2558
2614
  if (r?.customCoinReceive.type === "transfer") {
2559
2615
  if (!r.customCoinReceive.transfer)
2560
2616
  throw new Error("customCoinReceive.transfer is required");
2561
2617
  e.transferObjects(
2562
- [B],
2618
+ [T],
2563
2619
  h(r.customCoinReceive.transfer, e.pure.address)
2564
2620
  );
2565
2621
  }
2566
2622
  if (r?.customCoinReceive.type === "depositNAVI") {
2567
- const W = p(k.totalSupplyAmount).shiftedBy(-9), Y = p(k.supplyCapCeiling).shiftedBy(-27);
2568
- W.plus(u).isGreaterThan(Y) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2569
- [B],
2623
+ const $ = p(k.totalSupplyAmount).shiftedBy(-9), D = p(k.supplyCapCeiling).shiftedBy(-27);
2624
+ $.plus(u).isGreaterThan(D) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2625
+ [T],
2570
2626
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2571
- ) : await vt(e, k, B, {
2627
+ ) : await vt(e, k, T, {
2572
2628
  ...r,
2573
2629
  market: k.market
2574
2630
  });
2575
2631
  } else
2576
2632
  a.push({
2577
- coin: B,
2633
+ coin: T,
2578
2634
  identifier: k,
2579
- owner: w,
2580
- isEMode: g
2635
+ owner: b,
2636
+ isEMode: y
2581
2637
  });
2582
- } else if (r?.accountCap || g) {
2583
- const I = e.moveCall({
2638
+ } else if (r?.accountCap || y) {
2639
+ const j = e.moveCall({
2584
2640
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2585
2641
  arguments: [
2586
2642
  e.object("0x06"),
@@ -2589,24 +2645,24 @@ async function Ir(e, t, r) {
2589
2645
  // Incentive V3 contract
2590
2646
  e.object(d.storage),
2591
2647
  // Protocol storage
2592
- e.object(T),
2648
+ e.object(_),
2593
2649
  // Reward fund
2594
2650
  e.pure.vector("string", i),
2595
2651
  // Asset IDs
2596
2652
  e.pure.vector("address", s),
2597
2653
  // Rule IDs
2598
- h(r?.accountCap || y, e.object)
2654
+ h(r?.accountCap || g, e.object)
2599
2655
  // Account capability
2600
2656
  ],
2601
2657
  typeArguments: [f]
2602
- }), [B] = e.moveCall({
2658
+ }), [T] = e.moveCall({
2603
2659
  target: "0x2::coin::from_balance",
2604
- arguments: [I],
2660
+ arguments: [j],
2605
2661
  typeArguments: [f]
2606
2662
  });
2607
2663
  e.transferObjects(
2608
- [B],
2609
- h(r?.accountCap || w, e.pure.address)
2664
+ [T],
2665
+ h(r?.accountCap || b, e.pure.address)
2610
2666
  );
2611
2667
  } else
2612
2668
  e.moveCall({
@@ -2618,7 +2674,7 @@ async function Ir(e, t, r) {
2618
2674
  // Incentive V3 contract
2619
2675
  e.object(d.storage),
2620
2676
  // Protocol storage
2621
- e.object(T),
2677
+ e.object(_),
2622
2678
  // Reward fund
2623
2679
  e.pure.vector("string", i),
2624
2680
  // Asset IDs
@@ -2631,31 +2687,31 @@ async function Ir(e, t, r) {
2631
2687
  return a;
2632
2688
  }
2633
2689
  export {
2634
- oe as Address,
2690
+ ie as Address,
2635
2691
  v as DEFAULT_CACHE_TIME,
2636
- R as DEFAULT_MARKET_IDENTITY,
2692
+ z as DEFAULT_MARKET_IDENTITY,
2637
2693
  Wt as FlashLoanAssetConfig,
2638
2694
  qt as IncentiveAPYInfo,
2639
2695
  Le as IncentivePoolInfo,
2640
2696
  zt as IncentivePoolInfoByPhase,
2641
- F as MARKETS,
2697
+ L as MARKETS,
2642
2698
  Ct as Market,
2643
2699
  Ke as NaviMissingGraphQLClientError,
2644
2700
  Gt as OracleInfo,
2645
2701
  et as PUBLIC_MAINNET_GRPC_URL,
2646
- z as PoolOperator,
2702
+ H as PoolOperator,
2647
2703
  qe as ReserveDataInfo,
2648
- Ce as SuiPriceServiceConnection,
2704
+ Ie as SuiPriceServiceConnection,
2649
2705
  lt as SuiPythClient,
2650
- L as UserPositions,
2706
+ G as UserPositions,
2651
2707
  ze as UserStateInfo,
2652
2708
  er as borrowCoinPTB,
2653
- M as buildNaviOpenApiUrl,
2654
- Ir as claimLendingRewardsPTB,
2709
+ F as buildNaviOpenApiUrl,
2710
+ jr as claimLendingRewardsPTB,
2655
2711
  Yt as configureNaviSdk,
2656
- kt as createAccountCapPTB,
2712
+ It as createAccountCapPTB,
2657
2713
  ar as createEModeCapPTB,
2658
- ve as createNaviLegacyJsonRpcClient,
2714
+ ke as createNaviLegacyJsonRpcClient,
2659
2715
  rt as createNaviSuiClient,
2660
2716
  xe as createNaviSuiClientBundle,
2661
2717
  vt as depositCoinPTB,
@@ -2664,13 +2720,13 @@ export {
2664
2720
  or as exitEModePTB,
2665
2721
  Et as filterPriceFeeds,
2666
2722
  hr as flashloanPTB,
2667
- It as getAccountCapOwnerPTB,
2723
+ jt as getAccountCapOwnerPTB,
2668
2724
  Jt as getAddressBalance,
2669
- ne as getAllFlashLoanAssets,
2725
+ ae as getAllFlashLoanAssets,
2670
2726
  rr as getBorrowFee,
2671
2727
  Ht as getCoinObjectOnlyBalance,
2672
2728
  pr as getCoins,
2673
- j as getConfig,
2729
+ I as getConfig,
2674
2730
  Xt as getFees,
2675
2731
  gr as getFlashLoanAsset,
2676
2732
  ur as getHealthFactor,
@@ -2678,39 +2734,39 @@ export {
2678
2734
  Pt as getLendingPositions,
2679
2735
  sr as getLendingState,
2680
2736
  nr as getMarket,
2681
- _ as getMarketConfig,
2682
- jt as getMarkets,
2683
- S as getPool,
2684
- G as getPools,
2685
- $e as getPriceFeeds,
2737
+ P as getMarketConfig,
2738
+ kt as getMarkets,
2739
+ E as getPool,
2740
+ J as getPools,
2741
+ Oe as getPriceFeeds,
2686
2742
  fr as getPythStalePriceFeedId,
2687
- St as getPythStalePriceFeedIdV2,
2743
+ At as getPythStalePriceFeedIdV2,
2688
2744
  lr as getSimulatedHealthFactor,
2689
- Pe as getSimulatedHealthFactorPTB,
2745
+ Ae as getSimulatedHealthFactorPTB,
2690
2746
  Zt as getStats,
2691
2747
  dr as getTransactions,
2692
2748
  vr as getUserAvailableLendingRewards,
2693
- kr as getUserClaimedRewardHistory,
2694
- Be as getUserEModeCaps,
2695
- jr as getUserTotalClaimedReward,
2696
- br as liquidatePTB,
2749
+ Ir as getUserClaimedRewardHistory,
2750
+ Se as getUserEModeCaps,
2751
+ kr as getUserTotalClaimedReward,
2752
+ wr as liquidatePTB,
2697
2753
  Kt as listAddressBalances,
2698
2754
  cr as mergeCoinsPTB,
2699
- U as mergeServiceHeaders,
2700
- be as normalizeAddressBalance,
2755
+ N as mergeServiceHeaders,
2756
+ Ce as normalizeAddressBalance,
2701
2757
  C as normalizeCoinType,
2702
- bt as parsePoolUID,
2758
+ wt as parsePoolUID,
2703
2759
  h as parseTxValue,
2704
2760
  tr as repayCoinPTB,
2705
- wr as repayFlashLoanPTB,
2761
+ br as repayFlashLoanPTB,
2706
2762
  Qt as requireNaviGraphQLClient,
2707
- O as resolveNaviOpenApiEndpoint,
2763
+ U as resolveNaviOpenApiEndpoint,
2708
2764
  Cr as summaryLendingRewards,
2709
2765
  yr as updateOraclePriceBeforeUserOperationPTB,
2710
- fe as updateOraclePricesPTB,
2766
+ ge as updateOraclePricesPTB,
2711
2767
  $t as updatePythPriceFeeds,
2712
2768
  mr as verifyHealthFactorPTB,
2713
- $ as withCache,
2769
+ O as withCache,
2714
2770
  A as withSingleton,
2715
2771
  xt as withdrawCoinPTB
2716
2772
  };