@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.browser.esm.js
CHANGED
|
@@ -2126,42 +2126,52 @@ class SendTransactionError extends Error {
|
|
|
2126
2126
|
action,
|
|
2127
2127
|
signature,
|
|
2128
2128
|
transactionMessage,
|
|
2129
|
-
|
|
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
2149
|
this.transactionLogs = void 0;
|
|
2146
|
-
this.resolvedLogs = void 0;
|
|
2147
2150
|
this.signature = signature;
|
|
2148
2151
|
this.transactionMessage = transactionMessage;
|
|
2149
|
-
this.transactionLogs =
|
|
2150
|
-
this.resolvedLogs = transactionLogs ? transactionLogs : undefined;
|
|
2152
|
+
this.transactionLogs = logs ? logs : undefined;
|
|
2151
2153
|
}
|
|
2152
2154
|
get transactionError() {
|
|
2153
2155
|
return {
|
|
2154
2156
|
message: this.transactionMessage,
|
|
2155
|
-
logs: this.transactionLogs
|
|
2157
|
+
logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined
|
|
2156
2158
|
};
|
|
2157
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
|
+
}
|
|
2158
2169
|
async getLogs(connection) {
|
|
2159
|
-
if (this.
|
|
2160
|
-
this.
|
|
2170
|
+
if (!Array.isArray(this.transactionLogs)) {
|
|
2171
|
+
this.transactionLogs = new Promise((resolve, reject) => {
|
|
2161
2172
|
connection.getTransaction(this.signature).then(tx => {
|
|
2162
2173
|
if (tx && tx.meta && tx.meta.logMessages) {
|
|
2163
2174
|
const logs = tx.meta.logMessages;
|
|
2164
|
-
this.resolvedLogs = logs;
|
|
2165
2175
|
this.transactionLogs = logs;
|
|
2166
2176
|
resolve(logs);
|
|
2167
2177
|
} else {
|
|
@@ -2170,7 +2180,7 @@ class SendTransactionError extends Error {
|
|
|
2170
2180
|
}).catch(reject);
|
|
2171
2181
|
});
|
|
2172
2182
|
}
|
|
2173
|
-
return await this.
|
|
2183
|
+
return await this.transactionLogs;
|
|
2174
2184
|
}
|
|
2175
2185
|
}
|
|
2176
2186
|
|
|
@@ -7273,7 +7283,7 @@ class Connection {
|
|
|
7273
7283
|
action: 'simulate',
|
|
7274
7284
|
signature: '',
|
|
7275
7285
|
transactionMessage: res.error.message,
|
|
7276
|
-
|
|
7286
|
+
logs: logs
|
|
7277
7287
|
});
|
|
7278
7288
|
}
|
|
7279
7289
|
return res.result;
|
|
@@ -7383,7 +7393,7 @@ class Connection {
|
|
|
7383
7393
|
action: skipPreflight ? 'send' : 'simulate',
|
|
7384
7394
|
signature: '',
|
|
7385
7395
|
transactionMessage: res.error.message,
|
|
7386
|
-
|
|
7396
|
+
logs: logs
|
|
7387
7397
|
});
|
|
7388
7398
|
}
|
|
7389
7399
|
return res.result;
|