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