@naviprotocol/lending 1.4.0-emode.20 → 1.4.0-emode.21

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
@@ -129,9 +129,9 @@ const W = d.bytes(32).transform({
129
129
  borrow_balance: d.u256(),
130
130
  /** User's current supply balance */
131
131
  supply_balance: d.u256()
132
- }), me = "1.4.0-emode.20", S = {
132
+ }), me = "1.4.0-emode.21", S = {
133
133
  version: me
134
- }, ye = S.version, ge = () => {
134
+ }, ge = S.version, ye = () => {
135
135
  if (typeof process < "u" && process.versions && process.versions.node)
136
136
  try {
137
137
  const e = require("os"), o = process.version, n = e.type(), r = e.arch();
@@ -142,7 +142,7 @@ const W = d.bytes(32).transform({
142
142
  return "Node/Unknown";
143
143
  }, fe = () => {
144
144
  let e = "";
145
- return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${ye} (${ge()})`), e;
145
+ return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${ge} (${ye()})`), e;
146
146
  }, H = fe(), $ = new ce({
147
147
  url: ie("mainnet")
148
148
  });
@@ -185,13 +185,13 @@ function F(e) {
185
185
  {}
186
186
  ) : e;
187
187
  }
188
- function y(e, o) {
188
+ function g(e, o) {
189
189
  return typeof e == "object" ? e : o(e);
190
190
  }
191
- function we(e, o) {
191
+ function ve(e, o) {
192
192
  return typeof o == "string" ? e.object(o) : typeof o == "object" && o.$kind ? o : e.object(o.contract.pool);
193
193
  }
194
- function O(e, o, n) {
194
+ function R(e, o, n) {
195
195
  if (e.results && e.results.length > 0) {
196
196
  if (e.results[0].returnValues && e.results[0].returnValues.length > 0)
197
197
  return e.results[0].returnValues.map((r, t) => (o[t] || o[0]).parse(Uint8Array.from(r[0])));
@@ -209,9 +209,9 @@ function Q(e) {
209
209
  new Y("https://hermes.pyth.network", {
210
210
  timeout: 2e4
211
211
  });
212
- const ve = 27, G = (e, o) => {
212
+ const we = 27, G = (e, o) => {
213
213
  if (!Number(e) || !Number(o)) return new l(0);
214
- const n = new l(1).shiftedBy(1 * ve), r = n.multipliedBy(new l(0.5));
214
+ const n = new l(1).shiftedBy(1 * we), r = n.multipliedBy(new l(0.5));
215
215
  return new l(e).multipliedBy(new l(o)).plus(r).dividedBy(n).integerValue(l.ROUND_DOWN);
216
216
  }, V = H ? {
217
217
  "User-Agent": H
@@ -253,7 +253,7 @@ function P() {
253
253
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
254
254
  }
255
255
  var N = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(N || {});
256
- const R = A(
256
+ const O = A(
257
257
  I(
258
258
  async (e) => {
259
259
  const o = (e?.markets || [E.main]).map((t) => j(t)), n = `https://open-api.naviprotocol.io/api/navi/pools?env=${e?.env || "prod"}&sdk=${S.version}&market=${o.map(
@@ -265,11 +265,11 @@ const R = A(
265
265
  return t.market === _.key && f.isActive;
266
266
  }).filter((f) => !!f.assets.find((_) => _.assetId === t.id));
267
267
  t.emodes = i;
268
- const c = l(t.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), s = l(t.borrowedAmount).shiftedBy(-9).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), u = l(c).multipliedBy(t.oracle.price).toString(), m = l(s).multipliedBy(t.oracle.price).toString(), g = l(t.supplyCapCeiling).shiftedBy(-27).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), v = l.max(
268
+ const c = l(t.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), s = l(t.borrowedAmount).shiftedBy(-9).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), u = l(c).multipliedBy(t.oracle.price).toString(), m = l(s).multipliedBy(t.oracle.price).toString(), y = l(t.supplyCapCeiling).shiftedBy(-27).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), w = l.max(
269
269
  l(t.borrowedAmount),
270
270
  l(t.validBorrowAmount)
271
- ).shiftedBy(-9).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), w = l(g).multipliedBy(t.oracle.price).toString(), p = l(v).multipliedBy(t.oracle.price).toString();
272
- t.poolSupplyAmount = c, t.poolBorrowAmount = s, t.poolSupplyValue = u, t.poolBorrowValue = m, t.poolSupplyCapAmount = g, t.poolBorrowCapAmount = v, t.poolSupplyCapValue = w, t.poolBorrowCapValue = p;
271
+ ).shiftedBy(-9).decimalPlaces(t.token.decimals, l.ROUND_DOWN).toString(), v = l(y).multipliedBy(t.oracle.price).toString(), p = l(w).multipliedBy(t.oracle.price).toString();
272
+ t.poolSupplyAmount = c, t.poolBorrowAmount = s, t.poolSupplyValue = u, t.poolBorrowValue = m, t.poolSupplyCapAmount = y, t.poolBorrowCapAmount = w, t.poolSupplyCapValue = v, t.poolBorrowCapValue = p;
273
273
  }), r.data;
274
274
  }
275
275
  )
@@ -280,7 +280,7 @@ async function B(e, o) {
280
280
  const a = he(e);
281
281
  a && (n = a.marketKey, e = a.poolId);
282
282
  }
283
- const r = await R({
283
+ const r = await O({
284
284
  ...o,
285
285
  markets: [n || D],
286
286
  cacheTime: h
@@ -319,9 +319,9 @@ async function be(e, o, n, r) {
319
319
  n = e.splitCoins(n, [r.amount]);
320
320
  }
321
321
  let c;
322
- return typeof r?.amount < "u" ? c = y(r.amount, e.pure.u64) : c = e.moveCall({
322
+ return typeof r?.amount < "u" ? c = g(r.amount, e.pure.u64) : c = e.moveCall({
323
323
  target: "0x2::coin::value",
324
- arguments: [y(n, e.object)],
324
+ arguments: [g(n, e.object)],
325
325
  typeArguments: [a.suiCoinType]
326
326
  }), r?.accountCap ? e.moveCall({
327
327
  target: `${t.package}::incentive_v3::deposit_with_account_cap`,
@@ -330,10 +330,10 @@ async function be(e, o, n, r) {
330
330
  e.object(t.storage),
331
331
  e.object(a.contract.pool),
332
332
  e.pure.u8(a.id),
333
- y(n, e.object),
333
+ g(n, e.object),
334
334
  e.object(t.incentiveV2),
335
335
  e.object(t.incentiveV3),
336
- y(r.accountCap, e.object)
336
+ g(r.accountCap, e.object)
337
337
  ],
338
338
  typeArguments: [a.suiCoinType]
339
339
  }) : e.moveCall({
@@ -343,7 +343,7 @@ async function be(e, o, n, r) {
343
343
  e.object(t.storage),
344
344
  e.object(a.contract.pool),
345
345
  e.pure.u8(a.id),
346
- y(n, e.object),
346
+ g(n, e.object),
347
347
  c,
348
348
  e.object(t.incentiveV2),
349
349
  e.object(t.incentiveV3)
@@ -358,7 +358,7 @@ async function Ye(e, o, n, r) {
358
358
  const t = await k({
359
359
  ...r,
360
360
  cacheTime: h
361
- }), a = await B(o, r), i = y(n, e.pure.u64);
361
+ }), a = await B(o, r), i = g(n, e.pure.u64);
362
362
  let c;
363
363
  if (t.version === 1)
364
364
  if (r?.accountCap) {
@@ -373,7 +373,7 @@ async function Ye(e, o, n, r) {
373
373
  i,
374
374
  e.object(t.incentiveV2),
375
375
  e.object(t.incentiveV3),
376
- y(r.accountCap, e.object)
376
+ g(r.accountCap, e.object)
377
377
  ],
378
378
  typeArguments: [a.suiCoinType]
379
379
  });
@@ -407,7 +407,7 @@ async function Ye(e, o, n, r) {
407
407
  i,
408
408
  e.object(t.incentiveV2),
409
409
  e.object(t.incentiveV3),
410
- y(r.accountCap, e.object),
410
+ g(r.accountCap, e.object),
411
411
  e.object("0x05")
412
412
  ],
413
413
  typeArguments: [a.suiCoinType]
@@ -444,7 +444,7 @@ async function Je(e, o, n, r) {
444
444
  }), a = await B(o, r);
445
445
  if (a?.deprecatedAt && Date.now() > a.deprecatedAt)
446
446
  throw new Error(`The lending pool for coinType ${a.suiCoinType} has been deprecated.`);
447
- const i = y(n, e.pure.u64);
447
+ const i = g(n, e.pure.u64);
448
448
  let c;
449
449
  if (t.version === 1)
450
450
  if (r?.accountCap) {
@@ -459,7 +459,7 @@ async function Je(e, o, n, r) {
459
459
  i,
460
460
  e.object(t.incentiveV2),
461
461
  e.object(t.incentiveV3),
462
- y(r.accountCap, e.object)
462
+ g(r.accountCap, e.object)
463
463
  ],
464
464
  typeArguments: [a.suiCoinType]
465
465
  });
@@ -493,7 +493,7 @@ async function Je(e, o, n, r) {
493
493
  i,
494
494
  e.object(t.incentiveV2),
495
495
  e.object(t.incentiveV3),
496
- y(r.accountCap, e.object),
496
+ g(r.accountCap, e.object),
497
497
  e.object("0x05")
498
498
  ],
499
499
  typeArguments: [a.suiCoinType]
@@ -534,9 +534,9 @@ async function Qe(e, o, n, r) {
534
534
  n = e.splitCoins(n, [r.amount]);
535
535
  }
536
536
  let c;
537
- if (typeof r?.amount < "u" ? c = y(r.amount, e.pure.u64) : c = e.moveCall({
537
+ if (typeof r?.amount < "u" ? c = g(r.amount, e.pure.u64) : c = e.moveCall({
538
538
  target: "0x2::coin::value",
539
- arguments: [y(n, e.object)],
539
+ arguments: [g(n, e.object)],
540
540
  typeArguments: [a.suiCoinType]
541
541
  }), r?.accountCap) {
542
542
  const [s] = e.moveCall({
@@ -547,10 +547,10 @@ async function Qe(e, o, n, r) {
547
547
  e.object(t.storage),
548
548
  e.object(a.contract.pool),
549
549
  e.pure.u8(a.id),
550
- y(n, e.object),
550
+ g(n, e.object),
551
551
  e.object(t.incentiveV2),
552
552
  e.object(t.incentiveV3),
553
- y(r.accountCap, e.object)
553
+ g(r.accountCap, e.object)
554
554
  ],
555
555
  typeArguments: [a.suiCoinType]
556
556
  });
@@ -568,7 +568,7 @@ async function Qe(e, o, n, r) {
568
568
  e.object(t.storage),
569
569
  e.object(a.contract.pool),
570
570
  e.pure.u8(a.id),
571
- y(n, e.object),
571
+ g(n, e.object),
572
572
  c,
573
573
  e.object(t.incentiveV2),
574
574
  e.object(t.incentiveV3)
@@ -598,7 +598,7 @@ const Xe = A(
598
598
  const c = await a.devInspectTransactionBlock({
599
599
  transactionBlock: i,
600
600
  sender: e.address
601
- }), s = O(c, [C.u64()]);
601
+ }), s = R(c, [C.u64()]);
602
602
  return (Number(s[0]) || 0) / 100;
603
603
  } catch (t) {
604
604
  console.error(t);
@@ -636,8 +636,8 @@ class ke {
636
636
  return;
637
637
  }
638
638
  n[s.uniqueId] || this.pools.push(s), s?.emodes?.forEach((m) => {
639
- r[m.uniqueId] || this.emodes.push(m), m.assets.forEach((g) => {
640
- g.isDebt && t.add(s.uniqueId), g.isCollateral && a.add(s.uniqueId);
639
+ r[m.uniqueId] || this.emodes.push(m), m.assets.forEach((y) => {
640
+ y.isDebt && t.add(s.uniqueId), y.isCollateral && a.add(s.uniqueId);
641
641
  });
642
642
  }), c = c.plus(s.poolBorrowValue), i = i.plus(s.poolSupplyValue);
643
643
  }), this.poolMap = q(this.pools, "id"), this.emodeMap = z(this.emodes, "emodeId"), this.emodes.forEach((s) => {
@@ -686,7 +686,7 @@ const j = (e) => {
686
686
  }, Ce = A(
687
687
  I(
688
688
  async (e, o) => {
689
- const n = await R({
689
+ const n = await O({
690
690
  cacheTime: 6e4,
691
691
  ...o,
692
692
  markets: e
@@ -738,12 +738,12 @@ async function Te(e, o, n) {
738
738
  target: `${r.package}::lending::enter_emode_with_account_cap`,
739
739
  arguments: [
740
740
  e.object(r.storage),
741
- y(o, e.pure.u64),
742
- y(n.accountCap, e.object)
741
+ g(o, e.pure.u64),
742
+ g(n.accountCap, e.object)
743
743
  ]
744
744
  }) : e.moveCall({
745
745
  target: `${r.package}::lending::enter_emode`,
746
- arguments: [e.object(r.storage), y(o, e.pure.u64)]
746
+ arguments: [e.object(r.storage), g(o, e.pure.u64)]
747
747
  }), e;
748
748
  }
749
749
  async function xe(e, o) {
@@ -753,7 +753,7 @@ async function xe(e, o) {
753
753
  });
754
754
  return o?.accountCap ? e.moveCall({
755
755
  target: `${n.package}::lending::exit_emode_with_account_cap`,
756
- arguments: [e.object(n.storage), y(o.accountCap, e.object)]
756
+ arguments: [e.object(n.storage), g(o.accountCap, e.object)]
757
757
  }) : e.moveCall({
758
758
  target: `${n.package}::lending::exit_emode`,
759
759
  arguments: [e.object(n.storage)]
@@ -774,8 +774,8 @@ async function et(e, o, n) {
774
774
  arguments: [
775
775
  e.object(r.emode.contract.registryObject),
776
776
  i,
777
- y(a.id, e.pure.u64),
778
- y(o, e.pure.u64)
777
+ g(a.id, e.pure.u64),
778
+ g(o, e.pure.u64)
779
779
  ]
780
780
  }), t;
781
781
  }
@@ -794,10 +794,10 @@ const X = A(
794
794
  transactionBlock: r,
795
795
  sender: e
796
796
  })).results[0].returnValues, c = C.vector(C.u64()).parse(Uint8Array.from(i[0][0])), s = C.vector(C.u64()).parse(Uint8Array.from(i[1][0])), u = C.vector(C.Address).parse(Uint8Array.from(i[2][0]));
797
- return c.map((m, g) => ({
797
+ return c.map((m, y) => ({
798
798
  marketId: Number(m),
799
- emodeId: Number(s[g]),
800
- accountCap: u[g].toString()
799
+ emodeId: Number(s[y]),
800
+ accountCap: u[y].toString()
801
801
  }));
802
802
  }
803
803
  )
@@ -835,12 +835,12 @@ async function Z(e, o, n, r, t, a, i) {
835
835
  e.object("0x06"),
836
836
  e.object(c.storage),
837
837
  e.object(c.oracle.priceOracle),
838
- we(e, s),
839
- y(o, e.pure.address),
840
- y(s.id, e.pure.u8),
841
- y(r, e.pure.u64),
842
- y(t, e.pure.u64),
843
- y(a, e.pure.bool)
838
+ ve(e, s),
839
+ g(o, e.pure.address),
840
+ g(s.id, e.pure.u8),
841
+ g(r, e.pure.u64),
842
+ g(t, e.pure.u64),
843
+ g(a, e.pure.bool)
844
844
  ],
845
845
  typeArguments: [s.suiCoinType]
846
846
  });
@@ -849,31 +849,31 @@ async function Ie(e, o, n) {
849
849
  return Z(e, o, 0, 0, 0, !1, n);
850
850
  }
851
851
  async function x(e, o, n) {
852
- const r = new U(), t = n?.client ?? $, a = await R({
852
+ const r = new U(), t = n?.client ?? $, a = await O({
853
853
  ...n,
854
854
  markets: Object.values(E)
855
855
  }), i = q(a);
856
856
  for (let m of o) {
857
- const g = await k({
857
+ const y = await k({
858
858
  ...n,
859
859
  cacheTime: h,
860
860
  market: m.market
861
861
  });
862
862
  r.moveCall({
863
- target: `${g.uiGetter}::getter_unchecked::get_user_state`,
864
- arguments: [r.object(g.storage), r.pure.address(m.address)]
863
+ target: `${y.uiGetter}::getter_unchecked::get_user_state`,
864
+ arguments: [r.object(y.storage), r.pure.address(m.address)]
865
865
  });
866
866
  }
867
867
  const s = ((await t.devInspectTransactionBlock({
868
868
  transactionBlock: r,
869
869
  sender: e
870
- })).results || []).map((m) => m.returnValues?.map((g) => C.vector(de).parse(Uint8Array.from(g[0])))[0] || []), u = [];
871
- return s.forEach((m, g) => {
872
- const v = o[g], w = j(v.market);
870
+ })).results || []).map((m) => m.returnValues?.map((y) => C.vector(de).parse(Uint8Array.from(y[0])))[0] || []), u = [];
871
+ return s.forEach((m, y) => {
872
+ const w = o[y], v = j(w.market);
873
873
  m.forEach((p) => {
874
874
  if (p.supply_balance === "0" && p.borrow_balance === "0")
875
875
  return;
876
- const f = i[`${w.key}-${p.asset_id}`];
876
+ const f = i[`${v.key}-${p.asset_id}`];
877
877
  if (!f)
878
878
  return;
879
879
  const _ = G(
@@ -887,9 +887,9 @@ async function x(e, o, n) {
887
887
  supplyBalance: _,
888
888
  borrowBalance: T,
889
889
  assetId: p.asset_id,
890
- market: w.key,
890
+ market: v.key,
891
891
  pool: f,
892
- emodeId: v.emodeId
892
+ emodeId: w.emodeId
893
893
  });
894
894
  });
895
895
  }), u;
@@ -909,15 +909,15 @@ async function rt(e, o) {
909
909
  const t = await n.devInspectTransactionBlock({
910
910
  transactionBlock: r,
911
911
  sender: e
912
- }), a = O(t, [C.u256()]);
912
+ }), a = R(t, [C.u256()]);
913
913
  return Q(Number(a[0]) || 0);
914
914
  }
915
915
  async function at(e, o, n, r) {
916
916
  const t = r?.client ?? $, a = new U();
917
917
  let i = 0, c = 0;
918
918
  const s = await B(o, r);
919
- if (n.forEach((v) => {
920
- v.type === N.Supply ? i += v.amount : v.type === N.Withdraw ? i -= v.amount : v.type === N.Borrow ? c += v.amount : v.type === N.Repay && (c -= v.amount);
919
+ if (n.forEach((w) => {
920
+ w.type === N.Supply ? i += w.amount : w.type === N.Withdraw ? i -= w.amount : w.type === N.Borrow ? c += w.amount : w.type === N.Repay && (c -= w.amount);
921
921
  }), i * c < 0)
922
922
  throw new Error("Invalid operations");
923
923
  const u = i > 0 || c > 0;
@@ -933,8 +933,8 @@ async function at(e, o, n, r) {
933
933
  const m = await t.devInspectTransactionBlock({
934
934
  transactionBlock: a,
935
935
  sender: e
936
- }), g = O(m, [C.u256()]);
937
- return Q(Number(g[0]) || 0);
936
+ }), y = R(m, [C.u256()]);
937
+ return Q(Number(y[0]) || 0);
938
938
  }
939
939
  const ct = I(
940
940
  async (e, o) => {
@@ -1217,18 +1217,18 @@ class M {
1217
1217
  getPositionsOverview(o) {
1218
1218
  const n = {}, r = {};
1219
1219
  let t = new l(0), a = new l(0), i = new l(0), c = new l(0), s = new l(0), u = new l(0);
1220
- o.forEach((w) => {
1221
- if (w.type === "navi-lending-supply") {
1222
- const p = w["navi-lending-supply"];
1220
+ o.forEach((v) => {
1221
+ if (v.type === "navi-lending-supply") {
1222
+ const p = v["navi-lending-supply"];
1223
1223
  t = t.plus(p.valueUSD), s = s.plus(
1224
1224
  new l(p.valueUSD).multipliedBy(p.pool.liquidationFactor.threshold)
1225
1225
  ), u = u.plus(
1226
1226
  new l(p.valueUSD).multipliedBy(p.pool.ltvValue)
1227
1227
  );
1228
- } else if (w.type === "navi-lending-borrow")
1229
- a = a.plus(w["navi-lending-borrow"].valueUSD);
1230
- else if (w.type === "navi-lending-emode-supply") {
1231
- const p = w["navi-lending-emode-supply"];
1228
+ } else if (v.type === "navi-lending-borrow")
1229
+ a = a.plus(v["navi-lending-borrow"].valueUSD);
1230
+ else if (v.type === "navi-lending-emode-supply") {
1231
+ const p = v["navi-lending-emode-supply"];
1232
1232
  t = t.plus(p.valueUSD);
1233
1233
  const f = p.pool.emode;
1234
1234
  s = s.plus(
@@ -1236,35 +1236,35 @@ class M {
1236
1236
  ), u = u.plus(
1237
1237
  new l(p.valueUSD).multipliedBy(f.ltv)
1238
1238
  );
1239
- } else w.type === "navi-lending-emode-borrow" && (a = a.plus(w["navi-lending-emode-borrow"].valueUSD));
1240
- }), o.forEach((w) => {
1241
- if (w.type === "navi-lending-supply") {
1242
- const p = w["navi-lending-supply"], f = p.pool.supplyIncentiveApyInfo.apy;
1239
+ } else v.type === "navi-lending-emode-borrow" && (a = a.plus(v["navi-lending-emode-borrow"].valueUSD));
1240
+ }), o.forEach((v) => {
1241
+ if (v.type === "navi-lending-supply") {
1242
+ const p = v["navi-lending-supply"], f = p.pool.supplyIncentiveApyInfo.apy;
1243
1243
  i = i.plus(
1244
1244
  new l(p.valueUSD).dividedBy(t).multipliedBy(new l(f).dividedBy(100))
1245
1245
  ), n[p.pool.suiCoinType] = l(n[p.pool.suiCoinType] || 0).plus(p.amount).toString();
1246
- } else if (w.type === "navi-lending-borrow") {
1247
- const p = w["navi-lending-borrow"], f = p.pool.borrowIncentiveApyInfo.apy;
1246
+ } else if (v.type === "navi-lending-borrow") {
1247
+ const p = v["navi-lending-borrow"], f = p.pool.borrowIncentiveApyInfo.apy;
1248
1248
  a.gt(0) && (c = c.plus(
1249
1249
  new l(p.valueUSD).dividedBy(a).multipliedBy(new l(f).dividedBy(100))
1250
1250
  )), r[p.pool.suiCoinType] = l(r[p.pool.suiCoinType] || 0).plus(p.amount).toString();
1251
- } else if (w.type === "navi-lending-emode-supply") {
1252
- const p = w["navi-lending-emode-supply"], f = p.pool.supplyIncentiveApyInfo.apy;
1251
+ } else if (v.type === "navi-lending-emode-supply") {
1252
+ const p = v["navi-lending-emode-supply"], f = p.pool.supplyIncentiveApyInfo.apy;
1253
1253
  t.gt(0) && (i = i.plus(
1254
1254
  new l(p.valueUSD).dividedBy(t).multipliedBy(new l(f).dividedBy(100))
1255
1255
  )), n[p.pool.suiCoinType] = l(n[p.pool.suiCoinType] || 0).plus(p.amount).toString();
1256
- } else if (w.type === "navi-lending-emode-borrow") {
1257
- const p = w["navi-lending-emode-borrow"], f = p.pool.borrowIncentiveApyInfo.apy;
1256
+ } else if (v.type === "navi-lending-emode-borrow") {
1257
+ const p = v["navi-lending-emode-borrow"], f = p.pool.borrowIncentiveApyInfo.apy;
1258
1258
  a.gt(0) && (c = c.plus(
1259
1259
  new l(p.valueUSD).dividedBy(a).multipliedBy(new l(f).dividedBy(100))
1260
1260
  )), r[p.pool.suiCoinType] = l(r[p.pool.suiCoinType] || 0).plus(p.amount).toString();
1261
1261
  }
1262
1262
  });
1263
- const m = t.minus(a), g = t.minus(a).eq(0) ? new l(0) : t.multipliedBy(i).minus(a.multipliedBy(c)).div(t.minus(a));
1263
+ const m = t.minus(a), y = t.minus(a).eq(0) ? new l(0) : t.multipliedBy(i).minus(a.multipliedBy(c)).div(t.minus(a));
1264
1264
  return {
1265
1265
  hf: a.toNumber() !== 0 ? s.dividedBy(a).toNumber() : 1 / 0,
1266
1266
  netVaule: m.toString(),
1267
- netWorthApr: g.toString(),
1267
+ netWorthApr: y.toString(),
1268
1268
  totalSupplyValue: t.toString(),
1269
1269
  totalBorrowValue: a.toString(),
1270
1270
  totalsupplyApy: i.toString(),
@@ -1331,7 +1331,23 @@ async function Se(e, o, n) {
1331
1331
  }
1332
1332
  }
1333
1333
  for (const t of o)
1334
- e.moveCall({
1334
+ n?.env === "dev" ? e.moveCall({
1335
+ target: `${r.oracle.packageId}::oracle_pro::update_single_price`,
1336
+ arguments: [
1337
+ e.object("0x6"),
1338
+ // Clock object
1339
+ e.object(r.oracle.oracleConfig),
1340
+ // Oracle configuration
1341
+ e.object(r.oracle.priceOracle),
1342
+ // Price oracle contract
1343
+ e.object(r.oracle.supraOracleHolder),
1344
+ // Supra oracle holder
1345
+ e.object(t.pythPriceInfoObject),
1346
+ // Pyth price info object
1347
+ e.pure.address(t.feedId)
1348
+ // Price feed ID
1349
+ ]
1350
+ }) : e.moveCall({
1335
1351
  target: `${r.oracle.packageId}::oracle_pro::update_single_price_v2`,
1336
1352
  arguments: [
1337
1353
  e.object("0x6"),
@@ -1422,7 +1438,7 @@ async function lt(e, o, n, r) {
1422
1438
  arguments: [
1423
1439
  e.object(t.flashloanConfig),
1424
1440
  e.object(a.contract.pool),
1425
- y(n, e.pure.u64)
1441
+ g(n, e.pure.u64)
1426
1442
  ],
1427
1443
  typeArguments: [a.suiCoinType]
1428
1444
  });
@@ -1433,7 +1449,7 @@ async function lt(e, o, n, r) {
1433
1449
  arguments: [
1434
1450
  e.object(t.flashloanConfig),
1435
1451
  e.object(a.contract.pool),
1436
- y(n, e.pure.u64),
1452
+ g(n, e.pure.u64),
1437
1453
  e.object("0x05")
1438
1454
  ],
1439
1455
  typeArguments: [a.suiCoinType]
@@ -1459,8 +1475,8 @@ async function pt(e, o, n, r, t) {
1459
1475
  e.object("0x06"),
1460
1476
  e.object(a.storage),
1461
1477
  e.object(i.contract.pool),
1462
- y(n, e.object),
1463
- y(r, e.object)
1478
+ g(n, e.object),
1479
+ g(r, e.object)
1464
1480
  ],
1465
1481
  typeArguments: [i.suiCoinType]
1466
1482
  });
@@ -1472,7 +1488,7 @@ async function dt(e, o, n, r, t, a) {
1472
1488
  cacheTime: h
1473
1489
  }, c = await k(i), s = await B(o, i), u = await B(r, i);
1474
1490
  if (c.version === 1) {
1475
- const [m, g] = e.moveCall({
1491
+ const [m, y] = e.moveCall({
1476
1492
  target: `${c.package}::incentive_v3::liquidation`,
1477
1493
  arguments: [
1478
1494
  e.object("0x06"),
@@ -1485,13 +1501,13 @@ async function dt(e, o, n, r, t, a) {
1485
1501
  // Pay asset ID
1486
1502
  e.object(s.contract.pool),
1487
1503
  // Pay asset pool contract
1488
- y(n, e.object),
1504
+ g(n, e.object),
1489
1505
  // Debt repayment amount
1490
1506
  e.pure.u8(u.id),
1491
1507
  // Collateral asset ID
1492
1508
  e.object(u.contract.pool),
1493
1509
  // Collateral asset pool contract
1494
- y(t, e.pure.address),
1510
+ g(t, e.pure.address),
1495
1511
  // Borrower address
1496
1512
  e.object(c.incentiveV2),
1497
1513
  // Incentive V2 contract
@@ -1500,9 +1516,9 @@ async function dt(e, o, n, r, t, a) {
1500
1516
  ],
1501
1517
  typeArguments: [s.suiCoinType, u.suiCoinType]
1502
1518
  });
1503
- return [m, g];
1519
+ return [m, y];
1504
1520
  } else {
1505
- const [m, g] = e.moveCall({
1521
+ const [m, y] = e.moveCall({
1506
1522
  target: `${c.package}::incentive_v3::liquidation_v2`,
1507
1523
  arguments: [
1508
1524
  e.object("0x06"),
@@ -1515,13 +1531,13 @@ async function dt(e, o, n, r, t, a) {
1515
1531
  // Pay asset ID
1516
1532
  e.object(s.contract.pool),
1517
1533
  // Pay asset pool contract
1518
- y(n, e.object),
1534
+ g(n, e.object),
1519
1535
  // Debt repayment amount
1520
1536
  e.pure.u8(u.id),
1521
1537
  // Collateral asset ID
1522
1538
  e.object(u.contract.pool),
1523
1539
  // Collateral asset pool contract
1524
- y(t, e.pure.address),
1540
+ g(t, e.pure.address),
1525
1541
  // Borrower address
1526
1542
  e.object(c.incentiveV2),
1527
1543
  // Incentive V2 contract
@@ -1532,29 +1548,29 @@ async function dt(e, o, n, r, t, a) {
1532
1548
  ],
1533
1549
  typeArguments: [s.suiCoinType, u.suiCoinType]
1534
1550
  });
1535
- return [m, g];
1551
+ return [m, y];
1536
1552
  }
1537
1553
  }
1538
1554
  async function Ve(e, o, n) {
1539
- const r = n?.client ?? $, t = new U(), a = await R({
1555
+ const r = n?.client ?? $, t = new U(), a = await O({
1540
1556
  ...n,
1541
1557
  markets: Object.values(E),
1542
1558
  cacheTime: h
1543
1559
  }), i = await te(n);
1544
1560
  for (let m of o) {
1545
- const g = await k({
1561
+ const y = await k({
1546
1562
  ...n,
1547
1563
  cacheTime: h,
1548
1564
  market: m.market
1549
1565
  });
1550
1566
  t.moveCall({
1551
- target: `${g.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
1567
+ target: `${y.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
1552
1568
  arguments: [
1553
1569
  t.object("0x06"),
1554
1570
  // Clock object
1555
- t.object(g.storage),
1571
+ t.object(y.storage),
1556
1572
  // Protocol storage
1557
- t.object(g.incentiveV3),
1573
+ t.object(y.incentiveV3),
1558
1574
  // Incentive V3 contract
1559
1575
  t.pure.address(m.address)
1560
1576
  // User address
@@ -1567,7 +1583,7 @@ async function Ve(e, o, n) {
1567
1583
  }), s = [];
1568
1584
  c?.results?.forEach((m) => {
1569
1585
  s.push(
1570
- O(
1586
+ R(
1571
1587
  {
1572
1588
  results: [m]
1573
1589
  },
@@ -1587,11 +1603,11 @@ async function Ve(e, o, n) {
1587
1603
  );
1588
1604
  });
1589
1605
  const u = [];
1590
- return s.forEach((m, g) => {
1591
- const v = o[g];
1606
+ return s.forEach((m, y) => {
1607
+ const w = o[y];
1592
1608
  if (m.length === 5 && Array.isArray(m[0])) {
1593
- const w = m[0].length;
1594
- for (let p = 0; p < w; p++) {
1609
+ const v = m[0].length;
1610
+ for (let p = 0; p < v; p++) {
1595
1611
  const f = i.find(
1596
1612
  (T) => b(T.coinType) === b(m[1][p])
1597
1613
  ), _ = a.find(
@@ -1604,9 +1620,9 @@ async function Ve(e, o, n) {
1604
1620
  option: Number(m[2][p]),
1605
1621
  userClaimableReward: Number(m[4][p]) / Math.pow(10, f.priceDecimal),
1606
1622
  ruleIds: Array.isArray(m[3][p]) ? m[3][p] : [m[3][p]],
1607
- market: v.market,
1608
- owner: v.address,
1609
- emodeId: v.emodeId
1623
+ market: w.market,
1624
+ owner: w.address,
1625
+ emodeId: w.emodeId
1610
1626
  });
1611
1627
  }
1612
1628
  }
@@ -1628,7 +1644,7 @@ async function mt(e, o) {
1628
1644
  );
1629
1645
  return await Ve(e, t, o);
1630
1646
  }
1631
- function yt(e) {
1647
+ function gt(e) {
1632
1648
  const o = /* @__PURE__ */ new Map();
1633
1649
  e.forEach((r) => {
1634
1650
  const t = r.assetId, a = r.option, i = `${t}-${a}-${r.rewardCoinType}-${r.market}`;
@@ -1657,7 +1673,7 @@ function yt(e) {
1657
1673
  }))
1658
1674
  }));
1659
1675
  }
1660
- const gt = I(
1676
+ const yt = I(
1661
1677
  async (e, o) => {
1662
1678
  const n = `https://open-api.naviprotocol.io/api/navi/user/total_claimed_reward?userAddress=${e}&sdk=${S.version}&market=${o?.market || D}`;
1663
1679
  return (await fetch(n, { headers: V }).then((t) => t.json())).data;
@@ -1670,37 +1686,37 @@ const gt = I(
1670
1686
  });
1671
1687
  }
1672
1688
  );
1673
- async function wt(e, o, n) {
1689
+ async function vt(e, o, n) {
1674
1690
  const r = await k({
1675
1691
  ...n,
1676
1692
  cacheTime: h
1677
- }), t = await R({
1693
+ }), t = await O({
1678
1694
  ...n,
1679
1695
  markets: Object.values(E),
1680
1696
  cacheTime: h
1681
1697
  }), a = /* @__PURE__ */ new Map();
1682
1698
  for (const c of o) {
1683
- const { rewardCoinType: s, ruleIds: u, market: m, owner: g, emodeId: v } = c, w = `${s}-${m}-${g}`;
1699
+ const { rewardCoinType: s, ruleIds: u, market: m, owner: y, emodeId: w } = c, v = `${s}-${m}-${y}`;
1684
1700
  for (const p of u) {
1685
- a.has(w) || a.set(w, {
1701
+ a.has(v) || a.set(v, {
1686
1702
  assetIds: [],
1687
1703
  ruleIds: [],
1688
1704
  amount: 0,
1689
1705
  market: m,
1690
- owner: g,
1691
- isEMode: typeof v < "u"
1706
+ owner: y,
1707
+ isEMode: typeof w < "u"
1692
1708
  });
1693
- const f = a.get(w);
1709
+ const f = a.get(v);
1694
1710
  f.assetIds.push(c.assetCoinType.replace("0x", "")), f.ruleIds.push(p), f.amount += c.userClaimableReward;
1695
1711
  }
1696
1712
  }
1697
1713
  const i = [];
1698
- for (const [c, { assetIds: s, ruleIds: u, amount: m, market: g, owner: v, isEMode: w }] of a) {
1714
+ for (const [c, { assetIds: s, ruleIds: u, amount: m, market: y, owner: w, isEMode: v }] of a) {
1699
1715
  const p = t.find(
1700
- (_) => b(_.suiCoinType) === b(c) && _.market === g
1716
+ (_) => b(_.suiCoinType) === b(c) && _.market === y
1701
1717
  );
1702
1718
  if (!p || !p.contract.rewardFundId)
1703
- throw new Error(`No matching rewardFund found for reward coin: ${c} ${g}`);
1719
+ throw new Error(`No matching rewardFund found for reward coin: ${c} ${y}`);
1704
1720
  const f = p.contract.rewardFundId;
1705
1721
  if (n?.accountCap && !n.customCoinReceive)
1706
1722
  throw new Error("customCoinReceive is required when accountCap is provided");
@@ -1721,11 +1737,11 @@ async function wt(e, o, n) {
1721
1737
  // Asset IDs
1722
1738
  e.pure.vector("address", u),
1723
1739
  // Rule IDs
1724
- y(n.accountCap, e.object)
1740
+ g(n.accountCap, e.object)
1725
1741
  // Account capability
1726
1742
  ],
1727
1743
  typeArguments: [c]
1728
- }) : w ? _ = e.moveCall({
1744
+ }) : v ? _ = e.moveCall({
1729
1745
  target: `${r.package}::incentive_v3::claim_reward_with_account_cap`,
1730
1746
  arguments: [
1731
1747
  e.object("0x06"),
@@ -1740,7 +1756,7 @@ async function wt(e, o, n) {
1740
1756
  // Asset IDs
1741
1757
  e.pure.vector("address", u),
1742
1758
  // Rule IDs
1743
- y(v, e.object)
1759
+ g(w, e.object)
1744
1760
  // Account capability
1745
1761
  ],
1746
1762
  typeArguments: [c]
@@ -1772,7 +1788,7 @@ async function wt(e, o, n) {
1772
1788
  throw new Error("customCoinReceive.transfer is required");
1773
1789
  e.transferObjects(
1774
1790
  [T],
1775
- y(n.customCoinReceive.transfer, e.pure.address)
1791
+ g(n.customCoinReceive.transfer, e.pure.address)
1776
1792
  );
1777
1793
  }
1778
1794
  if (n?.customCoinReceive.type === "depositNAVI") {
@@ -1785,10 +1801,10 @@ async function wt(e, o, n) {
1785
1801
  i.push({
1786
1802
  coin: T,
1787
1803
  identifier: p,
1788
- owner: v,
1789
- isEMode: w
1804
+ owner: w,
1805
+ isEMode: v
1790
1806
  });
1791
- } else if (n?.accountCap || w) {
1807
+ } else if (n?.accountCap || v) {
1792
1808
  const _ = e.moveCall({
1793
1809
  target: `${r.package}::incentive_v3::claim_reward_with_account_cap`,
1794
1810
  arguments: [
@@ -1804,7 +1820,7 @@ async function wt(e, o, n) {
1804
1820
  // Asset IDs
1805
1821
  e.pure.vector("address", u),
1806
1822
  // Rule IDs
1807
- y(n?.accountCap || v, e.object)
1823
+ g(n?.accountCap || w, e.object)
1808
1824
  // Account capability
1809
1825
  ],
1810
1826
  typeArguments: [c]
@@ -1815,7 +1831,7 @@ async function wt(e, o, n) {
1815
1831
  });
1816
1832
  e.transferObjects(
1817
1833
  [T],
1818
- y(n?.accountCap || v, e.pure.address)
1834
+ g(n?.accountCap || w, e.pure.address)
1819
1835
  );
1820
1836
  } else
1821
1837
  e.moveCall({
@@ -1855,7 +1871,7 @@ export {
1855
1871
  M as UserPositions,
1856
1872
  de as UserStateInfo,
1857
1873
  Je as borrowCoinPTB,
1858
- wt as claimLendingRewardsPTB,
1874
+ vt as claimLendingRewardsPTB,
1859
1875
  _e as createAccountCapPTB,
1860
1876
  et as createEModeCapPTB,
1861
1877
  be as depositCoinPTB,
@@ -1879,7 +1895,7 @@ export {
1879
1895
  j as getMarketConfig,
1880
1896
  Ce as getMarkets,
1881
1897
  B as getPool,
1882
- R as getPools,
1898
+ O as getPools,
1883
1899
  te as getPriceFeeds,
1884
1900
  Ae as getPythStalePriceFeedId,
1885
1901
  at as getSimulatedHealthFactor,
@@ -1889,15 +1905,15 @@ export {
1889
1905
  mt as getUserAvailableLendingRewards,
1890
1906
  ft as getUserClaimedRewardHistory,
1891
1907
  X as getUserEModeCaps,
1892
- gt as getUserTotalClaimedReward,
1908
+ yt as getUserTotalClaimedReward,
1893
1909
  dt as liquidatePTB,
1894
1910
  ot as mergeCoinsPTB,
1895
1911
  b as normalizeCoinType,
1896
1912
  he as parsePoolUID,
1897
- y as parseTxValue,
1913
+ g as parseTxValue,
1898
1914
  Qe as repayCoinPTB,
1899
1915
  pt as repayFlashLoanPTB,
1900
- yt as summaryLendingRewards,
1916
+ gt as summaryLendingRewards,
1901
1917
  st as updateOraclePriceBeforeUserOperationPTB,
1902
1918
  Se as updateOraclePricesPTB,
1903
1919
  $e as updatePythPriceFeeds,