@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.d.ts CHANGED
@@ -3755,13 +3755,12 @@ export class BpfLoader {
3755
3755
  export class SendTransactionError extends Error {
3756
3756
  private signature;
3757
3757
  private transactionMessage;
3758
- private transactionLogs?;
3759
- private resolvedLogs;
3760
- constructor({ action, signature, transactionMessage, transactionLogs, }: {
3758
+ private logs;
3759
+ constructor({ action, signature, transactionMessage, logs: logs, }: {
3761
3760
  action: 'send' | 'simulate';
3762
3761
  signature: TransactionSignature;
3763
3762
  transactionMessage: string;
3764
- transactionLogs?: string[];
3763
+ logs?: string[];
3765
3764
  });
3766
3765
  get transactionError(): {
3767
3766
  message: string;
package/lib/index.esm.js CHANGED
@@ -2130,15 +2130,15 @@ class SendTransactionError extends Error {
2130
2130
  action,
2131
2131
  signature,
2132
2132
  transactionMessage,
2133
- transactionLogs
2133
+ logs: logs
2134
2134
  }) {
2135
2135
  let message;
2136
2136
  switch (action) {
2137
2137
  case 'send':
2138
- 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.';
2138
+ 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.';
2139
2139
  break;
2140
2140
  case 'simulate':
2141
- 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.';
2141
+ 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.';
2142
2142
  break;
2143
2143
  default:
2144
2144
  message = 'Unknown action';
@@ -2146,27 +2146,24 @@ class SendTransactionError extends Error {
2146
2146
  super(message);
2147
2147
  this.signature = void 0;
2148
2148
  this.transactionMessage = void 0;
2149
- this.transactionLogs = void 0;
2150
- this.resolvedLogs = void 0;
2149
+ this.logs = void 0;
2151
2150
  this.signature = signature;
2152
2151
  this.transactionMessage = transactionMessage;
2153
- this.transactionLogs = transactionLogs;
2154
- this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
2152
+ this.logs = logs ? logs : undefined;
2155
2153
  }
2156
2154
  get transactionError() {
2157
2155
  return {
2158
2156
  message: this.transactionMessage,
2159
- logs: this.transactionLogs
2157
+ logs: Array.isArray(this.logs) ? this.logs : undefined
2160
2158
  };
2161
2159
  }
2162
2160
  async getLogs(connection) {
2163
- if (this.resolvedLogs === undefined) {
2164
- this.resolvedLogs = new Promise((resolve, reject) => {
2161
+ if (!Array.isArray(this.logs)) {
2162
+ this.logs = new Promise((resolve, reject) => {
2165
2163
  connection.getTransaction(this.signature).then(tx => {
2166
2164
  if (tx && tx.meta && tx.meta.logMessages) {
2167
2165
  const logs = tx.meta.logMessages;
2168
- this.resolvedLogs = logs;
2169
- this.transactionLogs = logs;
2166
+ this.logs = logs;
2170
2167
  resolve(logs);
2171
2168
  } else {
2172
2169
  reject(new Error('Log messages not found'));
@@ -2174,7 +2171,7 @@ class SendTransactionError extends Error {
2174
2171
  }).catch(reject);
2175
2172
  });
2176
2173
  }
2177
- return await this.resolvedLogs;
2174
+ return await this.logs;
2178
2175
  }
2179
2176
  }
2180
2177
 
@@ -7966,7 +7963,7 @@ class Connection {
7966
7963
  action: 'simulate',
7967
7964
  signature: '',
7968
7965
  transactionMessage: res.error.message,
7969
- transactionLogs: logs
7966
+ logs: logs
7970
7967
  });
7971
7968
  }
7972
7969
  return res.result;
@@ -8076,7 +8073,7 @@ class Connection {
8076
8073
  action: skipPreflight ? 'send' : 'simulate',
8077
8074
  signature: '',
8078
8075
  transactionMessage: res.error.message,
8079
- transactionLogs: logs
8076
+ logs: logs
8080
8077
  });
8081
8078
  }
8082
8079
  return res.result;