@solana/web3.js 1.45.0 → 1.47.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.cjs.js +248 -127
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +247 -128
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +248 -127
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +178 -18
- package/lib/index.esm.js +247 -128
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +248 -127
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +371 -173
- package/src/errors.ts +41 -0
- package/src/util/send-and-confirm-raw-transaction.ts +1 -0
- package/src/util/send-and-confirm-transaction.ts +1 -0
package/lib/index.browser.esm.js
CHANGED
|
@@ -3073,7 +3073,8 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
3073
3073
|
const sendOptions = options && {
|
|
3074
3074
|
skipPreflight: options.skipPreflight,
|
|
3075
3075
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
3076
|
-
maxRetries: options.maxRetries
|
|
3076
|
+
maxRetries: options.maxRetries,
|
|
3077
|
+
minContextSlot: options.minContextSlot
|
|
3077
3078
|
};
|
|
3078
3079
|
const signature = await connection.sendTransaction(transaction, signers, sendOptions);
|
|
3079
3080
|
const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
|
|
@@ -4500,6 +4501,41 @@ class SendTransactionError extends Error {
|
|
|
4500
4501
|
this.logs = logs;
|
|
4501
4502
|
}
|
|
4502
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
|
+
|
|
4503
4539
|
}
|
|
4504
4540
|
|
|
4505
4541
|
var fetchImpl = globalThis.fetch;
|
|
@@ -4585,9 +4621,32 @@ const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;
|
|
|
4585
4621
|
* https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d
|
|
4586
4622
|
*/
|
|
4587
4623
|
|
|
4624
|
+
/** @internal */
|
|
4625
|
+
function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
4626
|
+
let commitment;
|
|
4627
|
+
let config;
|
|
4628
|
+
|
|
4629
|
+
if (typeof commitmentOrConfig === 'string') {
|
|
4630
|
+
commitment = commitmentOrConfig;
|
|
4631
|
+
} else if (commitmentOrConfig) {
|
|
4632
|
+
const {
|
|
4633
|
+
commitment: specifiedCommitment,
|
|
4634
|
+
...specifiedConfig
|
|
4635
|
+
} = commitmentOrConfig;
|
|
4636
|
+
commitment = specifiedCommitment;
|
|
4637
|
+
config = specifiedConfig;
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
return {
|
|
4641
|
+
commitment,
|
|
4642
|
+
config
|
|
4643
|
+
};
|
|
4644
|
+
}
|
|
4588
4645
|
/**
|
|
4589
4646
|
* @internal
|
|
4590
4647
|
*/
|
|
4648
|
+
|
|
4649
|
+
|
|
4591
4650
|
function createRpcResult(result) {
|
|
4592
4651
|
return union([type({
|
|
4593
4652
|
jsonrpc: literal('2.0'),
|
|
@@ -5624,14 +5683,22 @@ class Connection {
|
|
|
5624
5683
|
*/
|
|
5625
5684
|
|
|
5626
5685
|
|
|
5627
|
-
async getBalanceAndContext(publicKey,
|
|
5628
|
-
|
|
5686
|
+
async getBalanceAndContext(publicKey, commitmentOrConfig) {
|
|
5687
|
+
/** @internal */
|
|
5688
|
+
const {
|
|
5689
|
+
commitment,
|
|
5690
|
+
config
|
|
5691
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5692
|
+
|
|
5693
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
5694
|
+
/* encoding */
|
|
5695
|
+
, config);
|
|
5629
5696
|
|
|
5630
5697
|
const unsafeRes = await this._rpcRequest('getBalance', args);
|
|
5631
5698
|
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
5632
5699
|
|
|
5633
5700
|
if ('error' in res) {
|
|
5634
|
-
throw new
|
|
5701
|
+
throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);
|
|
5635
5702
|
}
|
|
5636
5703
|
|
|
5637
5704
|
return res.result;
|
|
@@ -5641,8 +5708,8 @@ class Connection {
|
|
|
5641
5708
|
*/
|
|
5642
5709
|
|
|
5643
5710
|
|
|
5644
|
-
async getBalance(publicKey,
|
|
5645
|
-
return await this.getBalanceAndContext(publicKey,
|
|
5711
|
+
async getBalance(publicKey, commitmentOrConfig) {
|
|
5712
|
+
return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {
|
|
5646
5713
|
throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);
|
|
5647
5714
|
});
|
|
5648
5715
|
}
|
|
@@ -5656,7 +5723,7 @@ class Connection {
|
|
|
5656
5723
|
const res = create(unsafeRes, jsonRpcResult(nullable(number())));
|
|
5657
5724
|
|
|
5658
5725
|
if ('error' in res) {
|
|
5659
|
-
throw new
|
|
5726
|
+
throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);
|
|
5660
5727
|
}
|
|
5661
5728
|
|
|
5662
5729
|
return res.result;
|
|
@@ -5672,7 +5739,7 @@ class Connection {
|
|
|
5672
5739
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
5673
5740
|
|
|
5674
5741
|
if ('error' in res) {
|
|
5675
|
-
throw new
|
|
5742
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');
|
|
5676
5743
|
}
|
|
5677
5744
|
|
|
5678
5745
|
return res.result;
|
|
@@ -5687,7 +5754,7 @@ class Connection {
|
|
|
5687
5754
|
const res = create(unsafeRes, SlotRpcResult);
|
|
5688
5755
|
|
|
5689
5756
|
if ('error' in res) {
|
|
5690
|
-
throw new
|
|
5757
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get first available block');
|
|
5691
5758
|
}
|
|
5692
5759
|
|
|
5693
5760
|
return res.result;
|
|
@@ -5718,7 +5785,7 @@ class Connection {
|
|
|
5718
5785
|
const res = create(unsafeRes, GetSupplyRpcResult);
|
|
5719
5786
|
|
|
5720
5787
|
if ('error' in res) {
|
|
5721
|
-
throw new
|
|
5788
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get supply');
|
|
5722
5789
|
}
|
|
5723
5790
|
|
|
5724
5791
|
return res.result;
|
|
@@ -5735,7 +5802,7 @@ class Connection {
|
|
|
5735
5802
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5736
5803
|
|
|
5737
5804
|
if ('error' in res) {
|
|
5738
|
-
throw new
|
|
5805
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token supply');
|
|
5739
5806
|
}
|
|
5740
5807
|
|
|
5741
5808
|
return res.result;
|
|
@@ -5752,7 +5819,7 @@ class Connection {
|
|
|
5752
5819
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5753
5820
|
|
|
5754
5821
|
if ('error' in res) {
|
|
5755
|
-
throw new
|
|
5822
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');
|
|
5756
5823
|
}
|
|
5757
5824
|
|
|
5758
5825
|
return res.result;
|
|
@@ -5764,7 +5831,11 @@ class Connection {
|
|
|
5764
5831
|
*/
|
|
5765
5832
|
|
|
5766
5833
|
|
|
5767
|
-
async getTokenAccountsByOwner(ownerAddress, filter,
|
|
5834
|
+
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
5835
|
+
const {
|
|
5836
|
+
commitment,
|
|
5837
|
+
config
|
|
5838
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5768
5839
|
let _args = [ownerAddress.toBase58()];
|
|
5769
5840
|
|
|
5770
5841
|
if ('mint' in filter) {
|
|
@@ -5777,13 +5848,13 @@ class Connection {
|
|
|
5777
5848
|
});
|
|
5778
5849
|
}
|
|
5779
5850
|
|
|
5780
|
-
const args = this._buildArgs(_args, commitment, 'base64');
|
|
5851
|
+
const args = this._buildArgs(_args, commitment, 'base64', config);
|
|
5781
5852
|
|
|
5782
5853
|
const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);
|
|
5783
5854
|
const res = create(unsafeRes, GetTokenAccountsByOwner);
|
|
5784
5855
|
|
|
5785
5856
|
if ('error' in res) {
|
|
5786
|
-
throw new
|
|
5857
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5787
5858
|
}
|
|
5788
5859
|
|
|
5789
5860
|
return res.result;
|
|
@@ -5814,7 +5885,7 @@ class Connection {
|
|
|
5814
5885
|
const res = create(unsafeRes, GetParsedTokenAccountsByOwner);
|
|
5815
5886
|
|
|
5816
5887
|
if ('error' in res) {
|
|
5817
|
-
throw new
|
|
5888
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5818
5889
|
}
|
|
5819
5890
|
|
|
5820
5891
|
return res.result;
|
|
@@ -5833,7 +5904,7 @@ class Connection {
|
|
|
5833
5904
|
const res = create(unsafeRes, GetLargestAccountsRpcResult);
|
|
5834
5905
|
|
|
5835
5906
|
if ('error' in res) {
|
|
5836
|
-
throw new
|
|
5907
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');
|
|
5837
5908
|
}
|
|
5838
5909
|
|
|
5839
5910
|
return res.result;
|
|
@@ -5851,7 +5922,7 @@ class Connection {
|
|
|
5851
5922
|
const res = create(unsafeRes, GetTokenLargestAccountsResult);
|
|
5852
5923
|
|
|
5853
5924
|
if ('error' in res) {
|
|
5854
|
-
throw new
|
|
5925
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');
|
|
5855
5926
|
}
|
|
5856
5927
|
|
|
5857
5928
|
return res.result;
|
|
@@ -5861,14 +5932,19 @@ class Connection {
|
|
|
5861
5932
|
*/
|
|
5862
5933
|
|
|
5863
5934
|
|
|
5864
|
-
async getAccountInfoAndContext(publicKey,
|
|
5865
|
-
const
|
|
5935
|
+
async getAccountInfoAndContext(publicKey, commitmentOrConfig) {
|
|
5936
|
+
const {
|
|
5937
|
+
commitment,
|
|
5938
|
+
config
|
|
5939
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5940
|
+
|
|
5941
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config);
|
|
5866
5942
|
|
|
5867
5943
|
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
|
|
5868
5944
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(AccountInfoResult)));
|
|
5869
5945
|
|
|
5870
5946
|
if ('error' in res) {
|
|
5871
|
-
throw new
|
|
5947
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5872
5948
|
}
|
|
5873
5949
|
|
|
5874
5950
|
return res.result;
|
|
@@ -5885,7 +5961,7 @@ class Connection {
|
|
|
5885
5961
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(ParsedAccountInfoResult)));
|
|
5886
5962
|
|
|
5887
5963
|
if ('error' in res) {
|
|
5888
|
-
throw new
|
|
5964
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5889
5965
|
}
|
|
5890
5966
|
|
|
5891
5967
|
return res.result;
|
|
@@ -5895,9 +5971,9 @@ class Connection {
|
|
|
5895
5971
|
*/
|
|
5896
5972
|
|
|
5897
5973
|
|
|
5898
|
-
async getAccountInfo(publicKey,
|
|
5974
|
+
async getAccountInfo(publicKey, commitmentOrConfig) {
|
|
5899
5975
|
try {
|
|
5900
|
-
const res = await this.getAccountInfoAndContext(publicKey,
|
|
5976
|
+
const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);
|
|
5901
5977
|
return res.value;
|
|
5902
5978
|
} catch (e) {
|
|
5903
5979
|
throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
|
|
@@ -5908,16 +5984,20 @@ class Connection {
|
|
|
5908
5984
|
*/
|
|
5909
5985
|
|
|
5910
5986
|
|
|
5911
|
-
async getMultipleAccountsInfoAndContext(publicKeys,
|
|
5987
|
+
async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {
|
|
5988
|
+
const {
|
|
5989
|
+
commitment,
|
|
5990
|
+
config
|
|
5991
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5912
5992
|
const keys = publicKeys.map(key => key.toBase58());
|
|
5913
5993
|
|
|
5914
|
-
const args = this._buildArgs([keys], commitment, 'base64');
|
|
5994
|
+
const args = this._buildArgs([keys], commitment, 'base64', config);
|
|
5915
5995
|
|
|
5916
5996
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
|
5917
5997
|
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
|
|
5918
5998
|
|
|
5919
5999
|
if ('error' in res) {
|
|
5920
|
-
throw new
|
|
6000
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);
|
|
5921
6001
|
}
|
|
5922
6002
|
|
|
5923
6003
|
return res.result;
|
|
@@ -5927,8 +6007,8 @@ class Connection {
|
|
|
5927
6007
|
*/
|
|
5928
6008
|
|
|
5929
6009
|
|
|
5930
|
-
async getMultipleAccountsInfo(publicKeys,
|
|
5931
|
-
const res = await this.getMultipleAccountsInfoAndContext(publicKeys,
|
|
6010
|
+
async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {
|
|
6011
|
+
const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);
|
|
5932
6012
|
return res.value;
|
|
5933
6013
|
}
|
|
5934
6014
|
/**
|
|
@@ -5936,16 +6016,23 @@ class Connection {
|
|
|
5936
6016
|
*/
|
|
5937
6017
|
|
|
5938
6018
|
|
|
5939
|
-
async getStakeActivation(publicKey,
|
|
5940
|
-
const
|
|
5941
|
-
|
|
5942
|
-
|
|
6019
|
+
async getStakeActivation(publicKey, commitmentOrConfig, epoch) {
|
|
6020
|
+
const {
|
|
6021
|
+
commitment,
|
|
6022
|
+
config
|
|
6023
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6024
|
+
|
|
6025
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
6026
|
+
/* encoding */
|
|
6027
|
+
, { ...config,
|
|
6028
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6029
|
+
});
|
|
5943
6030
|
|
|
5944
6031
|
const unsafeRes = await this._rpcRequest('getStakeActivation', args);
|
|
5945
6032
|
const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
|
|
5946
6033
|
|
|
5947
6034
|
if ('error' in res) {
|
|
5948
|
-
throw new
|
|
6035
|
+
throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);
|
|
5949
6036
|
}
|
|
5950
6037
|
|
|
5951
6038
|
return res.result;
|
|
@@ -5958,34 +6045,22 @@ class Connection {
|
|
|
5958
6045
|
|
|
5959
6046
|
|
|
5960
6047
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
5961
|
-
const
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
commitment = configOrCommitment.commitment;
|
|
5970
|
-
encoding = configOrCommitment.encoding;
|
|
5971
|
-
|
|
5972
|
-
if (configOrCommitment.dataSlice) {
|
|
5973
|
-
extra.dataSlice = configOrCommitment.dataSlice;
|
|
5974
|
-
}
|
|
5975
|
-
|
|
5976
|
-
if (configOrCommitment.filters) {
|
|
5977
|
-
extra.filters = configOrCommitment.filters;
|
|
5978
|
-
}
|
|
5979
|
-
}
|
|
5980
|
-
}
|
|
6048
|
+
const {
|
|
6049
|
+
commitment,
|
|
6050
|
+
config
|
|
6051
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6052
|
+
const {
|
|
6053
|
+
encoding,
|
|
6054
|
+
...configWithoutEncoding
|
|
6055
|
+
} = config || {};
|
|
5981
6056
|
|
|
5982
|
-
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64',
|
|
6057
|
+
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
5983
6058
|
|
|
5984
6059
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
5985
6060
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
|
|
5986
6061
|
|
|
5987
6062
|
if ('error' in res) {
|
|
5988
|
-
throw new
|
|
6063
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
5989
6064
|
}
|
|
5990
6065
|
|
|
5991
6066
|
return res.result;
|
|
@@ -5998,28 +6073,18 @@ class Connection {
|
|
|
5998
6073
|
|
|
5999
6074
|
|
|
6000
6075
|
async getParsedProgramAccounts(programId, configOrCommitment) {
|
|
6001
|
-
const
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
if (typeof configOrCommitment === 'string') {
|
|
6006
|
-
commitment = configOrCommitment;
|
|
6007
|
-
} else {
|
|
6008
|
-
commitment = configOrCommitment.commitment;
|
|
6009
|
-
|
|
6010
|
-
if (configOrCommitment.filters) {
|
|
6011
|
-
extra.filters = configOrCommitment.filters;
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
}
|
|
6076
|
+
const {
|
|
6077
|
+
commitment,
|
|
6078
|
+
config
|
|
6079
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6015
6080
|
|
|
6016
|
-
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed',
|
|
6081
|
+
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);
|
|
6017
6082
|
|
|
6018
6083
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6019
6084
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));
|
|
6020
6085
|
|
|
6021
6086
|
if ('error' in res) {
|
|
6022
|
-
throw new
|
|
6087
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6023
6088
|
}
|
|
6024
6089
|
|
|
6025
6090
|
return res.result;
|
|
@@ -6153,7 +6218,7 @@ class Connection {
|
|
|
6153
6218
|
const res = create(unsafeRes, jsonRpcResult(array(ContactInfoResult)));
|
|
6154
6219
|
|
|
6155
6220
|
if ('error' in res) {
|
|
6156
|
-
throw new
|
|
6221
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');
|
|
6157
6222
|
}
|
|
6158
6223
|
|
|
6159
6224
|
return res.result;
|
|
@@ -6170,7 +6235,7 @@ class Connection {
|
|
|
6170
6235
|
const res = create(unsafeRes, GetVoteAccounts);
|
|
6171
6236
|
|
|
6172
6237
|
if ('error' in res) {
|
|
6173
|
-
throw new
|
|
6238
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');
|
|
6174
6239
|
}
|
|
6175
6240
|
|
|
6176
6241
|
return res.result;
|
|
@@ -6180,14 +6245,21 @@ class Connection {
|
|
|
6180
6245
|
*/
|
|
6181
6246
|
|
|
6182
6247
|
|
|
6183
|
-
async getSlot(
|
|
6184
|
-
const
|
|
6248
|
+
async getSlot(commitmentOrConfig) {
|
|
6249
|
+
const {
|
|
6250
|
+
commitment,
|
|
6251
|
+
config
|
|
6252
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6253
|
+
|
|
6254
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6255
|
+
/* encoding */
|
|
6256
|
+
, config);
|
|
6185
6257
|
|
|
6186
6258
|
const unsafeRes = await this._rpcRequest('getSlot', args);
|
|
6187
6259
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6188
6260
|
|
|
6189
6261
|
if ('error' in res) {
|
|
6190
|
-
throw new
|
|
6262
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6191
6263
|
}
|
|
6192
6264
|
|
|
6193
6265
|
return res.result;
|
|
@@ -6197,14 +6269,21 @@ class Connection {
|
|
|
6197
6269
|
*/
|
|
6198
6270
|
|
|
6199
6271
|
|
|
6200
|
-
async getSlotLeader(
|
|
6201
|
-
const
|
|
6272
|
+
async getSlotLeader(commitmentOrConfig) {
|
|
6273
|
+
const {
|
|
6274
|
+
commitment,
|
|
6275
|
+
config
|
|
6276
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6277
|
+
|
|
6278
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6279
|
+
/* encoding */
|
|
6280
|
+
, config);
|
|
6202
6281
|
|
|
6203
6282
|
const unsafeRes = await this._rpcRequest('getSlotLeader', args);
|
|
6204
6283
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6205
6284
|
|
|
6206
6285
|
if ('error' in res) {
|
|
6207
|
-
throw new
|
|
6286
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');
|
|
6208
6287
|
}
|
|
6209
6288
|
|
|
6210
6289
|
return res.result;
|
|
@@ -6223,7 +6302,7 @@ class Connection {
|
|
|
6223
6302
|
const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
|
|
6224
6303
|
|
|
6225
6304
|
if ('error' in res) {
|
|
6226
|
-
throw new
|
|
6305
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');
|
|
6227
6306
|
}
|
|
6228
6307
|
|
|
6229
6308
|
return res.result;
|
|
@@ -6261,7 +6340,7 @@ class Connection {
|
|
|
6261
6340
|
const res = create(unsafeRes, GetSignatureStatusesRpcResult);
|
|
6262
6341
|
|
|
6263
6342
|
if ('error' in res) {
|
|
6264
|
-
throw new
|
|
6343
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signature status');
|
|
6265
6344
|
}
|
|
6266
6345
|
|
|
6267
6346
|
return res.result;
|
|
@@ -6271,14 +6350,21 @@ class Connection {
|
|
|
6271
6350
|
*/
|
|
6272
6351
|
|
|
6273
6352
|
|
|
6274
|
-
async getTransactionCount(
|
|
6275
|
-
const
|
|
6353
|
+
async getTransactionCount(commitmentOrConfig) {
|
|
6354
|
+
const {
|
|
6355
|
+
commitment,
|
|
6356
|
+
config
|
|
6357
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6358
|
+
|
|
6359
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6360
|
+
/* encoding */
|
|
6361
|
+
, config);
|
|
6276
6362
|
|
|
6277
6363
|
const unsafeRes = await this._rpcRequest('getTransactionCount', args);
|
|
6278
6364
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6279
6365
|
|
|
6280
6366
|
if ('error' in res) {
|
|
6281
|
-
throw new
|
|
6367
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');
|
|
6282
6368
|
}
|
|
6283
6369
|
|
|
6284
6370
|
return res.result;
|
|
@@ -6309,7 +6395,7 @@ class Connection {
|
|
|
6309
6395
|
const res = create(unsafeRes, GetInflationGovernorRpcResult);
|
|
6310
6396
|
|
|
6311
6397
|
if ('error' in res) {
|
|
6312
|
-
throw new
|
|
6398
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation');
|
|
6313
6399
|
}
|
|
6314
6400
|
|
|
6315
6401
|
return res.result;
|
|
@@ -6319,16 +6405,23 @@ class Connection {
|
|
|
6319
6405
|
*/
|
|
6320
6406
|
|
|
6321
6407
|
|
|
6322
|
-
async getInflationReward(addresses, epoch,
|
|
6323
|
-
const
|
|
6324
|
-
|
|
6408
|
+
async getInflationReward(addresses, epoch, commitmentOrConfig) {
|
|
6409
|
+
const {
|
|
6410
|
+
commitment,
|
|
6411
|
+
config
|
|
6412
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6413
|
+
|
|
6414
|
+
const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
|
|
6415
|
+
/* encoding */
|
|
6416
|
+
, { ...config,
|
|
6417
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6325
6418
|
});
|
|
6326
6419
|
|
|
6327
6420
|
const unsafeRes = await this._rpcRequest('getInflationReward', args);
|
|
6328
6421
|
const res = create(unsafeRes, GetInflationRewardResult);
|
|
6329
6422
|
|
|
6330
6423
|
if ('error' in res) {
|
|
6331
|
-
throw new
|
|
6424
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');
|
|
6332
6425
|
}
|
|
6333
6426
|
|
|
6334
6427
|
return res.result;
|
|
@@ -6338,14 +6431,21 @@ class Connection {
|
|
|
6338
6431
|
*/
|
|
6339
6432
|
|
|
6340
6433
|
|
|
6341
|
-
async getEpochInfo(
|
|
6342
|
-
const
|
|
6434
|
+
async getEpochInfo(commitmentOrConfig) {
|
|
6435
|
+
const {
|
|
6436
|
+
commitment,
|
|
6437
|
+
config
|
|
6438
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6439
|
+
|
|
6440
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6441
|
+
/* encoding */
|
|
6442
|
+
, config);
|
|
6343
6443
|
|
|
6344
6444
|
const unsafeRes = await this._rpcRequest('getEpochInfo', args);
|
|
6345
6445
|
const res = create(unsafeRes, GetEpochInfoRpcResult);
|
|
6346
6446
|
|
|
6347
6447
|
if ('error' in res) {
|
|
6348
|
-
throw new
|
|
6448
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');
|
|
6349
6449
|
}
|
|
6350
6450
|
|
|
6351
6451
|
return res.result;
|
|
@@ -6360,7 +6460,7 @@ class Connection {
|
|
|
6360
6460
|
const res = create(unsafeRes, GetEpochScheduleRpcResult);
|
|
6361
6461
|
|
|
6362
6462
|
if ('error' in res) {
|
|
6363
|
-
throw new
|
|
6463
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');
|
|
6364
6464
|
}
|
|
6365
6465
|
|
|
6366
6466
|
const epochSchedule = res.result;
|
|
@@ -6377,7 +6477,7 @@ class Connection {
|
|
|
6377
6477
|
const res = create(unsafeRes, GetLeaderScheduleRpcResult);
|
|
6378
6478
|
|
|
6379
6479
|
if ('error' in res) {
|
|
6380
|
-
throw new
|
|
6480
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');
|
|
6381
6481
|
}
|
|
6382
6482
|
|
|
6383
6483
|
return res.result;
|
|
@@ -6416,7 +6516,7 @@ class Connection {
|
|
|
6416
6516
|
const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
|
|
6417
6517
|
|
|
6418
6518
|
if ('error' in res) {
|
|
6419
|
-
throw new
|
|
6519
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
|
|
6420
6520
|
}
|
|
6421
6521
|
|
|
6422
6522
|
return res.result;
|
|
@@ -6434,7 +6534,7 @@ class Connection {
|
|
|
6434
6534
|
const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
|
|
6435
6535
|
|
|
6436
6536
|
if ('error' in res) {
|
|
6437
|
-
throw new
|
|
6537
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');
|
|
6438
6538
|
}
|
|
6439
6539
|
|
|
6440
6540
|
return res.result;
|
|
@@ -6453,7 +6553,7 @@ class Connection {
|
|
|
6453
6553
|
const res = create(unsafeRes, GetFeeCalculatorRpcResult);
|
|
6454
6554
|
|
|
6455
6555
|
if ('error' in res) {
|
|
6456
|
-
throw new
|
|
6556
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');
|
|
6457
6557
|
}
|
|
6458
6558
|
|
|
6459
6559
|
const {
|
|
@@ -6479,7 +6579,7 @@ class Connection {
|
|
|
6479
6579
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(number())));
|
|
6480
6580
|
|
|
6481
6581
|
if ('error' in res) {
|
|
6482
|
-
throw new
|
|
6582
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6483
6583
|
}
|
|
6484
6584
|
|
|
6485
6585
|
if (res.result === null) {
|
|
@@ -6510,9 +6610,9 @@ class Connection {
|
|
|
6510
6610
|
*/
|
|
6511
6611
|
|
|
6512
6612
|
|
|
6513
|
-
async getLatestBlockhash(
|
|
6613
|
+
async getLatestBlockhash(commitmentOrConfig) {
|
|
6514
6614
|
try {
|
|
6515
|
-
const res = await this.getLatestBlockhashAndContext(
|
|
6615
|
+
const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);
|
|
6516
6616
|
return res.value;
|
|
6517
6617
|
} catch (e) {
|
|
6518
6618
|
throw new Error('failed to get recent blockhash: ' + e);
|
|
@@ -6524,14 +6624,21 @@ class Connection {
|
|
|
6524
6624
|
*/
|
|
6525
6625
|
|
|
6526
6626
|
|
|
6527
|
-
async getLatestBlockhashAndContext(
|
|
6528
|
-
const
|
|
6627
|
+
async getLatestBlockhashAndContext(commitmentOrConfig) {
|
|
6628
|
+
const {
|
|
6629
|
+
commitment,
|
|
6630
|
+
config
|
|
6631
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6632
|
+
|
|
6633
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6634
|
+
/* encoding */
|
|
6635
|
+
, config);
|
|
6529
6636
|
|
|
6530
6637
|
const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);
|
|
6531
6638
|
const res = create(unsafeRes, GetLatestBlockhashRpcResult);
|
|
6532
6639
|
|
|
6533
6640
|
if ('error' in res) {
|
|
6534
|
-
throw new
|
|
6641
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');
|
|
6535
6642
|
}
|
|
6536
6643
|
|
|
6537
6644
|
return res.result;
|
|
@@ -6546,7 +6653,7 @@ class Connection {
|
|
|
6546
6653
|
const res = create(unsafeRes, jsonRpcResult(VersionResult));
|
|
6547
6654
|
|
|
6548
6655
|
if ('error' in res) {
|
|
6549
|
-
throw new
|
|
6656
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get version');
|
|
6550
6657
|
}
|
|
6551
6658
|
|
|
6552
6659
|
return res.result;
|
|
@@ -6561,7 +6668,7 @@ class Connection {
|
|
|
6561
6668
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6562
6669
|
|
|
6563
6670
|
if ('error' in res) {
|
|
6564
|
-
throw new
|
|
6671
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');
|
|
6565
6672
|
}
|
|
6566
6673
|
|
|
6567
6674
|
return res.result;
|
|
@@ -6578,7 +6685,7 @@ class Connection {
|
|
|
6578
6685
|
const res = create(unsafeRes, GetBlockRpcResult);
|
|
6579
6686
|
|
|
6580
6687
|
if ('error' in res) {
|
|
6581
|
-
throw new
|
|
6688
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6582
6689
|
}
|
|
6583
6690
|
|
|
6584
6691
|
const result = res.result;
|
|
@@ -6603,14 +6710,21 @@ class Connection {
|
|
|
6603
6710
|
*/
|
|
6604
6711
|
|
|
6605
6712
|
|
|
6606
|
-
async getBlockHeight(
|
|
6607
|
-
const
|
|
6713
|
+
async getBlockHeight(commitmentOrConfig) {
|
|
6714
|
+
const {
|
|
6715
|
+
commitment,
|
|
6716
|
+
config
|
|
6717
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6718
|
+
|
|
6719
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6720
|
+
/* encoding */
|
|
6721
|
+
, config);
|
|
6608
6722
|
|
|
6609
6723
|
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
6610
6724
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6611
6725
|
|
|
6612
6726
|
if ('error' in res) {
|
|
6613
|
-
throw new
|
|
6727
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
6614
6728
|
}
|
|
6615
6729
|
|
|
6616
6730
|
return res.result;
|
|
@@ -6641,7 +6755,7 @@ class Connection {
|
|
|
6641
6755
|
const res = create(unsafeRes, BlockProductionResponseStruct);
|
|
6642
6756
|
|
|
6643
6757
|
if ('error' in res) {
|
|
6644
|
-
throw new
|
|
6758
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block production information');
|
|
6645
6759
|
}
|
|
6646
6760
|
|
|
6647
6761
|
return res.result;
|
|
@@ -6658,7 +6772,7 @@ class Connection {
|
|
|
6658
6772
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6659
6773
|
|
|
6660
6774
|
if ('error' in res) {
|
|
6661
|
-
throw new
|
|
6775
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6662
6776
|
}
|
|
6663
6777
|
|
|
6664
6778
|
const result = res.result;
|
|
@@ -6681,7 +6795,7 @@ class Connection {
|
|
|
6681
6795
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6682
6796
|
|
|
6683
6797
|
if ('error' in res) {
|
|
6684
|
-
throw new
|
|
6798
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6685
6799
|
}
|
|
6686
6800
|
|
|
6687
6801
|
return res.result;
|
|
@@ -6705,7 +6819,7 @@ class Connection {
|
|
|
6705
6819
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6706
6820
|
|
|
6707
6821
|
if ('error' in res) {
|
|
6708
|
-
throw new
|
|
6822
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6709
6823
|
}
|
|
6710
6824
|
|
|
6711
6825
|
return res.result;
|
|
@@ -6732,7 +6846,7 @@ class Connection {
|
|
|
6732
6846
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6733
6847
|
|
|
6734
6848
|
if ('error' in res) {
|
|
6735
|
-
throw new
|
|
6849
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6736
6850
|
}
|
|
6737
6851
|
|
|
6738
6852
|
const result = res.result;
|
|
@@ -6760,7 +6874,7 @@ class Connection {
|
|
|
6760
6874
|
const res = create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
6761
6875
|
|
|
6762
6876
|
if ('error' in res) {
|
|
6763
|
-
throw new
|
|
6877
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6764
6878
|
}
|
|
6765
6879
|
|
|
6766
6880
|
const result = res.result;
|
|
@@ -6807,7 +6921,7 @@ class Connection {
|
|
|
6807
6921
|
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
|
6808
6922
|
|
|
6809
6923
|
if ('error' in res) {
|
|
6810
|
-
throw new
|
|
6924
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get blocks');
|
|
6811
6925
|
}
|
|
6812
6926
|
|
|
6813
6927
|
return res.result;
|
|
@@ -6827,7 +6941,7 @@ class Connection {
|
|
|
6827
6941
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6828
6942
|
|
|
6829
6943
|
if ('error' in res) {
|
|
6830
|
-
throw new
|
|
6944
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
6831
6945
|
}
|
|
6832
6946
|
|
|
6833
6947
|
const result = res.result;
|
|
@@ -6855,7 +6969,7 @@ class Connection {
|
|
|
6855
6969
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6856
6970
|
|
|
6857
6971
|
if ('error' in res) {
|
|
6858
|
-
throw new
|
|
6972
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6859
6973
|
}
|
|
6860
6974
|
|
|
6861
6975
|
const result = res.result;
|
|
@@ -6880,7 +6994,7 @@ class Connection {
|
|
|
6880
6994
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6881
6995
|
|
|
6882
6996
|
if ('error' in res) {
|
|
6883
|
-
throw new
|
|
6997
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6884
6998
|
}
|
|
6885
6999
|
|
|
6886
7000
|
const result = res.result;
|
|
@@ -6905,7 +7019,7 @@ class Connection {
|
|
|
6905
7019
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6906
7020
|
|
|
6907
7021
|
if ('error' in res) {
|
|
6908
|
-
throw new
|
|
7022
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
|
|
6909
7023
|
}
|
|
6910
7024
|
|
|
6911
7025
|
return res.result;
|
|
@@ -6931,7 +7045,7 @@ class Connection {
|
|
|
6931
7045
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6932
7046
|
|
|
6933
7047
|
if ('error' in res) {
|
|
6934
|
-
throw new
|
|
7048
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');
|
|
6935
7049
|
}
|
|
6936
7050
|
|
|
6937
7051
|
return res.result;
|
|
@@ -7020,7 +7134,7 @@ class Connection {
|
|
|
7020
7134
|
const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
7021
7135
|
|
|
7022
7136
|
if ('error' in res) {
|
|
7023
|
-
throw new
|
|
7137
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');
|
|
7024
7138
|
}
|
|
7025
7139
|
|
|
7026
7140
|
return res.result;
|
|
@@ -7042,7 +7156,7 @@ class Connection {
|
|
|
7042
7156
|
const res = create(unsafeRes, GetSignaturesForAddressRpcResult);
|
|
7043
7157
|
|
|
7044
7158
|
if ('error' in res) {
|
|
7045
|
-
throw new
|
|
7159
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');
|
|
7046
7160
|
}
|
|
7047
7161
|
|
|
7048
7162
|
return res.result;
|
|
@@ -7099,7 +7213,7 @@ class Connection {
|
|
|
7099
7213
|
const res = create(unsafeRes, RequestAirdropRpcResult);
|
|
7100
7214
|
|
|
7101
7215
|
if ('error' in res) {
|
|
7102
|
-
throw new
|
|
7216
|
+
throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);
|
|
7103
7217
|
}
|
|
7104
7218
|
|
|
7105
7219
|
return res.result;
|
|
@@ -7329,10 +7443,14 @@ class Connection {
|
|
|
7329
7443
|
const skipPreflight = options && options.skipPreflight;
|
|
7330
7444
|
const preflightCommitment = options && options.preflightCommitment || this.commitment;
|
|
7331
7445
|
|
|
7332
|
-
if (options && options.maxRetries) {
|
|
7446
|
+
if (options && options.maxRetries != null) {
|
|
7333
7447
|
config.maxRetries = options.maxRetries;
|
|
7334
7448
|
}
|
|
7335
7449
|
|
|
7450
|
+
if (options && options.minContextSlot != null) {
|
|
7451
|
+
config.minContextSlot = options.minContextSlot;
|
|
7452
|
+
}
|
|
7453
|
+
|
|
7336
7454
|
if (skipPreflight) {
|
|
7337
7455
|
config.skipPreflight = skipPreflight;
|
|
7338
7456
|
}
|
|
@@ -9742,7 +9860,8 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, confirma
|
|
|
9742
9860
|
|
|
9743
9861
|
const sendOptions = options && {
|
|
9744
9862
|
skipPreflight: options.skipPreflight,
|
|
9745
|
-
preflightCommitment: options.preflightCommitment || options.commitment
|
|
9863
|
+
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
9864
|
+
minContextSlot: options.minContextSlot
|
|
9746
9865
|
};
|
|
9747
9866
|
const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);
|
|
9748
9867
|
const commitment = options && options.commitment;
|
|
@@ -9794,5 +9913,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9794
9913
|
|
|
9795
9914
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9796
9915
|
|
|
9797
|
-
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 };
|
|
9916
|
+
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 };
|
|
9798
9917
|
//# sourceMappingURL=index.browser.esm.js.map
|