@wireio/stake 1.0.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireio/stake",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "LIQ Staking Module for Wire Network",
5
5
  "homepage": "https://gitea.gitgo.app/Wire/sdk-stake",
6
6
  "license": "FSL-1.1-Apache-2.0",
@@ -208,14 +208,18 @@ export class SolanaStakingClient implements IStakingClient {
208
208
  }
209
209
 
210
210
  try {
211
- const tx = await this.depositClient.buildDepositTx(amountLamports);
212
- const { tx: prepared, blockhash, lastValidBlockHeight } =
213
- await this.prepareTx(tx);
214
- const signed = await this.signTransaction(prepared);
215
- return await this.sendAndConfirmHttp(signed, {
216
- blockhash,
217
- lastValidBlockHeight,
218
- });
211
+ // Build compute budget increase instruction
212
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 400_000 });
213
+
214
+ // Build the Outpost synd instruction
215
+ const ix = await this.depositClient.buildDepositTx(amountLamports);
216
+
217
+ // Wrap in a transaction and send
218
+ const tx = new Transaction().add(cuIx, ix);
219
+ const prepared = await this.prepareTx(tx);
220
+ const signed = await this.signTransaction(prepared.tx);
221
+
222
+ return this.sendAndConfirmHttp(signed, prepared);
219
223
  } catch (err) {
220
224
  throw new Error(`Failed to deposit Solana: ${err}`);
221
225
  }
@@ -238,14 +242,18 @@ export class SolanaStakingClient implements IStakingClient {
238
242
  }
239
243
 
240
244
  try {
241
- const tx = await this.depositClient.buildWithdrawTx(amountLamports);
242
- const { tx: prepared, blockhash, lastValidBlockHeight } =
243
- await this.prepareTx(tx);
244
- const signed = await this.signTransaction(prepared);
245
- return await this.sendAndConfirmHttp(signed, {
246
- blockhash,
247
- lastValidBlockHeight,
248
- });
245
+ // Build compute budget increase instruction
246
+ const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 400_000 });
247
+
248
+ // Build the Outpost synd instruction
249
+ const ix = await this.depositClient.buildWithdrawTx(amountLamports);
250
+
251
+ // Wrap in a transaction and send
252
+ const tx = new Transaction().add(cuIx, ix);
253
+ const prepared = await this.prepareTx(tx);
254
+ const signed = await this.signTransaction(prepared.tx);
255
+
256
+ return this.sendAndConfirmHttp(signed, prepared);
249
257
  } catch (err) {
250
258
  throw new Error(`Failed to withdraw Solana: ${err}`);
251
259
  }
@@ -328,14 +336,12 @@ export class SolanaStakingClient implements IStakingClient {
328
336
  const user = this.solPubKey;
329
337
  const cuIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 400_000 });
330
338
  const ix = await this.tokenClient.buildPurchaseIx(amountLamports, user);
339
+
331
340
  const tx = new Transaction().add(cuIx, ix);
332
- const { tx: prepared, blockhash, lastValidBlockHeight } =
333
- await this.prepareTx(tx);
334
- const signed = await this.signTransaction(prepared);
335
- return await this.sendAndConfirmHttp(signed, {
336
- blockhash,
337
- lastValidBlockHeight,
338
- });
341
+ const prepared = await this.prepareTx(tx);
342
+ const signed = await this.signTransaction(prepared.tx);
343
+
344
+ return this.sendAndConfirmHttp(signed, prepared);
339
345
  }
340
346
  catch (err) {
341
347
  throw new Error(`Failed to buy liqSOL pretokens: ${err}`);