@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.browser.esm.js
CHANGED
|
@@ -5627,6 +5627,10 @@ const TokenBalanceResult = type({
|
|
|
5627
5627
|
owner: optional(string()),
|
|
5628
5628
|
uiTokenAmount: TokenAmountResult
|
|
5629
5629
|
});
|
|
5630
|
+
const LoadedAddressesResult = type({
|
|
5631
|
+
writable: array(PublicKeyFromString),
|
|
5632
|
+
readonly: array(PublicKeyFromString)
|
|
5633
|
+
});
|
|
5630
5634
|
/**
|
|
5631
5635
|
* @internal
|
|
5632
5636
|
*/
|
|
@@ -5646,7 +5650,8 @@ const ConfirmedTransactionMetaResult = type({
|
|
|
5646
5650
|
postBalances: array(number()),
|
|
5647
5651
|
logMessages: optional(nullable(array(string()))),
|
|
5648
5652
|
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5649
|
-
postTokenBalances: optional(nullable(array(TokenBalanceResult)))
|
|
5653
|
+
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5654
|
+
loadedAddresses: optional(LoadedAddressesResult)
|
|
5650
5655
|
});
|
|
5651
5656
|
/**
|
|
5652
5657
|
* @internal
|
|
@@ -5663,7 +5668,8 @@ const ParsedConfirmedTransactionMetaResult = type({
|
|
|
5663
5668
|
postBalances: array(number()),
|
|
5664
5669
|
logMessages: optional(nullable(array(string()))),
|
|
5665
5670
|
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5666
|
-
postTokenBalances: optional(nullable(array(TokenBalanceResult)))
|
|
5671
|
+
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
|
|
5672
|
+
loadedAddresses: optional(LoadedAddressesResult)
|
|
5667
5673
|
});
|
|
5668
5674
|
/**
|
|
5669
5675
|
* Expected JSON RPC response for the "getBlock" message
|
|
@@ -7104,8 +7110,13 @@ class Connection {
|
|
|
7104
7110
|
*/
|
|
7105
7111
|
|
|
7106
7112
|
|
|
7107
|
-
async getParsedTransaction(signature,
|
|
7108
|
-
const
|
|
7113
|
+
async getParsedTransaction(signature, commitmentOrConfig) {
|
|
7114
|
+
const {
|
|
7115
|
+
commitment,
|
|
7116
|
+
config
|
|
7117
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7118
|
+
|
|
7119
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
|
|
7109
7120
|
|
|
7110
7121
|
const unsafeRes = await this._rpcRequest('getTransaction', args);
|
|
7111
7122
|
const res = create(unsafeRes, GetParsedTransactionRpcResult);
|
|
@@ -7121,9 +7132,13 @@ class Connection {
|
|
|
7121
7132
|
*/
|
|
7122
7133
|
|
|
7123
7134
|
|
|
7124
|
-
async getParsedTransactions(signatures,
|
|
7135
|
+
async getParsedTransactions(signatures, commitmentOrConfig) {
|
|
7136
|
+
const {
|
|
7137
|
+
commitment,
|
|
7138
|
+
config
|
|
7139
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7125
7140
|
const batch = signatures.map(signature => {
|
|
7126
|
-
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
7141
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);
|
|
7127
7142
|
|
|
7128
7143
|
return {
|
|
7129
7144
|
methodName: 'getTransaction',
|
|
@@ -7148,9 +7163,15 @@ class Connection {
|
|
|
7148
7163
|
*/
|
|
7149
7164
|
|
|
7150
7165
|
|
|
7151
|
-
async getTransactions(signatures,
|
|
7166
|
+
async getTransactions(signatures, commitmentOrConfig) {
|
|
7167
|
+
const {
|
|
7168
|
+
commitment,
|
|
7169
|
+
config
|
|
7170
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7152
7171
|
const batch = signatures.map(signature => {
|
|
7153
|
-
const args = this._buildArgsAtLeastConfirmed([signature], commitment
|
|
7172
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined
|
|
7173
|
+
/* encoding */
|
|
7174
|
+
, config);
|
|
7154
7175
|
|
|
7155
7176
|
return {
|
|
7156
7177
|
methodName: 'getTransaction',
|
|
@@ -7592,6 +7613,28 @@ class Connection {
|
|
|
7592
7613
|
this._pollingBlockhash = false;
|
|
7593
7614
|
}
|
|
7594
7615
|
}
|
|
7616
|
+
/**
|
|
7617
|
+
* get the stake minimum delegation
|
|
7618
|
+
*/
|
|
7619
|
+
|
|
7620
|
+
|
|
7621
|
+
async getStakeMinimumDelegation(config) {
|
|
7622
|
+
const {
|
|
7623
|
+
commitment,
|
|
7624
|
+
config: configArg
|
|
7625
|
+
} = extractCommitmentFromConfig(config);
|
|
7626
|
+
|
|
7627
|
+
const args = this._buildArgs([], commitment, 'base64', configArg);
|
|
7628
|
+
|
|
7629
|
+
const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);
|
|
7630
|
+
const res = create(unsafeRes, jsonRpcResultAndContext(number()));
|
|
7631
|
+
|
|
7632
|
+
if ('error' in res) {
|
|
7633
|
+
throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);
|
|
7634
|
+
}
|
|
7635
|
+
|
|
7636
|
+
return res.result;
|
|
7637
|
+
}
|
|
7595
7638
|
/**
|
|
7596
7639
|
* Simulate a transaction
|
|
7597
7640
|
*/
|
|
@@ -7823,6 +7866,11 @@ class Connection {
|
|
|
7823
7866
|
this._rpcWebSocketConnected = false;
|
|
7824
7867
|
this._rpcWebSocketGeneration++;
|
|
7825
7868
|
|
|
7869
|
+
if (this._rpcWebSocketIdleTimeout) {
|
|
7870
|
+
clearTimeout(this._rpcWebSocketIdleTimeout);
|
|
7871
|
+
this._rpcWebSocketIdleTimeout = null;
|
|
7872
|
+
}
|
|
7873
|
+
|
|
7826
7874
|
if (this._rpcWebSocketHeartbeat) {
|
|
7827
7875
|
clearInterval(this._rpcWebSocketHeartbeat);
|
|
7828
7876
|
this._rpcWebSocketHeartbeat = null;
|