@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.
@@ -2126,15 +2126,15 @@ class SendTransactionError extends Error {
2126
2126
  action,
2127
2127
  signature,
2128
2128
  transactionMessage,
2129
- transactionLogs
2129
+ logs: logs
2130
2130
  }) {
2131
2131
  let message;
2132
2132
  switch (action) {
2133
2133
  case 'send':
2134
- 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.';
2134
+ 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.';
2135
2135
  break;
2136
2136
  case 'simulate':
2137
- 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.';
2137
+ 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.';
2138
2138
  break;
2139
2139
  default:
2140
2140
  message = 'Unknown action';
@@ -2142,27 +2142,24 @@ class SendTransactionError extends Error {
2142
2142
  super(message);
2143
2143
  this.signature = void 0;
2144
2144
  this.transactionMessage = void 0;
2145
- this.transactionLogs = void 0;
2146
- this.resolvedLogs = void 0;
2145
+ this.logs = void 0;
2147
2146
  this.signature = signature;
2148
2147
  this.transactionMessage = transactionMessage;
2149
- this.transactionLogs = transactionLogs;
2150
- this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
2148
+ this.logs = logs ? logs : undefined;
2151
2149
  }
2152
2150
  get transactionError() {
2153
2151
  return {
2154
2152
  message: this.transactionMessage,
2155
- logs: this.transactionLogs
2153
+ logs: Array.isArray(this.logs) ? this.logs : undefined
2156
2154
  };
2157
2155
  }
2158
2156
  async getLogs(connection) {
2159
- if (this.resolvedLogs === undefined) {
2160
- this.resolvedLogs = new Promise((resolve, reject) => {
2157
+ if (!Array.isArray(this.logs)) {
2158
+ this.logs = new Promise((resolve, reject) => {
2161
2159
  connection.getTransaction(this.signature).then(tx => {
2162
2160
  if (tx && tx.meta && tx.meta.logMessages) {
2163
2161
  const logs = tx.meta.logMessages;
2164
- this.resolvedLogs = logs;
2165
- this.transactionLogs = logs;
2162
+ this.logs = logs;
2166
2163
  resolve(logs);
2167
2164
  } else {
2168
2165
  reject(new Error('Log messages not found'));
@@ -2170,7 +2167,7 @@ class SendTransactionError extends Error {
2170
2167
  }).catch(reject);
2171
2168
  });
2172
2169
  }
2173
- return await this.resolvedLogs;
2170
+ return await this.logs;
2174
2171
  }
2175
2172
  }
2176
2173
 
@@ -7273,7 +7270,7 @@ class Connection {
7273
7270
  action: 'simulate',
7274
7271
  signature: '',
7275
7272
  transactionMessage: res.error.message,
7276
- transactionLogs: logs
7273
+ logs: logs
7277
7274
  });
7278
7275
  }
7279
7276
  return res.result;
@@ -7383,7 +7380,7 @@ class Connection {
7383
7380
  action: skipPreflight ? 'send' : 'simulate',
7384
7381
  signature: '',
7385
7382
  transactionMessage: res.error.message,
7386
- transactionLogs: logs
7383
+ logs: logs
7387
7384
  });
7388
7385
  }
7389
7386
  return res.result;