@naviprotocol/wallet-client 1.0.2-dev.1 → 1.0.2-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -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 {
@@ -237,16 +237,16 @@ class Be extends R {
237
237
  const n = this.portfolio.getBalance(e), c = t.reduce((h, f) => h.plus(f), p(0));
238
238
  if (n.amount.lt(c))
239
239
  throw new Error("Insufficient balance");
240
- const l = new w();
241
- let r = l.gas;
242
- T(e) !== T("0x2::sui::SUI") && (r = y(l, n.coins, {
240
+ const i = new w();
241
+ let l = i.gas;
242
+ T(e) !== T("0x2::sui::SUI") && (l = y(i, n.coins, {
243
243
  balance: c.toNumber()
244
244
  }));
245
- const o = l.splitCoins(r, t);
245
+ const o = i.splitCoins(l, t);
246
246
  return a.forEach((h, f) => {
247
- l.transferObjects([o[f]], h);
247
+ i.transferObjects([o[f]], h);
248
248
  }), await this.walletClient.signExecuteTransaction({
249
- transaction: l,
249
+ transaction: i,
250
250
  dryRun: (d = s == null ? void 0 : s.dryRun) != null ? d : !1
251
251
  });
252
252
  }
@@ -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((i, l) => {
284
+ s.transferObjects([s.object(i)], a[l]);
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) {
330
+ async function D(r, e, a, t) {
331
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), c = await this.getLendingState(), l = c.find((F) => F.pool.id === s.id), r = this.walletClient.address;
336
- if (!l || l.supplyBalance === "0")
335
+ const s = await this.getPool(e), n = await this.getPool(a), c = await this.getLendingState(), i = c.find((F) => F.pool.id === s.id), l = this.walletClient.address;
336
+ if (!i || i.supplyBalance === "0")
337
337
  throw new Error("No supply balance");
338
- if (t != null && t.amount && t.amount > Number(l.supplyBalance))
338
+ if (t != null && t.amount && t.amount > Number(i.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
@@ -350,7 +350,7 @@ async function D(i, e, a, t) {
350
350
  });
351
351
  if (!(d != null && d.flashloanFee))
352
352
  throw new Error(`${s.token.symbol} pool not support flashloan`);
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(
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(i.supplyBalance), b = await this.walletClient.swap.getQuote(
354
354
  s.suiCoinType,
355
355
  n.suiCoinType,
356
356
  f
@@ -360,56 +360,62 @@ async function D(i, e, a, t) {
360
360
  const C = Math.floor(m * (1 - h)), g = Math.floor(C / (1 + d.flashloanFee));
361
361
  if (g <= 0)
362
362
  throw new Error("The calculated borrow amount must be positive.");
363
- const [B, v] = await X(i, n, g), [A] = i.moveCall({
363
+ const [B, v] = await X(r, n, g), [A] = r.moveCall({
364
364
  target: "0x2::coin::from_balance",
365
365
  arguments: [B],
366
366
  typeArguments: [n.suiCoinType]
367
367
  });
368
- await x(i, n, A, {
368
+ await x(r, n, A, {
369
369
  amount: g
370
370
  });
371
- const j = await Y(i, s, f), U = await $(
371
+ const j = await Y(r, s, f), U = await $(
372
+ l,
372
373
  r,
373
- i,
374
374
  C,
375
375
  j,
376
376
  b
377
- ), _ = i.moveCall({
377
+ ), _ = r.moveCall({
378
378
  target: "0x2::coin::into_balance",
379
379
  arguments: [U],
380
380
  typeArguments: [n.suiCoinType]
381
- }), [W] = await Z(i, n, v, _), [N] = i.moveCall({
381
+ }), [W] = await Z(r, n, v, _), [N] = r.moveCall({
382
382
  target: "0x2::coin::from_balance",
383
383
  arguments: [W],
384
384
  typeArguments: [n.suiCoinType]
385
385
  });
386
- return await x(i, n, N), i;
386
+ return await x(r, n, N), r;
387
387
  }
388
- async function J(i, e, a, t) {
388
+ async function J(r, e, a, t) {
389
389
  var F, G;
390
390
  if (!this.walletClient)
391
391
  throw new Error("Wallet client not found");
392
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")
393
+ const s = this.walletClient.address, n = await this.getPool(e), c = await this.getPool(a), i = await this.getLendingState(), l = i.find((I) => I.pool.id === n.id);
394
+ if (!l || l.borrowBalance === "0")
395
395
  throw new Error("No borrow balance");
396
- if (t != null && t.amount && t.amount > Number(r.borrowBalance))
396
+ if (t != null && t.amount && t.amount > Number(l.borrowBalance))
397
397
  throw new Error("Amount is less than borrow balance");
398
398
  const o = await Q(), u = await Promise.all([n, c]);
399
399
  await q(
400
- i,
400
+ r,
401
401
  K(o, {
402
- lendingState: l,
402
+ lendingState: i,
403
403
  pools: u
404
404
  })
405
405
  );
406
- let d = (F = t == null ? void 0 : t.amount) != null ? F : Number(r.borrowBalance);
407
- if (Number(r.borrowBalance) === d) {
406
+ let d = (F = t == null ? void 0 : t.amount) != null ? F : Number(l.borrowBalance);
407
+ if (Number(l.borrowBalance) === d) {
408
408
  const I = parseFloat(Te(n.currentBorrowRate, 8)) / 100;
409
409
  d = Math.ceil(
410
410
  new p(d).multipliedBy(I * (60 * 3) / (365 * 24 * 3600)).plus(new p(1).shiftedBy(-n.token.decimals)).plus(d).toNumber()
411
411
  );
412
412
  }
413
+ console.log("migrateBetweenBorrowPTB", {
414
+ formAmount: d,
415
+ options: t,
416
+ fromPoolLending: l,
417
+ isMax: Number(l.borrowBalance) === d
418
+ });
413
419
  const h = await V(n, {
414
420
  env: this.config.env
415
421
  });
@@ -433,32 +439,32 @@ async function J(i, e, a, t) {
433
439
  n.suiCoinType,
434
440
  B
435
441
  );
436
- const [A, j] = await X(i, n, d), [U] = i.moveCall({
442
+ const [A, j] = await X(r, n, d), [U] = r.moveCall({
437
443
  target: "0x2::coin::from_balance",
438
444
  arguments: [A],
439
445
  typeArguments: [n.suiCoinType]
440
446
  });
441
- await ee(i, n, U, {
447
+ await ee(r, n, U, {
442
448
  amount: d
443
449
  });
444
- const _ = await te(i, c, B), W = await $(
450
+ const _ = await te(r, c, B), W = await $(
445
451
  s,
446
- i,
452
+ r,
447
453
  b,
448
454
  _,
449
455
  v
450
- ), N = i.moveCall({
456
+ ), N = r.moveCall({
451
457
  target: "0x2::coin::into_balance",
452
458
  arguments: [W],
453
459
  typeArguments: [n.suiCoinType]
454
- }), [S] = await Z(i, n, j, N), [O] = i.moveCall({
460
+ }), [S] = await Z(r, n, j, N), [O] = r.moveCall({
455
461
  target: "0x2::coin::from_balance",
456
462
  arguments: [S],
457
463
  typeArguments: [n.suiCoinType]
458
464
  });
459
- return i.transferObjects([O], s), i;
465
+ return r.transferObjects([O], s), r;
460
466
  }
461
- async function z(i, e, a, t) {
467
+ async function z(r, e, a, t) {
462
468
  var o, u;
463
469
  if (!this.walletClient)
464
470
  throw new Error("Wallet client not found");
@@ -468,21 +474,21 @@ async function z(i, e, a, t) {
468
474
  throw new Error(`No balance of ${e}`);
469
475
  if (t != null && t.amount && n.amount.lt(t.amount))
470
476
  throw new Error("Amount is less than balance");
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, {
477
+ const c = (o = t == null ? void 0 : t.amount) != null ? o : n.amount.toNumber(), i = (u = t == null ? void 0 : t.slippage) != null ? u : 5e-3;
478
+ let l = await y(r, n.coins, {
473
479
  balance: c,
474
480
  useGasCoin: !0
475
481
  });
476
482
  if (T(e) !== T(s.suiCoinType)) {
477
483
  const d = await this.walletClient.swap.getQuote(e, s.suiCoinType, c);
478
- r = await this.walletClient.swap.buildSwapPTBFromQuote(
479
- i,
480
- d,
484
+ l = await this.walletClient.swap.buildSwapPTBFromQuote(
481
485
  r,
482
- l
486
+ d,
487
+ l,
488
+ i
483
489
  );
484
490
  }
485
- return await x(i, s, r), i;
491
+ return await x(r, s, l), r;
486
492
  }
487
493
  class ve extends R {
488
494
  constructor() {
@@ -531,23 +537,23 @@ class ve extends R {
531
537
  env: this.config.env
532
538
  });
533
539
  await this.walletClient.module("balance").waitForUpdate();
534
- const n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
540
+ const n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), i = y(n, c.coins, {
535
541
  balance: a,
536
542
  useGasCoin: !0
537
543
  });
538
- await x(n, s, l, {
544
+ await x(n, s, i, {
539
545
  env: this.config.env,
540
546
  amount: a,
541
547
  accountCap: t == null ? void 0 : t.accountCap
542
548
  });
543
- const r = await this.walletClient.signExecuteTransaction({
549
+ const l = await this.walletClient.signExecuteTransaction({
544
550
  transaction: n,
545
551
  dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
546
552
  });
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", {
553
+ 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", {
548
554
  identifier: e,
549
555
  amount: a
550
- }), this.walletClient.module("balance").updatePortfolio()), r;
556
+ }), this.walletClient.module("balance").updatePortfolio()), l;
551
557
  }
552
558
  /**
553
559
  * Withdraws coins from a lending pool
@@ -558,7 +564,7 @@ class ve extends R {
558
564
  * @returns Transaction response or dry run response
559
565
  */
560
566
  async withdraw(e, a, t) {
561
- var r, o, u;
567
+ var l, o, u;
562
568
  if (!this.walletClient)
563
569
  throw new Error("Wallet client not found");
564
570
  const s = await P(e, {
@@ -570,14 +576,14 @@ class ve extends R {
570
576
  accountCap: t == null ? void 0 : t.accountCap
571
577
  });
572
578
  n.transferObjects([c], this.walletClient.address);
573
- const l = await this.walletClient.signExecuteTransaction({
579
+ const i = await this.walletClient.signExecuteTransaction({
574
580
  transaction: n,
575
- dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
581
+ dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
576
582
  });
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", {
583
+ return !(t != null && t.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:withdraw-success", {
578
584
  identifier: e,
579
585
  amount: a
580
- }), this.walletClient.module("balance").updatePortfolio()), l;
586
+ }), this.walletClient.module("balance").updatePortfolio()), i;
581
587
  }
582
588
  /**
583
589
  * Borrows coins from a lending pool
@@ -588,7 +594,7 @@ class ve extends R {
588
594
  * @returns Transaction response or dry run response
589
595
  */
590
596
  async borrow(e, a, t) {
591
- var r, o, u;
597
+ var l, o, u;
592
598
  if (!this.walletClient)
593
599
  throw new Error("Wallet client not found");
594
600
  const s = await P(e, {
@@ -600,14 +606,14 @@ class ve extends R {
600
606
  accountCap: t == null ? void 0 : t.accountCap
601
607
  });
602
608
  n.transferObjects([c], this.walletClient.address);
603
- const l = await this.walletClient.signExecuteTransaction({
609
+ const i = await this.walletClient.signExecuteTransaction({
604
610
  transaction: n,
605
- dryRun: (r = t == null ? void 0 : t.dryRun) != null ? r : !1
611
+ dryRun: (l = t == null ? void 0 : t.dryRun) != null ? l : !1
606
612
  });
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", {
613
+ return !(t != null && t.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("lending:borrow-success", {
608
614
  identifier: e,
609
615
  amount: a
610
- }), this.walletClient.module("balance").updatePortfolio()), l;
616
+ }), this.walletClient.module("balance").updatePortfolio()), i;
611
617
  }
612
618
  /**
613
619
  * Repays borrowed coins to a lending pool
@@ -624,23 +630,23 @@ class ve extends R {
624
630
  await this.walletClient.module("balance").waitForUpdate();
625
631
  const s = await P(e, {
626
632
  env: this.config.env
627
- }), n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), l = y(n, c.coins, {
633
+ }), n = new w(), c = this.walletClient.module("balance").portfolio.getBalance(s.suiCoinType), i = y(n, c.coins, {
628
634
  balance: a,
629
635
  useGasCoin: !0
630
636
  });
631
- await ee(n, s, l, {
637
+ await ee(n, s, i, {
632
638
  env: this.config.env,
633
639
  amount: a,
634
640
  accountCap: t == null ? void 0 : t.accountCap
635
641
  });
636
- const r = await this.walletClient.signExecuteTransaction({
642
+ const l = await this.walletClient.signExecuteTransaction({
637
643
  transaction: n,
638
644
  dryRun: (o = t == null ? void 0 : t.dryRun) != null ? o : !1
639
645
  });
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", {
646
+ 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", {
641
647
  identifier: e,
642
648
  amount: a
643
- }), this.walletClient.module("balance").updatePortfolio()), r;
649
+ }), this.walletClient.module("balance").updatePortfolio()), l;
644
650
  }
645
651
  /**
646
652
  * Gets the current health factor for the user
@@ -672,32 +678,32 @@ class ve extends R {
672
678
  throw new Error("Wallet client not found");
673
679
  const c = await P(e, {
674
680
  env: this.config.env
675
- }), l = await P(t, {
681
+ }), i = await P(t, {
676
682
  env: this.config.env
677
- }), r = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(r, o.coins, {
683
+ }), l = new w(), o = this.walletClient.module("balance").portfolio.getBalance(c.suiCoinType), u = y(l, o.coins, {
678
684
  balance: a,
679
685
  useGasCoin: !0
680
686
  }), [d, h] = await we(
681
- r,
687
+ l,
682
688
  c,
683
689
  u,
684
- l,
690
+ i,
685
691
  s,
686
692
  {
687
693
  env: this.config.env
688
694
  }
689
- ), [f] = r.moveCall({
695
+ ), [f] = l.moveCall({
690
696
  target: "0x2::coin::from_balance",
691
697
  arguments: [d],
692
- typeArguments: [l.suiCoinType]
693
- }), [b] = r.moveCall({
698
+ typeArguments: [i.suiCoinType]
699
+ }), [b] = l.moveCall({
694
700
  target: "0x2::coin::from_balance",
695
701
  arguments: [h],
696
702
  typeArguments: [c.suiCoinType]
697
703
  });
698
- r.transferObjects([f, b], this.walletClient.address);
704
+ l.transferObjects([f, b], this.walletClient.address);
699
705
  const m = await this.walletClient.signExecuteTransaction({
700
- transaction: r,
706
+ transaction: l,
701
707
  dryRun: (C = n == null ? void 0 : n.dryRun) != null ? C : !1
702
708
  });
703
709
  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", {
@@ -743,7 +749,7 @@ class ve extends R {
743
749
  * @returns Transaction response or dry run response
744
750
  */
745
751
  async claimAllRewards(e) {
746
- var n, c, l;
752
+ var n, c, i;
747
753
  if (!this.walletClient)
748
754
  throw new Error("Wallet client not found");
749
755
  const a = new w(), t = await H(this.walletClient.address, {
@@ -757,7 +763,7 @@ class ve extends R {
757
763
  transaction: a,
758
764
  dryRun: (n = e == null ? void 0 : e.dryRun) != null ? n : !1
759
765
  });
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", {
766
+ return !(e != null && e.dryRun) && ((i = (c = s.effects) == null ? void 0 : c.status) == null ? void 0 : i.status) === "success" && (this.emit("lending:claim-rewards-success", {
761
767
  rewards: t
762
768
  }), this.walletClient.module("balance").updatePortfolio()), s;
763
769
  }
@@ -884,7 +890,7 @@ class pe extends R {
884
890
  * @throws Error if wallet client not found or stake amount is too low
885
891
  */
886
892
  async stake(e, a) {
887
- var r, o, u;
893
+ var l, o, u;
888
894
  if (!this.walletClient)
889
895
  throw new Error("Wallet client not found");
890
896
  if (e < 1e9)
@@ -896,13 +902,13 @@ class pe extends R {
896
902
  useGasCoin: !0
897
903
  }), c = await this.stakePTB(t, n);
898
904
  t.transferObjects([c], this.walletClient.address);
899
- const l = await this.walletClient.signExecuteTransaction({
905
+ const i = await this.walletClient.signExecuteTransaction({
900
906
  transaction: t,
901
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
907
+ dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
902
908
  });
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", {
909
+ return !(a != null && a.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:stake-success", {
904
910
  suiAmount: e
905
- }), this.walletClient.module("balance").updatePortfolio()), l;
911
+ }), this.walletClient.module("balance").updatePortfolio()), i;
906
912
  }
907
913
  /**
908
914
  * Unstake vSUI tokens to receive SUI tokens
@@ -913,7 +919,7 @@ class pe extends R {
913
919
  * @throws Error if wallet client not found or unstake amount is too low
914
920
  */
915
921
  async unstake(e, a) {
916
- var r, o, u;
922
+ var l, o, u;
917
923
  if (!this.walletClient)
918
924
  throw new Error("Wallet client not found");
919
925
  if (e < 1e9)
@@ -923,13 +929,13 @@ class pe extends R {
923
929
  balance: e
924
930
  }), c = await this.unstakePTB(t, n);
925
931
  t.transferObjects([c], this.walletClient.address);
926
- const l = await this.walletClient.signExecuteTransaction({
932
+ const i = await this.walletClient.signExecuteTransaction({
927
933
  transaction: t,
928
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
934
+ dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
929
935
  });
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", {
936
+ return !(a != null && a.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("volo:unstake-success", {
931
937
  vSuiAmount: e
932
- }), this.walletClient.module("balance").updatePortfolio()), l;
938
+ }), this.walletClient.module("balance").updatePortfolio()), i;
933
939
  }
934
940
  }
935
941
  class Ee extends R {
@@ -1019,13 +1025,13 @@ class Ee extends R {
1019
1025
  if (!this.walletClient)
1020
1026
  throw new Error("Wallet client not found");
1021
1027
  await this.walletClient.module("balance").waitForUpdate();
1022
- const c = this.walletClient.module("balance").portfolio.getBalance(e), l = new w(), r = y(l, c.coins, {
1028
+ const c = this.walletClient.module("balance").portfolio.getBalance(e), i = new w(), l = y(i, c.coins, {
1023
1029
  balance: t,
1024
1030
  useGasCoin: !0
1025
- }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(l, o, r, s);
1026
- l.transferObjects([u], this.walletClient.address);
1031
+ }), o = await this.getQuote(e, a, t), u = await this.buildSwapPTBFromQuote(i, o, l, s);
1032
+ i.transferObjects([u], this.walletClient.address);
1027
1033
  const d = await this.walletClient.signExecuteTransaction({
1028
- transaction: l,
1034
+ transaction: i,
1029
1035
  dryRun: (h = n == null ? void 0 : n.dryRun) != null ? h : !1
1030
1036
  });
1031
1037
  if (!(n != null && n.dryRun) && ((b = (f = d.effects) == null ? void 0 : f.status) == null ? void 0 : b.status) === "success") {
@@ -1097,7 +1103,7 @@ class Re extends R {
1097
1103
  * @param options Optional dry run
1098
1104
  */
1099
1105
  async stake(e, a) {
1100
- var r, o, u;
1106
+ var l, o, u;
1101
1107
  if (!this.walletClient)
1102
1108
  throw new Error("Wallet client not found");
1103
1109
  const t = new w();
@@ -1107,11 +1113,11 @@ class Re extends R {
1107
1113
  useGasCoin: !0
1108
1114
  }), c = await this.stakePTB(t, n);
1109
1115
  t.transferObjects([c], this.walletClient.address);
1110
- const l = await this.walletClient.signExecuteTransaction({
1116
+ const i = await this.walletClient.signExecuteTransaction({
1111
1117
  transaction: t,
1112
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1118
+ dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1113
1119
  });
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;
1120
+ return !(a != null && a.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:stake-success", { suiAmount: e }), this.walletClient.module("balance").updatePortfolio()), i;
1115
1121
  }
1116
1122
  /**
1117
1123
  * Unstake haSUI for SUI
@@ -1120,7 +1126,7 @@ class Re extends R {
1120
1126
  * @param options Optional dry run
1121
1127
  */
1122
1128
  async unstake(e, a) {
1123
- var r, o, u;
1129
+ var l, o, u;
1124
1130
  if (!this.walletClient)
1125
1131
  throw new Error("Wallet client not found");
1126
1132
  await this.walletClient.module("balance").waitForUpdate();
@@ -1128,11 +1134,11 @@ class Re extends R {
1128
1134
  balance: e
1129
1135
  }), c = await this.unstakePTB(t, n);
1130
1136
  t.transferObjects([c], this.walletClient.address);
1131
- const l = await this.walletClient.signExecuteTransaction({
1137
+ const i = await this.walletClient.signExecuteTransaction({
1132
1138
  transaction: t,
1133
- dryRun: (r = a == null ? void 0 : a.dryRun) != null ? r : !1
1139
+ dryRun: (l = a == null ? void 0 : a.dryRun) != null ? l : !1
1134
1140
  });
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;
1141
+ return !(a != null && a.dryRun) && ((u = (o = i.effects) == null ? void 0 : o.status) == null ? void 0 : u.status) === "success" && (this.emit("haedal:unstake-success", { haSUIAmount: e }), this.walletClient.module("balance").updatePortfolio()), i;
1136
1142
  }
1137
1143
  }
1138
1144
  const Se = {