@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.esm.js
CHANGED
|
@@ -3097,7 +3097,8 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
3097
3097
|
const sendOptions = options && {
|
|
3098
3098
|
skipPreflight: options.skipPreflight,
|
|
3099
3099
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
3100
|
-
maxRetries: options.maxRetries
|
|
3100
|
+
maxRetries: options.maxRetries,
|
|
3101
|
+
minContextSlot: options.minContextSlot
|
|
3101
3102
|
};
|
|
3102
3103
|
const signature = await connection.sendTransaction(transaction, signers, sendOptions);
|
|
3103
3104
|
const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
|
|
@@ -4573,6 +4574,41 @@ class SendTransactionError extends Error {
|
|
|
4573
4574
|
this.logs = logs;
|
|
4574
4575
|
}
|
|
4575
4576
|
|
|
4577
|
+
} // Keep in sync with client/src/rpc_custom_errors.rs
|
|
4578
|
+
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
|
|
4579
|
+
|
|
4580
|
+
const SolanaJSONRPCErrorCode = {
|
|
4581
|
+
JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001,
|
|
4582
|
+
JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002,
|
|
4583
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003,
|
|
4584
|
+
JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004,
|
|
4585
|
+
JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005,
|
|
4586
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006,
|
|
4587
|
+
JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007,
|
|
4588
|
+
JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008,
|
|
4589
|
+
JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009,
|
|
4590
|
+
JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010,
|
|
4591
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011,
|
|
4592
|
+
JSON_RPC_SCAN_ERROR: -32012,
|
|
4593
|
+
JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013,
|
|
4594
|
+
JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014,
|
|
4595
|
+
JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015,
|
|
4596
|
+
JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016
|
|
4597
|
+
};
|
|
4598
|
+
class SolanaJSONRPCError extends Error {
|
|
4599
|
+
constructor({
|
|
4600
|
+
code,
|
|
4601
|
+
message,
|
|
4602
|
+
data
|
|
4603
|
+
}, customMessage) {
|
|
4604
|
+
super(customMessage != null ? `${customMessage}: ${message}` : message);
|
|
4605
|
+
this.code = void 0;
|
|
4606
|
+
this.data = void 0;
|
|
4607
|
+
this.code = code;
|
|
4608
|
+
this.data = data;
|
|
4609
|
+
this.name = 'SolanaJSONRPCError';
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4576
4612
|
}
|
|
4577
4613
|
|
|
4578
4614
|
async function fetchImpl (input, init) {
|
|
@@ -4661,9 +4697,32 @@ const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;
|
|
|
4661
4697
|
* https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d
|
|
4662
4698
|
*/
|
|
4663
4699
|
|
|
4700
|
+
/** @internal */
|
|
4701
|
+
function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
4702
|
+
let commitment;
|
|
4703
|
+
let config;
|
|
4704
|
+
|
|
4705
|
+
if (typeof commitmentOrConfig === 'string') {
|
|
4706
|
+
commitment = commitmentOrConfig;
|
|
4707
|
+
} else if (commitmentOrConfig) {
|
|
4708
|
+
const {
|
|
4709
|
+
commitment: specifiedCommitment,
|
|
4710
|
+
...specifiedConfig
|
|
4711
|
+
} = commitmentOrConfig;
|
|
4712
|
+
commitment = specifiedCommitment;
|
|
4713
|
+
config = specifiedConfig;
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
return {
|
|
4717
|
+
commitment,
|
|
4718
|
+
config
|
|
4719
|
+
};
|
|
4720
|
+
}
|
|
4664
4721
|
/**
|
|
4665
4722
|
* @internal
|
|
4666
4723
|
*/
|
|
4724
|
+
|
|
4725
|
+
|
|
4667
4726
|
function createRpcResult(result) {
|
|
4668
4727
|
return union([type({
|
|
4669
4728
|
jsonrpc: literal('2.0'),
|
|
@@ -5706,14 +5765,22 @@ class Connection {
|
|
|
5706
5765
|
*/
|
|
5707
5766
|
|
|
5708
5767
|
|
|
5709
|
-
async getBalanceAndContext(publicKey,
|
|
5710
|
-
|
|
5768
|
+
async getBalanceAndContext(publicKey, commitmentOrConfig) {
|
|
5769
|
+
/** @internal */
|
|
5770
|
+
const {
|
|
5771
|
+
commitment,
|
|
5772
|
+
config
|
|
5773
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5774
|
+
|
|
5775
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
5776
|
+
/* encoding */
|
|
5777
|
+
, config);
|
|
5711
5778
|
|
|
5712
5779
|
const unsafeRes = await this._rpcRequest('getBalance', args);
|
|
5713
5780
|
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
5714
5781
|
|
|
5715
5782
|
if ('error' in res) {
|
|
5716
|
-
throw new
|
|
5783
|
+
throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);
|
|
5717
5784
|
}
|
|
5718
5785
|
|
|
5719
5786
|
return res.result;
|
|
@@ -5723,8 +5790,8 @@ class Connection {
|
|
|
5723
5790
|
*/
|
|
5724
5791
|
|
|
5725
5792
|
|
|
5726
|
-
async getBalance(publicKey,
|
|
5727
|
-
return await this.getBalanceAndContext(publicKey,
|
|
5793
|
+
async getBalance(publicKey, commitmentOrConfig) {
|
|
5794
|
+
return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {
|
|
5728
5795
|
throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);
|
|
5729
5796
|
});
|
|
5730
5797
|
}
|
|
@@ -5738,7 +5805,7 @@ class Connection {
|
|
|
5738
5805
|
const res = create(unsafeRes, jsonRpcResult(nullable(number())));
|
|
5739
5806
|
|
|
5740
5807
|
if ('error' in res) {
|
|
5741
|
-
throw new
|
|
5808
|
+
throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);
|
|
5742
5809
|
}
|
|
5743
5810
|
|
|
5744
5811
|
return res.result;
|
|
@@ -5754,7 +5821,7 @@ class Connection {
|
|
|
5754
5821
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
5755
5822
|
|
|
5756
5823
|
if ('error' in res) {
|
|
5757
|
-
throw new
|
|
5824
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');
|
|
5758
5825
|
}
|
|
5759
5826
|
|
|
5760
5827
|
return res.result;
|
|
@@ -5769,7 +5836,7 @@ class Connection {
|
|
|
5769
5836
|
const res = create(unsafeRes, SlotRpcResult);
|
|
5770
5837
|
|
|
5771
5838
|
if ('error' in res) {
|
|
5772
|
-
throw new
|
|
5839
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get first available block');
|
|
5773
5840
|
}
|
|
5774
5841
|
|
|
5775
5842
|
return res.result;
|
|
@@ -5800,7 +5867,7 @@ class Connection {
|
|
|
5800
5867
|
const res = create(unsafeRes, GetSupplyRpcResult);
|
|
5801
5868
|
|
|
5802
5869
|
if ('error' in res) {
|
|
5803
|
-
throw new
|
|
5870
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get supply');
|
|
5804
5871
|
}
|
|
5805
5872
|
|
|
5806
5873
|
return res.result;
|
|
@@ -5817,7 +5884,7 @@ class Connection {
|
|
|
5817
5884
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5818
5885
|
|
|
5819
5886
|
if ('error' in res) {
|
|
5820
|
-
throw new
|
|
5887
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token supply');
|
|
5821
5888
|
}
|
|
5822
5889
|
|
|
5823
5890
|
return res.result;
|
|
@@ -5834,7 +5901,7 @@ class Connection {
|
|
|
5834
5901
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5835
5902
|
|
|
5836
5903
|
if ('error' in res) {
|
|
5837
|
-
throw new
|
|
5904
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');
|
|
5838
5905
|
}
|
|
5839
5906
|
|
|
5840
5907
|
return res.result;
|
|
@@ -5846,7 +5913,11 @@ class Connection {
|
|
|
5846
5913
|
*/
|
|
5847
5914
|
|
|
5848
5915
|
|
|
5849
|
-
async getTokenAccountsByOwner(ownerAddress, filter,
|
|
5916
|
+
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
5917
|
+
const {
|
|
5918
|
+
commitment,
|
|
5919
|
+
config
|
|
5920
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5850
5921
|
let _args = [ownerAddress.toBase58()];
|
|
5851
5922
|
|
|
5852
5923
|
if ('mint' in filter) {
|
|
@@ -5859,13 +5930,13 @@ class Connection {
|
|
|
5859
5930
|
});
|
|
5860
5931
|
}
|
|
5861
5932
|
|
|
5862
|
-
const args = this._buildArgs(_args, commitment, 'base64');
|
|
5933
|
+
const args = this._buildArgs(_args, commitment, 'base64', config);
|
|
5863
5934
|
|
|
5864
5935
|
const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);
|
|
5865
5936
|
const res = create(unsafeRes, GetTokenAccountsByOwner);
|
|
5866
5937
|
|
|
5867
5938
|
if ('error' in res) {
|
|
5868
|
-
throw new
|
|
5939
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5869
5940
|
}
|
|
5870
5941
|
|
|
5871
5942
|
return res.result;
|
|
@@ -5896,7 +5967,7 @@ class Connection {
|
|
|
5896
5967
|
const res = create(unsafeRes, GetParsedTokenAccountsByOwner);
|
|
5897
5968
|
|
|
5898
5969
|
if ('error' in res) {
|
|
5899
|
-
throw new
|
|
5970
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5900
5971
|
}
|
|
5901
5972
|
|
|
5902
5973
|
return res.result;
|
|
@@ -5915,7 +5986,7 @@ class Connection {
|
|
|
5915
5986
|
const res = create(unsafeRes, GetLargestAccountsRpcResult);
|
|
5916
5987
|
|
|
5917
5988
|
if ('error' in res) {
|
|
5918
|
-
throw new
|
|
5989
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');
|
|
5919
5990
|
}
|
|
5920
5991
|
|
|
5921
5992
|
return res.result;
|
|
@@ -5933,7 +6004,7 @@ class Connection {
|
|
|
5933
6004
|
const res = create(unsafeRes, GetTokenLargestAccountsResult);
|
|
5934
6005
|
|
|
5935
6006
|
if ('error' in res) {
|
|
5936
|
-
throw new
|
|
6007
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');
|
|
5937
6008
|
}
|
|
5938
6009
|
|
|
5939
6010
|
return res.result;
|
|
@@ -5943,14 +6014,19 @@ class Connection {
|
|
|
5943
6014
|
*/
|
|
5944
6015
|
|
|
5945
6016
|
|
|
5946
|
-
async getAccountInfoAndContext(publicKey,
|
|
5947
|
-
const
|
|
6017
|
+
async getAccountInfoAndContext(publicKey, commitmentOrConfig) {
|
|
6018
|
+
const {
|
|
6019
|
+
commitment,
|
|
6020
|
+
config
|
|
6021
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6022
|
+
|
|
6023
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config);
|
|
5948
6024
|
|
|
5949
6025
|
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
|
|
5950
6026
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(AccountInfoResult)));
|
|
5951
6027
|
|
|
5952
6028
|
if ('error' in res) {
|
|
5953
|
-
throw new
|
|
6029
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5954
6030
|
}
|
|
5955
6031
|
|
|
5956
6032
|
return res.result;
|
|
@@ -5967,7 +6043,7 @@ class Connection {
|
|
|
5967
6043
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(ParsedAccountInfoResult)));
|
|
5968
6044
|
|
|
5969
6045
|
if ('error' in res) {
|
|
5970
|
-
throw new
|
|
6046
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5971
6047
|
}
|
|
5972
6048
|
|
|
5973
6049
|
return res.result;
|
|
@@ -5977,9 +6053,9 @@ class Connection {
|
|
|
5977
6053
|
*/
|
|
5978
6054
|
|
|
5979
6055
|
|
|
5980
|
-
async getAccountInfo(publicKey,
|
|
6056
|
+
async getAccountInfo(publicKey, commitmentOrConfig) {
|
|
5981
6057
|
try {
|
|
5982
|
-
const res = await this.getAccountInfoAndContext(publicKey,
|
|
6058
|
+
const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);
|
|
5983
6059
|
return res.value;
|
|
5984
6060
|
} catch (e) {
|
|
5985
6061
|
throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
|
|
@@ -5990,16 +6066,20 @@ class Connection {
|
|
|
5990
6066
|
*/
|
|
5991
6067
|
|
|
5992
6068
|
|
|
5993
|
-
async getMultipleAccountsInfoAndContext(publicKeys,
|
|
6069
|
+
async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {
|
|
6070
|
+
const {
|
|
6071
|
+
commitment,
|
|
6072
|
+
config
|
|
6073
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5994
6074
|
const keys = publicKeys.map(key => key.toBase58());
|
|
5995
6075
|
|
|
5996
|
-
const args = this._buildArgs([keys], commitment, 'base64');
|
|
6076
|
+
const args = this._buildArgs([keys], commitment, 'base64', config);
|
|
5997
6077
|
|
|
5998
6078
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
|
5999
6079
|
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
|
|
6000
6080
|
|
|
6001
6081
|
if ('error' in res) {
|
|
6002
|
-
throw new
|
|
6082
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);
|
|
6003
6083
|
}
|
|
6004
6084
|
|
|
6005
6085
|
return res.result;
|
|
@@ -6009,8 +6089,8 @@ class Connection {
|
|
|
6009
6089
|
*/
|
|
6010
6090
|
|
|
6011
6091
|
|
|
6012
|
-
async getMultipleAccountsInfo(publicKeys,
|
|
6013
|
-
const res = await this.getMultipleAccountsInfoAndContext(publicKeys,
|
|
6092
|
+
async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {
|
|
6093
|
+
const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);
|
|
6014
6094
|
return res.value;
|
|
6015
6095
|
}
|
|
6016
6096
|
/**
|
|
@@ -6018,16 +6098,23 @@ class Connection {
|
|
|
6018
6098
|
*/
|
|
6019
6099
|
|
|
6020
6100
|
|
|
6021
|
-
async getStakeActivation(publicKey,
|
|
6022
|
-
const
|
|
6023
|
-
|
|
6024
|
-
|
|
6101
|
+
async getStakeActivation(publicKey, commitmentOrConfig, epoch) {
|
|
6102
|
+
const {
|
|
6103
|
+
commitment,
|
|
6104
|
+
config
|
|
6105
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6106
|
+
|
|
6107
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
6108
|
+
/* encoding */
|
|
6109
|
+
, { ...config,
|
|
6110
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6111
|
+
});
|
|
6025
6112
|
|
|
6026
6113
|
const unsafeRes = await this._rpcRequest('getStakeActivation', args);
|
|
6027
6114
|
const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
|
|
6028
6115
|
|
|
6029
6116
|
if ('error' in res) {
|
|
6030
|
-
throw new
|
|
6117
|
+
throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);
|
|
6031
6118
|
}
|
|
6032
6119
|
|
|
6033
6120
|
return res.result;
|
|
@@ -6040,34 +6127,22 @@ class Connection {
|
|
|
6040
6127
|
|
|
6041
6128
|
|
|
6042
6129
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
6043
|
-
const
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
commitment = configOrCommitment.commitment;
|
|
6052
|
-
encoding = configOrCommitment.encoding;
|
|
6053
|
-
|
|
6054
|
-
if (configOrCommitment.dataSlice) {
|
|
6055
|
-
extra.dataSlice = configOrCommitment.dataSlice;
|
|
6056
|
-
}
|
|
6057
|
-
|
|
6058
|
-
if (configOrCommitment.filters) {
|
|
6059
|
-
extra.filters = configOrCommitment.filters;
|
|
6060
|
-
}
|
|
6061
|
-
}
|
|
6062
|
-
}
|
|
6130
|
+
const {
|
|
6131
|
+
commitment,
|
|
6132
|
+
config
|
|
6133
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6134
|
+
const {
|
|
6135
|
+
encoding,
|
|
6136
|
+
...configWithoutEncoding
|
|
6137
|
+
} = config || {};
|
|
6063
6138
|
|
|
6064
|
-
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64',
|
|
6139
|
+
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
6065
6140
|
|
|
6066
6141
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6067
6142
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
|
|
6068
6143
|
|
|
6069
6144
|
if ('error' in res) {
|
|
6070
|
-
throw new
|
|
6145
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6071
6146
|
}
|
|
6072
6147
|
|
|
6073
6148
|
return res.result;
|
|
@@ -6080,28 +6155,18 @@ class Connection {
|
|
|
6080
6155
|
|
|
6081
6156
|
|
|
6082
6157
|
async getParsedProgramAccounts(programId, configOrCommitment) {
|
|
6083
|
-
const
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
if (typeof configOrCommitment === 'string') {
|
|
6088
|
-
commitment = configOrCommitment;
|
|
6089
|
-
} else {
|
|
6090
|
-
commitment = configOrCommitment.commitment;
|
|
6091
|
-
|
|
6092
|
-
if (configOrCommitment.filters) {
|
|
6093
|
-
extra.filters = configOrCommitment.filters;
|
|
6094
|
-
}
|
|
6095
|
-
}
|
|
6096
|
-
}
|
|
6158
|
+
const {
|
|
6159
|
+
commitment,
|
|
6160
|
+
config
|
|
6161
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6097
6162
|
|
|
6098
|
-
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed',
|
|
6163
|
+
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);
|
|
6099
6164
|
|
|
6100
6165
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6101
6166
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));
|
|
6102
6167
|
|
|
6103
6168
|
if ('error' in res) {
|
|
6104
|
-
throw new
|
|
6169
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6105
6170
|
}
|
|
6106
6171
|
|
|
6107
6172
|
return res.result;
|
|
@@ -6235,7 +6300,7 @@ class Connection {
|
|
|
6235
6300
|
const res = create(unsafeRes, jsonRpcResult(array(ContactInfoResult)));
|
|
6236
6301
|
|
|
6237
6302
|
if ('error' in res) {
|
|
6238
|
-
throw new
|
|
6303
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');
|
|
6239
6304
|
}
|
|
6240
6305
|
|
|
6241
6306
|
return res.result;
|
|
@@ -6252,7 +6317,7 @@ class Connection {
|
|
|
6252
6317
|
const res = create(unsafeRes, GetVoteAccounts);
|
|
6253
6318
|
|
|
6254
6319
|
if ('error' in res) {
|
|
6255
|
-
throw new
|
|
6320
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');
|
|
6256
6321
|
}
|
|
6257
6322
|
|
|
6258
6323
|
return res.result;
|
|
@@ -6262,14 +6327,21 @@ class Connection {
|
|
|
6262
6327
|
*/
|
|
6263
6328
|
|
|
6264
6329
|
|
|
6265
|
-
async getSlot(
|
|
6266
|
-
const
|
|
6330
|
+
async getSlot(commitmentOrConfig) {
|
|
6331
|
+
const {
|
|
6332
|
+
commitment,
|
|
6333
|
+
config
|
|
6334
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6335
|
+
|
|
6336
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6337
|
+
/* encoding */
|
|
6338
|
+
, config);
|
|
6267
6339
|
|
|
6268
6340
|
const unsafeRes = await this._rpcRequest('getSlot', args);
|
|
6269
6341
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6270
6342
|
|
|
6271
6343
|
if ('error' in res) {
|
|
6272
|
-
throw new
|
|
6344
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6273
6345
|
}
|
|
6274
6346
|
|
|
6275
6347
|
return res.result;
|
|
@@ -6279,14 +6351,21 @@ class Connection {
|
|
|
6279
6351
|
*/
|
|
6280
6352
|
|
|
6281
6353
|
|
|
6282
|
-
async getSlotLeader(
|
|
6283
|
-
const
|
|
6354
|
+
async getSlotLeader(commitmentOrConfig) {
|
|
6355
|
+
const {
|
|
6356
|
+
commitment,
|
|
6357
|
+
config
|
|
6358
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6359
|
+
|
|
6360
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6361
|
+
/* encoding */
|
|
6362
|
+
, config);
|
|
6284
6363
|
|
|
6285
6364
|
const unsafeRes = await this._rpcRequest('getSlotLeader', args);
|
|
6286
6365
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6287
6366
|
|
|
6288
6367
|
if ('error' in res) {
|
|
6289
|
-
throw new
|
|
6368
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');
|
|
6290
6369
|
}
|
|
6291
6370
|
|
|
6292
6371
|
return res.result;
|
|
@@ -6305,7 +6384,7 @@ class Connection {
|
|
|
6305
6384
|
const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
|
|
6306
6385
|
|
|
6307
6386
|
if ('error' in res) {
|
|
6308
|
-
throw new
|
|
6387
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');
|
|
6309
6388
|
}
|
|
6310
6389
|
|
|
6311
6390
|
return res.result;
|
|
@@ -6343,7 +6422,7 @@ class Connection {
|
|
|
6343
6422
|
const res = create(unsafeRes, GetSignatureStatusesRpcResult);
|
|
6344
6423
|
|
|
6345
6424
|
if ('error' in res) {
|
|
6346
|
-
throw new
|
|
6425
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signature status');
|
|
6347
6426
|
}
|
|
6348
6427
|
|
|
6349
6428
|
return res.result;
|
|
@@ -6353,14 +6432,21 @@ class Connection {
|
|
|
6353
6432
|
*/
|
|
6354
6433
|
|
|
6355
6434
|
|
|
6356
|
-
async getTransactionCount(
|
|
6357
|
-
const
|
|
6435
|
+
async getTransactionCount(commitmentOrConfig) {
|
|
6436
|
+
const {
|
|
6437
|
+
commitment,
|
|
6438
|
+
config
|
|
6439
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6440
|
+
|
|
6441
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6442
|
+
/* encoding */
|
|
6443
|
+
, config);
|
|
6358
6444
|
|
|
6359
6445
|
const unsafeRes = await this._rpcRequest('getTransactionCount', args);
|
|
6360
6446
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6361
6447
|
|
|
6362
6448
|
if ('error' in res) {
|
|
6363
|
-
throw new
|
|
6449
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');
|
|
6364
6450
|
}
|
|
6365
6451
|
|
|
6366
6452
|
return res.result;
|
|
@@ -6391,7 +6477,7 @@ class Connection {
|
|
|
6391
6477
|
const res = create(unsafeRes, GetInflationGovernorRpcResult);
|
|
6392
6478
|
|
|
6393
6479
|
if ('error' in res) {
|
|
6394
|
-
throw new
|
|
6480
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation');
|
|
6395
6481
|
}
|
|
6396
6482
|
|
|
6397
6483
|
return res.result;
|
|
@@ -6401,16 +6487,23 @@ class Connection {
|
|
|
6401
6487
|
*/
|
|
6402
6488
|
|
|
6403
6489
|
|
|
6404
|
-
async getInflationReward(addresses, epoch,
|
|
6405
|
-
const
|
|
6406
|
-
|
|
6490
|
+
async getInflationReward(addresses, epoch, commitmentOrConfig) {
|
|
6491
|
+
const {
|
|
6492
|
+
commitment,
|
|
6493
|
+
config
|
|
6494
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6495
|
+
|
|
6496
|
+
const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
|
|
6497
|
+
/* encoding */
|
|
6498
|
+
, { ...config,
|
|
6499
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6407
6500
|
});
|
|
6408
6501
|
|
|
6409
6502
|
const unsafeRes = await this._rpcRequest('getInflationReward', args);
|
|
6410
6503
|
const res = create(unsafeRes, GetInflationRewardResult);
|
|
6411
6504
|
|
|
6412
6505
|
if ('error' in res) {
|
|
6413
|
-
throw new
|
|
6506
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');
|
|
6414
6507
|
}
|
|
6415
6508
|
|
|
6416
6509
|
return res.result;
|
|
@@ -6420,14 +6513,21 @@ class Connection {
|
|
|
6420
6513
|
*/
|
|
6421
6514
|
|
|
6422
6515
|
|
|
6423
|
-
async getEpochInfo(
|
|
6424
|
-
const
|
|
6516
|
+
async getEpochInfo(commitmentOrConfig) {
|
|
6517
|
+
const {
|
|
6518
|
+
commitment,
|
|
6519
|
+
config
|
|
6520
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6521
|
+
|
|
6522
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6523
|
+
/* encoding */
|
|
6524
|
+
, config);
|
|
6425
6525
|
|
|
6426
6526
|
const unsafeRes = await this._rpcRequest('getEpochInfo', args);
|
|
6427
6527
|
const res = create(unsafeRes, GetEpochInfoRpcResult);
|
|
6428
6528
|
|
|
6429
6529
|
if ('error' in res) {
|
|
6430
|
-
throw new
|
|
6530
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');
|
|
6431
6531
|
}
|
|
6432
6532
|
|
|
6433
6533
|
return res.result;
|
|
@@ -6442,7 +6542,7 @@ class Connection {
|
|
|
6442
6542
|
const res = create(unsafeRes, GetEpochScheduleRpcResult);
|
|
6443
6543
|
|
|
6444
6544
|
if ('error' in res) {
|
|
6445
|
-
throw new
|
|
6545
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');
|
|
6446
6546
|
}
|
|
6447
6547
|
|
|
6448
6548
|
const epochSchedule = res.result;
|
|
@@ -6459,7 +6559,7 @@ class Connection {
|
|
|
6459
6559
|
const res = create(unsafeRes, GetLeaderScheduleRpcResult);
|
|
6460
6560
|
|
|
6461
6561
|
if ('error' in res) {
|
|
6462
|
-
throw new
|
|
6562
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');
|
|
6463
6563
|
}
|
|
6464
6564
|
|
|
6465
6565
|
return res.result;
|
|
@@ -6498,7 +6598,7 @@ class Connection {
|
|
|
6498
6598
|
const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
|
|
6499
6599
|
|
|
6500
6600
|
if ('error' in res) {
|
|
6501
|
-
throw new
|
|
6601
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
|
|
6502
6602
|
}
|
|
6503
6603
|
|
|
6504
6604
|
return res.result;
|
|
@@ -6516,7 +6616,7 @@ class Connection {
|
|
|
6516
6616
|
const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
|
|
6517
6617
|
|
|
6518
6618
|
if ('error' in res) {
|
|
6519
|
-
throw new
|
|
6619
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');
|
|
6520
6620
|
}
|
|
6521
6621
|
|
|
6522
6622
|
return res.result;
|
|
@@ -6535,7 +6635,7 @@ class Connection {
|
|
|
6535
6635
|
const res = create(unsafeRes, GetFeeCalculatorRpcResult);
|
|
6536
6636
|
|
|
6537
6637
|
if ('error' in res) {
|
|
6538
|
-
throw new
|
|
6638
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');
|
|
6539
6639
|
}
|
|
6540
6640
|
|
|
6541
6641
|
const {
|
|
@@ -6561,7 +6661,7 @@ class Connection {
|
|
|
6561
6661
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(number())));
|
|
6562
6662
|
|
|
6563
6663
|
if ('error' in res) {
|
|
6564
|
-
throw new
|
|
6664
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6565
6665
|
}
|
|
6566
6666
|
|
|
6567
6667
|
if (res.result === null) {
|
|
@@ -6592,9 +6692,9 @@ class Connection {
|
|
|
6592
6692
|
*/
|
|
6593
6693
|
|
|
6594
6694
|
|
|
6595
|
-
async getLatestBlockhash(
|
|
6695
|
+
async getLatestBlockhash(commitmentOrConfig) {
|
|
6596
6696
|
try {
|
|
6597
|
-
const res = await this.getLatestBlockhashAndContext(
|
|
6697
|
+
const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);
|
|
6598
6698
|
return res.value;
|
|
6599
6699
|
} catch (e) {
|
|
6600
6700
|
throw new Error('failed to get recent blockhash: ' + e);
|
|
@@ -6606,14 +6706,21 @@ class Connection {
|
|
|
6606
6706
|
*/
|
|
6607
6707
|
|
|
6608
6708
|
|
|
6609
|
-
async getLatestBlockhashAndContext(
|
|
6610
|
-
const
|
|
6709
|
+
async getLatestBlockhashAndContext(commitmentOrConfig) {
|
|
6710
|
+
const {
|
|
6711
|
+
commitment,
|
|
6712
|
+
config
|
|
6713
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6714
|
+
|
|
6715
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6716
|
+
/* encoding */
|
|
6717
|
+
, config);
|
|
6611
6718
|
|
|
6612
6719
|
const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);
|
|
6613
6720
|
const res = create(unsafeRes, GetLatestBlockhashRpcResult);
|
|
6614
6721
|
|
|
6615
6722
|
if ('error' in res) {
|
|
6616
|
-
throw new
|
|
6723
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');
|
|
6617
6724
|
}
|
|
6618
6725
|
|
|
6619
6726
|
return res.result;
|
|
@@ -6628,7 +6735,7 @@ class Connection {
|
|
|
6628
6735
|
const res = create(unsafeRes, jsonRpcResult(VersionResult));
|
|
6629
6736
|
|
|
6630
6737
|
if ('error' in res) {
|
|
6631
|
-
throw new
|
|
6738
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get version');
|
|
6632
6739
|
}
|
|
6633
6740
|
|
|
6634
6741
|
return res.result;
|
|
@@ -6643,7 +6750,7 @@ class Connection {
|
|
|
6643
6750
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6644
6751
|
|
|
6645
6752
|
if ('error' in res) {
|
|
6646
|
-
throw new
|
|
6753
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');
|
|
6647
6754
|
}
|
|
6648
6755
|
|
|
6649
6756
|
return res.result;
|
|
@@ -6660,7 +6767,7 @@ class Connection {
|
|
|
6660
6767
|
const res = create(unsafeRes, GetBlockRpcResult);
|
|
6661
6768
|
|
|
6662
6769
|
if ('error' in res) {
|
|
6663
|
-
throw new
|
|
6770
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6664
6771
|
}
|
|
6665
6772
|
|
|
6666
6773
|
const result = res.result;
|
|
@@ -6685,14 +6792,21 @@ class Connection {
|
|
|
6685
6792
|
*/
|
|
6686
6793
|
|
|
6687
6794
|
|
|
6688
|
-
async getBlockHeight(
|
|
6689
|
-
const
|
|
6795
|
+
async getBlockHeight(commitmentOrConfig) {
|
|
6796
|
+
const {
|
|
6797
|
+
commitment,
|
|
6798
|
+
config
|
|
6799
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6800
|
+
|
|
6801
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6802
|
+
/* encoding */
|
|
6803
|
+
, config);
|
|
6690
6804
|
|
|
6691
6805
|
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
6692
6806
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6693
6807
|
|
|
6694
6808
|
if ('error' in res) {
|
|
6695
|
-
throw new
|
|
6809
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
6696
6810
|
}
|
|
6697
6811
|
|
|
6698
6812
|
return res.result;
|
|
@@ -6723,7 +6837,7 @@ class Connection {
|
|
|
6723
6837
|
const res = create(unsafeRes, BlockProductionResponseStruct);
|
|
6724
6838
|
|
|
6725
6839
|
if ('error' in res) {
|
|
6726
|
-
throw new
|
|
6840
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block production information');
|
|
6727
6841
|
}
|
|
6728
6842
|
|
|
6729
6843
|
return res.result;
|
|
@@ -6740,7 +6854,7 @@ class Connection {
|
|
|
6740
6854
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6741
6855
|
|
|
6742
6856
|
if ('error' in res) {
|
|
6743
|
-
throw new
|
|
6857
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6744
6858
|
}
|
|
6745
6859
|
|
|
6746
6860
|
const result = res.result;
|
|
@@ -6763,7 +6877,7 @@ class Connection {
|
|
|
6763
6877
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6764
6878
|
|
|
6765
6879
|
if ('error' in res) {
|
|
6766
|
-
throw new
|
|
6880
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6767
6881
|
}
|
|
6768
6882
|
|
|
6769
6883
|
return res.result;
|
|
@@ -6787,7 +6901,7 @@ class Connection {
|
|
|
6787
6901
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6788
6902
|
|
|
6789
6903
|
if ('error' in res) {
|
|
6790
|
-
throw new
|
|
6904
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6791
6905
|
}
|
|
6792
6906
|
|
|
6793
6907
|
return res.result;
|
|
@@ -6814,7 +6928,7 @@ class Connection {
|
|
|
6814
6928
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6815
6929
|
|
|
6816
6930
|
if ('error' in res) {
|
|
6817
|
-
throw new
|
|
6931
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6818
6932
|
}
|
|
6819
6933
|
|
|
6820
6934
|
const result = res.result;
|
|
@@ -6842,7 +6956,7 @@ class Connection {
|
|
|
6842
6956
|
const res = create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
6843
6957
|
|
|
6844
6958
|
if ('error' in res) {
|
|
6845
|
-
throw new
|
|
6959
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6846
6960
|
}
|
|
6847
6961
|
|
|
6848
6962
|
const result = res.result;
|
|
@@ -6889,7 +7003,7 @@ class Connection {
|
|
|
6889
7003
|
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
|
6890
7004
|
|
|
6891
7005
|
if ('error' in res) {
|
|
6892
|
-
throw new
|
|
7006
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get blocks');
|
|
6893
7007
|
}
|
|
6894
7008
|
|
|
6895
7009
|
return res.result;
|
|
@@ -6909,7 +7023,7 @@ class Connection {
|
|
|
6909
7023
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6910
7024
|
|
|
6911
7025
|
if ('error' in res) {
|
|
6912
|
-
throw new
|
|
7026
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
6913
7027
|
}
|
|
6914
7028
|
|
|
6915
7029
|
const result = res.result;
|
|
@@ -6937,7 +7051,7 @@ class Connection {
|
|
|
6937
7051
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6938
7052
|
|
|
6939
7053
|
if ('error' in res) {
|
|
6940
|
-
throw new
|
|
7054
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6941
7055
|
}
|
|
6942
7056
|
|
|
6943
7057
|
const result = res.result;
|
|
@@ -6962,7 +7076,7 @@ class Connection {
|
|
|
6962
7076
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6963
7077
|
|
|
6964
7078
|
if ('error' in res) {
|
|
6965
|
-
throw new
|
|
7079
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6966
7080
|
}
|
|
6967
7081
|
|
|
6968
7082
|
const result = res.result;
|
|
@@ -6987,7 +7101,7 @@ class Connection {
|
|
|
6987
7101
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6988
7102
|
|
|
6989
7103
|
if ('error' in res) {
|
|
6990
|
-
throw new
|
|
7104
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
|
|
6991
7105
|
}
|
|
6992
7106
|
|
|
6993
7107
|
return res.result;
|
|
@@ -7013,7 +7127,7 @@ class Connection {
|
|
|
7013
7127
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
7014
7128
|
|
|
7015
7129
|
if ('error' in res) {
|
|
7016
|
-
throw new
|
|
7130
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');
|
|
7017
7131
|
}
|
|
7018
7132
|
|
|
7019
7133
|
return res.result;
|
|
@@ -7102,7 +7216,7 @@ class Connection {
|
|
|
7102
7216
|
const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
7103
7217
|
|
|
7104
7218
|
if ('error' in res) {
|
|
7105
|
-
throw new
|
|
7219
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');
|
|
7106
7220
|
}
|
|
7107
7221
|
|
|
7108
7222
|
return res.result;
|
|
@@ -7124,7 +7238,7 @@ class Connection {
|
|
|
7124
7238
|
const res = create(unsafeRes, GetSignaturesForAddressRpcResult);
|
|
7125
7239
|
|
|
7126
7240
|
if ('error' in res) {
|
|
7127
|
-
throw new
|
|
7241
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');
|
|
7128
7242
|
}
|
|
7129
7243
|
|
|
7130
7244
|
return res.result;
|
|
@@ -7181,7 +7295,7 @@ class Connection {
|
|
|
7181
7295
|
const res = create(unsafeRes, RequestAirdropRpcResult);
|
|
7182
7296
|
|
|
7183
7297
|
if ('error' in res) {
|
|
7184
|
-
throw new
|
|
7298
|
+
throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);
|
|
7185
7299
|
}
|
|
7186
7300
|
|
|
7187
7301
|
return res.result;
|
|
@@ -7411,10 +7525,14 @@ class Connection {
|
|
|
7411
7525
|
const skipPreflight = options && options.skipPreflight;
|
|
7412
7526
|
const preflightCommitment = options && options.preflightCommitment || this.commitment;
|
|
7413
7527
|
|
|
7414
|
-
if (options && options.maxRetries) {
|
|
7528
|
+
if (options && options.maxRetries != null) {
|
|
7415
7529
|
config.maxRetries = options.maxRetries;
|
|
7416
7530
|
}
|
|
7417
7531
|
|
|
7532
|
+
if (options && options.minContextSlot != null) {
|
|
7533
|
+
config.minContextSlot = options.minContextSlot;
|
|
7534
|
+
}
|
|
7535
|
+
|
|
7418
7536
|
if (skipPreflight) {
|
|
7419
7537
|
config.skipPreflight = skipPreflight;
|
|
7420
7538
|
}
|
|
@@ -9824,7 +9942,8 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, confirma
|
|
|
9824
9942
|
|
|
9825
9943
|
const sendOptions = options && {
|
|
9826
9944
|
skipPreflight: options.skipPreflight,
|
|
9827
|
-
preflightCommitment: options.preflightCommitment || options.commitment
|
|
9945
|
+
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
9946
|
+
minContextSlot: options.minContextSlot
|
|
9828
9947
|
};
|
|
9829
9948
|
const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);
|
|
9830
9949
|
const commitment = options && options.commitment;
|
|
@@ -9876,5 +9995,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9876
9995
|
|
|
9877
9996
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9878
9997
|
|
|
9879
|
-
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 };
|
|
9998
|
+
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 };
|
|
9880
9999
|
//# sourceMappingURL=index.esm.js.map
|