@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/package.json
CHANGED
package/src/connection.ts
CHANGED
|
@@ -785,6 +785,27 @@ const GetInflationRewardResult = jsonRpcResult(
|
|
|
785
785
|
),
|
|
786
786
|
);
|
|
787
787
|
|
|
788
|
+
export type InflationRate = {
|
|
789
|
+
/** total inflation */
|
|
790
|
+
total: number;
|
|
791
|
+
/** inflation allocated to validators */
|
|
792
|
+
validator: number;
|
|
793
|
+
/** inflation allocated to the foundation */
|
|
794
|
+
foundation: number;
|
|
795
|
+
/** epoch for which these values are valid */
|
|
796
|
+
epoch: number;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
801
|
+
*/
|
|
802
|
+
const GetInflationRateResult = pick({
|
|
803
|
+
total: number(),
|
|
804
|
+
validator: number(),
|
|
805
|
+
foundation: number(),
|
|
806
|
+
epoch: number(),
|
|
807
|
+
});
|
|
808
|
+
|
|
788
809
|
/**
|
|
789
810
|
* Information about the current epoch
|
|
790
811
|
*/
|
|
@@ -1626,6 +1647,11 @@ function createRpcBatchRequest(client: RpcClient): RpcBatchRequest {
|
|
|
1626
1647
|
*/
|
|
1627
1648
|
const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
|
|
1628
1649
|
|
|
1650
|
+
/**
|
|
1651
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
1652
|
+
*/
|
|
1653
|
+
const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
|
|
1654
|
+
|
|
1629
1655
|
/**
|
|
1630
1656
|
* Expected JSON RPC response for the "getEpochInfo" message
|
|
1631
1657
|
*/
|
|
@@ -4254,6 +4280,18 @@ export class Connection {
|
|
|
4254
4280
|
return res.result;
|
|
4255
4281
|
}
|
|
4256
4282
|
|
|
4283
|
+
/**
|
|
4284
|
+
* Fetch the specific inflation values for the current epoch
|
|
4285
|
+
*/
|
|
4286
|
+
async getInflationRate(): Promise<InflationRate> {
|
|
4287
|
+
const unsafeRes = await this._rpcRequest('getInflationRate', []);
|
|
4288
|
+
const res = create(unsafeRes, GetInflationRateRpcResult);
|
|
4289
|
+
if ('error' in res) {
|
|
4290
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate');
|
|
4291
|
+
}
|
|
4292
|
+
return res.result;
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4257
4295
|
/**
|
|
4258
4296
|
* Fetch the Epoch Info parameters
|
|
4259
4297
|
*/
|