Update getLogs GQL API to accept multiple addresses
This commit is contained in:
parent
70842edce7
commit
fd5f201bbd
@ -1037,12 +1037,15 @@ func (r *Resolver) GetStorageAt(ctx context.Context, args struct {
|
|||||||
|
|
||||||
func (r *Resolver) GetLogs(ctx context.Context, args struct {
|
func (r *Resolver) GetLogs(ctx context.Context, args struct {
|
||||||
BlockHash common.Hash
|
BlockHash common.Hash
|
||||||
Contract *common.Address
|
Addresses *[]common.Address
|
||||||
}) (*[]*Log, error) {
|
}) (*[]*Log, error) {
|
||||||
|
|
||||||
var filter eth.ReceiptFilter
|
var filter eth.ReceiptFilter
|
||||||
if args.Contract != nil {
|
|
||||||
filter.LogAddresses = []string{args.Contract.String()}
|
if args.Addresses != nil {
|
||||||
|
filter.LogAddresses = make([]string, len(*args.Addresses))
|
||||||
|
for i, address := range *args.Addresses {
|
||||||
|
filter.LogAddresses[i] = address.String()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin tx
|
// Begin tx
|
||||||
|
@ -343,7 +343,7 @@ const schema string = `
|
|||||||
getStorageAt(blockHash: Bytes32!, contract: Address!, slot: Bytes32!): StorageResult
|
getStorageAt(blockHash: Bytes32!, contract: Address!, slot: Bytes32!): StorageResult
|
||||||
|
|
||||||
# Get contract logs by block hash and contract address.
|
# Get contract logs by block hash and contract address.
|
||||||
getLogs(blockHash: Bytes32!, contract: Address): [Log!]
|
getLogs(blockHash: Bytes32!, addresses: [Address!]): [Log!]
|
||||||
|
|
||||||
# PostGraphile alternative to get headers with transactions using block number or block hash.
|
# PostGraphile alternative to get headers with transactions using block number or block hash.
|
||||||
allEthHeaderCids(condition: EthHeaderCidCondition): EthHeaderCidsConnection
|
allEthHeaderCids(condition: EthHeaderCidCondition): EthHeaderCidsConnection
|
||||||
|
Loading…
Reference in New Issue
Block a user