@solana/web3.js 1.71.1 → 1.72.1
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 +31 -1
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +31 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +31 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +14 -0
- package/lib/index.esm.js +31 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +31 -1
- 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 +31 -1
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +38 -0
package/lib/index.d.ts
CHANGED
|
@@ -2323,6 +2323,16 @@ declare module '@solana/web3.js' {
|
|
|
2323
2323
|
/** post balance of the account in lamports */
|
|
2324
2324
|
postBalance: number;
|
|
2325
2325
|
};
|
|
2326
|
+
type InflationRate = {
|
|
2327
|
+
/** total inflation */
|
|
2328
|
+
total: number;
|
|
2329
|
+
/** inflation allocated to validators */
|
|
2330
|
+
validator: number;
|
|
2331
|
+
/** inflation allocated to the foundation */
|
|
2332
|
+
foundation: number;
|
|
2333
|
+
/** epoch for which these values are valid */
|
|
2334
|
+
epoch: number;
|
|
2335
|
+
};
|
|
2326
2336
|
/**
|
|
2327
2337
|
* Information about the current epoch
|
|
2328
2338
|
*/
|
|
@@ -3580,6 +3590,10 @@ declare module '@solana/web3.js' {
|
|
|
3580
3590
|
epoch?: number,
|
|
3581
3591
|
commitmentOrConfig?: Commitment | GetInflationRewardConfig,
|
|
3582
3592
|
): Promise<(InflationReward | null)[]>;
|
|
3593
|
+
/**
|
|
3594
|
+
* Fetch the specific inflation values for the current epoch
|
|
3595
|
+
*/
|
|
3596
|
+
getInflationRate(): Promise<InflationRate>;
|
|
3583
3597
|
/**
|
|
3584
3598
|
* Fetch the Epoch Info parameters
|
|
3585
3599
|
*/
|
package/lib/index.esm.js
CHANGED
|
@@ -6415,6 +6415,16 @@ const GetInflationRewardResult = jsonRpcResult(array(nullable(type({
|
|
|
6415
6415
|
amount: number(),
|
|
6416
6416
|
postBalance: number()
|
|
6417
6417
|
}))));
|
|
6418
|
+
|
|
6419
|
+
/**
|
|
6420
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
6421
|
+
*/
|
|
6422
|
+
const GetInflationRateResult = type({
|
|
6423
|
+
total: number(),
|
|
6424
|
+
validator: number(),
|
|
6425
|
+
foundation: number(),
|
|
6426
|
+
epoch: number()
|
|
6427
|
+
});
|
|
6418
6428
|
/**
|
|
6419
6429
|
* Information about the current epoch
|
|
6420
6430
|
*/
|
|
@@ -6644,6 +6654,11 @@ function createRpcBatchRequest(client) {
|
|
|
6644
6654
|
|
|
6645
6655
|
|
|
6646
6656
|
const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
|
|
6657
|
+
/**
|
|
6658
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
6659
|
+
*/
|
|
6660
|
+
|
|
6661
|
+
const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
|
|
6647
6662
|
/**
|
|
6648
6663
|
* Expected JSON RPC response for the "getEpochInfo" message
|
|
6649
6664
|
*/
|
|
@@ -7326,7 +7341,7 @@ const LogsNotificationResult = type({
|
|
|
7326
7341
|
|
|
7327
7342
|
/** @internal */
|
|
7328
7343
|
const COMMON_HTTP_HEADERS = {
|
|
7329
|
-
'solana-client': `js/${(_process$env$npm_pack = "1.
|
|
7344
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.72.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
7330
7345
|
};
|
|
7331
7346
|
/**
|
|
7332
7347
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -8594,6 +8609,21 @@ class Connection {
|
|
|
8594
8609
|
|
|
8595
8610
|
return res.result;
|
|
8596
8611
|
}
|
|
8612
|
+
/**
|
|
8613
|
+
* Fetch the specific inflation values for the current epoch
|
|
8614
|
+
*/
|
|
8615
|
+
|
|
8616
|
+
|
|
8617
|
+
async getInflationRate() {
|
|
8618
|
+
const unsafeRes = await this._rpcRequest('getInflationRate', []);
|
|
8619
|
+
const res = create(unsafeRes, GetInflationRateRpcResult);
|
|
8620
|
+
|
|
8621
|
+
if ('error' in res) {
|
|
8622
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate');
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
return res.result;
|
|
8626
|
+
}
|
|
8597
8627
|
/**
|
|
8598
8628
|
* Fetch the Epoch Info parameters
|
|
8599
8629
|
*/
|