@solana/web3.js 1.46.0 → 1.47.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 +92 -57
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +91 -58
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +92 -57
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +36 -0
- package/lib/index.esm.js +91 -58
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +92 -57
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +103 -102
- package/src/errors.ts +41 -0
package/lib/index.browser.esm.js
CHANGED
|
@@ -4501,6 +4501,41 @@ class SendTransactionError extends Error {
|
|
|
4501
4501
|
this.logs = logs;
|
|
4502
4502
|
}
|
|
4503
4503
|
|
|
4504
|
+
} // Keep in sync with client/src/rpc_custom_errors.rs
|
|
4505
|
+
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
|
|
4506
|
+
|
|
4507
|
+
const SolanaJSONRPCErrorCode = {
|
|
4508
|
+
JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001,
|
|
4509
|
+
JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002,
|
|
4510
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003,
|
|
4511
|
+
JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004,
|
|
4512
|
+
JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005,
|
|
4513
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006,
|
|
4514
|
+
JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007,
|
|
4515
|
+
JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008,
|
|
4516
|
+
JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009,
|
|
4517
|
+
JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010,
|
|
4518
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011,
|
|
4519
|
+
JSON_RPC_SCAN_ERROR: -32012,
|
|
4520
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013,
|
|
4521
|
+
JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014,
|
|
4522
|
+
JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015,
|
|
4523
|
+
JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016
|
|
4524
|
+
};
|
|
4525
|
+
class SolanaJSONRPCError extends Error {
|
|
4526
|
+
constructor({
|
|
4527
|
+
code,
|
|
4528
|
+
message,
|
|
4529
|
+
data
|
|
4530
|
+
}, customMessage) {
|
|
4531
|
+
super(customMessage != null ? `${customMessage}: ${message}` : message);
|
|
4532
|
+
this.code = void 0;
|
|
4533
|
+
this.data = void 0;
|
|
4534
|
+
this.code = code;
|
|
4535
|
+
this.data = data;
|
|
4536
|
+
this.name = 'SolanaJSONRPCError';
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4504
4539
|
}
|
|
4505
4540
|
|
|
4506
4541
|
var fetchImpl = globalThis.fetch;
|
|
@@ -5663,7 +5698,7 @@ class Connection {
|
|
|
5663
5698
|
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
5664
5699
|
|
|
5665
5700
|
if ('error' in res) {
|
|
5666
|
-
throw new
|
|
5701
|
+
throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);
|
|
5667
5702
|
}
|
|
5668
5703
|
|
|
5669
5704
|
return res.result;
|
|
@@ -5688,7 +5723,7 @@ class Connection {
|
|
|
5688
5723
|
const res = create(unsafeRes, jsonRpcResult(nullable(number())));
|
|
5689
5724
|
|
|
5690
5725
|
if ('error' in res) {
|
|
5691
|
-
throw new
|
|
5726
|
+
throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);
|
|
5692
5727
|
}
|
|
5693
5728
|
|
|
5694
5729
|
return res.result;
|
|
@@ -5704,7 +5739,7 @@ class Connection {
|
|
|
5704
5739
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
5705
5740
|
|
|
5706
5741
|
if ('error' in res) {
|
|
5707
|
-
throw new
|
|
5742
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');
|
|
5708
5743
|
}
|
|
5709
5744
|
|
|
5710
5745
|
return res.result;
|
|
@@ -5719,7 +5754,7 @@ class Connection {
|
|
|
5719
5754
|
const res = create(unsafeRes, SlotRpcResult);
|
|
5720
5755
|
|
|
5721
5756
|
if ('error' in res) {
|
|
5722
|
-
throw new
|
|
5757
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get first available block');
|
|
5723
5758
|
}
|
|
5724
5759
|
|
|
5725
5760
|
return res.result;
|
|
@@ -5750,7 +5785,7 @@ class Connection {
|
|
|
5750
5785
|
const res = create(unsafeRes, GetSupplyRpcResult);
|
|
5751
5786
|
|
|
5752
5787
|
if ('error' in res) {
|
|
5753
|
-
throw new
|
|
5788
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get supply');
|
|
5754
5789
|
}
|
|
5755
5790
|
|
|
5756
5791
|
return res.result;
|
|
@@ -5767,7 +5802,7 @@ class Connection {
|
|
|
5767
5802
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5768
5803
|
|
|
5769
5804
|
if ('error' in res) {
|
|
5770
|
-
throw new
|
|
5805
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token supply');
|
|
5771
5806
|
}
|
|
5772
5807
|
|
|
5773
5808
|
return res.result;
|
|
@@ -5784,7 +5819,7 @@ class Connection {
|
|
|
5784
5819
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5785
5820
|
|
|
5786
5821
|
if ('error' in res) {
|
|
5787
|
-
throw new
|
|
5822
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');
|
|
5788
5823
|
}
|
|
5789
5824
|
|
|
5790
5825
|
return res.result;
|
|
@@ -5819,7 +5854,7 @@ class Connection {
|
|
|
5819
5854
|
const res = create(unsafeRes, GetTokenAccountsByOwner);
|
|
5820
5855
|
|
|
5821
5856
|
if ('error' in res) {
|
|
5822
|
-
throw new
|
|
5857
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5823
5858
|
}
|
|
5824
5859
|
|
|
5825
5860
|
return res.result;
|
|
@@ -5850,7 +5885,7 @@ class Connection {
|
|
|
5850
5885
|
const res = create(unsafeRes, GetParsedTokenAccountsByOwner);
|
|
5851
5886
|
|
|
5852
5887
|
if ('error' in res) {
|
|
5853
|
-
throw new
|
|
5888
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5854
5889
|
}
|
|
5855
5890
|
|
|
5856
5891
|
return res.result;
|
|
@@ -5869,7 +5904,7 @@ class Connection {
|
|
|
5869
5904
|
const res = create(unsafeRes, GetLargestAccountsRpcResult);
|
|
5870
5905
|
|
|
5871
5906
|
if ('error' in res) {
|
|
5872
|
-
throw new
|
|
5907
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');
|
|
5873
5908
|
}
|
|
5874
5909
|
|
|
5875
5910
|
return res.result;
|
|
@@ -5887,7 +5922,7 @@ class Connection {
|
|
|
5887
5922
|
const res = create(unsafeRes, GetTokenLargestAccountsResult);
|
|
5888
5923
|
|
|
5889
5924
|
if ('error' in res) {
|
|
5890
|
-
throw new
|
|
5925
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');
|
|
5891
5926
|
}
|
|
5892
5927
|
|
|
5893
5928
|
return res.result;
|
|
@@ -5909,7 +5944,7 @@ class Connection {
|
|
|
5909
5944
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(AccountInfoResult)));
|
|
5910
5945
|
|
|
5911
5946
|
if ('error' in res) {
|
|
5912
|
-
throw new
|
|
5947
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5913
5948
|
}
|
|
5914
5949
|
|
|
5915
5950
|
return res.result;
|
|
@@ -5926,7 +5961,7 @@ class Connection {
|
|
|
5926
5961
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(ParsedAccountInfoResult)));
|
|
5927
5962
|
|
|
5928
5963
|
if ('error' in res) {
|
|
5929
|
-
throw new
|
|
5964
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5930
5965
|
}
|
|
5931
5966
|
|
|
5932
5967
|
return res.result;
|
|
@@ -5962,7 +5997,7 @@ class Connection {
|
|
|
5962
5997
|
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
|
|
5963
5998
|
|
|
5964
5999
|
if ('error' in res) {
|
|
5965
|
-
throw new
|
|
6000
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);
|
|
5966
6001
|
}
|
|
5967
6002
|
|
|
5968
6003
|
return res.result;
|
|
@@ -5997,7 +6032,7 @@ class Connection {
|
|
|
5997
6032
|
const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
|
|
5998
6033
|
|
|
5999
6034
|
if ('error' in res) {
|
|
6000
|
-
throw new
|
|
6035
|
+
throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);
|
|
6001
6036
|
}
|
|
6002
6037
|
|
|
6003
6038
|
return res.result;
|
|
@@ -6025,7 +6060,7 @@ class Connection {
|
|
|
6025
6060
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
|
|
6026
6061
|
|
|
6027
6062
|
if ('error' in res) {
|
|
6028
|
-
throw new
|
|
6063
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6029
6064
|
}
|
|
6030
6065
|
|
|
6031
6066
|
return res.result;
|
|
@@ -6049,7 +6084,7 @@ class Connection {
|
|
|
6049
6084
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));
|
|
6050
6085
|
|
|
6051
6086
|
if ('error' in res) {
|
|
6052
|
-
throw new
|
|
6087
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6053
6088
|
}
|
|
6054
6089
|
|
|
6055
6090
|
return res.result;
|
|
@@ -6183,7 +6218,7 @@ class Connection {
|
|
|
6183
6218
|
const res = create(unsafeRes, jsonRpcResult(array(ContactInfoResult)));
|
|
6184
6219
|
|
|
6185
6220
|
if ('error' in res) {
|
|
6186
|
-
throw new
|
|
6221
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');
|
|
6187
6222
|
}
|
|
6188
6223
|
|
|
6189
6224
|
return res.result;
|
|
@@ -6200,7 +6235,7 @@ class Connection {
|
|
|
6200
6235
|
const res = create(unsafeRes, GetVoteAccounts);
|
|
6201
6236
|
|
|
6202
6237
|
if ('error' in res) {
|
|
6203
|
-
throw new
|
|
6238
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');
|
|
6204
6239
|
}
|
|
6205
6240
|
|
|
6206
6241
|
return res.result;
|
|
@@ -6224,7 +6259,7 @@ class Connection {
|
|
|
6224
6259
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6225
6260
|
|
|
6226
6261
|
if ('error' in res) {
|
|
6227
|
-
throw new
|
|
6262
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6228
6263
|
}
|
|
6229
6264
|
|
|
6230
6265
|
return res.result;
|
|
@@ -6248,7 +6283,7 @@ class Connection {
|
|
|
6248
6283
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6249
6284
|
|
|
6250
6285
|
if ('error' in res) {
|
|
6251
|
-
throw new
|
|
6286
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');
|
|
6252
6287
|
}
|
|
6253
6288
|
|
|
6254
6289
|
return res.result;
|
|
@@ -6267,7 +6302,7 @@ class Connection {
|
|
|
6267
6302
|
const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
|
|
6268
6303
|
|
|
6269
6304
|
if ('error' in res) {
|
|
6270
|
-
throw new
|
|
6305
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');
|
|
6271
6306
|
}
|
|
6272
6307
|
|
|
6273
6308
|
return res.result;
|
|
@@ -6305,7 +6340,7 @@ class Connection {
|
|
|
6305
6340
|
const res = create(unsafeRes, GetSignatureStatusesRpcResult);
|
|
6306
6341
|
|
|
6307
6342
|
if ('error' in res) {
|
|
6308
|
-
throw new
|
|
6343
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signature status');
|
|
6309
6344
|
}
|
|
6310
6345
|
|
|
6311
6346
|
return res.result;
|
|
@@ -6329,7 +6364,7 @@ class Connection {
|
|
|
6329
6364
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6330
6365
|
|
|
6331
6366
|
if ('error' in res) {
|
|
6332
|
-
throw new
|
|
6367
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');
|
|
6333
6368
|
}
|
|
6334
6369
|
|
|
6335
6370
|
return res.result;
|
|
@@ -6360,7 +6395,7 @@ class Connection {
|
|
|
6360
6395
|
const res = create(unsafeRes, GetInflationGovernorRpcResult);
|
|
6361
6396
|
|
|
6362
6397
|
if ('error' in res) {
|
|
6363
|
-
throw new
|
|
6398
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation');
|
|
6364
6399
|
}
|
|
6365
6400
|
|
|
6366
6401
|
return res.result;
|
|
@@ -6386,7 +6421,7 @@ class Connection {
|
|
|
6386
6421
|
const res = create(unsafeRes, GetInflationRewardResult);
|
|
6387
6422
|
|
|
6388
6423
|
if ('error' in res) {
|
|
6389
|
-
throw new
|
|
6424
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');
|
|
6390
6425
|
}
|
|
6391
6426
|
|
|
6392
6427
|
return res.result;
|
|
@@ -6410,7 +6445,7 @@ class Connection {
|
|
|
6410
6445
|
const res = create(unsafeRes, GetEpochInfoRpcResult);
|
|
6411
6446
|
|
|
6412
6447
|
if ('error' in res) {
|
|
6413
|
-
throw new
|
|
6448
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');
|
|
6414
6449
|
}
|
|
6415
6450
|
|
|
6416
6451
|
return res.result;
|
|
@@ -6425,7 +6460,7 @@ class Connection {
|
|
|
6425
6460
|
const res = create(unsafeRes, GetEpochScheduleRpcResult);
|
|
6426
6461
|
|
|
6427
6462
|
if ('error' in res) {
|
|
6428
|
-
throw new
|
|
6463
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');
|
|
6429
6464
|
}
|
|
6430
6465
|
|
|
6431
6466
|
const epochSchedule = res.result;
|
|
@@ -6442,7 +6477,7 @@ class Connection {
|
|
|
6442
6477
|
const res = create(unsafeRes, GetLeaderScheduleRpcResult);
|
|
6443
6478
|
|
|
6444
6479
|
if ('error' in res) {
|
|
6445
|
-
throw new
|
|
6480
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');
|
|
6446
6481
|
}
|
|
6447
6482
|
|
|
6448
6483
|
return res.result;
|
|
@@ -6481,7 +6516,7 @@ class Connection {
|
|
|
6481
6516
|
const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
|
|
6482
6517
|
|
|
6483
6518
|
if ('error' in res) {
|
|
6484
|
-
throw new
|
|
6519
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
|
|
6485
6520
|
}
|
|
6486
6521
|
|
|
6487
6522
|
return res.result;
|
|
@@ -6493,13 +6528,11 @@ class Connection {
|
|
|
6493
6528
|
|
|
6494
6529
|
|
|
6495
6530
|
async getRecentPerformanceSamples(limit) {
|
|
6496
|
-
const
|
|
6497
|
-
|
|
6498
|
-
const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', args);
|
|
6531
|
+
const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);
|
|
6499
6532
|
const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
|
|
6500
6533
|
|
|
6501
6534
|
if ('error' in res) {
|
|
6502
|
-
throw new
|
|
6535
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');
|
|
6503
6536
|
}
|
|
6504
6537
|
|
|
6505
6538
|
return res.result;
|
|
@@ -6518,7 +6551,7 @@ class Connection {
|
|
|
6518
6551
|
const res = create(unsafeRes, GetFeeCalculatorRpcResult);
|
|
6519
6552
|
|
|
6520
6553
|
if ('error' in res) {
|
|
6521
|
-
throw new
|
|
6554
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');
|
|
6522
6555
|
}
|
|
6523
6556
|
|
|
6524
6557
|
const {
|
|
@@ -6544,7 +6577,7 @@ class Connection {
|
|
|
6544
6577
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(number())));
|
|
6545
6578
|
|
|
6546
6579
|
if ('error' in res) {
|
|
6547
|
-
throw new
|
|
6580
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6548
6581
|
}
|
|
6549
6582
|
|
|
6550
6583
|
if (res.result === null) {
|
|
@@ -6603,7 +6636,7 @@ class Connection {
|
|
|
6603
6636
|
const res = create(unsafeRes, GetLatestBlockhashRpcResult);
|
|
6604
6637
|
|
|
6605
6638
|
if ('error' in res) {
|
|
6606
|
-
throw new
|
|
6639
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');
|
|
6607
6640
|
}
|
|
6608
6641
|
|
|
6609
6642
|
return res.result;
|
|
@@ -6618,7 +6651,7 @@ class Connection {
|
|
|
6618
6651
|
const res = create(unsafeRes, jsonRpcResult(VersionResult));
|
|
6619
6652
|
|
|
6620
6653
|
if ('error' in res) {
|
|
6621
|
-
throw new
|
|
6654
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get version');
|
|
6622
6655
|
}
|
|
6623
6656
|
|
|
6624
6657
|
return res.result;
|
|
@@ -6633,7 +6666,7 @@ class Connection {
|
|
|
6633
6666
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6634
6667
|
|
|
6635
6668
|
if ('error' in res) {
|
|
6636
|
-
throw new
|
|
6669
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');
|
|
6637
6670
|
}
|
|
6638
6671
|
|
|
6639
6672
|
return res.result;
|
|
@@ -6650,7 +6683,7 @@ class Connection {
|
|
|
6650
6683
|
const res = create(unsafeRes, GetBlockRpcResult);
|
|
6651
6684
|
|
|
6652
6685
|
if ('error' in res) {
|
|
6653
|
-
throw new
|
|
6686
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6654
6687
|
}
|
|
6655
6688
|
|
|
6656
6689
|
const result = res.result;
|
|
@@ -6689,7 +6722,7 @@ class Connection {
|
|
|
6689
6722
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6690
6723
|
|
|
6691
6724
|
if ('error' in res) {
|
|
6692
|
-
throw new
|
|
6725
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
6693
6726
|
}
|
|
6694
6727
|
|
|
6695
6728
|
return res.result;
|
|
@@ -6720,7 +6753,7 @@ class Connection {
|
|
|
6720
6753
|
const res = create(unsafeRes, BlockProductionResponseStruct);
|
|
6721
6754
|
|
|
6722
6755
|
if ('error' in res) {
|
|
6723
|
-
throw new
|
|
6756
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block production information');
|
|
6724
6757
|
}
|
|
6725
6758
|
|
|
6726
6759
|
return res.result;
|
|
@@ -6737,7 +6770,7 @@ class Connection {
|
|
|
6737
6770
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6738
6771
|
|
|
6739
6772
|
if ('error' in res) {
|
|
6740
|
-
throw new
|
|
6773
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6741
6774
|
}
|
|
6742
6775
|
|
|
6743
6776
|
const result = res.result;
|
|
@@ -6760,7 +6793,7 @@ class Connection {
|
|
|
6760
6793
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6761
6794
|
|
|
6762
6795
|
if ('error' in res) {
|
|
6763
|
-
throw new
|
|
6796
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6764
6797
|
}
|
|
6765
6798
|
|
|
6766
6799
|
return res.result;
|
|
@@ -6784,7 +6817,7 @@ class Connection {
|
|
|
6784
6817
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6785
6818
|
|
|
6786
6819
|
if ('error' in res) {
|
|
6787
|
-
throw new
|
|
6820
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6788
6821
|
}
|
|
6789
6822
|
|
|
6790
6823
|
return res.result;
|
|
@@ -6811,7 +6844,7 @@ class Connection {
|
|
|
6811
6844
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6812
6845
|
|
|
6813
6846
|
if ('error' in res) {
|
|
6814
|
-
throw new
|
|
6847
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6815
6848
|
}
|
|
6816
6849
|
|
|
6817
6850
|
const result = res.result;
|
|
@@ -6839,7 +6872,7 @@ class Connection {
|
|
|
6839
6872
|
const res = create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
6840
6873
|
|
|
6841
6874
|
if ('error' in res) {
|
|
6842
|
-
throw new
|
|
6875
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6843
6876
|
}
|
|
6844
6877
|
|
|
6845
6878
|
const result = res.result;
|
|
@@ -6886,7 +6919,7 @@ class Connection {
|
|
|
6886
6919
|
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
|
6887
6920
|
|
|
6888
6921
|
if ('error' in res) {
|
|
6889
|
-
throw new
|
|
6922
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get blocks');
|
|
6890
6923
|
}
|
|
6891
6924
|
|
|
6892
6925
|
return res.result;
|
|
@@ -6906,7 +6939,7 @@ class Connection {
|
|
|
6906
6939
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6907
6940
|
|
|
6908
6941
|
if ('error' in res) {
|
|
6909
|
-
throw new
|
|
6942
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
6910
6943
|
}
|
|
6911
6944
|
|
|
6912
6945
|
const result = res.result;
|
|
@@ -6934,7 +6967,7 @@ class Connection {
|
|
|
6934
6967
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6935
6968
|
|
|
6936
6969
|
if ('error' in res) {
|
|
6937
|
-
throw new
|
|
6970
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6938
6971
|
}
|
|
6939
6972
|
|
|
6940
6973
|
const result = res.result;
|
|
@@ -6959,7 +6992,7 @@ class Connection {
|
|
|
6959
6992
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6960
6993
|
|
|
6961
6994
|
if ('error' in res) {
|
|
6962
|
-
throw new
|
|
6995
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6963
6996
|
}
|
|
6964
6997
|
|
|
6965
6998
|
const result = res.result;
|
|
@@ -6984,7 +7017,7 @@ class Connection {
|
|
|
6984
7017
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6985
7018
|
|
|
6986
7019
|
if ('error' in res) {
|
|
6987
|
-
throw new
|
|
7020
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
|
|
6988
7021
|
}
|
|
6989
7022
|
|
|
6990
7023
|
return res.result;
|
|
@@ -7010,7 +7043,7 @@ class Connection {
|
|
|
7010
7043
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
7011
7044
|
|
|
7012
7045
|
if ('error' in res) {
|
|
7013
|
-
throw new
|
|
7046
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');
|
|
7014
7047
|
}
|
|
7015
7048
|
|
|
7016
7049
|
return res.result;
|
|
@@ -7099,7 +7132,7 @@ class Connection {
|
|
|
7099
7132
|
const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
7100
7133
|
|
|
7101
7134
|
if ('error' in res) {
|
|
7102
|
-
throw new
|
|
7135
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');
|
|
7103
7136
|
}
|
|
7104
7137
|
|
|
7105
7138
|
return res.result;
|
|
@@ -7121,7 +7154,7 @@ class Connection {
|
|
|
7121
7154
|
const res = create(unsafeRes, GetSignaturesForAddressRpcResult);
|
|
7122
7155
|
|
|
7123
7156
|
if ('error' in res) {
|
|
7124
|
-
throw new
|
|
7157
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');
|
|
7125
7158
|
}
|
|
7126
7159
|
|
|
7127
7160
|
return res.result;
|
|
@@ -7178,7 +7211,7 @@ class Connection {
|
|
|
7178
7211
|
const res = create(unsafeRes, RequestAirdropRpcResult);
|
|
7179
7212
|
|
|
7180
7213
|
if ('error' in res) {
|
|
7181
|
-
throw new
|
|
7214
|
+
throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);
|
|
7182
7215
|
}
|
|
7183
7216
|
|
|
7184
7217
|
return res.result;
|
|
@@ -7408,7 +7441,7 @@ class Connection {
|
|
|
7408
7441
|
const skipPreflight = options && options.skipPreflight;
|
|
7409
7442
|
const preflightCommitment = options && options.preflightCommitment || this.commitment;
|
|
7410
7443
|
|
|
7411
|
-
if (options && options.maxRetries) {
|
|
7444
|
+
if (options && options.maxRetries != null) {
|
|
7412
7445
|
config.maxRetries = options.maxRetries;
|
|
7413
7446
|
}
|
|
7414
7447
|
|
|
@@ -9878,5 +9911,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9878
9911
|
|
|
9879
9912
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9880
9913
|
|
|
9881
|
-
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionExpiredBlockheightExceededError, TransactionExpiredTimeoutError, TransactionInstruction, TransactionStatus, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9914
|
+
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, SolanaJSONRPCError, SolanaJSONRPCErrorCode, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionExpiredBlockheightExceededError, TransactionExpiredTimeoutError, TransactionInstruction, TransactionStatus, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9882
9915
|
//# sourceMappingURL=index.browser.esm.js.map
|