@solana/web3.js 1.92.1 → 1.92.3
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.browser.cjs.js +24 -11
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +24 -11
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +24 -11
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.esm.js +24 -11
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +24 -11
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +24 -11
- package/lib/index.native.js.map +1 -1
- package/package.json +2 -2
- package/src/errors.ts +35 -19
package/lib/index.cjs.js
CHANGED
|
@@ -2162,40 +2162,53 @@ class SendTransactionError extends Error {
|
|
|
2162
2162
|
action,
|
|
2163
2163
|
signature,
|
|
2164
2164
|
transactionMessage,
|
|
2165
|
-
logs
|
|
2165
|
+
logs
|
|
2166
2166
|
}) {
|
|
2167
|
+
const maybeLogsOutput = logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '';
|
|
2168
|
+
const guideText = '\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.';
|
|
2167
2169
|
let message;
|
|
2168
2170
|
switch (action) {
|
|
2169
2171
|
case 'send':
|
|
2170
|
-
message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` +
|
|
2172
|
+
message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + maybeLogsOutput + guideText;
|
|
2171
2173
|
break;
|
|
2172
2174
|
case 'simulate':
|
|
2173
|
-
message = `Simulation failed. \nMessage: ${transactionMessage}. \n` +
|
|
2175
|
+
message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + maybeLogsOutput + guideText;
|
|
2174
2176
|
break;
|
|
2175
2177
|
default:
|
|
2176
|
-
|
|
2178
|
+
{
|
|
2179
|
+
message = `Unknown action '${(a => a)(action)}'`;
|
|
2180
|
+
}
|
|
2177
2181
|
}
|
|
2178
2182
|
super(message);
|
|
2179
2183
|
this.signature = void 0;
|
|
2180
2184
|
this.transactionMessage = void 0;
|
|
2181
|
-
this.
|
|
2185
|
+
this.transactionLogs = void 0;
|
|
2182
2186
|
this.signature = signature;
|
|
2183
2187
|
this.transactionMessage = transactionMessage;
|
|
2184
|
-
this.
|
|
2188
|
+
this.transactionLogs = logs ? logs : undefined;
|
|
2185
2189
|
}
|
|
2186
2190
|
get transactionError() {
|
|
2187
2191
|
return {
|
|
2188
2192
|
message: this.transactionMessage,
|
|
2189
|
-
logs: Array.isArray(this.
|
|
2193
|
+
logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined
|
|
2190
2194
|
};
|
|
2191
2195
|
}
|
|
2196
|
+
|
|
2197
|
+
/* @deprecated Use `await getLogs()` instead */
|
|
2198
|
+
get logs() {
|
|
2199
|
+
const cachedLogs = this.transactionLogs;
|
|
2200
|
+
if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) {
|
|
2201
|
+
return undefined;
|
|
2202
|
+
}
|
|
2203
|
+
return cachedLogs;
|
|
2204
|
+
}
|
|
2192
2205
|
async getLogs(connection) {
|
|
2193
|
-
if (!Array.isArray(this.
|
|
2194
|
-
this.
|
|
2206
|
+
if (!Array.isArray(this.transactionLogs)) {
|
|
2207
|
+
this.transactionLogs = new Promise((resolve, reject) => {
|
|
2195
2208
|
connection.getTransaction(this.signature).then(tx => {
|
|
2196
2209
|
if (tx && tx.meta && tx.meta.logMessages) {
|
|
2197
2210
|
const logs = tx.meta.logMessages;
|
|
2198
|
-
this.
|
|
2211
|
+
this.transactionLogs = logs;
|
|
2199
2212
|
resolve(logs);
|
|
2200
2213
|
} else {
|
|
2201
2214
|
reject(new Error('Log messages not found'));
|
|
@@ -2203,7 +2216,7 @@ class SendTransactionError extends Error {
|
|
|
2203
2216
|
}).catch(reject);
|
|
2204
2217
|
});
|
|
2205
2218
|
}
|
|
2206
|
-
return await this.
|
|
2219
|
+
return await this.transactionLogs;
|
|
2207
2220
|
}
|
|
2208
2221
|
}
|
|
2209
2222
|
|