Skip to content

Commit

Permalink
Op get pos economis (#275)
Browse files Browse the repository at this point in the history
* cfx_getPoSEconomics support optional epoch parameter

* update d.ts
  • Loading branch information
Pana authored Sep 9, 2024
1 parent 472b9ba commit 5ef99c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "js-conflux-sdk",
"description": "JavaScript Conflux Software Development Kit",
"version": "2.4.7",
"version": "2.4.9",
"license": "LGPL-3.0",
"author": "[email protected]",
"repository": "https://github.com/Conflux-Chain/js-conflux-sdk.git",
Expand Down
5 changes: 3 additions & 2 deletions src/Conflux.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,14 +1267,15 @@ class Conflux {

/**
* Return PoS summary info
* @param {number|string} epochNumber - epoch number
* @returns {Promise<import('./rpc/types/formatter').PoSEconomics>} PoS summary info
* - distributablePosInterest `number`: Currently total distributable PoS interest (Drip)
* - lastDistributeBlock `number`: Last distribute block number
* - totalPosStakingTokens `number`: Total token amount (Drip) staked in PoS
*
*/
async getPoSEconomics() {
return this.cfx.getPoSEconomics();
async getPoSEconomics(epochNumber) {
return this.cfx.getPoSEconomics(epochNumber);
}

// ----------------------------- subscription -------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/rpc/cfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ class CFX extends RPCMethodFactory {
},
{
method: 'cfx_getPoSEconomics',
requestFormatters: [
format.epochNumberOrUndefined,
],
responseFormatter: cfxFormat.posEconomics,
},
{
Expand Down

0 comments on commit 5ef99c4

Please sign in to comment.