@drift-labs/vaults-sdk 0.1.190 → 0.1.191

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.
@@ -681,7 +681,7 @@ class VaultClient {
681
681
  * Used for UI wallet adapters compatibility
682
682
  */
683
683
  async createAndSendTxn(vaultIxs, txParams) {
684
- var _a, _b;
684
+ var _a, _b, _c;
685
685
  const ixs = [
686
686
  web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({
687
687
  units: (_a = txParams === null || txParams === void 0 ? void 0 : txParams.cuLimit) !== null && _a !== void 0 ? _a : 400000,
@@ -691,15 +691,20 @@ class VaultClient {
691
691
  }),
692
692
  ...vaultIxs,
693
693
  ];
694
- const tx = await this.driftClient.txSender.getVersionedTransaction(ixs, [], undefined, undefined);
694
+ const tx = await this.driftClient.txSender.getVersionedTransaction(ixs, [], undefined, this.driftClient.opts);
695
695
  let txSig = bytes_1.bs58.encode(tx.signatures[0]);
696
696
  if (txParams === null || txParams === void 0 ? void 0 : txParams.simulateTransaction) {
697
- const resp = await this.driftClient.connection.simulateTransaction(tx, {
698
- // replaceRecentBlockhash: true,
699
- sigVerify: false,
700
- commitment: this.driftClient.connection.commitment,
701
- });
702
- console.log(`Simulated transaction:\n${JSON.stringify(resp, null, 2)}`);
697
+ try {
698
+ const resp = await this.driftClient.connection.simulateTransaction(tx, {
699
+ sigVerify: false,
700
+ commitment: this.driftClient.connection.commitment,
701
+ });
702
+ console.log(`Simulated transaction:\n${JSON.stringify(resp, null, 2)}`);
703
+ }
704
+ catch (e) {
705
+ const err = e;
706
+ console.error(`Error simulating transaction: ${err.message}\n:${(_c = err.stack) !== null && _c !== void 0 ? _c : ''}`);
707
+ }
703
708
  }
704
709
  else {
705
710
  const resp = await this.driftClient.sendTransaction(tx, [], this.driftClient.opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.1.190",
3
+ "version": "0.1.191",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -1064,17 +1064,23 @@ export class VaultClient {
1064
1064
  ixs,
1065
1065
  [],
1066
1066
  undefined,
1067
- undefined
1067
+ this.driftClient.opts
1068
1068
  );
1069
1069
 
1070
1070
  let txSig = bs58.encode(tx.signatures[0]);
1071
1071
  if (txParams?.simulateTransaction) {
1072
- const resp = await this.driftClient.connection.simulateTransaction(tx, {
1073
- // replaceRecentBlockhash: true,
1074
- sigVerify: false,
1075
- commitment: this.driftClient.connection.commitment,
1076
- });
1077
- console.log(`Simulated transaction:\n${JSON.stringify(resp, null, 2)}`);
1072
+ try {
1073
+ const resp = await this.driftClient.connection.simulateTransaction(tx, {
1074
+ sigVerify: false,
1075
+ commitment: this.driftClient.connection.commitment,
1076
+ });
1077
+ console.log(`Simulated transaction:\n${JSON.stringify(resp, null, 2)}`);
1078
+ } catch (e) {
1079
+ const err = e as Error;
1080
+ console.error(
1081
+ `Error simulating transaction: ${err.message}\n:${err.stack ?? ''}`
1082
+ );
1083
+ }
1078
1084
  } else {
1079
1085
  const resp = await this.driftClient.sendTransaction(
1080
1086
  tx,