From 675a9441784b14ee4bd996832c4431adc291c5af Mon Sep 17 00:00:00 2001 From: Jhih-Ming Huang Date: Wed, 10 Apr 2019 22:29:35 +0800 Subject: fixup! Change import go github.com/dexon-foundation/dexon --- ethclient/ethclient.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'ethclient/ethclient.go') diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index c8a8e5eb5..ec2680188 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -90,7 +90,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface if err != nil { return nil, err } else if len(raw) == 0 { - return nil, ethereum.NotFound + return nil, dexon.NotFound } // Decode header and transactions. var head *types.Header @@ -154,7 +154,7 @@ func (ec *Client) HeaderByHash(ctx context.Context, hash common.Hash) (*types.He var head *types.Header err := ec.c.CallContext(ctx, &head, "eth_getBlockByHash", hash, false) if err == nil && head == nil { - err = ethereum.NotFound + err = dexon.NotFound } return head, err } @@ -165,7 +165,7 @@ func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.H var head *types.Header err := ec.c.CallContext(ctx, &head, "eth_getBlockByNumber", toBlockNumArg(number), false) if err == nil && head == nil { - err = ethereum.NotFound + err = dexon.NotFound } return head, err } @@ -195,7 +195,7 @@ func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx * if err != nil { return nil, false, err } else if json == nil { - return nil, false, ethereum.NotFound + return nil, false, dexon.NotFound } else if _, r, _ := json.tx.RawSignatureValues(); r == nil { return nil, false, fmt.Errorf("server returned transaction without signature") } @@ -243,7 +243,7 @@ func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, err := ec.c.CallContext(ctx, &json, "eth_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index)) if err == nil { if json == nil { - return nil, ethereum.NotFound + return nil, dexon.NotFound } else if _, r, _ := json.tx.RawSignatureValues(); r == nil { return nil, fmt.Errorf("server returned transaction without signature") } @@ -261,7 +261,7 @@ func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (* err := ec.c.CallContext(ctx, &r, "eth_getTransactionReceipt", txHash) if err == nil { if r == nil { - return nil, ethereum.NotFound + return nil, dexon.NotFound } } return r, err @@ -284,7 +284,7 @@ type rpcProgress struct { // SyncProgress retrieves the current progress of the sync algorithm. If there's // no sync currently running, it returns nil. -func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error) { +func (ec *Client) SyncProgress(ctx context.Context) (*dexon.SyncProgress, error) { var raw json.RawMessage if err := ec.c.CallContext(ctx, &raw, "eth_syncing"); err != nil { return nil, err @@ -298,7 +298,7 @@ func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, err if err := json.Unmarshal(raw, &progress); err != nil { return nil, err } - return ðereum.SyncProgress{ + return &dexon.SyncProgress{ StartingBlock: uint64(progress.StartingBlock), CurrentBlock: uint64(progress.CurrentBlock), HighestBlock: uint64(progress.HighestBlock), @@ -309,7 +309,7 @@ func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, err // SubscribeNewHead subscribes to notifications about the current blockchain head // on the given channel. -func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) { +func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (dexon.Subscription, error) { return ec.c.EthSubscribe(ctx, ch, "newHeads") } @@ -363,7 +363,7 @@ func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumb // Filters // FilterLogs executes a filter query. -func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { +func (ec *Client) FilterLogs(ctx context.Context, q dexon.FilterQuery) ([]types.Log, error) { var result []types.Log arg, err := toFilterArg(q) if err != nil { @@ -374,7 +374,7 @@ func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]typ } // SubscribeFilterLogs subscribes to the results of a streaming filter query. -func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) { +func (ec *Client) SubscribeFilterLogs(ctx context.Context, q dexon.FilterQuery, ch chan<- types.Log) (dexon.Subscription, error) { arg, err := toFilterArg(q) if err != nil { return nil, err @@ -382,7 +382,7 @@ func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuer return ec.c.EthSubscribe(ctx, ch, "logs", arg) } -func toFilterArg(q ethereum.FilterQuery) (interface{}, error) { +func toFilterArg(q dexon.FilterQuery) (interface{}, error) { arg := map[string]interface{}{ "address": q.Addresses, "topics": q.Topics, @@ -451,7 +451,7 @@ func (ec *Client) PendingTransactionCount(ctx context.Context) (uint, error) { // blockNumber selects the block height at which the call runs. It can be nil, in which // case the code is taken from the latest known block. Note that state from very old // blocks might not be available. -func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) { +func (ec *Client) CallContract(ctx context.Context, msg dexon.CallMsg, blockNumber *big.Int) ([]byte, error) { var hex hexutil.Bytes err := ec.c.CallContext(ctx, &hex, "eth_call", toCallArg(msg), toBlockNumArg(blockNumber)) if err != nil { @@ -462,7 +462,7 @@ func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockN // PendingCallContract executes a message call transaction using the EVM. // The state seen by the contract call is the pending state. -func (ec *Client) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error) { +func (ec *Client) PendingCallContract(ctx context.Context, msg dexon.CallMsg) ([]byte, error) { var hex hexutil.Bytes err := ec.c.CallContext(ctx, &hex, "eth_call", toCallArg(msg), "pending") if err != nil { @@ -485,7 +485,7 @@ func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error) { // the current pending state of the backend blockchain. There is no guarantee that this is // the true gas limit requirement as other transactions may be added or removed by miners, // but it should provide a basis for setting a reasonable default. -func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error) { +func (ec *Client) EstimateGas(ctx context.Context, msg dexon.CallMsg) (uint64, error) { var hex hexutil.Uint64 err := ec.c.CallContext(ctx, &hex, "eth_estimateGas", toCallArg(msg)) if err != nil { @@ -522,7 +522,7 @@ func (ec *Client) SendTransactions(ctx context.Context, txs []*types.Transaction return ec.c.CallContext(ctx, nil, "eth_sendRawTransactions", txData) } -func toCallArg(msg ethereum.CallMsg) interface{} { +func toCallArg(msg dexon.CallMsg) interface{} { arg := map[string]interface{}{ "from": msg.From, "to": msg.To, -- cgit