internal/ethapi: merge CallArgs and SendTxArgs (#22718)
There are two transaction parameter structures defined in the codebase, although for different purposes. But most of the parameters are shared. So it's nice to reduce the code duplication by merging them together. Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
@ -862,7 +862,7 @@ func (c *CallResult) Status() Long {
|
||||
}
|
||||
|
||||
func (b *Block) Call(ctx context.Context, args struct {
|
||||
Data ethapi.CallArgs
|
||||
Data ethapi.TransactionArgs
|
||||
}) (*CallResult, error) {
|
||||
if b.numberOrHash == nil {
|
||||
_, err := b.resolve(ctx)
|
||||
@ -887,7 +887,7 @@ func (b *Block) Call(ctx context.Context, args struct {
|
||||
}
|
||||
|
||||
func (b *Block) EstimateGas(ctx context.Context, args struct {
|
||||
Data ethapi.CallArgs
|
||||
Data ethapi.TransactionArgs
|
||||
}) (Long, error) {
|
||||
if b.numberOrHash == nil {
|
||||
_, err := b.resolveHeader(ctx)
|
||||
@ -937,7 +937,7 @@ func (p *Pending) Account(ctx context.Context, args struct {
|
||||
}
|
||||
|
||||
func (p *Pending) Call(ctx context.Context, args struct {
|
||||
Data ethapi.CallArgs
|
||||
Data ethapi.TransactionArgs
|
||||
}) (*CallResult, error) {
|
||||
pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
||||
result, err := ethapi.DoCall(ctx, p.backend, args.Data, pendingBlockNr, nil, vm.Config{}, 5*time.Second, p.backend.RPCGasCap())
|
||||
@ -957,7 +957,7 @@ func (p *Pending) Call(ctx context.Context, args struct {
|
||||
}
|
||||
|
||||
func (p *Pending) EstimateGas(ctx context.Context, args struct {
|
||||
Data ethapi.CallArgs
|
||||
Data ethapi.TransactionArgs
|
||||
}) (Long, error) {
|
||||
pendingBlockNr := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
||||
gas, err := ethapi.DoEstimateGas(ctx, p.backend, args.Data, pendingBlockNr, p.backend.RPCGasCap())
|
||||
|
Reference in New Issue
Block a user