@haven-fi/solauto-sdk 1.0.107 → 1.0.109

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.
@@ -42,13 +42,13 @@ class SolautoClient extends txHandler_1.TxHandler {
42
42
  this.solautoPositionData = await (0, generated_1.safeFetchSolautoPosition)(this.umi, (0, umi_1.publicKey)(this.solautoPosition));
43
43
  this.solautoPositionState = this.solautoPositionData?.state;
44
44
  this.supplyMint =
45
- args.supplyMint ??
46
- (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.supplyMint);
45
+ (args.supplyMint ??
46
+ this.solautoPositionData) ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.supplyMint) : web3_js_1.PublicKey.default;
47
47
  this.positionSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.supplyMint);
48
48
  this.signerSupplyTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.supplyMint);
49
49
  this.debtMint =
50
- args.debtMint ??
51
- (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.debtMint);
50
+ (args.debtMint ??
51
+ this.solautoPositionData) ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.debtMint) : web3_js_1.PublicKey.default;
52
52
  this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
53
53
  this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
54
54
  this.referralStateManager = new referralStateManager_1.ReferralStateManager(this.heliusApiKey);
@@ -167,9 +167,9 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, simulateOnly,
167
167
  const result = await assembleFinalTransaction(umi.identity, tx, feeEstimate, 800000).sendAndConfirm(umi, {
168
168
  send: {
169
169
  skipPreflight: true,
170
- commitment: "finalized",
170
+ commitment: "confirmed",
171
171
  },
172
- confirm: { commitment: "finalized" },
172
+ confirm: { commitment: "confirmed" },
173
173
  });
174
174
  console.log(`https://solscan.io/tx/${bs58_1.default.encode(result.signature)}`);
175
175
  if (result.result.value.err !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -144,7 +144,7 @@ export abstract class SolautoClient extends TxHandler {
144
144
 
145
145
  this.supplyMint =
146
146
  args.supplyMint ??
147
- toWeb3JsPublicKey(this.solautoPositionData!.position.supplyMint);
147
+ this.solautoPositionData ? toWeb3JsPublicKey(this.solautoPositionData!.position.supplyMint) : PublicKey.default;
148
148
  this.positionSupplyTa = getTokenAccount(
149
149
  this.solautoPosition,
150
150
  this.supplyMint
@@ -156,7 +156,7 @@ export abstract class SolautoClient extends TxHandler {
156
156
 
157
157
  this.debtMint =
158
158
  args.debtMint ??
159
- toWeb3JsPublicKey(this.solautoPositionData!.position.debtMint);
159
+ this.solautoPositionData ? toWeb3JsPublicKey(this.solautoPositionData!.position.debtMint) : PublicKey.default;
160
160
  this.positionDebtTa = getTokenAccount(this.solautoPosition, this.debtMint);
161
161
  this.signerDebtTa = getTokenAccount(
162
162
  toWeb3JsPublicKey(this.signer.publicKey),
@@ -321,9 +321,9 @@ export async function sendSingleOptimizedTransaction(
321
321
  ).sendAndConfirm(umi, {
322
322
  send: {
323
323
  skipPreflight: true,
324
- commitment: "finalized",
324
+ commitment: "confirmed",
325
325
  },
326
- confirm: { commitment: "finalized" },
326
+ confirm: { commitment: "confirmed" },
327
327
  });
328
328
  console.log(`https://solscan.io/tx/${bs58.encode(result.signature)}`);
329
329
  if (result.result.value.err !== null) {