2 function calls

This commit is contained in:
Arpit Temani 2021-08-11 14:00:52 +05:30
parent 218f96c1f5
commit 9d085ef65e
3 changed files with 23 additions and 8 deletions

View file

@ -70,8 +70,7 @@ func (ec *Client) ChainID(ctx context.Context) (*big.Int, error) {
return (*big.Int)(&result), err
}
// TransactionInBlock returns a single transaction at index in the given block.
func (ec *Client) TransactionRecipientsInBlock(ctx context.Context, number *big.Int) ([]*types.Receipt, error) {
func (ec *Client) TransactionReceiptsInBlockByBlockNumber(ctx context.Context, number *big.Int) ([]*types.Receipt, error) {
var rs []*types.Receipt
err := ec.c.CallContext(ctx, &rs, "eth_getTransactionReceiptsByBlockNumber", toBlockNumArg(number))
if err != nil {
@ -80,6 +79,15 @@ func (ec *Client) TransactionRecipientsInBlock(ctx context.Context, number *big.
return rs, err
}
func (ec *Client) TransactionReceiptsInBlockByBlockHash(ctx context.Context, hash common.Hash) ([]*types.Receipt, error) {
var rs []*types.Receipt
err := ec.c.CallContext(ctx, &rs, "eth_getTransactionReceiptsByBlockHash", hash)
if err != nil {
return nil, err
}
return rs, err
}
// BlockByHash returns the given full block.
//
// Note that loading full blocks requires two requests. Use HeaderByHash

View file

@ -5214,6 +5214,10 @@ var transactionFromBlockCall = function (args) {
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';
};
var transactionReceiptsFromBlockCall = function (args) {
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionReceiptsByBlockHash' : 'eth_getTransactionReceiptsByBlockNumber';
};
var uncleCall = function (args) {
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';
};
@ -5393,9 +5397,9 @@ var methods = function () {
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
});
var getTransactionReceiptsByBlockNumber = new Method({
name: 'getTransactionReceiptsByBlockNumber',
call: 'eth_getTransactionReceiptsByBlockNumber',
var transactionReceiptsByBlock = new Method({
name: 'getTransactionReceiptsByBlock',
call: transactionReceiptsFromBlockCall,
params: 1,
outputFormatter: formatters.outputTransactionReceiptFormatter
});
@ -5461,7 +5465,8 @@ var methods = function () {
compileLLL,
compileSerpent,
submitWork,
getWork
getWork,
transactionReceiptsByBlock
];
};

View file

@ -495,8 +495,10 @@ web3._extend({
property: 'eth',
methods: [
new web3._extend.Method({
name: 'getTransactionReceiptsByBlockNumber',
call: 'eth_getTransactionReceiptsByBlockNumber',
name: 'getTransactionReceiptsByBlock',
call: function(args) {
return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionReceiptsByBlockHash' : 'eth_getTransactionReceiptsByBlockNumber';
},
params: 1,
}),
new web3._extend.Method({