@solana/web3.js 1.44.2 → 1.46.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 +184 -91
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +184 -91
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +184 -91
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +144 -18
- package/lib/index.esm.js +184 -91
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +184 -91
- 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 +283 -76
- package/src/transaction.ts +19 -12
- package/src/util/send-and-confirm-raw-transaction.ts +1 -0
- package/src/util/send-and-confirm-transaction.ts +1 -0
package/lib/index.cjs.js
CHANGED
|
@@ -2568,24 +2568,27 @@ class Transaction {
|
|
|
2568
2568
|
return this._message;
|
|
2569
2569
|
}
|
|
2570
2570
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
} = this;
|
|
2571
|
+
let recentBlockhash;
|
|
2572
|
+
let instructions;
|
|
2574
2573
|
|
|
2575
|
-
if (
|
|
2576
|
-
|
|
2577
|
-
this.instructions.unshift(nonceInfo.nonceInstruction);
|
|
2578
|
-
}
|
|
2574
|
+
if (this.nonceInfo) {
|
|
2575
|
+
recentBlockhash = this.nonceInfo.nonce;
|
|
2579
2576
|
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2577
|
+
if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
|
|
2578
|
+
instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
|
|
2579
|
+
} else {
|
|
2580
|
+
instructions = this.instructions;
|
|
2581
|
+
}
|
|
2582
|
+
} else {
|
|
2583
|
+
recentBlockhash = this.recentBlockhash;
|
|
2584
|
+
instructions = this.instructions;
|
|
2585
|
+
}
|
|
2583
2586
|
|
|
2584
2587
|
if (!recentBlockhash) {
|
|
2585
2588
|
throw new Error('Transaction recentBlockhash required');
|
|
2586
2589
|
}
|
|
2587
2590
|
|
|
2588
|
-
if (
|
|
2591
|
+
if (instructions.length < 1) {
|
|
2589
2592
|
console.warn('No instructions provided');
|
|
2590
2593
|
}
|
|
2591
2594
|
|
|
@@ -2600,15 +2603,15 @@ class Transaction {
|
|
|
2600
2603
|
throw new Error('Transaction fee payer required');
|
|
2601
2604
|
}
|
|
2602
2605
|
|
|
2603
|
-
for (let i = 0; i <
|
|
2604
|
-
if (
|
|
2606
|
+
for (let i = 0; i < instructions.length; i++) {
|
|
2607
|
+
if (instructions[i].programId === undefined) {
|
|
2605
2608
|
throw new Error(`Transaction instruction index ${i} has undefined program id`);
|
|
2606
2609
|
}
|
|
2607
2610
|
}
|
|
2608
2611
|
|
|
2609
2612
|
const programIds = [];
|
|
2610
2613
|
const accountMetas = [];
|
|
2611
|
-
|
|
2614
|
+
instructions.forEach(instruction => {
|
|
2612
2615
|
instruction.keys.forEach(accountMeta => {
|
|
2613
2616
|
accountMetas.push({ ...accountMeta
|
|
2614
2617
|
});
|
|
@@ -2718,7 +2721,7 @@ class Transaction {
|
|
|
2718
2721
|
}
|
|
2719
2722
|
});
|
|
2720
2723
|
const accountKeys = signedKeys.concat(unsignedKeys);
|
|
2721
|
-
const
|
|
2724
|
+
const compiledInstructions = instructions.map(instruction => {
|
|
2722
2725
|
const {
|
|
2723
2726
|
data,
|
|
2724
2727
|
programId
|
|
@@ -2729,7 +2732,7 @@ class Transaction {
|
|
|
2729
2732
|
data: bs58__default["default"].encode(data)
|
|
2730
2733
|
};
|
|
2731
2734
|
});
|
|
2732
|
-
|
|
2735
|
+
compiledInstructions.forEach(instruction => {
|
|
2733
2736
|
assert(instruction.programIdIndex >= 0);
|
|
2734
2737
|
instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));
|
|
2735
2738
|
});
|
|
@@ -2741,7 +2744,7 @@ class Transaction {
|
|
|
2741
2744
|
},
|
|
2742
2745
|
accountKeys,
|
|
2743
2746
|
recentBlockhash,
|
|
2744
|
-
instructions
|
|
2747
|
+
instructions: compiledInstructions
|
|
2745
2748
|
});
|
|
2746
2749
|
}
|
|
2747
2750
|
/**
|
|
@@ -3128,7 +3131,8 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
|
|
|
3128
3131
|
const sendOptions = options && {
|
|
3129
3132
|
skipPreflight: options.skipPreflight,
|
|
3130
3133
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
3131
|
-
maxRetries: options.maxRetries
|
|
3134
|
+
maxRetries: options.maxRetries,
|
|
3135
|
+
minContextSlot: options.minContextSlot
|
|
3132
3136
|
};
|
|
3133
3137
|
const signature = await connection.sendTransaction(transaction, signers, sendOptions);
|
|
3134
3138
|
const status = transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null ? (await connection.confirmTransaction({
|
|
@@ -4675,6 +4679,7 @@ function makeWebsocketUrl(endpoint) {
|
|
|
4675
4679
|
return url.toString();
|
|
4676
4680
|
}
|
|
4677
4681
|
|
|
4682
|
+
var _process$env$npm_pack;
|
|
4678
4683
|
const PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey), superstruct.string(), value => new PublicKey(value));
|
|
4679
4684
|
const RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal('base64')]);
|
|
4680
4685
|
const BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
|
|
@@ -4691,9 +4696,32 @@ const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;
|
|
|
4691
4696
|
* https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d
|
|
4692
4697
|
*/
|
|
4693
4698
|
|
|
4699
|
+
/** @internal */
|
|
4700
|
+
function extractCommitmentFromConfig(commitmentOrConfig) {
|
|
4701
|
+
let commitment;
|
|
4702
|
+
let config;
|
|
4703
|
+
|
|
4704
|
+
if (typeof commitmentOrConfig === 'string') {
|
|
4705
|
+
commitment = commitmentOrConfig;
|
|
4706
|
+
} else if (commitmentOrConfig) {
|
|
4707
|
+
const {
|
|
4708
|
+
commitment: specifiedCommitment,
|
|
4709
|
+
...specifiedConfig
|
|
4710
|
+
} = commitmentOrConfig;
|
|
4711
|
+
commitment = specifiedCommitment;
|
|
4712
|
+
config = specifiedConfig;
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
return {
|
|
4716
|
+
commitment,
|
|
4717
|
+
config
|
|
4718
|
+
};
|
|
4719
|
+
}
|
|
4694
4720
|
/**
|
|
4695
4721
|
* @internal
|
|
4696
4722
|
*/
|
|
4723
|
+
|
|
4724
|
+
|
|
4697
4725
|
function createRpcResult(result) {
|
|
4698
4726
|
return superstruct.union([superstruct.type({
|
|
4699
4727
|
jsonrpc: superstruct.literal('2.0'),
|
|
@@ -4890,7 +4918,7 @@ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddlewar
|
|
|
4890
4918
|
agent,
|
|
4891
4919
|
headers: Object.assign({
|
|
4892
4920
|
'Content-Type': 'application/json'
|
|
4893
|
-
}, httpHeaders || {})
|
|
4921
|
+
}, httpHeaders || {}, COMMON_HTTP_HEADERS)
|
|
4894
4922
|
};
|
|
4895
4923
|
|
|
4896
4924
|
try {
|
|
@@ -5564,9 +5592,14 @@ const LogsNotificationResult = superstruct.type({
|
|
|
5564
5592
|
* Filter for log subscriptions.
|
|
5565
5593
|
*/
|
|
5566
5594
|
|
|
5595
|
+
/** @internal */
|
|
5596
|
+
const COMMON_HTTP_HEADERS = {
|
|
5597
|
+
'solana-client': `js/${(_process$env$npm_pack = "0.0.0-development") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
5598
|
+
};
|
|
5567
5599
|
/**
|
|
5568
5600
|
* A connection to a fullnode JSON RPC endpoint
|
|
5569
5601
|
*/
|
|
5602
|
+
|
|
5570
5603
|
class Connection {
|
|
5571
5604
|
/** @internal */
|
|
5572
5605
|
|
|
@@ -5731,8 +5764,16 @@ class Connection {
|
|
|
5731
5764
|
*/
|
|
5732
5765
|
|
|
5733
5766
|
|
|
5734
|
-
async getBalanceAndContext(publicKey,
|
|
5735
|
-
|
|
5767
|
+
async getBalanceAndContext(publicKey, commitmentOrConfig) {
|
|
5768
|
+
/** @internal */
|
|
5769
|
+
const {
|
|
5770
|
+
commitment,
|
|
5771
|
+
config
|
|
5772
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5773
|
+
|
|
5774
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
5775
|
+
/* encoding */
|
|
5776
|
+
, config);
|
|
5736
5777
|
|
|
5737
5778
|
const unsafeRes = await this._rpcRequest('getBalance', args);
|
|
5738
5779
|
const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.number()));
|
|
@@ -5748,8 +5789,8 @@ class Connection {
|
|
|
5748
5789
|
*/
|
|
5749
5790
|
|
|
5750
5791
|
|
|
5751
|
-
async getBalance(publicKey,
|
|
5752
|
-
return await this.getBalanceAndContext(publicKey,
|
|
5792
|
+
async getBalance(publicKey, commitmentOrConfig) {
|
|
5793
|
+
return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {
|
|
5753
5794
|
throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);
|
|
5754
5795
|
});
|
|
5755
5796
|
}
|
|
@@ -5871,7 +5912,11 @@ class Connection {
|
|
|
5871
5912
|
*/
|
|
5872
5913
|
|
|
5873
5914
|
|
|
5874
|
-
async getTokenAccountsByOwner(ownerAddress, filter,
|
|
5915
|
+
async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
|
|
5916
|
+
const {
|
|
5917
|
+
commitment,
|
|
5918
|
+
config
|
|
5919
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5875
5920
|
let _args = [ownerAddress.toBase58()];
|
|
5876
5921
|
|
|
5877
5922
|
if ('mint' in filter) {
|
|
@@ -5884,7 +5929,7 @@ class Connection {
|
|
|
5884
5929
|
});
|
|
5885
5930
|
}
|
|
5886
5931
|
|
|
5887
|
-
const args = this._buildArgs(_args, commitment, 'base64');
|
|
5932
|
+
const args = this._buildArgs(_args, commitment, 'base64', config);
|
|
5888
5933
|
|
|
5889
5934
|
const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);
|
|
5890
5935
|
const res = superstruct.create(unsafeRes, GetTokenAccountsByOwner);
|
|
@@ -5968,8 +6013,13 @@ class Connection {
|
|
|
5968
6013
|
*/
|
|
5969
6014
|
|
|
5970
6015
|
|
|
5971
|
-
async getAccountInfoAndContext(publicKey,
|
|
5972
|
-
const
|
|
6016
|
+
async getAccountInfoAndContext(publicKey, commitmentOrConfig) {
|
|
6017
|
+
const {
|
|
6018
|
+
commitment,
|
|
6019
|
+
config
|
|
6020
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6021
|
+
|
|
6022
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config);
|
|
5973
6023
|
|
|
5974
6024
|
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
|
|
5975
6025
|
const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.nullable(AccountInfoResult)));
|
|
@@ -6002,9 +6052,9 @@ class Connection {
|
|
|
6002
6052
|
*/
|
|
6003
6053
|
|
|
6004
6054
|
|
|
6005
|
-
async getAccountInfo(publicKey,
|
|
6055
|
+
async getAccountInfo(publicKey, commitmentOrConfig) {
|
|
6006
6056
|
try {
|
|
6007
|
-
const res = await this.getAccountInfoAndContext(publicKey,
|
|
6057
|
+
const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);
|
|
6008
6058
|
return res.value;
|
|
6009
6059
|
} catch (e) {
|
|
6010
6060
|
throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
|
|
@@ -6015,10 +6065,14 @@ class Connection {
|
|
|
6015
6065
|
*/
|
|
6016
6066
|
|
|
6017
6067
|
|
|
6018
|
-
async getMultipleAccountsInfoAndContext(publicKeys,
|
|
6068
|
+
async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {
|
|
6069
|
+
const {
|
|
6070
|
+
commitment,
|
|
6071
|
+
config
|
|
6072
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6019
6073
|
const keys = publicKeys.map(key => key.toBase58());
|
|
6020
6074
|
|
|
6021
|
-
const args = this._buildArgs([keys], commitment, 'base64');
|
|
6075
|
+
const args = this._buildArgs([keys], commitment, 'base64', config);
|
|
6022
6076
|
|
|
6023
6077
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
|
6024
6078
|
const res = superstruct.create(unsafeRes, jsonRpcResultAndContext(superstruct.array(superstruct.nullable(AccountInfoResult))));
|
|
@@ -6034,8 +6088,8 @@ class Connection {
|
|
|
6034
6088
|
*/
|
|
6035
6089
|
|
|
6036
6090
|
|
|
6037
|
-
async getMultipleAccountsInfo(publicKeys,
|
|
6038
|
-
const res = await this.getMultipleAccountsInfoAndContext(publicKeys,
|
|
6091
|
+
async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {
|
|
6092
|
+
const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);
|
|
6039
6093
|
return res.value;
|
|
6040
6094
|
}
|
|
6041
6095
|
/**
|
|
@@ -6043,10 +6097,17 @@ class Connection {
|
|
|
6043
6097
|
*/
|
|
6044
6098
|
|
|
6045
6099
|
|
|
6046
|
-
async getStakeActivation(publicKey,
|
|
6047
|
-
const
|
|
6048
|
-
|
|
6049
|
-
|
|
6100
|
+
async getStakeActivation(publicKey, commitmentOrConfig, epoch) {
|
|
6101
|
+
const {
|
|
6102
|
+
commitment,
|
|
6103
|
+
config
|
|
6104
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6105
|
+
|
|
6106
|
+
const args = this._buildArgs([publicKey.toBase58()], commitment, undefined
|
|
6107
|
+
/* encoding */
|
|
6108
|
+
, { ...config,
|
|
6109
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6110
|
+
});
|
|
6050
6111
|
|
|
6051
6112
|
const unsafeRes = await this._rpcRequest('getStakeActivation', args);
|
|
6052
6113
|
const res = superstruct.create(unsafeRes, jsonRpcResult(StakeActivationResult));
|
|
@@ -6065,28 +6126,16 @@ class Connection {
|
|
|
6065
6126
|
|
|
6066
6127
|
|
|
6067
6128
|
async getProgramAccounts(programId, configOrCommitment) {
|
|
6068
|
-
const
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
commitment = configOrCommitment.commitment;
|
|
6077
|
-
encoding = configOrCommitment.encoding;
|
|
6078
|
-
|
|
6079
|
-
if (configOrCommitment.dataSlice) {
|
|
6080
|
-
extra.dataSlice = configOrCommitment.dataSlice;
|
|
6081
|
-
}
|
|
6082
|
-
|
|
6083
|
-
if (configOrCommitment.filters) {
|
|
6084
|
-
extra.filters = configOrCommitment.filters;
|
|
6085
|
-
}
|
|
6086
|
-
}
|
|
6087
|
-
}
|
|
6129
|
+
const {
|
|
6130
|
+
commitment,
|
|
6131
|
+
config
|
|
6132
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6133
|
+
const {
|
|
6134
|
+
encoding,
|
|
6135
|
+
...configWithoutEncoding
|
|
6136
|
+
} = config || {};
|
|
6088
6137
|
|
|
6089
|
-
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64',
|
|
6138
|
+
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
|
|
6090
6139
|
|
|
6091
6140
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6092
6141
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.array(KeyedAccountInfoResult)));
|
|
@@ -6105,22 +6154,12 @@ class Connection {
|
|
|
6105
6154
|
|
|
6106
6155
|
|
|
6107
6156
|
async getParsedProgramAccounts(programId, configOrCommitment) {
|
|
6108
|
-
const
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
if (typeof configOrCommitment === 'string') {
|
|
6113
|
-
commitment = configOrCommitment;
|
|
6114
|
-
} else {
|
|
6115
|
-
commitment = configOrCommitment.commitment;
|
|
6116
|
-
|
|
6117
|
-
if (configOrCommitment.filters) {
|
|
6118
|
-
extra.filters = configOrCommitment.filters;
|
|
6119
|
-
}
|
|
6120
|
-
}
|
|
6121
|
-
}
|
|
6157
|
+
const {
|
|
6158
|
+
commitment,
|
|
6159
|
+
config
|
|
6160
|
+
} = extractCommitmentFromConfig(configOrCommitment);
|
|
6122
6161
|
|
|
6123
|
-
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed',
|
|
6162
|
+
const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);
|
|
6124
6163
|
|
|
6125
6164
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
6126
6165
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.array(KeyedParsedAccountInfoResult)));
|
|
@@ -6287,8 +6326,15 @@ class Connection {
|
|
|
6287
6326
|
*/
|
|
6288
6327
|
|
|
6289
6328
|
|
|
6290
|
-
async getSlot(
|
|
6291
|
-
const
|
|
6329
|
+
async getSlot(commitmentOrConfig) {
|
|
6330
|
+
const {
|
|
6331
|
+
commitment,
|
|
6332
|
+
config
|
|
6333
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6334
|
+
|
|
6335
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6336
|
+
/* encoding */
|
|
6337
|
+
, config);
|
|
6292
6338
|
|
|
6293
6339
|
const unsafeRes = await this._rpcRequest('getSlot', args);
|
|
6294
6340
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
@@ -6304,8 +6350,15 @@ class Connection {
|
|
|
6304
6350
|
*/
|
|
6305
6351
|
|
|
6306
6352
|
|
|
6307
|
-
async getSlotLeader(
|
|
6308
|
-
const
|
|
6353
|
+
async getSlotLeader(commitmentOrConfig) {
|
|
6354
|
+
const {
|
|
6355
|
+
commitment,
|
|
6356
|
+
config
|
|
6357
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6358
|
+
|
|
6359
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6360
|
+
/* encoding */
|
|
6361
|
+
, config);
|
|
6309
6362
|
|
|
6310
6363
|
const unsafeRes = await this._rpcRequest('getSlotLeader', args);
|
|
6311
6364
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.string()));
|
|
@@ -6378,8 +6431,15 @@ class Connection {
|
|
|
6378
6431
|
*/
|
|
6379
6432
|
|
|
6380
6433
|
|
|
6381
|
-
async getTransactionCount(
|
|
6382
|
-
const
|
|
6434
|
+
async getTransactionCount(commitmentOrConfig) {
|
|
6435
|
+
const {
|
|
6436
|
+
commitment,
|
|
6437
|
+
config
|
|
6438
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6439
|
+
|
|
6440
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6441
|
+
/* encoding */
|
|
6442
|
+
, config);
|
|
6383
6443
|
|
|
6384
6444
|
const unsafeRes = await this._rpcRequest('getTransactionCount', args);
|
|
6385
6445
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
@@ -6426,9 +6486,16 @@ class Connection {
|
|
|
6426
6486
|
*/
|
|
6427
6487
|
|
|
6428
6488
|
|
|
6429
|
-
async getInflationReward(addresses, epoch,
|
|
6430
|
-
const
|
|
6431
|
-
|
|
6489
|
+
async getInflationReward(addresses, epoch, commitmentOrConfig) {
|
|
6490
|
+
const {
|
|
6491
|
+
commitment,
|
|
6492
|
+
config
|
|
6493
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6494
|
+
|
|
6495
|
+
const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined
|
|
6496
|
+
/* encoding */
|
|
6497
|
+
, { ...config,
|
|
6498
|
+
epoch: epoch != null ? epoch : config === null || config === void 0 ? void 0 : config.epoch
|
|
6432
6499
|
});
|
|
6433
6500
|
|
|
6434
6501
|
const unsafeRes = await this._rpcRequest('getInflationReward', args);
|
|
@@ -6445,8 +6512,15 @@ class Connection {
|
|
|
6445
6512
|
*/
|
|
6446
6513
|
|
|
6447
6514
|
|
|
6448
|
-
async getEpochInfo(
|
|
6449
|
-
const
|
|
6515
|
+
async getEpochInfo(commitmentOrConfig) {
|
|
6516
|
+
const {
|
|
6517
|
+
commitment,
|
|
6518
|
+
config
|
|
6519
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6520
|
+
|
|
6521
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6522
|
+
/* encoding */
|
|
6523
|
+
, config);
|
|
6450
6524
|
|
|
6451
6525
|
const unsafeRes = await this._rpcRequest('getEpochInfo', args);
|
|
6452
6526
|
const res = superstruct.create(unsafeRes, GetEpochInfoRpcResult);
|
|
@@ -6617,9 +6691,9 @@ class Connection {
|
|
|
6617
6691
|
*/
|
|
6618
6692
|
|
|
6619
6693
|
|
|
6620
|
-
async getLatestBlockhash(
|
|
6694
|
+
async getLatestBlockhash(commitmentOrConfig) {
|
|
6621
6695
|
try {
|
|
6622
|
-
const res = await this.getLatestBlockhashAndContext(
|
|
6696
|
+
const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);
|
|
6623
6697
|
return res.value;
|
|
6624
6698
|
} catch (e) {
|
|
6625
6699
|
throw new Error('failed to get recent blockhash: ' + e);
|
|
@@ -6631,8 +6705,15 @@ class Connection {
|
|
|
6631
6705
|
*/
|
|
6632
6706
|
|
|
6633
6707
|
|
|
6634
|
-
async getLatestBlockhashAndContext(
|
|
6635
|
-
const
|
|
6708
|
+
async getLatestBlockhashAndContext(commitmentOrConfig) {
|
|
6709
|
+
const {
|
|
6710
|
+
commitment,
|
|
6711
|
+
config
|
|
6712
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6713
|
+
|
|
6714
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6715
|
+
/* encoding */
|
|
6716
|
+
, config);
|
|
6636
6717
|
|
|
6637
6718
|
const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);
|
|
6638
6719
|
const res = superstruct.create(unsafeRes, GetLatestBlockhashRpcResult);
|
|
@@ -6710,8 +6791,15 @@ class Connection {
|
|
|
6710
6791
|
*/
|
|
6711
6792
|
|
|
6712
6793
|
|
|
6713
|
-
async getBlockHeight(
|
|
6714
|
-
const
|
|
6794
|
+
async getBlockHeight(commitmentOrConfig) {
|
|
6795
|
+
const {
|
|
6796
|
+
commitment,
|
|
6797
|
+
config
|
|
6798
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
6799
|
+
|
|
6800
|
+
const args = this._buildArgs([], commitment, undefined
|
|
6801
|
+
/* encoding */
|
|
6802
|
+
, config);
|
|
6715
6803
|
|
|
6716
6804
|
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
6717
6805
|
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
@@ -7440,6 +7528,10 @@ class Connection {
|
|
|
7440
7528
|
config.maxRetries = options.maxRetries;
|
|
7441
7529
|
}
|
|
7442
7530
|
|
|
7531
|
+
if (options && options.minContextSlot != null) {
|
|
7532
|
+
config.minContextSlot = options.minContextSlot;
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7443
7535
|
if (skipPreflight) {
|
|
7444
7536
|
config.skipPreflight = skipPreflight;
|
|
7445
7537
|
}
|
|
@@ -9849,7 +9941,8 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, confirma
|
|
|
9849
9941
|
|
|
9850
9942
|
const sendOptions = options && {
|
|
9851
9943
|
skipPreflight: options.skipPreflight,
|
|
9852
|
-
preflightCommitment: options.preflightCommitment || options.commitment
|
|
9944
|
+
preflightCommitment: options.preflightCommitment || options.commitment,
|
|
9945
|
+
minContextSlot: options.minContextSlot
|
|
9853
9946
|
};
|
|
9854
9947
|
const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);
|
|
9855
9948
|
const commitment = options && options.commitment;
|