@naviprotocol/lending 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,147 +1,147 @@
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 Me, fromHex as Ue, normalizeStructTag as K, SUI_CLOCK_OBJECT_ID as Z, fromBase64 as De } from "@mysten/sui/utils";
4
+ import Fe from "lodash.camelcase";
5
5
  import p from "bignumber.js";
6
- import { SuiJsonRpcClient as 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 Ne } from "@mysten/sui/jsonRpc";
7
+ import { SuiGraphQLClient as Re } from "@mysten/sui/graphql";
8
+ import { SuiGrpcClient as ye, GrpcWebFetchTransport as ge } from "@mysten/sui/grpc";
9
+ const oe = l.bytes(32).transform({
10
10
  // To change the input type, you need to provide a type definition for the input
11
- input: (e) => Oe(e),
12
- output: (e) => $e(e)
13
- }), Rt = u.struct("IncentiveAPYInfo", {
11
+ input: (e) => Ue(e),
12
+ output: (e) => Me(e)
13
+ }), qt = 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
+ }), Le = l.struct("IncentivePoolInfo", {
21
21
  /** Unique pool identifier */
22
- pool_id: ne,
22
+ pool_id: oe,
23
23
  /** Address holding the incentive funds */
24
- funds: ne,
24
+ funds: oe,
25
25
  /** Current phase of the incentive program */
26
- 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
+ }), zt = 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(Le)
52
+ }), Gt = 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
+ }), Wt = 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
+ }), ze = 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
+ }), Ge = "2.0.2", O = {
133
+ version: Ge
134
+ }, We = O.version, He = () => {
135
135
  if (typeof process < "u" && process.versions && process.versions.node) {
136
136
  const e = process.version;
137
137
  return `Node.js ${e.startsWith("v") ? e.substring(1) : e}`;
138
138
  }
139
139
  return "Node/Unknown";
140
- }, We = () => {
140
+ }, Je = () => {
141
141
  let e = "";
142
- return typeof process < "u" && process.versions && process.versions.node && (e = `lending/${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/${We} (${He()})`), e;
143
+ }, ae = Je(), he = "0x2::sui::SUI";
144
+ class Ke extends Error {
145
145
  constructor(t) {
146
146
  super(
147
147
  `NAVI Sui SDK capability "${t}" requires an explicit graphql client; no public GraphQL fallback is configured`
@@ -151,22 +151,22 @@ class 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 Qe(e, t) {
155
155
  return (BigInt(e) + BigInt(t)).toString();
156
156
  }
157
- function Ke(e, t) {
157
+ function Ye(e, t) {
158
158
  return (BigInt(e) - BigInt(t)).toString();
159
159
  }
160
- function fe(e) {
160
+ function we(e) {
161
161
  const t = e.core;
162
162
  if (typeof t?.getBalance != "function" || typeof t?.listBalances != "function")
163
163
  throw new Error("NAVI Sui balance helpers require a v2 Core API client");
164
164
  return t;
165
165
  }
166
- function ye(e, t = me) {
166
+ function be(e, t = he) {
167
167
  const r = X(e.addressBalance ?? e.fundsInAddressBalance) ?? "0";
168
168
  let o = X(e.balance ?? e.totalBalance), n = X(e.coinBalance);
169
- return !n && o && (n = Ke(o, r)), !o && n && (o = Je(n, r)), {
169
+ return !n && o && (n = Ye(o, r)), !o && n && (o = Qe(n, r)), {
170
170
  coinType: K(e.coinType ?? t),
171
171
  totalBalance: o ?? "0",
172
172
  coinBalance: n ?? "0",
@@ -174,125 +174,111 @@ function 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 Ht(e, t = he) {
178
178
  const r = K(t);
179
179
  return e.filter((o) => K(o.coinType) === r).reduce((o, n) => o + BigInt(n.balance), 0n).toString();
180
180
  }
181
- async function 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);
181
+ async function Jt(e, t) {
182
+ const r = await we(e).getBalance(t), o = r.balance;
183
+ return be((o && typeof o == "object" ? o : r) ?? {}, t.coinType);
184
184
  }
185
- async function Ht(e, t) {
186
- const r = await fe(e).listBalances(t), { balances: o = [] } = r;
185
+ async function Kt(e, t) {
186
+ const r = await we(e).listBalances(t), { balances: o = [] } = r;
187
187
  return {
188
- balances: o.map((n) => ye(n)),
188
+ balances: o.map((n) => be(n)),
189
189
  nextCursor: r.nextCursor ?? r.cursor ?? null
190
190
  };
191
191
  }
192
- function Qe(e, t) {
192
+ function Ze(e, t) {
193
193
  if ("client" in t)
194
194
  return t.client;
195
- const r = new Ue({
195
+ const r = new ge({
196
196
  baseUrl: t.url,
197
197
  meta: t.headers,
198
198
  fetchInit: t.fetchInit,
199
199
  fetch: t.fetch
200
200
  });
201
- return new Fe({
201
+ return new ye({
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 Xe(e, t) {
207
+ return "client" in t ? t.client : new Re({
208
208
  network: e,
209
209
  url: t.url,
210
210
  headers: t.headers,
211
211
  fetch: t.fetch
212
212
  });
213
213
  }
214
- function ge(e, t) {
215
- return "client" in t ? t.client : new Me({
214
+ function ve(e, t) {
215
+ return "client" in t ? t.client : new Ne({
216
216
  network: e,
217
217
  url: t.url
218
218
  });
219
219
  }
220
- function Ze(e) {
221
- const t = Qe(e.network, e.grpc);
220
+ function xe(e) {
221
+ const t = Ze(e.network, e.grpc);
222
222
  return {
223
223
  network: e.network,
224
224
  coreClient: t,
225
225
  grpc: t,
226
- graphql: e.graphql ? Ye(e.network, e.graphql) : void 0,
227
- legacyJsonRpc: e.legacyJsonRpc ? ge(e.network, e.legacyJsonRpc) : void 0,
226
+ graphql: e.graphql ? Xe(e.network, e.graphql) : void 0,
227
+ legacyJsonRpc: e.legacyJsonRpc ? ve(e.network, e.legacyJsonRpc) : void 0,
228
228
  services: e.services
229
229
  };
230
230
  }
231
- function Jt(e, t) {
231
+ function Qt(e, t) {
232
232
  if (!e.graphql)
233
- throw new He(t);
233
+ throw new Ke(t);
234
234
  return e.graphql;
235
235
  }
236
- function Xe() {
237
- const e = "NAVI Sui SDK requires an explicit v2 gRPC/Core client. Pass { network, grpc } or an explicit legacyJsonRpc client for deprecated compatibility.", t = new Proxy(
238
- {},
239
- {
240
- get() {
241
- throw new Error(e);
242
- }
243
- }
244
- );
245
- return new Proxy(
246
- { core: t },
247
- {
248
- get(r, o) {
249
- if (o === "core")
250
- return r.core;
251
- if (o === "network")
252
- return "mainnet";
253
- throw new Error(e);
254
- }
255
- }
256
- );
236
+ const et = "https://fullnode.mainnet.sui.io:443";
237
+ let x;
238
+ function tt() {
239
+ return x || (x = new ye({
240
+ network: "mainnet",
241
+ transport: new ge({ baseUrl: et })
242
+ })), x;
257
243
  }
258
- function xe(e, t = "mainnet") {
259
- return e ? typeof e == "string" ? ge(t, { url: e }) : Ze(e) : Xe();
244
+ function rt(e, t = "mainnet") {
245
+ return e ? typeof e == "string" ? ve(t, { url: e }) : xe(e) : tt();
260
246
  }
261
- const et = 16 * 1024;
262
- function te(e) {
247
+ const nt = 16 * 1024;
248
+ function re(e) {
263
249
  return e.replace(/^0x/i, "");
264
250
  }
265
- function ae(e) {
266
- const t = te(e), r = new Uint8Array(t.length / 2);
251
+ function ie(e) {
252
+ const t = re(e), r = new Uint8Array(t.length / 2);
267
253
  for (let o = 0; o < r.length; o += 1)
268
254
  r[o] = parseInt(t.slice(o * 2, o * 2 + 2), 16);
269
255
  return r;
270
256
  }
271
- function tt(e, t) {
257
+ function ot(e, t) {
272
258
  return (e[t] << 8) + e[t + 1];
273
259
  }
274
- function ie(e) {
275
- return u.vector(u.U8).serialize(Array.from(e), {
276
- maxSize: et
260
+ function ce(e) {
261
+ return l.vector(l.U8).serialize(Array.from(e), {
262
+ maxSize: nt
277
263
  });
278
264
  }
279
- function ce(e, t) {
265
+ function se(e, t) {
280
266
  return {
281
267
  type: e,
282
268
  bcs: t
283
269
  };
284
270
  }
285
- function rt(e) {
286
- return u.vector(u.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
271
+ function at(e) {
272
+ return l.vector(l.U8).serialize(Array.from(new TextEncoder().encode(e))).toBytes();
287
273
  }
288
- function nt(e) {
289
- return u.struct("PriceIdentifier", {
290
- bytes: u.vector(u.U8)
274
+ function it(e) {
275
+ return l.struct("PriceIdentifier", {
276
+ bytes: l.vector(l.U8)
291
277
  }).serialize({
292
278
  bytes: Array.from(e)
293
279
  }).toBytes();
294
280
  }
295
- function ot(e) {
281
+ function ct(e) {
296
282
  const t = [];
297
283
  let r = 0, o = 0;
298
284
  for (let n = 0; n < e.length; n += 1) {
@@ -301,19 +287,19 @@ function ot(e) {
301
287
  }
302
288
  return t.push(e.slice(o).trim()), t;
303
289
  }
304
- function at(e) {
290
+ function st(e) {
305
291
  const r = e.indexOf("::table::Table"), o = e.indexOf("<", r), n = e.lastIndexOf(">"), a = "::price_identifier::PriceIdentifier";
306
292
  if (r < 0 || o < 0 || n <= o)
307
293
  throw new Error(`Unexpected Pyth price table type: ${e}`);
308
- const [c, i] = ot(e.slice(o + 1, n));
294
+ const [c, i] = ct(e.slice(o + 1, n));
309
295
  if (!c?.endsWith(a) || !i?.endsWith("::object::ID"))
310
296
  throw new Error(`Unexpected Pyth price table type arguments: ${e}`);
311
297
  return c.slice(0, -a.length);
312
298
  }
313
- function it(e) {
299
+ function ut(e) {
314
300
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
315
301
  }
316
- class he {
302
+ class Ce {
317
303
  constructor(t, r) {
318
304
  this.endpoint = t.replace(/\/$/, ""), this.timeout = r?.timeout ?? 1e4;
319
305
  }
@@ -341,14 +327,14 @@ class he {
341
327
  throw new Error(`Unsupported Hermes price update encoding: ${o}`);
342
328
  if (n.length === 0)
343
329
  throw new Error("Hermes price update response did not include binary update data");
344
- return n.map(it);
330
+ return n.map(ut);
345
331
  }
346
332
  async get(t, r, o) {
347
333
  const n = new AbortController(), a = setTimeout(() => n.abort(), this.timeout), c = new URL(`${this.endpoint}${t}`);
348
334
  for (const [i, s] of Object.entries(o ?? {}))
349
335
  c.searchParams.set(i, s);
350
336
  for (const i of r)
351
- c.searchParams.append("ids[]", te(i));
337
+ c.searchParams.append("ids[]", re(i));
352
338
  try {
353
339
  const i = await fetch(c, {
354
340
  signal: n.signal
@@ -361,7 +347,7 @@ class he {
361
347
  }
362
348
  }
363
349
  }
364
- class ct {
350
+ class lt {
365
351
  constructor(t, r, o) {
366
352
  this.provider = t, this.pythStateId = r, this.wormholeStateId = o, this.priceFeedObjectIdCache = /* @__PURE__ */ new Map();
367
353
  }
@@ -459,7 +445,7 @@ class ct {
459
445
  target: `${o}::vaa::parse_and_verify`,
460
446
  arguments: [
461
447
  r.object(this.wormholeStateId),
462
- r.pure(ie(n)),
448
+ r.pure(ce(n)),
463
449
  r.object(Z)
464
450
  ]
465
451
  });
@@ -475,7 +461,7 @@ class ct {
475
461
  target: `${o}::pyth::create_authenticated_price_infos_using_accumulator`,
476
462
  arguments: [
477
463
  t.object(this.pythStateId),
478
- t.pure(ie(r[0])),
464
+ t.pure(ce(r[0])),
479
465
  a,
480
466
  t.object(Z)
481
467
  ]
@@ -485,15 +471,15 @@ class ct {
485
471
  async executePriceFeedUpdates(t, r, o, n, a) {
486
472
  const c = [];
487
473
  for (const [i, s] of o.entries()) {
488
- const l = await this.getPriceFeedObjectId(s);
489
- if (!l)
474
+ const u = await this.getPriceFeedObjectId(s);
475
+ if (!u)
490
476
  throw new Error(`Price feed ${s} not found, please create it first`);
491
- c.push(l), [n] = t.moveCall({
477
+ c.push(u), [n] = t.moveCall({
492
478
  target: `${r}::pyth::update_single_price_feed`,
493
479
  arguments: [
494
480
  t.object(this.pythStateId),
495
481
  n,
496
- t.object(l),
482
+ t.object(u),
497
483
  a[i],
498
484
  t.object(Z)
499
485
  ]
@@ -512,15 +498,15 @@ class ct {
512
498
  return this.pythPackageId || (this.pythPackageId = await this.getPackageId(this.pythStateId)), this.pythPackageId;
513
499
  }
514
500
  async getPriceFeedObjectId(t) {
515
- const r = te(t);
501
+ const r = re(t);
516
502
  if (!this.priceFeedObjectIdCache.has(r)) {
517
- const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = this.getCoreProvider() ? ce(
503
+ const { id: o, fieldType: n } = await this.getPriceTableInfo(), a = this.getCoreProvider() ? se(
518
504
  `${n}::price_identifier::PriceIdentifier`,
519
- nt(ae(r))
505
+ it(ie(r))
520
506
  ) : {
521
507
  type: `${n}::price_identifier::PriceIdentifier`,
522
508
  value: {
523
- bytes: Array.from(ae(r))
509
+ bytes: Array.from(ie(r))
524
510
  }
525
511
  }, c = await this.getDynamicMoveObjectJson(o, a);
526
512
  c?.fields ? this.priceFeedObjectIdCache.set(r, c.fields.value) : this.priceFeedObjectIdCache.set(r, void 0);
@@ -529,7 +515,7 @@ class ct {
529
515
  }
530
516
  async getPriceTableInfo() {
531
517
  if (!this.priceTableInfo) {
532
- const t = this.getCoreProvider() ? ce("vector<u8>", rt("price_info")) : {
518
+ const t = this.getCoreProvider() ? se("vector<u8>", at("price_info")) : {
533
519
  type: "vector<u8>",
534
520
  value: "price_info"
535
521
  }, r = await this.getDynamicMoveObjectJson(this.pythStateId, t);
@@ -537,22 +523,22 @@ class ct {
537
523
  throw new Error("Price Table not found, contract may not be initialized");
538
524
  this.priceTableInfo = {
539
525
  id: r.objectId,
540
- fieldType: at(r.type)
526
+ fieldType: st(r.type)
541
527
  };
542
528
  }
543
529
  return this.priceTableInfo;
544
530
  }
545
531
  extractVaaBytesFromAccumulatorMessage(t) {
546
- const o = 7 + t[6] + 1, n = tt(t, o), a = o + 2;
532
+ const o = 7 + t[6] + 1, n = ot(t, o), a = o + 2;
547
533
  return t.subarray(a, a + n);
548
534
  }
549
535
  }
550
- const st = "https://open-api.naviprotocol.io/api";
551
- let J = {}, we = 0;
552
- function lt(e) {
536
+ const dt = "https://open-api.naviprotocol.io/api";
537
+ let J = {}, je = 0;
538
+ function pt(e) {
553
539
  return e.replace(/\/+$/, "");
554
540
  }
555
- function Kt(e) {
541
+ function Yt(e) {
556
542
  J = {
557
543
  ...J,
558
544
  ...e,
@@ -560,15 +546,15 @@ function Kt(e) {
560
546
  ...J.services,
561
547
  ...e.services
562
548
  }
563
- }, we += 1;
549
+ }, je += 1;
564
550
  }
565
- function se() {
566
- return we;
551
+ function ue() {
552
+ return je;
567
553
  }
568
554
  function E(e) {
569
555
  const t = e?.services?.naviOpenApi ?? J.services?.naviOpenApi;
570
556
  return {
571
- baseUrl: lt(t?.baseUrl ?? st),
557
+ baseUrl: pt(t?.baseUrl ?? dt),
572
558
  headers: t?.headers
573
559
  };
574
560
  }
@@ -576,7 +562,7 @@ function M(e, t) {
576
562
  const r = E(t), o = e.startsWith("/") ? e : `/${e}`;
577
563
  return `${r.baseUrl}${o}`;
578
564
  }
579
- function ut(e) {
565
+ function mt(e) {
580
566
  if (e instanceof Headers) {
581
567
  const t = {};
582
568
  return e.forEach((r, o) => {
@@ -585,17 +571,17 @@ function ut(e) {
585
571
  }
586
572
  return Array.isArray(e) ? Object.fromEntries(e) : e;
587
573
  }
588
- function D(e, t) {
574
+ function U(e, t) {
589
575
  return {
590
- ...ut(e),
576
+ ...mt(e),
591
577
  ...t?.headers ?? {}
592
578
  };
593
579
  }
594
- const V = xe();
580
+ const V = rt();
595
581
  function le(e) {
596
- return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(Ee(e)) : [];
582
+ return e ? e instanceof Uint8Array ? Array.from(e) : Array.isArray(e) ? e : Array.from(De(e)) : [];
597
583
  }
598
- function dt(e) {
584
+ function ft(e) {
599
585
  const t = e?.commandResults ?? [], r = e?.Transaction ?? e?.FailedTransaction ?? {}, o = r.effects?.errors?.[0] ?? r.effects?.status?.error ?? r.status?.error ?? r.status?.errors?.[0];
600
586
  return o && console.warn("[lending] devInspect(core simulate) returned error:", o), {
601
587
  effects: r.effects,
@@ -613,26 +599,22 @@ function dt(e) {
613
599
  }
614
600
  async function q(e, t) {
615
601
  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
602
+ if (typeof r?.simulateTransaction != "function")
603
+ throw new Error("devInspectTransaction requires a Sui v2 Core-capable client");
604
+ const o = t.transaction ?? t.transactionBlock;
605
+ o instanceof N && o.setSenderIfNotSet(t.sender);
606
+ const n = await r.simulateTransaction({
607
+ transaction: o,
608
+ checksEnabled: !1,
609
+ include: {
610
+ effects: !0,
611
+ events: !0,
612
+ commandResults: !0
613
+ }
633
614
  });
615
+ return ft(n);
634
616
  }
635
- function be(e) {
617
+ function Ie(e) {
636
618
  return {
637
619
  json: !!e?.showContent,
638
620
  display: !!e?.showDisplay,
@@ -640,7 +622,7 @@ function be(e) {
640
622
  objectBcs: !!e?.showBcs
641
623
  };
642
624
  }
643
- function ve(e) {
625
+ function ke(e) {
644
626
  return !e || e instanceof Error ? {
645
627
  error: e instanceof Error ? { code: "notFound", error: e.message } : void 0
646
628
  } : {
@@ -660,46 +642,44 @@ function ve(e) {
660
642
  }
661
643
  };
662
644
  }
663
- async function pt(e, t) {
645
+ async function yt(e, t) {
664
646
  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);
647
+ if (typeof r?.getObject != "function")
648
+ throw new Error("getSuiObject requires a Sui v2 Core-capable client");
649
+ const { object: o } = await r.getObject({
650
+ objectId: t.id,
651
+ include: Ie(t.options)
652
+ });
653
+ return ke(o);
673
654
  }
674
- async function mt(e, t) {
655
+ async function gt(e, t) {
675
656
  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);
657
+ if (typeof r?.getObjects != "function")
658
+ throw new Error("multiGetSuiObjects requires a Sui v2 Core-capable client");
659
+ const { objects: o } = await r.getObjects({
660
+ objectIds: t.ids,
661
+ include: Ie(t.options)
662
+ });
663
+ return o.map(ke);
684
664
  }
685
- function Ce(e) {
665
+ function _e(e) {
686
666
  const t = [];
687
667
  let r = !1;
688
668
  return e.forEach((o, n) => {
689
669
  const a = n === e.length - 1;
690
670
  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;
671
+ const { client: c, disableCache: i, cacheTime: s, ...u } = o;
672
+ u.__naviSdkServiceConfigVersion = ue(), t.push(u), r = !0;
693
673
  } else
694
674
  t.push(o);
695
675
  }), r || t.push({
696
- __naviSdkServiceConfigVersion: se()
676
+ __naviSdkServiceConfigVersion: ue()
697
677
  }), JSON.stringify(t);
698
678
  }
699
679
  function A(e) {
700
680
  const t = {};
701
681
  return (...r) => {
702
- const o = Ce(r);
682
+ const o = _e(r);
703
683
  return t[o] || (t[o] = e(...r).finally(() => {
704
684
  delete t[o];
705
685
  })), t[o];
@@ -708,18 +688,18 @@ function A(e) {
708
688
  function $(e) {
709
689
  let t = {};
710
690
  return (...r) => {
711
- const o = r[r.length - 1], n = Ce(r), a = t[n];
691
+ const o = r[r.length - 1], n = _e(r), a = t[n];
712
692
  return !o?.disableCache && typeof a?.data < "u" && (typeof o?.cacheTime > "u" || o.cacheTime > Date.now() - a.cacheAt) ? Promise.resolve(a.data) : e(...r).then((c) => (t[n] = {
713
693
  data: c,
714
694
  cacheAt: Date.now()
715
695
  }, c));
716
696
  };
717
697
  }
718
- function x(e) {
719
- return Array.isArray(e) ? e.map((t) => x(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
698
+ function ee(e) {
699
+ return Array.isArray(e) ? e.map((t) => ee(t)) : e != null && typeof e == "object" ? Object.keys(e).reduce(
720
700
  (t, r) => ({
721
701
  ...t,
722
- [Ve(r)]: x(e[r])
702
+ [Fe(r)]: ee(e[r])
723
703
  }),
724
704
  {}
725
705
  ) : e;
@@ -729,7 +709,7 @@ function h(e, t) {
729
709
  throw new Error("Transaction value is required");
730
710
  return typeof e == "object" ? e : t(e);
731
711
  }
732
- function ft(e, t) {
712
+ function ht(e, t) {
733
713
  return typeof t == "string" ? e.object(t) : typeof t == "object" && t.$kind ? t : e.object(t.contract.pool);
734
714
  }
735
715
  function Q(e, t, r) {
@@ -743,27 +723,27 @@ function Q(e, t, r) {
743
723
  function C(e) {
744
724
  return K(e);
745
725
  }
746
- function je(e) {
726
+ function Te(e) {
747
727
  const t = (e || 0) / Math.pow(10, 27);
748
728
  return t > Math.pow(10, 5) ? 1 / 0 : t;
749
729
  }
750
- new he("https://hermes.pyth.network", {
730
+ new Ce("https://hermes.pyth.network", {
751
731
  timeout: 2e4
752
732
  });
753
- const yt = 27, ue = (e, t) => {
733
+ const wt = 27, de = (e, t) => {
754
734
  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));
735
+ const r = new p(1).shiftedBy(1 * wt), o = r.multipliedBy(new p(0.5));
756
736
  return new p(e).multipliedBy(new p(t)).plus(o).dividedBy(r).integerValue(p.ROUND_DOWN);
757
- }, U = oe ? {
758
- "User-Agent": oe
737
+ }, D = ae ? {
738
+ "User-Agent": ae
759
739
  } : {};
760
- function ee(e, t = "uniqueId") {
740
+ function te(e, t = "uniqueId") {
761
741
  return e.reduce(
762
742
  (r, o) => (r[o[t]] = o, r),
763
743
  {}
764
744
  );
765
745
  }
766
- function de(e, t = "uniqueId") {
746
+ function pe(e, t = "uniqueId") {
767
747
  return e.reduce(
768
748
  (r, o) => (r[o[t]] = o, r),
769
749
  {}
@@ -783,7 +763,7 @@ function H(e, t) {
783
763
  isEMode: !0
784
764
  };
785
765
  }
786
- function gt(e) {
766
+ function bt(e) {
787
767
  const [t, r] = e.split("-");
788
768
  return !t || !r ? null : {
789
769
  marketKey: t,
@@ -802,20 +782,20 @@ const G = $(
802
782
  (a) => a.key
803
783
  )}`,
804
784
  e
805
- ), n = await fetch(o, { headers: D(U, r) }).then(
785
+ ), n = await fetch(o, { headers: U(D, r) }).then(
806
786
  (a) => a.json()
807
787
  );
808
788
  return n.data.forEach((a) => {
809
789
  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));
790
+ const I = _(b.marketId);
791
+ return a.market === I.key && b.isActive;
792
+ }).filter((b) => !!b.assets.find((I) => I.assetId === a.id));
813
793
  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(
794
+ 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
795
  p(a.borrowedAmount),
816
796
  p(a.validBorrowAmount)
817
797
  ).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;
798
+ 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
799
  }), n.data;
820
800
  }
821
801
  )
@@ -823,7 +803,7 @@ const G = $(
823
803
  async function S(e, t) {
824
804
  let r = t?.market;
825
805
  if (typeof e == "string") {
826
- const a = gt(e);
806
+ const a = bt(e);
827
807
  a && (r = a.marketKey, e = a.poolId);
828
808
  }
829
809
  const o = await G({
@@ -838,24 +818,24 @@ async function S(e, t) {
838
818
  throw new Error("Pool not found");
839
819
  return n.isDeprecated && console.log(`The lending pool for coinType ${n.suiCoinType} is going to be deprecated.`), n;
840
820
  }
841
- const Qt = $(
821
+ const Zt = $(
842
822
  A(async (e) => {
843
823
  const t = E(e), r = M(`/navi/stats?sdk=${O.version}`, e);
844
824
  return (await fetch(r, {
845
- headers: D(U, t)
825
+ headers: U(D, t)
846
826
  }).then((n) => n.json())).data;
847
827
  })
848
- ), Yt = $(
828
+ ), Xt = $(
849
829
  A(
850
830
  async (e) => {
851
831
  const t = E(e), r = M(`/navi/fee?sdk=${O.version}`, e);
852
832
  return await fetch(r, {
853
- headers: D(U, t)
833
+ headers: U(D, t)
854
834
  }).then((n) => n.json());
855
835
  }
856
836
  )
857
837
  );
858
- async function ht(e, t, r, o) {
838
+ async function vt(e, t, r, o) {
859
839
  const n = await j({
860
840
  ...o,
861
841
  cacheTime: v
@@ -903,7 +883,7 @@ async function ht(e, t, r, o) {
903
883
  arguments: [e.object(a.contract.pool), e.object("0x05")]
904
884
  }), e;
905
885
  }
906
- async function Zt(e, t, r, o) {
886
+ async function xt(e, t, r, o) {
907
887
  const n = await j({
908
888
  ...o,
909
889
  cacheTime: v
@@ -911,7 +891,7 @@ async function Zt(e, t, r, o) {
911
891
  let i;
912
892
  if (n.version === 1)
913
893
  if (o?.accountCap) {
914
- const [l] = e.moveCall({
894
+ const [u] = e.moveCall({
915
895
  target: `${n.package}::incentive_v3::withdraw_with_account_cap`,
916
896
  arguments: [
917
897
  e.object("0x06"),
@@ -926,9 +906,9 @@ async function Zt(e, t, r, o) {
926
906
  ],
927
907
  typeArguments: [a.suiCoinType]
928
908
  });
929
- i = l;
909
+ i = u;
930
910
  } else {
931
- const [l] = e.moveCall({
911
+ const [u] = e.moveCall({
932
912
  target: `${n.package}::incentive_v3::withdraw`,
933
913
  arguments: [
934
914
  e.object("0x06"),
@@ -942,10 +922,10 @@ async function Zt(e, t, r, o) {
942
922
  ],
943
923
  typeArguments: [a.suiCoinType]
944
924
  });
945
- i = l;
925
+ i = u;
946
926
  }
947
927
  else if (o?.accountCap) {
948
- const [l] = e.moveCall({
928
+ const [u] = e.moveCall({
949
929
  target: `${n.package}::incentive_v3::withdraw_with_account_cap_v2`,
950
930
  arguments: [
951
931
  e.object("0x06"),
@@ -961,9 +941,9 @@ async function Zt(e, t, r, o) {
961
941
  ],
962
942
  typeArguments: [a.suiCoinType]
963
943
  });
964
- i = l;
944
+ i = u;
965
945
  } else {
966
- const [l] = e.moveCall({
946
+ const [u] = e.moveCall({
967
947
  target: `${n.package}::incentive_v3::withdraw_v2`,
968
948
  arguments: [
969
949
  e.object("0x06"),
@@ -978,7 +958,7 @@ async function Zt(e, t, r, o) {
978
958
  ],
979
959
  typeArguments: [a.suiCoinType]
980
960
  });
981
- i = l;
961
+ i = u;
982
962
  }
983
963
  return e.moveCall({
984
964
  target: "0x2::coin::from_balance",
@@ -986,7 +966,7 @@ async function Zt(e, t, r, o) {
986
966
  typeArguments: [a.suiCoinType]
987
967
  });
988
968
  }
989
- async function Xt(e, t, r, o) {
969
+ async function er(e, t, r, o) {
990
970
  const n = await j({
991
971
  ...o,
992
972
  cacheTime: v
@@ -997,7 +977,7 @@ async function Xt(e, t, r, o) {
997
977
  let i;
998
978
  if (n.version === 1)
999
979
  if (o?.accountCap) {
1000
- const [l] = e.moveCall({
980
+ const [u] = e.moveCall({
1001
981
  target: `${n.package}::incentive_v3::borrow_with_account_cap`,
1002
982
  arguments: [
1003
983
  e.object("0x06"),
@@ -1012,9 +992,9 @@ async function Xt(e, t, r, o) {
1012
992
  ],
1013
993
  typeArguments: [a.suiCoinType]
1014
994
  });
1015
- i = l;
995
+ i = u;
1016
996
  } else {
1017
- const [l] = e.moveCall({
997
+ const [u] = e.moveCall({
1018
998
  target: `${n.package}::incentive_v3::borrow`,
1019
999
  arguments: [
1020
1000
  e.object("0x06"),
@@ -1028,10 +1008,10 @@ async function Xt(e, t, r, o) {
1028
1008
  ],
1029
1009
  typeArguments: [a.suiCoinType]
1030
1010
  });
1031
- i = l;
1011
+ i = u;
1032
1012
  }
1033
1013
  else if (o?.accountCap) {
1034
- const [l] = e.moveCall({
1014
+ const [u] = e.moveCall({
1035
1015
  target: `${n.package}::incentive_v3::borrow_with_account_cap_v2`,
1036
1016
  arguments: [
1037
1017
  e.object("0x06"),
@@ -1047,9 +1027,9 @@ async function Xt(e, t, r, o) {
1047
1027
  ],
1048
1028
  typeArguments: [a.suiCoinType]
1049
1029
  });
1050
- i = l;
1030
+ i = u;
1051
1031
  } else {
1052
- const [l] = e.moveCall({
1032
+ const [u] = e.moveCall({
1053
1033
  target: `${n.package}::incentive_v3::borrow_v2`,
1054
1034
  arguments: [
1055
1035
  e.object("0x06"),
@@ -1064,7 +1044,7 @@ async function Xt(e, t, r, o) {
1064
1044
  ],
1065
1045
  typeArguments: [a.suiCoinType]
1066
1046
  });
1067
- i = l;
1047
+ i = u;
1068
1048
  }
1069
1049
  return e.moveCall({
1070
1050
  target: "0x2::coin::from_balance",
@@ -1072,7 +1052,7 @@ async function Xt(e, t, r, o) {
1072
1052
  typeArguments: [a.suiCoinType]
1073
1053
  });
1074
1054
  }
1075
- async function xt(e, t, r, o) {
1055
+ async function tr(e, t, r, o) {
1076
1056
  const n = await j({
1077
1057
  ...o,
1078
1058
  cacheTime: v
@@ -1125,7 +1105,7 @@ async function xt(e, t, r, o) {
1125
1105
  typeArguments: [a.suiCoinType]
1126
1106
  }), e;
1127
1107
  }
1128
- const er = $(
1108
+ const rr = $(
1129
1109
  A(
1130
1110
  async (e) => {
1131
1111
  const t = await j({
@@ -1147,7 +1127,7 @@ const er = $(
1147
1127
  const i = await q(r, {
1148
1128
  transactionBlock: c,
1149
1129
  sender: e.address
1150
- }), s = Q(i, [u.u64()]);
1130
+ }), s = Q(i, [l.u64()]);
1151
1131
  return (Number(s[0]) || 0) / 100;
1152
1132
  } catch (a) {
1153
1133
  console.error(
@@ -1155,7 +1135,7 @@ const er = $(
1155
1135
  a
1156
1136
  );
1157
1137
  }
1158
- const n = (await pt(r, {
1138
+ const n = (await yt(r, {
1159
1139
  id: t.incentiveV3,
1160
1140
  options: { showType: !0, showOwner: !0, showContent: !0 }
1161
1141
  })).data.content.fields.borrow_fee_rate;
@@ -1184,7 +1164,7 @@ const er = $(
1184
1164
  name: "Sui Eco Market"
1185
1165
  }
1186
1166
  };
1187
- class wt {
1167
+ class Ct {
1188
1168
  constructor(t, r) {
1189
1169
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
1190
1170
  marketTotalSupplyValue: "0",
@@ -1195,7 +1175,7 @@ class wt {
1195
1175
  return this._overview;
1196
1176
  }
1197
1177
  initPools(t) {
1198
- const r = ee(this.pools), o = de(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1178
+ const r = te(this.pools), o = pe(this.emodes), n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1199
1179
  let c = p(0), i = p(0);
1200
1180
  t.forEach((s) => {
1201
1181
  if (!this.checkMarket(s.market)) {
@@ -1209,9 +1189,9 @@ class wt {
1209
1189
  ) && n.add(s.uniqueId), w.isCollateral && m.assets.find((g) => g.isDebt && g.assetId !== s.id) && a.add(s.uniqueId);
1210
1190
  });
1211
1191
  }), i = i.plus(s.poolBorrowValue), c = c.plus(s.poolSupplyValue);
1212
- }), 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);
1192
+ }), this.poolMap = te(this.pools, "id"), this.emodeMap = pe(this.emodes, "emodeId"), this.emodes.forEach((s) => {
1193
+ const u = this.getEModePools(s.emodeId);
1194
+ this.emodePools.push(...u);
1215
1195
  }), this._overview = {
1216
1196
  marketTotalSupplyValue: c.toString(),
1217
1197
  marketTotalBorrowValue: i.toString()
@@ -1252,7 +1232,7 @@ const _ = (e) => {
1252
1232
  if (!r)
1253
1233
  throw new Error("Market not found");
1254
1234
  return r;
1255
- }, bt = $(
1235
+ }, jt = $(
1256
1236
  A(
1257
1237
  async (e, t) => {
1258
1238
  const r = await G({
@@ -1262,13 +1242,13 @@ const _ = (e) => {
1262
1242
  });
1263
1243
  return e.map((o) => {
1264
1244
  const n = _(o), a = r.filter((c) => c.market === n.key);
1265
- return new wt(o, a);
1245
+ return new Ct(o, a);
1266
1246
  });
1267
1247
  }
1268
1248
  )
1269
- ), tr = $(
1249
+ ), nr = $(
1270
1250
  A(
1271
- async (e, t) => (await bt([e], t))[0]
1251
+ async (e, t) => (await jt([e], t))[0]
1272
1252
  )
1273
1253
  ), j = $(
1274
1254
  A(
@@ -1278,12 +1258,12 @@ const _ = (e) => {
1278
1258
  e
1279
1259
  );
1280
1260
  return (await fetch(o, {
1281
- headers: D(U, r)
1261
+ headers: U(D, r)
1282
1262
  }).then((a) => a.json())).data;
1283
1263
  }
1284
1264
  )
1285
1265
  ), v = 1e3 * 60 * 5;
1286
- async function vt(e, t) {
1266
+ async function It(e, t) {
1287
1267
  const r = await j({
1288
1268
  cacheTime: v,
1289
1269
  ...t
@@ -1293,7 +1273,7 @@ async function vt(e, t) {
1293
1273
  arguments: []
1294
1274
  });
1295
1275
  }
1296
- async function Ct(e, t, r) {
1276
+ async function kt(e, t, r) {
1297
1277
  const o = await j({
1298
1278
  cacheTime: v,
1299
1279
  ...r
@@ -1303,7 +1283,7 @@ async function Ct(e, t, r) {
1303
1283
  arguments: [t]
1304
1284
  });
1305
1285
  }
1306
- async function jt(e, t, r) {
1286
+ async function _t(e, t, r) {
1307
1287
  const o = await j({
1308
1288
  ...r,
1309
1289
  cacheTime: v
@@ -1320,7 +1300,7 @@ async function jt(e, t, r) {
1320
1300
  arguments: [e.object(o.storage), h(t, e.pure.u64)]
1321
1301
  }), e;
1322
1302
  }
1323
- async function rr(e, t) {
1303
+ async function or(e, t) {
1324
1304
  const r = await j({
1325
1305
  ...t,
1326
1306
  cacheTime: v
@@ -1333,16 +1313,16 @@ async function rr(e, t) {
1333
1313
  arguments: [e.object(r.storage)]
1334
1314
  }), e;
1335
1315
  }
1336
- async function nr(e, t, r) {
1316
+ async function ar(e, t, r) {
1337
1317
  const o = await j({
1338
1318
  cacheTime: v,
1339
1319
  ...r
1340
- }), n = await vt(e, r);
1341
- await jt(e, t, {
1320
+ }), n = await It(e, r);
1321
+ await _t(e, t, {
1342
1322
  ...r,
1343
1323
  accountCap: n
1344
1324
  });
1345
- const a = await _(r?.market || R), c = await Ct(e, n, r);
1325
+ const a = await _(r?.market || R), c = await kt(e, n, r);
1346
1326
  return e.moveCall({
1347
1327
  target: `${o.emode.contract.registryPackage}::registry::register_emode_for_account_cap`,
1348
1328
  arguments: [
@@ -1353,7 +1333,7 @@ async function nr(e, t, r) {
1353
1333
  ]
1354
1334
  }), n;
1355
1335
  }
1356
- const ke = $(
1336
+ const Be = $(
1357
1337
  A(
1358
1338
  async (e, t) => {
1359
1339
  const r = await j({
@@ -1367,35 +1347,35 @@ const ke = $(
1367
1347
  const c = (await q(n, {
1368
1348
  transactionBlock: o,
1369
1349
  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]));
1350
+ })).results[0].returnValues, i = l.vector(l.u64()).parse(Uint8Array.from(c[0][0])), s = l.vector(l.u64()).parse(Uint8Array.from(c[1][0])), u = l.vector(l.Address).parse(Uint8Array.from(c[2][0]));
1371
1351
  return i.map((m, w) => ({
1372
1352
  marketId: Number(m),
1373
1353
  emodeId: Number(s[w]),
1374
- accountCap: l[w].toString()
1354
+ accountCap: u[w].toString()
1375
1355
  }));
1376
1356
  }
1377
1357
  )
1378
1358
  );
1379
- function or(e) {
1359
+ function ir(e) {
1380
1360
  return `${_(e.marketId).key}-${e.emodeId}`;
1381
1361
  }
1382
- function kt(e, t) {
1362
+ function Tt(e, t) {
1383
1363
  return e.coinType ? e.coinType : t || (typeof e.type == "string" ? e.type.match(/::coin::Coin<(.+)>$/) : null)?.[1];
1384
1364
  }
1385
- function pe(e, t) {
1386
- const r = kt(e, t), o = e.coinObjectId ?? e.objectId;
1365
+ function me(e, t) {
1366
+ const r = Tt(e, t), o = e.coinObjectId ?? e.objectId;
1387
1367
  return !r || !o || e.balance === void 0 || e.balance === null ? null : {
1388
1368
  ...e,
1389
1369
  coinType: C(r),
1390
1370
  coinObjectId: o
1391
1371
  };
1392
1372
  }
1393
- function ar(e, t, r) {
1373
+ function cr(e, t, r) {
1394
1374
  const o = typeof r?.balance == "number", n = o ? r.balance : 0;
1395
1375
  let a = 0;
1396
1376
  const c = [];
1397
1377
  let i = "";
1398
- if (t.sort((s, l) => Number(l.balance) - Number(s.balance)).forEach((s) => {
1378
+ if (t.sort((s, u) => Number(u.balance) - Number(s.balance)).forEach((s) => {
1399
1379
  if (!(o && a >= n) && Number(s.balance) !== 0) {
1400
1380
  if (i || (i = s.coinType), i !== s.coinType)
1401
1381
  throw new Error("All coins must be of the same type");
@@ -1409,7 +1389,7 @@ function ar(e, t, r) {
1409
1389
  );
1410
1390
  return C(i) === C("0x2::sui::SUI") && r?.useGasCoin ? o ? e.splitCoins(e.gas, [e.pure.u64(n)]) : e.gas : (c.length === 1 ? e.object(c[0]) : e.mergeCoins(c[0], c.slice(1)), o ? e.splitCoins(c[0], [e.pure.u64(n)]) : c[0]);
1411
1391
  }
1412
- async function Ie(e, t, r, o, n, a, c) {
1392
+ async function Pe(e, t, r, o, n, a, c) {
1413
1393
  const i = await j({
1414
1394
  ...c,
1415
1395
  cacheTime: v
@@ -1420,7 +1400,7 @@ async function Ie(e, t, r, o, n, a, c) {
1420
1400
  e.object("0x06"),
1421
1401
  e.object(i.storage),
1422
1402
  e.object(i.oracle.priceOracle),
1423
- ft(e, s),
1403
+ ht(e, s),
1424
1404
  h(t, e.pure.address),
1425
1405
  h(s.id, e.pure.u8),
1426
1406
  h(o, e.pure.u64),
@@ -1430,14 +1410,14 @@ async function Ie(e, t, r, o, n, a, c) {
1430
1410
  typeArguments: [s.suiCoinType]
1431
1411
  });
1432
1412
  }
1433
- async function It(e, t, r) {
1434
- return Ie(e, t, 0, 0, 0, !1, r);
1413
+ async function Bt(e, t, r) {
1414
+ return Pe(e, t, 0, 0, 0, !1, r);
1435
1415
  }
1436
- async function _e(e, t, r) {
1416
+ async function Ae(e, t, r) {
1437
1417
  const o = new N(), n = r?.client ?? V, a = await G({
1438
1418
  ...r,
1439
1419
  markets: Object.values(F)
1440
- }), c = ee(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
1420
+ }), c = te(a), s = Array.from(new Set(t.map((d) => d.market))).map((d) => _(d));
1441
1421
  for (const d of s) {
1442
1422
  const f = await j({
1443
1423
  ...r,
@@ -1466,13 +1446,13 @@ async function _e(e, t, r) {
1466
1446
  })).results || [], w = {};
1467
1447
  s.forEach((d, f) => {
1468
1448
  try {
1469
- const b = m[f]?.returnValues?.map((T) => u.vector(Re).parse(Uint8Array.from(T[0])))[0] || [], k = {};
1449
+ const b = m[f]?.returnValues?.map((T) => l.vector(qe).parse(Uint8Array.from(T[0])))[0] || [], I = {};
1470
1450
  for (const T of b)
1471
- k[T.id] = {
1451
+ I[T.id] = {
1472
1452
  supplyIndex: T.supply_index,
1473
1453
  borrowIndex: T.borrow_index
1474
1454
  };
1475
- w[d.key] = k;
1455
+ w[d.key] = I;
1476
1456
  } catch (b) {
1477
1457
  console.warn(
1478
1458
  `[@naviprotocol/lending] Failed to decode reserve data for market "${d.key}", falling back to open-api pool indices`,
@@ -1480,46 +1460,46 @@ async function _e(e, t, r) {
1480
1460
  );
1481
1461
  }
1482
1462
  });
1483
- const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => u.vector(Le).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1463
+ const y = m.slice(s.length).map((d) => d.returnValues?.map((f) => l.vector(ze).parse(Uint8Array.from(f[0])))[0] || []), g = [];
1484
1464
  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))
1465
+ const b = t[f], I = _(b.market), T = w[I.key] || {};
1466
+ d.forEach((k) => {
1467
+ if (k.supply_balance === "0" && k.borrow_balance === "0" && (b.emodeId === void 0 || !r?.includeZeroBalanceEmodePositions))
1488
1468
  return;
1489
- const B = c[`${k.key}-${I.asset_id}`];
1469
+ const B = c[`${I.key}-${k.asset_id}`];
1490
1470
  if (!B)
1491
1471
  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();
1472
+ const W = T[k.asset_id], Y = W?.supplyIndex ?? B.currentSupplyIndex, Oe = W?.borrowIndex ?? B.currentBorrowIndex, Ee = de(k.supply_balance, Y).toString(), Ve = de(k.borrow_balance, Oe).toString();
1493
1473
  g.push({
1494
- supplyBalance: Ae,
1495
- borrowBalance: Se,
1496
- assetId: I.asset_id,
1497
- market: k.key,
1474
+ supplyBalance: Ee,
1475
+ borrowBalance: Ve,
1476
+ assetId: k.asset_id,
1477
+ market: I.key,
1498
1478
  pool: B,
1499
1479
  emodeId: b.emodeId
1500
1480
  });
1501
1481
  });
1502
1482
  }), g;
1503
1483
  }
1504
- const ir = $(
1484
+ const sr = $(
1505
1485
  async (e, t) => {
1506
1486
  const o = (t?.markets || Object.keys(F)).map((n) => _(n)).map((n) => ({
1507
1487
  address: e,
1508
1488
  market: n.key
1509
1489
  }));
1510
- return await _e(e, o, t);
1490
+ return await Ae(e, o, t);
1511
1491
  }
1512
1492
  );
1513
- async function cr(e, t) {
1493
+ async function ur(e, t) {
1514
1494
  const r = t?.client ?? V, o = new N();
1515
- await It(o, e, t);
1495
+ await Bt(o, e, t);
1516
1496
  const n = await q(r, {
1517
1497
  transactionBlock: o,
1518
1498
  sender: e
1519
- }), a = Q(n, [u.u256()]);
1520
- return je(Number(a[0]) || 0);
1499
+ }), a = Q(n, [l.u256()]);
1500
+ return Te(Number(a[0]) || 0);
1521
1501
  }
1522
- async function sr(e, t, r, o) {
1502
+ async function lr(e, t, r, o) {
1523
1503
  const n = o?.client ?? V, a = new N();
1524
1504
  let c = 0, i = 0;
1525
1505
  const s = await S(t, o);
@@ -1527,23 +1507,23 @@ async function sr(e, t, r, o) {
1527
1507
  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
1508
  }), c * i < 0)
1529
1509
  throw new Error("Invalid operations");
1530
- const l = c > 0 || i > 0;
1531
- await Ie(
1510
+ const u = c > 0 || i > 0;
1511
+ await Pe(
1532
1512
  a,
1533
1513
  e,
1534
1514
  s,
1535
1515
  Math.abs(c),
1536
1516
  Math.abs(i),
1537
- l,
1517
+ u,
1538
1518
  o
1539
1519
  );
1540
1520
  const m = await q(n, {
1541
1521
  transactionBlock: a,
1542
1522
  sender: e
1543
- }), w = Q(m, [u.u256()]);
1544
- return je(Number(w[0]) || 0);
1523
+ }), w = Q(m, [l.u256()]);
1524
+ return Te(Number(w[0]) || 0);
1545
1525
  }
1546
- const lr = A(
1526
+ const dr = A(
1547
1527
  async (e, t) => {
1548
1528
  const r = new URLSearchParams();
1549
1529
  t?.cursor && r.set("cursor", t.cursor), r.set("userAddress", e);
@@ -1552,11 +1532,11 @@ const lr = A(
1552
1532
  t
1553
1533
  );
1554
1534
  return (await fetch(n, {
1555
- headers: D(U, o)
1535
+ headers: U(D, o)
1556
1536
  }).then((c) => c.json())).data;
1557
1537
  }
1558
1538
  );
1559
- async function ur(e, t) {
1539
+ async function pr(e, t) {
1560
1540
  let r = null;
1561
1541
  const o = [], n = t?.client ?? V, a = n.core;
1562
1542
  do {
@@ -1570,7 +1550,7 @@ async function ur(e, t) {
1570
1550
  limit: 100
1571
1551
  });
1572
1552
  c = {
1573
- data: (i.objects ?? i.data ?? []).map((s) => pe(s, t?.coinType)).filter(Boolean),
1553
+ data: (i.objects ?? i.data ?? []).map((s) => me(s, t?.coinType)).filter(Boolean),
1574
1554
  nextCursor: i.cursor ?? i.nextCursor ?? null,
1575
1555
  hasNextPage: i.hasNextPage ?? !1
1576
1556
  };
@@ -1588,26 +1568,26 @@ async function ur(e, t) {
1588
1568
  const i = /* @__PURE__ */ new Set();
1589
1569
  let s = null;
1590
1570
  do {
1591
- const l = await a.listBalances({
1571
+ const u = await a.listBalances({
1592
1572
  owner: e,
1593
1573
  cursor: s,
1594
1574
  limit: 100
1595
1575
  });
1596
- for (const m of l.balances ?? [])
1576
+ for (const m of u.balances ?? [])
1597
1577
  m?.coinType && i.add(m.coinType);
1598
- s = l.cursor ?? l.nextCursor ?? null;
1578
+ s = u.cursor ?? u.nextCursor ?? null;
1599
1579
  } while (s);
1600
- for (const l of i) {
1580
+ for (const u of i) {
1601
1581
  let m = null;
1602
1582
  do {
1603
1583
  const w = await a.listCoins({
1604
1584
  owner: e,
1605
- coinType: l,
1585
+ coinType: u,
1606
1586
  cursor: m,
1607
1587
  limit: 100
1608
1588
  });
1609
1589
  o.push(
1610
- ...(w.objects ?? w.data ?? []).map((y) => pe(y, l)).filter(Boolean)
1590
+ ...(w.objects ?? w.data ?? []).map((y) => me(y, u)).filter(Boolean)
1611
1591
  ), m = w.cursor ?? w.nextCursor ?? null;
1612
1592
  } while (m);
1613
1593
  }
@@ -1629,16 +1609,9 @@ async function ur(e, t) {
1629
1609
  } while (r);
1630
1610
  return o;
1631
1611
  }
1632
- const _t = $(
1612
+ const Pt = $(
1633
1613
  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) => ({
1614
+ const r = [], o = (t?.markets || Object.keys(F)).map((i) => _(i)), n = await Be(e, t), a = o.map((i) => ({
1642
1615
  address: e,
1643
1616
  market: i.key
1644
1617
  })).concat(
@@ -1648,10 +1621,10 @@ const _t = $(
1648
1621
  emodeId: i.emodeId
1649
1622
  }))
1650
1623
  );
1651
- return (await _e(e, a, t)).forEach((i) => {
1652
- const s = typeof i.emodeId == "number" ? n.find((l) => {
1624
+ return (await Ae(e, a, t)).forEach((i) => {
1625
+ const s = typeof i.emodeId == "number" ? n.find((u) => {
1653
1626
  const m = _(i.market);
1654
- return l.emodeId === i.emodeId && l.marketId === m.id;
1627
+ return u.emodeId === i.emodeId && u.marketId === m.id;
1655
1628
  }) : void 0;
1656
1629
  if (s) {
1657
1630
  if (!i.pool.emodes.find((m) => m.emodeId === s.emodeId))
@@ -1702,7 +1675,7 @@ const _t = $(
1702
1675
  }
1703
1676
  } else {
1704
1677
  if (p(i.supplyBalance).gt(0)) {
1705
- const l = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1678
+ const u = p(i.supplyBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1706
1679
  r.push({
1707
1680
  id: `${i.pool.uniqueId}_navi-lending-supply-${P()}`,
1708
1681
  wallet: e,
@@ -1710,15 +1683,15 @@ const _t = $(
1710
1683
  type: "navi-lending-supply",
1711
1684
  market: i.market,
1712
1685
  "navi-lending-supply": {
1713
- amount: l.toString(),
1686
+ amount: u.toString(),
1714
1687
  pool: i.pool,
1715
1688
  token: i.pool.token,
1716
- valueUSD: l.multipliedBy(i.pool.oracle.price).toString()
1689
+ valueUSD: u.multipliedBy(i.pool.oracle.price).toString()
1717
1690
  }
1718
1691
  });
1719
1692
  }
1720
1693
  if (p(i.borrowBalance).gt(0)) {
1721
- const l = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1694
+ const u = p(i.borrowBalance).shiftedBy(-9).decimalPlaces(i.pool.token.decimals, p.ROUND_DOWN);
1722
1695
  r.push({
1723
1696
  id: `${i.pool.uniqueId}_navi-lending-borrow-${P()}`,
1724
1697
  wallet: e,
@@ -1726,10 +1699,10 @@ const _t = $(
1726
1699
  market: i.market,
1727
1700
  type: "navi-lending-borrow",
1728
1701
  "navi-lending-borrow": {
1729
- amount: l.toString(),
1702
+ amount: u.toString(),
1730
1703
  pool: i.pool,
1731
1704
  token: i.pool.token,
1732
- valueUSD: l.multipliedBy(i.pool.oracle.price).toString()
1705
+ valueUSD: u.multipliedBy(i.pool.oracle.price).toString()
1733
1706
  }
1734
1707
  });
1735
1708
  }
@@ -1910,13 +1883,13 @@ class L {
1910
1883
  }
1911
1884
  getPositionsOverview(t) {
1912
1885
  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);
1886
+ 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
1887
  t.forEach((g) => {
1915
1888
  if (g.type === "navi-lending-supply") {
1916
1889
  const d = g["navi-lending-supply"], f = this.resolveValueUSD(d);
1917
1890
  n = n.plus(f), s = s.plus(
1918
1891
  new p(f).multipliedBy(d.pool.liquidationFactor.threshold)
1919
- ), l = l.plus(
1892
+ ), u = u.plus(
1920
1893
  new p(f).multipliedBy(d.pool.ltvValue)
1921
1894
  );
1922
1895
  } else if (g.type === "navi-lending-borrow") {
@@ -1928,14 +1901,14 @@ class L {
1928
1901
  const b = d.pool.emode;
1929
1902
  s = s.plus(
1930
1903
  new p(f).multipliedBy(b.lt)
1931
- ), l = l.plus(
1904
+ ), u = u.plus(
1932
1905
  new p(f).multipliedBy(b.ltv)
1933
1906
  );
1934
1907
  } else if (g.type === "navi-lending-emode-borrow") {
1935
1908
  const d = g["navi-lending-emode-borrow"];
1936
1909
  a = a.plus(this.resolveValueUSD(d));
1937
1910
  }
1938
- }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), l = p.max(l, 0), t.forEach((g) => {
1911
+ }), a = p.max(a, 0), n = p.max(n, 0), s = p.max(s, 0), u = p.max(u, 0), t.forEach((g) => {
1939
1912
  if (g.type === "navi-lending-supply") {
1940
1913
  const d = g["navi-lending-supply"], f = this.resolveValueUSD(d), b = d.pool.supplyIncentiveApyInfo.apy;
1941
1914
  n.gt(0) && (c = c.plus(
@@ -1968,13 +1941,13 @@ class L {
1968
1941
  totalsupplyApy: c.toString(),
1969
1942
  totalBorrowApy: i.toString(),
1970
1943
  maxLiquidationValue: s.toString(),
1971
- maxLoanToVaule: l.toString(),
1944
+ maxLoanToVaule: u.toString(),
1972
1945
  supply: r,
1973
1946
  borrow: o
1974
1947
  };
1975
1948
  }
1976
1949
  }
1977
- async function dr(e, t, r, o) {
1950
+ async function mr(e, t, r, o) {
1978
1951
  const n = await j({
1979
1952
  ...o,
1980
1953
  cacheTime: v
@@ -1990,12 +1963,12 @@ async function dr(e, t, r, o) {
1990
1963
  ]
1991
1964
  });
1992
1965
  }
1993
- const Te = new he("https://hermes.pyth.network", {
1966
+ const Se = new Ce("https://hermes.pyth.network", {
1994
1967
  timeout: 1e4
1995
1968
  });
1996
- async function pr(e) {
1969
+ async function fr(e) {
1997
1970
  try {
1998
- const t = [], r = await Te.getLatestPriceFeeds(e);
1971
+ const t = [], r = await Se.getLatestPriceFeeds(e);
1999
1972
  if (!r) return t;
2000
1973
  const o = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2001
1974
  for (const n of r) {
@@ -2015,47 +1988,42 @@ async function pr(e) {
2015
1988
  throw new Error(`failed to get pyth stale price feed id, msg: ${t.message}`);
2016
1989
  }
2017
1990
  }
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
- });
1991
+ async function At(e, t) {
1992
+ const r = [], o = t?.client ?? V, n = e.map((c) => c.priceInfoObject), a = await gt(o, {
1993
+ ids: Array.from(new Set(n)),
1994
+ options: { showContent: !0 }
1995
+ });
1996
+ for (const c of a) {
1997
+ const i = c.data;
1998
+ if (!i || !i.content || i.content.dataType !== "moveObject") {
1999
+ console.warn(`fetched object ${i?.objectId} datatype should be moveObject`);
2000
+ continue;
2049
2001
  }
2050
- return r;
2051
- } catch (r) {
2052
- console.error(r, `Polling Sui on-chain price for ${e} failed.`);
2053
- return;
2002
+ const s = e.find((f) => f.priceInfoObject == i.objectId);
2003
+ if (!s) {
2004
+ console.warn(`unable to find pyth info from array, priceInfoObject: ${i.objectId}`);
2005
+ continue;
2006
+ }
2007
+ const u = i.content.fields?.price_info?.price_feed?.price, m = u?.price;
2008
+ if (!m) {
2009
+ console.warn(`unexpected pyth price struct, priceInfoObject: ${i.objectId}`);
2010
+ continue;
2011
+ }
2012
+ const { magnitude: w, negative: y } = m, g = u.conf, d = u.timestamp;
2013
+ r.push({
2014
+ priceFeedId: s.priceFeedId,
2015
+ priceInfoObject: s.priceInfoObject,
2016
+ price: y ? "-" + w : w,
2017
+ conf: g,
2018
+ publishTime: Number(d),
2019
+ expiration: s.expiration
2020
+ });
2054
2021
  }
2022
+ return r;
2055
2023
  }
2056
- async function Bt(e, t) {
2024
+ async function St(e, t) {
2057
2025
  try {
2058
- const r = [], o = await Tt(e, t);
2026
+ const r = [], o = await At(e, t);
2059
2027
  if (!o) return r;
2060
2028
  const n = Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3);
2061
2029
  for (const a of o) {
@@ -2075,14 +2043,14 @@ async function Bt(e, t) {
2075
2043
  throw new Error(`failed to get pyth stale price feed id, msg: ${r.message}`);
2076
2044
  }
2077
2045
  }
2078
- async function Pt(e, t, r) {
2046
+ async function $t(e, t, r) {
2079
2047
  const o = r?.client ?? V, n = await j({
2080
2048
  ...r,
2081
2049
  cacheTime: v
2082
2050
  });
2083
2051
  try {
2084
- const a = await Te.getPriceFeedsUpdateData(t);
2085
- return await new ct(
2052
+ const a = await Se.getPriceFeedsUpdateData(t);
2053
+ return await new lt(
2086
2054
  o,
2087
2055
  n.oracle.pythStateId,
2088
2056
  n.oracle.wormholeStateId
@@ -2091,23 +2059,18 @@ async function Pt(e, t, r) {
2091
2059
  throw new Error(`failed to update pyth price feeds, msg: ${a.message}`);
2092
2060
  }
2093
2061
  }
2094
- async function At(e, t, r) {
2062
+ async function fe(e, t, r) {
2095
2063
  const o = await j({
2096
2064
  ...r,
2097
2065
  cacheTime: v
2098
2066
  });
2099
2067
  if (r?.updatePythPriceFeeds) {
2100
- const n = t.filter((a) => !!a.pythPriceFeedId && !!a.pythPriceInfoObject).map((a) => ({
2101
- priceFeedId: a.pythPriceFeedId,
2102
- priceInfoObject: a.pythPriceInfoObject,
2068
+ const n = t.filter((c) => !!c.pythPriceFeedId && !!c.pythPriceInfoObject).map((c) => ({
2069
+ priceFeedId: c.pythPriceFeedId,
2070
+ priceInfoObject: c.pythPriceInfoObject,
2103
2071
  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
- }
2072
+ })), a = await St(n, r);
2073
+ a.length > 0 && await $t(e, a, r);
2111
2074
  }
2112
2075
  for (const n of t)
2113
2076
  r?.env === "dev" ? e.moveCall({
@@ -2146,13 +2109,13 @@ async function At(e, t, r) {
2146
2109
  });
2147
2110
  return e;
2148
2111
  }
2149
- async function Be(e) {
2112
+ async function $e(e) {
2150
2113
  return (await j({
2151
2114
  ...e,
2152
2115
  cacheTime: v
2153
2116
  })).oracle.feeds;
2154
2117
  }
2155
- function St(e, t) {
2118
+ function Ot(e, t) {
2156
2119
  return e.filter((r) => !!(t?.lendingState && t.lendingState.find((n) => r.oracleId === n.pool.oracleId) || t?.lendingPositions && t.lendingPositions.find((n) => {
2157
2120
  if (![
2158
2121
  "navi-lending-supply",
@@ -2165,39 +2128,49 @@ function St(e, t) {
2165
2128
  return r.oracleId === c?.oracleId;
2166
2129
  }) || t?.pools && t.pools.find((n) => r.oracleId === n.oracleId)));
2167
2130
  }
2168
- async function mr(e, t, r, o) {
2131
+ async function yr(e, t, r, o) {
2132
+ let n;
2169
2133
  try {
2170
- const n = await Be({
2134
+ const a = await $e({
2171
2135
  ...o
2172
- }), a = [];
2173
- r.forEach((l) => {
2174
- a.includes(l.market) || a.push(l.market);
2136
+ }), c = [];
2137
+ r.forEach((u) => {
2138
+ c.includes(u.market) || c.push(u.market);
2175
2139
  });
2176
- const c = await _t(t, {
2140
+ const i = await Pt(t, {
2177
2141
  ...o,
2178
- markets: a
2179
- }), i = St(n, {
2180
- lendingPositions: c,
2181
- pools: r
2142
+ markets: c
2182
2143
  });
2183
- return await At(e, i, {
2144
+ return n = Ot(a, {
2145
+ lendingPositions: i,
2146
+ pools: r
2147
+ }), await fe(e, n, {
2184
2148
  updatePythPriceFeeds: !0,
2185
2149
  ...o
2186
2150
  });
2187
- } catch (n) {
2151
+ } catch (a) {
2188
2152
  if (o?.throws)
2189
- throw n;
2190
- return console.error(n), e;
2153
+ throw a;
2154
+ if (console.error(a), n)
2155
+ try {
2156
+ return await fe(e, n, {
2157
+ ...o,
2158
+ updatePythPriceFeeds: !1
2159
+ });
2160
+ } catch (c) {
2161
+ console.error(c);
2162
+ }
2163
+ return e;
2191
2164
  }
2192
2165
  }
2193
- const re = $(
2166
+ const ne = $(
2194
2167
  A(
2195
2168
  async (e) => {
2196
2169
  const t = E(e), r = M(
2197
2170
  `/navi/flashloan?env=${e?.env || "prod"}&sdk=${O.version}&market=${e?.market || R}`,
2198
2171
  e
2199
2172
  ), o = await fetch(r, {
2200
- headers: D(U, t)
2173
+ headers: U(D, t)
2201
2174
  }).then((n) => n.json());
2202
2175
  return Object.keys(o.data).map((n) => ({
2203
2176
  ...o.data[n],
@@ -2206,15 +2179,15 @@ const re = $(
2206
2179
  }
2207
2180
  )
2208
2181
  );
2209
- async function fr(e, t) {
2210
- return (await re(t)).find((o) => typeof e == "string" ? C(o.coinType) === C(e) : typeof e == "number" ? o.assetId === e : o.assetId === e.id) || null;
2182
+ async function gr(e, t) {
2183
+ return (await ne(t)).find((o) => typeof e == "string" ? C(o.coinType) === C(e) : typeof e == "number" ? o.assetId === e : o.assetId === e.id) || null;
2211
2184
  }
2212
- async function yr(e, t, r, o) {
2185
+ async function hr(e, t, r, o) {
2213
2186
  const n = await j({
2214
2187
  ...o,
2215
2188
  cacheTime: v
2216
2189
  }), a = await S(t, o);
2217
- if (!(await re({
2190
+ if (!(await ne({
2218
2191
  ...o,
2219
2192
  cacheTime: v
2220
2193
  })).some(
@@ -2222,7 +2195,7 @@ async function yr(e, t, r, o) {
2222
2195
  ))
2223
2196
  throw new Error("Pool does not support flashloan");
2224
2197
  if (n.version === 1) {
2225
- const [s, l] = e.moveCall({
2198
+ const [s, u] = e.moveCall({
2226
2199
  target: `${n.package}::lending::flash_loan_with_ctx`,
2227
2200
  arguments: [
2228
2201
  e.object(n.flashloanConfig),
@@ -2231,9 +2204,9 @@ async function yr(e, t, r, o) {
2231
2204
  ],
2232
2205
  typeArguments: [a.suiCoinType]
2233
2206
  });
2234
- return [s, l];
2207
+ return [s, u];
2235
2208
  } else {
2236
- const [s, l] = e.moveCall({
2209
+ const [s, u] = e.moveCall({
2237
2210
  target: `${n.package}::lending::flash_loan_with_ctx_v2`,
2238
2211
  arguments: [
2239
2212
  e.object(n.flashloanConfig),
@@ -2243,22 +2216,22 @@ async function yr(e, t, r, o) {
2243
2216
  ],
2244
2217
  typeArguments: [a.suiCoinType]
2245
2218
  });
2246
- return [s, l];
2219
+ return [s, u];
2247
2220
  }
2248
2221
  }
2249
- async function gr(e, t, r, o, n) {
2222
+ async function wr(e, t, r, o, n) {
2250
2223
  const a = await j({
2251
2224
  ...n,
2252
2225
  cacheTime: v
2253
2226
  }), c = await S(t, n);
2254
- if (!(await re({
2227
+ if (!(await ne({
2255
2228
  ...n,
2256
2229
  cacheTime: v
2257
2230
  })).some(
2258
2231
  (m) => C(m.coinType) === C(c.suiCoinType)
2259
2232
  ))
2260
2233
  throw new Error("Pool does not support flashloan");
2261
- const [l] = e.moveCall({
2234
+ const [u] = e.moveCall({
2262
2235
  target: `${a.package}::lending::flash_repay_with_ctx`,
2263
2236
  arguments: [
2264
2237
  e.object("0x06"),
@@ -2269,13 +2242,13 @@ async function gr(e, t, r, o, n) {
2269
2242
  ],
2270
2243
  typeArguments: [c.suiCoinType]
2271
2244
  });
2272
- return [l];
2245
+ return [u];
2273
2246
  }
2274
- async function hr(e, t, r, o, n, a) {
2247
+ async function br(e, t, r, o, n, a) {
2275
2248
  const c = {
2276
2249
  ...a,
2277
2250
  cacheTime: v
2278
- }, i = await j(c), s = await S(t, c), l = await S(o, c);
2251
+ }, i = await j(c), s = await S(t, c), u = await S(o, c);
2279
2252
  if (i.version === 1) {
2280
2253
  const [m, w] = e.moveCall({
2281
2254
  target: `${i.package}::incentive_v3::liquidation`,
@@ -2292,9 +2265,9 @@ async function hr(e, t, r, o, n, a) {
2292
2265
  // Pay asset pool contract
2293
2266
  h(r, e.object),
2294
2267
  // Debt repayment amount
2295
- e.pure.u8(l.id),
2268
+ e.pure.u8(u.id),
2296
2269
  // Collateral asset ID
2297
- e.object(l.contract.pool),
2270
+ e.object(u.contract.pool),
2298
2271
  // Collateral asset pool contract
2299
2272
  h(n, e.pure.address),
2300
2273
  // Borrower address
@@ -2303,7 +2276,7 @@ async function hr(e, t, r, o, n, a) {
2303
2276
  e.object(i.incentiveV3)
2304
2277
  // Incentive V3 contract
2305
2278
  ],
2306
- typeArguments: [s.suiCoinType, l.suiCoinType]
2279
+ typeArguments: [s.suiCoinType, u.suiCoinType]
2307
2280
  });
2308
2281
  return [m, w];
2309
2282
  } else {
@@ -2322,9 +2295,9 @@ async function hr(e, t, r, o, n, a) {
2322
2295
  // Pay asset pool contract
2323
2296
  h(r, e.object),
2324
2297
  // Debt repayment amount
2325
- e.pure.u8(l.id),
2298
+ e.pure.u8(u.id),
2326
2299
  // Collateral asset ID
2327
- e.object(l.contract.pool),
2300
+ e.object(u.contract.pool),
2328
2301
  // Collateral asset pool contract
2329
2302
  h(n, e.pure.address),
2330
2303
  // Borrower address
@@ -2335,17 +2308,17 @@ async function hr(e, t, r, o, n, a) {
2335
2308
  e.object("0x05")
2336
2309
  // SuiSystemState object
2337
2310
  ],
2338
- typeArguments: [s.suiCoinType, l.suiCoinType]
2311
+ typeArguments: [s.suiCoinType, u.suiCoinType]
2339
2312
  });
2340
2313
  return [m, w];
2341
2314
  }
2342
2315
  }
2343
- async function $t(e, t, r) {
2316
+ async function Et(e, t, r) {
2344
2317
  const o = r?.client ?? V, n = await G({
2345
2318
  ...r,
2346
2319
  markets: Object.values(F),
2347
2320
  cacheTime: v
2348
- }), a = await Be(r), c = [];
2321
+ }), a = await $e(r), c = [];
2349
2322
  return await Promise.all(
2350
2323
  t.map(async (i) => {
2351
2324
  try {
@@ -2353,45 +2326,45 @@ async function $t(e, t, r) {
2353
2326
  ...r,
2354
2327
  cacheTime: v,
2355
2328
  market: i.market
2356
- }), l = new N();
2357
- l.moveCall({
2329
+ }), u = new N();
2330
+ u.moveCall({
2358
2331
  target: `${s.uiGetter}::incentive_v3_getter::get_user_atomic_claimable_rewards`,
2359
2332
  arguments: [
2360
- l.object("0x06"),
2333
+ u.object("0x06"),
2361
2334
  // Clock object
2362
- l.object(s.storage),
2335
+ u.object(s.storage),
2363
2336
  // Protocol storage
2364
- l.object(s.incentiveV3),
2337
+ u.object(s.incentiveV3),
2365
2338
  // Incentive V3 contract
2366
- l.pure.address(i.address)
2339
+ u.pure.address(i.address)
2367
2340
  // User address
2368
2341
  ]
2369
2342
  });
2370
2343
  const w = (await q(o, {
2371
- transactionBlock: l,
2344
+ transactionBlock: u,
2372
2345
  sender: e
2373
2346
  }))?.results?.[0];
2374
2347
  if (!w)
2375
2348
  return;
2376
2349
  const y = Q({ results: [w] }, [
2377
- u.vector(u.string()),
2350
+ l.vector(l.string()),
2378
2351
  // Asset coin types
2379
- u.vector(u.string()),
2352
+ l.vector(l.string()),
2380
2353
  // Reward coin types
2381
- u.vector(u.u8()),
2354
+ l.vector(l.u8()),
2382
2355
  // Reward options
2383
- u.vector(u.Address),
2356
+ l.vector(l.Address),
2384
2357
  // Rule IDs
2385
- u.vector(u.u256())
2358
+ l.vector(l.u256())
2386
2359
  // Claimable amounts
2387
2360
  ]);
2388
2361
  if (y.length === 5 && Array.isArray(y[0])) {
2389
2362
  const g = y[0].length;
2390
2363
  for (let d = 0; d < g; d++) {
2391
2364
  const f = a.find(
2392
- (k) => C(k.coinType) === C(y[1][d])
2365
+ (I) => C(I.coinType) === C(y[1][d])
2393
2366
  ), b = n.find(
2394
- (k) => C(k.coinType) === C(y[0][d]) && k.market === i.market
2367
+ (I) => C(I.coinType) === C(y[0][d]) && I.market === i.market
2395
2368
  );
2396
2369
  !f || !b || c.push({
2397
2370
  assetId: b.id,
@@ -2416,15 +2389,8 @@ async function $t(e, t, r) {
2416
2389
  })
2417
2390
  ), c;
2418
2391
  }
2419
- 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) => ({
2392
+ async function vr(e, t) {
2393
+ const r = (t?.markets || [F.main]).map((a) => _(a)), o = await Be(e, t), n = r.map((a) => ({
2428
2394
  address: e,
2429
2395
  owner: e,
2430
2396
  market: a.key
@@ -2439,9 +2405,9 @@ async function wr(e, t) {
2439
2405
  };
2440
2406
  })
2441
2407
  );
2442
- return await $t(e, n, t);
2408
+ return await Et(e, n, t);
2443
2409
  }
2444
- function br(e) {
2410
+ function Cr(e) {
2445
2411
  const t = /* @__PURE__ */ new Map();
2446
2412
  e.forEach((o) => {
2447
2413
  const n = o.assetId, a = o.option, c = `${n}-${a}-${o.rewardCoinType}-${o.market}`;
@@ -2457,8 +2423,8 @@ function br(e) {
2457
2423
  for (const { assetId: o, rewardType: n, coinType: a, total: c, market: i } of t.values()) {
2458
2424
  const s = `${o}-${n}-${i}`;
2459
2425
  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);
2426
+ const u = r.get(s);
2427
+ u.rewards.set(a, (u.rewards.get(a) || 0) + c);
2462
2428
  }
2463
2429
  return Array.from(r.values()).map((o) => ({
2464
2430
  assetId: o.assetId,
@@ -2470,43 +2436,43 @@ function br(e) {
2470
2436
  }))
2471
2437
  }));
2472
2438
  }
2473
- const vr = A(
2439
+ const jr = A(
2474
2440
  async (e, t) => {
2475
2441
  const r = E(t), o = M(
2476
2442
  `/navi/user/total_claimed_reward?userAddress=${e}&sdk=${O.version}&market=${t?.market || R}`,
2477
2443
  t
2478
2444
  );
2479
2445
  return (await fetch(o, {
2480
- headers: D(U, r)
2446
+ headers: U(D, r)
2481
2447
  }).then((a) => a.json())).data;
2482
2448
  }
2483
- ), Cr = A(
2449
+ ), Ir = A(
2484
2450
  async (e, t) => {
2485
2451
  const r = E(t), o = M(
2486
2452
  `/navi/user/rewards?userAddress=${e}&page=${t?.page || 1}&pageSize=${t?.size || 400}&sdk=${O.version}&market=${t?.market || R}`,
2487
2453
  t
2488
2454
  ), n = await fetch(o, {
2489
- headers: D(U, r)
2455
+ headers: U(D, r)
2490
2456
  }).then((a) => a.json());
2491
- return x({
2457
+ return ee({
2492
2458
  data: n.data.rewards
2493
2459
  });
2494
2460
  }
2495
2461
  );
2496
- async function jr(e, t, r) {
2462
+ async function kr(e, t, r) {
2497
2463
  const o = await G({
2498
2464
  ...r,
2499
2465
  markets: Object.values(F),
2500
2466
  cacheTime: v
2501
2467
  }), n = /* @__PURE__ */ new Map();
2502
2468
  for (const c of t) {
2503
- const { rewardCoinType: i, ruleIds: s, market: l, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${l}`;
2469
+ const { rewardCoinType: i, ruleIds: s, market: u, owner: m, address: w, emodeId: y } = c, g = `${i}___${w}__${u}`;
2504
2470
  for (const d of s) {
2505
2471
  n.has(g) || n.set(g, {
2506
2472
  assetIds: [],
2507
2473
  ruleIds: [],
2508
2474
  amount: 0,
2509
- market: l,
2475
+ market: u,
2510
2476
  owner: m,
2511
2477
  address: w,
2512
2478
  isEMode: typeof y < "u"
@@ -2518,24 +2484,24 @@ async function jr(e, t, r) {
2518
2484
  const a = [];
2519
2485
  for (const [
2520
2486
  c,
2521
- { assetIds: i, ruleIds: s, amount: l, market: m, owner: w, address: y, isEMode: g }
2487
+ { assetIds: i, ruleIds: s, amount: u, market: m, owner: w, address: y, isEMode: g }
2522
2488
  ] of n) {
2523
2489
  const d = await j({
2524
2490
  ...r,
2525
2491
  cacheTime: v,
2526
2492
  market: m
2527
2493
  }), f = c.split("___")[0], b = o.filter(
2528
- (I) => C(I.suiCoinType) === C(f)
2494
+ (k) => C(k.suiCoinType) === C(f)
2529
2495
  );
2530
- b.sort((I, B) => I.market === m ? -1 : 1);
2531
- const k = b[0], T = d.rewardFunds[C(f)];
2496
+ b.sort((k, B) => k.market === m ? -1 : 1);
2497
+ const I = b[0], T = d.rewardFunds[C(f)];
2532
2498
  if (!T)
2533
2499
  throw new Error(`No matching rewardFund found for reward coin: ${f} ${m}`);
2534
2500
  if (r?.accountCap && !r.customCoinReceive)
2535
2501
  throw new Error("customCoinReceive is required when accountCap is provided");
2536
2502
  if (r?.customCoinReceive) {
2537
- let I;
2538
- r.accountCap ? I = e.moveCall({
2503
+ let k;
2504
+ r.accountCap ? k = e.moveCall({
2539
2505
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2540
2506
  arguments: [
2541
2507
  e.object("0x06"),
@@ -2554,7 +2520,7 @@ async function jr(e, t, r) {
2554
2520
  // Account capability
2555
2521
  ],
2556
2522
  typeArguments: [f]
2557
- }) : g ? I = e.moveCall({
2523
+ }) : g ? k = e.moveCall({
2558
2524
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2559
2525
  arguments: [
2560
2526
  e.object("0x06"),
@@ -2573,7 +2539,7 @@ async function jr(e, t, r) {
2573
2539
  // Account capability
2574
2540
  ],
2575
2541
  typeArguments: [f]
2576
- }) : I = e.moveCall({
2542
+ }) : k = e.moveCall({
2577
2543
  target: `${d.package}::incentive_v3::claim_reward`,
2578
2544
  arguments: [
2579
2545
  e.object("0x06"),
@@ -2593,7 +2559,7 @@ async function jr(e, t, r) {
2593
2559
  });
2594
2560
  const [B] = e.moveCall({
2595
2561
  target: "0x2::coin::from_balance",
2596
- arguments: [I],
2562
+ arguments: [k],
2597
2563
  typeArguments: [f]
2598
2564
  });
2599
2565
  if (r?.customCoinReceive.type === "transfer") {
@@ -2605,23 +2571,23 @@ async function jr(e, t, r) {
2605
2571
  );
2606
2572
  }
2607
2573
  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(
2574
+ const W = p(I.totalSupplyAmount).shiftedBy(-9), Y = p(I.supplyCapCeiling).shiftedBy(-27);
2575
+ W.plus(u).isGreaterThan(Y) && r?.customCoinReceive.depositNAVI?.fallbackReceiveAddress ? e.transferObjects(
2610
2576
  [B],
2611
2577
  e.pure.address(r.customCoinReceive.depositNAVI.fallbackReceiveAddress)
2612
- ) : await ht(e, k, B, {
2578
+ ) : await vt(e, I, B, {
2613
2579
  ...r,
2614
- market: k.market
2580
+ market: I.market
2615
2581
  });
2616
2582
  } else
2617
2583
  a.push({
2618
2584
  coin: B,
2619
- identifier: k,
2585
+ identifier: I,
2620
2586
  owner: w,
2621
2587
  isEMode: g
2622
2588
  });
2623
2589
  } else if (r?.accountCap || g) {
2624
- const I = e.moveCall({
2590
+ const k = e.moveCall({
2625
2591
  target: `${d.package}::incentive_v3::claim_reward_with_account_cap`,
2626
2592
  arguments: [
2627
2593
  e.object("0x06"),
@@ -2642,7 +2608,7 @@ async function jr(e, t, r) {
2642
2608
  typeArguments: [f]
2643
2609
  }), [B] = e.moveCall({
2644
2610
  target: "0x2::coin::from_balance",
2645
- arguments: [I],
2611
+ arguments: [k],
2646
2612
  typeArguments: [f]
2647
2613
  });
2648
2614
  e.transferObjects(
@@ -2672,86 +2638,87 @@ async function jr(e, t, r) {
2672
2638
  return a;
2673
2639
  }
2674
2640
  export {
2675
- ne as Address,
2641
+ oe as Address,
2676
2642
  v as DEFAULT_CACHE_TIME,
2677
2643
  R as DEFAULT_MARKET_IDENTITY,
2678
- zt as FlashLoanAssetConfig,
2679
- Rt as IncentiveAPYInfo,
2680
- Ne as IncentivePoolInfo,
2681
- Lt as IncentivePoolInfoByPhase,
2644
+ Wt as FlashLoanAssetConfig,
2645
+ qt as IncentiveAPYInfo,
2646
+ Le as IncentivePoolInfo,
2647
+ zt as IncentivePoolInfoByPhase,
2682
2648
  F as MARKETS,
2683
- wt as Market,
2684
- He as NaviMissingGraphQLClientError,
2685
- qt as OracleInfo,
2649
+ Ct as Market,
2650
+ Ke as NaviMissingGraphQLClientError,
2651
+ Gt as OracleInfo,
2652
+ et as PUBLIC_MAINNET_GRPC_URL,
2686
2653
  z as PoolOperator,
2687
- Re as ReserveDataInfo,
2688
- he as SuiPriceServiceConnection,
2689
- ct as SuiPythClient,
2654
+ qe as ReserveDataInfo,
2655
+ Ce as SuiPriceServiceConnection,
2656
+ lt as SuiPythClient,
2690
2657
  L as UserPositions,
2691
- Le as UserStateInfo,
2692
- Xt as borrowCoinPTB,
2658
+ ze as UserStateInfo,
2659
+ er as borrowCoinPTB,
2693
2660
  M as buildNaviOpenApiUrl,
2694
- jr as claimLendingRewardsPTB,
2695
- Kt as configureNaviSdk,
2696
- vt as createAccountCapPTB,
2697
- nr as createEModeCapPTB,
2698
- ge as createNaviLegacyJsonRpcClient,
2699
- xe as createNaviSuiClient,
2700
- Ze as createNaviSuiClientBundle,
2701
- ht as depositCoinPTB,
2702
- or as emodeIdentityId,
2703
- jt as enterEModePTB,
2704
- rr as exitEModePTB,
2705
- St as filterPriceFeeds,
2706
- yr as flashloanPTB,
2707
- Ct as getAccountCapOwnerPTB,
2708
- Wt as getAddressBalance,
2709
- re as getAllFlashLoanAssets,
2710
- er as getBorrowFee,
2711
- Gt as getCoinObjectOnlyBalance,
2712
- ur as getCoins,
2661
+ kr as claimLendingRewardsPTB,
2662
+ Yt as configureNaviSdk,
2663
+ It as createAccountCapPTB,
2664
+ ar as createEModeCapPTB,
2665
+ ve as createNaviLegacyJsonRpcClient,
2666
+ rt as createNaviSuiClient,
2667
+ xe as createNaviSuiClientBundle,
2668
+ vt as depositCoinPTB,
2669
+ ir as emodeIdentityId,
2670
+ _t as enterEModePTB,
2671
+ or as exitEModePTB,
2672
+ Ot as filterPriceFeeds,
2673
+ hr as flashloanPTB,
2674
+ kt as getAccountCapOwnerPTB,
2675
+ Jt as getAddressBalance,
2676
+ ne as getAllFlashLoanAssets,
2677
+ rr as getBorrowFee,
2678
+ Ht as getCoinObjectOnlyBalance,
2679
+ pr as getCoins,
2713
2680
  j as getConfig,
2714
- Yt as getFees,
2715
- fr as getFlashLoanAsset,
2716
- cr as getHealthFactor,
2717
- It as getHealthFactorPTB,
2718
- _t as getLendingPositions,
2719
- ir as getLendingState,
2720
- tr as getMarket,
2681
+ Xt as getFees,
2682
+ gr as getFlashLoanAsset,
2683
+ ur as getHealthFactor,
2684
+ Bt as getHealthFactorPTB,
2685
+ Pt as getLendingPositions,
2686
+ sr as getLendingState,
2687
+ nr as getMarket,
2721
2688
  _ as getMarketConfig,
2722
- bt as getMarkets,
2689
+ jt as getMarkets,
2723
2690
  S as getPool,
2724
2691
  G as getPools,
2725
- Be as getPriceFeeds,
2726
- pr as getPythStalePriceFeedId,
2727
- Bt as getPythStalePriceFeedIdV2,
2728
- sr as getSimulatedHealthFactor,
2729
- Ie as getSimulatedHealthFactorPTB,
2730
- Qt as getStats,
2731
- lr as getTransactions,
2732
- wr as getUserAvailableLendingRewards,
2733
- Cr as getUserClaimedRewardHistory,
2734
- ke as getUserEModeCaps,
2735
- vr as getUserTotalClaimedReward,
2736
- hr as liquidatePTB,
2737
- Ht as listAddressBalances,
2738
- ar as mergeCoinsPTB,
2739
- D as mergeServiceHeaders,
2740
- ye as normalizeAddressBalance,
2692
+ $e as getPriceFeeds,
2693
+ fr as getPythStalePriceFeedId,
2694
+ St as getPythStalePriceFeedIdV2,
2695
+ lr as getSimulatedHealthFactor,
2696
+ Pe as getSimulatedHealthFactorPTB,
2697
+ Zt as getStats,
2698
+ dr as getTransactions,
2699
+ vr as getUserAvailableLendingRewards,
2700
+ Ir as getUserClaimedRewardHistory,
2701
+ Be as getUserEModeCaps,
2702
+ jr as getUserTotalClaimedReward,
2703
+ br as liquidatePTB,
2704
+ Kt as listAddressBalances,
2705
+ cr as mergeCoinsPTB,
2706
+ U as mergeServiceHeaders,
2707
+ be as normalizeAddressBalance,
2741
2708
  C as normalizeCoinType,
2742
- gt as parsePoolUID,
2709
+ bt as parsePoolUID,
2743
2710
  h as parseTxValue,
2744
- xt as repayCoinPTB,
2745
- gr as repayFlashLoanPTB,
2746
- Jt as requireNaviGraphQLClient,
2711
+ tr as repayCoinPTB,
2712
+ wr as repayFlashLoanPTB,
2713
+ Qt as requireNaviGraphQLClient,
2747
2714
  E as resolveNaviOpenApiEndpoint,
2748
- br as summaryLendingRewards,
2749
- mr as updateOraclePriceBeforeUserOperationPTB,
2750
- At as updateOraclePricesPTB,
2751
- Pt as updatePythPriceFeeds,
2752
- dr as verifyHealthFactorPTB,
2715
+ Cr as summaryLendingRewards,
2716
+ yr as updateOraclePriceBeforeUserOperationPTB,
2717
+ fe as updateOraclePricesPTB,
2718
+ $t as updatePythPriceFeeds,
2719
+ mr as verifyHealthFactorPTB,
2753
2720
  $ as withCache,
2754
2721
  A as withSingleton,
2755
- Zt as withdrawCoinPTB
2722
+ xt as withdrawCoinPTB
2756
2723
  };
2757
2724
  //# sourceMappingURL=index.esm.js.map