Skip to content

Commit

Permalink
fix get epoch receipts optional params
Browse files Browse the repository at this point in the history
  • Loading branch information
Pana committed Nov 5, 2024
1 parent 6bede27 commit 475b435
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 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.10",
"version": "2.4.11",
"license": "LGPL-3.0",
"author": "[email protected]",
"repository": "https://github.com/Conflux-Chain/js-conflux-sdk.git",
Expand Down
15 changes: 12 additions & 3 deletions src/rpc/cfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class CFX extends RPCMethodFactory {
method: 'cfx_getEpochReceipts',
debug: true,
requestFormatters: [
format.epochNumber,
format.epochNumberOrBlockHash,
format.boolean.$or(undefined),
],
responseFormatter: cfxFormat.epochReceipts,
Expand Down Expand Up @@ -592,8 +592,17 @@ class CFX extends RPCMethodFactory {
* @param {string} pivotBlockHash Hash of pivot block
* @returns {Promise<Array>} All receipts of one epoch
*/
async getEpochReceiptsByPivotBlockHash(pivotBlockHash) {
const result = await this.conflux.request({ method: 'cfx_getEpochReceipts', params: [`hash:${pivotBlockHash}`] });
async getEpochReceiptsByPivotBlockHash(pivotBlockHash, ...extra) {
const result = await this.conflux.request({
method: 'cfx_getEpochReceipts',
params: [
{
blockHash: pivotBlockHash,
requirePivot: true,
},
...extra,
],
});
return cfxFormat.epochReceipts(result);
}

Expand Down

0 comments on commit 475b435

Please sign in to comment.