@solana/web3.js 1.92.0 → 1.92.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.cjs.js CHANGED
@@ -2162,15 +2162,15 @@ class SendTransactionError extends Error {
2162
2162
  action,
2163
2163
  signature,
2164
2164
  transactionMessage,
2165
- transactionLogs
2165
+ logs: logs
2166
2166
  }) {
2167
2167
  let message;
2168
2168
  switch (action) {
2169
2169
  case 'send':
2170
- message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + (transactionLogs ? `Logs: \n${JSON.stringify(transactionLogs.slice(-10), null, 2)}. ` : '') + '\nCatch the SendTransactionError and call `getLogs()` on it for full details.';
2170
+ message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + (logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '') + '\nCatch the SendTransactionError and call `getLogs()` on it for full details.';
2171
2171
  break;
2172
2172
  case 'simulate':
2173
- message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + (transactionLogs ? `Logs: \n${JSON.stringify(transactionLogs.slice(-10), null, 2)}. ` : '') + '\nCatch the SendTransactionError and call `getLogs()` on it for full details.';
2173
+ message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + (logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '') + '\nCatch the SendTransactionError and call `getLogs()` on it for full details.';
2174
2174
  break;
2175
2175
  default:
2176
2176
  message = 'Unknown action';
@@ -2178,27 +2178,24 @@ class SendTransactionError extends Error {
2178
2178
  super(message);
2179
2179
  this.signature = void 0;
2180
2180
  this.transactionMessage = void 0;
2181
- this.transactionLogs = void 0;
2182
- this.resolvedLogs = void 0;
2181
+ this.logs = void 0;
2183
2182
  this.signature = signature;
2184
2183
  this.transactionMessage = transactionMessage;
2185
- this.transactionLogs = transactionLogs;
2186
- this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
2184
+ this.logs = logs ? logs : undefined;
2187
2185
  }
2188
2186
  get transactionError() {
2189
2187
  return {
2190
2188
  message: this.transactionMessage,
2191
- logs: this.transactionLogs
2189
+ logs: Array.isArray(this.logs) ? this.logs : undefined
2192
2190
  };
2193
2191
  }
2194
2192
  async getLogs(connection) {
2195
- if (this.resolvedLogs === undefined) {
2196
- this.resolvedLogs = new Promise((resolve, reject) => {
2193
+ if (!Array.isArray(this.logs)) {
2194
+ this.logs = new Promise((resolve, reject) => {
2197
2195
  connection.getTransaction(this.signature).then(tx => {
2198
2196
  if (tx && tx.meta && tx.meta.logMessages) {
2199
2197
  const logs = tx.meta.logMessages;
2200
- this.resolvedLogs = logs;
2201
- this.transactionLogs = logs;
2198
+ this.logs = logs;
2202
2199
  resolve(logs);
2203
2200
  } else {
2204
2201
  reject(new Error('Log messages not found'));
@@ -2206,7 +2203,7 @@ class SendTransactionError extends Error {
2206
2203
  }).catch(reject);
2207
2204
  });
2208
2205
  }
2209
- return await this.resolvedLogs;
2206
+ return await this.logs;
2210
2207
  }
2211
2208
  }
2212
2209
 
@@ -7998,7 +7995,7 @@ class Connection {
7998
7995
  action: 'simulate',
7999
7996
  signature: '',
8000
7997
  transactionMessage: res.error.message,
8001
- transactionLogs: logs
7998
+ logs: logs
8002
7999
  });
8003
8000
  }
8004
8001
  return res.result;
@@ -8108,7 +8105,7 @@ class Connection {
8108
8105
  action: skipPreflight ? 'send' : 'simulate',
8109
8106
  signature: '',
8110
8107
  transactionMessage: res.error.message,
8111
- transactionLogs: logs
8108
+ logs: logs
8112
8109
  });
8113
8110
  }
8114
8111
  return res.result;