Skip to content

Commit

Permalink
graphql: convert storage keys to non-nullable list
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Sep 28, 2021
1 parent a60e742 commit 7752cc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions graphql/graphql.go
Expand Up @@ -158,14 +158,14 @@ func (l *Log) Data(ctx context.Context) hexutil.Bytes {
// AccessTuple represents EIP-2930
type AccessTuple struct {
address common.Address
storageKeys *[]common.Hash
storageKeys []common.Hash
}

func (at *AccessTuple) Address(ctx context.Context) common.Address {
return at.address
}

func (at *AccessTuple) StorageKeys(ctx context.Context) *[]common.Hash {
func (at *AccessTuple) StorageKeys(ctx context.Context) []common.Hash {
return at.storageKeys
}

Expand Down Expand Up @@ -440,13 +440,9 @@ func (t *Transaction) AccessList(ctx context.Context) (*[]*AccessTuple, error) {
accessList := tx.AccessList()
ret := make([]*AccessTuple, 0, len(accessList))
for _, al := range accessList {
var sKeys []common.Hash
for _, h := range al.StorageKeys {
sKeys = append(sKeys, h)
}
ret = append(ret, &AccessTuple{
address: al.Address,
storageKeys: &sKeys,
storageKeys: al.StorageKeys,
})
}
return &ret, nil
Expand Down
2 changes: 1 addition & 1 deletion graphql/schema.go
Expand Up @@ -72,7 +72,7 @@ const schema string = `
#EIP-2718
type AccessTuple{
address: Address!
storageKeys : [Bytes32!]
storageKeys : [Bytes32!]!
}
# Transaction is an Ethereum transaction.
Expand Down

0 comments on commit 7752cc3

Please sign in to comment.