@solana/web3.js 1.92.0 → 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.browser.cjs.js +24 -14
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +24 -14
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +24 -14
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.esm.js +24 -14
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +24 -14
- 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 -14
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +2 -2
- package/src/errors.ts +38 -22
package/lib/index.cjs.js
CHANGED
|
@@ -2162,42 +2162,52 @@ class SendTransactionError extends Error {
|
|
|
2162
2162
|
action,
|
|
2163
2163
|
signature,
|
|
2164
2164
|
transactionMessage,
|
|
2165
|
-
|
|
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
2185
|
this.transactionLogs = void 0;
|
|
2182
|
-
this.resolvedLogs = void 0;
|
|
2183
2186
|
this.signature = signature;
|
|
2184
2187
|
this.transactionMessage = transactionMessage;
|
|
2185
|
-
this.transactionLogs =
|
|
2186
|
-
this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
|
|
2188
|
+
this.transactionLogs = logs ? logs : undefined;
|
|
2187
2189
|
}
|
|
2188
2190
|
get transactionError() {
|
|
2189
2191
|
return {
|
|
2190
2192
|
message: this.transactionMessage,
|
|
2191
|
-
logs: this.transactionLogs
|
|
2193
|
+
logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined
|
|
2192
2194
|
};
|
|
2193
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
|
+
}
|
|
2194
2205
|
async getLogs(connection) {
|
|
2195
|
-
if (this.
|
|
2196
|
-
this.
|
|
2206
|
+
if (!Array.isArray(this.transactionLogs)) {
|
|
2207
|
+
this.transactionLogs = new Promise((resolve, reject) => {
|
|
2197
2208
|
connection.getTransaction(this.signature).then(tx => {
|
|
2198
2209
|
if (tx && tx.meta && tx.meta.logMessages) {
|
|
2199
2210
|
const logs = tx.meta.logMessages;
|
|
2200
|
-
this.resolvedLogs = logs;
|
|
2201
2211
|
this.transactionLogs = logs;
|
|
2202
2212
|
resolve(logs);
|
|
2203
2213
|
} else {
|
|
@@ -2206,7 +2216,7 @@ class SendTransactionError extends Error {
|
|
|
2206
2216
|
}).catch(reject);
|
|
2207
2217
|
});
|
|
2208
2218
|
}
|
|
2209
|
-
return await this.
|
|
2219
|
+
return await this.transactionLogs;
|
|
2210
2220
|
}
|
|
2211
2221
|
}
|
|
2212
2222
|
|
|
@@ -7998,7 +8008,7 @@ class Connection {
|
|
|
7998
8008
|
action: 'simulate',
|
|
7999
8009
|
signature: '',
|
|
8000
8010
|
transactionMessage: res.error.message,
|
|
8001
|
-
|
|
8011
|
+
logs: logs
|
|
8002
8012
|
});
|
|
8003
8013
|
}
|
|
8004
8014
|
return res.result;
|
|
@@ -8108,7 +8118,7 @@ class Connection {
|
|
|
8108
8118
|
action: skipPreflight ? 'send' : 'simulate',
|
|
8109
8119
|
signature: '',
|
|
8110
8120
|
transactionMessage: res.error.message,
|
|
8111
|
-
|
|
8121
|
+
logs: logs
|
|
8112
8122
|
});
|
|
8113
8123
|
}
|
|
8114
8124
|
return res.result;
|