@naviprotocol/lending 1.4.5-beta.2 → 1.4.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
@@ -129,7 +129,7 @@ const J = d.bytes(32).transform({
129
129
  borrow_balance: d.u256(),
130
130
  /** User's current supply balance */
131
131
  supply_balance: d.u256()
132
- }), be = "1.4.5-beta.2", E = {
132
+ }), be = "1.4.5-beta.3", E = {
133
133
  version: be
134
134
  }, ke = E.version, _e = () => {
135
135
  if (typeof process < "u" && process.versions && process.versions.node)
@@ -143,7 +143,7 @@ const J = d.bytes(32).transform({
143
143
  }, Ce = () => {
144
144
  let e = "";
145
145
  return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${ke} (${_e()})`), e;
146
- }, Z = Ce(), M = new de({
146
+ }, Z = Ce(), V = new de({
147
147
  url: me("mainnet")
148
148
  });
149
149
  function ee(e) {
@@ -166,7 +166,7 @@ function P(e) {
166
166
  })), r[n];
167
167
  };
168
168
  }
169
- function V(e) {
169
+ function M(e) {
170
170
  let r = {};
171
171
  return (...o) => {
172
172
  const n = o[o.length - 1], t = ee(o), a = r[t];
@@ -253,7 +253,7 @@ function $() {
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 R = /* @__PURE__ */ ((e) => (e[e.Supply = 1] = "Supply", e[e.Withdraw = 2] = "Withdraw", e[e.Borrow = 3] = "Borrow", e[e.Repay = 4] = "Repay", e))(R || {});
256
- const q = V(
256
+ const q = M(
257
257
  P(
258
258
  async (e) => {
259
259
  const r = (e?.markets || [U.main]).map((t) => T(t)), o = `https://open-api.naviprotocol.io/api/navi/pools?env=${e?.env || "prod"}&sdk=${E.version}&market=${r.map(
@@ -292,12 +292,12 @@ async function S(e, r) {
292
292
  throw new Error("Pool not found");
293
293
  return t.isDeprecated && console.log(`The lending pool for coinType ${t.suiCoinType} is going to be deprecated.`), t;
294
294
  }
295
- const xe = V(
295
+ const xe = M(
296
296
  P(async (e) => {
297
297
  const r = `https://open-api.naviprotocol.io/api/navi/stats?sdk=${E.version}`;
298
298
  return (await fetch(r, { headers: D }).then((n) => n.json())).data;
299
299
  })
300
- ), et = V(
300
+ ), et = M(
301
301
  P(
302
302
  async (e) => {
303
303
  const r = `https://open-api.naviprotocol.io/api/navi/fee?sdk=${E.version}`;
@@ -578,7 +578,7 @@ async function rt(e, r, o, n) {
578
578
  typeArguments: [a.suiCoinType]
579
579
  }), e;
580
580
  }
581
- const nt = V(
581
+ const nt = M(
582
582
  P(
583
583
  async (e) => {
584
584
  const r = await _({
@@ -586,7 +586,7 @@ const nt = V(
586
586
  });
587
587
  if (e?.address && typeof e?.asset < "u")
588
588
  try {
589
- const t = await S(e.asset, e), a = e?.client ?? M, s = new F();
589
+ const t = await S(e.asset, e), a = e?.client ?? V, s = new F();
590
590
  s.moveCall({
591
591
  target: `${r.package}::incentive_v3::get_borrow_fee_v2`,
592
592
  arguments: [
@@ -605,7 +605,7 @@ const nt = V(
605
605
  } catch (t) {
606
606
  console.error(t);
607
607
  }
608
- const n = (await M.getObject({
608
+ const n = (await V.getObject({
609
609
  id: r.incentiveV3,
610
610
  options: { showType: !0, showOwner: !0, showContent: !0 }
611
611
  })).data.content.fields.borrow_fee_rate;
@@ -623,15 +623,15 @@ const nt = V(
623
623
  key: "ember",
624
624
  name: "Ember Market"
625
625
  },
626
- // 'sui-eco': {
627
- // id: 2,
628
- // key: 'sui-eco',
629
- // name: 'Sui Eco Market'
630
- // },
631
626
  rwa: {
632
627
  id: 2,
633
628
  key: "rwa",
634
629
  name: "Matrixdock Market"
630
+ },
631
+ "sui-eco": {
632
+ id: 3,
633
+ key: "sui-eco",
634
+ name: "Sui Eco Market"
635
635
  }
636
636
  };
637
637
  class Ae {
@@ -702,7 +702,7 @@ const T = (e) => {
702
702
  if (!o)
703
703
  throw new Error("Market not found");
704
704
  return o;
705
- }, $e = V(
705
+ }, $e = M(
706
706
  P(
707
707
  async (e, r) => {
708
708
  const o = await q({
@@ -716,11 +716,11 @@ const T = (e) => {
716
716
  });
717
717
  }
718
718
  )
719
- ), at = V(
719
+ ), at = M(
720
720
  P(
721
721
  async (e, r) => (await $e([e], r))[0]
722
722
  )
723
- ), _ = V(
723
+ ), _ = M(
724
724
  P(
725
725
  async (e) => {
726
726
  const r = T(e?.market || O), o = `https://open-api.naviprotocol.io/api/navi/config?env=${e?.env || "prod"}&sdk=${E.version}&market=${r.key}`;
@@ -748,7 +748,7 @@ async function Se(e, r, o) {
748
748
  arguments: [r]
749
749
  });
750
750
  }
751
- async function Ve(e, r, o) {
751
+ async function Me(e, r, o) {
752
752
  const n = await _({
753
753
  ...o,
754
754
  cacheTime: b
@@ -783,7 +783,7 @@ async function ct(e, r, o) {
783
783
  cacheTime: b,
784
784
  ...o
785
785
  }), t = await Pe(e, o);
786
- await Ve(e, r, {
786
+ await Me(e, r, {
787
787
  ...o,
788
788
  accountCap: t
789
789
  });
@@ -798,13 +798,13 @@ async function ct(e, r, o) {
798
798
  ]
799
799
  }), t;
800
800
  }
801
- const oe = V(
801
+ const oe = M(
802
802
  P(
803
803
  async (e, r) => {
804
804
  const o = await _({
805
805
  cacheTime: b,
806
806
  ...r
807
- }), n = new F(), t = r?.client ?? M;
807
+ }), n = new F(), t = r?.client ?? V;
808
808
  n.moveCall({
809
809
  target: `${o.emode.contract.registryPackage}::registry::find_user_emode_account_caps`,
810
810
  arguments: [n.object(o.emode.contract.registryObject), n.pure.address(e)]
@@ -864,11 +864,11 @@ async function re(e, r, o, n, t, a, s) {
864
864
  typeArguments: [c.suiCoinType]
865
865
  });
866
866
  }
867
- async function Me(e, r, o) {
867
+ async function Ve(e, r, o) {
868
868
  return re(e, r, 0, 0, 0, !1, o);
869
869
  }
870
870
  async function ne(e, r, o) {
871
- const n = new F(), t = o?.client ?? M, a = await q({
871
+ const n = new F(), t = o?.client ?? V, a = await q({
872
872
  ...o,
873
873
  markets: Object.values(U)
874
874
  }), s = z(a), c = Array.from(new Set(r.map((l) => l.market))).map((l) => T(l));
@@ -935,7 +935,7 @@ async function ne(e, r, o) {
935
935
  });
936
936
  }), y;
937
937
  }
938
- const ut = V(
938
+ const ut = M(
939
939
  async (e, r) => {
940
940
  const n = (r?.markets || Object.keys(U)).map((t) => T(t)).map((t) => ({
941
941
  address: e,
@@ -945,8 +945,8 @@ const ut = V(
945
945
  }
946
946
  );
947
947
  async function pt(e, r) {
948
- const o = r?.client ?? M, n = new F();
949
- await Me(n, e, r);
948
+ const o = r?.client ?? V, n = new F();
949
+ await Ve(n, e, r);
950
950
  const t = await o.devInspectTransactionBlock({
951
951
  transactionBlock: n,
952
952
  sender: e
@@ -954,7 +954,7 @@ async function pt(e, r) {
954
954
  return te(Number(a[0]) || 0);
955
955
  }
956
956
  async function dt(e, r, o, n) {
957
- const t = n?.client ?? M, a = new F();
957
+ const t = n?.client ?? V, a = new F();
958
958
  let s = 0, i = 0;
959
959
  const c = await S(r, n);
960
960
  if (o.forEach((v) => {
@@ -987,7 +987,7 @@ const mt = P(
987
987
  );
988
988
  async function ft(e, r) {
989
989
  let o = null;
990
- const n = [], t = r?.client ?? M;
990
+ const n = [], t = r?.client ?? V;
991
991
  do {
992
992
  let a;
993
993
  if (r?.coinType ? a = await t.getCoins({
@@ -1005,7 +1005,7 @@ async function ft(e, r) {
1005
1005
  } while (o);
1006
1006
  return n;
1007
1007
  }
1008
- const Ee = V(
1008
+ const Ee = M(
1009
1009
  async (e, r) => {
1010
1010
  const o = [], n = (r?.markets || Object.keys(U)).map((i) => T(i));
1011
1011
  let t = [];
@@ -1393,7 +1393,7 @@ async function gt(e) {
1393
1393
  }
1394
1394
  async function De(e, r) {
1395
1395
  try {
1396
- const o = [], n = r?.client ?? M, t = e.map((s) => s.priceInfoObject), a = await n.multiGetObjects({
1396
+ const o = [], n = r?.client ?? V, t = e.map((s) => s.priceInfoObject), a = await n.multiGetObjects({
1397
1397
  ids: Array.from(new Set(t)),
1398
1398
  options: { showContent: !0 }
1399
1399
  });
@@ -1447,7 +1447,7 @@ async function Ue(e, r) {
1447
1447
  }
1448
1448
  }
1449
1449
  async function Oe(e, r, o) {
1450
- const n = o?.client ?? M, t = await _({
1450
+ const n = o?.client ?? V, t = await _({
1451
1451
  ...o,
1452
1452
  cacheTime: b
1453
1453
  });
@@ -1561,7 +1561,7 @@ async function ht(e, r, o, n) {
1561
1561
  return console.error(t), e;
1562
1562
  }
1563
1563
  }
1564
- const Y = V(
1564
+ const Y = M(
1565
1565
  P(
1566
1566
  async (e) => {
1567
1567
  const r = `https://open-api.naviprotocol.io/api/navi/flashloan?env=${e?.env || "prod"}&sdk=${E.version}&market=${e?.market || O}`, o = await fetch(r, { headers: D }).then((n) => n.json());
@@ -1707,7 +1707,7 @@ async function kt(e, r, o, n, t, a) {
1707
1707
  }
1708
1708
  }
1709
1709
  async function Re(e, r, o) {
1710
- const n = o?.client ?? M, t = new F(), a = await q({
1710
+ const n = o?.client ?? V, t = new F(), a = await q({
1711
1711
  ...o,
1712
1712
  markets: Object.values(U),
1713
1713
  cacheTime: b
@@ -2050,7 +2050,7 @@ export {
2050
2050
  ct as createEModeCapPTB,
2051
2051
  Be as depositCoinPTB,
2052
2052
  st as emodeIdentityId,
2053
- Ve as enterEModePTB,
2053
+ Me as enterEModePTB,
2054
2054
  it as exitEModePTB,
2055
2055
  Fe as filterPriceFeeds,
2056
2056
  wt as flashloanPTB,
@@ -2062,7 +2062,7 @@ export {
2062
2062
  et as getFees,
2063
2063
  vt as getFlashLoanAsset,
2064
2064
  pt as getHealthFactor,
2065
- Me as getHealthFactorPTB,
2065
+ Ve as getHealthFactorPTB,
2066
2066
  Ee as getLendingPositions,
2067
2067
  ut as getLendingState,
2068
2068
  at as getMarket,
@@ -2093,7 +2093,7 @@ export {
2093
2093
  Ne as updateOraclePricesPTB,
2094
2094
  Oe as updatePythPriceFeeds,
2095
2095
  yt as verifyHealthFactorPTB,
2096
- V as withCache,
2096
+ M as withCache,
2097
2097
  P as withSingleton,
2098
2098
  tt as withdrawCoinPTB
2099
2099
  };