@solana/web3.js 1.71.0 → 1.72.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 +30 -0
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +30 -0
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +30 -0
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +14 -0
- package/lib/index.esm.js +30 -0
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +30 -0
- 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 +30 -0
- 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
|
@@ -6215,6 +6215,16 @@ const GetInflationRewardResult = jsonRpcResult(array(nullable(type({
|
|
|
6215
6215
|
amount: number(),
|
|
6216
6216
|
postBalance: number()
|
|
6217
6217
|
}))));
|
|
6218
|
+
|
|
6219
|
+
/**
|
|
6220
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
6221
|
+
*/
|
|
6222
|
+
const GetInflationRateResult = type({
|
|
6223
|
+
total: number(),
|
|
6224
|
+
validator: number(),
|
|
6225
|
+
foundation: number(),
|
|
6226
|
+
epoch: number()
|
|
6227
|
+
});
|
|
6218
6228
|
/**
|
|
6219
6229
|
* Information about the current epoch
|
|
6220
6230
|
*/
|
|
@@ -6444,6 +6454,11 @@ function createRpcBatchRequest(client) {
|
|
|
6444
6454
|
|
|
6445
6455
|
|
|
6446
6456
|
const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);
|
|
6457
|
+
/**
|
|
6458
|
+
* Expected JSON RPC response for the "getInflationRate" message
|
|
6459
|
+
*/
|
|
6460
|
+
|
|
6461
|
+
const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);
|
|
6447
6462
|
/**
|
|
6448
6463
|
* Expected JSON RPC response for the "getEpochInfo" message
|
|
6449
6464
|
*/
|
|
@@ -8394,6 +8409,21 @@ class Connection {
|
|
|
8394
8409
|
|
|
8395
8410
|
return res.result;
|
|
8396
8411
|
}
|
|
8412
|
+
/**
|
|
8413
|
+
* Fetch the specific inflation values for the current epoch
|
|
8414
|
+
*/
|
|
8415
|
+
|
|
8416
|
+
|
|
8417
|
+
async getInflationRate() {
|
|
8418
|
+
const unsafeRes = await this._rpcRequest('getInflationRate', []);
|
|
8419
|
+
const res = create(unsafeRes, GetInflationRateRpcResult);
|
|
8420
|
+
|
|
8421
|
+
if ('error' in res) {
|
|
8422
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate');
|
|
8423
|
+
}
|
|
8424
|
+
|
|
8425
|
+
return res.result;
|
|
8426
|
+
}
|
|
8397
8427
|
/**
|
|
8398
8428
|
* Fetch the Epoch Info parameters
|
|
8399
8429
|
*/
|