@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.browser.esm.js
CHANGED
|
@@ -2126,40 +2126,53 @@ class SendTransactionError extends Error {
|
|
|
2126
2126
|
action,
|
|
2127
2127
|
signature,
|
|
2128
2128
|
transactionMessage,
|
|
2129
|
-
logs
|
|
2129
|
+
logs
|
|
2130
2130
|
}) {
|
|
2131
|
+
const maybeLogsOutput = logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '';
|
|
2132
|
+
const guideText = '\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.';
|
|
2131
2133
|
let message;
|
|
2132
2134
|
switch (action) {
|
|
2133
2135
|
case 'send':
|
|
2134
|
-
message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` +
|
|
2136
|
+
message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + maybeLogsOutput + guideText;
|
|
2135
2137
|
break;
|
|
2136
2138
|
case 'simulate':
|
|
2137
|
-
message = `Simulation failed. \nMessage: ${transactionMessage}. \n` +
|
|
2139
|
+
message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + maybeLogsOutput + guideText;
|
|
2138
2140
|
break;
|
|
2139
2141
|
default:
|
|
2140
|
-
|
|
2142
|
+
{
|
|
2143
|
+
message = `Unknown action '${(a => a)(action)}'`;
|
|
2144
|
+
}
|
|
2141
2145
|
}
|
|
2142
2146
|
super(message);
|
|
2143
2147
|
this.signature = void 0;
|
|
2144
2148
|
this.transactionMessage = void 0;
|
|
2145
|
-
this.
|
|
2149
|
+
this.transactionLogs = void 0;
|
|
2146
2150
|
this.signature = signature;
|
|
2147
2151
|
this.transactionMessage = transactionMessage;
|
|
2148
|
-
this.
|
|
2152
|
+
this.transactionLogs = logs ? logs : undefined;
|
|
2149
2153
|
}
|
|
2150
2154
|
get transactionError() {
|
|
2151
2155
|
return {
|
|
2152
2156
|
message: this.transactionMessage,
|
|
2153
|
-
logs: Array.isArray(this.
|
|
2157
|
+
logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined
|
|
2154
2158
|
};
|
|
2155
2159
|
}
|
|
2160
|
+
|
|
2161
|
+
/* @deprecated Use `await getLogs()` instead */
|
|
2162
|
+
get logs() {
|
|
2163
|
+
const cachedLogs = this.transactionLogs;
|
|
2164
|
+
if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) {
|
|
2165
|
+
return undefined;
|
|
2166
|
+
}
|
|
2167
|
+
return cachedLogs;
|
|
2168
|
+
}
|
|
2156
2169
|
async getLogs(connection) {
|
|
2157
|
-
if (!Array.isArray(this.
|
|
2158
|
-
this.
|
|
2170
|
+
if (!Array.isArray(this.transactionLogs)) {
|
|
2171
|
+
this.transactionLogs = new Promise((resolve, reject) => {
|
|
2159
2172
|
connection.getTransaction(this.signature).then(tx => {
|
|
2160
2173
|
if (tx && tx.meta && tx.meta.logMessages) {
|
|
2161
2174
|
const logs = tx.meta.logMessages;
|
|
2162
|
-
this.
|
|
2175
|
+
this.transactionLogs = logs;
|
|
2163
2176
|
resolve(logs);
|
|
2164
2177
|
} else {
|
|
2165
2178
|
reject(new Error('Log messages not found'));
|
|
@@ -2167,7 +2180,7 @@ class SendTransactionError extends Error {
|
|
|
2167
2180
|
}).catch(reject);
|
|
2168
2181
|
});
|
|
2169
2182
|
}
|
|
2170
|
-
return await this.
|
|
2183
|
+
return await this.transactionLogs;
|
|
2171
2184
|
}
|
|
2172
2185
|
}
|
|
2173
2186
|
|