@naviprotocol/lending 2.0.0 → 2.0.1

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,137 +1,137 @@
1
1
  import { Transaction as N } from "@mysten/sui/transactions";
2
- import { bcs as u } from "@mysten/sui/bcs";
3
- import { toHex as $e, fromHex as Oe, normalizeStructTag as K, SUI_CLOCK_OBJECT_ID as Z, fromBase64 as Ee } from "@mysten/sui/utils";
4
- import Ve from "lodash.camelcase";
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";
5
5
  import p from "bignumber.js";
6
- import { SuiJsonRpcClient as Me } from "@mysten/sui/jsonRpc";
7
- import { SuiGraphQLClient as De } from "@mysten/sui/graphql";
8
- import { GrpcWebFetchTransport as Ue, SuiGrpcClient as Fe } from "@mysten/sui/grpc";
9
- const ne = u.bytes(32).transform({
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({
10
10
  // To change the input type, you need to provide a type definition for the input
11
11
  input: (e) => Oe(e),
12
- output: (e) => $e(e)
13
- }), Rt = u.struct("IncentiveAPYInfo", {
12
+ output: (e) => Ee(e)
13
+ }), Rt = l.struct("IncentiveAPYInfo", {
14
14
  /** Asset identifier */
15
- asset_id: u.u8(),
15
+ asset_id: l.u8(),
16
16
  /** Annual Percentage Yield as a 256-bit integer */
17
- apy: u.u256(),
17
+ apy: l.u256(),
18
18
  /** List of supported coin types for this incentive */
19
- coin_types: u.vector(u.string())
20
- }), Ne = u.struct("IncentivePoolInfo", {
19
+ coin_types: l.vector(l.string())
20
+ }), Re = l.struct("IncentivePoolInfo", {
21
21
  /** Unique pool identifier */
22
22
  pool_id: ne,
23
23
  /** Address holding the incentive funds */
24
24
  funds: ne,
25
25
  /** Current phase of the incentive program */
26
- phase: u.u64(),
26
+ phase: l.u64(),
27
27
  /** Timestamp when the incentive started */
28
- start_at: u.u64(),
28
+ start_at: l.u64(),
29
29
  /** Timestamp when the incentive ends */
30
- end_at: u.u64(),
30
+ end_at: l.u64(),
31
31
  /** Timestamp when the incentive was closed */
32
- closed_at: u.u64(),
32
+ closed_at: l.u64(),
33
33
  /** Total supply of incentive tokens */
34
- total_supply: u.u64(),
34
+ total_supply: l.u64(),
35
35
  /** Asset identifier for the incentive */
36
- asset_id: u.u8(),
36
+ asset_id: l.u8(),
37
37
  /** Option type for the incentive */
38
- option: u.u8(),
38
+ option: l.u8(),
39
39
  /** Factor used in incentive calculations */
40
- factor: u.u256(),
40
+ factor: l.u256(),
41
41
  /** Amount of incentives already distributed */
42
- distributed: u.u64(),
42
+ distributed: l.u64(),
43
43
  /** Amount of incentives currently available */
44
- available: u.u256(),
44
+ available: l.u256(),
45
45
  /** Total amount of incentives */
46
- total: u.u256()
47
- }), Lt = u.struct("IncentivePoolInfoByPhase", {
46
+ total: l.u256()
47
+ }), qt = l.struct("IncentivePoolInfoByPhase", {
48
48
  /** Phase number */
49
- phase: u.u64(),
49
+ phase: l.u64(),
50
50
  /** List of incentive pools in this phase */
51
- pools: u.vector(Ne)
52
- }), qt = u.struct("OracleInfo", {
51
+ pools: l.vector(Re)
52
+ }), Lt = l.struct("OracleInfo", {
53
53
  /** Oracle identifier */
54
- oracle_id: u.u8(),
54
+ oracle_id: l.u8(),
55
55
  /** Current price as a 256-bit integer */
56
- price: u.u256(),
56
+ price: l.u256(),
57
57
  /** Number of decimal places for the price */
58
- decimals: u.u8(),
58
+ decimals: l.u8(),
59
59
  /** Whether the oracle data is valid */
60
- valid: u.bool()
61
- }), zt = u.struct("FlashLoanAssetConfig", {
60
+ valid: l.bool()
61
+ }), zt = l.struct("FlashLoanAssetConfig", {
62
62
  /** Unique identifier for the flash loan asset */
63
- id: u.string(),
63
+ id: l.string(),
64
64
  /** Asset identifier */
65
- asset_id: u.u8(),
65
+ asset_id: l.u8(),
66
66
  /** Coin type for the asset */
67
- coin_type: u.string(),
67
+ coin_type: l.string(),
68
68
  /** Pool identifier for the flash loan */
69
- pool_id: u.string(),
69
+ pool_id: l.string(),
70
70
  /** Rate paid to suppliers for flash loans */
71
- rate_to_supplier: u.u64(),
71
+ rate_to_supplier: l.u64(),
72
72
  /** Rate paid to treasury for flash loans */
73
- rate_to_treasury: u.u64(),
73
+ rate_to_treasury: l.u64(),
74
74
  /** Maximum flash loan amount */
75
- max: u.u64(),
75
+ max: l.u64(),
76
76
  /** Minimum flash loan amount */
77
- min: u.u64()
78
- }), Re = u.struct("ReserveDataInfo", {
77
+ min: l.u64()
78
+ }), qe = l.struct("ReserveDataInfo", {
79
79
  /** Reserve identifier */
80
- id: u.u8(),
80
+ id: l.u8(),
81
81
  /** Oracle identifier for price feeds */
82
- oracle_id: u.u8(),
82
+ oracle_id: l.u8(),
83
83
  /** Coin type for the reserve */
84
- coin_type: u.string(),
84
+ coin_type: l.string(),
85
85
  /** Maximum supply capacity */
86
- supply_cap: u.u256(),
86
+ supply_cap: l.u256(),
87
87
  /** Maximum borrow capacity */
88
- borrow_cap: u.u256(),
88
+ borrow_cap: l.u256(),
89
89
  /** Current supply interest rate */
90
- supply_rate: u.u256(),
90
+ supply_rate: l.u256(),
91
91
  /** Current borrow interest rate */
92
- borrow_rate: u.u256(),
92
+ borrow_rate: l.u256(),
93
93
  /** Current supply index for interest calculation */
94
- supply_index: u.u256(),
94
+ supply_index: l.u256(),
95
95
  /** Current borrow index for interest calculation */
96
- borrow_index: u.u256(),
96
+ borrow_index: l.u256(),
97
97
  /** Total amount supplied to the reserve */
98
- total_supply: u.u256(),
98
+ total_supply: l.u256(),
99
99
  /** Total amount borrowed from the reserve */
100
- total_borrow: u.u256(),
100
+ total_borrow: l.u256(),
101
101
  /** Timestamp of last update */
102
- last_update_at: u.u64(),
102
+ last_update_at: l.u64(),
103
103
  /** Loan-to-Value ratio for collateral */
104
- ltv: u.u256(),
104
+ ltv: l.u256(),
105
105
  /** Treasury factor for fee calculations */
106
- treasury_factor: u.u256(),
106
+ treasury_factor: l.u256(),
107
107
  /** Current treasury balance */
108
- treasury_balance: u.u256(),
108
+ treasury_balance: l.u256(),
109
109
  /** Base interest rate */
110
- base_rate: u.u256(),
110
+ base_rate: l.u256(),
111
111
  /** Interest rate multiplier */
112
- multiplier: u.u256(),
112
+ multiplier: l.u256(),
113
113
  /** Jump rate multiplier for high utilization */
114
- jump_rate_multiplier: u.u256(),
114
+ jump_rate_multiplier: l.u256(),
115
115
  /** Reserve factor for protocol fees */
116
- reserve_factor: u.u256(),
116
+ reserve_factor: l.u256(),
117
117
  /** Optimal utilization rate */
118
- optimal_utilization: u.u256(),
118
+ optimal_utilization: l.u256(),
119
119
  /** Liquidation ratio threshold */
120
- liquidation_ratio: u.u256(),
120
+ liquidation_ratio: l.u256(),
121
121
  /** Liquidation bonus for liquidators */
122
- liquidation_bonus: u.u256(),
122
+ liquidation_bonus: l.u256(),
123
123
  /** Liquidation threshold */
124
- liquidation_threshold: u.u256()
125
- }), Le = u.struct("UserStateInfo", {
124
+ liquidation_threshold: l.u256()
125
+ }), Le = l.struct("UserStateInfo", {
126
126
  /** Asset identifier */
127
- asset_id: u.u8(),
127
+ asset_id: l.u8(),
128
128
  /** User's current borrow balance */
129
- borrow_balance: u.u256(),
129
+ borrow_balance: l.u256(),
130
130
  /** User's current supply balance */
131
- supply_balance: u.u256()
132
- }), qe = "2.0.0", O = {
133
- version: qe
134
- }, ze = O.version, Ge = () => {
131
+ supply_balance: l.u256()
132
+ }), ze = "2.0.1", E = {
133
+ version: ze
134
+ }, Ge = E.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}`;
@@ -139,9 +139,9 @@ const ne = u.bytes(32).transform({
139
139
  return "Node/Unknown";
140
140
  }, We = () => {
141
141
  let e = "";
142
- return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${ze} (${Ge()})`), e;
143
- }, oe = We(), me = "0x2::sui::SUI";
144
- class He extends Error {
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 {
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 He extends Error {
151
151
  function X(e) {
152
152
  return e == null ? void 0 : String(e);
153
153
  }
154
- function Je(e, t) {
154
+ function Ke(e, t) {
155
155
  return (BigInt(e) + BigInt(t)).toString();
156
156
  }
157
- function Ke(e, t) {
157
+ function Qe(e, t) {
158
158
  return (BigInt(e) - BigInt(t)).toString();
159
159
  }
160
- function fe(e) {
160
+ function ye(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 ye(e, t = me) {
166
+ function ge(e, t = fe) {
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 = Ke(o, r)), !o && n && (o = Je(n, r)), {
169
+ return !n && o && (n = Qe(o, r)), !o && n && (o = Ke(n, r)), {
170
170
  coinType: K(e.coinType ?? t),
171
171
  totalBalance: o ?? "0",
172
172
  coinBalance: n ?? "0",
@@ -174,66 +174,66 @@ function ye(e, t = me) {
174
174
  ...e.coinObjectCount === null || e.coinObjectCount === void 0 ? {} : { coinObjectCount: e.coinObjectCount }
175
175
  };
176
176
  }
177
- function Gt(e, t = me) {
177
+ function Gt(e, t = fe) {
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 Wt(e, t) {
182
- const r = await fe(e).getBalance(t), o = r.balance;
183
- return ye((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
- }
185
181
  async function Ht(e, t) {
186
- const r = await fe(e).listBalances(t), { balances: o = [] } = r;
182
+ const r = await ye(e).getBalance(t), o = r.balance;
183
+ return ge((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
+ }
185
+ async function Wt(e, t) {
186
+ const r = await ye(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => ye(n)),
188
+ balances: o.map((n) => ge(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
192
- function Qe(e, t) {
192
+ function Ye(e, t) {
193
193
  if ("client" in t)
194
194
  return t.client;
195
- const r = new Ue({
195
+ const r = new Fe({
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 Fe({
201
+ return new Ne({
202
202
  network: e,
203
203
  transport: r
204
204
  });
205
205
  }
206
- function Ye(e, t) {
207
- return "client" in t ? t.client : new De({
206
+ function Ze(e, t) {
207
+ return "client" in t ? t.client : new Ue({
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 ge(e, t) {
215
- return "client" in t ? t.client : new Me({
214
+ function he(e, t) {
215
+ return "client" in t ? t.client : new De({
216
216
  network: e,
217
217
  url: t.url
218
218
  });
219
219
  }
220
- function Ze(e) {
221
- const t = Qe(e.network, e.grpc);
220
+ function Xe(e) {
221
+ const t = Ye(e.network, e.grpc);
222
222
  return {
223
223
  network: e.network,
224
224
  coreClient: t,
225
225
  grpc: t,
226
- graphql: e.graphql ? Ye(e.network, e.graphql) : void 0,
227
- legacyJsonRpc: e.legacyJsonRpc ? ge(e.network, e.legacyJsonRpc) : void 0,
226
+ graphql: e.graphql ? Ze(e.network, e.graphql) : void 0,
227
+ legacyJsonRpc: e.legacyJsonRpc ? he(e.network, e.legacyJsonRpc) : void 0,
228
228
  services: e.services
229
229
  };
230
230
  }
231
231
  function Jt(e, t) {
232
232
  if (!e.graphql)
233
- throw new He(t);
233
+ throw new Je(t);
234
234
  return e.graphql;
235
235
  }
236
- function Xe() {
236
+ function xe() {
237
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
238
  {},
239
239
  {
@@ -255,10 +255,10 @@ function Xe() {
255
255
  }
256
256
  );
257
257
  }
258
- function xe(e, t = "mainnet") {
259
- return e ? typeof e == "string" ? ge(t, { url: e }) : Ze(e) : Xe();
258
+ function et(e, t = "mainnet") {
259
+ return e ? typeof e == "string" ? he(t, { url: e }) : Xe(e) : xe();
260
260
  }
261
- const et = 16 * 1024;
261
+ const tt = 16 * 1024;
262
262
  function te(e) {
263
263
  return e.replace(/^0x/i, "");
264
264
  }
@@ -268,12 +268,12 @@ function ae(e) {
268
268
  r[o] = parseInt(t.slice(o * 2, o * 2 + 2), 16);
269
269
  return r;
270
270
  }
271
- function tt(e, t) {
271
+ function rt(e, t) {
272
272
  return (e[t] << 8) + e[t + 1];
273
273
  }
274
274
  function ie(e) {
275
- return u.vector(u.U8).serialize(Array.from(e), {
276
- maxSize: et
275
+ return l.vector(l.U8).serialize(Array.from(e), {
276
+ maxSize: tt
277
277
  });
278
278
  }
279
279
  function ce(e, t) {
@@ -282,17 +282,17 @@ function ce(e, t) {
282
282
  bcs: t
283
283
  };
284
284
  }
285
- function rt(e) {
286
- return u.vector(u.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
287
- }
288
285
  function nt(e) {
289
- return u.struct("PriceIdentifier", {
290
- bytes: u.vector(u.U8)
286
+ return l.vector(l.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
287
+ }
288
+ function ot(e) {
289
+ return l.struct("PriceIdentifier", {
290
+ bytes: l.vector(l.U8)
291
291
  }).serialize({
292
292
  bytes: Array.from(e)
293
293
  }).toBytes();
294
294
  }
295
- function ot(e) {
295
+ function at(e) {
296
296
  const t = [];
297
297
  let r = 0, o = 0;
298
298
  for (let n = 0; n < e.length; n += 1) {
@@ -301,19 +301,19 @@ function ot(e) {
301
301
  }
302
302
  return t.push(e.slice(o).trim()), t;
303
303
  }
304
- function at(e) {
304
+ function it(e) {
305
305
  const r = e.indexOf("::table::Table"), o = e.indexOf("<", r), n = e.lastIndexOf(">"), a = "::price_identifier::PriceIdentifier";
306
306
  if (r < 0 || o < 0 || n <= o)
307
307
  throw new Error(`Unexpected Pyth price table type: ${e}`);
308
- const [c, i] = ot(e.slice(o + 1, n));
308
+ const [c, i] = at(e.slice(o + 1, n));
309
309
  if (!c?.endsWith(a) || !i?.endsWith("::object::ID"))
310
310
  throw new Error(`Unexpected Pyth price table type arguments: ${e}`);
311
311
  return c.slice(0, -a.length);
312
312
  }
313
- function it(e) {
313
+ function ct(e) {
314
314
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
315
315
  }
316
- class he {
316
+ class we {
317
317
  constructor(t, r) {
318
318
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
319
319
  }
@@ -341,7 +341,7 @@ class he {
341
341
  throw new Error(`Unsupported Hermes price update encoding: ${o}`);
342
342
  if (n.length === 0)
343
343
  throw new Error("Hermes price update response did not include binary update data");
344
- return n.map(it);
344
+ return n.map(ct);
345
345
  }
346
346
  async get(t, r, o) {
347
347
  const n = new AbortController(), a = setTimeout(() => n.abort(), this.timeout), c = new URL(`${this.endpoint}${t}`);
@@ -361,7 +361,7 @@ class he {
361
361
  }
362
362
  }
363
363
  }
364
- class ct {
364
+ class st {
365
365
  constructor(t, r, o) {
366
366
  this.provider = t, this.pythStateId = r, this.wormholeStateId = o, this.priceFeedObjectIdCache = /* @__PURE__ */ new Map();
367
367
  }
@@ -485,15 +485,15 @@ class ct {
485
485
  async executePriceFeedUpdates(t, r, o, n, a) {
486
486
  const c = [];
487
487
  for (const [i, s] of o.entries()) {
488
- const l = await this.getPriceFeedObjectId(s);
489
- if (!l)
488
+ const u = await this.getPriceFeedObjectId(s);
489
+ if (!u)
490
490
  throw new Error(`Price feed ${s} not found, please create it first`);
491
- c.push(l), [n] = t.moveCall({
491
+ c.push(u), [n] = t.moveCall({
492
492
  target: `${r}::pyth::update_single_price_feed`,
493
493
  arguments: [
494
494
  t.object(this.pythStateId),
495
495
  n,
496
- t.object(l),
496
+ t.object(u),
497
497
  a[i],
498
498
  t.object(Z)
499
499
  ]
@@ -516,7 +516,7 @@ class ct {
516
516
  if (!this.priceFeedObjectIdCache.has(r)) {
517
517
  const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = this.getCoreProvider() ? ce(
518
518
  `${n}::price_identifier::PriceIdentifier`,
519
- nt(ae(r))
519
+ ot(ae(r))
520
520
  ) : {
521
521
  type: `${n}::price_identifier::PriceIdentifier`,
522
522
  value: {
@@ -529,7 +529,7 @@ class ct {
529
529
  }
530
530
  async getPriceTableInfo() {
531
531
  if (!this.priceTableInfo) {
532
- const t = this.getCoreProvider() ? ce("vector<u8>", rt("price_info")) : {
532
+ const t = this.getCoreProvider() ? ce("vector<u8>", nt("price_info")) : {
533
533
  type: "vector<u8>",
534
534
  value: "price_info"
535
535
  }, r = await this.getDynamicMoveObjectJson(this.pythStateId, t);
@@ -537,18 +537,18 @@ class ct {
537
537
  throw new Error("Price Table not found, contract may not be initialized");
538
538
  this.priceTableInfo = {
539
539
  id: r.objectId,
540
- fieldType: at(r.type)
540
+ fieldType: it(r.type)
541
541
  };
542
542
  }
543
543
  return this.priceTableInfo;
544
544
  }
545
545
  extractVaaBytesFromAccumulatorMessage(t) {
546
- const o = 7 + t[6] + 1, n = tt(t, o), a = o + 2;
546
+ const o = 7 + t[6] + 1, n = rt(t, o), a = o + 2;
547
547
  return t.subarray(a, a + n);
548
548
  }
549
549
  }
550
- const st = "https://open-api.naviprotocol.io/api";
551
- let J = {}, we = 0;
550
+ const ut = "https://open-api.naviprotocol.io/api";
551
+ let J = {}, be = 0;
552
552
  function lt(e) {
553
553
  return e.replace(/\/+$/, "");
554
554
  }
@@ -560,23 +560,23 @@ function Kt(e) {
560
560
  ...J.services,
561
561
  ...e.services
562
562
  }
563
- }, we += 1;
563
+ }, be += 1;
564
564
  }
565
565
  function se() {
566
- return we;
566
+ return be;
567
567
  }
568
- function E(e) {
568
+ function O(e) {
569
569
  const t = e?.services?.naviOpenApi ?? J.services?.naviOpenApi;
570
570
  return {
571
- baseUrl: lt(t?.baseUrl ?? st),
571
+ baseUrl: lt(t?.baseUrl ?? ut),
572
572
  headers: t?.headers
573
573
  };
574
574
  }
575
575
  function M(e, t) {
576
- const r = E(t), o = e.startsWith("/") ? e : `/${e}`;
576
+ const r = O(t), o = e.startsWith("/") ? e : `/${e}`;
577
577
  return `${r.baseUrl}${o}`;
578
578
  }
579
- function ut(e) {
579
+ function dt(e) {
580
580
  if (e instanceof Headers) {
581
581
  const t = {};
582
582
  return e.forEach((r, o) => {
@@ -587,52 +587,55 @@ function ut(e) {
587
587
  }
588
588
  function D(e, t) {
589
589
  return {
590
- ...ut(e),
590
+ ...dt(e),
591
591
  ...t?.headers ?? {}
592
592
  };
593
593
  }
594
- const V = xe();
595
- function le(e) {
596
- return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Ee(e)) : [];
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;
597
601
  }
598
- function dt(e) {
602
+ function ue(e) {
603
+ return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Ve(e)) : [];
604
+ }
605
+ function pt(e) {
599
606
  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];
600
607
  return o && console.warn("[lending] devInspect(core simulate) returned error:", o), {
601
608
  effects: r.effects,
602
609
  events: r.events,
603
610
  error: o,
604
611
  results: t.map((n) => ({
605
- returnValues: (n.returnValues ?? []).map((a) => [le(a.bcs), ""]),
612
+ returnValues: (n.returnValues ?? []).map((a) => [ue(a.bcs), ""]),
606
613
  mutableReferenceOutputs: (n.mutatedReferences ?? []).map((a) => [
607
614
  "",
608
- le(a.bcs),
615
+ ue(a.bcs),
609
616
  ""
610
617
  ])
611
618
  }))
612
619
  };
613
620
  }
614
- async function q(e, t) {
621
+ async function L(e, t) {
615
622
  const r = e?.core;
616
- if (typeof r?.simulateTransaction == "function") {
617
- const o = t.transaction ?? t.transactionBlock;
618
- o instanceof N && o.setSenderIfNotSet(t.sender);
619
- const n = await r.simulateTransaction({
620
- transaction: o,
621
- checksEnabled: !1,
622
- include: {
623
- effects: !0,
624
- events: !0,
625
- commandResults: !0
626
- }
627
- });
628
- return dt(n);
629
- }
630
- return e.devInspectTransactionBlock({
631
- transactionBlock: t.transactionBlock ?? t.transaction,
632
- sender: t.sender
623
+ if (typeof r?.simulateTransaction != "function")
624
+ throw new Error("devInspectTransaction requires a Sui v2 Core-capable client");
625
+ const o = t.transaction ?? t.transactionBlock;
626
+ o instanceof N && o.setSenderIfNotSet(t.sender);
627
+ const n = await r.simulateTransaction({
628
+ transaction: o,
629
+ checksEnabled: !1,
630
+ include: {
631
+ effects: !0,
632
+ events: !0,
633
+ commandResults: !0
634
+ }
633
635
  });
636
+ return pt(n);
634
637
  }
635
- function be(e) {
638
+ function ve(e) {
636
639
  return {
637
640
  json: !!e?.showContent,
638
641
  display: !!e?.showDisplay,
@@ -640,7 +643,7 @@ function be(e) {
640
643
  objectBcs: !!e?.showBcs
641
644
  };
642
645
  }
643
- function ve(e) {
646
+ function Ce(e) {
644
647
  return !e || e instanceof Error ? {
645
648
  error: e instanceof Error ? { code: "notFound", error: e.message } : void 0
646
649
  } : {
@@ -660,36 +663,34 @@ function ve(e) {
660
663
  }
661
664
  };
662
665
  }
663
- async function pt(e, t) {
666
+ async function mt(e, t) {
664
667
  const r = e?.core;
665
- if (typeof r?.getObject == "function") {
666
- const { object: o } = await r.getObject({
667
- objectId: t.id,
668
- include: be(t.options)
669
- });
670
- return ve(o);
671
- }
672
- return e.getObject(t);
668
+ if (typeof r?.getObject != "function")
669
+ throw new Error("getSuiObject requires a Sui v2 Core-capable client");
670
+ const { object: o } = await r.getObject({
671
+ objectId: t.id,
672
+ include: ve(t.options)
673
+ });
674
+ return Ce(o);
673
675
  }
674
- async function mt(e, t) {
676
+ async function ft(e, t) {
675
677
  const r = e?.core;
676
- if (typeof r?.getObjects == "function") {
677
- const { objects: o } = await r.getObjects({
678
- objectIds: t.ids,
679
- include: be(t.options)
680
- });
681
- return o.map(ve);
682
- }
683
- return e.multiGetObjects(t);
678
+ if (typeof r?.getObjects != "function")
679
+ throw new Error("multiGetSuiObjects requires a Sui v2 Core-capable client");
680
+ const { objects: o } = await r.getObjects({
681
+ objectIds: t.ids,
682
+ include: ve(t.options)
683
+ });
684
+ return o.map(Ce);
684
685
  }
685
- function Ce(e) {
686
+ function je(e) {
686
687
  const t = [];
687
688
  let r = !1;
688
689
  return e.forEach((o, n) => {
689
690
  const a = n === e.length - 1;
690
691
  if (typeof o == "object" && o !== null && a) {
691
- const { client: c, disableCache: i, cacheTime: s, ...l } = o;
692
- l.__naviSdkServiceConfigVersion = se(), t.push(l), r = !0;
692
+ const { client: c, disableCache: i, cacheTime: s, ...u } = o;
693
+ u.__naviSdkServiceConfigVersion = se(), t.push(u), r = !0;
693
694
  } else
694
695
  t.push(o);
695
696
  }), r || t.push({
@@ -699,7 +700,7 @@ function Ce(e) {
699
700
  function A(e) {
700
701
  const t = {};
701
702
  return (...r) => {
702
- const o = Ce(r);
703
+ const o = je(r);
703
704
  return t[o] || (t[o] = e(...r).finally(() => {
704
705
  delete t[o];
705
706
  })), t[o];
@@ -708,7 +709,7 @@ function A(e) {
708
709
  function $(e) {
709
710
  let t = {};
710
711
  return (...r) => {
711
- const o = r[r.length - 1], n = Ce(r), a = t[n];
712
+ const o = r[r.length - 1], n = je(r), a = t[n];
712
713
  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] = {
713
714
  data: c,
714
715
  cacheAt: Date.now()
@@ -719,7 +720,7 @@ function x(e) {
719
720
  return Array.isArray(e) ? e.map((t) => x(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
720
721
  (t, r) => ({
721
722
  ...t,
722
- [Ve(r)]: x(e[r])
723
+ [Me(r)]: x(e[r])
723
724
  }),
724
725
  {}
725
726
  ) : e;
@@ -729,7 +730,7 @@ function h(e, t) {
729
730
  throw new Error("Transaction value is required");
730
731
  return typeof e == "object" ? e : t(e);
731
732
  }
732
- function ft(e, t) {
733
+ function yt(e, t) {
733
734
  return typeof t == "string" ? e.object(t) : typeof t == "object" && t.$kind ? t : e.object(t.contract.pool);
734
735
  }
735
736
  function Q(e, t, r) {
@@ -743,16 +744,16 @@ function Q(e, t, r) {
743
744
  function C(e) {
744
745
  return K(e);
745
746
  }
746
- function je(e) {
747
+ function Ie(e) {
747
748
  const t = (e || 0) / Math.pow(10, 27);
748
749
  return t > Math.pow(10, 5) ? 1 / 0 : t;
749
750
  }
750
- new he("https://hermes.pyth.network", {
751
+ new we("https://hermes.pyth.network", {
751
752
  timeout: 2e4
752
753
  });
753
- const yt = 27, ue = (e, t) => {
754
+ const gt = 27, le = (e, t) => {
754
755
  if (!Number(e) || !Number(t)) return new p(0);
755
- const r = new p(1).shiftedBy(1 * yt), o = r.multipliedBy(new p(0.5));
756
+ const r = new p(1).shiftedBy(1 * gt), o = r.multipliedBy(new p(0.5));
756
757
  return new p(e).multipliedBy(new p(t)).plus(o).dividedBy(r).integerValue(p.ROUND_DOWN);
757
758
  }, U = oe ? {
758
759
  "User-Agent": oe
@@ -769,7 +770,7 @@ function de(e, t = "uniqueId") {
769
770
  {}
770
771
  );
771
772
  }
772
- function H(e, t) {
773
+ function W(e, t) {
773
774
  const r = e.emodes.find((n) => n.emodeId === t.emodeId);
774
775
  if (!r)
775
776
  throw new Error("EMode not found in pool");
@@ -783,22 +784,22 @@ function H(e, t) {
783
784
  isEMode: !0
784
785
  };
785
786
  }
786
- function gt(e) {
787
+ function ht(e) {
787
788
  const [t, r] = e.split("-");
788
789
  return !t || !r ? null : {
789
790
  marketKey: t,
790
791
  poolId: parseInt(r)
791
792
  };
792
793
  }
793
- function P() {
794
+ function B() {
794
795
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
795
796
  }
796
797
  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 || {});
797
798
  const G = $(
798
799
  A(
799
800
  async (e) => {
800
- const t = (e?.markets || [F.main]).map((a) => _(a)), r = E(e), o = M(
801
- `/navi/pools?env=${e?.env || "prod"}&sdk=${O.version}&market=${t.map(
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(
802
803
  (a) => a.key
803
804
  )}`,
804
805
  e
@@ -807,15 +808,15 @@ const G = $(
807
808
  );
808
809
  return n.data.forEach((a) => {
809
810
  const i = n.meta.emodes.filter((b) => {
810
- const k = _(b.marketId);
811
- return a.market === k.key && b.isActive;
812
- }).filter((b) => !!b.assets.find((k) => k.assetId === a.id));
811
+ const I = _(b.marketId);
812
+ return a.market === I.key && b.isActive;
813
+ }).filter((b) => !!b.assets.find((I) => I.assetId === a.id));
813
814
  a.emodes = i;
814
- const s = p(a.totalSupplyAmount).div(Math.pow(10, 9)).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), l = p(a.borrowedAmount).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), m = p(s).multipliedBy(a.oracle.price).toString(), w = p(l).multipliedBy(a.oracle.price).toString(), y = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), g = p.max(
815
+ 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(), y = p(a.supplyCapCeiling).shiftedBy(-27).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), g = p.max(
815
816
  p(a.borrowedAmount),
816
817
  p(a.validBorrowAmount)
817
818
  ).shiftedBy(-9).decimalPlaces(a.token.decimals, p.ROUND_DOWN).toString(), d = p(y).multipliedBy(a.oracle.price).toString(), f = p(g).multipliedBy(a.oracle.price).toString();
818
- a.poolSupplyAmount = s, a.poolBorrowAmount = l, a.poolSupplyValue = m, a.poolBorrowValue = w, a.poolSupplyCapAmount = y, a.poolBorrowCapAmount = g, a.poolSupplyCapValue = d, a.poolBorrowCapValue = f;
819
+ a.poolSupplyAmount = s, a.poolBorrowAmount = u, a.poolSupplyValue = m, a.poolBorrowValue = w, a.poolSupplyCapAmount = y, a.poolBorrowCapAmount = g, a.poolSupplyCapValue = d, a.poolBorrowCapValue = f;
819
820
  }), n.data;
820
821
  }
821
822
  )
@@ -823,7 +824,7 @@ const G = $(
823
824
  async function S(e, t) {
824
825
  let r = t?.market;
825
826
  if (typeof e == "string") {
826
- const a = gt(e);
827
+ const a = ht(e);
827
828
  a && (r = a.marketKey, e = a.poolId);
828
829
  }
829
830
  const o = await G({
@@ -840,7 +841,7 @@ async function S(e, t) {
840
841
  }
841
842
  const Qt = $(
842
843
  A(async (e) => {
843
- const t = E(e), r = M(`/navi/stats?sdk=${O.version}`, e);
844
+ const t = O(e), r = M(`/navi/stats?sdk=${E.version}`, e);
844
845
  return (await fetch(r, {
845
846
  headers: D(U, t)
846
847
  }).then((n) => n.json())).data;
@@ -848,14 +849,14 @@ const Qt = $(
848
849
  ), Yt = $(
849
850
  A(
850
851
  async (e) => {
851
- const t = E(e), r = M(`/navi/fee?sdk=${O.version}`, e);
852
+ const t = O(e), r = M(`/navi/fee?sdk=${E.version}`, e);
852
853
  return await fetch(r, {
853
854
  headers: D(U, t)
854
855
  }).then((n) => n.json());
855
856
  }
856
857
  )
857
858
  );
858
- async function ht(e, t, r, o) {
859
+ async function wt(e, t, r, o) {
859
860
  const n = await j({
860
861
  ...o,
861
862
  cacheTime: v
@@ -911,7 +912,7 @@ async function Zt(e, t, r, o) {
911
912
  let i;
912
913
  if (n.version === 1)
913
914
  if (o?.accountCap) {
914
- const [l] = e.moveCall({
915
+ const [u] = e.moveCall({
915
916
  target: `${n.package}::incentive_v3::withdraw_with_account_cap`,
916
917
  arguments: [
917
918
  e.object("0x06"),
@@ -926,9 +927,9 @@ async function Zt(e, t, r, o) {
926
927
  ],
927
928
  typeArguments: [a.suiCoinType]
928
929
  });
929
- i = l;
930
+ i = u;
930
931
  } else {
931
- const [l] = e.moveCall({
932
+ const [u] = e.moveCall({
932
933
  target: `${n.package}::incentive_v3::withdraw`,
933
934
  arguments: [
934
935
  e.object("0x06"),
@@ -942,10 +943,10 @@ async function Zt(e, t, r, o) {
942
943
  ],
943
944
  typeArguments: [a.suiCoinType]
944
945
  });
945
- i = l;
946
+ i = u;
946
947
  }
947
948
  else if (o?.accountCap) {
948
- const [l] = e.moveCall({
949
+ const [u] = e.moveCall({
949
950
  target: `${n.package}::incentive_v3::withdraw_with_account_cap_v2`,
950
951
  arguments: [
951
952
  e.object("0x06"),
@@ -961,9 +962,9 @@ async function Zt(e, t, r, o) {
961
962
  ],
962
963
  typeArguments: [a.suiCoinType]
963
964
  });
964
- i = l;
965
+ i = u;
965
966
  } else {
966
- const [l] = e.moveCall({
967
+ const [u] = e.moveCall({
967
968
  target: `${n.package}::incentive_v3::withdraw_v2`,
968
969
  arguments: [
969
970
  e.object("0x06"),
@@ -978,7 +979,7 @@ async function Zt(e, t, r, o) {
978
979
  ],
979
980
  typeArguments: [a.suiCoinType]
980
981
  });
981
- i = l;
982
+ i = u;
982
983
  }
983
984
  return e.moveCall({
984
985
  target: "0x2::coin::from_balance",
@@ -997,7 +998,7 @@ async function Xt(e, t, r, o) {
997
998
  let i;
998
999
  if (n.version === 1)
999
1000
  if (o?.accountCap) {
1000
- const [l] = e.moveCall({
1001
+ const [u] = e.moveCall({
1001
1002
  target: `${n.package}::incentive_v3::borrow_with_account_cap`,
1002
1003
  arguments: [
1003
1004
  e.object("0x06"),
@@ -1012,9 +1013,9 @@ async function Xt(e, t, r, o) {
1012
1013
  ],
1013
1014
  typeArguments: [a.suiCoinType]
1014
1015
  });
1015
- i = l;
1016
+ i = u;
1016
1017
  } else {
1017
- const [l] = e.moveCall({
1018
+ const [u] = e.moveCall({
1018
1019
  target: `${n.package}::incentive_v3::borrow`,
1019
1020
  arguments: [
1020
1021
  e.object("0x06"),
@@ -1028,10 +1029,10 @@ async function Xt(e, t, r, o) {
1028
1029
  ],
1029
1030
  typeArguments: [a.suiCoinType]
1030
1031
  });
1031
- i = l;
1032
+ i = u;
1032
1033
  }
1033
1034
  else if (o?.accountCap) {
1034
- const [l] = e.moveCall({
1035
+ const [u] = e.moveCall({
1035
1036
  target: `${n.package}::incentive_v3::borrow_with_account_cap_v2`,
1036
1037
  arguments: [
1037
1038
  e.object("0x06"),
@@ -1047,9 +1048,9 @@ async function Xt(e, t, r, o) {
1047
1048
  ],
1048
1049
  typeArguments: [a.suiCoinType]
1049
1050
  });
1050
- i = l;
1051
+ i = u;
1051
1052
  } else {
1052
- const [l] = e.moveCall({
1053
+ const [u] = e.moveCall({
1053
1054
  target: `${n.package}::incentive_v3::borrow_v2`,
1054
1055
  arguments: [
1055
1056
  e.object("0x06"),
@@ -1064,7 +1065,7 @@ async function Xt(e, t, r, o) {
1064
1065
  ],
1065
1066
  typeArguments: [a.suiCoinType]
1066
1067
  });
1067
- i = l;
1068
+ i = u;
1068
1069
  }
1069
1070
  return e.moveCall({
1070
1071
  target: "0x2::coin::from_balance",
@@ -1130,7 +1131,7 @@ const er = $(
1130
1131
  async (e) => {
1131
1132
  const t = await j({
1132
1133
  ...e
1133
- }), r = e?.client ?? V;
1134
+ }), r = V(e?.client, "getBorrowFee");
1134
1135
  if (e?.address && typeof e?.asset < "u")
1135
1136
  try {
1136
1137
  const a = await S(e.asset, e), c = new N();
@@ -1144,10 +1145,10 @@ const er = $(
1144
1145
  ],
1145
1146
  typeArguments: []
1146
1147
  });
1147
- const i = await q(r, {
1148
+ const i = await L(r, {
1148
1149
  transactionBlock: c,
1149
1150
  sender: e.address
1150
- }), s = Q(i, [u.u64()]);
1151
+ }), s = Q(i, [l.u64()]);
1151
1152
  return (Number(s[0]) || 0) / 100;
1152
1153
  } catch (a) {
1153
1154
  console.error(
@@ -1155,7 +1156,7 @@ const er = $(
1155
1156
  a
1156
1157
  );
1157
1158
  }
1158
- const n = (await pt(r, {
1159
+ const n = (await mt(r, {
1159
1160
  id: t.incentiveV3,
1160
1161
  options: { showType: !0, showOwner: !0, showContent: !0 }
1161
1162
  })).data.content.fields.borrow_fee_rate;
@@ -1184,7 +1185,7 @@ const er = $(
1184
1185
  name: "Sui Eco Market"
1185
1186
  }
1186
1187
  };
1187
- class wt {
1188
+ class bt {
1188
1189
  constructor(t, r) {
1189
1190
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1190
1191
  marketTotalSupplyValue: "0",
@@ -1210,8 +1211,8 @@ class wt {
1210
1211
  });
1211
1212
  }), i = i.plus(s.poolBorrowValue), c = c.plus(s.poolSupplyValue);
1212
1213
  }), this.poolMap = ee(this.pools, "id"), this.emodeMap = de(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1213
- const l = this.getEModePools(s.emodeId);
1214
- this.emodePools.push(...l);
1214
+ const u = this.getEModePools(s.emodeId);
1215
+ this.emodePools.push(...u);
1215
1216
  }), this._overview = {
1216
1217
  marketTotalSupplyValue: c.toString(),
1217
1218
  marketTotalBorrowValue: i.toString()
@@ -1252,7 +1253,7 @@ const _ = (e) => {
1252
1253
  if (!r)
1253
1254
  throw new Error("Market not found");
1254
1255
  return r;
1255
- }, bt = $(
1256
+ }, vt = $(
1256
1257
  A(
1257
1258
  async (e, t) => {
1258
1259
  const r = await G({
@@ -1262,19 +1263,19 @@ const _ = (e) => {
1262
1263
  });
1263
1264
  return e.map((o) => {
1264
1265
  const n = _(o), a = r.filter((c) => c.market === n.key);
1265
- return new wt(o, a);
1266
+ return new bt(o, a);
1266
1267
  });
1267
1268
  }
1268
1269
  )
1269
1270
  ), tr = $(
1270
1271
  A(
1271
- async (e, t) => (await bt([e], t))[0]
1272
+ async (e, t) => (await vt([e], t))[0]
1272
1273
  )
1273
1274
  ), j = $(
1274
1275
  A(
1275
1276
  async (e) => {
1276
- const t = _(e?.market || R), r = E(e), o = M(
1277
- `/navi/config?env=${e?.env || "prod"}&sdk=${O.version}&market=${t.key}`,
1277
+ const t = _(e?.market || R), r = O(e), o = M(
1278
+ `/navi/config?env=${e?.env || "prod"}&sdk=${E.version}&market=${t.key}`,
1278
1279
  e
1279
1280
  );
1280
1281
  return (await fetch(o, {
@@ -1283,7 +1284,7 @@ const _ = (e) => {
1283
1284
  }
1284
1285
  )
1285
1286
  ), v = 1e3 * 60 * 5;
1286
- async function vt(e, t) {
1287
+ async function Ct(e, t) {
1287
1288
  const r = await j({
1288
1289
  cacheTime: v,
1289
1290
  ...t
@@ -1293,7 +1294,7 @@ async function vt(e, t) {
1293
1294
  arguments: []
1294
1295
  });
1295
1296
  }
1296
- async function Ct(e, t, r) {
1297
+ async function jt(e, t, r) {
1297
1298
  const o = await j({
1298
1299
  cacheTime: v,
1299
1300
  ...r
@@ -1303,7 +1304,7 @@ async function Ct(e, t, r) {
1303
1304
  arguments: [t]
1304
1305
  });
1305
1306
  }
1306
- async function jt(e, t, r) {
1307
+ async function It(e, t, r) {
1307
1308
  const o = await j({
1308
1309
  ...r,
1309
1310
  cacheTime: v
@@ -1337,12 +1338,12 @@ async function nr(e, t, r) {
1337
1338
  const o = await j({
1338
1339
  cacheTime: v,
1339
1340
  ...r
1340
- }), n = await vt(e, r);
1341
- await jt(e, t, {
1341
+ }), n = await Ct(e, r);
1342
+ await It(e, t, {
1342
1343
  ...r,
1343
1344
  accountCap: n
1344
1345
  });
1345
- const a = await _(r?.market || R), c = await Ct(e, n, r);
1346
+ const a = await _(r?.market || R), c = await jt(e, n, r);
1346
1347
  return e.moveCall({
1347
1348
  target: `${o.emode.contract.registryPackage}::registry::register_emode_for_account_cap`,
1348
1349
  arguments: [
@@ -1359,19 +1360,19 @@ const ke = $(
1359
1360
  const r = await j({
1360
1361
  cacheTime: v,
1361
1362
  ...t
1362
- }), o = new N(), n = t?.client ?? V;
1363
+ }), o = new N(), n = V(t?.client, "getUserEModeCaps");
1363
1364
  o.moveCall({
1364
1365
  target: `${r.emode.contract.registryPackage}::registry::find_user_emode_account_caps`,
1365
1366
  arguments: [o.object(r.emode.contract.registryObject), o.pure.address(e)]
1366
1367
  });
1367
- const c = (await q(n, {
1368
+ const c = (await L(n, {
1368
1369
  transactionBlock: o,
1369
1370
  sender: e
1370
- })).results[0].returnValues, i = u.vector(u.u64()).parse(Uint8Array.from(c[0][0])), s = u.vector(u.u64()).parse(Uint8Array.from(c[1][0])), l = u.vector(u.Address).parse(Uint8Array.from(c[2][0]));
1371
+ })).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]));
1371
1372
  return i.map((m, w) => ({
1372
1373
  marketId: Number(m),
1373
1374
  emodeId: Number(s[w]),
1374
- accountCap: l[w].toString()
1375
+ accountCap: u[w].toString()
1375
1376
  }));
1376
1377
  }
1377
1378
  )
@@ -1395,7 +1396,7 @@ function ar(e, t, r) {
1395
1396
  let a = 0;
1396
1397
  const c = [];
1397
1398
  let i = "";
1398
- if (t.sort((s, l) => Number(l.balance) - Number(s.balance)).forEach((s) => {
1399
+ if (t.sort((s, u) => Number(u.balance) - Number(s.balance)).forEach((s) => {
1399
1400
  if (!(o && a >= n) && Number(s.balance) !== 0) {
1400
1401
  if (i || (i = s.coinType), i !== s.coinType)
1401
1402
  throw new Error("All coins must be of the same type");
@@ -1409,7 +1410,7 @@ function ar(e, t, r) {
1409
1410
  );
1410
1411
  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]);
1411
1412
  }
1412
- async function Ie(e, t, r, o, n, a, c) {
1413
+ async function _e(e, t, r, o, n, a, c) {
1413
1414
  const i = await j({
1414
1415
  ...c,
1415
1416
  cacheTime: v
@@ -1420,7 +1421,7 @@ async function Ie(e, t, r, o, n, a, c) {
1420
1421
  e.object("0x06"),
1421
1422
  e.object(i.storage),
1422
1423
  e.object(i.oracle.priceOracle),
1423
- ft(e, s),
1424
+ yt(e, s),
1424
1425
  h(t, e.pure.address),
1425
1426
  h(s.id, e.pure.u8),
1426
1427
  h(o, e.pure.u64),
@@ -1430,11 +1431,11 @@ async function Ie(e, t, r, o, n, a, c) {
1430
1431
  typeArguments: [s.suiCoinType]
1431
1432
  });
1432
1433
  }
1433
- async function It(e, t, r) {
1434
- return Ie(e, t, 0, 0, 0, !1, r);
1434
+ async function _t(e, t, r) {
1435
+ return _e(e, t, 0, 0, 0, !1, r);
1435
1436
  }
1436
- async function _e(e, t, r) {
1437
- const o = new N(), n = r?.client ?? V, a = await G({
1437
+ async function Te(e, t, r) {
1438
+ const o = new N(), n = V(r?.client, "getLendingStateBatch"), a = await G({
1438
1439
  ...r,
1439
1440
  markets: Object.values(F)
1440
1441
  }), c = ee(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
@@ -1460,19 +1461,19 @@ async function _e(e, t, r) {
1460
1461
  arguments: [o.object(f.storage), o.pure.address(d.address)]
1461
1462
  });
1462
1463
  }
1463
- const m = (await q(n, {
1464
+ const m = (await L(n, {
1464
1465
  transactionBlock: o,
1465
1466
  sender: e
1466
1467
  })).results || [], w = {};
1467
1468
  s.forEach((d, f) => {
1468
1469
  try {
1469
- const b = m[f]?.returnValues?.map((T) => u.vector(Re).parse(Uint8Array.from(T[0])))[0] || [], k = {};
1470
+ const b = m[f]?.returnValues?.map((T) => l.vector(qe).parse(Uint8Array.from(T[0])))[0] || [], I = {};
1470
1471
  for (const T of b)
1471
- k[T.id] = {
1472
+ I[T.id] = {
1472
1473
  supplyIndex: T.supply_index,
1473
1474
  borrowIndex: T.borrow_index
1474
1475
  };
1475
- w[d.key] = k;
1476
+ w[d.key] = I;
1476
1477
  } catch (b) {
1477
1478
  console.warn(
1478
1479
  `[@naviprotocol/lending] Failed to decode reserve data for market "${d.key}", falling back to open-api pool indices`,
@@ -1480,22 +1481,22 @@ async function _e(e, t, r) {
1480
1481
  );
1481
1482
  }
1482
1483
  });
1483
- const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => u.vector(Le).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1484
+ const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(Le).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1484
1485
  return y.forEach((d, f) => {
1485
- const b = t[f], k = _(b.market), T = w[k.key] || {};
1486
- d.forEach((I) => {
1487
- if (I.supply_balance === "0" && I.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1486
+ const b = t[f], I = _(b.market), T = w[I.key] || {};
1487
+ d.forEach((k) => {
1488
+ if (k.supply_balance === "0" && k.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1488
1489
  return;
1489
- const B = c[`${k.key}-${I.asset_id}`];
1490
- if (!B)
1490
+ const P = c[`${I.key}-${k.asset_id}`];
1491
+ if (!P)
1491
1492
  return;
1492
- const W = T[I.asset_id], Y = W?.supplyIndex ?? B.currentSupplyIndex, Pe = W?.borrowIndex ?? B.currentBorrowIndex, Ae = ue(I.supply_balance, Y).toString(), Se = ue(I.borrow_balance, Pe).toString();
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();
1493
1494
  g.push({
1494
- supplyBalance: Ae,
1495
- borrowBalance: Se,
1496
- assetId: I.asset_id,
1497
- market: k.key,
1498
- pool: B,
1495
+ supplyBalance: Se,
1496
+ borrowBalance: $e,
1497
+ assetId: k.asset_id,
1498
+ market: I.key,
1499
+ pool: P,
1499
1500
  emodeId: b.emodeId
1500
1501
  });
1501
1502
  });
@@ -1507,48 +1508,48 @@ const ir = $(
1507
1508
  address: e,
1508
1509
  market: n.key
1509
1510
  }));
1510
- return await _e(e, o, t);
1511
+ return await Te(e, o, t);
1511
1512
  }
1512
1513
  );
1513
1514
  async function cr(e, t) {
1514
- const r = t?.client ?? V, o = new N();
1515
- await It(o, e, t);
1516
- const n = await q(r, {
1515
+ const r = V(t?.client, "getHealthFactor"), o = new N();
1516
+ await _t(o, e, t);
1517
+ const n = await L(r, {
1517
1518
  transactionBlock: o,
1518
1519
  sender: e
1519
- }), a = Q(n, [u.u256()]);
1520
- return je(Number(a[0]) || 0);
1520
+ }), a = Q(n, [l.u256()]);
1521
+ return Ie(Number(a[0]) || 0);
1521
1522
  }
1522
1523
  async function sr(e, t, r, o) {
1523
- const n = o?.client ?? V, a = new N();
1524
+ const n = V(o?.client, "getSimulatedHealthFactor"), a = new N();
1524
1525
  let c = 0, i = 0;
1525
1526
  const s = await S(t, o);
1526
1527
  if (r.forEach((y) => {
1527
1528
  y.type === z.Supply ? c += y.amount : y.type === z.Withdraw ? c -= y.amount : y.type === z.Borrow ? i += y.amount : y.type === z.Repay && (i -= y.amount);
1528
1529
  }), c * i < 0)
1529
1530
  throw new Error("Invalid operations");
1530
- const l = c > 0 || i > 0;
1531
- await Ie(
1531
+ const u = c > 0 || i > 0;
1532
+ await _e(
1532
1533
  a,
1533
1534
  e,
1534
1535
  s,
1535
1536
  Math.abs(c),
1536
1537
  Math.abs(i),
1537
- l,
1538
+ u,
1538
1539
  o
1539
1540
  );
1540
- const m = await q(n, {
1541
+ const m = await L(n, {
1541
1542
  transactionBlock: a,
1542
1543
  sender: e
1543
- }), w = Q(m, [u.u256()]);
1544
- return je(Number(w[0]) || 0);
1544
+ }), w = Q(m, [l.u256()]);
1545
+ return Ie(Number(w[0]) || 0);
1545
1546
  }
1546
- const lr = A(
1547
+ const ur = A(
1547
1548
  async (e, t) => {
1548
1549
  const r = new URLSearchParams();
1549
1550
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
1550
- const o = E(t), n = M(
1551
- `/navi/user/transactions?${r.toString()}&sdk=${O.version}`,
1551
+ const o = O(t), n = M(
1552
+ `/navi/user/transactions?${r.toString()}&sdk=${E.version}`,
1552
1553
  t
1553
1554
  );
1554
1555
  return (await fetch(n, {
@@ -1556,9 +1557,9 @@ const lr = A(
1556
1557
  }).then((c) => c.json())).data;
1557
1558
  }
1558
1559
  );
1559
- async function ur(e, t) {
1560
+ async function lr(e, t) {
1560
1561
  let r = null;
1561
- const o = [], n = t?.client ?? V, a = n.core;
1562
+ const o = [], n = V(t?.client, "getCoins"), a = n.core;
1562
1563
  do {
1563
1564
  let c;
1564
1565
  if (t?.coinType)
@@ -1588,26 +1589,26 @@ async function ur(e, t) {
1588
1589
  const i = /* @__PURE__ */ new Set();
1589
1590
  let s = null;
1590
1591
  do {
1591
- const l = await a.listBalances({
1592
+ const u = await a.listBalances({
1592
1593
  owner: e,
1593
1594
  cursor: s,
1594
1595
  limit: 100
1595
1596
  });
1596
- for (const m of l.balances ?? [])
1597
+ for (const m of u.balances ?? [])
1597
1598
  m?.coinType && i.add(m.coinType);
1598
- s = l.cursor ?? l.nextCursor ?? null;
1599
+ s = u.cursor ?? u.nextCursor ?? null;
1599
1600
  } while (s);
1600
- for (const l of i) {
1601
+ for (const u of i) {
1601
1602
  let m = null;
1602
1603
  do {
1603
1604
  const w = await a.listCoins({
1604
1605
  owner: e,
1605
- coinType: l,
1606
+ coinType: u,
1606
1607
  cursor: m,
1607
1608
  limit: 100
1608
1609
  });
1609
1610
  o.push(
1610
- ...(w.objects ?? w.data ?? []).map((y) => pe(y, l)).filter(Boolean)
1611
+ ...(w.objects ?? w.data ?? []).map((y) => pe(y, u)).filter(Boolean)
1611
1612
  ), m = w.cursor ?? w.nextCursor ?? null;
1612
1613
  } while (m);
1613
1614
  }
@@ -1629,16 +1630,9 @@ async function ur(e, t) {
1629
1630
  } while (r);
1630
1631
  return o;
1631
1632
  }
1632
- const _t = $(
1633
+ const Tt = $(
1633
1634
  async (e, t) => {
1634
- const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i));
1635
- let n = [];
1636
- try {
1637
- n = await ke(e, t);
1638
- } catch (i) {
1639
- console.error(i);
1640
- }
1641
- const a = o.map((i) => ({
1635
+ const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i)), n = await ke(e, t), a = o.map((i) => ({
1642
1636
  address: e,
1643
1637
  market: i.key
1644
1638
  })).concat(
@@ -1648,27 +1642,27 @@ const _t = $(
1648
1642
  emodeId: i.emodeId
1649
1643
  }))
1650
1644
  );
1651
- return (await _e(e, a, t)).forEach((i) => {
1652
- const s = typeof i.emodeId == "number" ? n.find((l) => {
1645
+ return (await Te(e, a, t)).forEach((i) => {
1646
+ const s = typeof i.emodeId == "number" ? n.find((u) => {
1653
1647
  const m = _(i.market);
1654
- return l.emodeId === i.emodeId && l.marketId === m.id;
1648
+ return u.emodeId === i.emodeId && u.marketId === m.id;
1655
1649
  }) : void 0;
1656
1650
  if (s) {
1657
1651
  if (!i.pool.emodes.find((m) => m.emodeId === s.emodeId))
1658
1652
  return;
1659
1653
  if (p(i.supplyBalance).gte(0)) {
1660
- const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1654
+ const m = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = W(i.pool, s);
1661
1655
  if (m.gt(0) || w.emode.isCollateral)
1662
1656
  try {
1663
1657
  r.push({
1664
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${P()}`,
1658
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-supply-${B()}`,
1665
1659
  wallet: e,
1666
1660
  protocol: "navi",
1667
1661
  market: i.market,
1668
1662
  type: "navi-lending-emode-supply",
1669
1663
  "navi-lending-emode-supply": {
1670
1664
  amount: m.toString(),
1671
- pool: H(i.pool, s),
1665
+ pool: W(i.pool, s),
1672
1666
  token: i.pool.token,
1673
1667
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1674
1668
  emodeCap: s
@@ -1679,18 +1673,18 @@ const _t = $(
1679
1673
  }
1680
1674
  }
1681
1675
  if (p(i.borrowBalance).gte(0)) {
1682
- const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = H(i.pool, s);
1676
+ const m = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN), w = W(i.pool, s);
1683
1677
  if (m.gt(0) || w.emode.isDebt)
1684
1678
  try {
1685
1679
  r.push({
1686
- id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${P()}`,
1680
+ id: `${i.pool.uniqueId}_${s.emodeId}_navi-lending-emode-borrow-${B()}`,
1687
1681
  wallet: e,
1688
1682
  protocol: "navi",
1689
1683
  market: i.market,
1690
1684
  type: "navi-lending-emode-borrow",
1691
1685
  "navi-lending-emode-borrow": {
1692
1686
  amount: m.toString(),
1693
- pool: H(i.pool, s),
1687
+ pool: W(i.pool, s),
1694
1688
  token: i.pool.token,
1695
1689
  valueUSD: m.multipliedBy(i.pool.oracle.price).toString(),
1696
1690
  emodeCap: s
@@ -1702,34 +1696,34 @@ const _t = $(
1702
1696
  }
1703
1697
  } else {
1704
1698
  if (p(i.supplyBalance).gt(0)) {
1705
- const l = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1699
+ const u = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1706
1700
  r.push({
1707
- id: `${i.pool.uniqueId}_navi-lending-supply-${P()}`,
1701
+ id: `${i.pool.uniqueId}_navi-lending-supply-${B()}`,
1708
1702
  wallet: e,
1709
1703
  protocol: "navi",
1710
1704
  type: "navi-lending-supply",
1711
1705
  market: i.market,
1712
1706
  "navi-lending-supply": {
1713
- amount: l.toString(),
1707
+ amount: u.toString(),
1714
1708
  pool: i.pool,
1715
1709
  token: i.pool.token,
1716
- valueUSD: l.multipliedBy(i.pool.oracle.price).toString()
1710
+ valueUSD: u.multipliedBy(i.pool.oracle.price).toString()
1717
1711
  }
1718
1712
  });
1719
1713
  }
1720
1714
  if (p(i.borrowBalance).gt(0)) {
1721
- const l = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1715
+ const u = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1722
1716
  r.push({
1723
- id: `${i.pool.uniqueId}_navi-lending-borrow-${P()}`,
1717
+ id: `${i.pool.uniqueId}_navi-lending-borrow-${B()}`,
1724
1718
  wallet: e,
1725
1719
  protocol: "navi",
1726
1720
  market: i.market,
1727
1721
  type: "navi-lending-borrow",
1728
1722
  "navi-lending-borrow": {
1729
- amount: l.toString(),
1723
+ amount: u.toString(),
1730
1724
  pool: i.pool,
1731
1725
  token: i.pool.token,
1732
- valueUSD: l.multipliedBy(i.pool.oracle.price).toString()
1726
+ valueUSD: u.multipliedBy(i.pool.oracle.price).toString()
1733
1727
  }
1734
1728
  });
1735
1729
  }
@@ -1737,7 +1731,7 @@ const _t = $(
1737
1731
  }), r;
1738
1732
  }
1739
1733
  );
1740
- class L {
1734
+ class q {
1741
1735
  constructor(t, r) {
1742
1736
  this._positions = [], this._priceMap = {}, this._overview = {
1743
1737
  hf: 1 / 0,
@@ -1777,7 +1771,7 @@ class L {
1777
1771
  }
1778
1772
  filterPositionsByPool(t) {
1779
1773
  const o = !!t.isEMode ? ["navi-lending-emode-supply", "navi-lending-emode-borrow"] : ["navi-lending-supply", "navi-lending-borrow"];
1780
- return new L(
1774
+ return new q(
1781
1775
  this.positions.filter((n) => {
1782
1776
  const a = n[n.type];
1783
1777
  return o.includes(n.type) && a.pool.uniqueId === t.uniqueId;
@@ -1789,7 +1783,7 @@ class L {
1789
1783
  const o = !!t.isEMode, n = this.getPrice(t);
1790
1784
  let a;
1791
1785
  return o ? a = {
1792
- id: P(),
1786
+ id: B(),
1793
1787
  wallet: "",
1794
1788
  protocol: "navi",
1795
1789
  market: "",
@@ -1802,7 +1796,7 @@ class L {
1802
1796
  emodeCap: {}
1803
1797
  }
1804
1798
  } : a = {
1805
- id: P(),
1799
+ id: B(),
1806
1800
  wallet: "",
1807
1801
  protocol: "navi",
1808
1802
  market: "",
@@ -1813,13 +1807,13 @@ class L {
1813
1807
  token: t.token,
1814
1808
  pool: t
1815
1809
  }
1816
- }, new L([...this.positions, a], this._priceMap);
1810
+ }, new q([...this.positions, a], this._priceMap);
1817
1811
  }
1818
1812
  withdraw(t, r) {
1819
1813
  const o = !!t.isEMode, n = this.getPrice(t);
1820
1814
  let a;
1821
1815
  return o ? a = {
1822
- id: P(),
1816
+ id: B(),
1823
1817
  wallet: "",
1824
1818
  protocol: "navi",
1825
1819
  market: "",
@@ -1832,7 +1826,7 @@ class L {
1832
1826
  emodeCap: {}
1833
1827
  }
1834
1828
  } : a = {
1835
- id: P(),
1829
+ id: B(),
1836
1830
  wallet: "",
1837
1831
  protocol: "navi",
1838
1832
  market: "",
@@ -1843,13 +1837,13 @@ class L {
1843
1837
  token: t.token,
1844
1838
  pool: t
1845
1839
  }
1846
- }, new L([...this.positions, a], this._priceMap);
1840
+ }, new q([...this.positions, a], this._priceMap);
1847
1841
  }
1848
1842
  borrow(t, r) {
1849
1843
  const o = !!t.isEMode, n = this.getPrice(t);
1850
1844
  let a;
1851
1845
  return o ? a = {
1852
- id: P(),
1846
+ id: B(),
1853
1847
  wallet: "",
1854
1848
  protocol: "navi",
1855
1849
  market: "",
@@ -1862,7 +1856,7 @@ class L {
1862
1856
  emodeCap: {}
1863
1857
  }
1864
1858
  } : a = {
1865
- id: P(),
1859
+ id: B(),
1866
1860
  wallet: "",
1867
1861
  protocol: "navi",
1868
1862
  market: "",
@@ -1873,13 +1867,13 @@ class L {
1873
1867
  token: t.token,
1874
1868
  pool: t
1875
1869
  }
1876
- }, new L([...this.positions, a], this._priceMap);
1870
+ }, new q([...this.positions, a], this._priceMap);
1877
1871
  }
1878
1872
  repay(t, r) {
1879
1873
  const o = !!t.isEMode, n = this.getPrice(t);
1880
1874
  let a;
1881
1875
  return o ? a = {
1882
- id: P(),
1876
+ id: B(),
1883
1877
  wallet: "",
1884
1878
  protocol: "navi",
1885
1879
  market: "",
@@ -1892,7 +1886,7 @@ class L {
1892
1886
  emodeCap: {}
1893
1887
  }
1894
1888
  } : a = {
1895
- id: P(),
1889
+ id: B(),
1896
1890
  wallet: "",
1897
1891
  protocol: "navi",
1898
1892
  market: "",
@@ -1903,20 +1897,20 @@ class L {
1903
1897
  token: t.token,
1904
1898
  pool: t
1905
1899
  }
1906
- }, new L([...this.positions, a], this._priceMap);
1900
+ }, new q([...this.positions, a], this._priceMap);
1907
1901
  }
1908
1902
  resolveValueUSD(t) {
1909
1903
  return Object.keys(this._priceMap).length > 0 ? p(t.amount).multipliedBy(this.getPrice(t.pool)).toString() : t.valueUSD;
1910
1904
  }
1911
1905
  getPositionsOverview(t) {
1912
1906
  const r = {}, o = {};
1913
- let n = new p(0), a = new p(0), c = new p(0), i = new p(0), s = new p(0), l = new p(0);
1907
+ let n = new p(0), a = new p(0), c = new p(0), i = new p(0), s = new p(0), u = new p(0);
1914
1908
  t.forEach((g) => {
1915
1909
  if (g.type === "navi-lending-supply") {
1916
1910
  const d = g["navi-lending-supply"], f = this.resolveValueUSD(d);
1917
1911
  n = n.plus(f), s = s.plus(
1918
1912
  new p(f).multipliedBy(d.pool.liquidationFactor.threshold)
1919
- ), l = l.plus(
1913
+ ), u = u.plus(
1920
1914
  new p(f).multipliedBy(d.pool.ltvValue)
1921
1915
  );
1922
1916
  } else if (g.type === "navi-lending-borrow") {
@@ -1928,14 +1922,14 @@ class L {
1928
1922
  const b = d.pool.emode;
1929
1923
  s = s.plus(
1930
1924
  new p(f).multipliedBy(b.lt)
1931
- ), l = l.plus(
1925
+ ), u = u.plus(
1932
1926
  new p(f).multipliedBy(b.ltv)
1933
1927
  );
1934
1928
  } else if (g.type === "navi-lending-emode-borrow") {
1935
1929
  const d = g["navi-lending-emode-borrow"];
1936
1930
  a = a.plus(this.resolveValueUSD(d));
1937
1931
  }
1938
- }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), l = p.max(l, 0), t.forEach((g) => {
1932
+ }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), u = p.max(u, 0), t.forEach((g) => {
1939
1933
  if (g.type === "navi-lending-supply") {
1940
1934
  const d = g["navi-lending-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
1941
1935
  n.gt(0) && (c = c.plus(
@@ -1968,7 +1962,7 @@ class L {
1968
1962
  totalsupplyApy: c.toString(),
1969
1963
  totalBorrowApy: i.toString(),
1970
1964
  maxLiquidationValue: s.toString(),
1971
- maxLoanToVaule: l.toString(),
1965
+ maxLoanToVaule: u.toString(),
1972
1966
  supply: r,
1973
1967
  borrow: o
1974
1968
  };
@@ -1990,12 +1984,12 @@ async function dr(e, t, r, o) {
1990
1984
  ]
1991
1985
  });
1992
1986
  }
1993
- const Te = new he("https://hermes.pyth.network", {
1987
+ const Pe = new we("https://hermes.pyth.network", {
1994
1988
  timeout: 1e4
1995
1989
  });
1996
1990
  async function pr(e) {
1997
1991
  try {
1998
- const t = [], r = await Te.getLatestPriceFeeds(e);
1992
+ const t = [], r = await Pe.getLatestPriceFeeds(e);
1999
1993
  if (!r) return t;
2000
1994
  const o = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2001
1995
  for (const n of r) {
@@ -2015,47 +2009,42 @@ async function pr(e) {
2015
2009
  throw new Error(`failed to get pyth stale price feed id, msg: ${t.message}`);
2016
2010
  }
2017
2011
  }
2018
- async function Tt(e, t) {
2019
- try {
2020
- const r = [], o = t?.client ?? V, n = e.map((c) => c.priceInfoObject), a = await mt(o, {
2021
- ids: Array.from(new Set(n)),
2022
- options: { showContent: !0 }
2023
- });
2024
- for (const c of a) {
2025
- const i = c.data;
2026
- if (!i || !i.content || i.content.dataType !== "moveObject") {
2027
- console.warn(`fetched object ${i?.objectId} datatype should be moveObject`);
2028
- continue;
2029
- }
2030
- const s = e.find((f) => f.priceInfoObject == i.objectId);
2031
- if (!s) {
2032
- console.warn(`unable to find pyth info from array, priceInfoObject: ${i.objectId}`);
2033
- continue;
2034
- }
2035
- const l = i.content.fields?.price_info?.price_feed?.price, m = l?.price;
2036
- if (!m) {
2037
- console.warn(`unexpected pyth price struct, priceInfoObject: ${i.objectId}`);
2038
- continue;
2039
- }
2040
- const { magnitude: w, negative: y } = m, g = l.conf, d = l.timestamp;
2041
- r.push({
2042
- priceFeedId: s.priceFeedId,
2043
- priceInfoObject: s.priceInfoObject,
2044
- price: y ? "-" + w : w,
2045
- conf: g,
2046
- publishTime: Number(d),
2047
- expiration: s.expiration
2048
- });
2012
+ async function Pt(e, t) {
2013
+ const r = [], o = V(t?.client, "getOnChainPriceInfo"), n = e.map((c) => c.priceInfoObject), a = await ft(o, {
2014
+ ids: Array.from(new Set(n)),
2015
+ options: { showContent: !0 }
2016
+ });
2017
+ for (const c of a) {
2018
+ const i = c.data;
2019
+ if (!i || !i.content || i.content.dataType !== "moveObject") {
2020
+ console.warn(`fetched object ${i?.objectId} datatype should be moveObject`);
2021
+ continue;
2049
2022
  }
2050
- return r;
2051
- } catch (r) {
2052
- console.error(r, `Polling Sui on-chain price for ${e} failed.`);
2053
- return;
2023
+ const s = e.find((f) => f.priceInfoObject == i.objectId);
2024
+ if (!s) {
2025
+ console.warn(`unable to find pyth info from array, priceInfoObject: ${i.objectId}`);
2026
+ continue;
2027
+ }
2028
+ const u = i.content.fields?.price_info?.price_feed?.price, m = u?.price;
2029
+ if (!m) {
2030
+ console.warn(`unexpected pyth price struct, priceInfoObject: ${i.objectId}`);
2031
+ continue;
2032
+ }
2033
+ const { magnitude: w, negative: y } = m, g = u.conf, d = u.timestamp;
2034
+ r.push({
2035
+ priceFeedId: s.priceFeedId,
2036
+ priceInfoObject: s.priceInfoObject,
2037
+ price: y ? "-" + w : w,
2038
+ conf: g,
2039
+ publishTime: Number(d),
2040
+ expiration: s.expiration
2041
+ });
2054
2042
  }
2043
+ return r;
2055
2044
  }
2056
2045
  async function Bt(e, t) {
2057
2046
  try {
2058
- const r = [], o = await Tt(e, t);
2047
+ const r = [], o = await Pt(e, t);
2059
2048
  if (!o) return r;
2060
2049
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2061
2050
  for (const a of o) {
@@ -2075,14 +2064,14 @@ async function Bt(e, t) {
2075
2064
  throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2076
2065
  }
2077
2066
  }
2078
- async function Pt(e, t, r) {
2079
- const o = r?.client ?? V, n = await j({
2067
+ async function At(e, t, r) {
2068
+ const o = V(r?.client, "updatePythPriceFeeds"), n = await j({
2080
2069
  ...r,
2081
2070
  cacheTime: v
2082
2071
  });
2083
2072
  try {
2084
- const a = await Te.getPriceFeedsUpdateData(t);
2085
- return await new ct(
2073
+ const a = await Pe.getPriceFeedsUpdateData(t);
2074
+ return await new st(
2086
2075
  o,
2087
2076
  n.oracle.pythStateId,
2088
2077
  n.oracle.wormholeStateId
@@ -2091,23 +2080,18 @@ async function Pt(e, t, r) {
2091
2080
  throw new Error(`failed to update pyth price feeds, msg: ${a.message}`);
2092
2081
  }
2093
2082
  }
2094
- async function At(e, t, r) {
2083
+ async function me(e, t, r) {
2095
2084
  const o = await j({
2096
2085
  ...r,
2097
2086
  cacheTime: v
2098
2087
  });
2099
2088
  if (r?.updatePythPriceFeeds) {
2100
- const n = t.filter((a) => !!a.pythPriceFeedId && !!a.pythPriceInfoObject).map((a) => ({
2101
- priceFeedId: a.pythPriceFeedId,
2102
- priceInfoObject: a.pythPriceInfoObject,
2089
+ const n = t.filter((c) => !!c.pythPriceFeedId && !!c.pythPriceInfoObject).map((c) => ({
2090
+ priceFeedId: c.pythPriceFeedId,
2091
+ priceInfoObject: c.pythPriceInfoObject,
2103
2092
  expiration: 30
2104
- }));
2105
- try {
2106
- const a = await Bt(n, r);
2107
- a.length > 0 && await Pt(e, a, r);
2108
- } catch {
2109
- console.error("Failed to update Pyth price feeds");
2110
- }
2093
+ })), a = await Bt(n, r);
2094
+ a.length > 0 && await At(e, a, r);
2111
2095
  }
2112
2096
  for (const n of t)
2113
2097
  r?.env === "dev" ? e.moveCall({
@@ -2166,35 +2150,45 @@ function St(e, t) {
2166
2150
  }) || t?.pools && t.pools.find((n) => r.oracleId === n.oracleId)));
2167
2151
  }
2168
2152
  async function mr(e, t, r, o) {
2153
+ let n;
2169
2154
  try {
2170
- const n = await Be({
2155
+ const a = await Be({
2171
2156
  ...o
2172
- }), a = [];
2173
- r.forEach((l) => {
2174
- a.includes(l.market) || a.push(l.market);
2157
+ }), c = [];
2158
+ r.forEach((u) => {
2159
+ c.includes(u.market) || c.push(u.market);
2175
2160
  });
2176
- const c = await _t(t, {
2161
+ const i = await Tt(t, {
2177
2162
  ...o,
2178
- markets: a
2179
- }), i = St(n, {
2180
- lendingPositions: c,
2181
- pools: r
2163
+ markets: c
2182
2164
  });
2183
- return await At(e, i, {
2165
+ return n = St(a, {
2166
+ lendingPositions: i,
2167
+ pools: r
2168
+ }), await me(e, n, {
2184
2169
  updatePythPriceFeeds: !0,
2185
2170
  ...o
2186
2171
  });
2187
- } catch (n) {
2172
+ } catch (a) {
2188
2173
  if (o?.throws)
2189
- throw n;
2190
- return console.error(n), e;
2174
+ throw a;
2175
+ if (console.error(a), n)
2176
+ try {
2177
+ return await me(e, n, {
2178
+ ...o,
2179
+ updatePythPriceFeeds: !1
2180
+ });
2181
+ } catch (c) {
2182
+ console.error(c);
2183
+ }
2184
+ return e;
2191
2185
  }
2192
2186
  }
2193
2187
  const re = $(
2194
2188
  A(
2195
2189
  async (e) => {
2196
- const t = E(e), r = M(
2197
- `/navi/flashloan?env=${e?.env || "prod"}&sdk=${O.version}&market=${e?.market || R}`,
2190
+ const t = O(e), r = M(
2191
+ `/navi/flashloan?env=${e?.env || "prod"}&sdk=${E.version}&market=${e?.market || R}`,
2198
2192
  e
2199
2193
  ), o = await fetch(r, {
2200
2194
  headers: D(U, t)
@@ -2222,7 +2216,7 @@ async function yr(e, t, r, o) {
2222
2216
  ))
2223
2217
  throw new Error("Pool does not support flashloan");
2224
2218
  if (n.version === 1) {
2225
- const [s, l] = e.moveCall({
2219
+ const [s, u] = e.moveCall({
2226
2220
  target: `${n.package}::lending::flash_loan_with_ctx`,
2227
2221
  arguments: [
2228
2222
  e.object(n.flashloanConfig),
@@ -2231,9 +2225,9 @@ async function yr(e, t, r, o) {
2231
2225
  ],
2232
2226
  typeArguments: [a.suiCoinType]
2233
2227
  });
2234
- return [s, l];
2228
+ return [s, u];
2235
2229
  } else {
2236
- const [s, l] = e.moveCall({
2230
+ const [s, u] = e.moveCall({
2237
2231
  target: `${n.package}::lending::flash_loan_with_ctx_v2`,
2238
2232
  arguments: [
2239
2233
  e.object(n.flashloanConfig),
@@ -2243,7 +2237,7 @@ async function yr(e, t, r, o) {
2243
2237
  ],
2244
2238
  typeArguments: [a.suiCoinType]
2245
2239
  });
2246
- return [s, l];
2240
+ return [s, u];
2247
2241
  }
2248
2242
  }
2249
2243
  async function gr(e, t, r, o, n) {
@@ -2258,7 +2252,7 @@ async function gr(e, t, r, o, n) {
2258
2252
  (m) => C(m.coinType) === C(c.suiCoinType)
2259
2253
  ))
2260
2254
  throw new Error("Pool does not support flashloan");
2261
- const [l] = e.moveCall({
2255
+ const [u] = e.moveCall({
2262
2256
  target: `${a.package}::lending::flash_repay_with_ctx`,
2263
2257
  arguments: [
2264
2258
  e.object("0x06"),
@@ -2269,13 +2263,13 @@ async function gr(e, t, r, o, n) {
2269
2263
  ],
2270
2264
  typeArguments: [c.suiCoinType]
2271
2265
  });
2272
- return [l];
2266
+ return [u];
2273
2267
  }
2274
2268
  async function hr(e, t, r, o, n, a) {
2275
2269
  const c = {
2276
2270
  ...a,
2277
2271
  cacheTime: v
2278
- }, i = await j(c), s = await S(t, c), l = await S(o, c);
2272
+ }, i = await j(c), s = await S(t, c), u = await S(o, c);
2279
2273
  if (i.version === 1) {
2280
2274
  const [m, w] = e.moveCall({
2281
2275
  target: `${i.package}::incentive_v3::liquidation`,
@@ -2292,9 +2286,9 @@ async function hr(e, t, r, o, n, a) {
2292
2286
  // Pay asset pool contract
2293
2287
  h(r, e.object),
2294
2288
  // Debt repayment amount
2295
- e.pure.u8(l.id),
2289
+ e.pure.u8(u.id),
2296
2290
  // Collateral asset ID
2297
- e.object(l.contract.pool),
2291
+ e.object(u.contract.pool),
2298
2292
  // Collateral asset pool contract
2299
2293
  h(n, e.pure.address),
2300
2294
  // Borrower address
@@ -2303,7 +2297,7 @@ async function hr(e, t, r, o, n, a) {
2303
2297
  e.object(i.incentiveV3)
2304
2298
  // Incentive V3 contract
2305
2299
  ],
2306
- typeArguments: [s.suiCoinType, l.suiCoinType]
2300
+ typeArguments: [s.suiCoinType, u.suiCoinType]
2307
2301
  });
2308
2302
  return [m, w];
2309
2303
  } else {
@@ -2322,9 +2316,9 @@ async function hr(e, t, r, o, n, a) {
2322
2316
  // Pay asset pool contract
2323
2317
  h(r, e.object),
2324
2318
  // Debt repayment amount
2325
- e.pure.u8(l.id),
2319
+ e.pure.u8(u.id),
2326
2320
  // Collateral asset ID
2327
- e.object(l.contract.pool),
2321
+ e.object(u.contract.pool),
2328
2322
  // Collateral asset pool contract
2329
2323
  h(n, e.pure.address),
2330
2324
  // Borrower address
@@ -2335,13 +2329,13 @@ async function hr(e, t, r, o, n, a) {
2335
2329
  e.object("0x05")
2336
2330
  // SuiSystemState object
2337
2331
  ],
2338
- typeArguments: [s.suiCoinType, l.suiCoinType]
2332
+ typeArguments: [s.suiCoinType, u.suiCoinType]
2339
2333
  });
2340
2334
  return [m, w];
2341
2335
  }
2342
2336
  }
2343
2337
  async function $t(e, t, r) {
2344
- const o = r?.client ?? V, n = await G({
2338
+ const o = V(r?.client, "getLendingRewardsBatch"), n = await G({
2345
2339
  ...r,
2346
2340
  markets: Object.values(F),
2347
2341
  cacheTime: v
@@ -2353,45 +2347,45 @@ async function $t(e, t, r) {
2353
2347
  ...r,
2354
2348
  cacheTime: v,
2355
2349
  market: i.market
2356
- }), l = new N();
2357
- l.moveCall({
2350
+ }), u = new N();
2351
+ u.moveCall({
2358
2352
  target: `${s.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
2359
2353
  arguments: [
2360
- l.object("0x06"),
2354
+ u.object("0x06"),
2361
2355
  // Clock object
2362
- l.object(s.storage),
2356
+ u.object(s.storage),
2363
2357
  // Protocol storage
2364
- l.object(s.incentiveV3),
2358
+ u.object(s.incentiveV3),
2365
2359
  // Incentive V3 contract
2366
- l.pure.address(i.address)
2360
+ u.pure.address(i.address)
2367
2361
  // User address
2368
2362
  ]
2369
2363
  });
2370
- const w = (await q(o, {
2371
- transactionBlock: l,
2364
+ const w = (await L(o, {
2365
+ transactionBlock: u,
2372
2366
  sender: e
2373
2367
  }))?.results?.[0];
2374
2368
  if (!w)
2375
2369
  return;
2376
2370
  const y = Q({ results: [w] }, [
2377
- u.vector(u.string()),
2371
+ l.vector(l.string()),
2378
2372
  // Asset coin types
2379
- u.vector(u.string()),
2373
+ l.vector(l.string()),
2380
2374
  // Reward coin types
2381
- u.vector(u.u8()),
2375
+ l.vector(l.u8()),
2382
2376
  // Reward options
2383
- u.vector(u.Address),
2377
+ l.vector(l.Address),
2384
2378
  // Rule IDs
2385
- u.vector(u.u256())
2379
+ l.vector(l.u256())
2386
2380
  // Claimable amounts
2387
2381
  ]);
2388
2382
  if (y.length === 5 && Array.isArray(y[0])) {
2389
2383
  const g = y[0].length;
2390
2384
  for (let d = 0; d < g; d++) {
2391
2385
  const f = a.find(
2392
- (k) => C(k.coinType) === C(y[1][d])
2386
+ (I) => C(I.coinType) === C(y[1][d])
2393
2387
  ), b = n.find(
2394
- (k) => C(k.coinType) === C(y[0][d]) && k.market === i.market
2388
+ (I) => C(I.coinType) === C(y[0][d]) && I.market === i.market
2395
2389
  );
2396
2390
  !f || !b || c.push({
2397
2391
  assetId: b.id,
@@ -2417,14 +2411,7 @@ async function $t(e, t, r) {
2417
2411
  ), c;
2418
2412
  }
2419
2413
  async function wr(e, t) {
2420
- const r = (t?.markets || [F.main]).map((a) => _(a));
2421
- let o = [];
2422
- try {
2423
- o = await ke(e, t);
2424
- } catch (a) {
2425
- console.error(a);
2426
- }
2427
- const n = r.map((a) => ({
2414
+ const r = (t?.markets || [F.main]).map((a) => _(a)), o = await ke(e, t), n = r.map((a) => ({
2428
2415
  address: e,
2429
2416
  owner: e,
2430
2417
  market: a.key
@@ -2457,8 +2444,8 @@ function br(e) {
2457
2444
  for (const { assetId: o, rewardType: n, coinType: a, total: c, market: i } of t.values()) {
2458
2445
  const s = `${o}-${n}-${i}`;
2459
2446
  r.has(s) || r.set(s, { assetId: o, rewardType: n, market: i, rewards: /* @__PURE__ */ new Map() });
2460
- const l = r.get(s);
2461
- l.rewards.set(a, (l.rewards.get(a) || 0) + c);
2447
+ const u = r.get(s);
2448
+ u.rewards.set(a, (u.rewards.get(a) || 0) + c);
2462
2449
  }
2463
2450
  return Array.from(r.values()).map((o) => ({
2464
2451
  assetId: o.assetId,
@@ -2472,8 +2459,8 @@ function br(e) {
2472
2459
  }
2473
2460
  const vr = A(
2474
2461
  async (e, t) => {
2475
- const r = E(t), o = M(
2476
- `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${O.version}&market=${t?.market || R}`,
2462
+ const r = O(t), o = M(
2463
+ `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${E.version}&market=${t?.market || R}`,
2477
2464
  t
2478
2465
  );
2479
2466
  return (await fetch(o, {
@@ -2482,8 +2469,8 @@ const vr = A(
2482
2469
  }
2483
2470
  ), Cr = A(
2484
2471
  async (e, t) => {
2485
- const r = E(t), o = M(
2486
- `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${O.version}&market=${t?.market || R}`,
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}`,
2487
2474
  t
2488
2475
  ), n = await fetch(o, {
2489
2476
  headers: D(U, r)
@@ -2500,13 +2487,13 @@ async function jr(e, t, r) {
2500
2487
  cacheTime: v
2501
2488
  }), n = /* @__PURE__ */ new Map();
2502
2489
  for (const c of t) {
2503
- const { rewardCoinType: i, ruleIds: s, market: l, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${l}`;
2490
+ const { rewardCoinType: i, ruleIds: s, market: u, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${u}`;
2504
2491
  for (const d of s) {
2505
2492
  n.has(g) || n.set(g, {
2506
2493
  assetIds: [],
2507
2494
  ruleIds: [],
2508
2495
  amount: 0,
2509
- market: l,
2496
+ market: u,
2510
2497
  owner: m,
2511
2498
  address: w,
2512
2499
  isEMode: typeof y < "u"
@@ -2518,24 +2505,24 @@ async function jr(e, t, r) {
2518
2505
  const a = [];
2519
2506
  for (const [
2520
2507
  c,
2521
- { assetIds: i, ruleIds: s, amount: l, market: m, owner: w, address: y, isEMode: g }
2508
+ { assetIds: i, ruleIds: s, amount: u, market: m, owner: w, address: y, isEMode: g }
2522
2509
  ] of n) {
2523
2510
  const d = await j({
2524
2511
  ...r,
2525
2512
  cacheTime: v,
2526
2513
  market: m
2527
2514
  }), f = c.split("___")[0], b = o.filter(
2528
- (I) => C(I.suiCoinType) === C(f)
2515
+ (k) => C(k.suiCoinType) === C(f)
2529
2516
  );
2530
- b.sort((I, B) => I.market === m ? -1 : 1);
2531
- const k = b[0], T = d.rewardFunds[C(f)];
2517
+ b.sort((k, P) => k.market === m ? -1 : 1);
2518
+ const I = b[0], T = d.rewardFunds[C(f)];
2532
2519
  if (!T)
2533
2520
  throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
2534
2521
  if (r?.accountCap && !r.customCoinReceive)
2535
2522
  throw new Error("customCoinReceive is required when accountCap is provided");
2536
2523
  if (r?.customCoinReceive) {
2537
- let I;
2538
- r.accountCap ? I = e.moveCall({
2524
+ let k;
2525
+ r.accountCap ? k = e.moveCall({
2539
2526
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2540
2527
  arguments: [
2541
2528
  e.object("0x06"),
@@ -2554,7 +2541,7 @@ async function jr(e, t, r) {
2554
2541
  // Account capability
2555
2542
  ],
2556
2543
  typeArguments: [f]
2557
- }) : g ? I = e.moveCall({
2544
+ }) : g ? k = e.moveCall({
2558
2545
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2559
2546
  arguments: [
2560
2547
  e.object("0x06"),
@@ -2573,7 +2560,7 @@ async function jr(e, t, r) {
2573
2560
  // Account capability
2574
2561
  ],
2575
2562
  typeArguments: [f]
2576
- }) : I = e.moveCall({
2563
+ }) : k = e.moveCall({
2577
2564
  target: `${d.package}::incentive_v3::claim_reward`,
2578
2565
  arguments: [
2579
2566
  e.object("0x06"),
@@ -2591,37 +2578,37 @@ async function jr(e, t, r) {
2591
2578
  ],
2592
2579
  typeArguments: [f]
2593
2580
  });
2594
- const [B] = e.moveCall({
2581
+ const [P] = e.moveCall({
2595
2582
  target: "0x2::coin::from_balance",
2596
- arguments: [I],
2583
+ arguments: [k],
2597
2584
  typeArguments: [f]
2598
2585
  });
2599
2586
  if (r?.customCoinReceive.type === "transfer") {
2600
2587
  if (!r.customCoinReceive.transfer)
2601
2588
  throw new Error("customCoinReceive.transfer is required");
2602
2589
  e.transferObjects(
2603
- [B],
2590
+ [P],
2604
2591
  h(r.customCoinReceive.transfer, e.pure.address)
2605
2592
  );
2606
2593
  }
2607
2594
  if (r?.customCoinReceive.type === "depositNAVI") {
2608
- const W = p(k.totalSupplyAmount).shiftedBy(-9), Y = p(k.supplyCapCeiling).shiftedBy(-27);
2609
- W.plus(l).isGreaterThan(Y) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2610
- [B],
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],
2611
2598
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2612
- ) : await ht(e, k, B, {
2599
+ ) : await wt(e, I, P, {
2613
2600
  ...r,
2614
- market: k.market
2601
+ market: I.market
2615
2602
  });
2616
2603
  } else
2617
2604
  a.push({
2618
- coin: B,
2619
- identifier: k,
2605
+ coin: P,
2606
+ identifier: I,
2620
2607
  owner: w,
2621
2608
  isEMode: g
2622
2609
  });
2623
2610
  } else if (r?.accountCap || g) {
2624
- const I = e.moveCall({
2611
+ const k = e.moveCall({
2625
2612
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2626
2613
  arguments: [
2627
2614
  e.object("0x06"),
@@ -2640,13 +2627,13 @@ async function jr(e, t, r) {
2640
2627
  // Account capability
2641
2628
  ],
2642
2629
  typeArguments: [f]
2643
- }), [B] = e.moveCall({
2630
+ }), [P] = e.moveCall({
2644
2631
  target: "0x2::coin::from_balance",
2645
- arguments: [I],
2632
+ arguments: [k],
2646
2633
  typeArguments: [f]
2647
2634
  });
2648
2635
  e.transferObjects(
2649
- [B],
2636
+ [P],
2650
2637
  h(r?.accountCap || w, e.pure.address)
2651
2638
  );
2652
2639
  } else
@@ -2677,78 +2664,78 @@ export {
2677
2664
  R as DEFAULT_MARKET_IDENTITY,
2678
2665
  zt as FlashLoanAssetConfig,
2679
2666
  Rt as IncentiveAPYInfo,
2680
- Ne as IncentivePoolInfo,
2681
- Lt as IncentivePoolInfoByPhase,
2667
+ Re as IncentivePoolInfo,
2668
+ qt as IncentivePoolInfoByPhase,
2682
2669
  F as MARKETS,
2683
- wt as Market,
2684
- He as NaviMissingGraphQLClientError,
2685
- qt as OracleInfo,
2670
+ bt as Market,
2671
+ Je as NaviMissingGraphQLClientError,
2672
+ Lt as OracleInfo,
2686
2673
  z as PoolOperator,
2687
- Re as ReserveDataInfo,
2688
- he as SuiPriceServiceConnection,
2689
- ct as SuiPythClient,
2690
- L as UserPositions,
2674
+ qe as ReserveDataInfo,
2675
+ we as SuiPriceServiceConnection,
2676
+ st as SuiPythClient,
2677
+ q as UserPositions,
2691
2678
  Le as UserStateInfo,
2692
2679
  Xt as borrowCoinPTB,
2693
2680
  M as buildNaviOpenApiUrl,
2694
2681
  jr as claimLendingRewardsPTB,
2695
2682
  Kt as configureNaviSdk,
2696
- vt as createAccountCapPTB,
2683
+ Ct as createAccountCapPTB,
2697
2684
  nr as createEModeCapPTB,
2698
- ge as createNaviLegacyJsonRpcClient,
2699
- xe as createNaviSuiClient,
2700
- Ze as createNaviSuiClientBundle,
2701
- ht as depositCoinPTB,
2685
+ he as createNaviLegacyJsonRpcClient,
2686
+ et as createNaviSuiClient,
2687
+ Xe as createNaviSuiClientBundle,
2688
+ wt as depositCoinPTB,
2702
2689
  or as emodeIdentityId,
2703
- jt as enterEModePTB,
2690
+ It as enterEModePTB,
2704
2691
  rr as exitEModePTB,
2705
2692
  St as filterPriceFeeds,
2706
2693
  yr as flashloanPTB,
2707
- Ct as getAccountCapOwnerPTB,
2708
- Wt as getAddressBalance,
2694
+ jt as getAccountCapOwnerPTB,
2695
+ Ht as getAddressBalance,
2709
2696
  re as getAllFlashLoanAssets,
2710
2697
  er as getBorrowFee,
2711
2698
  Gt as getCoinObjectOnlyBalance,
2712
- ur as getCoins,
2699
+ lr as getCoins,
2713
2700
  j as getConfig,
2714
2701
  Yt as getFees,
2715
2702
  fr as getFlashLoanAsset,
2716
2703
  cr as getHealthFactor,
2717
- It as getHealthFactorPTB,
2718
- _t as getLendingPositions,
2704
+ _t as getHealthFactorPTB,
2705
+ Tt as getLendingPositions,
2719
2706
  ir as getLendingState,
2720
2707
  tr as getMarket,
2721
2708
  _ as getMarketConfig,
2722
- bt as getMarkets,
2709
+ vt as getMarkets,
2723
2710
  S as getPool,
2724
2711
  G as getPools,
2725
2712
  Be as getPriceFeeds,
2726
2713
  pr as getPythStalePriceFeedId,
2727
2714
  Bt as getPythStalePriceFeedIdV2,
2728
2715
  sr as getSimulatedHealthFactor,
2729
- Ie as getSimulatedHealthFactorPTB,
2716
+ _e as getSimulatedHealthFactorPTB,
2730
2717
  Qt as getStats,
2731
- lr as getTransactions,
2718
+ ur as getTransactions,
2732
2719
  wr as getUserAvailableLendingRewards,
2733
2720
  Cr as getUserClaimedRewardHistory,
2734
2721
  ke as getUserEModeCaps,
2735
2722
  vr as getUserTotalClaimedReward,
2736
2723
  hr as liquidatePTB,
2737
- Ht as listAddressBalances,
2724
+ Wt as listAddressBalances,
2738
2725
  ar as mergeCoinsPTB,
2739
2726
  D as mergeServiceHeaders,
2740
- ye as normalizeAddressBalance,
2727
+ ge as normalizeAddressBalance,
2741
2728
  C as normalizeCoinType,
2742
- gt as parsePoolUID,
2729
+ ht as parsePoolUID,
2743
2730
  h as parseTxValue,
2744
2731
  xt as repayCoinPTB,
2745
2732
  gr as repayFlashLoanPTB,
2746
2733
  Jt as requireNaviGraphQLClient,
2747
- E as resolveNaviOpenApiEndpoint,
2734
+ O as resolveNaviOpenApiEndpoint,
2748
2735
  br as summaryLendingRewards,
2749
2736
  mr as updateOraclePriceBeforeUserOperationPTB,
2750
- At as updateOraclePricesPTB,
2751
- Pt as updatePythPriceFeeds,
2737
+ me as updateOraclePricesPTB,
2738
+ At as updatePythPriceFeeds,
2752
2739
  dr as verifyHealthFactorPTB,
2753
2740
  $ as withCache,
2754
2741
  A as withSingleton,