@solana/web3.js 1.20.3 → 1.21.1
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.esm.js +28 -3
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +28 -3
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +28 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +28 -3
- 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/package.json +2 -2
- package/src/connection.ts +20 -3
- package/src/errors.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"nyc": "^15.1.0",
|
|
104
104
|
"prettier": "^2.3.0",
|
|
105
105
|
"rimraf": "3.0.2",
|
|
106
|
-
"rollup": "2.
|
|
106
|
+
"rollup": "2.53.1",
|
|
107
107
|
"rollup-plugin-dts": "^3.0.1",
|
|
108
108
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
109
109
|
"rollup-plugin-terser": "^7.0.2",
|
package/src/connection.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {IWSRequestParams} from 'rpc-websockets/dist/lib/client';
|
|
|
26
26
|
|
|
27
27
|
import {AgentManager} from './agent-manager';
|
|
28
28
|
import {EpochSchedule} from './epoch-schedule';
|
|
29
|
+
import {SendTransactionError} from './errors';
|
|
29
30
|
import {NonceAccount} from './nonce-account';
|
|
30
31
|
import {PublicKey} from './publickey';
|
|
31
32
|
import {Signer} from './keypair';
|
|
@@ -3444,7 +3445,19 @@ export class Connection {
|
|
|
3444
3445
|
const unsafeRes = await this._rpcRequest('simulateTransaction', args);
|
|
3445
3446
|
const res = create(unsafeRes, SimulatedTransactionResponseStruct);
|
|
3446
3447
|
if ('error' in res) {
|
|
3447
|
-
|
|
3448
|
+
let logs;
|
|
3449
|
+
if ('data' in res.error) {
|
|
3450
|
+
logs = res.error.data.logs;
|
|
3451
|
+
if (logs && Array.isArray(logs)) {
|
|
3452
|
+
const traceIndent = '\n ';
|
|
3453
|
+
const logTrace = traceIndent + logs.join(traceIndent);
|
|
3454
|
+
console.error(res.error.message, logTrace);
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
throw new SendTransactionError(
|
|
3458
|
+
'failed to simulate transaction: ' + res.error.message,
|
|
3459
|
+
logs,
|
|
3460
|
+
);
|
|
3448
3461
|
}
|
|
3449
3462
|
return res.result;
|
|
3450
3463
|
}
|
|
@@ -3528,15 +3541,19 @@ export class Connection {
|
|
|
3528
3541
|
const unsafeRes = await this._rpcRequest('sendTransaction', args);
|
|
3529
3542
|
const res = create(unsafeRes, SendTransactionRpcResult);
|
|
3530
3543
|
if ('error' in res) {
|
|
3544
|
+
let logs;
|
|
3531
3545
|
if ('data' in res.error) {
|
|
3532
|
-
|
|
3546
|
+
logs = res.error.data.logs;
|
|
3533
3547
|
if (logs && Array.isArray(logs)) {
|
|
3534
3548
|
const traceIndent = '\n ';
|
|
3535
3549
|
const logTrace = traceIndent + logs.join(traceIndent);
|
|
3536
3550
|
console.error(res.error.message, logTrace);
|
|
3537
3551
|
}
|
|
3538
3552
|
}
|
|
3539
|
-
throw new
|
|
3553
|
+
throw new SendTransactionError(
|
|
3554
|
+
'failed to send transaction: ' + res.error.message,
|
|
3555
|
+
logs,
|
|
3556
|
+
);
|
|
3540
3557
|
}
|
|
3541
3558
|
return res.result;
|
|
3542
3559
|
}
|