From 475b4355c633d10dd320170316b24fe93db456d3 Mon Sep 17 00:00:00 2001 From: Pana Date: Tue, 5 Nov 2024 11:30:25 +0800 Subject: [PATCH] fix get epoch receipts optional params --- package.json | 2 +- src/rpc/cfx.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2763876..5f9c6b9 100644 --- a/package.json +++ b/package.json @@ -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": "pan.wang@confluxnetwork.org", "repository": "https://github.com/Conflux-Chain/js-conflux-sdk.git", diff --git a/src/rpc/cfx.js b/src/rpc/cfx.js index 4e71a65..e27930a 100644 --- a/src/rpc/cfx.js +++ b/src/rpc/cfx.js @@ -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, @@ -592,8 +592,17 @@ class CFX extends RPCMethodFactory { * @param {string} pivotBlockHash Hash of pivot block * @returns {Promise} 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); }