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 4e84a9d commit cc89fc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 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 @@ -593,7 +593,16 @@ class CFX extends RPCMethodFactory {
* @returns {Promise<Array>} All receipts of one epoch
*/
async getEpochReceiptsByPivotBlockHash(pivotBlockHash, ...extra) {
const result = await this.conflux.request({ method: 'cfx_getEpochReceipts', params: [`hash:${pivotBlockHash}`, ...extra] });
const result = await this.conflux.request({
method: 'cfx_getEpochReceipts',
params: [
{
blockHash: pivotBlockHash,
requirePivot: true,
},
...extra,
],
});
return cfxFormat.epochReceipts(result);
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,6 @@ format.epochNumber1898 = format({
requirePivot: format.boolean.$or(null),
});

format.epochNumberOrBlockHash = format.epochNumberOrUndefined.$or(format.epochNumber1898);
format.epochNumberOrBlockHash = format.epochNumber.$or(format.epochNumber1898);

module.exports = format;

0 comments on commit cc89fc7

Please sign in to comment.