@solana/web3.js 1.44.3 → 1.47.0
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 +254 -127
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +253 -128
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +254 -127
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +180 -18
- package/lib/index.esm.js +253 -128
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +254 -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 +3 -3
- package/src/connection.ts +382 -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) {
|
|
@@ -4644,6 +4680,7 @@ function makeWebsocketUrl(endpoint) {
|
|
|
4644
4680
|
return url.toString();
|
|
4645
4681
|
}
|
|
4646
4682
|
|
|
4683
|
+
var _process$env$npm_pack;
|
|
4647
4684
|
const PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));
|
|
4648
4685
|
const RawAccountDataResult = tuple([string(), literal('base64')]);
|
|
4649
4686
|
const BufferFromRawAccountData = coerce(instance(Buffer), RawAccountDataResult, value => Buffer.from(value[0], 'base64'));
|
|
@@ -4660,9 +4697,32 @@ const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;
|
|
|
4660
4697
|
* https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d
|
|
4661
4698
|
*/
|
|
4662
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
|
+
}
|
|
4663
4721
|
/**
|
|
4664
4722
|
* @internal
|
|
4665
4723
|
*/
|
|
4724
|
+
|
|
4725
|
+
|
|
4666
4726
|
function createRpcResult(result) {
|
|
4667
4727
|
return union([type({
|
|
4668
4728
|
jsonrpc: literal('2.0'),
|
|
@@ -4859,7 +4919,7 @@ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddlewar
|
|
|
4859
4919
|
agent,
|
|
4860
4920
|
headers: Object.assign({
|
|
4861
4921
|
'Content-Type': 'application/json'
|
|
4862
|
-
}, httpHeaders || {})
|
|
4922
|
+
}, httpHeaders || {}, COMMON_HTTP_HEADERS)
|
|
4863
4923
|
};
|
|
4864
4924
|
|
|
4865
4925
|
try {
|
|
@@ -5533,9 +5593,14 @@ const LogsNotificationResult = type({
|
|
|
5533
5593
|
* Filter for log subscriptions.
|
|
5534
5594
|
*/
|
|
5535
5595
|
|
|
5596
|
+
/** @internal */
|
|
5597
|
+
const COMMON_HTTP_HEADERS = {
|
|
5598
|
+
'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
5599
|
+
};
|
|
5536
5600
|
/**
|
|
5537
5601
|
* A connection to a fullnode JSON RPC endpoint
|
|
5538
5602
|
*/
|
|
5603
|
+
|
|
5539
5604
|
class Connection {
|
|
5540
5605
|
/** @internal */
|
|
5541
5606
|
|
|
@@ -5700,14 +5765,22 @@ class Connection {
|
|
|
5700
5765
|
*/
|
|
5701
5766
|
|
|
5702
5767
|
|
|
5703
|
-
async getBalanceAndContext(publicKey,
|
|
5704
|
-
|
|
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);
|
|
5705
5778
|
|
|
5706
5779
|
const unsafeRes = await this._rpcRequest('getBalance', args);
|
|
5707
5780
|
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
5708
5781
|
|
|
5709
5782
|
if ('error' in res) {
|
|
5710
|
-
throw new
|
|
5783
|
+
throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);
|
|
5711
5784
|
}
|
|
5712
5785
|
|
|
5713
5786
|
return res.result;
|
|
@@ -5717,8 +5790,8 @@ class Connection {
|
|
|
5717
5790
|
*/
|
|
5718
5791
|
|
|
5719
5792
|
|
|
5720
|
-
async getBalance(publicKey,
|
|
5721
|
-
return await this.getBalanceAndContext(publicKey,
|
|
5793
|
+
async getBalance(publicKey, commitmentOrConfig) {
|
|
5794
|
+
return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {
|
|
5722
5795
|
throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);
|
|
5723
5796
|
});
|
|
5724
5797
|
}
|
|
@@ -5732,7 +5805,7 @@ class Connection {
|
|
|
5732
5805
|
const res = create(unsafeRes, jsonRpcResult(nullable(number())));
|
|
5733
5806
|
|
|
5734
5807
|
if ('error' in res) {
|
|
5735
|
-
throw new
|
|
5808
|
+
throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);
|
|
5736
5809
|
}
|
|
5737
5810
|
|
|
5738
5811
|
return res.result;
|
|
@@ -5748,7 +5821,7 @@ class Connection {
|
|
|
5748
5821
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
5749
5822
|
|
|
5750
5823
|
if ('error' in res) {
|
|
5751
|
-
throw new
|
|
5824
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');
|
|
5752
5825
|
}
|
|
5753
5826
|
|
|
5754
5827
|
return res.result;
|
|
@@ -5763,7 +5836,7 @@ class Connection {
|
|
|
5763
5836
|
const res = create(unsafeRes, SlotRpcResult);
|
|
5764
5837
|
|
|
5765
5838
|
if ('error' in res) {
|
|
5766
|
-
throw new
|
|
5839
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get first available block');
|
|
5767
5840
|
}
|
|
5768
5841
|
|
|
5769
5842
|
return res.result;
|
|
@@ -5794,7 +5867,7 @@ class Connection {
|
|
|
5794
5867
|
const res = create(unsafeRes, GetSupplyRpcResult);
|
|
5795
5868
|
|
|
5796
5869
|
if ('error' in res) {
|
|
5797
|
-
throw new
|
|
5870
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get supply');
|
|
5798
5871
|
}
|
|
5799
5872
|
|
|
5800
5873
|
return res.result;
|
|
@@ -5811,7 +5884,7 @@ class Connection {
|
|
|
5811
5884
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5812
5885
|
|
|
5813
5886
|
if ('error' in res) {
|
|
5814
|
-
throw new
|
|
5887
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token supply');
|
|
5815
5888
|
}
|
|
5816
5889
|
|
|
5817
5890
|
return res.result;
|
|
@@ -5828,7 +5901,7 @@ class Connection {
|
|
|
5828
5901
|
const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));
|
|
5829
5902
|
|
|
5830
5903
|
if ('error' in res) {
|
|
5831
|
-
throw new
|
|
5904
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');
|
|
5832
5905
|
}
|
|
5833
5906
|
|
|
5834
5907
|
return res.result;
|
|
@@ -5840,7 +5913,11 @@ class Connection {
|
|
|
5840
5913
|
*/
|
|
5841
5914
|
|
|
5842
5915
|
|
|
5843
|
-
async getTokenAccountsByOwner(ownerAddress, filter,
|
|
5916
|
+
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
5917
|
+
const {
|
|
5918
|
+
commitment,
|
|
5919
|
+
config
|
|
5920
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5844
5921
|
let _args = [ownerAddress.toBase58()];
|
|
5845
5922
|
|
|
5846
5923
|
if ('mint' in filter) {
|
|
@@ -5853,13 +5930,13 @@ class Connection {
|
|
|
5853
5930
|
});
|
|
5854
5931
|
}
|
|
5855
5932
|
|
|
5856
|
-
const args = this._buildArgs(_args, commitment, 'base64');
|
|
5933
|
+
const args = this._buildArgs(_args, commitment, 'base64', config);
|
|
5857
5934
|
|
|
5858
5935
|
const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);
|
|
5859
5936
|
const res = create(unsafeRes, GetTokenAccountsByOwner);
|
|
5860
5937
|
|
|
5861
5938
|
if ('error' in res) {
|
|
5862
|
-
throw new
|
|
5939
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5863
5940
|
}
|
|
5864
5941
|
|
|
5865
5942
|
return res.result;
|
|
@@ -5890,7 +5967,7 @@ class Connection {
|
|
|
5890
5967
|
const res = create(unsafeRes, GetParsedTokenAccountsByOwner);
|
|
5891
5968
|
|
|
5892
5969
|
if ('error' in res) {
|
|
5893
|
-
throw new
|
|
5970
|
+
throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);
|
|
5894
5971
|
}
|
|
5895
5972
|
|
|
5896
5973
|
return res.result;
|
|
@@ -5909,7 +5986,7 @@ class Connection {
|
|
|
5909
5986
|
const res = create(unsafeRes, GetLargestAccountsRpcResult);
|
|
5910
5987
|
|
|
5911
5988
|
if ('error' in res) {
|
|
5912
|
-
throw new
|
|
5989
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');
|
|
5913
5990
|
}
|
|
5914
5991
|
|
|
5915
5992
|
return res.result;
|
|
@@ -5927,7 +6004,7 @@ class Connection {
|
|
|
5927
6004
|
const res = create(unsafeRes, GetTokenLargestAccountsResult);
|
|
5928
6005
|
|
|
5929
6006
|
if ('error' in res) {
|
|
5930
|
-
throw new
|
|
6007
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');
|
|
5931
6008
|
}
|
|
5932
6009
|
|
|
5933
6010
|
return res.result;
|
|
@@ -5937,14 +6014,19 @@ class Connection {
|
|
|
5937
6014
|
*/
|
|
5938
6015
|
|
|
5939
6016
|
|
|
5940
|
-
async getAccountInfoAndContext(publicKey,
|
|
5941
|
-
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);
|
|
5942
6024
|
|
|
5943
6025
|
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
|
|
5944
6026
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(AccountInfoResult)));
|
|
5945
6027
|
|
|
5946
6028
|
if ('error' in res) {
|
|
5947
|
-
throw new
|
|
6029
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5948
6030
|
}
|
|
5949
6031
|
|
|
5950
6032
|
return res.result;
|
|
@@ -5961,7 +6043,7 @@ class Connection {
|
|
|
5961
6043
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(ParsedAccountInfoResult)));
|
|
5962
6044
|
|
|
5963
6045
|
if ('error' in res) {
|
|
5964
|
-
throw new
|
|
6046
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);
|
|
5965
6047
|
}
|
|
5966
6048
|
|
|
5967
6049
|
return res.result;
|
|
@@ -5971,9 +6053,9 @@ class Connection {
|
|
|
5971
6053
|
*/
|
|
5972
6054
|
|
|
5973
6055
|
|
|
5974
|
-
async getAccountInfo(publicKey,
|
|
6056
|
+
async getAccountInfo(publicKey, commitmentOrConfig) {
|
|
5975
6057
|
try {
|
|
5976
|
-
const res = await this.getAccountInfoAndContext(publicKey,
|
|
6058
|
+
const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);
|
|
5977
6059
|
return res.value;
|
|
5978
6060
|
} catch (e) {
|
|
5979
6061
|
throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
|
|
@@ -5984,16 +6066,20 @@ class Connection {
|
|
|
5984
6066
|
*/
|
|
5985
6067
|
|
|
5986
6068
|
|
|
5987
|
-
async getMultipleAccountsInfoAndContext(publicKeys,
|
|
6069
|
+
async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {
|
|
6070
|
+
const {
|
|
6071
|
+
commitment,
|
|
6072
|
+
config
|
|
6073
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5988
6074
|
const keys = publicKeys.map(key => key.toBase58());
|
|
5989
6075
|
|
|
5990
|
-
const args = this._buildArgs([keys], commitment, 'base64');
|
|
6076
|
+
const args = this._buildArgs([keys], commitment, 'base64', config);
|
|
5991
6077
|
|
|
5992
6078
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
|
5993
6079
|
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
|
|
5994
6080
|
|
|
5995
6081
|
if ('error' in res) {
|
|
5996
|
-
throw new
|
|
6082
|
+
throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);
|
|
5997
6083
|
}
|
|
5998
6084
|
|
|
5999
6085
|
return res.result;
|
|
@@ -6003,8 +6089,8 @@ class Connection {
|
|
|
6003
6089
|
*/
|
|
6004
6090
|
|
|
6005
6091
|
|
|
6006
|
-
async getMultipleAccountsInfo(publicKeys,
|
|
6007
|
-
const res = await this.getMultipleAccountsInfoAndContext(publicKeys,
|
|
6092
|
+
async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {
|
|
6093
|
+
const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);
|
|
6008
6094
|
return res.value;
|
|
6009
6095
|
}
|
|
6010
6096
|
/**
|
|
@@ -6012,16 +6098,23 @@ class Connection {
|
|
|
6012
6098
|
*/
|
|
6013
6099
|
|
|
6014
6100
|
|
|
6015
|
-
async getStakeActivation(publicKey,
|
|
6016
|
-
const
|
|
6017
|
-
|
|
6018
|
-
|
|
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
|
+
});
|
|
6019
6112
|
|
|
6020
6113
|
const unsafeRes = await this._rpcRequest('getStakeActivation', args);
|
|
6021
6114
|
const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
|
|
6022
6115
|
|
|
6023
6116
|
if ('error' in res) {
|
|
6024
|
-
throw new
|
|
6117
|
+
throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);
|
|
6025
6118
|
}
|
|
6026
6119
|
|
|
6027
6120
|
return res.result;
|
|
@@ -6034,34 +6127,22 @@ class Connection {
|
|
|
6034
6127
|
|
|
6035
6128
|
|
|
6036
6129
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
6037
|
-
const
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
commitment = configOrCommitment.commitment;
|
|
6046
|
-
encoding = configOrCommitment.encoding;
|
|
6047
|
-
|
|
6048
|
-
if (configOrCommitment.dataSlice) {
|
|
6049
|
-
extra.dataSlice = configOrCommitment.dataSlice;
|
|
6050
|
-
}
|
|
6051
|
-
|
|
6052
|
-
if (configOrCommitment.filters) {
|
|
6053
|
-
extra.filters = configOrCommitment.filters;
|
|
6054
|
-
}
|
|
6055
|
-
}
|
|
6056
|
-
}
|
|
6130
|
+
const {
|
|
6131
|
+
commitment,
|
|
6132
|
+
config
|
|
6133
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6134
|
+
const {
|
|
6135
|
+
encoding,
|
|
6136
|
+
...configWithoutEncoding
|
|
6137
|
+
} = config || {};
|
|
6057
6138
|
|
|
6058
|
-
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64',
|
|
6139
|
+
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
6059
6140
|
|
|
6060
6141
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6061
6142
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
|
|
6062
6143
|
|
|
6063
6144
|
if ('error' in res) {
|
|
6064
|
-
throw new
|
|
6145
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6065
6146
|
}
|
|
6066
6147
|
|
|
6067
6148
|
return res.result;
|
|
@@ -6074,28 +6155,18 @@ class Connection {
|
|
|
6074
6155
|
|
|
6075
6156
|
|
|
6076
6157
|
async getParsedProgramAccounts(programId, configOrCommitment) {
|
|
6077
|
-
const
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
if (typeof configOrCommitment === 'string') {
|
|
6082
|
-
commitment = configOrCommitment;
|
|
6083
|
-
} else {
|
|
6084
|
-
commitment = configOrCommitment.commitment;
|
|
6085
|
-
|
|
6086
|
-
if (configOrCommitment.filters) {
|
|
6087
|
-
extra.filters = configOrCommitment.filters;
|
|
6088
|
-
}
|
|
6089
|
-
}
|
|
6090
|
-
}
|
|
6158
|
+
const {
|
|
6159
|
+
commitment,
|
|
6160
|
+
config
|
|
6161
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6091
6162
|
|
|
6092
|
-
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed',
|
|
6163
|
+
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);
|
|
6093
6164
|
|
|
6094
6165
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6095
6166
|
const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));
|
|
6096
6167
|
|
|
6097
6168
|
if ('error' in res) {
|
|
6098
|
-
throw new
|
|
6169
|
+
throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
|
|
6099
6170
|
}
|
|
6100
6171
|
|
|
6101
6172
|
return res.result;
|
|
@@ -6229,7 +6300,7 @@ class Connection {
|
|
|
6229
6300
|
const res = create(unsafeRes, jsonRpcResult(array(ContactInfoResult)));
|
|
6230
6301
|
|
|
6231
6302
|
if ('error' in res) {
|
|
6232
|
-
throw new
|
|
6303
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');
|
|
6233
6304
|
}
|
|
6234
6305
|
|
|
6235
6306
|
return res.result;
|
|
@@ -6246,7 +6317,7 @@ class Connection {
|
|
|
6246
6317
|
const res = create(unsafeRes, GetVoteAccounts);
|
|
6247
6318
|
|
|
6248
6319
|
if ('error' in res) {
|
|
6249
|
-
throw new
|
|
6320
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');
|
|
6250
6321
|
}
|
|
6251
6322
|
|
|
6252
6323
|
return res.result;
|
|
@@ -6256,14 +6327,21 @@ class Connection {
|
|
|
6256
6327
|
*/
|
|
6257
6328
|
|
|
6258
6329
|
|
|
6259
|
-
async getSlot(
|
|
6260
|
-
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);
|
|
6261
6339
|
|
|
6262
6340
|
const unsafeRes = await this._rpcRequest('getSlot', args);
|
|
6263
6341
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6264
6342
|
|
|
6265
6343
|
if ('error' in res) {
|
|
6266
|
-
throw new
|
|
6344
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6267
6345
|
}
|
|
6268
6346
|
|
|
6269
6347
|
return res.result;
|
|
@@ -6273,14 +6351,21 @@ class Connection {
|
|
|
6273
6351
|
*/
|
|
6274
6352
|
|
|
6275
6353
|
|
|
6276
|
-
async getSlotLeader(
|
|
6277
|
-
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);
|
|
6278
6363
|
|
|
6279
6364
|
const unsafeRes = await this._rpcRequest('getSlotLeader', args);
|
|
6280
6365
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6281
6366
|
|
|
6282
6367
|
if ('error' in res) {
|
|
6283
|
-
throw new
|
|
6368
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');
|
|
6284
6369
|
}
|
|
6285
6370
|
|
|
6286
6371
|
return res.result;
|
|
@@ -6299,7 +6384,7 @@ class Connection {
|
|
|
6299
6384
|
const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
|
|
6300
6385
|
|
|
6301
6386
|
if ('error' in res) {
|
|
6302
|
-
throw new
|
|
6387
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');
|
|
6303
6388
|
}
|
|
6304
6389
|
|
|
6305
6390
|
return res.result;
|
|
@@ -6337,7 +6422,7 @@ class Connection {
|
|
|
6337
6422
|
const res = create(unsafeRes, GetSignatureStatusesRpcResult);
|
|
6338
6423
|
|
|
6339
6424
|
if ('error' in res) {
|
|
6340
|
-
throw new
|
|
6425
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signature status');
|
|
6341
6426
|
}
|
|
6342
6427
|
|
|
6343
6428
|
return res.result;
|
|
@@ -6347,14 +6432,21 @@ class Connection {
|
|
|
6347
6432
|
*/
|
|
6348
6433
|
|
|
6349
6434
|
|
|
6350
|
-
async getTransactionCount(
|
|
6351
|
-
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);
|
|
6352
6444
|
|
|
6353
6445
|
const unsafeRes = await this._rpcRequest('getTransactionCount', args);
|
|
6354
6446
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6355
6447
|
|
|
6356
6448
|
if ('error' in res) {
|
|
6357
|
-
throw new
|
|
6449
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');
|
|
6358
6450
|
}
|
|
6359
6451
|
|
|
6360
6452
|
return res.result;
|
|
@@ -6385,7 +6477,7 @@ class Connection {
|
|
|
6385
6477
|
const res = create(unsafeRes, GetInflationGovernorRpcResult);
|
|
6386
6478
|
|
|
6387
6479
|
if ('error' in res) {
|
|
6388
|
-
throw new
|
|
6480
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation');
|
|
6389
6481
|
}
|
|
6390
6482
|
|
|
6391
6483
|
return res.result;
|
|
@@ -6395,16 +6487,23 @@ class Connection {
|
|
|
6395
6487
|
*/
|
|
6396
6488
|
|
|
6397
6489
|
|
|
6398
|
-
async getInflationReward(addresses, epoch,
|
|
6399
|
-
const
|
|
6400
|
-
|
|
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
|
|
6401
6500
|
});
|
|
6402
6501
|
|
|
6403
6502
|
const unsafeRes = await this._rpcRequest('getInflationReward', args);
|
|
6404
6503
|
const res = create(unsafeRes, GetInflationRewardResult);
|
|
6405
6504
|
|
|
6406
6505
|
if ('error' in res) {
|
|
6407
|
-
throw new
|
|
6506
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');
|
|
6408
6507
|
}
|
|
6409
6508
|
|
|
6410
6509
|
return res.result;
|
|
@@ -6414,14 +6513,21 @@ class Connection {
|
|
|
6414
6513
|
*/
|
|
6415
6514
|
|
|
6416
6515
|
|
|
6417
|
-
async getEpochInfo(
|
|
6418
|
-
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);
|
|
6419
6525
|
|
|
6420
6526
|
const unsafeRes = await this._rpcRequest('getEpochInfo', args);
|
|
6421
6527
|
const res = create(unsafeRes, GetEpochInfoRpcResult);
|
|
6422
6528
|
|
|
6423
6529
|
if ('error' in res) {
|
|
6424
|
-
throw new
|
|
6530
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');
|
|
6425
6531
|
}
|
|
6426
6532
|
|
|
6427
6533
|
return res.result;
|
|
@@ -6436,7 +6542,7 @@ class Connection {
|
|
|
6436
6542
|
const res = create(unsafeRes, GetEpochScheduleRpcResult);
|
|
6437
6543
|
|
|
6438
6544
|
if ('error' in res) {
|
|
6439
|
-
throw new
|
|
6545
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');
|
|
6440
6546
|
}
|
|
6441
6547
|
|
|
6442
6548
|
const epochSchedule = res.result;
|
|
@@ -6453,7 +6559,7 @@ class Connection {
|
|
|
6453
6559
|
const res = create(unsafeRes, GetLeaderScheduleRpcResult);
|
|
6454
6560
|
|
|
6455
6561
|
if ('error' in res) {
|
|
6456
|
-
throw new
|
|
6562
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');
|
|
6457
6563
|
}
|
|
6458
6564
|
|
|
6459
6565
|
return res.result;
|
|
@@ -6492,7 +6598,7 @@ class Connection {
|
|
|
6492
6598
|
const res = create(unsafeRes, GetRecentBlockhashAndContextRpcResult);
|
|
6493
6599
|
|
|
6494
6600
|
if ('error' in res) {
|
|
6495
|
-
throw new
|
|
6601
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent blockhash');
|
|
6496
6602
|
}
|
|
6497
6603
|
|
|
6498
6604
|
return res.result;
|
|
@@ -6510,7 +6616,7 @@ class Connection {
|
|
|
6510
6616
|
const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);
|
|
6511
6617
|
|
|
6512
6618
|
if ('error' in res) {
|
|
6513
|
-
throw new
|
|
6619
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');
|
|
6514
6620
|
}
|
|
6515
6621
|
|
|
6516
6622
|
return res.result;
|
|
@@ -6529,7 +6635,7 @@ class Connection {
|
|
|
6529
6635
|
const res = create(unsafeRes, GetFeeCalculatorRpcResult);
|
|
6530
6636
|
|
|
6531
6637
|
if ('error' in res) {
|
|
6532
|
-
throw new
|
|
6638
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');
|
|
6533
6639
|
}
|
|
6534
6640
|
|
|
6535
6641
|
const {
|
|
@@ -6555,7 +6661,7 @@ class Connection {
|
|
|
6555
6661
|
const res = create(unsafeRes, jsonRpcResultAndContext(nullable(number())));
|
|
6556
6662
|
|
|
6557
6663
|
if ('error' in res) {
|
|
6558
|
-
throw new
|
|
6664
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get slot');
|
|
6559
6665
|
}
|
|
6560
6666
|
|
|
6561
6667
|
if (res.result === null) {
|
|
@@ -6586,9 +6692,9 @@ class Connection {
|
|
|
6586
6692
|
*/
|
|
6587
6693
|
|
|
6588
6694
|
|
|
6589
|
-
async getLatestBlockhash(
|
|
6695
|
+
async getLatestBlockhash(commitmentOrConfig) {
|
|
6590
6696
|
try {
|
|
6591
|
-
const res = await this.getLatestBlockhashAndContext(
|
|
6697
|
+
const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);
|
|
6592
6698
|
return res.value;
|
|
6593
6699
|
} catch (e) {
|
|
6594
6700
|
throw new Error('failed to get recent blockhash: ' + e);
|
|
@@ -6600,14 +6706,21 @@ class Connection {
|
|
|
6600
6706
|
*/
|
|
6601
6707
|
|
|
6602
6708
|
|
|
6603
|
-
async getLatestBlockhashAndContext(
|
|
6604
|
-
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);
|
|
6605
6718
|
|
|
6606
6719
|
const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);
|
|
6607
6720
|
const res = create(unsafeRes, GetLatestBlockhashRpcResult);
|
|
6608
6721
|
|
|
6609
6722
|
if ('error' in res) {
|
|
6610
|
-
throw new
|
|
6723
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');
|
|
6611
6724
|
}
|
|
6612
6725
|
|
|
6613
6726
|
return res.result;
|
|
@@ -6622,7 +6735,7 @@ class Connection {
|
|
|
6622
6735
|
const res = create(unsafeRes, jsonRpcResult(VersionResult));
|
|
6623
6736
|
|
|
6624
6737
|
if ('error' in res) {
|
|
6625
|
-
throw new
|
|
6738
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get version');
|
|
6626
6739
|
}
|
|
6627
6740
|
|
|
6628
6741
|
return res.result;
|
|
@@ -6637,7 +6750,7 @@ class Connection {
|
|
|
6637
6750
|
const res = create(unsafeRes, jsonRpcResult(string()));
|
|
6638
6751
|
|
|
6639
6752
|
if ('error' in res) {
|
|
6640
|
-
throw new
|
|
6753
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');
|
|
6641
6754
|
}
|
|
6642
6755
|
|
|
6643
6756
|
return res.result;
|
|
@@ -6654,7 +6767,7 @@ class Connection {
|
|
|
6654
6767
|
const res = create(unsafeRes, GetBlockRpcResult);
|
|
6655
6768
|
|
|
6656
6769
|
if ('error' in res) {
|
|
6657
|
-
throw new
|
|
6770
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6658
6771
|
}
|
|
6659
6772
|
|
|
6660
6773
|
const result = res.result;
|
|
@@ -6679,14 +6792,21 @@ class Connection {
|
|
|
6679
6792
|
*/
|
|
6680
6793
|
|
|
6681
6794
|
|
|
6682
|
-
async getBlockHeight(
|
|
6683
|
-
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);
|
|
6684
6804
|
|
|
6685
6805
|
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
6686
6806
|
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
6687
6807
|
|
|
6688
6808
|
if ('error' in res) {
|
|
6689
|
-
throw new
|
|
6809
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
6690
6810
|
}
|
|
6691
6811
|
|
|
6692
6812
|
return res.result;
|
|
@@ -6717,7 +6837,7 @@ class Connection {
|
|
|
6717
6837
|
const res = create(unsafeRes, BlockProductionResponseStruct);
|
|
6718
6838
|
|
|
6719
6839
|
if ('error' in res) {
|
|
6720
|
-
throw new
|
|
6840
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block production information');
|
|
6721
6841
|
}
|
|
6722
6842
|
|
|
6723
6843
|
return res.result;
|
|
@@ -6734,7 +6854,7 @@ class Connection {
|
|
|
6734
6854
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6735
6855
|
|
|
6736
6856
|
if ('error' in res) {
|
|
6737
|
-
throw new
|
|
6857
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6738
6858
|
}
|
|
6739
6859
|
|
|
6740
6860
|
const result = res.result;
|
|
@@ -6757,7 +6877,7 @@ class Connection {
|
|
|
6757
6877
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6758
6878
|
|
|
6759
6879
|
if ('error' in res) {
|
|
6760
|
-
throw new
|
|
6880
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6761
6881
|
}
|
|
6762
6882
|
|
|
6763
6883
|
return res.result;
|
|
@@ -6781,7 +6901,7 @@ class Connection {
|
|
|
6781
6901
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6782
6902
|
|
|
6783
6903
|
if ('error' in res) {
|
|
6784
|
-
throw new
|
|
6904
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6785
6905
|
}
|
|
6786
6906
|
|
|
6787
6907
|
return res.result;
|
|
@@ -6808,7 +6928,7 @@ class Connection {
|
|
|
6808
6928
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6809
6929
|
|
|
6810
6930
|
if ('error' in res) {
|
|
6811
|
-
throw new
|
|
6931
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transactions');
|
|
6812
6932
|
}
|
|
6813
6933
|
|
|
6814
6934
|
const result = res.result;
|
|
@@ -6836,7 +6956,7 @@ class Connection {
|
|
|
6836
6956
|
const res = create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
6837
6957
|
|
|
6838
6958
|
if ('error' in res) {
|
|
6839
|
-
throw new
|
|
6959
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6840
6960
|
}
|
|
6841
6961
|
|
|
6842
6962
|
const result = res.result;
|
|
@@ -6883,7 +7003,7 @@ class Connection {
|
|
|
6883
7003
|
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
|
6884
7004
|
|
|
6885
7005
|
if ('error' in res) {
|
|
6886
|
-
throw new
|
|
7006
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get blocks');
|
|
6887
7007
|
}
|
|
6888
7008
|
|
|
6889
7009
|
return res.result;
|
|
@@ -6903,7 +7023,7 @@ class Connection {
|
|
|
6903
7023
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6904
7024
|
|
|
6905
7025
|
if ('error' in res) {
|
|
6906
|
-
throw new
|
|
7026
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block');
|
|
6907
7027
|
}
|
|
6908
7028
|
|
|
6909
7029
|
const result = res.result;
|
|
@@ -6931,7 +7051,7 @@ class Connection {
|
|
|
6931
7051
|
const res = create(unsafeRes, GetBlockSignaturesRpcResult);
|
|
6932
7052
|
|
|
6933
7053
|
if ('error' in res) {
|
|
6934
|
-
throw new
|
|
7054
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');
|
|
6935
7055
|
}
|
|
6936
7056
|
|
|
6937
7057
|
const result = res.result;
|
|
@@ -6956,7 +7076,7 @@ class Connection {
|
|
|
6956
7076
|
const res = create(unsafeRes, GetTransactionRpcResult);
|
|
6957
7077
|
|
|
6958
7078
|
if ('error' in res) {
|
|
6959
|
-
throw new
|
|
7079
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get transaction');
|
|
6960
7080
|
}
|
|
6961
7081
|
|
|
6962
7082
|
const result = res.result;
|
|
@@ -6981,7 +7101,7 @@ class Connection {
|
|
|
6981
7101
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
6982
7102
|
|
|
6983
7103
|
if ('error' in res) {
|
|
6984
|
-
throw new
|
|
7104
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');
|
|
6985
7105
|
}
|
|
6986
7106
|
|
|
6987
7107
|
return res.result;
|
|
@@ -7007,7 +7127,7 @@ class Connection {
|
|
|
7007
7127
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
7008
7128
|
|
|
7009
7129
|
if ('error' in res) {
|
|
7010
|
-
throw new
|
|
7130
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');
|
|
7011
7131
|
}
|
|
7012
7132
|
|
|
7013
7133
|
return res.result;
|
|
@@ -7096,7 +7216,7 @@ class Connection {
|
|
|
7096
7216
|
const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
7097
7217
|
|
|
7098
7218
|
if ('error' in res) {
|
|
7099
|
-
throw new
|
|
7219
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');
|
|
7100
7220
|
}
|
|
7101
7221
|
|
|
7102
7222
|
return res.result;
|
|
@@ -7118,7 +7238,7 @@ class Connection {
|
|
|
7118
7238
|
const res = create(unsafeRes, GetSignaturesForAddressRpcResult);
|
|
7119
7239
|
|
|
7120
7240
|
if ('error' in res) {
|
|
7121
|
-
throw new
|
|
7241
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');
|
|
7122
7242
|
}
|
|
7123
7243
|
|
|
7124
7244
|
return res.result;
|
|
@@ -7175,7 +7295,7 @@ class Connection {
|
|
|
7175
7295
|
const res = create(unsafeRes, RequestAirdropRpcResult);
|
|
7176
7296
|
|
|
7177
7297
|
if ('error' in res) {
|
|
7178
|
-
throw new
|
|
7298
|
+
throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);
|
|
7179
7299
|
}
|
|
7180
7300
|
|
|
7181
7301
|
return res.result;
|
|
@@ -7409,6 +7529,10 @@ class Connection {
|
|
|
7409
7529
|
config.maxRetries = options.maxRetries;
|
|
7410
7530
|
}
|
|
7411
7531
|
|
|
7532
|
+
if (options && options.minContextSlot != null) {
|
|
7533
|
+
config.minContextSlot = options.minContextSlot;
|
|
7534
|
+
}
|
|
7535
|
+
|
|
7412
7536
|
if (skipPreflight) {
|
|
7413
7537
|
config.skipPreflight = skipPreflight;
|
|
7414
7538
|
}
|
|
@@ -9818,7 +9942,8 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, confirma
|
|
|
9818
9942
|
|
|
9819
9943
|
const sendOptions = options && {
|
|
9820
9944
|
skipPreflight: options.skipPreflight,
|
|
9821
|
-
preflightCommitment: options.preflightCommitment || options.commitment
|
|
9945
|
+
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
9946
|
+
minContextSlot: options.minContextSlot
|
|
9822
9947
|
};
|
|
9823
9948
|
const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);
|
|
9824
9949
|
const commitment = options && options.commitment;
|
|
@@ -9870,5 +9995,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9870
9995
|
|
|
9871
9996
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9872
9997
|
|
|
9873
|
-
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 };
|
|
9874
9999
|
//# sourceMappingURL=index.esm.js.map
|