@naviprotocol/lending 2.0.5-beta.2 → 2.0.5-beta.3

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,6 +1,6 @@
1
1
  import { Transaction as q } from "@mysten/sui/transactions";
2
2
  import { bcs as l } from "@mysten/sui/bcs";
3
- import { toHex as Me, fromHex as De, normalizeStructTag as Y, SUI_CLOCK_OBJECT_ID as x, fromBase64 as Fe } from "@mysten/sui/utils";
3
+ import { toHex as Ue, fromHex as De, normalizeStructTag as Y, SUI_CLOCK_OBJECT_ID as x, fromBase64 as Fe } from "@mysten/sui/utils";
4
4
  import Ne from "lodash.camelcase";
5
5
  import p from "bignumber.js";
6
6
  import { SuiJsonRpcClient as Re } from "@mysten/sui/jsonRpc";
@@ -9,7 +9,7 @@ import { SuiGrpcClient as we, GrpcWebFetchTransport as be } from "@mysten/sui/gr
9
9
  const ie = l.bytes(32).transform({
10
10
  // To change the input type, you need to provide a type definition for the input
11
11
  input: (e) => De(e),
12
- output: (e) => Me(e)
12
+ output: (e) => Ue(e)
13
13
  }), zt = l.struct("IncentiveAPYInfo", {
14
14
  /** Asset identifier */
15
15
  asset_id: l.u8(),
@@ -129,7 +129,7 @@ const ie = l.bytes(32).transform({
129
129
  borrow_balance: l.u256(),
130
130
  /** User's current supply balance */
131
131
  supply_balance: l.u256()
132
- }), We = "2.0.5-beta.2", V = {
132
+ }), We = "2.0.5-beta.3", V = {
133
133
  version: We
134
134
  }, He = V.version, Je = () => {
135
135
  if (typeof process < "u" && process.versions && process.versions.node) {
@@ -163,7 +163,7 @@ function Ce(e) {
163
163
  throw new Error("NAVI Sui balance helpers require a v2 Core API client");
164
164
  return t;
165
165
  }
166
- function ke(e, t = ve) {
166
+ function je(e, t = ve) {
167
167
  const r = ee(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
168
  let o = ee(e.balance ?? e.totalBalance), n = ee(e.coinBalance);
169
169
  return !n && o && (n = Ze(o, r)), !o && n && (o = Ye(n, r)), {
@@ -180,12 +180,12 @@ function Jt(e, t = ve) {
180
180
  }
181
181
  async function Kt(e, t) {
182
182
  const r = await Ce(e).getBalance(t), o = r.balance;
183
- return ke((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
183
+ return je((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
184
  }
185
185
  async function Qt(e, t) {
186
186
  const r = await Ce(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => ke(n)),
188
+ balances: o.map((n) => je(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
@@ -299,7 +299,7 @@ function ut(e) {
299
299
  function lt(e) {
300
300
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
301
301
  }
302
- class je {
302
+ class ke {
303
303
  constructor(t, r) {
304
304
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
305
305
  }
@@ -560,7 +560,7 @@ function Zt(e) {
560
560
  function de() {
561
561
  return _e;
562
562
  }
563
- function U(e) {
563
+ function M(e) {
564
564
  const t = e?.services?.naviOpenApi ?? Q.services?.naviOpenApi;
565
565
  return {
566
566
  baseUrl: mt(t?.baseUrl ?? pt),
@@ -568,7 +568,7 @@ function U(e) {
568
568
  };
569
569
  }
570
570
  function F(e, t) {
571
- const r = U(t), o = e.startsWith("/") ? e : `/${e}`;
571
+ const r = M(t), o = e.startsWith("/") ? e : `/${e}`;
572
572
  return `${r.baseUrl}${o}`;
573
573
  }
574
574
  function ft(e) {
@@ -586,7 +586,7 @@ function N(e, t) {
586
586
  ...t?.headers ?? {}
587
587
  };
588
588
  }
589
- const M = nt();
589
+ const U = nt();
590
590
  function pe(e) {
591
591
  return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Fe(e)) : [];
592
592
  }
@@ -685,7 +685,7 @@ function Pe(e) {
685
685
  __naviSdkServiceConfigVersion: de()
686
686
  }), JSON.stringify(t);
687
687
  }
688
- function A(e) {
688
+ function S(e) {
689
689
  const t = {};
690
690
  return (...r) => {
691
691
  const o = Pe(r);
@@ -732,11 +732,11 @@ function Z(e, t, r) {
732
732
  function C(e) {
733
733
  return Y(e);
734
734
  }
735
- function Se(e) {
735
+ function Ae(e) {
736
736
  const t = (e || 0) / Math.pow(10, 27);
737
737
  return t > Math.pow(10, 5) ? 1 / 0 : t;
738
738
  }
739
- new je("https://hermes.pyth.network", {
739
+ new ke("https://hermes.pyth.network", {
740
740
  timeout: 2e4
741
741
  });
742
742
  const bt = 27, me = (e, t) => {
@@ -779,14 +779,14 @@ function vt(e) {
779
779
  poolId: parseInt(r)
780
780
  };
781
781
  }
782
- function S() {
782
+ function A() {
783
783
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
784
784
  }
785
785
  var H = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(H || {});
786
786
  const J = O(
787
- A(
787
+ S(
788
788
  async (e) => {
789
- const t = (e?.markets || [L.main]).map((a) => P(a)), r = U(e), o = F(
789
+ const t = (e?.markets || [L.main]).map((a) => P(a)), r = M(e), o = F(
790
790
  `/navi/pools?env=${e?.env || "prod"}&sdk=${V.version}&market=${t.map(
791
791
  (a) => a.key
792
792
  )}`,
@@ -796,9 +796,9 @@ const J = O(
796
796
  );
797
797
  return n.data.forEach((a) => {
798
798
  const i = n.meta.emodes.filter((b) => {
799
- const k = P(b.marketId);
800
- return a.market === k.key && b.isActive;
801
- }).filter((b) => !!b.assets.find((k) => k.assetId === a.id));
799
+ const j = P(b.marketId);
800
+ return a.market === j.key && b.isActive;
801
+ }).filter((b) => !!b.assets.find((j) => j.assetId === a.id));
802
802
  a.emodes = i;
803
803
  const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), u = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(), w = p(u).multipliedBy(a.oracle.price).toString(), g = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), y = p.max(
804
804
  p(a.borrowedAmount),
@@ -828,16 +828,16 @@ async function E(e, t) {
828
828
  return n.isDeprecated && console.log(`The lending pool for coinType ${n.suiCoinType} is going to be deprecated.`), n;
829
829
  }
830
830
  const Xt = O(
831
- A(async (e) => {
832
- const t = U(e), r = F(`/navi/stats?sdk=${V.version}`, e);
831
+ S(async (e) => {
832
+ const t = M(e), r = F(`/navi/stats?sdk=${V.version}`, e);
833
833
  return (await fetch(r, {
834
834
  headers: N(R, t)
835
835
  }).then((n) => n.json())).data;
836
836
  })
837
837
  ), xt = O(
838
- A(
838
+ S(
839
839
  async (e) => {
840
- const t = U(e), r = F(`/navi/fee?sdk=${V.version}`, e);
840
+ const t = M(e), r = F(`/navi/fee?sdk=${V.version}`, e);
841
841
  return await fetch(r, {
842
842
  headers: N(R, t)
843
843
  }).then((n) => n.json());
@@ -1115,11 +1115,11 @@ async function rr(e, t, r, o) {
1115
1115
  }), e;
1116
1116
  }
1117
1117
  const nr = O(
1118
- A(
1118
+ S(
1119
1119
  async (e) => {
1120
1120
  const t = await I({
1121
1121
  ...e
1122
- }), r = e?.client ?? M;
1122
+ }), r = e?.client ?? U;
1123
1123
  if (e?.address && typeof e?.asset < "u")
1124
1124
  try {
1125
1125
  const a = await E(e.asset, e), c = new q();
@@ -1171,39 +1171,39 @@ const nr = O(
1171
1171
  id: 3,
1172
1172
  key: "sui-eco",
1173
1173
  name: "Sui Eco Market"
1174
- },
1175
- "sui-usdc": {
1176
- id: 4,
1177
- key: "sui-usdc",
1178
- name: "SUI/USDC Market"
1179
- },
1180
- "wbtc-usdc": {
1181
- id: 5,
1182
- key: "wbtc-usdc",
1183
- name: "WBTC/USDC Market"
1184
- },
1185
- "xbtc-usdc": {
1186
- id: 6,
1187
- key: "xbtc-usdc",
1188
- name: "xBTC/USDC Market"
1189
- },
1190
- "vsui-usdc": {
1191
- id: 7,
1192
- key: "vsui-usdc",
1193
- name: "vSUI/USDC Market"
1194
- },
1195
- "vsui-sui": {
1196
- id: 8,
1197
- key: "vsui-sui",
1198
- name: "vSUI/SUI Market"
1199
- },
1200
- "hasui-sui": {
1201
- id: 9,
1202
- key: "hasui-sui",
1203
- name: "hasSUI/SUI Market"
1204
1174
  }
1175
+ // 'sui-usdc': {
1176
+ // id: 4,
1177
+ // key: 'sui-usdc',
1178
+ // name: 'SUI/USDC Market'
1179
+ // },
1180
+ // 'wbtc-usdc': {
1181
+ // id: 5,
1182
+ // key: 'wbtc-usdc',
1183
+ // name: 'WBTC/USDC Market'
1184
+ // },
1185
+ // 'xbtc-usdc': {
1186
+ // id: 6,
1187
+ // key: 'xbtc-usdc',
1188
+ // name: 'xBTC/USDC Market'
1189
+ // },
1190
+ // 'vsui-usdc': {
1191
+ // id: 7,
1192
+ // key: 'vsui-usdc',
1193
+ // name: 'vSUI/USDC Market'
1194
+ // },
1195
+ // 'vsui-sui': {
1196
+ // id: 8,
1197
+ // key: 'vsui-sui',
1198
+ // name: 'vSUI/SUI Market'
1199
+ // },
1200
+ // 'hasui-sui': {
1201
+ // id: 9,
1202
+ // key: 'hasui-sui',
1203
+ // name: 'hasSUI/SUI Market'
1204
+ // }
1205
1205
  };
1206
- class kt {
1206
+ class jt {
1207
1207
  constructor(t, r) {
1208
1208
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1209
1209
  marketTotalSupplyValue: "0",
@@ -1272,7 +1272,7 @@ const P = (e) => {
1272
1272
  throw new Error("Market not found");
1273
1273
  return r;
1274
1274
  }, It = O(
1275
- A(
1275
+ S(
1276
1276
  async (e, t) => {
1277
1277
  const r = await J({
1278
1278
  cacheTime: 6e4,
@@ -1281,18 +1281,18 @@ const P = (e) => {
1281
1281
  });
1282
1282
  return e.map((o) => {
1283
1283
  const n = P(o), a = r.filter((c) => c.market === n.key);
1284
- return new kt(o, a);
1284
+ return new jt(o, a);
1285
1285
  });
1286
1286
  }
1287
1287
  )
1288
1288
  ), or = O(
1289
- A(
1289
+ S(
1290
1290
  async (e, t) => (await It([e], t))[0]
1291
1291
  )
1292
1292
  ), I = O(
1293
- A(
1293
+ S(
1294
1294
  async (e) => {
1295
- const t = P(e?.market || z), r = U(e), o = F(
1295
+ const t = P(e?.market || z), r = M(e), o = F(
1296
1296
  `/navi/config?env=${e?.env || "prod"}&sdk=${V.version}&market=${t.key}`,
1297
1297
  e
1298
1298
  );
@@ -1302,7 +1302,7 @@ const P = (e) => {
1302
1302
  }
1303
1303
  )
1304
1304
  ), v = 1e3 * 60 * 5;
1305
- async function jt(e, t) {
1305
+ async function kt(e, t) {
1306
1306
  const r = await I({
1307
1307
  cacheTime: v,
1308
1308
  ...t
@@ -1356,7 +1356,7 @@ async function ir(e, t, r) {
1356
1356
  const o = await I({
1357
1357
  cacheTime: v,
1358
1358
  ...r
1359
- }), n = await jt(e, r);
1359
+ }), n = await kt(e, r);
1360
1360
  await Tt(e, t, {
1361
1361
  ...r,
1362
1362
  accountCap: n
@@ -1372,13 +1372,13 @@ async function ir(e, t, r) {
1372
1372
  ]
1373
1373
  }), n;
1374
1374
  }
1375
- const Ae = O(
1376
- A(
1375
+ const Se = O(
1376
+ S(
1377
1377
  async (e, t) => {
1378
1378
  const r = await I({
1379
1379
  cacheTime: v,
1380
1380
  ...t
1381
- }), o = new q(), n = t?.client ?? M;
1381
+ }), o = new q(), n = t?.client ?? U;
1382
1382
  o.moveCall({
1383
1383
  target: `${r.emode.contract.registryPackage}::registry::find_user_emode_account_caps`,
1384
1384
  arguments: [o.object(r.emode.contract.registryObject), o.pure.address(e)]
@@ -1429,14 +1429,14 @@ function sr(e, t, r) {
1429
1429
  } catch {
1430
1430
  return !1;
1431
1431
  }
1432
- })(s || m || "") && !!r?.useGasCoin, d = BigInt(n), f = !y && !!m, b = f ? a : 0n, k = u + b, _ = !o || u >= d ? 0n : d - u, j = f && _ > 0n && b >= _;
1433
- if (o && k < d)
1434
- throw new Error(`Balance is less than the specified balance: ${k} < ${d}`);
1435
- if (i.length === 0 && !j)
1432
+ })(s || m || "") && !!r?.useGasCoin, d = BigInt(n), f = !y && !!m, b = f ? a : 0n, j = u + b, _ = !o || u >= d ? 0n : d - u, k = f && _ > 0n && b >= _;
1433
+ if (o && j < d)
1434
+ throw new Error(`Balance is less than the specified balance: ${j} < ${d}`);
1435
+ if (i.length === 0 && !k)
1436
1436
  throw new Error("No coins to merge");
1437
1437
  if (y)
1438
1438
  return o ? e.splitCoins(e.gas, [e.pure.u64(n)]) : e.gas;
1439
- if (!j)
1439
+ if (!k)
1440
1440
  return i.length === 1 ? e.object(i[0]) : e.mergeCoins(i[0], i.slice(1)), o ? e.splitCoins(i[0], [e.pure.u64(n)]) : i[0];
1441
1441
  const T = e.moveCall({
1442
1442
  target: "0x2::coin::redeem_funds",
@@ -1479,7 +1479,7 @@ async function Pt(e, t, r) {
1479
1479
  return $e(e, t, 0, 0, 0, !1, r);
1480
1480
  }
1481
1481
  async function Ee(e, t, r) {
1482
- const o = new q(), n = r?.client ?? M, a = await J({
1482
+ const o = new q(), n = r?.client ?? U, a = await J({
1483
1483
  ...r,
1484
1484
  markets: Object.values(L)
1485
1485
  }), c = ne(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => P(d));
@@ -1511,13 +1511,13 @@ async function Ee(e, t, r) {
1511
1511
  })).results || [], w = {};
1512
1512
  s.forEach((d, f) => {
1513
1513
  try {
1514
- const b = m[f]?.returnValues?.map((_) => l.vector(ze).parse(Uint8Array.from(_[0])))[0] || [], k = {};
1514
+ const b = m[f]?.returnValues?.map((_) => l.vector(ze).parse(Uint8Array.from(_[0])))[0] || [], j = {};
1515
1515
  for (const _ of b)
1516
- k[_.id] = {
1516
+ j[_.id] = {
1517
1517
  supplyIndex: _.supply_index,
1518
1518
  borrowIndex: _.borrow_index
1519
1519
  };
1520
- w[d.key] = k;
1520
+ w[d.key] = j;
1521
1521
  } catch (b) {
1522
1522
  console.warn(
1523
1523
  `[@naviprotocol/lending] Failed to decode reserve data for market "${d.key}", falling back to open-api pool indices`,
@@ -1527,19 +1527,19 @@ async function Ee(e, t, r) {
1527
1527
  });
1528
1528
  const g = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(Ge).parse(Uint8Array.from(f[0])))[0] || []), y = [];
1529
1529
  return g.forEach((d, f) => {
1530
- const b = t[f], k = P(b.market), _ = w[k.key] || {};
1531
- d.forEach((j) => {
1532
- if (j.supply_balance === "0" && j.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1530
+ const b = t[f], j = P(b.market), _ = w[j.key] || {};
1531
+ d.forEach((k) => {
1532
+ if (k.supply_balance === "0" && k.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1533
1533
  return;
1534
- const T = c[`${k.key}-${j.asset_id}`];
1534
+ const T = c[`${j.key}-${k.asset_id}`];
1535
1535
  if (!T)
1536
1536
  return;
1537
- const $ = _[j.asset_id], D = $?.supplyIndex ?? T.currentSupplyIndex, B = $?.borrowIndex ?? T.currentBorrowIndex, X = me(j.supply_balance, D).toString(), Ue = me(j.borrow_balance, B).toString();
1537
+ const $ = _[k.asset_id], D = $?.supplyIndex ?? T.currentSupplyIndex, B = $?.borrowIndex ?? T.currentBorrowIndex, X = me(k.supply_balance, D).toString(), Me = me(k.borrow_balance, B).toString();
1538
1538
  y.push({
1539
1539
  supplyBalance: X,
1540
- borrowBalance: Ue,
1541
- assetId: j.asset_id,
1542
- market: k.key,
1540
+ borrowBalance: Me,
1541
+ assetId: k.asset_id,
1542
+ market: j.key,
1543
1543
  pool: T,
1544
1544
  emodeId: b.emodeId
1545
1545
  });
@@ -1556,16 +1556,16 @@ const ur = O(
1556
1556
  }
1557
1557
  );
1558
1558
  async function lr(e, t) {
1559
- const r = t?.client ?? M, o = new q();
1559
+ const r = t?.client ?? U, o = new q();
1560
1560
  await Pt(o, e, t);
1561
1561
  const n = await W(r, {
1562
1562
  transactionBlock: o,
1563
1563
  sender: e
1564
1564
  }), a = Z(n, [l.u256()]);
1565
- return Se(Number(a[0]) || 0);
1565
+ return Ae(Number(a[0]) || 0);
1566
1566
  }
1567
1567
  async function dr(e, t, r, o) {
1568
- const n = o?.client ?? M, a = new q();
1568
+ const n = o?.client ?? U, a = new q();
1569
1569
  let c = 0, i = 0;
1570
1570
  const s = await E(t, o);
1571
1571
  if (r.forEach((g) => {
@@ -1586,13 +1586,13 @@ async function dr(e, t, r, o) {
1586
1586
  transactionBlock: a,
1587
1587
  sender: e
1588
1588
  }), w = Z(m, [l.u256()]);
1589
- return Se(Number(w[0]) || 0);
1589
+ return Ae(Number(w[0]) || 0);
1590
1590
  }
1591
- const pr = A(
1591
+ const pr = S(
1592
1592
  async (e, t) => {
1593
1593
  const r = new URLSearchParams();
1594
1594
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
1595
- const o = U(t), n = F(
1595
+ const o = M(t), n = F(
1596
1596
  `/navi/user/transactions?${r.toString()}&sdk=${V.version}`,
1597
1597
  t
1598
1598
  );
@@ -1603,7 +1603,7 @@ const pr = A(
1603
1603
  );
1604
1604
  async function mr(e, t) {
1605
1605
  let r = null;
1606
- const o = [], n = t?.client ?? M, a = n.core;
1606
+ const o = [], n = t?.client ?? U, a = n.core;
1607
1607
  do {
1608
1608
  let c;
1609
1609
  if (t?.coinType)
@@ -1674,9 +1674,9 @@ async function mr(e, t) {
1674
1674
  } while (r);
1675
1675
  return o;
1676
1676
  }
1677
- const St = O(
1677
+ const At = O(
1678
1678
  async (e, t) => {
1679
- const r = [], o = (t?.markets || Object.keys(L)).map((i) => P(i)), n = await Ae(e, t), a = o.map((i) => ({
1679
+ const r = [], o = (t?.markets || Object.keys(L)).map((i) => P(i)), n = await Se(e, t), a = o.map((i) => ({
1680
1680
  address: e,
1681
1681
  market: i.key
1682
1682
  })).concat(
@@ -1699,7 +1699,7 @@ const St = O(
1699
1699
  if (m.gt(0) || w.emode.isCollateral)
1700
1700
  try {
1701
1701
  r.push({
1702
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${S()}`,
1702
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${A()}`,
1703
1703
  wallet: e,
1704
1704
  protocol: "navi",
1705
1705
  market: i.market,
@@ -1721,7 +1721,7 @@ const St = O(
1721
1721
  if (m.gt(0) || w.emode.isDebt)
1722
1722
  try {
1723
1723
  r.push({
1724
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${S()}`,
1724
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${A()}`,
1725
1725
  wallet: e,
1726
1726
  protocol: "navi",
1727
1727
  market: i.market,
@@ -1742,7 +1742,7 @@ const St = O(
1742
1742
  if (p(i.supplyBalance).gt(0)) {
1743
1743
  const u = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1744
1744
  r.push({
1745
- id: `${i.pool.uniqueId}_navi-lending-supply-${S()}`,
1745
+ id: `${i.pool.uniqueId}_navi-lending-supply-${A()}`,
1746
1746
  wallet: e,
1747
1747
  protocol: "navi",
1748
1748
  type: "navi-lending-supply",
@@ -1758,7 +1758,7 @@ const St = O(
1758
1758
  if (p(i.borrowBalance).gt(0)) {
1759
1759
  const u = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1760
1760
  r.push({
1761
- id: `${i.pool.uniqueId}_navi-lending-borrow-${S()}`,
1761
+ id: `${i.pool.uniqueId}_navi-lending-borrow-${A()}`,
1762
1762
  wallet: e,
1763
1763
  protocol: "navi",
1764
1764
  market: i.market,
@@ -1827,7 +1827,7 @@ class G {
1827
1827
  const o = !!t.isEMode, n = this.getPrice(t);
1828
1828
  let a;
1829
1829
  return o ? a = {
1830
- id: S(),
1830
+ id: A(),
1831
1831
  wallet: "",
1832
1832
  protocol: "navi",
1833
1833
  market: "",
@@ -1840,7 +1840,7 @@ class G {
1840
1840
  emodeCap: {}
1841
1841
  }
1842
1842
  } : a = {
1843
- id: S(),
1843
+ id: A(),
1844
1844
  wallet: "",
1845
1845
  protocol: "navi",
1846
1846
  market: "",
@@ -1857,7 +1857,7 @@ class G {
1857
1857
  const o = !!t.isEMode, n = this.getPrice(t);
1858
1858
  let a;
1859
1859
  return o ? a = {
1860
- id: S(),
1860
+ id: A(),
1861
1861
  wallet: "",
1862
1862
  protocol: "navi",
1863
1863
  market: "",
@@ -1870,7 +1870,7 @@ class G {
1870
1870
  emodeCap: {}
1871
1871
  }
1872
1872
  } : a = {
1873
- id: S(),
1873
+ id: A(),
1874
1874
  wallet: "",
1875
1875
  protocol: "navi",
1876
1876
  market: "",
@@ -1887,7 +1887,7 @@ class G {
1887
1887
  const o = !!t.isEMode, n = this.getPrice(t);
1888
1888
  let a;
1889
1889
  return o ? a = {
1890
- id: S(),
1890
+ id: A(),
1891
1891
  wallet: "",
1892
1892
  protocol: "navi",
1893
1893
  market: "",
@@ -1900,7 +1900,7 @@ class G {
1900
1900
  emodeCap: {}
1901
1901
  }
1902
1902
  } : a = {
1903
- id: S(),
1903
+ id: A(),
1904
1904
  wallet: "",
1905
1905
  protocol: "navi",
1906
1906
  market: "",
@@ -1917,7 +1917,7 @@ class G {
1917
1917
  const o = !!t.isEMode, n = this.getPrice(t);
1918
1918
  let a;
1919
1919
  return o ? a = {
1920
- id: S(),
1920
+ id: A(),
1921
1921
  wallet: "",
1922
1922
  protocol: "navi",
1923
1923
  market: "",
@@ -1930,7 +1930,7 @@ class G {
1930
1930
  emodeCap: {}
1931
1931
  }
1932
1932
  } : a = {
1933
- id: S(),
1933
+ id: A(),
1934
1934
  wallet: "",
1935
1935
  protocol: "navi",
1936
1936
  market: "",
@@ -2031,7 +2031,7 @@ async function fr(e, t, r, o) {
2031
2031
  const ge = /* @__PURE__ */ new Map(), Oe = (e) => {
2032
2032
  const t = e ?? "https://hermes.pyth.network";
2033
2033
  let r = ge.get(t);
2034
- return r || (r = new je(t, { timeout: 1e4 }), ge.set(t, r)), r;
2034
+ return r || (r = new ke(t, { timeout: 1e4 }), ge.set(t, r)), r;
2035
2035
  };
2036
2036
  async function yr(e, t) {
2037
2037
  try {
@@ -2057,8 +2057,8 @@ async function yr(e, t) {
2057
2057
  throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2058
2058
  }
2059
2059
  }
2060
- async function At(e, t) {
2061
- const r = [], o = t?.client ?? M, n = e.map((c) => c.priceInfoObject), a = await ht(o, {
2060
+ async function St(e, t) {
2061
+ const r = [], o = t?.client ?? U, n = e.map((c) => c.priceInfoObject), a = await ht(o, {
2062
2062
  ids: Array.from(new Set(n)),
2063
2063
  options: { showContent: !0 }
2064
2064
  });
@@ -2092,7 +2092,7 @@ async function At(e, t) {
2092
2092
  }
2093
2093
  async function $t(e, t) {
2094
2094
  try {
2095
- const r = [], o = await At(e, t);
2095
+ const r = [], o = await St(e, t);
2096
2096
  if (!o) return r;
2097
2097
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2098
2098
  for (const a of o) {
@@ -2113,7 +2113,7 @@ async function $t(e, t) {
2113
2113
  }
2114
2114
  }
2115
2115
  async function Et(e, t, r) {
2116
- const o = r?.client ?? M, n = await I({
2116
+ const o = r?.client ?? U, n = await I({
2117
2117
  ...r,
2118
2118
  cacheTime: v
2119
2119
  });
@@ -2192,7 +2192,7 @@ async function gr(e, t, r, o) {
2192
2192
  r.forEach((u) => {
2193
2193
  c.includes(u.market) || c.push(u.market);
2194
2194
  });
2195
- const i = await St(t, {
2195
+ const i = await At(t, {
2196
2196
  ...o,
2197
2197
  markets: c
2198
2198
  });
@@ -2219,9 +2219,9 @@ async function gr(e, t, r, o) {
2219
2219
  }
2220
2220
  }
2221
2221
  const ae = O(
2222
- A(
2222
+ S(
2223
2223
  async (e) => {
2224
- const t = U(e), r = F(
2224
+ const t = M(e), r = F(
2225
2225
  `/navi/flashloan?env=${e?.env || "prod"}&sdk=${V.version}&market=${e?.market || z}`,
2226
2226
  e
2227
2227
  ), o = await fetch(r, {
@@ -2369,7 +2369,7 @@ async function vr(e, t, r, o, n, a) {
2369
2369
  }
2370
2370
  }
2371
2371
  async function Vt(e, t, r) {
2372
- const o = r?.client ?? M, n = await J({
2372
+ const o = r?.client ?? U, n = await J({
2373
2373
  ...r,
2374
2374
  markets: Object.values(L),
2375
2375
  cacheTime: v
@@ -2417,9 +2417,9 @@ async function Vt(e, t, r) {
2417
2417
  const y = g[0].length;
2418
2418
  for (let d = 0; d < y; d++) {
2419
2419
  const f = a.find(
2420
- (k) => C(k.coinType) === C(g[1][d])
2420
+ (j) => C(j.coinType) === C(g[1][d])
2421
2421
  ), b = n.find(
2422
- (k) => C(k.coinType) === C(g[0][d]) && k.market === i.market
2422
+ (j) => C(j.coinType) === C(g[0][d]) && j.market === i.market
2423
2423
  );
2424
2424
  !f || !b || c.push({
2425
2425
  assetId: b.id,
@@ -2445,7 +2445,7 @@ async function Vt(e, t, r) {
2445
2445
  ), c;
2446
2446
  }
2447
2447
  async function Cr(e, t) {
2448
- const r = (t?.markets || [L.main]).map((a) => P(a)), o = await Ae(e, t), n = r.map((a) => ({
2448
+ const r = (t?.markets || [L.main]).map((a) => P(a)), o = await Se(e, t), n = r.map((a) => ({
2449
2449
  address: e,
2450
2450
  owner: e,
2451
2451
  market: a.key
@@ -2462,7 +2462,7 @@ async function Cr(e, t) {
2462
2462
  );
2463
2463
  return await Vt(e, n, t);
2464
2464
  }
2465
- function kr(e) {
2465
+ function jr(e) {
2466
2466
  const t = /* @__PURE__ */ new Map();
2467
2467
  e.forEach((o) => {
2468
2468
  const n = o.assetId, a = o.option, c = `${n}-${a}-${o.rewardCoinType}-${o.market}`;
@@ -2491,9 +2491,9 @@ function kr(e) {
2491
2491
  }))
2492
2492
  }));
2493
2493
  }
2494
- const Ir = A(
2494
+ const Ir = S(
2495
2495
  async (e, t) => {
2496
- const r = U(t), o = F(
2496
+ const r = M(t), o = F(
2497
2497
  `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${V.version}&market=${t?.market || z}`,
2498
2498
  t
2499
2499
  );
@@ -2501,9 +2501,9 @@ const Ir = A(
2501
2501
  headers: N(R, r)
2502
2502
  }).then((a) => a.json())).data;
2503
2503
  }
2504
- ), jr = A(
2504
+ ), kr = S(
2505
2505
  async (e, t) => {
2506
- const r = U(t), o = F(
2506
+ const r = M(t), o = F(
2507
2507
  `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${V.version}&market=${t?.market || z}`,
2508
2508
  t
2509
2509
  ), n = await fetch(o, {
@@ -2546,17 +2546,17 @@ async function _r(e, t, r) {
2546
2546
  cacheTime: v,
2547
2547
  market: m
2548
2548
  }), f = c.split("___")[0], b = o.filter(
2549
- (j) => C(j.suiCoinType) === C(f)
2549
+ (k) => C(k.suiCoinType) === C(f)
2550
2550
  );
2551
- b.sort((j, T) => j.market === m ? -1 : 1);
2552
- const k = b[0], _ = d.rewardFunds[C(f)];
2551
+ b.sort((k, T) => k.market === m ? -1 : 1);
2552
+ const j = b[0], _ = d.rewardFunds[C(f)];
2553
2553
  if (!_)
2554
2554
  throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
2555
2555
  if (r?.accountCap && !r.customCoinReceive)
2556
2556
  throw new Error("customCoinReceive is required when accountCap is provided");
2557
2557
  if (r?.customCoinReceive) {
2558
- let j;
2559
- r.accountCap ? j = e.moveCall({
2558
+ let k;
2559
+ r.accountCap ? k = e.moveCall({
2560
2560
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2561
2561
  arguments: [
2562
2562
  e.object("0x06"),
@@ -2575,7 +2575,7 @@ async function _r(e, t, r) {
2575
2575
  // Account capability
2576
2576
  ],
2577
2577
  typeArguments: [f]
2578
- }) : y ? j = e.moveCall({
2578
+ }) : y ? k = e.moveCall({
2579
2579
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2580
2580
  arguments: [
2581
2581
  e.object("0x06"),
@@ -2594,7 +2594,7 @@ async function _r(e, t, r) {
2594
2594
  // Account capability
2595
2595
  ],
2596
2596
  typeArguments: [f]
2597
- }) : j = e.moveCall({
2597
+ }) : k = e.moveCall({
2598
2598
  target: `${d.package}::incentive_v3::claim_reward`,
2599
2599
  arguments: [
2600
2600
  e.object("0x06"),
@@ -2614,7 +2614,7 @@ async function _r(e, t, r) {
2614
2614
  });
2615
2615
  const [T] = e.moveCall({
2616
2616
  target: "0x2::coin::from_balance",
2617
- arguments: [j],
2617
+ arguments: [k],
2618
2618
  typeArguments: [f]
2619
2619
  });
2620
2620
  if (r?.customCoinReceive.type === "transfer") {
@@ -2626,23 +2626,23 @@ async function _r(e, t, r) {
2626
2626
  );
2627
2627
  }
2628
2628
  if (r?.customCoinReceive.type === "depositNAVI") {
2629
- const $ = p(k.totalSupplyAmount).shiftedBy(-9), D = p(k.supplyCapCeiling).shiftedBy(-27);
2629
+ const $ = p(j.totalSupplyAmount).shiftedBy(-9), D = p(j.supplyCapCeiling).shiftedBy(-27);
2630
2630
  $.plus(u).isGreaterThan(D) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2631
2631
  [T],
2632
2632
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2633
- ) : await Ct(e, k, T, {
2633
+ ) : await Ct(e, j, T, {
2634
2634
  ...r,
2635
- market: k.market
2635
+ market: j.market
2636
2636
  });
2637
2637
  } else
2638
2638
  a.push({
2639
2639
  coin: T,
2640
- identifier: k,
2640
+ identifier: j,
2641
2641
  owner: w,
2642
2642
  isEMode: y
2643
2643
  });
2644
2644
  } else if (r?.accountCap || y) {
2645
- const j = e.moveCall({
2645
+ const k = e.moveCall({
2646
2646
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2647
2647
  arguments: [
2648
2648
  e.object("0x06"),
@@ -2663,7 +2663,7 @@ async function _r(e, t, r) {
2663
2663
  typeArguments: [f]
2664
2664
  }), [T] = e.moveCall({
2665
2665
  target: "0x2::coin::from_balance",
2666
- arguments: [j],
2666
+ arguments: [k],
2667
2667
  typeArguments: [f]
2668
2668
  });
2669
2669
  e.transferObjects(
@@ -2701,13 +2701,13 @@ export {
2701
2701
  qe as IncentivePoolInfo,
2702
2702
  Gt as IncentivePoolInfoByPhase,
2703
2703
  L as MARKETS,
2704
- kt as Market,
2704
+ jt as Market,
2705
2705
  Qe as NaviMissingGraphQLClientError,
2706
2706
  Wt as OracleInfo,
2707
2707
  tt as PUBLIC_MAINNET_GRPC_URL,
2708
2708
  H as PoolOperator,
2709
2709
  ze as ReserveDataInfo,
2710
- je as SuiPriceServiceConnection,
2710
+ ke as SuiPriceServiceConnection,
2711
2711
  dt as SuiPythClient,
2712
2712
  G as UserPositions,
2713
2713
  Ge as UserStateInfo,
@@ -2715,7 +2715,7 @@ export {
2715
2715
  F as buildNaviOpenApiUrl,
2716
2716
  _r as claimLendingRewardsPTB,
2717
2717
  Zt as configureNaviSdk,
2718
- jt as createAccountCapPTB,
2718
+ kt as createAccountCapPTB,
2719
2719
  ir as createEModeCapPTB,
2720
2720
  Ie as createNaviLegacyJsonRpcClient,
2721
2721
  nt as createNaviSuiClient,
@@ -2737,7 +2737,7 @@ export {
2737
2737
  hr as getFlashLoanAsset,
2738
2738
  lr as getHealthFactor,
2739
2739
  Pt as getHealthFactorPTB,
2740
- St as getLendingPositions,
2740
+ At as getLendingPositions,
2741
2741
  ur as getLendingState,
2742
2742
  or as getMarket,
2743
2743
  P as getMarketConfig,
@@ -2752,28 +2752,28 @@ export {
2752
2752
  Xt as getStats,
2753
2753
  pr as getTransactions,
2754
2754
  Cr as getUserAvailableLendingRewards,
2755
- jr as getUserClaimedRewardHistory,
2756
- Ae as getUserEModeCaps,
2755
+ kr as getUserClaimedRewardHistory,
2756
+ Se as getUserEModeCaps,
2757
2757
  Ir as getUserTotalClaimedReward,
2758
2758
  vr as liquidatePTB,
2759
2759
  Qt as listAddressBalances,
2760
2760
  sr as mergeCoinsPTB,
2761
2761
  N as mergeServiceHeaders,
2762
- ke as normalizeAddressBalance,
2762
+ je as normalizeAddressBalance,
2763
2763
  C as normalizeCoinType,
2764
2764
  vt as parsePoolUID,
2765
2765
  h as parseTxValue,
2766
2766
  rr as repayCoinPTB,
2767
2767
  br as repayFlashLoanPTB,
2768
2768
  Yt as requireNaviGraphQLClient,
2769
- U as resolveNaviOpenApiEndpoint,
2770
- kr as summaryLendingRewards,
2769
+ M as resolveNaviOpenApiEndpoint,
2770
+ jr as summaryLendingRewards,
2771
2771
  gr as updateOraclePriceBeforeUserOperationPTB,
2772
2772
  he as updateOraclePricesPTB,
2773
2773
  Et as updatePythPriceFeeds,
2774
2774
  fr as verifyHealthFactorPTB,
2775
2775
  O as withCache,
2776
- A as withSingleton,
2776
+ S as withSingleton,
2777
2777
  er as withdrawCoinPTB
2778
2778
  };
2779
2779
  //# sourceMappingURL=index.esm.js.map