aboutsummaryrefslogtreecommitdiffstats
path: root/eth/bind.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-12-17 22:39:55 +0800
committerFelix Lange <fjl@twurst.com>2016-12-20 21:41:58 +0800
commitcf71f5cd604f4d5c94d9e9b12b121a614d662dc7 (patch)
treea89491c26dc19fc39bb6d8273eeefa2778ff5ec2 /eth/bind.go
parentadab2e16bdf24c2eaf498722187fb36c04a5376b (diff)
downloadgo-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar.gz
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar.bz2
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar.lz
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar.xz
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.tar.zst
go-tangerine-cf71f5cd604f4d5c94d9e9b12b121a614d662dc7.zip
rpc: remove HexNumber, replace all uses with hexutil types
This change couldn't be automated because HexNumber was used for numbers of all sizes.
Diffstat (limited to 'eth/bind.go')
-rw-r--r--eth/bind.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/eth/bind.go b/eth/bind.go
index 747965d37..6f7aee4f7 100644
--- a/eth/bind.go
+++ b/eth/bind.go
@@ -21,6 +21,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/rlp"
@@ -86,13 +87,13 @@ func toCallArgs(msg ethereum.CallMsg) ethapi.CallArgs {
Data: common.ToHex(msg.Data),
}
if msg.Gas != nil {
- args.Gas = *rpc.NewHexNumber(msg.Gas)
+ args.Gas = hexutil.Big(*msg.Gas)
}
if msg.GasPrice != nil {
- args.GasPrice = *rpc.NewHexNumber(msg.GasPrice)
+ args.GasPrice = hexutil.Big(*msg.GasPrice)
}
if msg.Value != nil {
- args.Value = *rpc.NewHexNumber(msg.Value)
+ args.Value = hexutil.Big(*msg.Value)
}
return args
}
@@ -106,9 +107,12 @@ func toBlockNumber(num *big.Int) rpc.BlockNumber {
// PendingAccountNonce implements bind.ContractTransactor retrieving the current
// pending nonce associated with an account.
-func (b *ContractBackend) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) {
+func (b *ContractBackend) PendingNonceAt(ctx context.Context, account common.Address) (nonce uint64, err error) {
out, err := b.txapi.GetTransactionCount(ctx, account, rpc.PendingBlockNumber)
- return out.Uint64(), err
+ if out != nil {
+ nonce = uint64(*out)
+ }
+ return nonce, err
}
// SuggestGasPrice implements bind.ContractTransactor retrieving the currently
@@ -124,7 +128,7 @@ func (b *ContractBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error)
// should provide a basis for setting a reasonable default.
func (b *ContractBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (*big.Int, error) {
out, err := b.bcapi.EstimateGas(ctx, toCallArgs(msg))
- return out.BigInt(), err
+ return out.ToInt(), err
}
// SendTransaction implements bind.ContractTransactor injects the transaction