@streamflow/staking 8.0.1 → 8.0.2-alpha.p287.a3616ff

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.
@@ -2449,8 +2449,16 @@ var SolanaStakingClient = class {
2449
2449
  return feeManagerProgram.account.feeValue.fetchNullable(feeValueKey);
2450
2450
  }
2451
2451
  async createStakePool(data, extParams) {
2452
- const { ixs, publicKey } = await this.prepareCreateStakePoolInstructions(data, extParams);
2453
- const { signature } = await this.execute(ixs, extParams);
2452
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2453
+ const { ixs, publicKey } = await solana.createAndEstimateTransaction(
2454
+ async (params) => this.prepareCreateStakePoolInstructions(data, params).then((res) => ({
2455
+ ixs: solana.prepareBaseInstructions(this.connection, params).concat(res.ixs),
2456
+ publicKey: res.publicKey
2457
+ })),
2458
+ executionParams,
2459
+ (res) => res.ixs
2460
+ );
2461
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2454
2462
  return {
2455
2463
  ixs,
2456
2464
  txId: signature,
@@ -2480,8 +2488,14 @@ var SolanaStakingClient = class {
2480
2488
  return { ixs: [createInstruction], publicKey: stakePoolPDA };
2481
2489
  }
2482
2490
  async stake(data, extParams) {
2483
- const { ixs } = await this.prepareStakeInstructions(data, extParams);
2484
- const { signature } = await this.execute(ixs, extParams);
2491
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2492
+ const ixs = await solana.createAndEstimateTransaction(
2493
+ (params) => this.prepareStakeInstructions(data, params).then(
2494
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2495
+ ),
2496
+ executionParams
2497
+ );
2498
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2485
2499
  return {
2486
2500
  ixs,
2487
2501
  txId: signature
@@ -2505,8 +2519,14 @@ var SolanaStakingClient = class {
2505
2519
  return { ixs: [instruction] };
2506
2520
  }
2507
2521
  async unstake(data, extParams) {
2508
- const { ixs } = await this.prepareUnstakeInstructions(data, extParams);
2509
- const { signature } = await this.execute(ixs, extParams);
2522
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2523
+ const ixs = await solana.createAndEstimateTransaction(
2524
+ (params) => this.prepareUnstakeInstructions(data, params).then(
2525
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2526
+ ),
2527
+ executionParams
2528
+ );
2529
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2510
2530
  return {
2511
2531
  ixs,
2512
2532
  txId: signature
@@ -2530,8 +2550,16 @@ var SolanaStakingClient = class {
2530
2550
  return { ixs: [instruction] };
2531
2551
  }
2532
2552
  async createRewardPool(data, extParams) {
2533
- const { ixs, publicKey } = await this.prepareCreateRewardPoolInstructions(data, extParams);
2534
- const { signature } = await this.execute(ixs, extParams);
2553
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2554
+ const { ixs, publicKey } = await solana.createAndEstimateTransaction(
2555
+ async (params) => this.prepareCreateRewardPoolInstructions(data, params).then((res) => ({
2556
+ ixs: solana.prepareBaseInstructions(this.connection, params).concat(res.ixs),
2557
+ publicKey: res.publicKey
2558
+ })),
2559
+ executionParams,
2560
+ (res) => res.ixs
2561
+ );
2562
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2535
2563
  return {
2536
2564
  ixs,
2537
2565
  txId: signature,
@@ -2561,8 +2589,14 @@ var SolanaStakingClient = class {
2561
2589
  return { publicKey: rewardPoolKey, ixs: [instruction] };
2562
2590
  }
2563
2591
  async claimRewards(data, extParams) {
2564
- const { ixs } = await this.prepareClaimRewardsInstructions(data, extParams);
2565
- const { signature } = await this.execute(ixs, extParams);
2592
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2593
+ const ixs = await solana.createAndEstimateTransaction(
2594
+ (params) => this.prepareClaimRewardsInstructions(data, params).then(
2595
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2596
+ ),
2597
+ executionParams
2598
+ );
2599
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2566
2600
  return {
2567
2601
  ixs,
2568
2602
  txId: signature
@@ -2582,8 +2616,14 @@ var SolanaStakingClient = class {
2582
2616
  return { ixs: [instruction] };
2583
2617
  }
2584
2618
  async fundPool(data, extParams) {
2585
- const { ixs } = await this.prepareFundPoolInstructions(data, extParams);
2586
- const { signature } = await this.execute(ixs, extParams);
2619
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2620
+ const ixs = await solana.createAndEstimateTransaction(
2621
+ (params) => this.prepareFundPoolInstructions(data, params).then(
2622
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2623
+ ),
2624
+ executionParams
2625
+ );
2626
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2587
2627
  return {
2588
2628
  ixs,
2589
2629
  txId: signature
@@ -2616,8 +2656,13 @@ var SolanaStakingClient = class {
2616
2656
  return { ixs: treasuryATA ? treasuryATA.concat([instruction]) : [instruction] };
2617
2657
  }
2618
2658
  async createRewardEntry(data, extParams) {
2619
- const { ixs } = await this.prepareCreateRewardEntryInstructions(data, extParams);
2620
- const { signature } = await this.execute(ixs, extParams);
2659
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2660
+ const ixs = await solana.createAndEstimateTransaction(async (params) => {
2661
+ return this.prepareCreateRewardEntryInstructions(data, params).then(
2662
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2663
+ );
2664
+ }, executionParams);
2665
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2621
2666
  return {
2622
2667
  ixs,
2623
2668
  txId: signature
@@ -2636,8 +2681,13 @@ var SolanaStakingClient = class {
2636
2681
  return { ixs: [instruction] };
2637
2682
  }
2638
2683
  async updateRewardPool(data, extParams) {
2639
- const { ixs } = await this.prepareUpdateRewardPoolInstructions(data, extParams);
2640
- const { signature } = await this.execute(ixs, extParams);
2684
+ const executionParams = solana.unwrapExecutionParams(extParams, this.connection);
2685
+ const ixs = await solana.createAndEstimateTransaction(async (params) => {
2686
+ return this.prepareUpdateRewardPoolInstructions(data, params).then(
2687
+ (res) => solana.prepareBaseInstructions(this.connection, params).concat(res.ixs)
2688
+ );
2689
+ }, executionParams);
2690
+ const { signature } = await this.execute(ixs, extParams.invoker, executionParams.skipSimulation);
2641
2691
  return {
2642
2692
  ixs,
2643
2693
  txId: signature
@@ -2669,23 +2719,19 @@ var SolanaStakingClient = class {
2669
2719
  );
2670
2720
  return accountEntity.discriminator;
2671
2721
  }
2672
- async execute(ixs, extParams) {
2673
- const { tx, hash, context } = await solana.prepareTransaction(
2674
- this.connection,
2675
- solana.prepareBaseInstructions(this.connection, extParams).concat(ixs),
2676
- extParams.invoker.publicKey
2677
- );
2722
+ async execute(ixs, invoker, skipSimulation = false) {
2723
+ const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker.publicKey);
2678
2724
  try {
2679
2725
  const signature = await solana.signAndExecuteTransaction(
2680
2726
  this.connection,
2681
- extParams.invoker,
2727
+ invoker,
2682
2728
  tx,
2683
2729
  {
2684
2730
  hash,
2685
2731
  context,
2686
2732
  commitment: this.getCommitment()
2687
2733
  },
2688
- { sendThrottler: this.sendThrottler }
2734
+ { sendThrottler: this.sendThrottler, skipSimulation }
2689
2735
  );
2690
2736
  return { signature };
2691
2737
  } catch (err) {