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