@naviprotocol/lending 2.0.1 → 2.0.2

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,27 +1,27 @@
1
1
  import { Transaction as N } from "@mysten/sui/transactions";
2
2
  import { bcs as l } from "@mysten/sui/bcs";
3
- import { toHex as Ee, fromHex as Oe, normalizeStructTag as K, SUI_CLOCK_OBJECT_ID as Z, fromBase64 as Ve } from "@mysten/sui/utils";
4
- import Me from "lodash.camelcase";
3
+ import { toHex as Me, fromHex as Ue, normalizeStructTag as K, SUI_CLOCK_OBJECT_ID as Z, fromBase64 as De } from "@mysten/sui/utils";
4
+ import Fe from "lodash.camelcase";
5
5
  import p from "bignumber.js";
6
- import { SuiJsonRpcClient as De } from "@mysten/sui/jsonRpc";
7
- import { SuiGraphQLClient as Ue } from "@mysten/sui/graphql";
8
- import { GrpcWebFetchTransport as Fe, SuiGrpcClient as Ne } from "@mysten/sui/grpc";
9
- const ne = l.bytes(32).transform({
6
+ import { SuiJsonRpcClient as Ne } from "@mysten/sui/jsonRpc";
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({
10
10
  // To change the input type, you need to provide a type definition for the input
11
- input: (e) => Oe(e),
12
- output: (e) => Ee(e)
13
- }), Rt = l.struct("IncentiveAPYInfo", {
11
+ input: (e) => Ue(e),
12
+ output: (e) => Me(e)
13
+ }), qt = 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
- }), Re = l.struct("IncentivePoolInfo", {
20
+ }), Le = l.struct("IncentivePoolInfo", {
21
21
  /** Unique pool identifier */
22
- pool_id: ne,
22
+ pool_id: oe,
23
23
  /** Address holding the incentive funds */
24
- funds: ne,
24
+ funds: oe,
25
25
  /** Current phase of the incentive program */
26
26
  phase: l.u64(),
27
27
  /** Timestamp when the incentive started */
@@ -44,12 +44,12 @@ const ne = l.bytes(32).transform({
44
44
  available: l.u256(),
45
45
  /** Total amount of incentives */
46
46
  total: l.u256()
47
- }), qt = l.struct("IncentivePoolInfoByPhase", {
47
+ }), zt = 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(Re)
52
- }), Lt = l.struct("OracleInfo", {
51
+ pools: l.vector(Le)
52
+ }), Gt = 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 ne = l.bytes(32).transform({
58
58
  decimals: l.u8(),
59
59
  /** Whether the oracle data is valid */
60
60
  valid: l.bool()
61
- }), zt = l.struct("FlashLoanAssetConfig", {
61
+ }), Wt = l.struct("FlashLoanAssetConfig", {
62
62
  /** Unique identifier for the flash loan asset */
63
63
  id: l.string(),
64
64
  /** Asset identifier */
@@ -122,26 +122,26 @@ const ne = l.bytes(32).transform({
122
122
  liquidation_bonus: l.u256(),
123
123
  /** Liquidation threshold */
124
124
  liquidation_threshold: l.u256()
125
- }), Le = l.struct("UserStateInfo", {
125
+ }), ze = 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
- }), ze = "2.0.1", E = {
133
- version: ze
134
- }, Ge = E.version, He = () => {
132
+ }), Ge = "2.0.2", O = {
133
+ version: Ge
134
+ }, We = O.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}`;
138
138
  }
139
139
  return "Node/Unknown";
140
- }, We = () => {
140
+ }, Je = () => {
141
141
  let e = "";
142
- return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${Ge} (${He()})`), e;
143
- }, oe = We(), fe = "0x2::sui::SUI";
144
- class Je extends Error {
142
+ return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${We} (${He()})`), e;
143
+ }, ae = Je(), he = "0x2::sui::SUI";
144
+ class Ke 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 Je extends Error {
151
151
  function X(e) {
152
152
  return e == null ? void 0 : String(e);
153
153
  }
154
- function Ke(e, t) {
154
+ function Qe(e, t) {
155
155
  return (BigInt(e) + BigInt(t)).toString();
156
156
  }
157
- function Qe(e, t) {
157
+ function Ye(e, t) {
158
158
  return (BigInt(e) - BigInt(t)).toString();
159
159
  }
160
- function ye(e) {
160
+ function we(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 ge(e, t = fe) {
166
+ function be(e, t = he) {
167
167
  const r = X(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
168
  let o = X(e.balance ?? e.totalBalance), n = X(e.coinBalance);
169
- return !n && o && (n = Qe(o, r)), !o && n && (o = Ke(n, r)), {
169
+ return !n && o && (n = Ye(o, r)), !o && n && (o = Qe(n, r)), {
170
170
  coinType: K(e.coinType ?? t),
171
171
  totalBalance: o ?? "0",
172
172
  coinBalance: n ?? "0",
@@ -174,125 +174,111 @@ function ge(e, t = fe) {
174
174
  ...e.coinObjectCount === null || e.coinObjectCount === void 0 ? {} : { coinObjectCount: e.coinObjectCount }
175
175
  };
176
176
  }
177
- function Gt(e, t = fe) {
177
+ function Ht(e, t = he) {
178
178
  const r = K(t);
179
179
  return e.filter((o) => K(o.coinType) === r).reduce((o, n) => o + BigInt(n.balance), 0n).toString();
180
180
  }
181
- async function Ht(e, t) {
182
- const r = await ye(e).getBalance(t), o = r.balance;
183
- return ge((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
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);
184
184
  }
185
- async function Wt(e, t) {
186
- const r = await ye(e).listBalances(t), { balances: o = [] } = r;
185
+ async function Kt(e, t) {
186
+ const r = await we(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => ge(n)),
188
+ balances: o.map((n) => be(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
192
- function Ye(e, t) {
192
+ function Ze(e, t) {
193
193
  if ("client" in t)
194
194
  return t.client;
195
- const r = new Fe({
195
+ const r = new ge({
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 Ne({
201
+ return new ye({
202
202
  network: e,
203
203
  transport: r
204
204
  });
205
205
  }
206
- function Ze(e, t) {
207
- return "client" in t ? t.client : new Ue({
206
+ function Xe(e, t) {
207
+ return "client" in t ? t.client : new Re({
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 he(e, t) {
215
- return "client" in t ? t.client : new De({
214
+ function ve(e, t) {
215
+ return "client" in t ? t.client : new Ne({
216
216
  network: e,
217
217
  url: t.url
218
218
  });
219
219
  }
220
- function Xe(e) {
221
- const t = Ye(e.network, e.grpc);
220
+ function xe(e) {
221
+ const t = Ze(e.network, e.grpc);
222
222
  return {
223
223
  network: e.network,
224
224
  coreClient: t,
225
225
  grpc: t,
226
- graphql: e.graphql ? Ze(e.network, e.graphql) : void 0,
227
- legacyJsonRpc: e.legacyJsonRpc ? he(e.network, e.legacyJsonRpc) : void 0,
226
+ graphql: e.graphql ? Xe(e.network, e.graphql) : void 0,
227
+ legacyJsonRpc: e.legacyJsonRpc ? ve(e.network, e.legacyJsonRpc) : void 0,
228
228
  services: e.services
229
229
  };
230
230
  }
231
- function Jt(e, t) {
231
+ function Qt(e, t) {
232
232
  if (!e.graphql)
233
- throw new Je(t);
233
+ throw new Ke(t);
234
234
  return e.graphql;
235
235
  }
236
- function xe() {
237
- const e = "NAVI Sui SDK requires an explicit v2 gRPC/Core client. Pass { network, grpc } or an explicit legacyJsonRpc client for deprecated compatibility.", t = new Proxy(
238
- {},
239
- {
240
- get() {
241
- throw new Error(e);
242
- }
243
- }
244
- );
245
- return new Proxy(
246
- { core: t },
247
- {
248
- get(r, o) {
249
- if (o === "core")
250
- return r.core;
251
- if (o === "network")
252
- return "mainnet";
253
- throw new Error(e);
254
- }
255
- }
256
- );
236
+ const et = "https://fullnode.mainnet.sui.io:443";
237
+ let x;
238
+ function tt() {
239
+ return x || (x = new ye({
240
+ network: "mainnet",
241
+ transport: new ge({ baseUrl: et })
242
+ })), x;
257
243
  }
258
- function et(e, t = "mainnet") {
259
- return e ? typeof e == "string" ? he(t, { url: e }) : Xe(e) : xe();
244
+ function rt(e, t = "mainnet") {
245
+ return e ? typeof e == "string" ? ve(t, { url: e }) : xe(e) : tt();
260
246
  }
261
- const tt = 16 * 1024;
262
- function te(e) {
247
+ const nt = 16 * 1024;
248
+ function re(e) {
263
249
  return e.replace(/^0x/i, "");
264
250
  }
265
- function ae(e) {
266
- const t = te(e), r = new Uint8Array(t.length / 2);
251
+ function ie(e) {
252
+ const t = re(e), r = new Uint8Array(t.length / 2);
267
253
  for (let o = 0; o < r.length; o += 1)
268
254
  r[o] = parseInt(t.slice(o * 2, o * 2 + 2), 16);
269
255
  return r;
270
256
  }
271
- function rt(e, t) {
257
+ function ot(e, t) {
272
258
  return (e[t] << 8) + e[t + 1];
273
259
  }
274
- function ie(e) {
260
+ function ce(e) {
275
261
  return l.vector(l.U8).serialize(Array.from(e), {
276
- maxSize: tt
262
+ maxSize: nt
277
263
  });
278
264
  }
279
- function ce(e, t) {
265
+ function se(e, t) {
280
266
  return {
281
267
  type: e,
282
268
  bcs: t
283
269
  };
284
270
  }
285
- function nt(e) {
271
+ function at(e) {
286
272
  return l.vector(l.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
287
273
  }
288
- function ot(e) {
274
+ function it(e) {
289
275
  return l.struct("PriceIdentifier", {
290
276
  bytes: l.vector(l.U8)
291
277
  }).serialize({
292
278
  bytes: Array.from(e)
293
279
  }).toBytes();
294
280
  }
295
- function at(e) {
281
+ function ct(e) {
296
282
  const t = [];
297
283
  let r = 0, o = 0;
298
284
  for (let n = 0; n < e.length; n += 1) {
@@ -301,19 +287,19 @@ function at(e) {
301
287
  }
302
288
  return t.push(e.slice(o).trim()), t;
303
289
  }
304
- function it(e) {
290
+ function st(e) {
305
291
  const r = e.indexOf("::table::Table"), o = e.indexOf("<", r), n = e.lastIndexOf(">"), a = "::price_identifier::PriceIdentifier";
306
292
  if (r < 0 || o < 0 || n <= o)
307
293
  throw new Error(`Unexpected Pyth price table type: ${e}`);
308
- const [c, i] = at(e.slice(o + 1, n));
294
+ const [c, i] = ct(e.slice(o + 1, n));
309
295
  if (!c?.endsWith(a) || !i?.endsWith("::object::ID"))
310
296
  throw new Error(`Unexpected Pyth price table type arguments: ${e}`);
311
297
  return c.slice(0, -a.length);
312
298
  }
313
- function ct(e) {
299
+ function ut(e) {
314
300
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
315
301
  }
316
- class we {
302
+ class Ce {
317
303
  constructor(t, r) {
318
304
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
319
305
  }
@@ -341,14 +327,14 @@ class we {
341
327
  throw new Error(`Unsupported Hermes price update encoding: ${o}`);
342
328
  if (n.length === 0)
343
329
  throw new Error("Hermes price update response did not include binary update data");
344
- return n.map(ct);
330
+ return n.map(ut);
345
331
  }
346
332
  async get(t, r, o) {
347
333
  const n = new AbortController(), a = setTimeout(() => n.abort(), this.timeout), c = new URL(`${this.endpoint}${t}`);
348
334
  for (const [i, s] of Object.entries(o ?? {}))
349
335
  c.searchParams.set(i, s);
350
336
  for (const i of r)
351
- c.searchParams.append("ids[]", te(i));
337
+ c.searchParams.append("ids[]", re(i));
352
338
  try {
353
339
  const i = await fetch(c, {
354
340
  signal: n.signal
@@ -361,7 +347,7 @@ class we {
361
347
  }
362
348
  }
363
349
  }
364
- class st {
350
+ class lt {
365
351
  constructor(t, r, o) {
366
352
  this.provider = t, this.pythStateId = r, this.wormholeStateId = o, this.priceFeedObjectIdCache = /* @__PURE__ */ new Map();
367
353
  }
@@ -459,7 +445,7 @@ class st {
459
445
  target: `${o}::vaa::parse_and_verify`,
460
446
  arguments: [
461
447
  r.object(this.wormholeStateId),
462
- r.pure(ie(n)),
448
+ r.pure(ce(n)),
463
449
  r.object(Z)
464
450
  ]
465
451
  });
@@ -475,7 +461,7 @@ class st {
475
461
  target: `${o}::pyth::create_authenticated_price_infos_using_accumulator`,
476
462
  arguments: [
477
463
  t.object(this.pythStateId),
478
- t.pure(ie(r[0])),
464
+ t.pure(ce(r[0])),
479
465
  a,
480
466
  t.object(Z)
481
467
  ]
@@ -512,15 +498,15 @@ class st {
512
498
  return this.pythPackageId || (this.pythPackageId = await this.getPackageId(this.pythStateId)), this.pythPackageId;
513
499
  }
514
500
  async getPriceFeedObjectId(t) {
515
- const r = te(t);
501
+ const r = re(t);
516
502
  if (!this.priceFeedObjectIdCache.has(r)) {
517
- const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = this.getCoreProvider() ? ce(
503
+ const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = this.getCoreProvider() ? se(
518
504
  `${n}::price_identifier::PriceIdentifier`,
519
- ot(ae(r))
505
+ it(ie(r))
520
506
  ) : {
521
507
  type: `${n}::price_identifier::PriceIdentifier`,
522
508
  value: {
523
- bytes: Array.from(ae(r))
509
+ bytes: Array.from(ie(r))
524
510
  }
525
511
  }, c = await this.getDynamicMoveObjectJson(o, a);
526
512
  c?.fields ? this.priceFeedObjectIdCache.set(r, c.fields.value) : this.priceFeedObjectIdCache.set(r, void 0);
@@ -529,7 +515,7 @@ class st {
529
515
  }
530
516
  async getPriceTableInfo() {
531
517
  if (!this.priceTableInfo) {
532
- const t = this.getCoreProvider() ? ce("vector<u8>", nt("price_info")) : {
518
+ const t = this.getCoreProvider() ? se("vector<u8>", at("price_info")) : {
533
519
  type: "vector<u8>",
534
520
  value: "price_info"
535
521
  }, r = await this.getDynamicMoveObjectJson(this.pythStateId, t);
@@ -537,22 +523,22 @@ class st {
537
523
  throw new Error("Price Table not found, contract may not be initialized");
538
524
  this.priceTableInfo = {
539
525
  id: r.objectId,
540
- fieldType: it(r.type)
526
+ fieldType: st(r.type)
541
527
  };
542
528
  }
543
529
  return this.priceTableInfo;
544
530
  }
545
531
  extractVaaBytesFromAccumulatorMessage(t) {
546
- const o = 7 + t[6] + 1, n = rt(t, o), a = o + 2;
532
+ const o = 7 + t[6] + 1, n = ot(t, o), a = o + 2;
547
533
  return t.subarray(a, a + n);
548
534
  }
549
535
  }
550
- const ut = "https://open-api.naviprotocol.io/api";
551
- let J = {}, be = 0;
552
- function lt(e) {
536
+ const dt = "https://open-api.naviprotocol.io/api";
537
+ let J = {}, je = 0;
538
+ function pt(e) {
553
539
  return e.replace(/\/+$/, "");
554
540
  }
555
- function Kt(e) {
541
+ function Yt(e) {
556
542
  J = {
557
543
  ...J,
558
544
  ...e,
@@ -560,23 +546,23 @@ function Kt(e) {
560
546
  ...J.services,
561
547
  ...e.services
562
548
  }
563
- }, be += 1;
549
+ }, je += 1;
564
550
  }
565
- function se() {
566
- return be;
551
+ function ue() {
552
+ return je;
567
553
  }
568
- function O(e) {
554
+ function E(e) {
569
555
  const t = e?.services?.naviOpenApi ?? J.services?.naviOpenApi;
570
556
  return {
571
- baseUrl: lt(t?.baseUrl ?? ut),
557
+ baseUrl: pt(t?.baseUrl ?? dt),
572
558
  headers: t?.headers
573
559
  };
574
560
  }
575
561
  function M(e, t) {
576
- const r = O(t), o = e.startsWith("/") ? e : `/${e}`;
562
+ const r = E(t), o = e.startsWith("/") ? e : `/${e}`;
577
563
  return `${r.baseUrl}${o}`;
578
564
  }
579
- function dt(e) {
565
+ function mt(e) {
580
566
  if (e instanceof Headers) {
581
567
  const t = {};
582
568
  return e.forEach((r, o) => {
@@ -585,40 +571,33 @@ function dt(e) {
585
571
  }
586
572
  return Array.isArray(e) ? Object.fromEntries(e) : e;
587
573
  }
588
- function D(e, t) {
574
+ function U(e, t) {
589
575
  return {
590
- ...dt(e),
576
+ ...mt(e),
591
577
  ...t?.headers ?? {}
592
578
  };
593
579
  }
594
- et();
595
- function V(e, t) {
596
- if (!e)
597
- throw new Error(
598
- `${t} requires an explicit Sui v2 gRPC/Core client. Pass { client }; NAVI SDK v2 no longer provides an implicit default client.`
599
- );
600
- return e;
601
- }
602
- function ue(e) {
603
- return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Ve(e)) : [];
580
+ const V = rt();
581
+ function le(e) {
582
+ return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(De(e)) : [];
604
583
  }
605
- function pt(e) {
584
+ function ft(e) {
606
585
  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];
607
586
  return o && console.warn("[lending] devInspect(core simulate) returned error:", o), {
608
587
  effects: r.effects,
609
588
  events: r.events,
610
589
  error: o,
611
590
  results: t.map((n) => ({
612
- returnValues: (n.returnValues ?? []).map((a) => [ue(a.bcs), ""]),
591
+ returnValues: (n.returnValues ?? []).map((a) => [le(a.bcs), ""]),
613
592
  mutableReferenceOutputs: (n.mutatedReferences ?? []).map((a) => [
614
593
  "",
615
- ue(a.bcs),
594
+ le(a.bcs),
616
595
  ""
617
596
  ])
618
597
  }))
619
598
  };
620
599
  }
621
- async function L(e, t) {
600
+ async function q(e, t) {
622
601
  const r = e?.core;
623
602
  if (typeof r?.simulateTransaction != "function")
624
603
  throw new Error("devInspectTransaction requires a Sui v2 Core-capable client");
@@ -633,9 +612,9 @@ async function L(e, t) {
633
612
  commandResults: !0
634
613
  }
635
614
  });
636
- return pt(n);
615
+ return ft(n);
637
616
  }
638
- function ve(e) {
617
+ function Ie(e) {
639
618
  return {
640
619
  json: !!e?.showContent,
641
620
  display: !!e?.showDisplay,
@@ -643,7 +622,7 @@ function ve(e) {
643
622
  objectBcs: !!e?.showBcs
644
623
  };
645
624
  }
646
- function Ce(e) {
625
+ function ke(e) {
647
626
  return !e || e instanceof Error ? {
648
627
  error: e instanceof Error ? { code: "notFound", error: e.message } : void 0
649
628
  } : {
@@ -663,44 +642,44 @@ function Ce(e) {
663
642
  }
664
643
  };
665
644
  }
666
- async function mt(e, t) {
645
+ async function yt(e, t) {
667
646
  const r = e?.core;
668
647
  if (typeof r?.getObject != "function")
669
648
  throw new Error("getSuiObject requires a Sui v2 Core-capable client");
670
649
  const { object: o } = await r.getObject({
671
650
  objectId: t.id,
672
- include: ve(t.options)
651
+ include: Ie(t.options)
673
652
  });
674
- return Ce(o);
653
+ return ke(o);
675
654
  }
676
- async function ft(e, t) {
655
+ async function gt(e, t) {
677
656
  const r = e?.core;
678
657
  if (typeof r?.getObjects != "function")
679
658
  throw new Error("multiGetSuiObjects requires a Sui v2 Core-capable client");
680
659
  const { objects: o } = await r.getObjects({
681
660
  objectIds: t.ids,
682
- include: ve(t.options)
661
+ include: Ie(t.options)
683
662
  });
684
- return o.map(Ce);
663
+ return o.map(ke);
685
664
  }
686
- function je(e) {
665
+ function _e(e) {
687
666
  const t = [];
688
667
  let r = !1;
689
668
  return e.forEach((o, n) => {
690
669
  const a = n === e.length - 1;
691
670
  if (typeof o == "object" && o !== null && a) {
692
671
  const { client: c, disableCache: i, cacheTime: s, ...u } = o;
693
- u.__naviSdkServiceConfigVersion = se(), t.push(u), r = !0;
672
+ u.__naviSdkServiceConfigVersion = ue(), t.push(u), r = !0;
694
673
  } else
695
674
  t.push(o);
696
675
  }), r || t.push({
697
- __naviSdkServiceConfigVersion: se()
676
+ __naviSdkServiceConfigVersion: ue()
698
677
  }), JSON.stringify(t);
699
678
  }
700
679
  function A(e) {
701
680
  const t = {};
702
681
  return (...r) => {
703
- const o = je(r);
682
+ const o = _e(r);
704
683
  return t[o] || (t[o] = e(...r).finally(() => {
705
684
  delete t[o];
706
685
  })), t[o];
@@ -709,18 +688,18 @@ function A(e) {
709
688
  function $(e) {
710
689
  let t = {};
711
690
  return (...r) => {
712
- const o = r[r.length - 1], n = je(r), a = t[n];
691
+ const o = r[r.length - 1], n = _e(r), a = t[n];
713
692
  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] = {
714
693
  data: c,
715
694
  cacheAt: Date.now()
716
695
  }, c));
717
696
  };
718
697
  }
719
- function x(e) {
720
- return Array.isArray(e) ? e.map((t) => x(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
698
+ function ee(e) {
699
+ return Array.isArray(e) ? e.map((t) => ee(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
721
700
  (t, r) => ({
722
701
  ...t,
723
- [Me(r)]: x(e[r])
702
+ [Fe(r)]: ee(e[r])
724
703
  }),
725
704
  {}
726
705
  ) : e;
@@ -730,7 +709,7 @@ function h(e, t) {
730
709
  throw new Error("Transaction value is required");
731
710
  return typeof e == "object" ? e : t(e);
732
711
  }
733
- function yt(e, t) {
712
+ function ht(e, t) {
734
713
  return typeof t == "string" ? e.object(t) : typeof t == "object" && t.$kind ? t : e.object(t.contract.pool);
735
714
  }
736
715
  function Q(e, t, r) {
@@ -744,33 +723,33 @@ function Q(e, t, r) {
744
723
  function C(e) {
745
724
  return K(e);
746
725
  }
747
- function Ie(e) {
726
+ function Te(e) {
748
727
  const t = (e || 0) / Math.pow(10, 27);
749
728
  return t > Math.pow(10, 5) ? 1 / 0 : t;
750
729
  }
751
- new we("https://hermes.pyth.network", {
730
+ new Ce("https://hermes.pyth.network", {
752
731
  timeout: 2e4
753
732
  });
754
- const gt = 27, le = (e, t) => {
733
+ const wt = 27, de = (e, t) => {
755
734
  if (!Number(e) || !Number(t)) return new p(0);
756
- const r = new p(1).shiftedBy(1 * gt), o = r.multipliedBy(new p(0.5));
735
+ const r = new p(1).shiftedBy(1 * wt), o = r.multipliedBy(new p(0.5));
757
736
  return new p(e).multipliedBy(new p(t)).plus(o).dividedBy(r).integerValue(p.ROUND_DOWN);
758
- }, U = oe ? {
759
- "User-Agent": oe
737
+ }, D = ae ? {
738
+ "User-Agent": ae
760
739
  } : {};
761
- function ee(e, t = "uniqueId") {
740
+ function te(e, t = "uniqueId") {
762
741
  return e.reduce(
763
742
  (r, o) => (r[o[t]] = o, r),
764
743
  {}
765
744
  );
766
745
  }
767
- function de(e, t = "uniqueId") {
746
+ function pe(e, t = "uniqueId") {
768
747
  return e.reduce(
769
748
  (r, o) => (r[o[t]] = o, r),
770
749
  {}
771
750
  );
772
751
  }
773
- function W(e, t) {
752
+ function H(e, t) {
774
753
  const r = e.emodes.find((n) => n.emodeId === t.emodeId);
775
754
  if (!r)
776
755
  throw new Error("EMode not found in pool");
@@ -784,26 +763,26 @@ function W(e, t) {
784
763
  isEMode: !0
785
764
  };
786
765
  }
787
- function ht(e) {
766
+ function bt(e) {
788
767
  const [t, r] = e.split("-");
789
768
  return !t || !r ? null : {
790
769
  marketKey: t,
791
770
  poolId: parseInt(r)
792
771
  };
793
772
  }
794
- function B() {
773
+ function P() {
795
774
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
796
775
  }
797
776
  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 || {});
798
777
  const G = $(
799
778
  A(
800
779
  async (e) => {
801
- const t = (e?.markets || [F.main]).map((a) => _(a)), r = O(e), o = M(
802
- `/navi/pools?env=${e?.env || "prod"}&sdk=${E.version}&market=${t.map(
780
+ const t = (e?.markets || [F.main]).map((a) => _(a)), r = E(e), o = M(
781
+ `/navi/pools?env=${e?.env || "prod"}&sdk=${O.version}&market=${t.map(
803
782
  (a) => a.key
804
783
  )}`,
805
784
  e
806
- ), n = await fetch(o, { headers: D(U, r) }).then(
785
+ ), n = await fetch(o, { headers: U(D, r) }).then(
807
786
  (a) => a.json()
808
787
  );
809
788
  return n.data.forEach((a) => {
@@ -824,7 +803,7 @@ const G = $(
824
803
  async function S(e, t) {
825
804
  let r = t?.market;
826
805
  if (typeof e == "string") {
827
- const a = ht(e);
806
+ const a = bt(e);
828
807
  a && (r = a.marketKey, e = a.poolId);
829
808
  }
830
809
  const o = await G({
@@ -839,24 +818,24 @@ async function S(e, t) {
839
818
  throw new Error("Pool not found");
840
819
  return n.isDeprecated && console.log(`The lending pool for coinType ${n.suiCoinType} is going to be deprecated.`), n;
841
820
  }
842
- const Qt = $(
821
+ const Zt = $(
843
822
  A(async (e) => {
844
- const t = O(e), r = M(`/navi/stats?sdk=${E.version}`, e);
823
+ const t = E(e), r = M(`/navi/stats?sdk=${O.version}`, e);
845
824
  return (await fetch(r, {
846
- headers: D(U, t)
825
+ headers: U(D, t)
847
826
  }).then((n) => n.json())).data;
848
827
  })
849
- ), Yt = $(
828
+ ), Xt = $(
850
829
  A(
851
830
  async (e) => {
852
- const t = O(e), r = M(`/navi/fee?sdk=${E.version}`, e);
831
+ const t = E(e), r = M(`/navi/fee?sdk=${O.version}`, e);
853
832
  return await fetch(r, {
854
- headers: D(U, t)
833
+ headers: U(D, t)
855
834
  }).then((n) => n.json());
856
835
  }
857
836
  )
858
837
  );
859
- async function wt(e, t, r, o) {
838
+ async function vt(e, t, r, o) {
860
839
  const n = await j({
861
840
  ...o,
862
841
  cacheTime: v
@@ -904,7 +883,7 @@ async function wt(e, t, r, o) {
904
883
  arguments: [e.object(a.contract.pool), e.object("0x05")]
905
884
  }), e;
906
885
  }
907
- async function Zt(e, t, r, o) {
886
+ async function xt(e, t, r, o) {
908
887
  const n = await j({
909
888
  ...o,
910
889
  cacheTime: v
@@ -987,7 +966,7 @@ async function Zt(e, t, r, o) {
987
966
  typeArguments: [a.suiCoinType]
988
967
  });
989
968
  }
990
- async function Xt(e, t, r, o) {
969
+ async function er(e, t, r, o) {
991
970
  const n = await j({
992
971
  ...o,
993
972
  cacheTime: v
@@ -1073,7 +1052,7 @@ async function Xt(e, t, r, o) {
1073
1052
  typeArguments: [a.suiCoinType]
1074
1053
  });
1075
1054
  }
1076
- async function xt(e, t, r, o) {
1055
+ async function tr(e, t, r, o) {
1077
1056
  const n = await j({
1078
1057
  ...o,
1079
1058
  cacheTime: v
@@ -1126,12 +1105,12 @@ async function xt(e, t, r, o) {
1126
1105
  typeArguments: [a.suiCoinType]
1127
1106
  }), e;
1128
1107
  }
1129
- const er = $(
1108
+ const rr = $(
1130
1109
  A(
1131
1110
  async (e) => {
1132
1111
  const t = await j({
1133
1112
  ...e
1134
- }), r = V(e?.client, "getBorrowFee");
1113
+ }), r = e?.client ?? V;
1135
1114
  if (e?.address && typeof e?.asset < "u")
1136
1115
  try {
1137
1116
  const a = await S(e.asset, e), c = new N();
@@ -1145,7 +1124,7 @@ const er = $(
1145
1124
  ],
1146
1125
  typeArguments: []
1147
1126
  });
1148
- const i = await L(r, {
1127
+ const i = await q(r, {
1149
1128
  transactionBlock: c,
1150
1129
  sender: e.address
1151
1130
  }), s = Q(i, [l.u64()]);
@@ -1156,7 +1135,7 @@ const er = $(
1156
1135
  a
1157
1136
  );
1158
1137
  }
1159
- const n = (await mt(r, {
1138
+ const n = (await yt(r, {
1160
1139
  id: t.incentiveV3,
1161
1140
  options: { showType: !0, showOwner: !0, showContent: !0 }
1162
1141
  })).data.content.fields.borrow_fee_rate;
@@ -1185,7 +1164,7 @@ const er = $(
1185
1164
  name: "Sui Eco Market"
1186
1165
  }
1187
1166
  };
1188
- class bt {
1167
+ class Ct {
1189
1168
  constructor(t, r) {
1190
1169
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1191
1170
  marketTotalSupplyValue: "0",
@@ -1196,7 +1175,7 @@ class bt {
1196
1175
  return this._overview;
1197
1176
  }
1198
1177
  initPools(t) {
1199
- const r = ee(this.pools), o = de(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1178
+ const r = te(this.pools), o = pe(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1200
1179
  let c = p(0), i = p(0);
1201
1180
  t.forEach((s) => {
1202
1181
  if (!this.checkMarket(s.market)) {
@@ -1210,7 +1189,7 @@ class bt {
1210
1189
  ) && n.add(s.uniqueId), w.isCollateral && m.assets.find((g) => g.isDebt && g.assetId !== s.id) && a.add(s.uniqueId);
1211
1190
  });
1212
1191
  }), i = i.plus(s.poolBorrowValue), c = c.plus(s.poolSupplyValue);
1213
- }), this.poolMap = ee(this.pools, "id"), this.emodeMap = de(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1192
+ }), this.poolMap = te(this.pools, "id"), this.emodeMap = pe(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1214
1193
  const u = this.getEModePools(s.emodeId);
1215
1194
  this.emodePools.push(...u);
1216
1195
  }), this._overview = {
@@ -1253,7 +1232,7 @@ const _ = (e) => {
1253
1232
  if (!r)
1254
1233
  throw new Error("Market not found");
1255
1234
  return r;
1256
- }, vt = $(
1235
+ }, jt = $(
1257
1236
  A(
1258
1237
  async (e, t) => {
1259
1238
  const r = await G({
@@ -1263,28 +1242,28 @@ const _ = (e) => {
1263
1242
  });
1264
1243
  return e.map((o) => {
1265
1244
  const n = _(o), a = r.filter((c) => c.market === n.key);
1266
- return new bt(o, a);
1245
+ return new Ct(o, a);
1267
1246
  });
1268
1247
  }
1269
1248
  )
1270
- ), tr = $(
1249
+ ), nr = $(
1271
1250
  A(
1272
- async (e, t) => (await vt([e], t))[0]
1251
+ async (e, t) => (await jt([e], t))[0]
1273
1252
  )
1274
1253
  ), j = $(
1275
1254
  A(
1276
1255
  async (e) => {
1277
- const t = _(e?.market || R), r = O(e), o = M(
1278
- `/navi/config?env=${e?.env || "prod"}&sdk=${E.version}&market=${t.key}`,
1256
+ const t = _(e?.market || R), r = E(e), o = M(
1257
+ `/navi/config?env=${e?.env || "prod"}&sdk=${O.version}&market=${t.key}`,
1279
1258
  e
1280
1259
  );
1281
1260
  return (await fetch(o, {
1282
- headers: D(U, r)
1261
+ headers: U(D, r)
1283
1262
  }).then((a) => a.json())).data;
1284
1263
  }
1285
1264
  )
1286
1265
  ), v = 1e3 * 60 * 5;
1287
- async function Ct(e, t) {
1266
+ async function It(e, t) {
1288
1267
  const r = await j({
1289
1268
  cacheTime: v,
1290
1269
  ...t
@@ -1294,7 +1273,7 @@ async function Ct(e, t) {
1294
1273
  arguments: []
1295
1274
  });
1296
1275
  }
1297
- async function jt(e, t, r) {
1276
+ async function kt(e, t, r) {
1298
1277
  const o = await j({
1299
1278
  cacheTime: v,
1300
1279
  ...r
@@ -1304,7 +1283,7 @@ async function jt(e, t, r) {
1304
1283
  arguments: [t]
1305
1284
  });
1306
1285
  }
1307
- async function It(e, t, r) {
1286
+ async function _t(e, t, r) {
1308
1287
  const o = await j({
1309
1288
  ...r,
1310
1289
  cacheTime: v
@@ -1321,7 +1300,7 @@ async function It(e, t, r) {
1321
1300
  arguments: [e.object(o.storage), h(t, e.pure.u64)]
1322
1301
  }), e;
1323
1302
  }
1324
- async function rr(e, t) {
1303
+ async function or(e, t) {
1325
1304
  const r = await j({
1326
1305
  ...t,
1327
1306
  cacheTime: v
@@ -1334,16 +1313,16 @@ async function rr(e, t) {
1334
1313
  arguments: [e.object(r.storage)]
1335
1314
  }), e;
1336
1315
  }
1337
- async function nr(e, t, r) {
1316
+ async function ar(e, t, r) {
1338
1317
  const o = await j({
1339
1318
  cacheTime: v,
1340
1319
  ...r
1341
- }), n = await Ct(e, r);
1342
- await It(e, t, {
1320
+ }), n = await It(e, r);
1321
+ await _t(e, t, {
1343
1322
  ...r,
1344
1323
  accountCap: n
1345
1324
  });
1346
- const a = await _(r?.market || R), c = await jt(e, n, r);
1325
+ const a = await _(r?.market || R), c = await kt(e, n, r);
1347
1326
  return e.moveCall({
1348
1327
  target: `${o.emode.contract.registryPackage}::registry::register_emode_for_account_cap`,
1349
1328
  arguments: [
@@ -1354,18 +1333,18 @@ async function nr(e, t, r) {
1354
1333
  ]
1355
1334
  }), n;
1356
1335
  }
1357
- const ke = $(
1336
+ const Be = $(
1358
1337
  A(
1359
1338
  async (e, t) => {
1360
1339
  const r = await j({
1361
1340
  cacheTime: v,
1362
1341
  ...t
1363
- }), o = new N(), n = V(t?.client, "getUserEModeCaps");
1342
+ }), o = new N(), n = t?.client ?? V;
1364
1343
  o.moveCall({
1365
1344
  target: `${r.emode.contract.registryPackage}::registry::find_user_emode_account_caps`,
1366
1345
  arguments: [o.object(r.emode.contract.registryObject), o.pure.address(e)]
1367
1346
  });
1368
- const c = (await L(n, {
1347
+ const c = (await q(n, {
1369
1348
  transactionBlock: o,
1370
1349
  sender: e
1371
1350
  })).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]));
@@ -1377,21 +1356,21 @@ const ke = $(
1377
1356
  }
1378
1357
  )
1379
1358
  );
1380
- function or(e) {
1359
+ function ir(e) {
1381
1360
  return `${_(e.marketId).key}-${e.emodeId}`;
1382
1361
  }
1383
- function kt(e, t) {
1362
+ function Tt(e, t) {
1384
1363
  return e.coinType ? e.coinType : t || (typeof e.type == "string" ? e.type.match(/::coin::Coin<(.+)>$/) : null)?.[1];
1385
1364
  }
1386
- function pe(e, t) {
1387
- const r = kt(e, t), o = e.coinObjectId ?? e.objectId;
1365
+ function me(e, t) {
1366
+ const r = Tt(e, t), o = e.coinObjectId ?? e.objectId;
1388
1367
  return !r || !o || e.balance === void 0 || e.balance === null ? null : {
1389
1368
  ...e,
1390
1369
  coinType: C(r),
1391
1370
  coinObjectId: o
1392
1371
  };
1393
1372
  }
1394
- function ar(e, t, r) {
1373
+ function cr(e, t, r) {
1395
1374
  const o = typeof r?.balance == "number", n = o ? r.balance : 0;
1396
1375
  let a = 0;
1397
1376
  const c = [];
@@ -1410,7 +1389,7 @@ function ar(e, t, r) {
1410
1389
  );
1411
1390
  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]);
1412
1391
  }
1413
- async function _e(e, t, r, o, n, a, c) {
1392
+ async function Pe(e, t, r, o, n, a, c) {
1414
1393
  const i = await j({
1415
1394
  ...c,
1416
1395
  cacheTime: v
@@ -1421,7 +1400,7 @@ async function _e(e, t, r, o, n, a, c) {
1421
1400
  e.object("0x06"),
1422
1401
  e.object(i.storage),
1423
1402
  e.object(i.oracle.priceOracle),
1424
- yt(e, s),
1403
+ ht(e, s),
1425
1404
  h(t, e.pure.address),
1426
1405
  h(s.id, e.pure.u8),
1427
1406
  h(o, e.pure.u64),
@@ -1431,14 +1410,14 @@ async function _e(e, t, r, o, n, a, c) {
1431
1410
  typeArguments: [s.suiCoinType]
1432
1411
  });
1433
1412
  }
1434
- async function _t(e, t, r) {
1435
- return _e(e, t, 0, 0, 0, !1, r);
1413
+ async function Bt(e, t, r) {
1414
+ return Pe(e, t, 0, 0, 0, !1, r);
1436
1415
  }
1437
- async function Te(e, t, r) {
1438
- const o = new N(), n = V(r?.client, "getLendingStateBatch"), a = await G({
1416
+ async function Ae(e, t, r) {
1417
+ const o = new N(), n = r?.client ?? V, a = await G({
1439
1418
  ...r,
1440
1419
  markets: Object.values(F)
1441
- }), c = ee(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
1420
+ }), c = te(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
1442
1421
  for (const d of s) {
1443
1422
  const f = await j({
1444
1423
  ...r,
@@ -1461,7 +1440,7 @@ async function Te(e, t, r) {
1461
1440
  arguments: [o.object(f.storage), o.pure.address(d.address)]
1462
1441
  });
1463
1442
  }
1464
- const m = (await L(n, {
1443
+ const m = (await q(n, {
1465
1444
  transactionBlock: o,
1466
1445
  sender: e
1467
1446
  })).results || [], w = {};
@@ -1481,47 +1460,47 @@ async function Te(e, t, r) {
1481
1460
  );
1482
1461
  }
1483
1462
  });
1484
- const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(Le).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1463
+ const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(ze).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1485
1464
  return y.forEach((d, f) => {
1486
1465
  const b = t[f], I = _(b.market), T = w[I.key] || {};
1487
1466
  d.forEach((k) => {
1488
1467
  if (k.supply_balance === "0" && k.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1489
1468
  return;
1490
- const P = c[`${I.key}-${k.asset_id}`];
1491
- if (!P)
1469
+ const B = c[`${I.key}-${k.asset_id}`];
1470
+ if (!B)
1492
1471
  return;
1493
- const H = T[k.asset_id], Y = H?.supplyIndex ?? P.currentSupplyIndex, Ae = H?.borrowIndex ?? P.currentBorrowIndex, Se = le(k.supply_balance, Y).toString(), $e = le(k.borrow_balance, Ae).toString();
1472
+ const W = T[k.asset_id], Y = W?.supplyIndex ?? B.currentSupplyIndex, Oe = W?.borrowIndex ?? B.currentBorrowIndex, Ee = de(k.supply_balance, Y).toString(), Ve = de(k.borrow_balance, Oe).toString();
1494
1473
  g.push({
1495
- supplyBalance: Se,
1496
- borrowBalance: $e,
1474
+ supplyBalance: Ee,
1475
+ borrowBalance: Ve,
1497
1476
  assetId: k.asset_id,
1498
1477
  market: I.key,
1499
- pool: P,
1478
+ pool: B,
1500
1479
  emodeId: b.emodeId
1501
1480
  });
1502
1481
  });
1503
1482
  }), g;
1504
1483
  }
1505
- const ir = $(
1484
+ const sr = $(
1506
1485
  async (e, t) => {
1507
1486
  const o = (t?.markets || Object.keys(F)).map((n) => _(n)).map((n) => ({
1508
1487
  address: e,
1509
1488
  market: n.key
1510
1489
  }));
1511
- return await Te(e, o, t);
1490
+ return await Ae(e, o, t);
1512
1491
  }
1513
1492
  );
1514
- async function cr(e, t) {
1515
- const r = V(t?.client, "getHealthFactor"), o = new N();
1516
- await _t(o, e, t);
1517
- const n = await L(r, {
1493
+ async function ur(e, t) {
1494
+ const r = t?.client ?? V, o = new N();
1495
+ await Bt(o, e, t);
1496
+ const n = await q(r, {
1518
1497
  transactionBlock: o,
1519
1498
  sender: e
1520
1499
  }), a = Q(n, [l.u256()]);
1521
- return Ie(Number(a[0]) || 0);
1500
+ return Te(Number(a[0]) || 0);
1522
1501
  }
1523
- async function sr(e, t, r, o) {
1524
- const n = V(o?.client, "getSimulatedHealthFactor"), a = new N();
1502
+ async function lr(e, t, r, o) {
1503
+ const n = o?.client ?? V, a = new N();
1525
1504
  let c = 0, i = 0;
1526
1505
  const s = await S(t, o);
1527
1506
  if (r.forEach((y) => {
@@ -1529,7 +1508,7 @@ async function sr(e, t, r, o) {
1529
1508
  }), c * i < 0)
1530
1509
  throw new Error("Invalid operations");
1531
1510
  const u = c > 0 || i > 0;
1532
- await _e(
1511
+ await Pe(
1533
1512
  a,
1534
1513
  e,
1535
1514
  s,
@@ -1538,28 +1517,28 @@ async function sr(e, t, r, o) {
1538
1517
  u,
1539
1518
  o
1540
1519
  );
1541
- const m = await L(n, {
1520
+ const m = await q(n, {
1542
1521
  transactionBlock: a,
1543
1522
  sender: e
1544
1523
  }), w = Q(m, [l.u256()]);
1545
- return Ie(Number(w[0]) || 0);
1524
+ return Te(Number(w[0]) || 0);
1546
1525
  }
1547
- const ur = A(
1526
+ const dr = A(
1548
1527
  async (e, t) => {
1549
1528
  const r = new URLSearchParams();
1550
1529
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
1551
- const o = O(t), n = M(
1552
- `/navi/user/transactions?${r.toString()}&sdk=${E.version}`,
1530
+ const o = E(t), n = M(
1531
+ `/navi/user/transactions?${r.toString()}&sdk=${O.version}`,
1553
1532
  t
1554
1533
  );
1555
1534
  return (await fetch(n, {
1556
- headers: D(U, o)
1535
+ headers: U(D, o)
1557
1536
  }).then((c) => c.json())).data;
1558
1537
  }
1559
1538
  );
1560
- async function lr(e, t) {
1539
+ async function pr(e, t) {
1561
1540
  let r = null;
1562
- const o = [], n = V(t?.client, "getCoins"), a = n.core;
1541
+ const o = [], n = t?.client ?? V, a = n.core;
1563
1542
  do {
1564
1543
  let c;
1565
1544
  if (t?.coinType)
@@ -1571,7 +1550,7 @@ async function lr(e, t) {
1571
1550
  limit: 100
1572
1551
  });
1573
1552
  c = {
1574
- data: (i.objects ?? i.data ?? []).map((s) => pe(s, t?.coinType)).filter(Boolean),
1553
+ data: (i.objects ?? i.data ?? []).map((s) => me(s, t?.coinType)).filter(Boolean),
1575
1554
  nextCursor: i.cursor ?? i.nextCursor ?? null,
1576
1555
  hasNextPage: i.hasNextPage ?? !1
1577
1556
  };
@@ -1608,7 +1587,7 @@ async function lr(e, t) {
1608
1587
  limit: 100
1609
1588
  });
1610
1589
  o.push(
1611
- ...(w.objects ?? w.data ?? []).map((y) => pe(y, u)).filter(Boolean)
1590
+ ...(w.objects ?? w.data ?? []).map((y) => me(y, u)).filter(Boolean)
1612
1591
  ), m = w.cursor ?? w.nextCursor ?? null;
1613
1592
  } while (m);
1614
1593
  }
@@ -1630,9 +1609,9 @@ async function lr(e, t) {
1630
1609
  } while (r);
1631
1610
  return o;
1632
1611
  }
1633
- const Tt = $(
1612
+ const Pt = $(
1634
1613
  async (e, t) => {
1635
- const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i)), n = await ke(e, t), a = o.map((i) => ({
1614
+ const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i)), n = await Be(e, t), a = o.map((i) => ({
1636
1615
  address: e,
1637
1616
  market: i.key
1638
1617
  })).concat(
@@ -1642,7 +1621,7 @@ const Tt = $(
1642
1621
  emodeId: i.emodeId
1643
1622
  }))
1644
1623
  );
1645
- return (await Te(e, a, t)).forEach((i) => {
1624
+ return (await Ae(e, a, t)).forEach((i) => {
1646
1625
  const s = typeof i.emodeId == "number" ? n.find((u) => {
1647
1626
  const m = _(i.market);
1648
1627
  return u.emodeId === i.emodeId && u.marketId === m.id;
@@ -1651,18 +1630,18 @@ const Tt = $(
1651
1630
  if (!i.pool.emodes.find((m) => m.emodeId === s.emodeId))
1652
1631
  return;
1653
1632
  if (p(i.supplyBalance).gte(0)) {
1654
- const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = W(i.pool, s);
1633
+ const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1655
1634
  if (m.gt(0) || w.emode.isCollateral)
1656
1635
  try {
1657
1636
  r.push({
1658
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${B()}`,
1637
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${P()}`,
1659
1638
  wallet: e,
1660
1639
  protocol: "navi",
1661
1640
  market: i.market,
1662
1641
  type: "navi-lending-emode-supply",
1663
1642
  "navi-lending-emode-supply": {
1664
1643
  amount: m.toString(),
1665
- pool: W(i.pool, s),
1644
+ pool: H(i.pool, s),
1666
1645
  token: i.pool.token,
1667
1646
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1668
1647
  emodeCap: s
@@ -1673,18 +1652,18 @@ const Tt = $(
1673
1652
  }
1674
1653
  }
1675
1654
  if (p(i.borrowBalance).gte(0)) {
1676
- const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = W(i.pool, s);
1655
+ const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1677
1656
  if (m.gt(0) || w.emode.isDebt)
1678
1657
  try {
1679
1658
  r.push({
1680
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${B()}`,
1659
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${P()}`,
1681
1660
  wallet: e,
1682
1661
  protocol: "navi",
1683
1662
  market: i.market,
1684
1663
  type: "navi-lending-emode-borrow",
1685
1664
  "navi-lending-emode-borrow": {
1686
1665
  amount: m.toString(),
1687
- pool: W(i.pool, s),
1666
+ pool: H(i.pool, s),
1688
1667
  token: i.pool.token,
1689
1668
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1690
1669
  emodeCap: s
@@ -1698,7 +1677,7 @@ const Tt = $(
1698
1677
  if (p(i.supplyBalance).gt(0)) {
1699
1678
  const u = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1700
1679
  r.push({
1701
- id: `${i.pool.uniqueId}_navi-lending-supply-${B()}`,
1680
+ id: `${i.pool.uniqueId}_navi-lending-supply-${P()}`,
1702
1681
  wallet: e,
1703
1682
  protocol: "navi",
1704
1683
  type: "navi-lending-supply",
@@ -1714,7 +1693,7 @@ const Tt = $(
1714
1693
  if (p(i.borrowBalance).gt(0)) {
1715
1694
  const u = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1716
1695
  r.push({
1717
- id: `${i.pool.uniqueId}_navi-lending-borrow-${B()}`,
1696
+ id: `${i.pool.uniqueId}_navi-lending-borrow-${P()}`,
1718
1697
  wallet: e,
1719
1698
  protocol: "navi",
1720
1699
  market: i.market,
@@ -1731,7 +1710,7 @@ const Tt = $(
1731
1710
  }), r;
1732
1711
  }
1733
1712
  );
1734
- class q {
1713
+ class L {
1735
1714
  constructor(t, r) {
1736
1715
  this._positions = [], this._priceMap = {}, this._overview = {
1737
1716
  hf: 1 / 0,
@@ -1771,7 +1750,7 @@ class q {
1771
1750
  }
1772
1751
  filterPositionsByPool(t) {
1773
1752
  const o = !!t.isEMode ? ["navi-lending-emode-supply", "navi-lending-emode-borrow"] : ["navi-lending-supply", "navi-lending-borrow"];
1774
- return new q(
1753
+ return new L(
1775
1754
  this.positions.filter((n) => {
1776
1755
  const a = n[n.type];
1777
1756
  return o.includes(n.type) && a.pool.uniqueId === t.uniqueId;
@@ -1783,7 +1762,7 @@ class q {
1783
1762
  const o = !!t.isEMode, n = this.getPrice(t);
1784
1763
  let a;
1785
1764
  return o ? a = {
1786
- id: B(),
1765
+ id: P(),
1787
1766
  wallet: "",
1788
1767
  protocol: "navi",
1789
1768
  market: "",
@@ -1796,7 +1775,7 @@ class q {
1796
1775
  emodeCap: {}
1797
1776
  }
1798
1777
  } : a = {
1799
- id: B(),
1778
+ id: P(),
1800
1779
  wallet: "",
1801
1780
  protocol: "navi",
1802
1781
  market: "",
@@ -1807,13 +1786,13 @@ class q {
1807
1786
  token: t.token,
1808
1787
  pool: t
1809
1788
  }
1810
- }, new q([...this.positions, a], this._priceMap);
1789
+ }, new L([...this.positions, a], this._priceMap);
1811
1790
  }
1812
1791
  withdraw(t, r) {
1813
1792
  const o = !!t.isEMode, n = this.getPrice(t);
1814
1793
  let a;
1815
1794
  return o ? a = {
1816
- id: B(),
1795
+ id: P(),
1817
1796
  wallet: "",
1818
1797
  protocol: "navi",
1819
1798
  market: "",
@@ -1826,7 +1805,7 @@ class q {
1826
1805
  emodeCap: {}
1827
1806
  }
1828
1807
  } : a = {
1829
- id: B(),
1808
+ id: P(),
1830
1809
  wallet: "",
1831
1810
  protocol: "navi",
1832
1811
  market: "",
@@ -1837,13 +1816,13 @@ class q {
1837
1816
  token: t.token,
1838
1817
  pool: t
1839
1818
  }
1840
- }, new q([...this.positions, a], this._priceMap);
1819
+ }, new L([...this.positions, a], this._priceMap);
1841
1820
  }
1842
1821
  borrow(t, r) {
1843
1822
  const o = !!t.isEMode, n = this.getPrice(t);
1844
1823
  let a;
1845
1824
  return o ? a = {
1846
- id: B(),
1825
+ id: P(),
1847
1826
  wallet: "",
1848
1827
  protocol: "navi",
1849
1828
  market: "",
@@ -1856,7 +1835,7 @@ class q {
1856
1835
  emodeCap: {}
1857
1836
  }
1858
1837
  } : a = {
1859
- id: B(),
1838
+ id: P(),
1860
1839
  wallet: "",
1861
1840
  protocol: "navi",
1862
1841
  market: "",
@@ -1867,13 +1846,13 @@ class q {
1867
1846
  token: t.token,
1868
1847
  pool: t
1869
1848
  }
1870
- }, new q([...this.positions, a], this._priceMap);
1849
+ }, new L([...this.positions, a], this._priceMap);
1871
1850
  }
1872
1851
  repay(t, r) {
1873
1852
  const o = !!t.isEMode, n = this.getPrice(t);
1874
1853
  let a;
1875
1854
  return o ? a = {
1876
- id: B(),
1855
+ id: P(),
1877
1856
  wallet: "",
1878
1857
  protocol: "navi",
1879
1858
  market: "",
@@ -1886,7 +1865,7 @@ class q {
1886
1865
  emodeCap: {}
1887
1866
  }
1888
1867
  } : a = {
1889
- id: B(),
1868
+ id: P(),
1890
1869
  wallet: "",
1891
1870
  protocol: "navi",
1892
1871
  market: "",
@@ -1897,7 +1876,7 @@ class q {
1897
1876
  token: t.token,
1898
1877
  pool: t
1899
1878
  }
1900
- }, new q([...this.positions, a], this._priceMap);
1879
+ }, new L([...this.positions, a], this._priceMap);
1901
1880
  }
1902
1881
  resolveValueUSD(t) {
1903
1882
  return Object.keys(this._priceMap).length > 0 ? p(t.amount).multipliedBy(this.getPrice(t.pool)).toString() : t.valueUSD;
@@ -1968,7 +1947,7 @@ class q {
1968
1947
  };
1969
1948
  }
1970
1949
  }
1971
- async function dr(e, t, r, o) {
1950
+ async function mr(e, t, r, o) {
1972
1951
  const n = await j({
1973
1952
  ...o,
1974
1953
  cacheTime: v
@@ -1984,12 +1963,12 @@ async function dr(e, t, r, o) {
1984
1963
  ]
1985
1964
  });
1986
1965
  }
1987
- const Pe = new we("https://hermes.pyth.network", {
1966
+ const Se = new Ce("https://hermes.pyth.network", {
1988
1967
  timeout: 1e4
1989
1968
  });
1990
- async function pr(e) {
1969
+ async function fr(e) {
1991
1970
  try {
1992
- const t = [], r = await Pe.getLatestPriceFeeds(e);
1971
+ const t = [], r = await Se.getLatestPriceFeeds(e);
1993
1972
  if (!r) return t;
1994
1973
  const o = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
1995
1974
  for (const n of r) {
@@ -2009,8 +1988,8 @@ async function pr(e) {
2009
1988
  throw new Error(`failed to get pyth stale price feed id, msg: ${t.message}`);
2010
1989
  }
2011
1990
  }
2012
- async function Pt(e, t) {
2013
- const r = [], o = V(t?.client, "getOnChainPriceInfo"), n = e.map((c) => c.priceInfoObject), a = await ft(o, {
1991
+ async function At(e, t) {
1992
+ const r = [], o = t?.client ?? V, n = e.map((c) => c.priceInfoObject), a = await gt(o, {
2014
1993
  ids: Array.from(new Set(n)),
2015
1994
  options: { showContent: !0 }
2016
1995
  });
@@ -2042,9 +2021,9 @@ async function Pt(e, t) {
2042
2021
  }
2043
2022
  return r;
2044
2023
  }
2045
- async function Bt(e, t) {
2024
+ async function St(e, t) {
2046
2025
  try {
2047
- const r = [], o = await Pt(e, t);
2026
+ const r = [], o = await At(e, t);
2048
2027
  if (!o) return r;
2049
2028
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2050
2029
  for (const a of o) {
@@ -2064,14 +2043,14 @@ async function Bt(e, t) {
2064
2043
  throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2065
2044
  }
2066
2045
  }
2067
- async function At(e, t, r) {
2068
- const o = V(r?.client, "updatePythPriceFeeds"), n = await j({
2046
+ async function $t(e, t, r) {
2047
+ const o = r?.client ?? V, n = await j({
2069
2048
  ...r,
2070
2049
  cacheTime: v
2071
2050
  });
2072
2051
  try {
2073
- const a = await Pe.getPriceFeedsUpdateData(t);
2074
- return await new st(
2052
+ const a = await Se.getPriceFeedsUpdateData(t);
2053
+ return await new lt(
2075
2054
  o,
2076
2055
  n.oracle.pythStateId,
2077
2056
  n.oracle.wormholeStateId
@@ -2080,7 +2059,7 @@ async function At(e, t, r) {
2080
2059
  throw new Error(`failed to update pyth price feeds, msg: ${a.message}`);
2081
2060
  }
2082
2061
  }
2083
- async function me(e, t, r) {
2062
+ async function fe(e, t, r) {
2084
2063
  const o = await j({
2085
2064
  ...r,
2086
2065
  cacheTime: v
@@ -2090,8 +2069,8 @@ async function me(e, t, r) {
2090
2069
  priceFeedId: c.pythPriceFeedId,
2091
2070
  priceInfoObject: c.pythPriceInfoObject,
2092
2071
  expiration: 30
2093
- })), a = await Bt(n, r);
2094
- a.length > 0 && await At(e, a, r);
2072
+ })), a = await St(n, r);
2073
+ a.length > 0 && await $t(e, a, r);
2095
2074
  }
2096
2075
  for (const n of t)
2097
2076
  r?.env === "dev" ? e.moveCall({
@@ -2130,13 +2109,13 @@ async function me(e, t, r) {
2130
2109
  });
2131
2110
  return e;
2132
2111
  }
2133
- async function Be(e) {
2112
+ async function $e(e) {
2134
2113
  return (await j({
2135
2114
  ...e,
2136
2115
  cacheTime: v
2137
2116
  })).oracle.feeds;
2138
2117
  }
2139
- function St(e, t) {
2118
+ function Ot(e, t) {
2140
2119
  return e.filter((r) => !!(t?.lendingState && t.lendingState.find((n) => r.oracleId === n.pool.oracleId) || t?.lendingPositions && t.lendingPositions.find((n) => {
2141
2120
  if (![
2142
2121
  "navi-lending-supply",
@@ -2149,23 +2128,23 @@ function St(e, t) {
2149
2128
  return r.oracleId === c?.oracleId;
2150
2129
  }) || t?.pools && t.pools.find((n) => r.oracleId === n.oracleId)));
2151
2130
  }
2152
- async function mr(e, t, r, o) {
2131
+ async function yr(e, t, r, o) {
2153
2132
  let n;
2154
2133
  try {
2155
- const a = await Be({
2134
+ const a = await $e({
2156
2135
  ...o
2157
2136
  }), c = [];
2158
2137
  r.forEach((u) => {
2159
2138
  c.includes(u.market) || c.push(u.market);
2160
2139
  });
2161
- const i = await Tt(t, {
2140
+ const i = await Pt(t, {
2162
2141
  ...o,
2163
2142
  markets: c
2164
2143
  });
2165
- return n = St(a, {
2144
+ return n = Ot(a, {
2166
2145
  lendingPositions: i,
2167
2146
  pools: r
2168
- }), await me(e, n, {
2147
+ }), await fe(e, n, {
2169
2148
  updatePythPriceFeeds: !0,
2170
2149
  ...o
2171
2150
  });
@@ -2174,7 +2153,7 @@ async function mr(e, t, r, o) {
2174
2153
  throw a;
2175
2154
  if (console.error(a), n)
2176
2155
  try {
2177
- return await me(e, n, {
2156
+ return await fe(e, n, {
2178
2157
  ...o,
2179
2158
  updatePythPriceFeeds: !1
2180
2159
  });
@@ -2184,14 +2163,14 @@ async function mr(e, t, r, o) {
2184
2163
  return e;
2185
2164
  }
2186
2165
  }
2187
- const re = $(
2166
+ const ne = $(
2188
2167
  A(
2189
2168
  async (e) => {
2190
- const t = O(e), r = M(
2191
- `/navi/flashloan?env=${e?.env || "prod"}&sdk=${E.version}&market=${e?.market || R}`,
2169
+ const t = E(e), r = M(
2170
+ `/navi/flashloan?env=${e?.env || "prod"}&sdk=${O.version}&market=${e?.market || R}`,
2192
2171
  e
2193
2172
  ), o = await fetch(r, {
2194
- headers: D(U, t)
2173
+ headers: U(D, t)
2195
2174
  }).then((n) => n.json());
2196
2175
  return Object.keys(o.data).map((n) => ({
2197
2176
  ...o.data[n],
@@ -2200,15 +2179,15 @@ const re = $(
2200
2179
  }
2201
2180
  )
2202
2181
  );
2203
- async function fr(e, t) {
2204
- return (await re(t)).find((o) => typeof e == "string" ? C(o.coinType) === C(e) : typeof e == "number" ? o.assetId === e : o.assetId === e.id) || null;
2182
+ async function gr(e, t) {
2183
+ 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;
2205
2184
  }
2206
- async function yr(e, t, r, o) {
2185
+ async function hr(e, t, r, o) {
2207
2186
  const n = await j({
2208
2187
  ...o,
2209
2188
  cacheTime: v
2210
2189
  }), a = await S(t, o);
2211
- if (!(await re({
2190
+ if (!(await ne({
2212
2191
  ...o,
2213
2192
  cacheTime: v
2214
2193
  })).some(
@@ -2240,12 +2219,12 @@ async function yr(e, t, r, o) {
2240
2219
  return [s, u];
2241
2220
  }
2242
2221
  }
2243
- async function gr(e, t, r, o, n) {
2222
+ async function wr(e, t, r, o, n) {
2244
2223
  const a = await j({
2245
2224
  ...n,
2246
2225
  cacheTime: v
2247
2226
  }), c = await S(t, n);
2248
- if (!(await re({
2227
+ if (!(await ne({
2249
2228
  ...n,
2250
2229
  cacheTime: v
2251
2230
  })).some(
@@ -2265,7 +2244,7 @@ async function gr(e, t, r, o, n) {
2265
2244
  });
2266
2245
  return [u];
2267
2246
  }
2268
- async function hr(e, t, r, o, n, a) {
2247
+ async function br(e, t, r, o, n, a) {
2269
2248
  const c = {
2270
2249
  ...a,
2271
2250
  cacheTime: v
@@ -2334,12 +2313,12 @@ async function hr(e, t, r, o, n, a) {
2334
2313
  return [m, w];
2335
2314
  }
2336
2315
  }
2337
- async function $t(e, t, r) {
2338
- const o = V(r?.client, "getLendingRewardsBatch"), n = await G({
2316
+ async function Et(e, t, r) {
2317
+ const o = r?.client ?? V, n = await G({
2339
2318
  ...r,
2340
2319
  markets: Object.values(F),
2341
2320
  cacheTime: v
2342
- }), a = await Be(r), c = [];
2321
+ }), a = await $e(r), c = [];
2343
2322
  return await Promise.all(
2344
2323
  t.map(async (i) => {
2345
2324
  try {
@@ -2361,7 +2340,7 @@ async function $t(e, t, r) {
2361
2340
  // User address
2362
2341
  ]
2363
2342
  });
2364
- const w = (await L(o, {
2343
+ const w = (await q(o, {
2365
2344
  transactionBlock: u,
2366
2345
  sender: e
2367
2346
  }))?.results?.[0];
@@ -2410,8 +2389,8 @@ async function $t(e, t, r) {
2410
2389
  })
2411
2390
  ), c;
2412
2391
  }
2413
- async function wr(e, t) {
2414
- const r = (t?.markets || [F.main]).map((a) => _(a)), o = await ke(e, t), n = r.map((a) => ({
2392
+ async function vr(e, t) {
2393
+ const r = (t?.markets || [F.main]).map((a) => _(a)), o = await Be(e, t), n = r.map((a) => ({
2415
2394
  address: e,
2416
2395
  owner: e,
2417
2396
  market: a.key
@@ -2426,9 +2405,9 @@ async function wr(e, t) {
2426
2405
  };
2427
2406
  })
2428
2407
  );
2429
- return await $t(e, n, t);
2408
+ return await Et(e, n, t);
2430
2409
  }
2431
- function br(e) {
2410
+ function Cr(e) {
2432
2411
  const t = /* @__PURE__ */ new Map();
2433
2412
  e.forEach((o) => {
2434
2413
  const n = o.assetId, a = o.option, c = `${n}-${a}-${o.rewardCoinType}-${o.market}`;
@@ -2457,30 +2436,30 @@ function br(e) {
2457
2436
  }))
2458
2437
  }));
2459
2438
  }
2460
- const vr = A(
2439
+ const jr = A(
2461
2440
  async (e, t) => {
2462
- const r = O(t), o = M(
2463
- `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${E.version}&market=${t?.market || R}`,
2441
+ const r = E(t), o = M(
2442
+ `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${O.version}&market=${t?.market || R}`,
2464
2443
  t
2465
2444
  );
2466
2445
  return (await fetch(o, {
2467
- headers: D(U, r)
2446
+ headers: U(D, r)
2468
2447
  }).then((a) => a.json())).data;
2469
2448
  }
2470
- ), Cr = A(
2449
+ ), Ir = A(
2471
2450
  async (e, t) => {
2472
- const r = O(t), o = M(
2473
- `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${E.version}&market=${t?.market || R}`,
2451
+ const r = E(t), o = M(
2452
+ `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${O.version}&market=${t?.market || R}`,
2474
2453
  t
2475
2454
  ), n = await fetch(o, {
2476
- headers: D(U, r)
2455
+ headers: U(D, r)
2477
2456
  }).then((a) => a.json());
2478
- return x({
2457
+ return ee({
2479
2458
  data: n.data.rewards
2480
2459
  });
2481
2460
  }
2482
2461
  );
2483
- async function jr(e, t, r) {
2462
+ async function kr(e, t, r) {
2484
2463
  const o = await G({
2485
2464
  ...r,
2486
2465
  markets: Object.values(F),
@@ -2514,7 +2493,7 @@ async function jr(e, t, r) {
2514
2493
  }), f = c.split("___")[0], b = o.filter(
2515
2494
  (k) => C(k.suiCoinType) === C(f)
2516
2495
  );
2517
- b.sort((k, P) => k.market === m ? -1 : 1);
2496
+ b.sort((k, B) => k.market === m ? -1 : 1);
2518
2497
  const I = b[0], T = d.rewardFunds[C(f)];
2519
2498
  if (!T)
2520
2499
  throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
@@ -2578,7 +2557,7 @@ async function jr(e, t, r) {
2578
2557
  ],
2579
2558
  typeArguments: [f]
2580
2559
  });
2581
- const [P] = e.moveCall({
2560
+ const [B] = e.moveCall({
2582
2561
  target: "0x2::coin::from_balance",
2583
2562
  arguments: [k],
2584
2563
  typeArguments: [f]
@@ -2587,22 +2566,22 @@ async function jr(e, t, r) {
2587
2566
  if (!r.customCoinReceive.transfer)
2588
2567
  throw new Error("customCoinReceive.transfer is required");
2589
2568
  e.transferObjects(
2590
- [P],
2569
+ [B],
2591
2570
  h(r.customCoinReceive.transfer, e.pure.address)
2592
2571
  );
2593
2572
  }
2594
2573
  if (r?.customCoinReceive.type === "depositNAVI") {
2595
- const H = p(I.totalSupplyAmount).shiftedBy(-9), Y = p(I.supplyCapCeiling).shiftedBy(-27);
2596
- H.plus(u).isGreaterThan(Y) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2597
- [P],
2574
+ const W = p(I.totalSupplyAmount).shiftedBy(-9), Y = p(I.supplyCapCeiling).shiftedBy(-27);
2575
+ W.plus(u).isGreaterThan(Y) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2576
+ [B],
2598
2577
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2599
- ) : await wt(e, I, P, {
2578
+ ) : await vt(e, I, B, {
2600
2579
  ...r,
2601
2580
  market: I.market
2602
2581
  });
2603
2582
  } else
2604
2583
  a.push({
2605
- coin: P,
2584
+ coin: B,
2606
2585
  identifier: I,
2607
2586
  owner: w,
2608
2587
  isEMode: g
@@ -2627,13 +2606,13 @@ async function jr(e, t, r) {
2627
2606
  // Account capability
2628
2607
  ],
2629
2608
  typeArguments: [f]
2630
- }), [P] = e.moveCall({
2609
+ }), [B] = e.moveCall({
2631
2610
  target: "0x2::coin::from_balance",
2632
2611
  arguments: [k],
2633
2612
  typeArguments: [f]
2634
2613
  });
2635
2614
  e.transferObjects(
2636
- [P],
2615
+ [B],
2637
2616
  h(r?.accountCap || w, e.pure.address)
2638
2617
  );
2639
2618
  } else
@@ -2659,86 +2638,87 @@ async function jr(e, t, r) {
2659
2638
  return a;
2660
2639
  }
2661
2640
  export {
2662
- ne as Address,
2641
+ oe as Address,
2663
2642
  v as DEFAULT_CACHE_TIME,
2664
2643
  R as DEFAULT_MARKET_IDENTITY,
2665
- zt as FlashLoanAssetConfig,
2666
- Rt as IncentiveAPYInfo,
2667
- Re as IncentivePoolInfo,
2668
- qt as IncentivePoolInfoByPhase,
2644
+ Wt as FlashLoanAssetConfig,
2645
+ qt as IncentiveAPYInfo,
2646
+ Le as IncentivePoolInfo,
2647
+ zt as IncentivePoolInfoByPhase,
2669
2648
  F as MARKETS,
2670
- bt as Market,
2671
- Je as NaviMissingGraphQLClientError,
2672
- Lt as OracleInfo,
2649
+ Ct as Market,
2650
+ Ke as NaviMissingGraphQLClientError,
2651
+ Gt as OracleInfo,
2652
+ et as PUBLIC_MAINNET_GRPC_URL,
2673
2653
  z as PoolOperator,
2674
2654
  qe as ReserveDataInfo,
2675
- we as SuiPriceServiceConnection,
2676
- st as SuiPythClient,
2677
- q as UserPositions,
2678
- Le as UserStateInfo,
2679
- Xt as borrowCoinPTB,
2655
+ Ce as SuiPriceServiceConnection,
2656
+ lt as SuiPythClient,
2657
+ L as UserPositions,
2658
+ ze as UserStateInfo,
2659
+ er as borrowCoinPTB,
2680
2660
  M as buildNaviOpenApiUrl,
2681
- jr as claimLendingRewardsPTB,
2682
- Kt as configureNaviSdk,
2683
- Ct as createAccountCapPTB,
2684
- nr as createEModeCapPTB,
2685
- he as createNaviLegacyJsonRpcClient,
2686
- et as createNaviSuiClient,
2687
- Xe as createNaviSuiClientBundle,
2688
- wt as depositCoinPTB,
2689
- or as emodeIdentityId,
2690
- It as enterEModePTB,
2691
- rr as exitEModePTB,
2692
- St as filterPriceFeeds,
2693
- yr as flashloanPTB,
2694
- jt as getAccountCapOwnerPTB,
2695
- Ht as getAddressBalance,
2696
- re as getAllFlashLoanAssets,
2697
- er as getBorrowFee,
2698
- Gt as getCoinObjectOnlyBalance,
2699
- lr as getCoins,
2661
+ kr as claimLendingRewardsPTB,
2662
+ Yt as configureNaviSdk,
2663
+ It as createAccountCapPTB,
2664
+ ar as createEModeCapPTB,
2665
+ ve as createNaviLegacyJsonRpcClient,
2666
+ rt as createNaviSuiClient,
2667
+ xe as createNaviSuiClientBundle,
2668
+ vt as depositCoinPTB,
2669
+ ir as emodeIdentityId,
2670
+ _t as enterEModePTB,
2671
+ or as exitEModePTB,
2672
+ Ot as filterPriceFeeds,
2673
+ hr as flashloanPTB,
2674
+ kt as getAccountCapOwnerPTB,
2675
+ Jt as getAddressBalance,
2676
+ ne as getAllFlashLoanAssets,
2677
+ rr as getBorrowFee,
2678
+ Ht as getCoinObjectOnlyBalance,
2679
+ pr as getCoins,
2700
2680
  j as getConfig,
2701
- Yt as getFees,
2702
- fr as getFlashLoanAsset,
2703
- cr as getHealthFactor,
2704
- _t as getHealthFactorPTB,
2705
- Tt as getLendingPositions,
2706
- ir as getLendingState,
2707
- tr as getMarket,
2681
+ Xt as getFees,
2682
+ gr as getFlashLoanAsset,
2683
+ ur as getHealthFactor,
2684
+ Bt as getHealthFactorPTB,
2685
+ Pt as getLendingPositions,
2686
+ sr as getLendingState,
2687
+ nr as getMarket,
2708
2688
  _ as getMarketConfig,
2709
- vt as getMarkets,
2689
+ jt as getMarkets,
2710
2690
  S as getPool,
2711
2691
  G as getPools,
2712
- Be as getPriceFeeds,
2713
- pr as getPythStalePriceFeedId,
2714
- Bt as getPythStalePriceFeedIdV2,
2715
- sr as getSimulatedHealthFactor,
2716
- _e as getSimulatedHealthFactorPTB,
2717
- Qt as getStats,
2718
- ur as getTransactions,
2719
- wr as getUserAvailableLendingRewards,
2720
- Cr as getUserClaimedRewardHistory,
2721
- ke as getUserEModeCaps,
2722
- vr as getUserTotalClaimedReward,
2723
- hr as liquidatePTB,
2724
- Wt as listAddressBalances,
2725
- ar as mergeCoinsPTB,
2726
- D as mergeServiceHeaders,
2727
- ge as normalizeAddressBalance,
2692
+ $e as getPriceFeeds,
2693
+ fr as getPythStalePriceFeedId,
2694
+ St as getPythStalePriceFeedIdV2,
2695
+ lr as getSimulatedHealthFactor,
2696
+ Pe as getSimulatedHealthFactorPTB,
2697
+ Zt as getStats,
2698
+ dr as getTransactions,
2699
+ vr as getUserAvailableLendingRewards,
2700
+ Ir as getUserClaimedRewardHistory,
2701
+ Be as getUserEModeCaps,
2702
+ jr as getUserTotalClaimedReward,
2703
+ br as liquidatePTB,
2704
+ Kt as listAddressBalances,
2705
+ cr as mergeCoinsPTB,
2706
+ U as mergeServiceHeaders,
2707
+ be as normalizeAddressBalance,
2728
2708
  C as normalizeCoinType,
2729
- ht as parsePoolUID,
2709
+ bt as parsePoolUID,
2730
2710
  h as parseTxValue,
2731
- xt as repayCoinPTB,
2732
- gr as repayFlashLoanPTB,
2733
- Jt as requireNaviGraphQLClient,
2734
- O as resolveNaviOpenApiEndpoint,
2735
- br as summaryLendingRewards,
2736
- mr as updateOraclePriceBeforeUserOperationPTB,
2737
- me as updateOraclePricesPTB,
2738
- At as updatePythPriceFeeds,
2739
- dr as verifyHealthFactorPTB,
2711
+ tr as repayCoinPTB,
2712
+ wr as repayFlashLoanPTB,
2713
+ Qt as requireNaviGraphQLClient,
2714
+ E as resolveNaviOpenApiEndpoint,
2715
+ Cr as summaryLendingRewards,
2716
+ yr as updateOraclePriceBeforeUserOperationPTB,
2717
+ fe as updateOraclePricesPTB,
2718
+ $t as updatePythPriceFeeds,
2719
+ mr as verifyHealthFactorPTB,
2740
2720
  $ as withCache,
2741
2721
  A as withSingleton,
2742
- Zt as withdrawCoinPTB
2722
+ xt as withdrawCoinPTB
2743
2723
  };
2744
2724
  //# sourceMappingURL=index.esm.js.map