@streamflow/common 6.2.0 → 6.2.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.
@@ -1,6 +1,6 @@
1
1
  import { Mint } from "@solana/spl-token";
2
2
  import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
3
- import { BlockhashWithExpiryBlockHeight, Commitment, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, SignatureStatus, VersionedTransaction, Context } from "@solana/web3.js";
3
+ import { BlockhashWithExpiryBlockHeight, Commitment, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, SignatureStatus, VersionedTransaction, Context, RpcResponseAndContext, SimulatedTransactionResponse } from "@solana/web3.js";
4
4
  import { Account, AtaParams, ConfirmationParams, ITransactionSolanaExt } from "./types";
5
5
  /**
6
6
  * Wrapper function for Solana web3 getProgramAccounts with slightly better call interface
@@ -78,7 +78,7 @@ export declare function executeTransaction(connection: Connection, tx: Transacti
78
78
  * @param commitment - optional commitment that will be used for simulation and confirmation
79
79
  */
80
80
  export declare function sendAndConfirmTransaction(connection: Connection, tx: Transaction | VersionedTransaction, { hash, context, commitment }: ConfirmationParams): Promise<string>;
81
- export declare function simulateTransaction(connection: Connection, tx: Transaction | VersionedTransaction): Promise<void>;
81
+ export declare function simulateTransaction(connection: Connection, tx: Transaction | VersionedTransaction): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
82
82
  /**
83
83
  * Confirms and validates transaction success once
84
84
  * @param connection - Solana client connection
@@ -327,7 +327,7 @@ function sendAndConfirmTransaction(connection, tx, _a) {
327
327
  exports.sendAndConfirmTransaction = sendAndConfirmTransaction;
328
328
  function simulateTransaction(connection, tx) {
329
329
  return __awaiter(this, void 0, void 0, function () {
330
- var i, res, errMessage;
330
+ var res, i, errMessage;
331
331
  return __generator(this, function (_a) {
332
332
  switch (_a.label) {
333
333
  case 0:
@@ -335,7 +335,6 @@ function simulateTransaction(connection, tx) {
335
335
  _a.label = 1;
336
336
  case 1:
337
337
  if (!(i < SIMULATE_TRIES)) return [3 /*break*/, 7];
338
- res = void 0;
339
338
  if (!isTransactionVersioned(tx)) return [3 /*break*/, 3];
340
339
  return [4 /*yield*/, connection.simulateTransaction(tx)];
341
340
  case 2:
@@ -351,12 +350,13 @@ function simulateTransaction(connection, tx) {
351
350
  if (!errMessage.includes("BlockhashNotFound") || i === SIMULATE_TRIES - 1) {
352
351
  throw new web3_js_1.SendTransactionError("failed to simulate transaction: " + errMessage, res.value.logs || undefined);
353
352
  }
353
+ return [3 /*break*/, 6];
354
354
  }
355
- return [3 /*break*/, 7];
355
+ return [2 /*return*/, res];
356
356
  case 6:
357
357
  i++;
358
358
  return [3 /*break*/, 1];
359
- case 7: return [2 /*return*/];
359
+ case 7: throw new web3_js_1.SendTransactionError("failed to simulate transaction");
360
360
  }
361
361
  });
362
362
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/common",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "Common utilities and types used by streamflow packages.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "lint-config": "eslint --print-config",
24
24
  "prepublishOnly": "npm run lint && npm run build"
25
25
  },
26
- "gitHead": "06f6635b47854013b63db62e9da401b4f004bfdc",
26
+ "gitHead": "bd8cb2daf52fbc3c618c1c7f27d300e98f15d264",
27
27
  "devDependencies": {
28
28
  "@streamflow/eslint-config": "6.0.0",
29
29
  "@types/bn.js": "5.1.1",