@naviprotocol/wallet-client 1.0.1-dev.2 → 1.0.2-dev.0

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,16 +1,16 @@
1
- import { getFullnodeUrl as ee, SuiClient as te } from "@mysten/sui/client";
2
- import ae from "mitt";
3
- import ne from "axios";
4
- import { withSingleton as I, getCoins as se, mergeCoinsPTB as y, getFlashLoanAsset as G, flashloanPTB as H, depositCoinPTB as x, withdrawCoinPTB as D, repayFlashLoanPTB as J, repayCoinPTB as z, borrowCoinPTB as V, getPools as le, getPool as B, getHealthFactor as ie, liquidatePTB as re, getUserAvailableLendingRewards as Q, getUserClaimedRewardHistory as ce, claimLendingRewardsPTB as oe, getPriceFeeds as ue, filterPriceFeeds as de, updateOraclePricesPTB as he, getLendingState as we, createAccountCapPTB as fe, withCache as X, parseTxValue as F } from "@naviprotocol/lending";
5
- import P, { BigNumber as N } from "bignumber.js";
1
+ import { getFullnodeUrl as le, SuiClient as ie } from "@mysten/sui/client";
2
+ import re from "mitt";
3
+ import ce from "axios";
4
+ import { withSingleton as M, getCoins as oe, mergeCoinsPTB as y, getPriceFeeds as Q, updateOraclePricesPTB as q, filterPriceFeeds as K, getFlashLoanAsset as V, flashloanPTB as X, depositCoinPTB as x, withdrawCoinPTB as Y, repayFlashLoanPTB as Z, repayCoinPTB as ee, borrowCoinPTB as te, getPools as ue, getPool as P, getHealthFactor as de, liquidatePTB as we, getUserAvailableLendingRewards as H, getUserClaimedRewardHistory as he, claimLendingRewardsPTB as fe, getLendingState as ge, createAccountCapPTB as me, withCache as ae, parseTxValue as k } from "@naviprotocol/lending";
5
+ import p, { BigNumber as L } from "bignumber.js";
6
6
  import { normalizeStructTag as T } from "@mysten/sui/utils";
7
- import { Transaction as h } from "@mysten/sui/transactions";
8
- import { buildSwapPTBFromQuote as M, generateRefId as ge, getQuote as me } from "@naviprotocol/astros-aggregator-sdk";
9
- import { Signer as Y } from "@mysten/sui/cryptography";
10
- const Z = ne.create({
7
+ import { Transaction as w } from "@mysten/sui/transactions";
8
+ import { buildSwapPTBFromQuote as $, generateRefId as Ce, getQuote as be } from "@naviprotocol/astros-aggregator-sdk";
9
+ import { Signer as ne } from "@mysten/sui/cryptography";
10
+ const se = ce.create({
11
11
  timeout: 2e4
12
12
  });
13
- Z.interceptors.response.use(
13
+ se.interceptors.response.use(
14
14
  function(r) {
15
15
  if (r.data.err)
16
16
  throw new Error(r.data.err);
@@ -22,7 +22,7 @@ Z.interceptors.response.use(
22
22
  return Promise.reject(r);
23
23
  }
24
24
  );
25
- class Ce {
25
+ class ye {
26
26
  /**
27
27
  * Creates a new custom transport instance
28
28
  *
@@ -41,7 +41,7 @@ class Ce {
41
41
  * @returns Promise<T> - The response data from the RPC call
42
42
  */
43
43
  async request(e) {
44
- return this.requestId += 1, (await Z.post(this.rpcUrl, {
44
+ return this.requestId += 1, (await se.post(this.rpcUrl, {
45
45
  jsonrpc: "2.0",
46
46
  id: this.requestId,
47
47
  method: e.method,
@@ -61,7 +61,7 @@ class Ce {
61
61
  throw new Error("subscribe not implemented.");
62
62
  }
63
63
  }
64
- class E {
64
+ class R {
65
65
  /**
66
66
  * Gets the current configuration for this module
67
67
  *
@@ -104,14 +104,14 @@ class E {
104
104
  this.walletClient = void 0;
105
105
  }
106
106
  }
107
- class p {
107
+ class E {
108
108
  /**
109
109
  * Creates a new user portfolio
110
110
  *
111
111
  * @param coins - Array of coin objects or existing portfolio to copy from
112
112
  */
113
113
  constructor(e) {
114
- if (e instanceof p)
114
+ if (e instanceof E)
115
115
  this.balances = JSON.parse(JSON.stringify(e.balances));
116
116
  else {
117
117
  const a = {};
@@ -120,7 +120,7 @@ class p {
120
120
  let n = a[s];
121
121
  n || (n = {
122
122
  coinType: s,
123
- amount: N(0),
123
+ amount: L(0),
124
124
  coins: []
125
125
  }, a[s] = n), n.coins.push(t), n.amount = n.amount.plus(t.balance);
126
126
  }), this.balances = a;
@@ -133,7 +133,7 @@ class p {
133
133
  * @returns UserCoinBalance object with coin type, total amount, and coin objects
134
134
  */
135
135
  getBalance(e) {
136
- return e = T(e), this.balances[e] || { coinType: e, amount: N(0), coins: [] };
136
+ return e = T(e), this.balances[e] || { coinType: e, amount: L(0), coins: [] };
137
137
  }
138
138
  /**
139
139
  * Gets all coin types in the portfolio
@@ -152,7 +152,7 @@ class p {
152
152
  balanceOf(e) {
153
153
  e = T(e);
154
154
  const a = this.getBalance(e);
155
- return (a == null ? void 0 : a.amount) || N(0);
155
+ return (a == null ? void 0 : a.amount) || L(0);
156
156
  }
157
157
  /**
158
158
  * Creates a deep copy of the portfolio
@@ -163,21 +163,21 @@ class p {
163
163
  * @returns New UserPortfolio instance with copied data
164
164
  */
165
165
  clone() {
166
- const e = JSON.parse(JSON.stringify(this.balances)), a = new p();
166
+ const e = JSON.parse(JSON.stringify(this.balances)), a = new E();
167
167
  return a.balances = e, a;
168
168
  }
169
169
  }
170
- class be extends E {
170
+ class Be extends R {
171
171
  constructor() {
172
172
  super(...arguments), this.name = "balance", this.defaultConfig = {
173
173
  coinPollingInterval: 6e3
174
- }, this.updatePortfolio = I(async () => {
174
+ }, this.updatePortfolio = M(async () => {
175
175
  if (!this.walletClient)
176
176
  throw new Error("Wallet client not found");
177
- this._coins = await se(this.walletClient.address, {
177
+ this._coins = await oe(this.walletClient.address, {
178
178
  client: this.walletClient.client
179
- }), this._portfolio = new p(this._coins), this.emit("balance:portfolio-updated", {});
180
- }), this._coins = [], this._portfolio = new p(), this.pollingTimer = null, this._updatePromise = null;
179
+ }), this._portfolio = new E(this._coins), this.emit("balance:portfolio-updated", {});
180
+ }), this._coins = [], this._portfolio = new E(), this.pollingTimer = null, this._updatePromise = null;
181
181
  }
182
182
  /**
183
183
  * Gets the current coin objects from the wallet
@@ -234,19 +234,19 @@ class be extends E {
234
234
  if (a.length !== t.length)
235
235
  throw new Error("Recipients and amounts must have the same length");
236
236
  await this.waitForUpdate();
237
- const n = this.portfolio.getBalance(e), o = t.reduce((f, w) => f.plus(w), P(0));
238
- if (n.amount.lt(o))
237
+ const n = this.portfolio.getBalance(e), c = t.reduce((h, f) => h.plus(f), p(0));
238
+ if (n.amount.lt(c))
239
239
  throw new Error("Insufficient balance");
240
- const i = new h();
241
- let l = i.gas;
242
- T(e) !== T("0x2::sui::SUI") && (l = y(i, n.coins, {
243
- balance: o.toNumber()
240
+ const l = new w();
241
+ let i = l.gas;
242
+ T(e) !== T("0x2::sui::SUI") && (i = y(l, n.coins, {
243
+ balance: c.toNumber()
244
244
  }));
245
- const c = i.splitCoins(l, t);
246
- return a.forEach((f, w) => {
247
- i.transferObjects([c[w]], f);
245
+ const o = l.splitCoins(i, t);
246
+ return a.forEach((h, f) => {
247
+ l.transferObjects([o[f]], h);
248
248
  }), await this.walletClient.signExecuteTransaction({
249
- transaction: i,
249
+ transaction: l,
250
250
  dryRun: (d = s == null ? void 0 : s.dryRun) != null ? d : !1
251
251
  });
252
252
  }
@@ -273,18 +273,18 @@ class be extends E {
273
273
  * @returns Transaction response or dry run response
274
274
  */
275
275
  async transferObjectBatch(e, a, t) {
276
- var o;
276
+ var c;
277
277
  if (!this.walletClient)
278
278
  throw new Error("Wallet client not found");
279
279
  if (e.length !== a.length)
280
280
  throw new Error("Objects and recipients must have the same length");
281
281
  await this.waitForUpdate();
282
- const s = new h();
283
- return e.forEach((i, l) => {
284
- s.transferObjects([s.object(i)], a[l]);
282
+ const s = new w();
283
+ return e.forEach((l, i) => {
284
+ s.transferObjects([s.object(l)], a[i]);
285
285
  }), await this.walletClient.signExecuteTransaction({
286
286
  transaction: s,
287
- dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
287
+ dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
288
288
  });
289
289
  }
290
290
  /**
@@ -323,127 +323,150 @@ class be extends E {
323
323
  super.uninstall(), this.pollingTimer && (clearTimeout(this.pollingTimer), this.pollingTimer = null);
324
324
  }
325
325
  }
326
- const ye = 27;
327
- function Be(r, e = 2) {
328
- return r ? new P(r.toString()).shiftedBy(-1 * ye).multipliedBy(100).decimalPlaces(e, P.ROUND_DOWN).toFixed(e) : "0.00";
326
+ const Pe = 27;
327
+ function Te(r, e = 2) {
328
+ return r ? new p(r.toString()).shiftedBy(-1 * Pe).multipliedBy(100).decimalPlaces(e, p.ROUND_DOWN).toFixed(e) : "0.00";
329
329
  }
330
- async function q(r, e, a, t) {
331
- var R, S;
330
+ async function D(r, e, a, t) {
331
+ var S, O;
332
332
  if (!this.walletClient)
333
333
  throw new Error("Wallet client not found");
334
334
  await this.walletClient.balance.waitForUpdate();
335
- const s = await this.getPool(e), n = await this.getPool(a), i = (await this.getLendingState()).find((O) => O.pool.id === s.id), l = this.walletClient.address;
336
- if (!i || i.supplyBalance === "0")
335
+ const s = await this.getPool(e), n = await this.getPool(a), c = await this.getLendingState(), l = c.find((F) => F.pool.id === s.id), i = this.walletClient.address;
336
+ if (console.log("fromPoolLending", {
337
+ fromPoolLending: l,
338
+ lendingState: c,
339
+ address: i,
340
+ options: t,
341
+ from: e,
342
+ to: a
343
+ }), !l || l.supplyBalance === "0")
337
344
  throw new Error("No supply balance");
338
- if (t != null && t.amount && t.amount < Number(i.supplyBalance))
345
+ if (t != null && t.amount && t.amount > Number(l.supplyBalance))
339
346
  throw new Error("Amount is less than supply balance");
340
- const c = await G(n, {
347
+ const o = await Q(), u = await Promise.all([s, n]);
348
+ await q(
349
+ r,
350
+ K(o, {
351
+ lendingState: c,
352
+ pools: u
353
+ })
354
+ );
355
+ const d = await V(n, {
341
356
  env: this.config.env
342
357
  });
343
- if (!(c != null && c.flashloanFee))
358
+ if (!(d != null && d.flashloanFee))
344
359
  throw new Error(`${s.token.symbol} pool not support flashloan`);
345
- const u = (R = t == null ? void 0 : t.slippage) != null ? R : 5e-3, d = (S = t == null ? void 0 : t.amount) != null ? S : Number(i.supplyBalance), f = await this.walletClient.swap.getQuote(
360
+ const h = (S = t == null ? void 0 : t.slippage) != null ? S : 5e-3, f = (O = t == null ? void 0 : t.amount) != null ? O : Number(l.supplyBalance), b = await this.walletClient.swap.getQuote(
346
361
  s.suiCoinType,
347
362
  n.suiCoinType,
348
- d
349
- ), w = Number(f.amount_out);
350
- if (w <= 0)
363
+ f
364
+ ), m = Number(b.amount_out);
365
+ if (m <= 0)
351
366
  throw new Error("The amount of swapAmountOut must be greater than 0.");
352
- const b = Math.floor(w * (1 - u)), g = Math.floor(b / (1 + c.flashloanFee));
367
+ const C = Math.floor(m * (1 - h)), g = Math.floor(C / (1 + d.flashloanFee));
353
368
  if (g <= 0)
354
369
  throw new Error("The calculated borrow amount must be positive.");
355
- const [m, C] = await H(r, n, g), [v] = r.moveCall({
370
+ const [B, v] = await X(r, n, g), [A] = r.moveCall({
356
371
  target: "0x2::coin::from_balance",
357
- arguments: [m],
372
+ arguments: [B],
358
373
  typeArguments: [n.suiCoinType]
359
374
  });
360
- await x(r, n, v, {
375
+ await x(r, n, A, {
361
376
  amount: g
362
377
  });
363
- const k = await D(r, s, d), A = await M(
364
- l,
378
+ const j = await Y(r, s, f), U = await $(
379
+ i,
365
380
  r,
366
- b,
367
- k,
368
- f
369
- ), j = r.moveCall({
381
+ C,
382
+ j,
383
+ b
384
+ ), _ = r.moveCall({
370
385
  target: "0x2::coin::into_balance",
371
- arguments: [A],
386
+ arguments: [U],
372
387
  typeArguments: [n.suiCoinType]
373
- }), [U] = await J(r, n, C, j), [_] = r.moveCall({
388
+ }), [W] = await Z(r, n, v, _), [N] = r.moveCall({
374
389
  target: "0x2::coin::from_balance",
375
- arguments: [U],
390
+ arguments: [W],
376
391
  typeArguments: [n.suiCoinType]
377
392
  });
378
- return await x(r, n, _), r;
393
+ return await x(r, n, N), r;
379
394
  }
380
- async function K(r, e, a, t) {
381
- var O, L;
395
+ async function J(r, e, a, t) {
396
+ var F, G;
382
397
  if (!this.walletClient)
383
398
  throw new Error("Wallet client not found");
384
399
  await this.walletClient.balance.waitForUpdate();
385
- const s = this.walletClient.address, n = await this.getPool(e), o = await this.getPool(a), l = (await this.getLendingState()).find((W) => W.pool.id === n.id);
386
- if (!l || l.borrowBalance === "0")
400
+ const s = this.walletClient.address, n = await this.getPool(e), c = await this.getPool(a), l = await this.getLendingState(), i = l.find((I) => I.pool.id === n.id);
401
+ if (!i || i.borrowBalance === "0")
387
402
  throw new Error("No borrow balance");
388
- if (t != null && t.amount && t.amount < Number(l.borrowBalance))
403
+ if (t != null && t.amount && t.amount > Number(i.borrowBalance))
389
404
  throw new Error("Amount is less than borrow balance");
390
- let c = (O = t == null ? void 0 : t.amount) != null ? O : Number(l.borrowBalance);
391
- if (Number(l.borrowBalance) === c) {
392
- const W = parseFloat(Be(n.currentBorrowRate, 8)) / 100;
393
- c = Math.ceil(
394
- new P(c).multipliedBy(W * (60 * 3) / (365 * 24 * 3600)).plus(new P(1).shiftedBy(-n.token.decimals)).plus(c).toNumber()
405
+ const o = await Q(), u = await Promise.all([n, c]);
406
+ await q(
407
+ r,
408
+ K(o, {
409
+ lendingState: l,
410
+ pools: u
411
+ })
412
+ );
413
+ let d = (F = t == null ? void 0 : t.amount) != null ? F : Number(i.borrowBalance);
414
+ if (Number(i.borrowBalance) === d) {
415
+ const I = parseFloat(Te(n.currentBorrowRate, 8)) / 100;
416
+ d = Math.ceil(
417
+ new p(d).multipliedBy(I * (60 * 3) / (365 * 24 * 3600)).plus(new p(1).shiftedBy(-n.token.decimals)).plus(d).toNumber()
395
418
  );
396
419
  }
397
- const u = await G(n, {
420
+ const h = await V(n, {
398
421
  env: this.config.env
399
422
  });
400
- if (!u)
423
+ if (!h)
401
424
  throw new Error(`${n.token.symbol} pool not support flashloan`);
402
425
  if (!this.walletClient)
403
426
  throw new Error("Wallet client not found");
404
- const d = (L = t == null ? void 0 : t.slippage) != null ? L : 5e-3, f = Math.ceil(c * (1 + u.flashloanFee)), w = f, b = await this.walletClient.swap.getQuote(
427
+ const f = (G = t == null ? void 0 : t.slippage) != null ? G : 5e-3, b = Math.ceil(d * (1 + h.flashloanFee)), m = b, C = await this.walletClient.swap.getQuote(
405
428
  n.suiCoinType,
406
- o.suiCoinType,
407
- w
429
+ c.suiCoinType,
430
+ m
408
431
  );
409
- let g = 1 + d, m = Math.ceil(Number(b.amount_out) * g), C = await this.walletClient.swap.getQuote(
410
- o.suiCoinType,
432
+ let g = 1 + f, B = Math.ceil(Number(C.amount_out) * g), v = await this.walletClient.swap.getQuote(
433
+ c.suiCoinType,
411
434
  n.suiCoinType,
412
- m
435
+ B
413
436
  );
414
- for (; Number(C.amount_out) < w; )
415
- g = g * Math.max(w / Number(C.amount_out), 1.001), m = Math.ceil(Number(b.amount_out) * g), C = await this.walletClient.swap.getQuote(
416
- o.suiCoinType,
437
+ for (; Number(v.amount_out) < m; )
438
+ g = g * Math.max(m / Number(v.amount_out), 1.001), B = Math.ceil(Number(C.amount_out) * g), v = await this.walletClient.swap.getQuote(
439
+ c.suiCoinType,
417
440
  n.suiCoinType,
418
- m
441
+ B
419
442
  );
420
- const [v, k] = await H(r, n, c), [A] = r.moveCall({
443
+ const [A, j] = await X(r, n, d), [U] = r.moveCall({
421
444
  target: "0x2::coin::from_balance",
422
- arguments: [v],
445
+ arguments: [A],
423
446
  typeArguments: [n.suiCoinType]
424
447
  });
425
- await z(r, n, A, {
426
- amount: c
448
+ await ee(r, n, U, {
449
+ amount: d
427
450
  });
428
- const j = await V(r, o, m), U = await M(
451
+ const _ = await te(r, c, B), W = await $(
429
452
  s,
430
453
  r,
431
- f,
432
- j,
433
- C
434
- ), _ = r.moveCall({
454
+ b,
455
+ _,
456
+ v
457
+ ), N = r.moveCall({
435
458
  target: "0x2::coin::into_balance",
436
- arguments: [U],
459
+ arguments: [W],
437
460
  typeArguments: [n.suiCoinType]
438
- }), [R] = await J(r, n, k, _), [S] = r.moveCall({
461
+ }), [S] = await Z(r, n, j, N), [O] = r.moveCall({
439
462
  target: "0x2::coin::from_balance",
440
- arguments: [R],
463
+ arguments: [S],
441
464
  typeArguments: [n.suiCoinType]
442
465
  });
443
- return r.transferObjects([S], s), r;
466
+ return r.transferObjects([O], s), r;
444
467
  }
445
- async function $(r, e, a, t) {
446
- var c, u;
468
+ async function z(r, e, a, t) {
469
+ var o, u;
447
470
  if (!this.walletClient)
448
471
  throw new Error("Wallet client not found");
449
472
  await this.walletClient.balance.waitForUpdate(), this.walletClient.address;
@@ -452,27 +475,27 @@ async function $(r, e, a, t) {
452
475
  throw new Error(`No balance of ${e}`);
453
476
  if (t != null && t.amount && n.amount.lt(t.amount))
454
477
  throw new Error("Amount is less than balance");
455
- const o = (c = t == null ? void 0 : t.amount) != null ? c : n.amount.toNumber(), i = (u = t == null ? void 0 : t.slippage) != null ? u : 5e-3;
456
- let l = await y(r, n.coins, {
457
- balance: o,
478
+ const c = (o = t == null ? void 0 : t.amount) != null ? o : n.amount.toNumber(), l = (u = t == null ? void 0 : t.slippage) != null ? u : 5e-3;
479
+ let i = await y(r, n.coins, {
480
+ balance: c,
458
481
  useGasCoin: !0
459
482
  });
460
483
  if (T(e) !== T(s.suiCoinType)) {
461
- const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, o);
462
- l = await this.walletClient.swap.buildSwapPTBFromQuote(
484
+ const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, c);
485
+ i = await this.walletClient.swap.buildSwapPTBFromQuote(
463
486
  r,
464
487
  d,
465
- l,
466
- i
488
+ i,
489
+ l
467
490
  );
468
491
  }
469
- return await x(r, s, l), r;
492
+ return await x(r, s, i), r;
470
493
  }
471
- class Te extends E {
494
+ class ve extends R {
472
495
  constructor() {
473
496
  super(), this.name = "lending", this.defaultConfig = {
474
497
  env: "prod"
475
- }, this.migrateSupplyPTB = q, this.migrateBorrowPTB = K, this.migrateBalanceToSupplyPTB = $, this.migrateSupplyPTB = q.bind(this), this.migrateBorrowPTB = K.bind(this), this.migrateBalanceToSupplyPTB = $.bind(this);
498
+ }, this.migrateBetweenSupplyPTB = D, this.migrateBetweenBorrowPTB = J, this.migrateBalanceToSupplyPTB = z, this.migrateBetweenSupplyPTB = D.bind(this), this.migrateBetweenSupplyPTB = J.bind(this), this.migrateBalanceToSupplyPTB = z.bind(this);
476
499
  }
477
500
  /**
478
501
  * Gets all available lending pools
@@ -481,7 +504,7 @@ class Te extends E {
481
504
  * @returns Array of pool information
482
505
  */
483
506
  async getPools(e) {
484
- return await le({
507
+ return await ue({
485
508
  env: this.config.env,
486
509
  ...e
487
510
  });
@@ -494,7 +517,7 @@ class Te extends E {
494
517
  * @returns Pool information
495
518
  */
496
519
  async getPool(e, a) {
497
- return await B(e, {
520
+ return await P(e, {
498
521
  env: this.config.env,
499
522
  ...a
500
523
  });
@@ -508,30 +531,30 @@ class Te extends E {
508
531
  * @returns Transaction response or dry run response
509
532
  */
510
533
  async deposit(e, a, t) {
511
- var c, u, d;
534
+ var o, u, d;
512
535
  if (!this.walletClient)
513
536
  throw new Error("Wallet client not found");
514
- const s = await B(e, {
537
+ const s = await P(e, {
515
538
  env: this.config.env
516
539
  });
517
540
  await this.walletClient.module("balance").waitForUpdate();
518
- const n = new h(), o = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), i = y(n, o.coins, {
541
+ const n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
519
542
  balance: a,
520
543
  useGasCoin: !0
521
544
  });
522
- await x(n, s, i, {
545
+ await x(n, s, l, {
523
546
  env: this.config.env,
524
547
  amount: a,
525
548
  accountCap: t == null ? void 0 : t.accountCap
526
549
  });
527
- const l = await this.walletClient.signExecuteTransaction({
550
+ const i = await this.walletClient.signExecuteTransaction({
528
551
  transaction: n,
529
- dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
552
+ dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
530
553
  });
531
- return !(t != null && t.dryRun) && ((d = (u = l.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:deposit-success", {
554
+ return !(t != null && t.dryRun) && ((d = (u = i.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:deposit-success", {
532
555
  identifier: e,
533
556
  amount: a
534
- }), this.walletClient.module("balance").updatePortfolio()), l;
557
+ }), this.walletClient.module("balance").updatePortfolio()), i;
535
558
  }
536
559
  /**
537
560
  * Withdraws coins from a lending pool
@@ -542,26 +565,26 @@ class Te extends E {
542
565
  * @returns Transaction response or dry run response
543
566
  */
544
567
  async withdraw(e, a, t) {
545
- var l, c, u;
568
+ var i, o, u;
546
569
  if (!this.walletClient)
547
570
  throw new Error("Wallet client not found");
548
- const s = await B(e, {
571
+ const s = await P(e, {
549
572
  env: this.config.env
550
- }), n = new h();
573
+ }), n = new w();
551
574
  t != null && t.disableUpdateOracle || await this.updateOraclePTB(n, [s]);
552
- const o = await D(n, s, a, {
575
+ const c = await Y(n, s, a, {
553
576
  env: this.config.env,
554
577
  accountCap: t == null ? void 0 : t.accountCap
555
578
  });
556
- n.transferObjects([o], this.walletClient.address);
557
- const i = await this.walletClient.signExecuteTransaction({
579
+ n.transferObjects([c], this.walletClient.address);
580
+ const l = await this.walletClient.signExecuteTransaction({
558
581
  transaction: n,
559
- dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
582
+ dryRun: (i = t == null ? void 0 : t.dryRun) != null ? i : !1
560
583
  });
561
- return !(t != null && t.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:withdraw-success", {
584
+ return !(t != null && t.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:withdraw-success", {
562
585
  identifier: e,
563
586
  amount: a
564
- }), this.walletClient.module("balance").updatePortfolio()), i;
587
+ }), this.walletClient.module("balance").updatePortfolio()), l;
565
588
  }
566
589
  /**
567
590
  * Borrows coins from a lending pool
@@ -572,26 +595,26 @@ class Te extends E {
572
595
  * @returns Transaction response or dry run response
573
596
  */
574
597
  async borrow(e, a, t) {
575
- var l, c, u;
598
+ var i, o, u;
576
599
  if (!this.walletClient)
577
600
  throw new Error("Wallet client not found");
578
- const s = await B(e, {
601
+ const s = await P(e, {
579
602
  env: this.config.env
580
- }), n = new h();
603
+ }), n = new w();
581
604
  t != null && t.disableUpdateOracle || await this.updateOraclePTB(n, [s]);
582
- const o = await V(n, s, a, {
605
+ const c = await te(n, s, a, {
583
606
  env: this.config.env,
584
607
  accountCap: t == null ? void 0 : t.accountCap
585
608
  });
586
- n.transferObjects([o], this.walletClient.address);
587
- const i = await this.walletClient.signExecuteTransaction({
609
+ n.transferObjects([c], this.walletClient.address);
610
+ const l = await this.walletClient.signExecuteTransaction({
588
611
  transaction: n,
589
- dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
612
+ dryRun: (i = t == null ? void 0 : t.dryRun) != null ? i : !1
590
613
  });
591
- return !(t != null && t.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:borrow-success", {
614
+ return !(t != null && t.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:borrow-success", {
592
615
  identifier: e,
593
616
  amount: a
594
- }), this.walletClient.module("balance").updatePortfolio()), i;
617
+ }), this.walletClient.module("balance").updatePortfolio()), l;
595
618
  }
596
619
  /**
597
620
  * Repays borrowed coins to a lending pool
@@ -602,29 +625,29 @@ class Te extends E {
602
625
  * @returns Transaction response or dry run response
603
626
  */
604
627
  async repay(e, a, t) {
605
- var c, u, d;
628
+ var o, u, d;
606
629
  if (!this.walletClient)
607
630
  throw new Error("Wallet client not found");
608
631
  await this.walletClient.module("balance").waitForUpdate();
609
- const s = await B(e, {
632
+ const s = await P(e, {
610
633
  env: this.config.env
611
- }), n = new h(), o = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), i = y(n, o.coins, {
634
+ }), n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
612
635
  balance: a,
613
636
  useGasCoin: !0
614
637
  });
615
- await z(n, s, i, {
638
+ await ee(n, s, l, {
616
639
  env: this.config.env,
617
640
  amount: a,
618
641
  accountCap: t == null ? void 0 : t.accountCap
619
642
  });
620
- const l = await this.walletClient.signExecuteTransaction({
643
+ const i = await this.walletClient.signExecuteTransaction({
621
644
  transaction: n,
622
- dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
645
+ dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
623
646
  });
624
- return !(t != null && t.dryRun) && ((d = (u = l.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:repay-success", {
647
+ return !(t != null && t.dryRun) && ((d = (u = i.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:repay-success", {
625
648
  identifier: e,
626
649
  amount: a
627
- }), this.walletClient.module("balance").updatePortfolio()), l;
650
+ }), this.walletClient.module("balance").updatePortfolio()), i;
628
651
  }
629
652
  /**
630
653
  * Gets the current health factor for the user
@@ -635,7 +658,7 @@ class Te extends E {
635
658
  if (!this.walletClient)
636
659
  throw new Error("Wallet client not found");
637
660
  const e = this.walletClient.address;
638
- return await ie(e, {
661
+ return await de(e, {
639
662
  env: this.config.env,
640
663
  client: this.walletClient.client
641
664
  });
@@ -651,45 +674,45 @@ class Te extends E {
651
674
  * @returns Transaction response or dry run response
652
675
  */
653
676
  async liquidate(e, a, t, s, n) {
654
- var m, C, v;
677
+ var C, g, B;
655
678
  if (!this.walletClient)
656
679
  throw new Error("Wallet client not found");
657
- const o = await B(e, {
680
+ const c = await P(e, {
658
681
  env: this.config.env
659
- }), i = await B(t, {
682
+ }), l = await P(t, {
660
683
  env: this.config.env
661
- }), l = new h(), c = this.walletClient.module("balance").portfolio.getBalance(o.suiCoinType), u = y(l, c.coins, {
684
+ }), i = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(i, o.coins, {
662
685
  balance: a,
663
686
  useGasCoin: !0
664
- }), [d, f] = await re(
665
- l,
666
- o,
667
- u,
687
+ }), [d, h] = await we(
668
688
  i,
689
+ c,
690
+ u,
691
+ l,
669
692
  s,
670
693
  {
671
694
  env: this.config.env
672
695
  }
673
- ), [w] = l.moveCall({
696
+ ), [f] = i.moveCall({
674
697
  target: "0x2::coin::from_balance",
675
698
  arguments: [d],
676
- typeArguments: [i.suiCoinType]
677
- }), [b] = l.moveCall({
699
+ typeArguments: [l.suiCoinType]
700
+ }), [b] = i.moveCall({
678
701
  target: "0x2::coin::from_balance",
679
- arguments: [f],
680
- typeArguments: [o.suiCoinType]
702
+ arguments: [h],
703
+ typeArguments: [c.suiCoinType]
681
704
  });
682
- l.transferObjects([w, b], this.walletClient.address);
683
- const g = await this.walletClient.signExecuteTransaction({
684
- transaction: l,
685
- dryRun: (m = n == null ? void 0 : n.dryRun) != null ? m : !1
705
+ i.transferObjects([f, b], this.walletClient.address);
706
+ const m = await this.walletClient.signExecuteTransaction({
707
+ transaction: i,
708
+ dryRun: (C = n == null ? void 0 : n.dryRun) != null ? C : !1
686
709
  });
687
- return !(n != null && n.dryRun) && ((v = (C = g.effects) == null ? void 0 : C.status) == null ? void 0 : v.status) === "success" && (this.emit("lending:liquidate-success", {
710
+ return !(n != null && n.dryRun) && ((B = (g = m.effects) == null ? void 0 : g.status) == null ? void 0 : B.status) === "success" && (this.emit("lending:liquidate-success", {
688
711
  payIdentifier: e,
689
712
  payAmount: a,
690
713
  collateralIdentifier: t,
691
714
  liquidationAddress: s
692
- }), this.walletClient.module("balance").updatePortfolio()), g;
715
+ }), this.walletClient.module("balance").updatePortfolio()), m;
693
716
  }
694
717
  /**
695
718
  * Gets the available lending rewards for the current user.
@@ -701,7 +724,7 @@ class Te extends E {
701
724
  async getAvailableRewards(e) {
702
725
  if (!this.walletClient)
703
726
  throw new Error("Wallet client not found");
704
- return Q(this.walletClient.address, {
727
+ return H(this.walletClient.address, {
705
728
  ...e,
706
729
  env: this.config.env
707
730
  });
@@ -716,7 +739,7 @@ class Te extends E {
716
739
  async getClaimedRewardHistory(e) {
717
740
  if (!this.walletClient)
718
741
  throw new Error("Wallet client not found");
719
- return ce(this.walletClient.address, {
742
+ return he(this.walletClient.address, {
720
743
  ...e
721
744
  });
722
745
  }
@@ -727,13 +750,13 @@ class Te extends E {
727
750
  * @returns Transaction response or dry run response
728
751
  */
729
752
  async claimAllRewards(e) {
730
- var n, o, i;
753
+ var n, c, l;
731
754
  if (!this.walletClient)
732
755
  throw new Error("Wallet client not found");
733
- const a = new h(), t = await Q(this.walletClient.address, {
756
+ const a = new w(), t = await H(this.walletClient.address, {
734
757
  env: this.config.env
735
758
  });
736
- await oe(a, t, {
759
+ await fe(a, t, {
737
760
  env: this.config.env,
738
761
  accountCap: e == null ? void 0 : e.accountCap
739
762
  });
@@ -741,20 +764,20 @@ class Te extends E {
741
764
  transaction: a,
742
765
  dryRun: (n = e == null ? void 0 : e.dryRun) != null ? n : !1
743
766
  });
744
- return !(e != null && e.dryRun) && ((i = (o = s.effects) == null ? void 0 : o.status) == null ? void 0 : i.status) === "success" && (this.emit("lending:claim-rewards-success", {
767
+ return !(e != null && e.dryRun) && ((l = (c = s.effects) == null ? void 0 : c.status) == null ? void 0 : l.status) === "success" && (this.emit("lending:claim-rewards-success", {
745
768
  rewards: t
746
769
  }), this.walletClient.module("balance").updatePortfolio()), s;
747
770
  }
748
771
  async updateOraclePTB(e, a) {
749
- const t = await ue({
772
+ const t = await Q({
750
773
  env: this.config.env
751
774
  }), s = await this.getLendingState({
752
775
  cacheTime: 60 * 1e3
753
- }), n = de(t, {
776
+ }), n = K(t, {
754
777
  lendingState: s,
755
778
  pools: a
756
779
  });
757
- await he(e, n, {
780
+ await q(e, n, {
758
781
  env: this.config.env,
759
782
  updatePythPriceFeeds: !0
760
783
  });
@@ -770,7 +793,7 @@ class Te extends E {
770
793
  var s;
771
794
  if (!this.walletClient)
772
795
  throw new Error("Wallet client not found");
773
- const a = new h();
796
+ const a = new w();
774
797
  return await this.updateOraclePTB(a, e == null ? void 0 : e.pools), await this.walletClient.signExecuteTransaction({
775
798
  transaction: a,
776
799
  dryRun: (s = e == null ? void 0 : e.dryRun) != null ? s : !1
@@ -785,7 +808,7 @@ class Te extends E {
785
808
  async getLendingState(e) {
786
809
  if (!this.walletClient)
787
810
  throw new Error("Wallet client not found");
788
- return await we(this.walletClient.address, {
811
+ return await ge(this.walletClient.address, {
789
812
  env: this.config.env,
790
813
  ...e,
791
814
  client: this.walletClient.client
@@ -801,22 +824,22 @@ class Te extends E {
801
824
  var n;
802
825
  if (!this.walletClient)
803
826
  throw new Error("Wallet client not found");
804
- const a = new h(), t = await fe(a);
827
+ const a = new w(), t = await me(a);
805
828
  return a.transferObjects([t], this.walletClient.address), await this.walletClient.signExecuteTransaction({
806
829
  transaction: a,
807
830
  dryRun: (n = e == null ? void 0 : e.dryRun) != null ? n : !1
808
831
  });
809
832
  }
810
833
  }
811
- class ve extends E {
834
+ class pe extends R {
812
835
  constructor() {
813
836
  super(...arguments), this.name = "volo", this.defaultConfig = {
814
837
  packageId: "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20",
815
838
  poolId: "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5",
816
839
  metadataId: "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60",
817
840
  coinType: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
818
- }, this.getStats = X(
819
- I(async () => (await fetch("https://open-api.naviprotocol.io/api/volo/stats").then((a) => a.json())).data)
841
+ }, this.getStats = ae(
842
+ M(async () => (await fetch("https://open-api.naviprotocol.io/api/volo/stats").then((a) => a.json())).data)
820
843
  );
821
844
  }
822
845
  /**
@@ -833,7 +856,7 @@ class ve extends E {
833
856
  e.object(this.config.poolId),
834
857
  e.object(this.config.metadataId),
835
858
  e.object("0x05"),
836
- F(a, e.object)
859
+ k(a, e.object)
837
860
  ],
838
861
  typeArguments: []
839
862
  });
@@ -853,7 +876,7 @@ class ve extends E {
853
876
  e.object(this.config.poolId),
854
877
  e.object(this.config.metadataId),
855
878
  e.object("0x05"),
856
- F(a, e.object)
879
+ k(a, e.object)
857
880
  ],
858
881
  typeArguments: []
859
882
  });
@@ -868,25 +891,25 @@ class ve extends E {
868
891
  * @throws Error if wallet client not found or stake amount is too low
869
892
  */
870
893
  async stake(e, a) {
871
- var l, c, u;
894
+ var i, o, u;
872
895
  if (!this.walletClient)
873
896
  throw new Error("Wallet client not found");
874
897
  if (e < 1e9)
875
898
  throw new Error("Stake amount should be greater than 1Sui");
876
- const t = new h();
899
+ const t = new w();
877
900
  await this.walletClient.module("balance").waitForUpdate();
878
901
  const s = this.walletClient.module("balance").portfolio.getBalance("0x2::sui::SUI"), n = y(t, s.coins, {
879
902
  balance: e,
880
903
  useGasCoin: !0
881
- }), o = await this.stakePTB(t, n);
882
- t.transferObjects([o], this.walletClient.address);
883
- const i = await this.walletClient.signExecuteTransaction({
904
+ }), c = await this.stakePTB(t, n);
905
+ t.transferObjects([c], this.walletClient.address);
906
+ const l = await this.walletClient.signExecuteTransaction({
884
907
  transaction: t,
885
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
908
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
886
909
  });
887
- return !(a != null && a.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:stake-success", {
910
+ return !(a != null && a.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:stake-success", {
888
911
  suiAmount: e
889
- }), this.walletClient.module("balance").updatePortfolio()), i;
912
+ }), this.walletClient.module("balance").updatePortfolio()), l;
890
913
  }
891
914
  /**
892
915
  * Unstake vSUI tokens to receive SUI tokens
@@ -897,26 +920,26 @@ class ve extends E {
897
920
  * @throws Error if wallet client not found or unstake amount is too low
898
921
  */
899
922
  async unstake(e, a) {
900
- var l, c, u;
923
+ var i, o, u;
901
924
  if (!this.walletClient)
902
925
  throw new Error("Wallet client not found");
903
926
  if (e < 1e9)
904
927
  throw new Error("Unstake amount should >= 1vSui");
905
928
  await this.walletClient.module("balance").waitForUpdate();
906
- const t = new h(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
929
+ const t = new w(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
907
930
  balance: e
908
- }), o = await this.unstakePTB(t, n);
909
- t.transferObjects([o], this.walletClient.address);
910
- const i = await this.walletClient.signExecuteTransaction({
931
+ }), c = await this.unstakePTB(t, n);
932
+ t.transferObjects([c], this.walletClient.address);
933
+ const l = await this.walletClient.signExecuteTransaction({
911
934
  transaction: t,
912
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
935
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
913
936
  });
914
- return !(a != null && a.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:unstake-success", {
937
+ return !(a != null && a.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:unstake-success", {
915
938
  vSuiAmount: e
916
- }), this.walletClient.module("balance").updatePortfolio()), i;
939
+ }), this.walletClient.module("balance").updatePortfolio()), l;
917
940
  }
918
941
  }
919
- class Pe extends E {
942
+ class Ee extends R {
920
943
  constructor() {
921
944
  super(...arguments), this.name = "swap", this.defaultConfig = {
922
945
  apiKey: "",
@@ -933,7 +956,7 @@ class Pe extends E {
933
956
  * @returns Referral ID if API key is configured, otherwise 0
934
957
  */
935
958
  get referral() {
936
- return this.config.apiKey ? ge(this.config.apiKey) : 0;
959
+ return this.config.apiKey ? Ce(this.config.apiKey) : 0;
937
960
  }
938
961
  /**
939
962
  * Get the swap options
@@ -955,7 +978,7 @@ class Pe extends E {
955
978
  * @returns A promise that resolves with the quote
956
979
  */
957
980
  async getQuote(e, a, t) {
958
- return me(e, a, t, this.config.apiKey, this.swapOptions);
981
+ return be(e, a, t, this.config.apiKey, this.swapOptions);
959
982
  }
960
983
  /**
961
984
  * Builds a swap transaction from a quote
@@ -968,8 +991,8 @@ class Pe extends E {
968
991
  async buildSwapPTBFromQuote(e, a, t, s) {
969
992
  if (!this.walletClient)
970
993
  throw new Error("Wallet client not found");
971
- const n = new P(a.amount_out).multipliedBy(1 - s).toFixed(0);
972
- return await M(
994
+ const n = new p(a.amount_out).multipliedBy(1 - s).toFixed(0);
995
+ return await $(
973
996
  this.walletClient.address,
974
997
  e,
975
998
  Number(n),
@@ -999,40 +1022,40 @@ class Pe extends E {
999
1022
  * @returns Transaction response or dry run response
1000
1023
  */
1001
1024
  async swap(e, a, t, s, n) {
1002
- var f, w, b, g;
1025
+ var h, f, b, m;
1003
1026
  if (!this.walletClient)
1004
1027
  throw new Error("Wallet client not found");
1005
1028
  await this.walletClient.module("balance").waitForUpdate();
1006
- const o = this.walletClient.module("balance").portfolio.getBalance(e), i = new h(), l = y(i, o.coins, {
1029
+ const c = this.walletClient.module("balance").portfolio.getBalance(e), l = new w(), i = y(l, c.coins, {
1007
1030
  balance: t,
1008
1031
  useGasCoin: !0
1009
- }), c = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(i, c, l, s);
1010
- i.transferObjects([u], this.walletClient.address);
1032
+ }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(l, o, i, s);
1033
+ l.transferObjects([u], this.walletClient.address);
1011
1034
  const d = await this.walletClient.signExecuteTransaction({
1012
- transaction: i,
1013
- dryRun: (f = n == null ? void 0 : n.dryRun) != null ? f : !1
1035
+ transaction: l,
1036
+ dryRun: (h = n == null ? void 0 : n.dryRun) != null ? h : !1
1014
1037
  });
1015
- if (!(n != null && n.dryRun) && ((b = (w = d.effects) == null ? void 0 : w.status) == null ? void 0 : b.status) === "success") {
1016
- const m = (g = d.events) == null ? void 0 : g.find((C) => C.type.includes("::slippage::SwapEvent"));
1017
- m && this.emit("swap:swap-success", {
1038
+ if (!(n != null && n.dryRun) && ((b = (f = d.effects) == null ? void 0 : f.status) == null ? void 0 : b.status) === "success") {
1039
+ const C = (m = d.events) == null ? void 0 : m.find((g) => g.type.includes("::slippage::SwapEvent"));
1040
+ C && this.emit("swap:swap-success", {
1018
1041
  fromCoinType: e,
1019
1042
  toCoinType: a,
1020
1043
  fromAmount: t,
1021
1044
  slippage: s,
1022
- toAmount: Number(m.parsedJson.amount_out)
1045
+ toAmount: Number(C.parsedJson.amount_out)
1023
1046
  }), this.walletClient.module("balance").updatePortfolio();
1024
1047
  }
1025
1048
  return d;
1026
1049
  }
1027
1050
  }
1028
- class pe extends E {
1051
+ class Re extends R {
1029
1052
  constructor() {
1030
1053
  super(...arguments), this.name = "haedal", this.defaultConfig = {
1031
1054
  packageId: "0x3f45767c1aa95b25422f675800f02d8a813ec793a00b60667d071a77ba7178a2",
1032
1055
  configId: "0x47b224762220393057ebf4f70501b6e657c3e56684737568439a04f80849b2ca",
1033
1056
  coinType: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
1034
- }, this.getApy = X(
1035
- I(async () => (await fetch("https://open-api.naviprotocol.io/api/haedal/stats").then((a) => a.json())).data.apy)
1057
+ }, this.getApy = ae(
1058
+ M(async () => (await fetch("https://open-api.naviprotocol.io/api/haedal/stats").then((a) => a.json())).data.apy)
1036
1059
  );
1037
1060
  }
1038
1061
  /**
@@ -1048,7 +1071,7 @@ class pe extends E {
1048
1071
  arguments: [
1049
1072
  e.object("0x05"),
1050
1073
  e.object(this.config.configId),
1051
- F(a, e.object),
1074
+ k(a, e.object),
1052
1075
  e.pure.address("0x0000000000000000000000000000000000000000000000000000000000000000")
1053
1076
  ],
1054
1077
  typeArguments: []
@@ -1068,7 +1091,7 @@ class pe extends E {
1068
1091
  arguments: [
1069
1092
  e.object("0x05"),
1070
1093
  e.object(this.config.configId),
1071
- F(a, e.object)
1094
+ k(a, e.object)
1072
1095
  ],
1073
1096
  typeArguments: []
1074
1097
  });
@@ -1081,21 +1104,21 @@ class pe extends E {
1081
1104
  * @param options Optional dry run
1082
1105
  */
1083
1106
  async stake(e, a) {
1084
- var l, c, u;
1107
+ var i, o, u;
1085
1108
  if (!this.walletClient)
1086
1109
  throw new Error("Wallet client not found");
1087
- const t = new h();
1110
+ const t = new w();
1088
1111
  await this.walletClient.module("balance").waitForUpdate();
1089
1112
  const s = this.walletClient.module("balance").portfolio.getBalance("0x2::sui::SUI"), n = y(t, s.coins, {
1090
1113
  balance: e,
1091
1114
  useGasCoin: !0
1092
- }), o = await this.stakePTB(t, n);
1093
- t.transferObjects([o], this.walletClient.address);
1094
- const i = await this.walletClient.signExecuteTransaction({
1115
+ }), c = await this.stakePTB(t, n);
1116
+ t.transferObjects([c], this.walletClient.address);
1117
+ const l = await this.walletClient.signExecuteTransaction({
1095
1118
  transaction: t,
1096
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1119
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
1097
1120
  });
1098
- return !(a != null && a.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:stake-success", { suiAmount: e }), this.walletClient.module("balance").updatePortfolio()), i;
1121
+ return !(a != null && a.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:stake-success", { suiAmount: e }), this.walletClient.module("balance").updatePortfolio()), l;
1099
1122
  }
1100
1123
  /**
1101
1124
  * Unstake haSUI for SUI
@@ -1104,47 +1127,47 @@ class pe extends E {
1104
1127
  * @param options Optional dry run
1105
1128
  */
1106
1129
  async unstake(e, a) {
1107
- var l, c, u;
1130
+ var i, o, u;
1108
1131
  if (!this.walletClient)
1109
1132
  throw new Error("Wallet client not found");
1110
1133
  await this.walletClient.module("balance").waitForUpdate();
1111
- const t = new h(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
1134
+ const t = new w(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
1112
1135
  balance: e
1113
- }), o = await this.unstakePTB(t, n);
1114
- t.transferObjects([o], this.walletClient.address);
1115
- const i = await this.walletClient.signExecuteTransaction({
1136
+ }), c = await this.unstakePTB(t, n);
1137
+ t.transferObjects([c], this.walletClient.address);
1138
+ const l = await this.walletClient.signExecuteTransaction({
1116
1139
  transaction: t,
1117
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1140
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
1118
1141
  });
1119
- return !(a != null && a.dryRun) && ((u = (c = i.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:unstake-success", { haSUIAmount: e }), this.walletClient.module("balance").updatePortfolio()), i;
1142
+ return !(a != null && a.dryRun) && ((u = (o = l.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:unstake-success", { haSUIAmount: e }), this.walletClient.module("balance").updatePortfolio()), l;
1120
1143
  }
1121
1144
  }
1122
- const Ee = {
1145
+ const Se = {
1123
1146
  /** Balance management module */
1124
- balance: new be(),
1147
+ balance: new Be(),
1125
1148
  /** Lending protocol module */
1126
- lending: new Te(),
1149
+ lending: new ve(),
1127
1150
  /** Volo protocol module */
1128
- volo: new ve(),
1151
+ volo: new pe(),
1129
1152
  /** DEX swapping module */
1130
- swap: new Pe(),
1153
+ swap: new Ee(),
1131
1154
  /** Haedal protocol module */
1132
- haedal: new pe()
1133
- }, Re = {
1134
- url: ee("mainnet")
1155
+ haedal: new Re()
1156
+ }, Oe = {
1157
+ url: le("mainnet")
1135
1158
  };
1136
- class We {
1159
+ class Ie {
1137
1160
  /**
1138
1161
  * Creates a new wallet client instance
1139
1162
  * @param options - Configuration options for the wallet client
1140
1163
  */
1141
1164
  constructor(e) {
1142
- this.modules = Ee, this.userConfigs = {}, this.events = ae();
1165
+ this.modules = Se, this.userConfigs = {}, this.events = re();
1143
1166
  const a = {
1144
- ...Re,
1167
+ ...Oe,
1145
1168
  ...e.client
1146
1169
  };
1147
- a.transport = a.transport || new Ce(a.url), this.client = new te(a), this.signer = e.signer, this.userConfigs = e.configs || {}, Object.entries(this.modules).forEach(([t, s]) => {
1170
+ a.transport = a.transport || new ye(a.url), this.client = new ie(a), this.signer = e.signer, this.userConfigs = e.configs || {}, Object.entries(this.modules).forEach(([t, s]) => {
1148
1171
  if (t !== s.name)
1149
1172
  throw new Error(`Module name ${t} does not match module name ${s.name}`);
1150
1173
  s.install(this);
@@ -1174,7 +1197,7 @@ class We {
1174
1197
  const { dryRun: a = !1, ...t } = e;
1175
1198
  if (a) {
1176
1199
  let s;
1177
- return e.transaction instanceof h ? (e.transaction.setSenderIfNotSet(this.address), s = await e.transaction.build({
1200
+ return e.transaction instanceof w ? (e.transaction.setSenderIfNotSet(this.address), s = await e.transaction.build({
1178
1201
  client: this.client
1179
1202
  })) : s = e.transaction, this.client.dryRunTransactionBlock({
1180
1203
  transactionBlock: s
@@ -1220,7 +1243,7 @@ class We {
1220
1243
  return e in this.modules;
1221
1244
  }
1222
1245
  }
1223
- class Ne extends Y {
1246
+ class Le extends ne {
1224
1247
  /**
1225
1248
  * Creates a new watch-only signer
1226
1249
  *
@@ -1284,7 +1307,7 @@ class Ne extends Y {
1284
1307
  return {};
1285
1308
  }
1286
1309
  }
1287
- class Ie extends Y {
1310
+ class Me extends ne {
1288
1311
  /**
1289
1312
  * Creates a new watch-only signer
1290
1313
  *
@@ -1337,8 +1360,8 @@ class Ie extends Y {
1337
1360
  }
1338
1361
  }
1339
1362
  export {
1340
- We as WalletClient,
1341
- Ne as WatchSigner,
1342
- Ie as WebSigner
1363
+ Ie as WalletClient,
1364
+ Le as WatchSigner,
1365
+ Me as WebSigner
1343
1366
  };
1344
1367
  //# sourceMappingURL=index.esm.js.map