@naviprotocol/lending 2.0.5 → 2.0.6

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,23 +1,23 @@
1
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 Y, SUI_CLOCK_OBJECT_ID as x, fromBase64 as De } from "@mysten/sui/utils";
4
- import Fe from "lodash.camelcase";
3
+ import { toHex as Ue, fromHex as De, normalizeStructTag as Y, SUI_CLOCK_OBJECT_ID as x, fromBase64 as Fe } from "@mysten/sui/utils";
4
+ import Ne from "lodash.camelcase";
5
5
  import p from "bignumber.js";
6
- import { SuiJsonRpcClient as Ne } from "@mysten/sui/jsonRpc";
7
- import { SuiGraphQLClient as Re } from "@mysten/sui/graphql";
8
- import { SuiGrpcClient as he, GrpcWebFetchTransport as we } from "@mysten/sui/grpc";
6
+ import { SuiJsonRpcClient as Re } from "@mysten/sui/jsonRpc";
7
+ import { SuiGraphQLClient as Le } from "@mysten/sui/graphql";
8
+ import { SuiGrpcClient as we, GrpcWebFetchTransport as be } from "@mysten/sui/grpc";
9
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)
13
- }), qt = l.struct("IncentiveAPYInfo", {
11
+ input: (e) => De(e),
12
+ output: (e) => Ue(e)
13
+ }), zt = l.struct("IncentiveAPYInfo", {
14
14
  /** Asset identifier */
15
15
  asset_id: l.u8(),
16
16
  /** Annual Percentage Yield as a 256-bit integer */
17
17
  apy: l.u256(),
18
18
  /** List of supported coin types for this incentive */
19
19
  coin_types: l.vector(l.string())
20
- }), Le = l.struct("IncentivePoolInfo", {
20
+ }), qe = l.struct("IncentivePoolInfo", {
21
21
  /** Unique pool identifier */
22
22
  pool_id: ie,
23
23
  /** Address holding the incentive funds */
@@ -44,12 +44,12 @@ const ie = l.bytes(32).transform({
44
44
  available: l.u256(),
45
45
  /** Total amount of incentives */
46
46
  total: l.u256()
47
- }), zt = l.struct("IncentivePoolInfoByPhase", {
47
+ }), Gt = l.struct("IncentivePoolInfoByPhase", {
48
48
  /** Phase number */
49
49
  phase: l.u64(),
50
50
  /** List of incentive pools in this phase */
51
- pools: l.vector(Le)
52
- }), Gt = l.struct("OracleInfo", {
51
+ pools: l.vector(qe)
52
+ }), Wt = l.struct("OracleInfo", {
53
53
  /** Oracle identifier */
54
54
  oracle_id: l.u8(),
55
55
  /** Current price as a 256-bit integer */
@@ -58,7 +58,7 @@ const ie = l.bytes(32).transform({
58
58
  decimals: l.u8(),
59
59
  /** Whether the oracle data is valid */
60
60
  valid: l.bool()
61
- }), Wt = l.struct("FlashLoanAssetConfig", {
61
+ }), Ht = l.struct("FlashLoanAssetConfig", {
62
62
  /** Unique identifier for the flash loan asset */
63
63
  id: l.string(),
64
64
  /** Asset identifier */
@@ -75,7 +75,7 @@ const ie = l.bytes(32).transform({
75
75
  max: l.u64(),
76
76
  /** Minimum flash loan amount */
77
77
  min: l.u64()
78
- }), qe = l.struct("ReserveDataInfo", {
78
+ }), ze = l.struct("ReserveDataInfo", {
79
79
  /** Reserve identifier */
80
80
  id: l.u8(),
81
81
  /** Oracle identifier for price feeds */
@@ -122,26 +122,26 @@ const ie = l.bytes(32).transform({
122
122
  liquidation_bonus: l.u256(),
123
123
  /** Liquidation threshold */
124
124
  liquidation_threshold: l.u256()
125
- }), ze = l.struct("UserStateInfo", {
125
+ }), Ge = l.struct("UserStateInfo", {
126
126
  /** Asset identifier */
127
127
  asset_id: l.u8(),
128
128
  /** User's current borrow balance */
129
129
  borrow_balance: l.u256(),
130
130
  /** User's current supply balance */
131
131
  supply_balance: l.u256()
132
- }), Ge = "2.0.5", V = {
133
- version: Ge
134
- }, We = V.version, He = () => {
132
+ }), We = "2.0.6", V = {
133
+ version: We
134
+ }, He = V.version, Je = () => {
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}`;
138
138
  }
139
139
  return "Node/Unknown";
140
- }, Je = () => {
140
+ }, Ke = () => {
141
141
  let e = "";
142
- return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${We} (${He()})`), e;
143
- }, ce = Je(), be = "0x2::sui::SUI";
144
- class Ke extends Error {
142
+ return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${He} (${Je()})`), e;
143
+ }, ce = Ke(), ve = "0x2::sui::SUI";
144
+ class Qe extends Error {
145
145
  constructor(t) {
146
146
  super(
147
147
  `NAVI Sui SDK capability "${t}" requires an explicit graphql client; no public GraphQL fallback is configured`
@@ -151,22 +151,22 @@ class Ke extends Error {
151
151
  function ee(e) {
152
152
  return e == null ? void 0 : String(e);
153
153
  }
154
- function Qe(e, t) {
154
+ function Ye(e, t) {
155
155
  return (BigInt(e) + BigInt(t)).toString();
156
156
  }
157
- function Ye(e, t) {
157
+ function Ze(e, t) {
158
158
  return (BigInt(e) - BigInt(t)).toString();
159
159
  }
160
- function ve(e) {
160
+ function Ce(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 Ce(e, t = be) {
166
+ function je(e, t = ve) {
167
167
  const r = ee(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
168
  let o = ee(e.balance ?? e.totalBalance), n = ee(e.coinBalance);
169
- return !n && o && (n = Ye(o, r)), !o && n && (o = Qe(n, r)), {
169
+ return !n && o && (n = Ze(o, r)), !o && n && (o = Ye(n, r)), {
170
170
  coinType: Y(e.coinType ?? t),
171
171
  totalBalance: o ?? "0",
172
172
  coinBalance: n ?? "0",
@@ -174,77 +174,77 @@ function Ce(e, t = be) {
174
174
  ...e.coinObjectCount === null || e.coinObjectCount === void 0 ? {} : { coinObjectCount: e.coinObjectCount }
175
175
  };
176
176
  }
177
- function Ht(e, t = be) {
177
+ function Jt(e, t = ve) {
178
178
  const r = Y(t);
179
179
  return e.filter((o) => Y(o.coinType) === r).reduce((o, n) => o + BigInt(n.balance), 0n).toString();
180
180
  }
181
- async function Jt(e, t) {
182
- const r = await ve(e).getBalance(t), o = r.balance;
183
- return Ce((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
- }
185
181
  async function Kt(e, t) {
186
- const r = await ve(e).listBalances(t), { balances: o = [] } = r;
182
+ const r = await Ce(e).getBalance(t), o = r.balance;
183
+ return je((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
+ }
185
+ async function Qt(e, t) {
186
+ const r = await Ce(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => Ce(n)),
188
+ balances: o.map((n) => je(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
192
- function Ze(e, t) {
192
+ function Xe(e, t) {
193
193
  if ("client" in t)
194
194
  return t.client;
195
- const r = new we({
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 he({
201
+ return new we({
202
202
  network: e,
203
203
  transport: r
204
204
  });
205
205
  }
206
- function Xe(e, t) {
207
- return "client" in t ? t.client : new Re({
206
+ function xe(e, t) {
207
+ return "client" in t ? t.client : new Le({
208
208
  network: e,
209
209
  url: t.url,
210
210
  headers: t.headers,
211
211
  fetch: t.fetch
212
212
  });
213
213
  }
214
- function je(e, t) {
215
- return "client" in t ? t.client : new Ne({
214
+ function Ie(e, t) {
215
+ return "client" in t ? t.client : new Re({
216
216
  network: e,
217
217
  url: t.url
218
218
  });
219
219
  }
220
- function xe(e) {
221
- const t = Ze(e.network, e.grpc);
220
+ function et(e) {
221
+ const t = Xe(e.network, e.grpc);
222
222
  return {
223
223
  network: e.network,
224
224
  coreClient: t,
225
225
  grpc: t,
226
- graphql: e.graphql ? Xe(e.network, e.graphql) : void 0,
227
- legacyJsonRpc: e.legacyJsonRpc ? je(e.network, e.legacyJsonRpc) : void 0,
226
+ graphql: e.graphql ? xe(e.network, e.graphql) : void 0,
227
+ legacyJsonRpc: e.legacyJsonRpc ? Ie(e.network, e.legacyJsonRpc) : void 0,
228
228
  services: e.services
229
229
  };
230
230
  }
231
- function Qt(e, t) {
231
+ function Yt(e, t) {
232
232
  if (!e.graphql)
233
- throw new Ke(t);
233
+ throw new Qe(t);
234
234
  return e.graphql;
235
235
  }
236
- const et = "https://fullnode.mainnet.sui.io:443";
236
+ const tt = "https://fullnode.mainnet.sui.io:443";
237
237
  let te;
238
- function tt() {
239
- return te || (te = new he({
238
+ function rt() {
239
+ return te || (te = new we({
240
240
  network: "mainnet",
241
- transport: new we({ baseUrl: et })
241
+ transport: new be({ baseUrl: tt })
242
242
  })), te;
243
243
  }
244
- function rt(e, t = "mainnet") {
245
- return e ? typeof e == "string" ? je(t, { url: e }) : xe(e) : tt();
244
+ function nt(e, t = "mainnet") {
245
+ return e ? typeof e == "string" ? Ie(t, { url: e }) : et(e) : rt();
246
246
  }
247
- const nt = 16 * 1024;
247
+ const ot = 16 * 1024;
248
248
  function oe(e) {
249
249
  return e.replace(/^0x/i, "");
250
250
  }
@@ -254,12 +254,12 @@ function se(e) {
254
254
  r[o] = parseInt(t.slice(o * 2, o * 2 + 2), 16);
255
255
  return r;
256
256
  }
257
- function ot(e, t) {
257
+ function at(e, t) {
258
258
  return (e[t] << 8) + e[t + 1];
259
259
  }
260
260
  function ue(e) {
261
261
  return l.vector(l.U8).serialize(Array.from(e), {
262
- maxSize: nt
262
+ maxSize: ot
263
263
  });
264
264
  }
265
265
  function le(e, t) {
@@ -268,17 +268,17 @@ function le(e, t) {
268
268
  bcs: t
269
269
  };
270
270
  }
271
- function at(e) {
271
+ function it(e) {
272
272
  return l.vector(l.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
273
273
  }
274
- function it(e) {
274
+ function ct(e) {
275
275
  return l.struct("PriceIdentifier", {
276
276
  bytes: l.vector(l.U8)
277
277
  }).serialize({
278
278
  bytes: Array.from(e)
279
279
  }).toBytes();
280
280
  }
281
- function ct(e) {
281
+ function st(e) {
282
282
  const t = [];
283
283
  let r = 0, o = 0;
284
284
  for (let n = 0; n < e.length; n += 1) {
@@ -287,19 +287,19 @@ function ct(e) {
287
287
  }
288
288
  return t.push(e.slice(o).trim()), t;
289
289
  }
290
- function st(e) {
290
+ function ut(e) {
291
291
  const r = e.indexOf("::table::Table"), o = e.indexOf("<", r), n = e.lastIndexOf(">"), a = "::price_identifier::PriceIdentifier";
292
292
  if (r < 0 || o < 0 || n <= o)
293
293
  throw new Error(`Unexpected Pyth price table type: ${e}`);
294
- const [c, i] = ct(e.slice(o + 1, n));
294
+ const [c, i] = st(e.slice(o + 1, n));
295
295
  if (!c?.endsWith(a) || !i?.endsWith("::object::ID"))
296
296
  throw new Error(`Unexpected Pyth price table type arguments: ${e}`);
297
297
  return c.slice(0, -a.length);
298
298
  }
299
- function ut(e) {
299
+ function lt(e) {
300
300
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
301
301
  }
302
- class Ie {
302
+ class ke {
303
303
  constructor(t, r) {
304
304
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
305
305
  }
@@ -327,7 +327,7 @@ class Ie {
327
327
  throw new Error(`Unsupported Hermes price update encoding: ${o}`);
328
328
  if (n.length === 0)
329
329
  throw new Error("Hermes price update response did not include binary update data");
330
- return n.map(ut);
330
+ return n.map(lt);
331
331
  }
332
332
  async get(t, r, o) {
333
333
  const n = new AbortController(), a = setTimeout(() => n.abort(), this.timeout), c = new URL(`${this.endpoint}${t}`);
@@ -347,7 +347,7 @@ class Ie {
347
347
  }
348
348
  }
349
349
  }
350
- class lt {
350
+ class dt {
351
351
  constructor(t, r, o) {
352
352
  this.provider = t, this.pythStateId = r, this.wormholeStateId = o, this.priceFeedObjectIdCache = /* @__PURE__ */ new Map();
353
353
  }
@@ -504,7 +504,7 @@ class lt {
504
504
  if (c) {
505
505
  const { dynamicField: i } = await c.getDynamicField({
506
506
  parentId: o,
507
- name: le(a, it(se(r)))
507
+ name: le(a, ct(se(r)))
508
508
  }), s = i?.value?.bcs;
509
509
  this.priceFeedObjectIdCache.set(
510
510
  r,
@@ -524,7 +524,7 @@ class lt {
524
524
  }
525
525
  async getPriceTableInfo() {
526
526
  if (!this.priceTableInfo) {
527
- const t = this.getCoreProvider() ? le("vector<u8>", at("price_info")) : {
527
+ const t = this.getCoreProvider() ? le("vector<u8>", it("price_info")) : {
528
528
  type: "vector<u8>",
529
529
  value: "price_info"
530
530
  }, r = await this.getDynamicMoveObjectJson(this.pythStateId, t);
@@ -532,22 +532,22 @@ class lt {
532
532
  throw new Error("Price Table not found, contract may not be initialized");
533
533
  this.priceTableInfo = {
534
534
  id: r.objectId,
535
- fieldType: st(r.type)
535
+ fieldType: ut(r.type)
536
536
  };
537
537
  }
538
538
  return this.priceTableInfo;
539
539
  }
540
540
  extractVaaBytesFromAccumulatorMessage(t) {
541
- const o = 7 + t[6] + 1, n = ot(t, o), a = o + 2;
541
+ const o = 7 + t[6] + 1, n = at(t, o), a = o + 2;
542
542
  return t.subarray(a, a + n);
543
543
  }
544
544
  }
545
- const dt = "https://open-api.naviprotocol.io/api";
546
- let Q = {}, ke = 0;
547
- function pt(e) {
545
+ const pt = "https://open-api.naviprotocol.io/api";
546
+ let Q = {}, _e = 0;
547
+ function mt(e) {
548
548
  return e.replace(/\/+$/, "");
549
549
  }
550
- function Yt(e) {
550
+ function Zt(e) {
551
551
  Q = {
552
552
  ...Q,
553
553
  ...e,
@@ -555,15 +555,15 @@ function Yt(e) {
555
555
  ...Q.services,
556
556
  ...e.services
557
557
  }
558
- }, ke += 1;
558
+ }, _e += 1;
559
559
  }
560
560
  function de() {
561
- return ke;
561
+ return _e;
562
562
  }
563
563
  function M(e) {
564
564
  const t = e?.services?.naviOpenApi ?? Q.services?.naviOpenApi;
565
565
  return {
566
- baseUrl: pt(t?.baseUrl ?? dt),
566
+ baseUrl: mt(t?.baseUrl ?? pt),
567
567
  headers: t?.headers
568
568
  };
569
569
  }
@@ -571,7 +571,7 @@ function F(e, t) {
571
571
  const r = M(t), o = e.startsWith("/") ? e : `/${e}`;
572
572
  return `${r.baseUrl}${o}`;
573
573
  }
574
- function mt(e) {
574
+ function ft(e) {
575
575
  if (e instanceof Headers) {
576
576
  const t = {};
577
577
  return e.forEach((r, o) => {
@@ -582,15 +582,15 @@ function mt(e) {
582
582
  }
583
583
  function N(e, t) {
584
584
  return {
585
- ...mt(e),
585
+ ...ft(e),
586
586
  ...t?.headers ?? {}
587
587
  };
588
588
  }
589
- const U = rt();
589
+ const U = nt();
590
590
  function pe(e) {
591
- return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(De(e)) : [];
591
+ return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Fe(e)) : [];
592
592
  }
593
- function ft(e) {
593
+ function yt(e) {
594
594
  const t = e?.commandResults ?? [], r = e?.Transaction ?? e?.FailedTransaction ?? {}, o = r.effects?.errors?.[0] ?? r.effects?.status?.error ?? r.status?.error ?? r.status?.errors?.[0];
595
595
  return o && console.warn("[lending] devInspect(core simulate) returned error:", o), {
596
596
  effects: r.effects,
@@ -621,9 +621,9 @@ async function W(e, t) {
621
621
  commandResults: !0
622
622
  }
623
623
  });
624
- return ft(n);
624
+ return yt(n);
625
625
  }
626
- function _e(e) {
626
+ function Te(e) {
627
627
  return {
628
628
  json: !!e?.showContent,
629
629
  display: !!e?.showDisplay,
@@ -631,7 +631,7 @@ function _e(e) {
631
631
  objectBcs: !!e?.showBcs
632
632
  };
633
633
  }
634
- function Te(e) {
634
+ function Be(e) {
635
635
  return !e || e instanceof Error ? {
636
636
  error: e instanceof Error ? { code: "notFound", error: e.message } : void 0
637
637
  } : {
@@ -651,27 +651,27 @@ function Te(e) {
651
651
  }
652
652
  };
653
653
  }
654
- async function yt(e, t) {
654
+ async function gt(e, t) {
655
655
  const r = e?.core;
656
656
  if (typeof r?.getObject != "function")
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: _e(t.options)
660
+ include: Te(t.options)
661
661
  });
662
- return Te(o);
662
+ return Be(o);
663
663
  }
664
- async function gt(e, t) {
664
+ async function ht(e, t) {
665
665
  const r = e?.core;
666
666
  if (typeof r?.getObjects != "function")
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: _e(t.options)
670
+ include: Te(t.options)
671
671
  });
672
- return o.map(Te);
672
+ return o.map(Be);
673
673
  }
674
- function Be(e) {
674
+ function Pe(e) {
675
675
  const t = [];
676
676
  let r = !1;
677
677
  return e.forEach((o, n) => {
@@ -688,7 +688,7 @@ function Be(e) {
688
688
  function S(e) {
689
689
  const t = {};
690
690
  return (...r) => {
691
- const o = Be(r);
691
+ const o = Pe(r);
692
692
  return t[o] || (t[o] = e(...r).finally(() => {
693
693
  delete t[o];
694
694
  })), t[o];
@@ -697,7 +697,7 @@ function S(e) {
697
697
  function O(e) {
698
698
  let t = {};
699
699
  return (...r) => {
700
- const o = r[r.length - 1], n = Be(r), a = t[n];
700
+ const o = r[r.length - 1], n = Pe(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()
@@ -708,7 +708,7 @@ function re(e) {
708
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)]: re(e[r])
711
+ [Ne(r)]: re(e[r])
712
712
  }),
713
713
  {}
714
714
  ) : e;
@@ -718,7 +718,7 @@ function h(e, t) {
718
718
  throw new Error("Transaction value is required");
719
719
  return typeof e == "object" ? e : t(e);
720
720
  }
721
- function ht(e, t) {
721
+ function wt(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
724
  function Z(e, t, r) {
@@ -732,16 +732,16 @@ function Z(e, t, r) {
732
732
  function C(e) {
733
733
  return Y(e);
734
734
  }
735
- function Pe(e) {
735
+ function Ae(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 Ie("https://hermes.pyth.network", {
739
+ new ke("https://hermes.pyth.network", {
740
740
  timeout: 2e4
741
741
  });
742
- const wt = 27, me = (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
746
  }, R = ce ? {
747
747
  "User-Agent": ce
@@ -772,7 +772,7 @@ function K(e, t) {
772
772
  isEMode: !0
773
773
  };
774
774
  }
775
- function bt(e) {
775
+ function vt(e) {
776
776
  const [t, r] = e.split("-");
777
777
  return !t || !r ? null : {
778
778
  marketKey: t,
@@ -812,7 +812,7 @@ const J = O(
812
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 = vt(e);
816
816
  a && (r = a.marketKey, e = a.poolId);
817
817
  }
818
818
  const o = await J({
@@ -827,14 +827,14 @@ async function E(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 = O(
830
+ const Xt = O(
831
831
  S(async (e) => {
832
832
  const t = M(e), r = F(`/navi/stats?sdk=${V.version}`, e);
833
833
  return (await fetch(r, {
834
834
  headers: N(R, t)
835
835
  }).then((n) => n.json())).data;
836
836
  })
837
- ), Xt = O(
837
+ ), xt = O(
838
838
  S(
839
839
  async (e) => {
840
840
  const t = M(e), r = F(`/navi/fee?sdk=${V.version}`, e);
@@ -844,7 +844,7 @@ const Zt = O(
844
844
  }
845
845
  )
846
846
  );
847
- async function vt(e, t, r, o) {
847
+ async function Ct(e, t, r, o) {
848
848
  const n = await I({
849
849
  ...o,
850
850
  cacheTime: v
@@ -892,7 +892,7 @@ async function vt(e, t, r, o) {
892
892
  arguments: [e.object(a.contract.pool), e.object("0x05")]
893
893
  }), e;
894
894
  }
895
- async function xt(e, t, r, o) {
895
+ async function er(e, t, r, o) {
896
896
  const n = await I({
897
897
  ...o,
898
898
  cacheTime: v
@@ -975,7 +975,7 @@ async function xt(e, t, r, o) {
975
975
  typeArguments: [a.suiCoinType]
976
976
  });
977
977
  }
978
- async function er(e, t, r, o) {
978
+ async function tr(e, t, r, o) {
979
979
  const n = await I({
980
980
  ...o,
981
981
  cacheTime: v
@@ -1061,7 +1061,7 @@ async function er(e, t, r, o) {
1061
1061
  typeArguments: [a.suiCoinType]
1062
1062
  });
1063
1063
  }
1064
- async function tr(e, t, r, o) {
1064
+ async function rr(e, t, r, o) {
1065
1065
  const n = await I({
1066
1066
  ...o,
1067
1067
  cacheTime: v
@@ -1114,7 +1114,7 @@ async function tr(e, t, r, o) {
1114
1114
  typeArguments: [a.suiCoinType]
1115
1115
  }), e;
1116
1116
  }
1117
- const rr = O(
1117
+ const nr = O(
1118
1118
  S(
1119
1119
  async (e) => {
1120
1120
  const t = await I({
@@ -1144,7 +1144,7 @@ const rr = O(
1144
1144
  a
1145
1145
  );
1146
1146
  }
1147
- const n = (await yt(r, {
1147
+ const n = (await gt(r, {
1148
1148
  id: t.incentiveV3,
1149
1149
  options: { showType: !0, showOwner: !0, showContent: !0 }
1150
1150
  })).data.content.fields.borrow_fee_rate;
@@ -1173,7 +1173,7 @@ const rr = O(
1173
1173
  name: "Sui Eco Market"
1174
1174
  }
1175
1175
  };
1176
- class Ct {
1176
+ class jt {
1177
1177
  constructor(t, r) {
1178
1178
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1179
1179
  marketTotalSupplyValue: "0",
@@ -1241,7 +1241,7 @@ const P = (e) => {
1241
1241
  if (!r)
1242
1242
  throw new Error("Market not found");
1243
1243
  return r;
1244
- }, jt = O(
1244
+ }, It = O(
1245
1245
  S(
1246
1246
  async (e, t) => {
1247
1247
  const r = await J({
@@ -1251,13 +1251,13 @@ const P = (e) => {
1251
1251
  });
1252
1252
  return e.map((o) => {
1253
1253
  const n = P(o), a = r.filter((c) => c.market === n.key);
1254
- return new Ct(o, a);
1254
+ return new jt(o, a);
1255
1255
  });
1256
1256
  }
1257
1257
  )
1258
- ), nr = O(
1258
+ ), or = O(
1259
1259
  S(
1260
- async (e, t) => (await jt([e], t))[0]
1260
+ async (e, t) => (await It([e], t))[0]
1261
1261
  )
1262
1262
  ), I = O(
1263
1263
  S(
@@ -1272,7 +1272,7 @@ const P = (e) => {
1272
1272
  }
1273
1273
  )
1274
1274
  ), v = 1e3 * 60 * 5;
1275
- async function It(e, t) {
1275
+ async function kt(e, t) {
1276
1276
  const r = await I({
1277
1277
  cacheTime: v,
1278
1278
  ...t
@@ -1282,7 +1282,7 @@ async function It(e, t) {
1282
1282
  arguments: []
1283
1283
  });
1284
1284
  }
1285
- async function kt(e, t, r) {
1285
+ async function _t(e, t, r) {
1286
1286
  const o = await I({
1287
1287
  cacheTime: v,
1288
1288
  ...r
@@ -1292,7 +1292,7 @@ async function kt(e, t, r) {
1292
1292
  arguments: [t]
1293
1293
  });
1294
1294
  }
1295
- async function _t(e, t, r) {
1295
+ async function Tt(e, t, r) {
1296
1296
  const o = await I({
1297
1297
  ...r,
1298
1298
  cacheTime: v
@@ -1309,7 +1309,7 @@ async function _t(e, t, r) {
1309
1309
  arguments: [e.object(o.storage), h(t, e.pure.u64)]
1310
1310
  }), e;
1311
1311
  }
1312
- async function or(e, t) {
1312
+ async function ar(e, t) {
1313
1313
  const r = await I({
1314
1314
  ...t,
1315
1315
  cacheTime: v
@@ -1322,16 +1322,16 @@ async function or(e, t) {
1322
1322
  arguments: [e.object(r.storage)]
1323
1323
  }), e;
1324
1324
  }
1325
- async function ar(e, t, r) {
1325
+ async function ir(e, t, r) {
1326
1326
  const o = await I({
1327
1327
  cacheTime: v,
1328
1328
  ...r
1329
- }), n = await It(e, r);
1330
- await _t(e, t, {
1329
+ }), n = await kt(e, r);
1330
+ await Tt(e, t, {
1331
1331
  ...r,
1332
1332
  accountCap: n
1333
1333
  });
1334
- const a = await P(r?.market || z), c = await kt(e, n, r);
1334
+ const a = await P(r?.market || z), c = await _t(e, n, r);
1335
1335
  return e.moveCall({
1336
1336
  target: `${o.emode.contract.registryPackage}::registry::register_emode_for_account_cap`,
1337
1337
  arguments: [
@@ -1342,7 +1342,7 @@ async function ar(e, t, r) {
1342
1342
  ]
1343
1343
  }), n;
1344
1344
  }
1345
- const Ae = O(
1345
+ const Se = O(
1346
1346
  S(
1347
1347
  async (e, t) => {
1348
1348
  const r = await I({
@@ -1365,21 +1365,21 @@ const Ae = O(
1365
1365
  }
1366
1366
  )
1367
1367
  );
1368
- function ir(e) {
1368
+ function cr(e) {
1369
1369
  return `${P(e.marketId).key}-${e.emodeId}`;
1370
1370
  }
1371
- function Tt(e, t) {
1371
+ function Bt(e, t) {
1372
1372
  return e.coinType ? e.coinType : t || (typeof e.type == "string" ? e.type.match(/::coin::Coin<(.+)>$/) : null)?.[1];
1373
1373
  }
1374
1374
  function ye(e, t) {
1375
- const r = Tt(e, t), o = e.coinObjectId ?? e.objectId;
1375
+ const r = Bt(e, t), o = e.coinObjectId ?? e.objectId;
1376
1376
  return !r || !o || e.balance === void 0 || e.balance === null ? null : {
1377
1377
  ...e,
1378
1378
  coinType: C(r),
1379
1379
  coinObjectId: o
1380
1380
  };
1381
1381
  }
1382
- function cr(e, t, r) {
1382
+ function sr(e, t, r) {
1383
1383
  const o = typeof r?.balance == "number", n = o ? r.balance : 0, a = BigInt(r?.addressBalance ?? 0);
1384
1384
  let c = 0;
1385
1385
  const i = [];
@@ -1424,7 +1424,7 @@ function cr(e, t, r) {
1424
1424
  $ = T;
1425
1425
  return D.length > 0 && e.mergeCoins($, D), i.length === 0 ? $ : o ? e.splitCoins($, [e.pure.u64(n)]) : $;
1426
1426
  }
1427
- async function Se(e, t, r, o, n, a, c) {
1427
+ async function $e(e, t, r, o, n, a, c) {
1428
1428
  const i = await I({
1429
1429
  ...c,
1430
1430
  cacheTime: v
@@ -1435,7 +1435,7 @@ async function Se(e, t, r, o, n, a, c) {
1435
1435
  e.object("0x06"),
1436
1436
  e.object(i.storage),
1437
1437
  e.object(i.oracle.priceOracle),
1438
- ht(e, s),
1438
+ wt(e, s),
1439
1439
  h(t, e.pure.address),
1440
1440
  h(s.id, e.pure.u8),
1441
1441
  h(o, e.pure.u64),
@@ -1445,10 +1445,10 @@ async function Se(e, t, r, o, n, a, c) {
1445
1445
  typeArguments: [s.suiCoinType]
1446
1446
  });
1447
1447
  }
1448
- async function Bt(e, t, r) {
1449
- return Se(e, t, 0, 0, 0, !1, r);
1448
+ async function Pt(e, t, r) {
1449
+ return $e(e, t, 0, 0, 0, !1, r);
1450
1450
  }
1451
- async function $e(e, t, r) {
1451
+ async function Ee(e, t, r) {
1452
1452
  const o = new q(), n = r?.client ?? U, a = await J({
1453
1453
  ...r,
1454
1454
  markets: Object.values(L)
@@ -1481,7 +1481,7 @@ async function $e(e, t, r) {
1481
1481
  })).results || [], w = {};
1482
1482
  s.forEach((d, f) => {
1483
1483
  try {
1484
- const b = m[f]?.returnValues?.map((_) => l.vector(qe).parse(Uint8Array.from(_[0])))[0] || [], j = {};
1484
+ const b = m[f]?.returnValues?.map((_) => l.vector(ze).parse(Uint8Array.from(_[0])))[0] || [], j = {};
1485
1485
  for (const _ of b)
1486
1486
  j[_.id] = {
1487
1487
  supplyIndex: _.supply_index,
@@ -1495,7 +1495,7 @@ async function $e(e, t, r) {
1495
1495
  );
1496
1496
  }
1497
1497
  });
1498
- const g = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(ze).parse(Uint8Array.from(f[0])))[0] || []), y = [];
1498
+ const g = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(Ge).parse(Uint8Array.from(f[0])))[0] || []), y = [];
1499
1499
  return g.forEach((d, f) => {
1500
1500
  const b = t[f], j = P(b.market), _ = w[j.key] || {};
1501
1501
  d.forEach((k) => {
@@ -1504,10 +1504,10 @@ async function $e(e, t, r) {
1504
1504
  const T = c[`${j.key}-${k.asset_id}`];
1505
1505
  if (!T)
1506
1506
  return;
1507
- const $ = _[k.asset_id], D = $?.supplyIndex ?? T.currentSupplyIndex, B = $?.borrowIndex ?? T.currentBorrowIndex, X = me(k.supply_balance, D).toString(), Ve = me(k.borrow_balance, B).toString();
1507
+ const $ = _[k.asset_id], D = $?.supplyIndex ?? T.currentSupplyIndex, B = $?.borrowIndex ?? T.currentBorrowIndex, X = me(k.supply_balance, D).toString(), Me = me(k.borrow_balance, B).toString();
1508
1508
  y.push({
1509
1509
  supplyBalance: X,
1510
- borrowBalance: Ve,
1510
+ borrowBalance: Me,
1511
1511
  assetId: k.asset_id,
1512
1512
  market: j.key,
1513
1513
  pool: T,
@@ -1516,25 +1516,25 @@ async function $e(e, t, r) {
1516
1516
  });
1517
1517
  }), y;
1518
1518
  }
1519
- const sr = O(
1519
+ const ur = O(
1520
1520
  async (e, t) => {
1521
1521
  const o = (t?.markets || Object.keys(L)).map((n) => P(n)).map((n) => ({
1522
1522
  address: e,
1523
1523
  market: n.key
1524
1524
  }));
1525
- return await $e(e, o, t);
1525
+ return await Ee(e, o, t);
1526
1526
  }
1527
1527
  );
1528
- async function ur(e, t) {
1528
+ async function lr(e, t) {
1529
1529
  const r = t?.client ?? U, o = new q();
1530
- await Bt(o, e, t);
1530
+ await Pt(o, e, t);
1531
1531
  const n = await W(r, {
1532
1532
  transactionBlock: o,
1533
1533
  sender: e
1534
1534
  }), a = Z(n, [l.u256()]);
1535
- return Pe(Number(a[0]) || 0);
1535
+ return Ae(Number(a[0]) || 0);
1536
1536
  }
1537
- async function lr(e, t, r, o) {
1537
+ async function dr(e, t, r, o) {
1538
1538
  const n = o?.client ?? U, a = new q();
1539
1539
  let c = 0, i = 0;
1540
1540
  const s = await E(t, o);
@@ -1543,7 +1543,7 @@ async function lr(e, t, r, o) {
1543
1543
  }), c * i < 0)
1544
1544
  throw new Error("Invalid operations");
1545
1545
  const u = c > 0 || i > 0;
1546
- await Se(
1546
+ await $e(
1547
1547
  a,
1548
1548
  e,
1549
1549
  s,
@@ -1556,9 +1556,9 @@ async function lr(e, t, r, o) {
1556
1556
  transactionBlock: a,
1557
1557
  sender: e
1558
1558
  }), w = Z(m, [l.u256()]);
1559
- return Pe(Number(w[0]) || 0);
1559
+ return Ae(Number(w[0]) || 0);
1560
1560
  }
1561
- const dr = S(
1561
+ const pr = S(
1562
1562
  async (e, t) => {
1563
1563
  const r = new URLSearchParams();
1564
1564
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
@@ -1571,7 +1571,7 @@ const dr = S(
1571
1571
  }).then((c) => c.json())).data;
1572
1572
  }
1573
1573
  );
1574
- async function pr(e, t) {
1574
+ async function mr(e, t) {
1575
1575
  let r = null;
1576
1576
  const o = [], n = t?.client ?? U, a = n.core;
1577
1577
  do {
@@ -1644,9 +1644,9 @@ async function pr(e, t) {
1644
1644
  } while (r);
1645
1645
  return o;
1646
1646
  }
1647
- const Pt = O(
1647
+ const At = O(
1648
1648
  async (e, t) => {
1649
- const r = [], o = (t?.markets || Object.keys(L)).map((i) => P(i)), n = await Ae(e, t), a = o.map((i) => ({
1649
+ const r = [], o = (t?.markets || Object.keys(L)).map((i) => P(i)), n = await Se(e, t), a = o.map((i) => ({
1650
1650
  address: e,
1651
1651
  market: i.key
1652
1652
  })).concat(
@@ -1656,7 +1656,7 @@ const Pt = O(
1656
1656
  emodeId: i.emodeId
1657
1657
  }))
1658
1658
  );
1659
- return (await $e(e, a, t)).forEach((i) => {
1659
+ return (await Ee(e, a, t)).forEach((i) => {
1660
1660
  const s = typeof i.emodeId == "number" ? n.find((u) => {
1661
1661
  const m = P(i.market);
1662
1662
  return u.emodeId === i.emodeId && u.marketId === m.id;
@@ -1982,7 +1982,7 @@ class G {
1982
1982
  };
1983
1983
  }
1984
1984
  }
1985
- async function mr(e, t, r, o) {
1985
+ async function fr(e, t, r, o) {
1986
1986
  const n = await I({
1987
1987
  ...o,
1988
1988
  cacheTime: v
@@ -1998,33 +1998,37 @@ async function mr(e, t, r, o) {
1998
1998
  ]
1999
1999
  });
2000
2000
  }
2001
- const Ee = new Ie("https://hermes.pyth.network", {
2002
- timeout: 1e4
2003
- });
2004
- async function fr(e) {
2001
+ const ge = /* @__PURE__ */ new Map(), Oe = (e) => {
2002
+ const t = e ?? "https://hermes.pyth.network";
2003
+ let r = ge.get(t);
2004
+ return r || (r = new ke(t, { timeout: 1e4 }), ge.set(t, r)), r;
2005
+ };
2006
+ async function yr(e, t) {
2005
2007
  try {
2006
- const t = [], r = await Ee.getLatestPriceFeeds(e);
2007
- if (!r) return t;
2008
- const o = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2009
- for (const n of r) {
2010
- const a = n.getPriceUnchecked();
2011
- if (a.publishTime > o) {
2008
+ const r = [], o = await I({ ...t, cacheTime: v }), n = await Oe(
2009
+ o.oracle.hermesEndpoint
2010
+ ).getLatestPriceFeeds(e);
2011
+ if (!n) return r;
2012
+ const a = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2013
+ for (const c of n) {
2014
+ const i = c.getPriceUnchecked();
2015
+ if (i.publishTime > a) {
2012
2016
  console.warn(
2013
- `pyth price feed is invalid, id: ${n.id}, publish time: ${a.publishTime}, current timestamp: ${o}`
2017
+ `pyth price feed is invalid, id: ${c.id}, publish time: ${i.publishTime}, current timestamp: ${a}`
2014
2018
  );
2015
2019
  continue;
2016
2020
  }
2017
- o - n.getPriceUnchecked().publishTime > 30 && (console.info(
2018
- `stale price feed, id: ${n.id}, publish time: ${a.publishTime}, current timestamp: ${o}`
2019
- ), t.push(n.id));
2021
+ a - c.getPriceUnchecked().publishTime > 30 && (console.info(
2022
+ `stale price feed, id: ${c.id}, publish time: ${i.publishTime}, current timestamp: ${a}`
2023
+ ), r.push(c.id));
2020
2024
  }
2021
- return t;
2022
- } catch (t) {
2023
- throw new Error(`failed to get pyth stale price feed id, msg: ${t.message}`);
2025
+ return r;
2026
+ } catch (r) {
2027
+ throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2024
2028
  }
2025
2029
  }
2026
- async function At(e, t) {
2027
- const r = [], o = t?.client ?? U, n = e.map((c) => c.priceInfoObject), a = await gt(o, {
2030
+ async function St(e, t) {
2031
+ const r = [], o = t?.client ?? U, n = e.map((c) => c.priceInfoObject), a = await ht(o, {
2028
2032
  ids: Array.from(new Set(n)),
2029
2033
  options: { showContent: !0 }
2030
2034
  });
@@ -2056,9 +2060,9 @@ async function At(e, t) {
2056
2060
  }
2057
2061
  return r;
2058
2062
  }
2059
- async function St(e, t) {
2063
+ async function $t(e, t) {
2060
2064
  try {
2061
- const r = [], o = await At(e, t);
2065
+ const r = [], o = await St(e, t);
2062
2066
  if (!o) return r;
2063
2067
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2064
2068
  for (const a of o) {
@@ -2078,14 +2082,16 @@ async function St(e, t) {
2078
2082
  throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2079
2083
  }
2080
2084
  }
2081
- async function $t(e, t, r) {
2085
+ async function Et(e, t, r) {
2082
2086
  const o = r?.client ?? U, n = await I({
2083
2087
  ...r,
2084
2088
  cacheTime: v
2085
2089
  });
2086
2090
  try {
2087
- const a = await Ee.getPriceFeedsUpdateData(t);
2088
- return await new lt(
2091
+ const a = await Oe(
2092
+ n.oracle.hermesEndpoint
2093
+ ).getPriceFeedsUpdateData(t);
2094
+ return await new dt(
2089
2095
  o,
2090
2096
  n.oracle.pythStateId,
2091
2097
  n.oracle.wormholeStateId
@@ -2094,7 +2100,7 @@ async function $t(e, t, r) {
2094
2100
  throw new Error(`failed to update pyth price feeds, msg: ${a.message}`);
2095
2101
  }
2096
2102
  }
2097
- async function ge(e, t, r) {
2103
+ async function he(e, t, r) {
2098
2104
  const o = await I({
2099
2105
  ...r,
2100
2106
  cacheTime: v
@@ -2104,12 +2110,12 @@ async function ge(e, t, r) {
2104
2110
  priceFeedId: c.pythPriceFeedId,
2105
2111
  priceInfoObject: c.pythPriceInfoObject,
2106
2112
  expiration: 30
2107
- })), a = await St(n, r);
2108
- a.length > 0 && await $t(e, a, r);
2113
+ })), a = await $t(n, r);
2114
+ a.length > 0 && await Et(e, a, r);
2109
2115
  }
2110
2116
  for (const n of t)
2111
2117
  e.moveCall({
2112
- target: `${o.oracle.packageId}::oracle_pro::update_single_price_v2`,
2118
+ target: `${o.oracle.packageId}::oracle_pro::${o.oracle.updateFunction ?? "update_single_price_v2"}`,
2113
2119
  arguments: [
2114
2120
  e.object("0x6"),
2115
2121
  // Clock object
@@ -2128,13 +2134,13 @@ async function ge(e, t, r) {
2128
2134
  });
2129
2135
  return e;
2130
2136
  }
2131
- async function Oe(e) {
2137
+ async function Ve(e) {
2132
2138
  return (await I({
2133
2139
  ...e,
2134
2140
  cacheTime: v
2135
2141
  })).oracle.feeds;
2136
2142
  }
2137
- function Et(e, t) {
2143
+ function Ot(e, t) {
2138
2144
  return e.filter((r) => !!(t?.lendingState && t.lendingState.find((n) => r.oracleId === n.pool.oracleId) || t?.lendingPositions && t.lendingPositions.find((n) => {
2139
2145
  if (![
2140
2146
  "navi-lending-supply",
@@ -2147,23 +2153,23 @@ function Et(e, t) {
2147
2153
  return r.oracleId === c?.oracleId;
2148
2154
  }) || t?.pools && t.pools.find((n) => r.oracleId === n.oracleId)));
2149
2155
  }
2150
- async function yr(e, t, r, o) {
2156
+ async function gr(e, t, r, o) {
2151
2157
  let n;
2152
2158
  try {
2153
- const a = await Oe({
2159
+ const a = await Ve({
2154
2160
  ...o
2155
2161
  }), c = [];
2156
2162
  r.forEach((u) => {
2157
2163
  c.includes(u.market) || c.push(u.market);
2158
2164
  });
2159
- const i = await Pt(t, {
2165
+ const i = await At(t, {
2160
2166
  ...o,
2161
2167
  markets: c
2162
2168
  });
2163
- return n = Et(a, {
2169
+ return n = Ot(a, {
2164
2170
  lendingPositions: i,
2165
2171
  pools: r
2166
- }), await ge(e, n, {
2172
+ }), await he(e, n, {
2167
2173
  updatePythPriceFeeds: !0,
2168
2174
  ...o
2169
2175
  });
@@ -2172,7 +2178,7 @@ async function yr(e, t, r, o) {
2172
2178
  throw a;
2173
2179
  if (console.error(a), n)
2174
2180
  try {
2175
- return await ge(e, n, {
2181
+ return await he(e, n, {
2176
2182
  ...o,
2177
2183
  updatePythPriceFeeds: !1
2178
2184
  });
@@ -2198,10 +2204,10 @@ const ae = O(
2198
2204
  }
2199
2205
  )
2200
2206
  );
2201
- async function gr(e, t) {
2207
+ async function hr(e, t) {
2202
2208
  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;
2203
2209
  }
2204
- async function hr(e, t, r, o) {
2210
+ async function wr(e, t, r, o) {
2205
2211
  const n = await I({
2206
2212
  ...o,
2207
2213
  cacheTime: v
@@ -2238,7 +2244,7 @@ async function hr(e, t, r, o) {
2238
2244
  return [s, u];
2239
2245
  }
2240
2246
  }
2241
- async function wr(e, t, r, o, n) {
2247
+ async function br(e, t, r, o, n) {
2242
2248
  const a = await I({
2243
2249
  ...n,
2244
2250
  cacheTime: v
@@ -2263,7 +2269,7 @@ async function wr(e, t, r, o, n) {
2263
2269
  });
2264
2270
  return [u];
2265
2271
  }
2266
- async function br(e, t, r, o, n, a) {
2272
+ async function vr(e, t, r, o, n, a) {
2267
2273
  const c = {
2268
2274
  ...a,
2269
2275
  cacheTime: v
@@ -2332,12 +2338,12 @@ async function br(e, t, r, o, n, a) {
2332
2338
  return [m, w];
2333
2339
  }
2334
2340
  }
2335
- async function Ot(e, t, r) {
2341
+ async function Vt(e, t, r) {
2336
2342
  const o = r?.client ?? U, n = await J({
2337
2343
  ...r,
2338
2344
  markets: Object.values(L),
2339
2345
  cacheTime: v
2340
- }), a = await Oe(r), c = [];
2346
+ }), a = await Ve(r), c = [];
2341
2347
  return await Promise.all(
2342
2348
  t.map(async (i) => {
2343
2349
  try {
@@ -2408,8 +2414,8 @@ async function Ot(e, t, r) {
2408
2414
  })
2409
2415
  ), c;
2410
2416
  }
2411
- async function vr(e, t) {
2412
- const r = (t?.markets || [L.main]).map((a) => P(a)), o = await Ae(e, t), n = r.map((a) => ({
2417
+ async function Cr(e, t) {
2418
+ const r = (t?.markets || [L.main]).map((a) => P(a)), o = await Se(e, t), n = r.map((a) => ({
2413
2419
  address: e,
2414
2420
  owner: e,
2415
2421
  market: a.key
@@ -2424,9 +2430,9 @@ async function vr(e, t) {
2424
2430
  };
2425
2431
  })
2426
2432
  );
2427
- return await Ot(e, n, t);
2433
+ return await Vt(e, n, t);
2428
2434
  }
2429
- function Cr(e) {
2435
+ function jr(e) {
2430
2436
  const t = /* @__PURE__ */ new Map();
2431
2437
  e.forEach((o) => {
2432
2438
  const n = o.assetId, a = o.option, c = `${n}-${a}-${o.rewardCoinType}-${o.market}`;
@@ -2455,7 +2461,7 @@ function Cr(e) {
2455
2461
  }))
2456
2462
  }));
2457
2463
  }
2458
- const jr = S(
2464
+ const Ir = S(
2459
2465
  async (e, t) => {
2460
2466
  const r = M(t), o = F(
2461
2467
  `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${V.version}&market=${t?.market || z}`,
@@ -2465,7 +2471,7 @@ const jr = S(
2465
2471
  headers: N(R, r)
2466
2472
  }).then((a) => a.json())).data;
2467
2473
  }
2468
- ), Ir = S(
2474
+ ), kr = S(
2469
2475
  async (e, t) => {
2470
2476
  const r = M(t), o = F(
2471
2477
  `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${V.version}&market=${t?.market || z}`,
@@ -2478,7 +2484,7 @@ const jr = S(
2478
2484
  });
2479
2485
  }
2480
2486
  );
2481
- async function kr(e, t, r) {
2487
+ async function _r(e, t, r) {
2482
2488
  const o = await J({
2483
2489
  ...r,
2484
2490
  markets: Object.values(L),
@@ -2594,7 +2600,7 @@ async function kr(e, t, r) {
2594
2600
  $.plus(u).isGreaterThan(D) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2595
2601
  [T],
2596
2602
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2597
- ) : await vt(e, j, T, {
2603
+ ) : await Ct(e, j, T, {
2598
2604
  ...r,
2599
2605
  market: j.market
2600
2606
  });
@@ -2660,84 +2666,84 @@ export {
2660
2666
  ie as Address,
2661
2667
  v as DEFAULT_CACHE_TIME,
2662
2668
  z as DEFAULT_MARKET_IDENTITY,
2663
- Wt as FlashLoanAssetConfig,
2664
- qt as IncentiveAPYInfo,
2665
- Le as IncentivePoolInfo,
2666
- zt as IncentivePoolInfoByPhase,
2669
+ Ht as FlashLoanAssetConfig,
2670
+ zt as IncentiveAPYInfo,
2671
+ qe as IncentivePoolInfo,
2672
+ Gt as IncentivePoolInfoByPhase,
2667
2673
  L as MARKETS,
2668
- Ct as Market,
2669
- Ke as NaviMissingGraphQLClientError,
2670
- Gt as OracleInfo,
2671
- et as PUBLIC_MAINNET_GRPC_URL,
2674
+ jt as Market,
2675
+ Qe as NaviMissingGraphQLClientError,
2676
+ Wt as OracleInfo,
2677
+ tt as PUBLIC_MAINNET_GRPC_URL,
2672
2678
  H as PoolOperator,
2673
- qe as ReserveDataInfo,
2674
- Ie as SuiPriceServiceConnection,
2675
- lt as SuiPythClient,
2679
+ ze as ReserveDataInfo,
2680
+ ke as SuiPriceServiceConnection,
2681
+ dt as SuiPythClient,
2676
2682
  G as UserPositions,
2677
- ze as UserStateInfo,
2678
- er as borrowCoinPTB,
2683
+ Ge as UserStateInfo,
2684
+ tr as borrowCoinPTB,
2679
2685
  F as buildNaviOpenApiUrl,
2680
- kr as claimLendingRewardsPTB,
2681
- Yt as configureNaviSdk,
2682
- It as createAccountCapPTB,
2683
- ar as createEModeCapPTB,
2684
- je as createNaviLegacyJsonRpcClient,
2685
- rt as createNaviSuiClient,
2686
- xe as createNaviSuiClientBundle,
2687
- vt as depositCoinPTB,
2688
- ir as emodeIdentityId,
2689
- _t as enterEModePTB,
2690
- or as exitEModePTB,
2691
- Et as filterPriceFeeds,
2692
- hr as flashloanPTB,
2693
- kt as getAccountCapOwnerPTB,
2694
- Jt as getAddressBalance,
2686
+ _r as claimLendingRewardsPTB,
2687
+ Zt as configureNaviSdk,
2688
+ kt as createAccountCapPTB,
2689
+ ir as createEModeCapPTB,
2690
+ Ie as createNaviLegacyJsonRpcClient,
2691
+ nt as createNaviSuiClient,
2692
+ et as createNaviSuiClientBundle,
2693
+ Ct as depositCoinPTB,
2694
+ cr as emodeIdentityId,
2695
+ Tt as enterEModePTB,
2696
+ ar as exitEModePTB,
2697
+ Ot as filterPriceFeeds,
2698
+ wr as flashloanPTB,
2699
+ _t as getAccountCapOwnerPTB,
2700
+ Kt as getAddressBalance,
2695
2701
  ae as getAllFlashLoanAssets,
2696
- rr as getBorrowFee,
2697
- Ht as getCoinObjectOnlyBalance,
2698
- pr as getCoins,
2702
+ nr as getBorrowFee,
2703
+ Jt as getCoinObjectOnlyBalance,
2704
+ mr as getCoins,
2699
2705
  I as getConfig,
2700
- Xt as getFees,
2701
- gr as getFlashLoanAsset,
2702
- ur as getHealthFactor,
2703
- Bt as getHealthFactorPTB,
2704
- Pt as getLendingPositions,
2705
- sr as getLendingState,
2706
- nr as getMarket,
2706
+ xt as getFees,
2707
+ hr as getFlashLoanAsset,
2708
+ lr as getHealthFactor,
2709
+ Pt as getHealthFactorPTB,
2710
+ At as getLendingPositions,
2711
+ ur as getLendingState,
2712
+ or as getMarket,
2707
2713
  P as getMarketConfig,
2708
- jt as getMarkets,
2714
+ It as getMarkets,
2709
2715
  E as getPool,
2710
2716
  J as getPools,
2711
- Oe as getPriceFeeds,
2712
- fr as getPythStalePriceFeedId,
2713
- St as getPythStalePriceFeedIdV2,
2714
- lr as getSimulatedHealthFactor,
2715
- Se as getSimulatedHealthFactorPTB,
2716
- Zt as getStats,
2717
- dr as getTransactions,
2718
- vr as getUserAvailableLendingRewards,
2719
- Ir as getUserClaimedRewardHistory,
2720
- Ae as getUserEModeCaps,
2721
- jr as getUserTotalClaimedReward,
2722
- br as liquidatePTB,
2723
- Kt as listAddressBalances,
2724
- cr as mergeCoinsPTB,
2717
+ Ve as getPriceFeeds,
2718
+ yr as getPythStalePriceFeedId,
2719
+ $t as getPythStalePriceFeedIdV2,
2720
+ dr as getSimulatedHealthFactor,
2721
+ $e as getSimulatedHealthFactorPTB,
2722
+ Xt as getStats,
2723
+ pr as getTransactions,
2724
+ Cr as getUserAvailableLendingRewards,
2725
+ kr as getUserClaimedRewardHistory,
2726
+ Se as getUserEModeCaps,
2727
+ Ir as getUserTotalClaimedReward,
2728
+ vr as liquidatePTB,
2729
+ Qt as listAddressBalances,
2730
+ sr as mergeCoinsPTB,
2725
2731
  N as mergeServiceHeaders,
2726
- Ce as normalizeAddressBalance,
2732
+ je as normalizeAddressBalance,
2727
2733
  C as normalizeCoinType,
2728
- bt as parsePoolUID,
2734
+ vt as parsePoolUID,
2729
2735
  h as parseTxValue,
2730
- tr as repayCoinPTB,
2731
- wr as repayFlashLoanPTB,
2732
- Qt as requireNaviGraphQLClient,
2736
+ rr as repayCoinPTB,
2737
+ br as repayFlashLoanPTB,
2738
+ Yt as requireNaviGraphQLClient,
2733
2739
  M as resolveNaviOpenApiEndpoint,
2734
- Cr as summaryLendingRewards,
2735
- yr as updateOraclePriceBeforeUserOperationPTB,
2736
- ge as updateOraclePricesPTB,
2737
- $t as updatePythPriceFeeds,
2738
- mr as verifyHealthFactorPTB,
2740
+ jr as summaryLendingRewards,
2741
+ gr as updateOraclePriceBeforeUserOperationPTB,
2742
+ he as updateOraclePricesPTB,
2743
+ Et as updatePythPriceFeeds,
2744
+ fr as verifyHealthFactorPTB,
2739
2745
  O as withCache,
2740
2746
  S as withSingleton,
2741
- xt as withdrawCoinPTB
2747
+ er as withdrawCoinPTB
2742
2748
  };
2743
2749
  //# sourceMappingURL=index.esm.js.map