@pyron-finance/pyron-client 2.8.1 → 2.8.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.cjs CHANGED
@@ -23312,14 +23312,19 @@ var BankConfig = class _BankConfig {
23312
23312
  };
23313
23313
 
23314
23314
  // src/models/account/pure.ts
23315
- function makeSessionWrapSolIxs(walletAddress, sessionKey, payer, amount, existingBalance) {
23316
- const nativeAmount = uiToNative(amount, 9).toNumber();
23317
- const TOKEN_ACCOUNT_RENT_EXEMPT = 2039280;
23318
- const existingBalanceNative = existingBalance ? uiToNative(existingBalance, 9).toNumber() : 0;
23319
- let totalAmount = nativeAmount;
23320
- if (existingBalanceNative < TOKEN_ACCOUNT_RENT_EXEMPT) {
23321
- const rentNeeded = Math.max(0, TOKEN_ACCOUNT_RENT_EXEMPT - existingBalanceNative);
23322
- totalAmount = nativeAmount + rentNeeded;
23315
+ var TOKEN_ACCOUNT_RENT_EXEMPT = 2039280;
23316
+ function makeSessionWrapSolIxs(walletAddress, sessionKey, amount, options) {
23317
+ let totalAmount;
23318
+ if (options?.wrapAmountUi !== void 0) {
23319
+ totalAmount = uiToNative(options.wrapAmountUi, 9).toNumber();
23320
+ } else {
23321
+ const nativeAmount = uiToNative(amount, 9).toNumber();
23322
+ const existingBalanceNative = options?.existingBalance ? uiToNative(options.existingBalance, 9).toNumber() : 0;
23323
+ totalAmount = nativeAmount;
23324
+ if (existingBalanceNative < TOKEN_ACCOUNT_RENT_EXEMPT) {
23325
+ const rentNeeded = Math.max(0, TOKEN_ACCOUNT_RENT_EXEMPT - existingBalanceNative);
23326
+ totalAmount = nativeAmount + rentNeeded;
23327
+ }
23323
23328
  }
23324
23329
  return (0, import_sessions_sdk.createSessionWrapInstructions)(sessionKey, walletAddress, BigInt(totalAmount));
23325
23330
  }
@@ -23859,10 +23864,8 @@ var LendrAccount = class _LendrAccount {
23859
23864
  const wrapIxs = makeSessionWrapSolIxs(
23860
23865
  session.walletPublicKey,
23861
23866
  session.sessionPublicKey,
23862
- session.payer,
23863
23867
  wrapAmount,
23864
- wSolBalanceUi
23865
- // Pass existing balance to calculate rent correctly
23868
+ { existingBalance: wSolBalanceUi }
23866
23869
  );
23867
23870
  depositIxs.push(...wrapIxs);
23868
23871
  }
@@ -23977,17 +23980,15 @@ var LendrAccount = class _LendrAccount {
23977
23980
  );
23978
23981
  if (bank.mint.equals(import_spl_token6.NATIVE_MINT)) {
23979
23982
  const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
23980
- let wrapAmount = new import_bignumber14.default(amount).minus(wSolBalanceUi);
23981
- if (repayAll) {
23982
- wrapAmount = wrapAmount.plus(96071e-8);
23983
- }
23983
+ const neededAmount = new import_bignumber14.default(amount).minus(wSolBalanceUi);
23984
23984
  const wrapIxs = makeSessionWrapSolIxs(
23985
23985
  session.walletPublicKey,
23986
23986
  session.sessionPublicKey,
23987
- session.payer,
23988
- wrapAmount,
23989
- wSolBalanceUi
23990
- // Pass existing balance to calculate rent correctly
23987
+ neededAmount,
23988
+ {
23989
+ existingBalance: wSolBalanceUi,
23990
+ wrapAmountUi: opts.wrapAmountUi
23991
+ }
23991
23992
  );
23992
23993
  repayIxs.push(...wrapIxs);
23993
23994
  }
package/dist/index.d.cts CHANGED
@@ -448,6 +448,7 @@ interface MakeDepositWithSessionIxOpts extends MakeDepositIxOpts {
448
448
  interface MakeRepayIxOpts {
449
449
  wrapAndUnwrapSol?: boolean;
450
450
  wSolBalanceUi?: number;
451
+ wrapAmountUi?: number;
451
452
  overrideInferAccounts?: {
452
453
  group?: PublicKey;
453
454
  authority?: PublicKey;
package/dist/index.d.ts CHANGED
@@ -448,6 +448,7 @@ interface MakeDepositWithSessionIxOpts extends MakeDepositIxOpts {
448
448
  interface MakeRepayIxOpts {
449
449
  wrapAndUnwrapSol?: boolean;
450
450
  wSolBalanceUi?: number;
451
+ wrapAmountUi?: number;
451
452
  overrideInferAccounts?: {
452
453
  group?: PublicKey;
453
454
  authority?: PublicKey;
package/dist/index.js CHANGED
@@ -23135,14 +23135,19 @@ var BankConfig = class _BankConfig {
23135
23135
  };
23136
23136
 
23137
23137
  // src/models/account/pure.ts
23138
- function makeSessionWrapSolIxs(walletAddress, sessionKey, payer, amount, existingBalance) {
23139
- const nativeAmount = uiToNative(amount, 9).toNumber();
23140
- const TOKEN_ACCOUNT_RENT_EXEMPT = 2039280;
23141
- const existingBalanceNative = existingBalance ? uiToNative(existingBalance, 9).toNumber() : 0;
23142
- let totalAmount = nativeAmount;
23143
- if (existingBalanceNative < TOKEN_ACCOUNT_RENT_EXEMPT) {
23144
- const rentNeeded = Math.max(0, TOKEN_ACCOUNT_RENT_EXEMPT - existingBalanceNative);
23145
- totalAmount = nativeAmount + rentNeeded;
23138
+ var TOKEN_ACCOUNT_RENT_EXEMPT = 2039280;
23139
+ function makeSessionWrapSolIxs(walletAddress, sessionKey, amount, options) {
23140
+ let totalAmount;
23141
+ if (options?.wrapAmountUi !== void 0) {
23142
+ totalAmount = uiToNative(options.wrapAmountUi, 9).toNumber();
23143
+ } else {
23144
+ const nativeAmount = uiToNative(amount, 9).toNumber();
23145
+ const existingBalanceNative = options?.existingBalance ? uiToNative(options.existingBalance, 9).toNumber() : 0;
23146
+ totalAmount = nativeAmount;
23147
+ if (existingBalanceNative < TOKEN_ACCOUNT_RENT_EXEMPT) {
23148
+ const rentNeeded = Math.max(0, TOKEN_ACCOUNT_RENT_EXEMPT - existingBalanceNative);
23149
+ totalAmount = nativeAmount + rentNeeded;
23150
+ }
23146
23151
  }
23147
23152
  return createSessionWrapInstructions(sessionKey, walletAddress, BigInt(totalAmount));
23148
23153
  }
@@ -23682,10 +23687,8 @@ var LendrAccount = class _LendrAccount {
23682
23687
  const wrapIxs = makeSessionWrapSolIxs(
23683
23688
  session.walletPublicKey,
23684
23689
  session.sessionPublicKey,
23685
- session.payer,
23686
23690
  wrapAmount,
23687
- wSolBalanceUi
23688
- // Pass existing balance to calculate rent correctly
23691
+ { existingBalance: wSolBalanceUi }
23689
23692
  );
23690
23693
  depositIxs.push(...wrapIxs);
23691
23694
  }
@@ -23800,17 +23803,15 @@ var LendrAccount = class _LendrAccount {
23800
23803
  );
23801
23804
  if (bank.mint.equals(NATIVE_MINT2)) {
23802
23805
  const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
23803
- let wrapAmount = new BigNumber14(amount).minus(wSolBalanceUi);
23804
- if (repayAll) {
23805
- wrapAmount = wrapAmount.plus(96071e-8);
23806
- }
23806
+ const neededAmount = new BigNumber14(amount).minus(wSolBalanceUi);
23807
23807
  const wrapIxs = makeSessionWrapSolIxs(
23808
23808
  session.walletPublicKey,
23809
23809
  session.sessionPublicKey,
23810
- session.payer,
23811
- wrapAmount,
23812
- wSolBalanceUi
23813
- // Pass existing balance to calculate rent correctly
23810
+ neededAmount,
23811
+ {
23812
+ existingBalance: wSolBalanceUi,
23813
+ wrapAmountUi: opts.wrapAmountUi
23814
+ }
23814
23815
  );
23815
23816
  repayIxs.push(...wrapIxs);
23816
23817
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyron-finance/pyron-client",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "keywords": [],
5
5
  "license": "MIT",
6
6
  "type": "module",