mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Replace ethgraphql.Address with common.Address
This commit is contained in:
parent
ba6f531027
commit
268a03b102
1 changed files with 6 additions and 23 deletions
|
|
@ -66,23 +66,6 @@ func (b *Bytes32) UnmarshalGraphQL(input interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
type Address struct {
|
|
||||||
common.Address
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h Address) ImplementsGraphQLType(name string) bool { return name == "Address" }
|
|
||||||
|
|
||||||
func (h *Address) UnmarshalGraphQL(input interface{}) error {
|
|
||||||
var err error
|
|
||||||
switch input := input.(type) {
|
|
||||||
case string:
|
|
||||||
*h = Address{common.HexToAddress(input)}
|
|
||||||
default:
|
|
||||||
err = fmt.Errorf("Unexpected type for Hash: %v", input)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
node *node.Node
|
node *node.Node
|
||||||
address common.Address
|
address common.Address
|
||||||
|
|
@ -99,8 +82,8 @@ func (a *Account) getState(ctx context.Context) (*state.StateDB, error) {
|
||||||
return state, err
|
return state, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Account) Address(ctx context.Context) (Address, error) {
|
func (a *Account) Address(ctx context.Context) (common.Address, error) {
|
||||||
return Address{a.address}, nil
|
return a.address, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Account) Balance(ctx context.Context) (hexutil.Big, error) {
|
func (a *Account) Balance(ctx context.Context) (hexutil.Big, error) {
|
||||||
|
|
@ -796,7 +779,7 @@ func (r *Resolver) Blocks(ctx context.Context, args BlocksArgs) ([]*Block, error
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccountArgs struct {
|
type AccountArgs struct {
|
||||||
Address Address
|
Address common.Address
|
||||||
BlockNumber *int32
|
BlockNumber *int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -808,7 +791,7 @@ func (r *Resolver) Account(ctx context.Context, args AccountArgs) *Account {
|
||||||
|
|
||||||
return &Account{
|
return &Account{
|
||||||
node: r.node,
|
node: r.node,
|
||||||
address: args.Address.Address,
|
address: args.Address,
|
||||||
blockNumber: blockNumber,
|
blockNumber: blockNumber,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -848,8 +831,8 @@ func (r *Resolver) SendRawTransaction(ctx context.Context, args struct{ Data hex
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallData struct {
|
type CallData struct {
|
||||||
From *Address
|
From *common.Address
|
||||||
To *Address
|
To *common.Address
|
||||||
Gas *hexutil.Uint64
|
Gas *hexutil.Uint64
|
||||||
GasPrice *hexutil.Big
|
GasPrice *hexutil.Big
|
||||||
Value *hexutil.Big
|
Value *hexutil.Big
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue