@naviprotocol/wallet-client 1.0.3-dev.0 → 1.0.3-dev.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,7 +1,7 @@
1
1
  import { getFullnodeUrl as le, SuiClient as ie } from "@mysten/sui/client";
2
2
  import re from "mitt";
3
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";
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 A, 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 x } from "@naviprotocol/lending";
5
5
  import p, { BigNumber as M } from "bignumber.js";
6
6
  import { normalizeStructTag as T } from "@mysten/sui/utils";
7
7
  import { Transaction as w } from "@mysten/sui/transactions";
@@ -11,15 +11,15 @@ const se = ce.create({
11
11
  timeout: 2e4
12
12
  });
13
13
  se.interceptors.response.use(
14
- function(i) {
15
- if (i.data.err)
16
- throw new Error(i.data.err);
17
- if (i.data.error)
18
- throw new Error(i.data.error.message);
19
- return i;
14
+ function(r) {
15
+ if (r.data.err)
16
+ throw new Error(r.data.err);
17
+ if (r.data.error)
18
+ throw new Error(r.data.error.message);
19
+ return r;
20
20
  },
21
- function(i) {
22
- return Promise.reject(i);
21
+ function(r) {
22
+ return Promise.reject(r);
23
23
  }
24
24
  );
25
25
  class ye {
@@ -238,11 +238,11 @@ class Be extends R {
238
238
  if (n.amount.lt(c))
239
239
  throw new Error("Insufficient balance");
240
240
  const l = new w();
241
- let r = l.gas;
242
- T(e) !== T("0x2::sui::SUI") && (r = y(l, n.coins, {
241
+ let i = l.gas;
242
+ T(e) !== T("0x2::sui::SUI") && (i = y(l, n.coins, {
243
243
  balance: c.toNumber()
244
244
  }));
245
- const o = l.splitCoins(r, t);
245
+ const o = l.splitCoins(i, t);
246
246
  return a.forEach((h, f) => {
247
247
  l.transferObjects([o[f]], h);
248
248
  }), await this.walletClient.signExecuteTransaction({
@@ -280,8 +280,8 @@ class Be extends R {
280
280
  throw new Error("Objects and recipients must have the same length");
281
281
  await this.waitForUpdate();
282
282
  const s = new w();
283
- return e.forEach((l, r) => {
284
- s.transferObjects([s.object(l)], a[r]);
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
287
  dryRun: (c = t == null ? void 0 : t.dryRun) != null ? c : !1
@@ -324,22 +324,22 @@ class Be extends R {
324
324
  }
325
325
  }
326
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";
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 D(i, e, a, t) {
331
- var S, O;
330
+ async function D(r, e, a, t) {
331
+ var S, F;
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), c = await this.getLendingState(), l = c.find((F) => F.pool.id === s.id), r = this.walletClient.address;
335
+ const s = await this.getPool(e), n = await this.getPool(a), c = await this.getLendingState(), l = c.find((O) => O.pool.id === s.id), i = this.walletClient.address;
336
336
  if (!l || l.supplyBalance === "0")
337
337
  throw new Error("No supply balance");
338
338
  if (t != null && t.amount && t.amount > Number(l.supplyBalance))
339
339
  throw new Error("Amount is less than supply balance");
340
340
  const o = await Q(), u = await Promise.all([s, n]);
341
341
  await q(
342
- i,
342
+ r,
343
343
  K(o, {
344
344
  lendingState: c,
345
345
  pools: u
@@ -356,9 +356,9 @@ async function D(i, e, a, t) {
356
356
  options: t,
357
357
  from: e,
358
358
  to: a
359
- }), !(d != null && d.flashloanFee))
359
+ }), !d)
360
360
  throw new Error(`${n.token.symbol} pool not support flashloan`);
361
- 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(
361
+ const h = (S = t == null ? void 0 : t.slippage) != null ? S : 5e-3, f = (F = t == null ? void 0 : t.amount) != null ? F : Number(l.supplyBalance), b = await this.walletClient.swap.getQuote(
362
362
  s.suiCoinType,
363
363
  n.suiCoinType,
364
364
  f
@@ -368,51 +368,51 @@ async function D(i, e, a, t) {
368
368
  const C = Math.floor(m * (1 - h)), g = Math.floor(C / (1 + d.flashloanFee));
369
369
  if (g <= 0)
370
370
  throw new Error("The calculated borrow amount must be positive.");
371
- const [B, v] = await X(i, n, g), [A] = i.moveCall({
371
+ const [B, v] = await X(r, n, g), [k] = r.moveCall({
372
372
  target: "0x2::coin::from_balance",
373
373
  arguments: [B],
374
374
  typeArguments: [n.suiCoinType]
375
375
  });
376
- await x(i, n, A, {
376
+ await A(r, n, k, {
377
377
  amount: g
378
378
  });
379
- const j = await Y(i, s, f), U = await $(
380
- r,
379
+ const j = await Y(r, s, f), U = await $(
381
380
  i,
381
+ r,
382
382
  C,
383
383
  j,
384
384
  b
385
- ), _ = i.moveCall({
385
+ ), _ = r.moveCall({
386
386
  target: "0x2::coin::into_balance",
387
387
  arguments: [U],
388
388
  typeArguments: [n.suiCoinType]
389
- }), [W] = await Z(i, n, v, _), [N] = i.moveCall({
389
+ }), [W] = await Z(r, n, v, _), [N] = r.moveCall({
390
390
  target: "0x2::coin::from_balance",
391
391
  arguments: [W],
392
392
  typeArguments: [n.suiCoinType]
393
393
  });
394
- return await x(i, n, N), i;
394
+ return await A(r, n, N), r;
395
395
  }
396
- async function J(i, e, a, t) {
397
- var F, G;
396
+ async function J(r, e, a, t) {
397
+ var O, G;
398
398
  if (!this.walletClient)
399
399
  throw new Error("Wallet client not found");
400
400
  await this.walletClient.balance.waitForUpdate();
401
- 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);
402
- if (!r || r.borrowBalance === "0")
401
+ 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);
402
+ if (!i || i.borrowBalance === "0")
403
403
  throw new Error("No borrow balance");
404
- if (t != null && t.amount && t.amount > Number(r.borrowBalance))
404
+ if (t != null && t.amount && t.amount > Number(i.borrowBalance))
405
405
  throw new Error("Amount is less than borrow balance");
406
406
  const o = await Q(), u = await Promise.all([n, c]);
407
407
  await q(
408
- i,
408
+ r,
409
409
  K(o, {
410
410
  lendingState: l,
411
411
  pools: u
412
412
  })
413
413
  );
414
- let d = (F = t == null ? void 0 : t.amount) != null ? F : Number(r.borrowBalance);
415
- if (Number(r.borrowBalance) === d) {
414
+ let d = (O = t == null ? void 0 : t.amount) != null ? O : Number(i.borrowBalance);
415
+ if (Number(i.borrowBalance) === d) {
416
416
  const I = parseFloat(Te(n.currentBorrowRate, 8)) / 100;
417
417
  d = Math.ceil(
418
418
  new p(d).multipliedBy(I * (60 * 3) / (365 * 24 * 3600)).plus(new p(1).shiftedBy(-n.token.decimals)).plus(d).toNumber()
@@ -425,6 +425,16 @@ async function J(i, e, a, t) {
425
425
  throw new Error(`${n.token.symbol} pool not support flashloan`);
426
426
  if (!this.walletClient)
427
427
  throw new Error("Wallet client not found");
428
+ console.log("migrateBetweenBorrowPTB", {
429
+ toPool: c,
430
+ fromPoolFlashloanAsset: h,
431
+ fromPool: n,
432
+ formAmount: d,
433
+ fromPoolLending: i,
434
+ options: t,
435
+ from: e,
436
+ to: a
437
+ });
428
438
  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(
429
439
  n.suiCoinType,
430
440
  c.suiCoinType,
@@ -441,32 +451,32 @@ async function J(i, e, a, t) {
441
451
  n.suiCoinType,
442
452
  B
443
453
  );
444
- const [A, j] = await X(i, n, d), [U] = i.moveCall({
454
+ const [k, j] = await X(r, n, d), [U] = r.moveCall({
445
455
  target: "0x2::coin::from_balance",
446
- arguments: [A],
456
+ arguments: [k],
447
457
  typeArguments: [n.suiCoinType]
448
458
  });
449
- await ee(i, n, U, {
459
+ await ee(r, n, U, {
450
460
  amount: d
451
461
  });
452
- const _ = await te(i, c, B), W = await $(
462
+ const _ = await te(r, c, B), W = await $(
453
463
  s,
454
- i,
464
+ r,
455
465
  b,
456
466
  _,
457
467
  v
458
- ), N = i.moveCall({
468
+ ), N = r.moveCall({
459
469
  target: "0x2::coin::into_balance",
460
470
  arguments: [W],
461
471
  typeArguments: [n.suiCoinType]
462
- }), [S] = await Z(i, n, j, N), [O] = i.moveCall({
472
+ }), [S] = await Z(r, n, j, N), [F] = r.moveCall({
463
473
  target: "0x2::coin::from_balance",
464
474
  arguments: [S],
465
475
  typeArguments: [n.suiCoinType]
466
476
  });
467
- return i.transferObjects([O], s), i;
477
+ return r.transferObjects([F], s), r;
468
478
  }
469
- async function z(i, e, a, t) {
479
+ async function z(r, e, a, t) {
470
480
  var o, u;
471
481
  if (!this.walletClient)
472
482
  throw new Error("Wallet client not found");
@@ -477,20 +487,20 @@ async function z(i, e, a, t) {
477
487
  if (t != null && t.amount && n.amount.lt(t.amount))
478
488
  throw new Error("Amount is less than balance");
479
489
  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;
480
- let r = await y(i, n.coins, {
490
+ let i = await y(r, n.coins, {
481
491
  balance: c,
482
492
  useGasCoin: !0
483
493
  });
484
494
  if (T(e) !== T(s.suiCoinType)) {
485
495
  const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, c);
486
- r = await this.walletClient.swap.buildSwapPTBFromQuote(
487
- i,
488
- d,
496
+ i = await this.walletClient.swap.buildSwapPTBFromQuote(
489
497
  r,
498
+ d,
499
+ i,
490
500
  l
491
501
  );
492
502
  }
493
- return await x(i, s, r), i;
503
+ return await A(r, s, i), r;
494
504
  }
495
505
  class ve extends R {
496
506
  constructor() {
@@ -543,19 +553,19 @@ class ve extends R {
543
553
  balance: a,
544
554
  useGasCoin: !0
545
555
  });
546
- await x(n, s, l, {
556
+ await A(n, s, l, {
547
557
  env: this.config.env,
548
558
  amount: a,
549
559
  accountCap: t == null ? void 0 : t.accountCap
550
560
  });
551
- const r = await this.walletClient.signExecuteTransaction({
561
+ const i = await this.walletClient.signExecuteTransaction({
552
562
  transaction: n,
553
563
  dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
554
564
  });
555
- 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", {
565
+ 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", {
556
566
  identifier: e,
557
567
  amount: a
558
- }), this.walletClient.module("balance").updatePortfolio()), r;
568
+ }), this.walletClient.module("balance").updatePortfolio()), i;
559
569
  }
560
570
  /**
561
571
  * Withdraws coins from a lending pool
@@ -566,7 +576,7 @@ class ve extends R {
566
576
  * @returns Transaction response or dry run response
567
577
  */
568
578
  async withdraw(e, a, t) {
569
- var r, o, u;
579
+ var i, o, u;
570
580
  if (!this.walletClient)
571
581
  throw new Error("Wallet client not found");
572
582
  const s = await P(e, {
@@ -580,7 +590,7 @@ class ve extends R {
580
590
  n.transferObjects([c], this.walletClient.address);
581
591
  const l = await this.walletClient.signExecuteTransaction({
582
592
  transaction: n,
583
- dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
593
+ dryRun: (i = t == null ? void 0 : t.dryRun) != null ? i : !1
584
594
  });
585
595
  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", {
586
596
  identifier: e,
@@ -596,7 +606,7 @@ class ve extends R {
596
606
  * @returns Transaction response or dry run response
597
607
  */
598
608
  async borrow(e, a, t) {
599
- var r, o, u;
609
+ var i, o, u;
600
610
  if (!this.walletClient)
601
611
  throw new Error("Wallet client not found");
602
612
  const s = await P(e, {
@@ -610,7 +620,7 @@ class ve extends R {
610
620
  n.transferObjects([c], this.walletClient.address);
611
621
  const l = await this.walletClient.signExecuteTransaction({
612
622
  transaction: n,
613
- dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
623
+ dryRun: (i = t == null ? void 0 : t.dryRun) != null ? i : !1
614
624
  });
615
625
  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", {
616
626
  identifier: e,
@@ -641,14 +651,14 @@ class ve extends R {
641
651
  amount: a,
642
652
  accountCap: t == null ? void 0 : t.accountCap
643
653
  });
644
- const r = await this.walletClient.signExecuteTransaction({
654
+ const i = await this.walletClient.signExecuteTransaction({
645
655
  transaction: n,
646
656
  dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
647
657
  });
648
- 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", {
658
+ 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", {
649
659
  identifier: e,
650
660
  amount: a
651
- }), this.walletClient.module("balance").updatePortfolio()), r;
661
+ }), this.walletClient.module("balance").updatePortfolio()), i;
652
662
  }
653
663
  /**
654
664
  * Gets the current health factor for the user
@@ -682,11 +692,11 @@ class ve extends R {
682
692
  env: this.config.env
683
693
  }), l = await P(t, {
684
694
  env: this.config.env
685
- }), r = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(r, o.coins, {
695
+ }), i = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(i, o.coins, {
686
696
  balance: a,
687
697
  useGasCoin: !0
688
698
  }), [d, h] = await we(
689
- r,
699
+ i,
690
700
  c,
691
701
  u,
692
702
  l,
@@ -694,18 +704,18 @@ class ve extends R {
694
704
  {
695
705
  env: this.config.env
696
706
  }
697
- ), [f] = r.moveCall({
707
+ ), [f] = i.moveCall({
698
708
  target: "0x2::coin::from_balance",
699
709
  arguments: [d],
700
710
  typeArguments: [l.suiCoinType]
701
- }), [b] = r.moveCall({
711
+ }), [b] = i.moveCall({
702
712
  target: "0x2::coin::from_balance",
703
713
  arguments: [h],
704
714
  typeArguments: [c.suiCoinType]
705
715
  });
706
- r.transferObjects([f, b], this.walletClient.address);
716
+ i.transferObjects([f, b], this.walletClient.address);
707
717
  const m = await this.walletClient.signExecuteTransaction({
708
- transaction: r,
718
+ transaction: i,
709
719
  dryRun: (C = n == null ? void 0 : n.dryRun) != null ? C : !1
710
720
  });
711
721
  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", {
@@ -857,7 +867,7 @@ class pe extends R {
857
867
  e.object(this.config.poolId),
858
868
  e.object(this.config.metadataId),
859
869
  e.object("0x05"),
860
- k(a, e.object)
870
+ x(a, e.object)
861
871
  ],
862
872
  typeArguments: []
863
873
  });
@@ -877,7 +887,7 @@ class pe extends R {
877
887
  e.object(this.config.poolId),
878
888
  e.object(this.config.metadataId),
879
889
  e.object("0x05"),
880
- k(a, e.object)
890
+ x(a, e.object)
881
891
  ],
882
892
  typeArguments: []
883
893
  });
@@ -892,7 +902,7 @@ class pe extends R {
892
902
  * @throws Error if wallet client not found or stake amount is too low
893
903
  */
894
904
  async stake(e, a) {
895
- var r, o, u;
905
+ var i, o, u;
896
906
  if (!this.walletClient)
897
907
  throw new Error("Wallet client not found");
898
908
  if (e < 1e9)
@@ -906,7 +916,7 @@ class pe extends R {
906
916
  t.transferObjects([c], this.walletClient.address);
907
917
  const l = await this.walletClient.signExecuteTransaction({
908
918
  transaction: t,
909
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
919
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
910
920
  });
911
921
  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", {
912
922
  suiAmount: e
@@ -921,7 +931,7 @@ class pe extends R {
921
931
  * @throws Error if wallet client not found or unstake amount is too low
922
932
  */
923
933
  async unstake(e, a) {
924
- var r, o, u;
934
+ var i, o, u;
925
935
  if (!this.walletClient)
926
936
  throw new Error("Wallet client not found");
927
937
  if (e < 1e9)
@@ -933,7 +943,7 @@ class pe extends R {
933
943
  t.transferObjects([c], this.walletClient.address);
934
944
  const l = await this.walletClient.signExecuteTransaction({
935
945
  transaction: t,
936
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
946
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
937
947
  });
938
948
  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", {
939
949
  vSuiAmount: e
@@ -1027,10 +1037,10 @@ class Ee extends R {
1027
1037
  if (!this.walletClient)
1028
1038
  throw new Error("Wallet client not found");
1029
1039
  await this.walletClient.module("balance").waitForUpdate();
1030
- const c = this.walletClient.module("balance").portfolio.getBalance(e), l = new w(), r = y(l, c.coins, {
1040
+ const c = this.walletClient.module("balance").portfolio.getBalance(e), l = new w(), i = y(l, c.coins, {
1031
1041
  balance: t,
1032
1042
  useGasCoin: !0
1033
- }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(l, o, r, s);
1043
+ }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(l, o, i, s);
1034
1044
  l.transferObjects([u], this.walletClient.address);
1035
1045
  const d = await this.walletClient.signExecuteTransaction({
1036
1046
  transaction: l,
@@ -1072,7 +1082,7 @@ class Re extends R {
1072
1082
  arguments: [
1073
1083
  e.object("0x05"),
1074
1084
  e.object(this.config.configId),
1075
- k(a, e.object),
1085
+ x(a, e.object),
1076
1086
  e.pure.address("0x0000000000000000000000000000000000000000000000000000000000000000")
1077
1087
  ],
1078
1088
  typeArguments: []
@@ -1092,7 +1102,7 @@ class Re extends R {
1092
1102
  arguments: [
1093
1103
  e.object("0x05"),
1094
1104
  e.object(this.config.configId),
1095
- k(a, e.object)
1105
+ x(a, e.object)
1096
1106
  ],
1097
1107
  typeArguments: []
1098
1108
  });
@@ -1105,7 +1115,7 @@ class Re extends R {
1105
1115
  * @param options Optional dry run
1106
1116
  */
1107
1117
  async stake(e, a) {
1108
- var r, o, u;
1118
+ var i, o, u;
1109
1119
  if (!this.walletClient)
1110
1120
  throw new Error("Wallet client not found");
1111
1121
  const t = new w();
@@ -1117,7 +1127,7 @@ class Re extends R {
1117
1127
  t.transferObjects([c], this.walletClient.address);
1118
1128
  const l = await this.walletClient.signExecuteTransaction({
1119
1129
  transaction: t,
1120
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1130
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
1121
1131
  });
1122
1132
  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;
1123
1133
  }
@@ -1128,7 +1138,7 @@ class Re extends R {
1128
1138
  * @param options Optional dry run
1129
1139
  */
1130
1140
  async unstake(e, a) {
1131
- var r, o, u;
1141
+ var i, o, u;
1132
1142
  if (!this.walletClient)
1133
1143
  throw new Error("Wallet client not found");
1134
1144
  await this.walletClient.module("balance").waitForUpdate();
@@ -1138,7 +1148,7 @@ class Re extends R {
1138
1148
  t.transferObjects([c], this.walletClient.address);
1139
1149
  const l = await this.walletClient.signExecuteTransaction({
1140
1150
  transaction: t,
1141
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1151
+ dryRun: (i = a == null ? void 0 : a.dryRun) != null ? i : !1
1142
1152
  });
1143
1153
  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;
1144
1154
  }
@@ -1154,7 +1164,7 @@ const Se = {
1154
1164
  swap: new Ee(),
1155
1165
  /** Haedal protocol module */
1156
1166
  haedal: new Re()
1157
- }, Oe = {
1167
+ }, Fe = {
1158
1168
  url: le("mainnet")
1159
1169
  };
1160
1170
  class Ie {
@@ -1165,7 +1175,7 @@ class Ie {
1165
1175
  constructor(e) {
1166
1176
  this.modules = Se, this.userConfigs = {}, this.events = re();
1167
1177
  const a = {
1168
- ...Oe,
1178
+ ...Fe,
1169
1179
  ...e.client
1170
1180
  };
1171
1181
  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]) => {