Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Op get pos economis #275

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -162,7 +162,7 @@
*/
_formatAddress(address) {
if (!this.networkId) {
console.warn('Conflux address: networkId is not set properly, please set it');

Check warning on line 165 in src/Conflux.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
}
return this.useHexAddressInParameter ? format.hexAddress(address) : format.address(address, this.networkId, this.useVerboseAddress);
}
Expand Down Expand Up @@ -1267,14 +1267,15 @@

/**
* 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
Loading