diff options
author | johnliu-dexon <42129254+johnliu-dexon@users.noreply.github.com> | 2018-11-27 17:13:22 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | dc18d07437b43de381ee47d7f8191ed956869ef8 (patch) | |
tree | eb98bf23c11d0214eeff865a7e9b92a2e60e5262 /internal/jsre | |
parent | 342a17ca87dbf2b2e6f746204efe46df371a4540 (diff) | |
download | dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar.gz dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar.bz2 dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar.lz dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar.xz dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.tar.zst dexon-dc18d07437b43de381ee47d7f8191ed956869ef8.zip |
internal/ethapi: add getBlockReceiptsByHash (#56)
* dex: add getBlockReceiptsByHash
add rpc method for performance acceleration
* Update internal/ethapi/api.go
Co-Authored-By: johnliu-dexon <42129254+johnliu-dexon@users.noreply.github.com>
Diffstat (limited to 'internal/jsre')
-rw-r--r-- | internal/jsre/deps/web3.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/jsre/deps/web3.js b/internal/jsre/deps/web3.js index 7848393dd..333c32b48 100644 --- a/internal/jsre/deps/web3.js +++ b/internal/jsre/deps/web3.js @@ -3811,6 +3811,16 @@ var outputTransactionReceiptFormatter = function (receipt){ return receipt; }; +var outputTransactionReceiptsFormatter = function (receipts){ + if(utils.isArray(receipts)) { + receipts = receipts.map(function(receipt){ + return outputTransactionReceiptFormatter(receipt); + }); + } + + return receipts; +}; + /** * Formats the output of a block to its proper values * @@ -3957,6 +3967,7 @@ module.exports = { outputBigNumberFormatter: outputBigNumberFormatter, outputTransactionFormatter: outputTransactionFormatter, outputTransactionReceiptFormatter: outputTransactionReceiptFormatter, + outputTransactionReceiptsFormatter: outputTransactionReceiptsFormatter, outputBlockFormatter: outputBlockFormatter, outputLogFormatter: outputLogFormatter, outputPostFormatter: outputPostFormatter, @@ -5289,6 +5300,14 @@ var methods = function () { inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter] }); + var getBlockReceiptsByHash = new Method({ + name: 'getBlockReceiptsByHash', + call: 'eth_getBlockReceiptsByHash', + params: 1, + inputFormatter: [formatters.inputBlockNumberFormatter], + outputFormatter: formatters.outputTransactionReceiptsFormatter, + }); + var getBlock = new Method({ name: 'getBlock', call: blockCall, @@ -5435,6 +5454,7 @@ var methods = function () { getBalance, getStorageAt, getCode, + getBlockReceiptsByHash, getBlock, getUncle, getCompilers, |