@solana/web3.js 1.92.1 → 1.92.2

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
@@ -13357,40 +13357,53 @@ var solanaWeb3 = (function (exports) {
13357
13357
  action,
13358
13358
  signature,
13359
13359
  transactionMessage,
13360
- logs: logs
13360
+ logs
13361
13361
  }) {
13362
+ const maybeLogsOutput = logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '';
13363
+ const guideText = '\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.';
13362
13364
  let message;
13363
13365
  switch (action) {
13364
13366
  case 'send':
13365
- 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.';
13367
+ message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + maybeLogsOutput + guideText;
13366
13368
  break;
13367
13369
  case 'simulate':
13368
- 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.';
13370
+ message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + maybeLogsOutput + guideText;
13369
13371
  break;
13370
13372
  default:
13371
- message = 'Unknown action';
13373
+ {
13374
+ message = `Unknown action '${(a => a)(action)}'`;
13375
+ }
13372
13376
  }
13373
13377
  super(message);
13374
13378
  this.signature = void 0;
13375
13379
  this.transactionMessage = void 0;
13376
- this.logs = void 0;
13380
+ this.transactionLogs = void 0;
13377
13381
  this.signature = signature;
13378
13382
  this.transactionMessage = transactionMessage;
13379
- this.logs = logs ? logs : undefined;
13383
+ this.transactionLogs = logs ? logs : undefined;
13380
13384
  }
13381
13385
  get transactionError() {
13382
13386
  return {
13383
13387
  message: this.transactionMessage,
13384
- logs: Array.isArray(this.logs) ? this.logs : undefined
13388
+ logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined
13385
13389
  };
13386
13390
  }
13391
+
13392
+ /* @deprecated Use `await getLogs()` instead */
13393
+ get logs() {
13394
+ const cachedLogs = this.transactionLogs;
13395
+ if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) {
13396
+ return undefined;
13397
+ }
13398
+ return cachedLogs;
13399
+ }
13387
13400
  async getLogs(connection) {
13388
- if (!Array.isArray(this.logs)) {
13389
- this.logs = new Promise((resolve, reject) => {
13401
+ if (!Array.isArray(this.transactionLogs)) {
13402
+ this.transactionLogs = new Promise((resolve, reject) => {
13390
13403
  connection.getTransaction(this.signature).then(tx => {
13391
13404
  if (tx && tx.meta && tx.meta.logMessages) {
13392
13405
  const logs = tx.meta.logMessages;
13393
- this.logs = logs;
13406
+ this.transactionLogs = logs;
13394
13407
  resolve(logs);
13395
13408
  } else {
13396
13409
  reject(new Error('Log messages not found'));
@@ -13398,7 +13411,7 @@ var solanaWeb3 = (function (exports) {
13398
13411
  }).catch(reject);
13399
13412
  });
13400
13413
  }
13401
- return await this.logs;
13414
+ return await this.transactionLogs;
13402
13415
  }
13403
13416
  }
13404
13417