@streamflow/distributor 8.0.0-alpha.p284.726ba98 → 8.0.0-alpha.p287.39c8818

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.
@@ -1656,9 +1656,9 @@ function getEventAuthorityPda(programId) {
1656
1656
  const seeds = [buffer.Buffer.from("__event_authority")];
1657
1657
  return web3_js.PublicKey.findProgramAddressSync(seeds, programId)[0];
1658
1658
  }
1659
- async function wrappedSignAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams) {
1659
+ async function wrappedSignAndExecuteTransaction(...args) {
1660
1660
  try {
1661
- return await solana.signAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams);
1661
+ return await solana.signAndExecuteTransaction(...args);
1662
1662
  } catch (err) {
1663
1663
  if (err instanceof Error) {
1664
1664
  const parsed = fromTxError(err);
@@ -1774,7 +1774,14 @@ var BaseDistributorClient = class {
1774
1774
  return { distributorPublicKey, ixs };
1775
1775
  }
1776
1776
  async create(data, extParams) {
1777
- const { ixs, distributorPublicKey } = await this.prepareCreateInstructions(data, extParams);
1777
+ const invoker = extParams.invoker.publicKey;
1778
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
1779
+ const executionParams = this.unwrapExecutionParams(extParams);
1780
+ const { ixs, distributorPublicKey } = await solana.createAndEstimateTransaction(
1781
+ (params) => this.prepareCreateInstructions(data, params),
1782
+ executionParams,
1783
+ (q) => q.ixs
1784
+ );
1778
1785
  const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
1779
1786
  const signature = await wrappedSignAndExecuteTransaction(
1780
1787
  this.connection,
@@ -1785,7 +1792,7 @@ var BaseDistributorClient = class {
1785
1792
  context,
1786
1793
  commitment: this.getCommitment()
1787
1794
  },
1788
- { sendThrottler: this.sendThrottler }
1795
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
1789
1796
  );
1790
1797
  return {
1791
1798
  ixs,
@@ -1794,18 +1801,24 @@ var BaseDistributorClient = class {
1794
1801
  };
1795
1802
  }
1796
1803
  async claim(data, extParams) {
1797
- const ixs = await this.prepareClaimInstructions(data, extParams);
1798
- const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
1804
+ const executionParams = this.unwrapExecutionParams(extParams);
1805
+ const invoker = executionParams.invoker.publicKey;
1806
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
1807
+ const ixs = await solana.createAndEstimateTransaction(
1808
+ (params) => this.prepareClaimInstructions(data, params),
1809
+ executionParams
1810
+ );
1811
+ const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker);
1799
1812
  const signature = await wrappedSignAndExecuteTransaction(
1800
1813
  this.connection,
1801
- extParams.invoker,
1814
+ executionParams.invoker,
1802
1815
  tx,
1803
1816
  {
1804
1817
  hash,
1805
1818
  context,
1806
1819
  commitment: this.getCommitment()
1807
1820
  },
1808
- { sendThrottler: this.sendThrottler }
1821
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
1809
1822
  );
1810
1823
  return { ixs, txId: signature };
1811
1824
  }
@@ -1865,18 +1878,24 @@ var BaseDistributorClient = class {
1865
1878
  return ixs;
1866
1879
  }
1867
1880
  async closeClaim(data, extParams) {
1868
- const ixs = await this.prepareCloseClaimInstructions(data, extParams);
1869
- const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
1881
+ const executionParams = this.unwrapExecutionParams(extParams);
1882
+ const invoker = executionParams.invoker.publicKey;
1883
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
1884
+ const ixs = await solana.createAndEstimateTransaction(
1885
+ (params) => this.prepareCloseClaimInstructions(data, params),
1886
+ executionParams
1887
+ );
1888
+ const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker);
1870
1889
  const signature = await wrappedSignAndExecuteTransaction(
1871
1890
  this.connection,
1872
- extParams.invoker,
1891
+ executionParams.invoker,
1873
1892
  tx,
1874
1893
  {
1875
1894
  hash,
1876
1895
  context,
1877
1896
  commitment: this.getCommitment()
1878
1897
  },
1879
- { sendThrottler: this.sendThrottler }
1898
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
1880
1899
  );
1881
1900
  return { ixs, txId: signature };
1882
1901
  }
@@ -1944,18 +1963,24 @@ var BaseDistributorClient = class {
1944
1963
  return ixs;
1945
1964
  }
1946
1965
  async clawback(data, extParams) {
1947
- const ixs = await this.prepareClawbackInstructions(data, extParams);
1948
- const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
1966
+ const executionParams = this.unwrapExecutionParams(extParams);
1967
+ const invoker = executionParams.invoker.publicKey;
1968
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
1969
+ const ixs = await solana.createAndEstimateTransaction(
1970
+ (params) => this.prepareClawbackInstructions(data, params),
1971
+ executionParams
1972
+ );
1973
+ const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker);
1949
1974
  const signature = await wrappedSignAndExecuteTransaction(
1950
1975
  this.connection,
1951
- extParams.invoker,
1976
+ executionParams.invoker,
1952
1977
  tx,
1953
1978
  {
1954
1979
  hash,
1955
1980
  context,
1956
1981
  commitment: this.getCommitment()
1957
1982
  },
1958
- { sendThrottler: this.sendThrottler }
1983
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
1959
1984
  );
1960
1985
  return { ixs, txId: signature };
1961
1986
  }
@@ -2022,6 +2047,9 @@ var BaseDistributorClient = class {
2022
2047
  }
2023
2048
  return args;
2024
2049
  }
2050
+ unwrapExecutionParams(extParams) {
2051
+ return solana.unwrapExecutionParams(extParams, this.connection);
2052
+ }
2025
2053
  };
2026
2054
 
2027
2055
  // solana/clients/SolanaDistributorClient.ts