@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.
@@ -2154,15 +2154,15 @@ class SendTransactionError extends Error {
2154
2154
  action,
2155
2155
  signature,
2156
2156
  transactionMessage,
2157
- transactionLogs
2157
+ logs: logs
2158
2158
  }) {
2159
2159
  let message;
2160
2160
  switch (action) {
2161
2161
  case 'send':
2162
- 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.';
2162
+ 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.';
2163
2163
  break;
2164
2164
  case 'simulate':
2165
- 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.';
2165
+ 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.';
2166
2166
  break;
2167
2167
  default:
2168
2168
  message = 'Unknown action';
@@ -2170,27 +2170,24 @@ class SendTransactionError extends Error {
2170
2170
  super(message);
2171
2171
  this.signature = void 0;
2172
2172
  this.transactionMessage = void 0;
2173
- this.transactionLogs = void 0;
2174
- this.resolvedLogs = void 0;
2173
+ this.logs = void 0;
2175
2174
  this.signature = signature;
2176
2175
  this.transactionMessage = transactionMessage;
2177
- this.transactionLogs = transactionLogs;
2178
- this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
2176
+ this.logs = logs ? logs : undefined;
2179
2177
  }
2180
2178
  get transactionError() {
2181
2179
  return {
2182
2180
  message: this.transactionMessage,
2183
- logs: this.transactionLogs
2181
+ logs: Array.isArray(this.logs) ? this.logs : undefined
2184
2182
  };
2185
2183
  }
2186
2184
  async getLogs(connection) {
2187
- if (this.resolvedLogs === undefined) {
2188
- this.resolvedLogs = new Promise((resolve, reject) => {
2185
+ if (!Array.isArray(this.logs)) {
2186
+ this.logs = new Promise((resolve, reject) => {
2189
2187
  connection.getTransaction(this.signature).then(tx => {
2190
2188
  if (tx && tx.meta && tx.meta.logMessages) {
2191
2189
  const logs = tx.meta.logMessages;
2192
- this.resolvedLogs = logs;
2193
- this.transactionLogs = logs;
2190
+ this.logs = logs;
2194
2191
  resolve(logs);
2195
2192
  } else {
2196
2193
  reject(new Error('Log messages not found'));
@@ -2198,7 +2195,7 @@ class SendTransactionError extends Error {
2198
2195
  }).catch(reject);
2199
2196
  });
2200
2197
  }
2201
- return await this.resolvedLogs;
2198
+ return await this.logs;
2202
2199
  }
2203
2200
  }
2204
2201
 
@@ -7301,7 +7298,7 @@ class Connection {
7301
7298
  action: 'simulate',
7302
7299
  signature: '',
7303
7300
  transactionMessage: res.error.message,
7304
- transactionLogs: logs
7301
+ logs: logs
7305
7302
  });
7306
7303
  }
7307
7304
  return res.result;
@@ -7411,7 +7408,7 @@ class Connection {
7411
7408
  action: skipPreflight ? 'send' : 'simulate',
7412
7409
  signature: '',
7413
7410
  transactionMessage: res.error.message,
7414
- transactionLogs: logs
7411
+ logs: logs
7415
7412
  });
7416
7413
  }
7417
7414
  return res.result;