@solana/web3.js 1.73.4 → 1.75.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 +61 -25
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +61 -25
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +61 -25
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +21 -1
- package/lib/index.esm.js +61 -25
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +61 -25
- 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 +61 -25
- package/lib/index.native.js.map +1 -1
- package/package.json +4 -4
- package/src/connection.ts +89 -21
package/lib/index.iife.js
CHANGED
|
@@ -17337,6 +17337,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
17337
17337
|
postBalance: number(),
|
|
17338
17338
|
commission: optional(nullable(number()))
|
|
17339
17339
|
}))));
|
|
17340
|
+
/**
|
|
17341
|
+
* Expected JSON RPC response for the "getRecentPrioritizationFees" message
|
|
17342
|
+
*/
|
|
17343
|
+
const GetRecentPrioritizationFeesResult = array(type({
|
|
17344
|
+
slot: number(),
|
|
17345
|
+
prioritizationFee: number()
|
|
17346
|
+
}));
|
|
17340
17347
|
/**
|
|
17341
17348
|
* Expected JSON RPC response for the "getInflationRate" message
|
|
17342
17349
|
*/
|
|
@@ -17538,6 +17545,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
17538
17545
|
*/
|
|
17539
17546
|
const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
|
|
17540
17547
|
|
|
17548
|
+
/**
|
|
17549
|
+
* Expected JSON RPC response for the "getRecentPrioritizationFees" message
|
|
17550
|
+
*/
|
|
17551
|
+
const GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult);
|
|
17552
|
+
|
|
17541
17553
|
/**
|
|
17542
17554
|
* Expected JSON RPC response for the "getEpochInfo" message
|
|
17543
17555
|
*/
|
|
@@ -18293,7 +18305,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18293
18305
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
18294
18306
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
18295
18307
|
*/
|
|
18296
|
-
constructor(endpoint,
|
|
18308
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
18297
18309
|
this._commitment = void 0;
|
|
18298
18310
|
this._confirmTransactionInitialTimeout = void 0;
|
|
18299
18311
|
this._rpcEndpoint = void 0;
|
|
@@ -18321,23 +18333,47 @@ var solanaWeb3 = (function (exports) {
|
|
|
18321
18333
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
18322
18334
|
this._subscriptionsByHash = {};
|
|
18323
18335
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
18336
|
+
this.getBlockHeight = (() => {
|
|
18337
|
+
const requestPromises = {};
|
|
18338
|
+
return async commitmentOrConfig => {
|
|
18339
|
+
const {
|
|
18340
|
+
commitment,
|
|
18341
|
+
config
|
|
18342
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
18343
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
18344
|
+
const requestHash = fastStableStringify$1(args);
|
|
18345
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
18346
|
+
try {
|
|
18347
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
18348
|
+
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
18349
|
+
if ('error' in res) {
|
|
18350
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
18351
|
+
}
|
|
18352
|
+
return res.result;
|
|
18353
|
+
} finally {
|
|
18354
|
+
delete requestPromises[requestHash];
|
|
18355
|
+
}
|
|
18356
|
+
})();
|
|
18357
|
+
return await requestPromises[requestHash];
|
|
18358
|
+
};
|
|
18359
|
+
})();
|
|
18324
18360
|
let wsEndpoint;
|
|
18325
18361
|
let httpHeaders;
|
|
18326
18362
|
let fetch;
|
|
18327
18363
|
let fetchMiddleware;
|
|
18328
18364
|
let disableRetryOnRateLimit;
|
|
18329
18365
|
let httpAgent;
|
|
18330
|
-
if (
|
|
18331
|
-
this._commitment =
|
|
18332
|
-
} else if (
|
|
18333
|
-
this._commitment =
|
|
18334
|
-
this._confirmTransactionInitialTimeout =
|
|
18335
|
-
wsEndpoint =
|
|
18336
|
-
httpHeaders =
|
|
18337
|
-
fetch =
|
|
18338
|
-
fetchMiddleware =
|
|
18339
|
-
disableRetryOnRateLimit =
|
|
18340
|
-
httpAgent =
|
|
18366
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
18367
|
+
this._commitment = _commitmentOrConfig;
|
|
18368
|
+
} else if (_commitmentOrConfig) {
|
|
18369
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
18370
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
18371
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
18372
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
18373
|
+
fetch = _commitmentOrConfig.fetch;
|
|
18374
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
18375
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
18376
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
18341
18377
|
}
|
|
18342
18378
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
18343
18379
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -19411,6 +19447,19 @@ var solanaWeb3 = (function (exports) {
|
|
|
19411
19447
|
return res.result;
|
|
19412
19448
|
}
|
|
19413
19449
|
|
|
19450
|
+
/**
|
|
19451
|
+
* Fetch a list of prioritization fees from recent blocks.
|
|
19452
|
+
*/
|
|
19453
|
+
async getRecentPrioritizationFees(config) {
|
|
19454
|
+
const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());
|
|
19455
|
+
const args = this._buildArgs(accounts?.length ? [accounts] : []);
|
|
19456
|
+
const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args);
|
|
19457
|
+
const res = create(unsafeRes, GetRecentPrioritizationFeesRpcResult);
|
|
19458
|
+
if ('error' in res) {
|
|
19459
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees');
|
|
19460
|
+
}
|
|
19461
|
+
return res.result;
|
|
19462
|
+
}
|
|
19414
19463
|
/**
|
|
19415
19464
|
* Fetch a recent blockhash from the cluster
|
|
19416
19465
|
* @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
|
|
@@ -19595,19 +19644,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
19595
19644
|
/*
|
|
19596
19645
|
* Returns the current block height of the node
|
|
19597
19646
|
*/
|
|
19598
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
19599
|
-
const {
|
|
19600
|
-
commitment,
|
|
19601
|
-
config
|
|
19602
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
19603
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
19604
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
19605
|
-
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
19606
|
-
if ('error' in res) {
|
|
19607
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
19608
|
-
}
|
|
19609
|
-
return res.result;
|
|
19610
|
-
}
|
|
19611
19647
|
|
|
19612
19648
|
/*
|
|
19613
19649
|
* Returns recent block production information from the current or previous epoch
|