@solana/web3.js 1.49.0 → 1.51.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/README.md +4 -0
- package/lib/index.browser.cjs.js +56 -8
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +56 -8
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +56 -8
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +25 -3
- package/lib/index.esm.js +56 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +56 -8
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +56 -8
- package/lib/index.native.js.map +1 -1
- package/package.json +2 -2
- package/src/connection.ts +67 -6
package/lib/index.d.ts
CHANGED
|
@@ -489,6 +489,13 @@ declare module '@solana/web3.js' {
|
|
|
489
489
|
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
490
490
|
maxSupportedTransactionVersion?: number;
|
|
491
491
|
};
|
|
492
|
+
/**
|
|
493
|
+
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
494
|
+
*/
|
|
495
|
+
export type GetStakeMinimumDelegationConfig = {
|
|
496
|
+
/** The level of commitment desired */
|
|
497
|
+
commitment?: Commitment;
|
|
498
|
+
};
|
|
492
499
|
/**
|
|
493
500
|
* Configuration object for changing `getBlockHeight` query behavior
|
|
494
501
|
*/
|
|
@@ -712,6 +719,13 @@ declare module '@solana/web3.js' {
|
|
|
712
719
|
* @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
|
|
713
720
|
*/
|
|
714
721
|
export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
|
|
722
|
+
/**
|
|
723
|
+
* Collection of addresses loaded by a transaction using address table lookups
|
|
724
|
+
*/
|
|
725
|
+
export type LoadedAddresses = {
|
|
726
|
+
writable: Array<PublicKey>;
|
|
727
|
+
readonly: Array<PublicKey>;
|
|
728
|
+
};
|
|
715
729
|
/**
|
|
716
730
|
* Metadata for a parsed transaction on the ledger
|
|
717
731
|
*/
|
|
@@ -732,6 +746,8 @@ declare module '@solana/web3.js' {
|
|
|
732
746
|
postTokenBalances?: Array<TokenBalance> | null;
|
|
733
747
|
/** The error result of transaction processing */
|
|
734
748
|
err: TransactionError | null;
|
|
749
|
+
/** The collection of addresses loaded using address lookup tables */
|
|
750
|
+
loadedAddresses?: LoadedAddresses;
|
|
735
751
|
};
|
|
736
752
|
export type CompiledInnerInstruction = {
|
|
737
753
|
index: number;
|
|
@@ -1776,14 +1792,14 @@ declare module '@solana/web3.js' {
|
|
|
1776
1792
|
*/
|
|
1777
1793
|
getParsedTransaction(
|
|
1778
1794
|
signature: TransactionSignature,
|
|
1779
|
-
|
|
1795
|
+
commitmentOrConfig?: GetTransactionConfig | Finality,
|
|
1780
1796
|
): Promise<ParsedConfirmedTransaction | null>;
|
|
1781
1797
|
/**
|
|
1782
1798
|
* Fetch parsed transaction details for a batch of confirmed transactions
|
|
1783
1799
|
*/
|
|
1784
1800
|
getParsedTransactions(
|
|
1785
1801
|
signatures: TransactionSignature[],
|
|
1786
|
-
|
|
1802
|
+
commitmentOrConfig?: GetTransactionConfig | Finality,
|
|
1787
1803
|
): Promise<(ParsedConfirmedTransaction | null)[]>;
|
|
1788
1804
|
/**
|
|
1789
1805
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
@@ -1791,7 +1807,7 @@ declare module '@solana/web3.js' {
|
|
|
1791
1807
|
*/
|
|
1792
1808
|
getTransactions(
|
|
1793
1809
|
signatures: TransactionSignature[],
|
|
1794
|
-
|
|
1810
|
+
commitmentOrConfig?: GetTransactionConfig | Finality,
|
|
1795
1811
|
): Promise<(TransactionResponse | null)[]>;
|
|
1796
1812
|
/**
|
|
1797
1813
|
* Fetch a list of Transactions and transaction statuses from the cluster
|
|
@@ -1927,6 +1943,12 @@ declare module '@solana/web3.js' {
|
|
|
1927
1943
|
to: PublicKey,
|
|
1928
1944
|
lamports: number,
|
|
1929
1945
|
): Promise<TransactionSignature>;
|
|
1946
|
+
/**
|
|
1947
|
+
* get the stake minimum delegation
|
|
1948
|
+
*/
|
|
1949
|
+
getStakeMinimumDelegation(
|
|
1950
|
+
config?: GetStakeMinimumDelegationConfig,
|
|
1951
|
+
): Promise<RpcResponseAndContext<number>>;
|
|
1930
1952
|
/**
|
|
1931
1953
|
* Simulate a transaction
|
|
1932
1954
|
*/
|
package/lib/index.esm.js
CHANGED
|
@@ -5709,6 +5709,10 @@ const TokenBalanceResult = type({
|
|
|
5709
5709
|
owner: optional(string()),
|
|
5710
5710
|
uiTokenAmount: TokenAmountResult
|
|
5711
5711
|
});
|
|
5712
|
+
const LoadedAddressesResult = type({
|
|
5713
|
+
writable: array(PublicKeyFromString),
|
|
5714
|
+
readonly: array(PublicKeyFromString)
|
|
5715
|
+
});
|
|
5712
5716
|
/**
|
|
5713
5717
|
* @internal
|
|
5714
5718
|
*/
|
|
@@ -5728,7 +5732,8 @@ const ConfirmedTransactionMetaResult = type({
|
|
|
5728
5732
|
postBalances: array(number()),
|
|
5729
5733
|
logMessages: optional(nullable(array(string()))),
|
|
5730
5734
|
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5731
|
-
postTokenBalances: optional(nullable(array(TokenBalanceResult)))
|
|
5735
|
+
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5736
|
+
loadedAddresses: optional(LoadedAddressesResult)
|
|
5732
5737
|
});
|
|
5733
5738
|
/**
|
|
5734
5739
|
* @internal
|
|
@@ -5745,7 +5750,8 @@ const ParsedConfirmedTransactionMetaResult = type({
|
|
|
5745
5750
|
postBalances: array(number()),
|
|
5746
5751
|
logMessages: optional(nullable(array(string()))),
|
|
5747
5752
|
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5748
|
-
postTokenBalances: optional(nullable(array(TokenBalanceResult)))
|
|
5753
|
+
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5754
|
+
loadedAddresses: optional(LoadedAddressesResult)
|
|
5749
5755
|
});
|
|
5750
5756
|
/**
|
|
5751
5757
|
* Expected JSON RPC response for the "getBlock" message
|
|
@@ -7186,8 +7192,13 @@ class Connection {
|
|
|
7186
7192
|
*/
|
|
7187
7193
|
|
|
7188
7194
|
|
|
7189
|
-
async getParsedTransaction(signature,
|
|
7190
|
-
const
|
|
7195
|
+
async getParsedTransaction(signature, commitmentOrConfig) {
|
|
7196
|
+
const {
|
|
7197
|
+
commitment,
|
|
7198
|
+
config
|
|
7199
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7200
|
+
|
|
7201
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
|
|
7191
7202
|
|
|
7192
7203
|
const unsafeRes = await this._rpcRequest('getTransaction', args);
|
|
7193
7204
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
@@ -7203,9 +7214,13 @@ class Connection {
|
|
|
7203
7214
|
*/
|
|
7204
7215
|
|
|
7205
7216
|
|
|
7206
|
-
async getParsedTransactions(signatures,
|
|
7217
|
+
async getParsedTransactions(signatures, commitmentOrConfig) {
|
|
7218
|
+
const {
|
|
7219
|
+
commitment,
|
|
7220
|
+
config
|
|
7221
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7207
7222
|
const batch = signatures.map(signature => {
|
|
7208
|
-
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
7223
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
|
|
7209
7224
|
|
|
7210
7225
|
return {
|
|
7211
7226
|
methodName: 'getTransaction',
|
|
@@ -7230,9 +7245,15 @@ class Connection {
|
|
|
7230
7245
|
*/
|
|
7231
7246
|
|
|
7232
7247
|
|
|
7233
|
-
async getTransactions(signatures,
|
|
7248
|
+
async getTransactions(signatures, commitmentOrConfig) {
|
|
7249
|
+
const {
|
|
7250
|
+
commitment,
|
|
7251
|
+
config
|
|
7252
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7234
7253
|
const batch = signatures.map(signature => {
|
|
7235
|
-
const args = this._buildArgsAtLeastConfirmed([signature], commitment
|
|
7254
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
|
|
7255
|
+
/* encoding */
|
|
7256
|
+
, config);
|
|
7236
7257
|
|
|
7237
7258
|
return {
|
|
7238
7259
|
methodName: 'getTransaction',
|
|
@@ -7674,6 +7695,28 @@ class Connection {
|
|
|
7674
7695
|
this._pollingBlockhash = false;
|
|
7675
7696
|
}
|
|
7676
7697
|
}
|
|
7698
|
+
/**
|
|
7699
|
+
* get the stake minimum delegation
|
|
7700
|
+
*/
|
|
7701
|
+
|
|
7702
|
+
|
|
7703
|
+
async getStakeMinimumDelegation(config) {
|
|
7704
|
+
const {
|
|
7705
|
+
commitment,
|
|
7706
|
+
config: configArg
|
|
7707
|
+
} = extractCommitmentFromConfig(config);
|
|
7708
|
+
|
|
7709
|
+
const args = this._buildArgs([], commitment, 'base64', configArg);
|
|
7710
|
+
|
|
7711
|
+
const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
|
|
7712
|
+
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
7713
|
+
|
|
7714
|
+
if ('error' in res) {
|
|
7715
|
+
throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
|
|
7716
|
+
}
|
|
7717
|
+
|
|
7718
|
+
return res.result;
|
|
7719
|
+
}
|
|
7677
7720
|
/**
|
|
7678
7721
|
* Simulate a transaction
|
|
7679
7722
|
*/
|
|
@@ -7905,6 +7948,11 @@ class Connection {
|
|
|
7905
7948
|
this._rpcWebSocketConnected = false;
|
|
7906
7949
|
this._rpcWebSocketGeneration++;
|
|
7907
7950
|
|
|
7951
|
+
if (this._rpcWebSocketIdleTimeout) {
|
|
7952
|
+
clearTimeout(this._rpcWebSocketIdleTimeout);
|
|
7953
|
+
this._rpcWebSocketIdleTimeout = null;
|
|
7954
|
+
}
|
|
7955
|
+
|
|
7908
7956
|
if (this._rpcWebSocketHeartbeat) {
|
|
7909
7957
|
clearInterval(this._rpcWebSocketHeartbeat);
|
|
7910
7958
|
this._rpcWebSocketHeartbeat = null;
|