@naviprotocol/wallet-client 1.0.3-dev.1 → 1.0.3-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
@@ -333,7 +333,13 @@ async function D(r, e, a, t) {
333
333
  throw new Error("Wallet client not found");
334
334
  await this.walletClient.balance.waitForUpdate();
335
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
- if (!l || l.supplyBalance === "0")
336
+ if (console.log("migrateBetweenSupplyPTB", {
337
+ lendingState: c,
338
+ fromPoolLending: l,
339
+ fromPool: s,
340
+ toPool: n,
341
+ address: i
342
+ }), !l || l.supplyBalance === "0")
337
343
  throw new Error("No supply balance");
338
344
  if (t != null && t.amount && t.amount > Number(l.supplyBalance))
339
345
  throw new Error("Amount is less than supply balance");
@@ -348,15 +354,7 @@ async function D(r, e, a, t) {
348
354
  const d = await V(n, {
349
355
  env: this.config.env
350
356
  });
351
- if (console.log("migrateBetweenSupplyPTB", {
352
- toPool: n,
353
- toPoolFlashloanAsset: d,
354
- fromPool: s,
355
- fromPoolLending: l,
356
- options: t,
357
- from: e,
358
- to: a
359
- }), !d)
357
+ if (!d)
360
358
  throw new Error(`${n.token.symbol} pool not support flashloan`);
361
359
  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
360
  s.suiCoinType,
@@ -399,7 +397,13 @@ async function J(r, e, a, t) {
399
397
  throw new Error("Wallet client not found");
400
398
  await this.walletClient.balance.waitForUpdate();
401
399
  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")
400
+ if (console.log("migrateBetweenBorrowPTB", {
401
+ lendingState: l,
402
+ fromPoolLending: i,
403
+ fromPool: n,
404
+ toPool: c,
405
+ address: s
406
+ }), !i || i.borrowBalance === "0")
403
407
  throw new Error("No borrow balance");
404
408
  if (t != null && t.amount && t.amount > Number(i.borrowBalance))
405
409
  throw new Error("Amount is less than borrow balance");
@@ -425,16 +429,6 @@ async function J(r, e, a, t) {
425
429
  throw new Error(`${n.token.symbol} pool not support flashloan`);
426
430
  if (!this.walletClient)
427
431
  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
- });
438
432
  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(
439
433
  n.suiCoinType,
440
434
  c.suiCoinType,