@solana/web3.js 1.20.3 → 1.21.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/lib/index.iife.js CHANGED
@@ -17493,6 +17493,17 @@ var solanaWeb3 = (function (exports) {
17493
17493
 
17494
17494
  }
17495
17495
 
17496
+ class SendTransactionError extends Error {
17497
+ constructor(message, logs) {
17498
+ super(message);
17499
+
17500
+ _defineProperty(this, "logs", void 0);
17501
+
17502
+ this.logs = logs;
17503
+ }
17504
+
17505
+ }
17506
+
17496
17507
  // TODO: These constants should be removed in favor of reading them out of a
17497
17508
  // Syscall account
17498
17509
 
@@ -19774,7 +19785,19 @@ var solanaWeb3 = (function (exports) {
19774
19785
  const res = create(unsafeRes, SimulatedTransactionResponseStruct);
19775
19786
 
19776
19787
  if ('error' in res) {
19777
- throw new Error('failed to simulate transaction: ' + res.error.message);
19788
+ let logs;
19789
+
19790
+ if ('data' in res.error) {
19791
+ logs = res.error.data.logs;
19792
+
19793
+ if (logs && Array.isArray(logs)) {
19794
+ const traceIndent = '\n ';
19795
+ const logTrace = traceIndent + logs.join(traceIndent);
19796
+ console.error(res.error.message, logTrace);
19797
+ }
19798
+ }
19799
+
19800
+ throw new SendTransactionError('failed to simulate transaction: ' + res.error.message, logs);
19778
19801
  }
19779
19802
 
19780
19803
  return res.result;
@@ -19856,8 +19879,10 @@ var solanaWeb3 = (function (exports) {
19856
19879
  const res = create(unsafeRes, SendTransactionRpcResult);
19857
19880
 
19858
19881
  if ('error' in res) {
19882
+ let logs;
19883
+
19859
19884
  if ('data' in res.error) {
19860
- const logs = res.error.data.logs;
19885
+ logs = res.error.data.logs;
19861
19886
 
19862
19887
  if (logs && Array.isArray(logs)) {
19863
19888
  const traceIndent = '\n ';
@@ -19866,7 +19891,7 @@ var solanaWeb3 = (function (exports) {
19866
19891
  }
19867
19892
  }
19868
19893
 
19869
- throw new Error('failed to send transaction: ' + res.error.message);
19894
+ throw new SendTransactionError('failed to send transaction: ' + res.error.message, logs);
19870
19895
  }
19871
19896
 
19872
19897
  return res.result;