@naviprotocol/wallet-client 1.0.1-dev.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,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 re, liquidatePTB as ie, 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 k } 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 L, 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 M } 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(i) {
15
15
  if (i.data.err)
16
16
  throw new Error(i.data.err);
@@ -22,7 +22,7 @@ Z.interceptors.response.use(
22
22
  return Promise.reject(i);
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: M(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: M(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) || M(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 = L(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 r = new h();
241
- let l = r.gas;
242
- T(e) !== T("0x2::sui::SUI") && (l = y(r, n.coins, {
243
- balance: o.toNumber()
240
+ const l = new w();
241
+ let r = l.gas;
242
+ T(e) !== T("0x2::sui::SUI") && (r = y(l, n.coins, {
243
+ balance: c.toNumber()
244
244
  }));
245
- const c = r.splitCoins(l, t);
246
- return a.forEach((f, w) => {
247
- r.transferObjects([c[w]], f);
245
+ const o = l.splitCoins(r, t);
246
+ return a.forEach((h, f) => {
247
+ l.transferObjects([o[f]], h);
248
248
  }), await this.walletClient.signExecuteTransaction({
249
- transaction: r,
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((r, l) => {
284
- s.transferObjects([s.object(r)], a[l]);
282
+ const s = new w();
283
+ return e.forEach((l, r) => {
284
+ s.transferObjects([s.object(l)], a[r]);
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,154 +323,172 @@ 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(i, e = 2) {
328
- return i ? new P(i.toString()).shiftedBy(-1 * ye).multipliedBy(100).decimalPlaces(e, P.ROUND_DOWN).toFixed(e) : "0.00";
326
+ const Pe = 27;
327
+ function Te(i, e = 2) {
328
+ return i ? new p(i.toString()).shiftedBy(-1 * Pe).multipliedBy(100).decimalPlaces(e, p.ROUND_DOWN).toFixed(e) : "0.00";
329
329
  }
330
- async function q(i, e, a, t) {
331
- var R, S;
330
+ async function D(i, e, a, t) {
331
+ var S, O;
332
332
  if (!this.walletClient)
333
333
  throw new Error("Wallet client not found");
334
- const s = await this.getPool(e), n = await this.getPool(a), r = (await this.getLendingState()).find((O) => O.pool.id === s.id), l = this.walletClient.address;
335
- if (!r || r.supplyBalance === "0")
334
+ await this.walletClient.balance.waitForUpdate();
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), r = this.walletClient.address;
336
+ if (!l || l.supplyBalance === "0")
336
337
  throw new Error("No supply balance");
337
- if (t != null && t.amount && t.amount < Number(r.supplyBalance))
338
+ if (t != null && t.amount && t.amount > Number(l.supplyBalance))
338
339
  throw new Error("Amount is less than supply balance");
339
- const c = await G(n, {
340
+ const o = await Q(), u = await Promise.all([s, n]);
341
+ await q(
342
+ i,
343
+ K(o, {
344
+ lendingState: c,
345
+ pools: u
346
+ })
347
+ );
348
+ const d = await V(n, {
340
349
  env: this.config.env
341
350
  });
342
- if (!(c != null && c.flashloanFee))
351
+ if (!(d != null && d.flashloanFee))
343
352
  throw new Error(`${s.token.symbol} pool not support flashloan`);
344
- const u = (R = t == null ? void 0 : t.slippage) != null ? R : 5e-3, d = (S = t == null ? void 0 : t.amount) != null ? S : Number(r.supplyBalance), f = await this.walletClient.swap.getQuote(
353
+ 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(
345
354
  s.suiCoinType,
346
355
  n.suiCoinType,
347
- d
348
- ), w = Number(f.amount_out);
349
- if (w <= 0)
356
+ f
357
+ ), m = Number(b.amount_out);
358
+ if (m <= 0)
350
359
  throw new Error("The amount of swapAmountOut must be greater than 0.");
351
- const b = Math.floor(w * (1 - u)), g = Math.floor(b / (1 + c.flashloanFee));
360
+ const C = Math.floor(m * (1 - h)), g = Math.floor(C / (1 + d.flashloanFee));
352
361
  if (g <= 0)
353
362
  throw new Error("The calculated borrow amount must be positive.");
354
- const [m, C] = await H(i, n, g), [v] = i.moveCall({
363
+ const [B, v] = await X(i, n, g), [A] = i.moveCall({
355
364
  target: "0x2::coin::from_balance",
356
- arguments: [m],
365
+ arguments: [B],
357
366
  typeArguments: [n.suiCoinType]
358
367
  });
359
- await x(i, n, v, {
368
+ await x(i, n, A, {
360
369
  amount: g
361
370
  });
362
- const A = await D(i, s, d), j = await M(
363
- l,
371
+ const j = await Y(i, s, f), U = await $(
372
+ r,
364
373
  i,
365
- b,
366
- A,
367
- f
368
- ), F = i.moveCall({
374
+ C,
375
+ j,
376
+ b
377
+ ), _ = i.moveCall({
369
378
  target: "0x2::coin::into_balance",
370
- arguments: [j],
379
+ arguments: [U],
371
380
  typeArguments: [n.suiCoinType]
372
- }), [_] = await J(i, n, C, F), [U] = i.moveCall({
381
+ }), [W] = await Z(i, n, v, _), [N] = i.moveCall({
373
382
  target: "0x2::coin::from_balance",
374
- arguments: [_],
383
+ arguments: [W],
375
384
  typeArguments: [n.suiCoinType]
376
385
  });
377
- return await x(i, n, U), i;
386
+ return await x(i, n, N), i;
378
387
  }
379
- async function K(i, e, a, t) {
380
- var O, L;
388
+ async function J(i, e, a, t) {
389
+ var F, G;
381
390
  if (!this.walletClient)
382
391
  throw new Error("Wallet client not found");
383
- 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);
384
- if (!l || l.borrowBalance === "0")
392
+ await this.walletClient.balance.waitForUpdate();
393
+ const s = this.walletClient.address, n = await this.getPool(e), c = await this.getPool(a), l = await this.getLendingState(), r = l.find((I) => I.pool.id === n.id);
394
+ if (!r || r.borrowBalance === "0")
385
395
  throw new Error("No borrow balance");
386
- if (t != null && t.amount && t.amount < Number(l.borrowBalance))
396
+ if (t != null && t.amount && t.amount > Number(r.borrowBalance))
387
397
  throw new Error("Amount is less than borrow balance");
388
- let c = (O = t == null ? void 0 : t.amount) != null ? O : Number(l.borrowBalance);
389
- if (Number(l.borrowBalance) === c) {
390
- const W = parseFloat(Be(n.currentBorrowRate, 8)) / 100;
391
- c = Math.ceil(
392
- new P(c).multipliedBy(W * (60 * 3) / (365 * 24 * 3600)).plus(new P(1).shiftedBy(-n.token.decimals)).plus(c).toNumber()
398
+ const o = await Q(), u = await Promise.all([n, c]);
399
+ await q(
400
+ i,
401
+ K(o, {
402
+ lendingState: l,
403
+ pools: u
404
+ })
405
+ );
406
+ let d = (F = t == null ? void 0 : t.amount) != null ? F : Number(r.borrowBalance);
407
+ if (Number(r.borrowBalance) === d) {
408
+ const I = parseFloat(Te(n.currentBorrowRate, 8)) / 100;
409
+ d = Math.ceil(
410
+ new p(d).multipliedBy(I * (60 * 3) / (365 * 24 * 3600)).plus(new p(1).shiftedBy(-n.token.decimals)).plus(d).toNumber()
393
411
  );
394
412
  }
395
- const u = await G(n, {
413
+ const h = await V(n, {
396
414
  env: this.config.env
397
415
  });
398
- if (!u)
416
+ if (!h)
399
417
  throw new Error(`${n.token.symbol} pool not support flashloan`);
400
418
  if (!this.walletClient)
401
419
  throw new Error("Wallet client not found");
402
- 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(
420
+ 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(
403
421
  n.suiCoinType,
404
- o.suiCoinType,
405
- w
422
+ c.suiCoinType,
423
+ m
406
424
  );
407
- let g = 1 + d, m = Math.ceil(Number(b.amount_out) * g), C = await this.walletClient.swap.getQuote(
408
- o.suiCoinType,
425
+ let g = 1 + f, B = Math.ceil(Number(C.amount_out) * g), v = await this.walletClient.swap.getQuote(
426
+ c.suiCoinType,
409
427
  n.suiCoinType,
410
- m
428
+ B
411
429
  );
412
- for (; Number(C.amount_out) < w; )
413
- 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(
414
- o.suiCoinType,
430
+ for (; Number(v.amount_out) < m; )
431
+ 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(
432
+ c.suiCoinType,
415
433
  n.suiCoinType,
416
- m
434
+ B
417
435
  );
418
- const [v, A] = await H(i, n, c), [j] = i.moveCall({
436
+ const [A, j] = await X(i, n, d), [U] = i.moveCall({
419
437
  target: "0x2::coin::from_balance",
420
- arguments: [v],
438
+ arguments: [A],
421
439
  typeArguments: [n.suiCoinType]
422
440
  });
423
- await z(i, n, j, {
424
- amount: c
441
+ await ee(i, n, U, {
442
+ amount: d
425
443
  });
426
- const F = await V(i, o, m), _ = await M(
444
+ const _ = await te(i, c, B), W = await $(
427
445
  s,
428
446
  i,
429
- f,
430
- F,
431
- C
432
- ), U = i.moveCall({
447
+ b,
448
+ _,
449
+ v
450
+ ), N = i.moveCall({
433
451
  target: "0x2::coin::into_balance",
434
- arguments: [_],
452
+ arguments: [W],
435
453
  typeArguments: [n.suiCoinType]
436
- }), [R] = await J(i, n, A, U), [S] = i.moveCall({
454
+ }), [S] = await Z(i, n, j, N), [O] = i.moveCall({
437
455
  target: "0x2::coin::from_balance",
438
- arguments: [R],
456
+ arguments: [S],
439
457
  typeArguments: [n.suiCoinType]
440
458
  });
441
- return i.transferObjects([S], s), i;
459
+ return i.transferObjects([O], s), i;
442
460
  }
443
- async function $(i, e, a, t) {
444
- var c, u;
461
+ async function z(i, e, a, t) {
462
+ var o, u;
445
463
  if (!this.walletClient)
446
464
  throw new Error("Wallet client not found");
447
- this.walletClient.address;
465
+ await this.walletClient.balance.waitForUpdate(), this.walletClient.address;
448
466
  const s = await this.getPool(a), n = this.walletClient.balance.portfolio.getBalance(e);
449
467
  if (n.amount.eq(0))
450
468
  throw new Error(`No balance of ${e}`);
451
469
  if (t != null && t.amount && n.amount.lt(t.amount))
452
470
  throw new Error("Amount is less than balance");
453
- const o = (c = t == null ? void 0 : t.amount) != null ? c : n.amount.toNumber(), r = (u = t == null ? void 0 : t.slippage) != null ? u : 5e-3;
454
- let l = await y(i, n.coins, {
455
- balance: o,
471
+ 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;
472
+ let r = await y(i, n.coins, {
473
+ balance: c,
456
474
  useGasCoin: !0
457
475
  });
458
476
  if (T(e) !== T(s.suiCoinType)) {
459
- const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, o);
460
- l = await this.walletClient.swap.buildSwapPTBFromQuote(
477
+ const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, c);
478
+ r = await this.walletClient.swap.buildSwapPTBFromQuote(
461
479
  i,
462
480
  d,
463
- l,
464
- r
481
+ r,
482
+ l
465
483
  );
466
484
  }
467
- return await x(i, s, l), i;
485
+ return await x(i, s, r), i;
468
486
  }
469
- class Te extends E {
487
+ class ve extends R {
470
488
  constructor() {
471
489
  super(), this.name = "lending", this.defaultConfig = {
472
490
  env: "prod"
473
- }, this.migrateSupplyPTB = q, this.migrateBorrowPTB = K, this.migrateBalanceToSupplyPTB = $, this.migrateSupplyPTB = q.bind(this), this.migrateBorrowPTB = K.bind(this), this.migrateBalanceToSupplyPTB = $.bind(this);
491
+ }, this.migrateBetweenSupplyPTB = D, this.migrateBetweenBorrowPTB = J, this.migrateBalanceToSupplyPTB = z, this.migrateBetweenSupplyPTB = D.bind(this), this.migrateBetweenSupplyPTB = J.bind(this), this.migrateBalanceToSupplyPTB = z.bind(this);
474
492
  }
475
493
  /**
476
494
  * Gets all available lending pools
@@ -479,7 +497,7 @@ class Te extends E {
479
497
  * @returns Array of pool information
480
498
  */
481
499
  async getPools(e) {
482
- return await le({
500
+ return await ue({
483
501
  env: this.config.env,
484
502
  ...e
485
503
  });
@@ -492,7 +510,7 @@ class Te extends E {
492
510
  * @returns Pool information
493
511
  */
494
512
  async getPool(e, a) {
495
- return await B(e, {
513
+ return await P(e, {
496
514
  env: this.config.env,
497
515
  ...a
498
516
  });
@@ -506,30 +524,30 @@ class Te extends E {
506
524
  * @returns Transaction response or dry run response
507
525
  */
508
526
  async deposit(e, a, t) {
509
- var c, u, d;
527
+ var o, u, d;
510
528
  if (!this.walletClient)
511
529
  throw new Error("Wallet client not found");
512
- const s = await B(e, {
530
+ const s = await P(e, {
513
531
  env: this.config.env
514
532
  });
515
533
  await this.walletClient.module("balance").waitForUpdate();
516
- const n = new h(), o = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), r = y(n, o.coins, {
534
+ const n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
517
535
  balance: a,
518
536
  useGasCoin: !0
519
537
  });
520
- await x(n, s, r, {
538
+ await x(n, s, l, {
521
539
  env: this.config.env,
522
540
  amount: a,
523
541
  accountCap: t == null ? void 0 : t.accountCap
524
542
  });
525
- const l = await this.walletClient.signExecuteTransaction({
543
+ const r = await this.walletClient.signExecuteTransaction({
526
544
  transaction: n,
527
- dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
545
+ dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
528
546
  });
529
- 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", {
547
+ return !(t != null && t.dryRun) && ((d = (u = r.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:deposit-success", {
530
548
  identifier: e,
531
549
  amount: a
532
- }), this.walletClient.module("balance").updatePortfolio()), l;
550
+ }), this.walletClient.module("balance").updatePortfolio()), r;
533
551
  }
534
552
  /**
535
553
  * Withdraws coins from a lending pool
@@ -540,26 +558,26 @@ class Te extends E {
540
558
  * @returns Transaction response or dry run response
541
559
  */
542
560
  async withdraw(e, a, t) {
543
- var l, c, u;
561
+ var r, o, u;
544
562
  if (!this.walletClient)
545
563
  throw new Error("Wallet client not found");
546
- const s = await B(e, {
564
+ const s = await P(e, {
547
565
  env: this.config.env
548
- }), n = new h();
566
+ }), n = new w();
549
567
  t != null && t.disableUpdateOracle || await this.updateOraclePTB(n, [s]);
550
- const o = await D(n, s, a, {
568
+ const c = await Y(n, s, a, {
551
569
  env: this.config.env,
552
570
  accountCap: t == null ? void 0 : t.accountCap
553
571
  });
554
- n.transferObjects([o], this.walletClient.address);
555
- const r = await this.walletClient.signExecuteTransaction({
572
+ n.transferObjects([c], this.walletClient.address);
573
+ const l = await this.walletClient.signExecuteTransaction({
556
574
  transaction: n,
557
- dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
575
+ dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
558
576
  });
559
- return !(t != null && t.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:withdraw-success", {
577
+ 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", {
560
578
  identifier: e,
561
579
  amount: a
562
- }), this.walletClient.module("balance").updatePortfolio()), r;
580
+ }), this.walletClient.module("balance").updatePortfolio()), l;
563
581
  }
564
582
  /**
565
583
  * Borrows coins from a lending pool
@@ -570,26 +588,26 @@ class Te extends E {
570
588
  * @returns Transaction response or dry run response
571
589
  */
572
590
  async borrow(e, a, t) {
573
- var l, c, u;
591
+ var r, o, u;
574
592
  if (!this.walletClient)
575
593
  throw new Error("Wallet client not found");
576
- const s = await B(e, {
594
+ const s = await P(e, {
577
595
  env: this.config.env
578
- }), n = new h();
596
+ }), n = new w();
579
597
  t != null && t.disableUpdateOracle || await this.updateOraclePTB(n, [s]);
580
- const o = await V(n, s, a, {
598
+ const c = await te(n, s, a, {
581
599
  env: this.config.env,
582
600
  accountCap: t == null ? void 0 : t.accountCap
583
601
  });
584
- n.transferObjects([o], this.walletClient.address);
585
- const r = await this.walletClient.signExecuteTransaction({
602
+ n.transferObjects([c], this.walletClient.address);
603
+ const l = await this.walletClient.signExecuteTransaction({
586
604
  transaction: n,
587
- dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
605
+ dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
588
606
  });
589
- return !(t != null && t.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:borrow-success", {
607
+ 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", {
590
608
  identifier: e,
591
609
  amount: a
592
- }), this.walletClient.module("balance").updatePortfolio()), r;
610
+ }), this.walletClient.module("balance").updatePortfolio()), l;
593
611
  }
594
612
  /**
595
613
  * Repays borrowed coins to a lending pool
@@ -600,29 +618,29 @@ class Te extends E {
600
618
  * @returns Transaction response or dry run response
601
619
  */
602
620
  async repay(e, a, t) {
603
- var c, u, d;
621
+ var o, u, d;
604
622
  if (!this.walletClient)
605
623
  throw new Error("Wallet client not found");
606
624
  await this.walletClient.module("balance").waitForUpdate();
607
- const s = await B(e, {
625
+ const s = await P(e, {
608
626
  env: this.config.env
609
- }), n = new h(), o = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), r = y(n, o.coins, {
627
+ }), n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
610
628
  balance: a,
611
629
  useGasCoin: !0
612
630
  });
613
- await z(n, s, r, {
631
+ await ee(n, s, l, {
614
632
  env: this.config.env,
615
633
  amount: a,
616
634
  accountCap: t == null ? void 0 : t.accountCap
617
635
  });
618
- const l = await this.walletClient.signExecuteTransaction({
636
+ const r = await this.walletClient.signExecuteTransaction({
619
637
  transaction: n,
620
- dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
638
+ dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
621
639
  });
622
- 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", {
640
+ return !(t != null && t.dryRun) && ((d = (u = r.effects) == null ? void 0 : u.status) == null ? void 0 : d.status) === "success" && (this.emit("lending:repay-success", {
623
641
  identifier: e,
624
642
  amount: a
625
- }), this.walletClient.module("balance").updatePortfolio()), l;
643
+ }), this.walletClient.module("balance").updatePortfolio()), r;
626
644
  }
627
645
  /**
628
646
  * Gets the current health factor for the user
@@ -633,7 +651,7 @@ class Te extends E {
633
651
  if (!this.walletClient)
634
652
  throw new Error("Wallet client not found");
635
653
  const e = this.walletClient.address;
636
- return await re(e, {
654
+ return await de(e, {
637
655
  env: this.config.env,
638
656
  client: this.walletClient.client
639
657
  });
@@ -649,45 +667,45 @@ class Te extends E {
649
667
  * @returns Transaction response or dry run response
650
668
  */
651
669
  async liquidate(e, a, t, s, n) {
652
- var m, C, v;
670
+ var C, g, B;
653
671
  if (!this.walletClient)
654
672
  throw new Error("Wallet client not found");
655
- const o = await B(e, {
673
+ const c = await P(e, {
656
674
  env: this.config.env
657
- }), r = await B(t, {
675
+ }), l = await P(t, {
658
676
  env: this.config.env
659
- }), l = new h(), c = this.walletClient.module("balance").portfolio.getBalance(o.suiCoinType), u = y(l, c.coins, {
677
+ }), r = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(r, o.coins, {
660
678
  balance: a,
661
679
  useGasCoin: !0
662
- }), [d, f] = await ie(
663
- l,
664
- o,
665
- u,
680
+ }), [d, h] = await we(
666
681
  r,
682
+ c,
683
+ u,
684
+ l,
667
685
  s,
668
686
  {
669
687
  env: this.config.env
670
688
  }
671
- ), [w] = l.moveCall({
689
+ ), [f] = r.moveCall({
672
690
  target: "0x2::coin::from_balance",
673
691
  arguments: [d],
674
- typeArguments: [r.suiCoinType]
675
- }), [b] = l.moveCall({
692
+ typeArguments: [l.suiCoinType]
693
+ }), [b] = r.moveCall({
676
694
  target: "0x2::coin::from_balance",
677
- arguments: [f],
678
- typeArguments: [o.suiCoinType]
695
+ arguments: [h],
696
+ typeArguments: [c.suiCoinType]
679
697
  });
680
- l.transferObjects([w, b], this.walletClient.address);
681
- const g = await this.walletClient.signExecuteTransaction({
682
- transaction: l,
683
- dryRun: (m = n == null ? void 0 : n.dryRun) != null ? m : !1
698
+ r.transferObjects([f, b], this.walletClient.address);
699
+ const m = await this.walletClient.signExecuteTransaction({
700
+ transaction: r,
701
+ dryRun: (C = n == null ? void 0 : n.dryRun) != null ? C : !1
684
702
  });
685
- 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", {
703
+ 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", {
686
704
  payIdentifier: e,
687
705
  payAmount: a,
688
706
  collateralIdentifier: t,
689
707
  liquidationAddress: s
690
- }), this.walletClient.module("balance").updatePortfolio()), g;
708
+ }), this.walletClient.module("balance").updatePortfolio()), m;
691
709
  }
692
710
  /**
693
711
  * Gets the available lending rewards for the current user.
@@ -699,7 +717,7 @@ class Te extends E {
699
717
  async getAvailableRewards(e) {
700
718
  if (!this.walletClient)
701
719
  throw new Error("Wallet client not found");
702
- return Q(this.walletClient.address, {
720
+ return H(this.walletClient.address, {
703
721
  ...e,
704
722
  env: this.config.env
705
723
  });
@@ -714,7 +732,7 @@ class Te extends E {
714
732
  async getClaimedRewardHistory(e) {
715
733
  if (!this.walletClient)
716
734
  throw new Error("Wallet client not found");
717
- return ce(this.walletClient.address, {
735
+ return he(this.walletClient.address, {
718
736
  ...e
719
737
  });
720
738
  }
@@ -725,13 +743,13 @@ class Te extends E {
725
743
  * @returns Transaction response or dry run response
726
744
  */
727
745
  async claimAllRewards(e) {
728
- var n, o, r;
746
+ var n, c, l;
729
747
  if (!this.walletClient)
730
748
  throw new Error("Wallet client not found");
731
- const a = new h(), t = await Q(this.walletClient.address, {
749
+ const a = new w(), t = await H(this.walletClient.address, {
732
750
  env: this.config.env
733
751
  });
734
- await oe(a, t, {
752
+ await fe(a, t, {
735
753
  env: this.config.env,
736
754
  accountCap: e == null ? void 0 : e.accountCap
737
755
  });
@@ -739,20 +757,20 @@ class Te extends E {
739
757
  transaction: a,
740
758
  dryRun: (n = e == null ? void 0 : e.dryRun) != null ? n : !1
741
759
  });
742
- return !(e != null && e.dryRun) && ((r = (o = s.effects) == null ? void 0 : o.status) == null ? void 0 : r.status) === "success" && (this.emit("lending:claim-rewards-success", {
760
+ 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", {
743
761
  rewards: t
744
762
  }), this.walletClient.module("balance").updatePortfolio()), s;
745
763
  }
746
764
  async updateOraclePTB(e, a) {
747
- const t = await ue({
765
+ const t = await Q({
748
766
  env: this.config.env
749
767
  }), s = await this.getLendingState({
750
768
  cacheTime: 60 * 1e3
751
- }), n = de(t, {
769
+ }), n = K(t, {
752
770
  lendingState: s,
753
771
  pools: a
754
772
  });
755
- await he(e, n, {
773
+ await q(e, n, {
756
774
  env: this.config.env,
757
775
  updatePythPriceFeeds: !0
758
776
  });
@@ -768,7 +786,7 @@ class Te extends E {
768
786
  var s;
769
787
  if (!this.walletClient)
770
788
  throw new Error("Wallet client not found");
771
- const a = new h();
789
+ const a = new w();
772
790
  return await this.updateOraclePTB(a, e == null ? void 0 : e.pools), await this.walletClient.signExecuteTransaction({
773
791
  transaction: a,
774
792
  dryRun: (s = e == null ? void 0 : e.dryRun) != null ? s : !1
@@ -783,7 +801,7 @@ class Te extends E {
783
801
  async getLendingState(e) {
784
802
  if (!this.walletClient)
785
803
  throw new Error("Wallet client not found");
786
- return await we(this.walletClient.address, {
804
+ return await ge(this.walletClient.address, {
787
805
  env: this.config.env,
788
806
  ...e,
789
807
  client: this.walletClient.client
@@ -799,22 +817,22 @@ class Te extends E {
799
817
  var n;
800
818
  if (!this.walletClient)
801
819
  throw new Error("Wallet client not found");
802
- const a = new h(), t = await fe(a);
820
+ const a = new w(), t = await me(a);
803
821
  return a.transferObjects([t], this.walletClient.address), await this.walletClient.signExecuteTransaction({
804
822
  transaction: a,
805
823
  dryRun: (n = e == null ? void 0 : e.dryRun) != null ? n : !1
806
824
  });
807
825
  }
808
826
  }
809
- class ve extends E {
827
+ class pe extends R {
810
828
  constructor() {
811
829
  super(...arguments), this.name = "volo", this.defaultConfig = {
812
830
  packageId: "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20",
813
831
  poolId: "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5",
814
832
  metadataId: "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60",
815
833
  coinType: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
816
- }, this.getStats = X(
817
- I(async () => (await fetch("https://open-api.naviprotocol.io/api/volo/stats").then((a) => a.json())).data)
834
+ }, this.getStats = ae(
835
+ L(async () => (await fetch("https://open-api.naviprotocol.io/api/volo/stats").then((a) => a.json())).data)
818
836
  );
819
837
  }
820
838
  /**
@@ -866,25 +884,25 @@ class ve extends E {
866
884
  * @throws Error if wallet client not found or stake amount is too low
867
885
  */
868
886
  async stake(e, a) {
869
- var l, c, u;
887
+ var r, o, u;
870
888
  if (!this.walletClient)
871
889
  throw new Error("Wallet client not found");
872
890
  if (e < 1e9)
873
891
  throw new Error("Stake amount should be greater than 1Sui");
874
- const t = new h();
892
+ const t = new w();
875
893
  await this.walletClient.module("balance").waitForUpdate();
876
894
  const s = this.walletClient.module("balance").portfolio.getBalance("0x2::sui::SUI"), n = y(t, s.coins, {
877
895
  balance: e,
878
896
  useGasCoin: !0
879
- }), o = await this.stakePTB(t, n);
880
- t.transferObjects([o], this.walletClient.address);
881
- const r = await this.walletClient.signExecuteTransaction({
897
+ }), c = await this.stakePTB(t, n);
898
+ t.transferObjects([c], this.walletClient.address);
899
+ const l = await this.walletClient.signExecuteTransaction({
882
900
  transaction: t,
883
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
901
+ dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
884
902
  });
885
- return !(a != null && a.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:stake-success", {
903
+ 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", {
886
904
  suiAmount: e
887
- }), this.walletClient.module("balance").updatePortfolio()), r;
905
+ }), this.walletClient.module("balance").updatePortfolio()), l;
888
906
  }
889
907
  /**
890
908
  * Unstake vSUI tokens to receive SUI tokens
@@ -895,26 +913,26 @@ class ve extends E {
895
913
  * @throws Error if wallet client not found or unstake amount is too low
896
914
  */
897
915
  async unstake(e, a) {
898
- var l, c, u;
916
+ var r, o, u;
899
917
  if (!this.walletClient)
900
918
  throw new Error("Wallet client not found");
901
919
  if (e < 1e9)
902
920
  throw new Error("Unstake amount should >= 1vSui");
903
921
  await this.walletClient.module("balance").waitForUpdate();
904
- const t = new h(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
922
+ const t = new w(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
905
923
  balance: e
906
- }), o = await this.unstakePTB(t, n);
907
- t.transferObjects([o], this.walletClient.address);
908
- const r = await this.walletClient.signExecuteTransaction({
924
+ }), c = await this.unstakePTB(t, n);
925
+ t.transferObjects([c], this.walletClient.address);
926
+ const l = await this.walletClient.signExecuteTransaction({
909
927
  transaction: t,
910
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
928
+ dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
911
929
  });
912
- return !(a != null && a.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:unstake-success", {
930
+ 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", {
913
931
  vSuiAmount: e
914
- }), this.walletClient.module("balance").updatePortfolio()), r;
932
+ }), this.walletClient.module("balance").updatePortfolio()), l;
915
933
  }
916
934
  }
917
- class Pe extends E {
935
+ class Ee extends R {
918
936
  constructor() {
919
937
  super(...arguments), this.name = "swap", this.defaultConfig = {
920
938
  apiKey: "",
@@ -931,7 +949,7 @@ class Pe extends E {
931
949
  * @returns Referral ID if API key is configured, otherwise 0
932
950
  */
933
951
  get referral() {
934
- return this.config.apiKey ? ge(this.config.apiKey) : 0;
952
+ return this.config.apiKey ? Ce(this.config.apiKey) : 0;
935
953
  }
936
954
  /**
937
955
  * Get the swap options
@@ -953,7 +971,7 @@ class Pe extends E {
953
971
  * @returns A promise that resolves with the quote
954
972
  */
955
973
  async getQuote(e, a, t) {
956
- return me(e, a, t, this.config.apiKey, this.swapOptions);
974
+ return be(e, a, t, this.config.apiKey, this.swapOptions);
957
975
  }
958
976
  /**
959
977
  * Builds a swap transaction from a quote
@@ -966,8 +984,8 @@ class Pe extends E {
966
984
  async buildSwapPTBFromQuote(e, a, t, s) {
967
985
  if (!this.walletClient)
968
986
  throw new Error("Wallet client not found");
969
- const n = new P(a.amount_out).multipliedBy(1 - s).toFixed(0);
970
- return await M(
987
+ const n = new p(a.amount_out).multipliedBy(1 - s).toFixed(0);
988
+ return await $(
971
989
  this.walletClient.address,
972
990
  e,
973
991
  Number(n),
@@ -997,40 +1015,40 @@ class Pe extends E {
997
1015
  * @returns Transaction response or dry run response
998
1016
  */
999
1017
  async swap(e, a, t, s, n) {
1000
- var f, w, b, g;
1018
+ var h, f, b, m;
1001
1019
  if (!this.walletClient)
1002
1020
  throw new Error("Wallet client not found");
1003
1021
  await this.walletClient.module("balance").waitForUpdate();
1004
- const o = this.walletClient.module("balance").portfolio.getBalance(e), r = new h(), l = y(r, o.coins, {
1022
+ const c = this.walletClient.module("balance").portfolio.getBalance(e), l = new w(), r = y(l, c.coins, {
1005
1023
  balance: t,
1006
1024
  useGasCoin: !0
1007
- }), c = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(r, c, l, s);
1008
- r.transferObjects([u], this.walletClient.address);
1025
+ }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(l, o, r, s);
1026
+ l.transferObjects([u], this.walletClient.address);
1009
1027
  const d = await this.walletClient.signExecuteTransaction({
1010
- transaction: r,
1011
- dryRun: (f = n == null ? void 0 : n.dryRun) != null ? f : !1
1028
+ transaction: l,
1029
+ dryRun: (h = n == null ? void 0 : n.dryRun) != null ? h : !1
1012
1030
  });
1013
- if (!(n != null && n.dryRun) && ((b = (w = d.effects) == null ? void 0 : w.status) == null ? void 0 : b.status) === "success") {
1014
- const m = (g = d.events) == null ? void 0 : g.find((C) => C.type.includes("::slippage::SwapEvent"));
1015
- m && this.emit("swap:swap-success", {
1031
+ if (!(n != null && n.dryRun) && ((b = (f = d.effects) == null ? void 0 : f.status) == null ? void 0 : b.status) === "success") {
1032
+ const C = (m = d.events) == null ? void 0 : m.find((g) => g.type.includes("::slippage::SwapEvent"));
1033
+ C && this.emit("swap:swap-success", {
1016
1034
  fromCoinType: e,
1017
1035
  toCoinType: a,
1018
1036
  fromAmount: t,
1019
1037
  slippage: s,
1020
- toAmount: Number(m.parsedJson.amount_out)
1038
+ toAmount: Number(C.parsedJson.amount_out)
1021
1039
  }), this.walletClient.module("balance").updatePortfolio();
1022
1040
  }
1023
1041
  return d;
1024
1042
  }
1025
1043
  }
1026
- class pe extends E {
1044
+ class Re extends R {
1027
1045
  constructor() {
1028
1046
  super(...arguments), this.name = "haedal", this.defaultConfig = {
1029
1047
  packageId: "0x3f45767c1aa95b25422f675800f02d8a813ec793a00b60667d071a77ba7178a2",
1030
1048
  configId: "0x47b224762220393057ebf4f70501b6e657c3e56684737568439a04f80849b2ca",
1031
1049
  coinType: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
1032
- }, this.getApy = X(
1033
- I(async () => (await fetch("https://open-api.naviprotocol.io/api/haedal/stats").then((a) => a.json())).data.apy)
1050
+ }, this.getApy = ae(
1051
+ L(async () => (await fetch("https://open-api.naviprotocol.io/api/haedal/stats").then((a) => a.json())).data.apy)
1034
1052
  );
1035
1053
  }
1036
1054
  /**
@@ -1079,21 +1097,21 @@ class pe extends E {
1079
1097
  * @param options Optional dry run
1080
1098
  */
1081
1099
  async stake(e, a) {
1082
- var l, c, u;
1100
+ var r, o, u;
1083
1101
  if (!this.walletClient)
1084
1102
  throw new Error("Wallet client not found");
1085
- const t = new h();
1103
+ const t = new w();
1086
1104
  await this.walletClient.module("balance").waitForUpdate();
1087
1105
  const s = this.walletClient.module("balance").portfolio.getBalance("0x2::sui::SUI"), n = y(t, s.coins, {
1088
1106
  balance: e,
1089
1107
  useGasCoin: !0
1090
- }), o = await this.stakePTB(t, n);
1091
- t.transferObjects([o], this.walletClient.address);
1092
- const r = await this.walletClient.signExecuteTransaction({
1108
+ }), c = await this.stakePTB(t, n);
1109
+ t.transferObjects([c], this.walletClient.address);
1110
+ const l = await this.walletClient.signExecuteTransaction({
1093
1111
  transaction: t,
1094
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1112
+ dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1095
1113
  });
1096
- return !(a != null && a.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:stake-success", { suiAmount: e }), this.walletClient.module("balance").updatePortfolio()), r;
1114
+ 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;
1097
1115
  }
1098
1116
  /**
1099
1117
  * Unstake haSUI for SUI
@@ -1102,47 +1120,47 @@ class pe extends E {
1102
1120
  * @param options Optional dry run
1103
1121
  */
1104
1122
  async unstake(e, a) {
1105
- var l, c, u;
1123
+ var r, o, u;
1106
1124
  if (!this.walletClient)
1107
1125
  throw new Error("Wallet client not found");
1108
1126
  await this.walletClient.module("balance").waitForUpdate();
1109
- const t = new h(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
1127
+ const t = new w(), s = this.walletClient.module("balance").portfolio.getBalance(this.config.coinType), n = y(t, s.coins, {
1110
1128
  balance: e
1111
- }), o = await this.unstakePTB(t, n);
1112
- t.transferObjects([o], this.walletClient.address);
1113
- const r = await this.walletClient.signExecuteTransaction({
1129
+ }), c = await this.unstakePTB(t, n);
1130
+ t.transferObjects([c], this.walletClient.address);
1131
+ const l = await this.walletClient.signExecuteTransaction({
1114
1132
  transaction: t,
1115
- dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1133
+ dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1116
1134
  });
1117
- return !(a != null && a.dryRun) && ((u = (c = r.effects) == null ? void 0 : c.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:unstake-success", { haSUIAmount: e }), this.walletClient.module("balance").updatePortfolio()), r;
1135
+ 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;
1118
1136
  }
1119
1137
  }
1120
- const Ee = {
1138
+ const Se = {
1121
1139
  /** Balance management module */
1122
- balance: new be(),
1140
+ balance: new Be(),
1123
1141
  /** Lending protocol module */
1124
- lending: new Te(),
1142
+ lending: new ve(),
1125
1143
  /** Volo protocol module */
1126
- volo: new ve(),
1144
+ volo: new pe(),
1127
1145
  /** DEX swapping module */
1128
- swap: new Pe(),
1146
+ swap: new Ee(),
1129
1147
  /** Haedal protocol module */
1130
- haedal: new pe()
1131
- }, Re = {
1132
- url: ee("mainnet")
1148
+ haedal: new Re()
1149
+ }, Oe = {
1150
+ url: le("mainnet")
1133
1151
  };
1134
- class We {
1152
+ class Ie {
1135
1153
  /**
1136
1154
  * Creates a new wallet client instance
1137
1155
  * @param options - Configuration options for the wallet client
1138
1156
  */
1139
1157
  constructor(e) {
1140
- this.modules = Ee, this.userConfigs = {}, this.events = ae();
1158
+ this.modules = Se, this.userConfigs = {}, this.events = re();
1141
1159
  const a = {
1142
- ...Re,
1160
+ ...Oe,
1143
1161
  ...e.client
1144
1162
  };
1145
- 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]) => {
1163
+ 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]) => {
1146
1164
  if (t !== s.name)
1147
1165
  throw new Error(`Module name ${t} does not match module name ${s.name}`);
1148
1166
  s.install(this);
@@ -1172,7 +1190,7 @@ class We {
1172
1190
  const { dryRun: a = !1, ...t } = e;
1173
1191
  if (a) {
1174
1192
  let s;
1175
- return e.transaction instanceof h ? (e.transaction.setSenderIfNotSet(this.address), s = await e.transaction.build({
1193
+ return e.transaction instanceof w ? (e.transaction.setSenderIfNotSet(this.address), s = await e.transaction.build({
1176
1194
  client: this.client
1177
1195
  })) : s = e.transaction, this.client.dryRunTransactionBlock({
1178
1196
  transactionBlock: s
@@ -1218,7 +1236,7 @@ class We {
1218
1236
  return e in this.modules;
1219
1237
  }
1220
1238
  }
1221
- class Ne extends Y {
1239
+ class Me extends ne {
1222
1240
  /**
1223
1241
  * Creates a new watch-only signer
1224
1242
  *
@@ -1282,7 +1300,7 @@ class Ne extends Y {
1282
1300
  return {};
1283
1301
  }
1284
1302
  }
1285
- class Ie extends Y {
1303
+ class Le extends ne {
1286
1304
  /**
1287
1305
  * Creates a new watch-only signer
1288
1306
  *
@@ -1335,8 +1353,8 @@ class Ie extends Y {
1335
1353
  }
1336
1354
  }
1337
1355
  export {
1338
- We as WalletClient,
1339
- Ne as WatchSigner,
1340
- Ie as WebSigner
1356
+ Ie as WalletClient,
1357
+ Me as WatchSigner,
1358
+ Le as WebSigner
1341
1359
  };
1342
1360
  //# sourceMappingURL=index.esm.js.map