getLogs API changes to return txHash, make contract arg optional. #81
@ -21,8 +21,13 @@ type GetStorageAt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LogResponse struct {
|
type LogResponse struct {
|
||||||
Topics []common.Hash `json:"topics"`
|
Topics []common.Hash `json:"topics"`
|
||||||
Data hexutil.Bytes `json:"data"`
|
Data hexutil.Bytes `json:"data"`
|
||||||
|
Transaction TransactionResp `json:"transaction"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TransactionResp struct {
|
||||||
|
Hash common.Hash `json:"hash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetLogs struct {
|
type GetLogs struct {
|
||||||
@ -44,6 +49,9 @@ func (c *Client) GetLogs(ctx context.Context, hash common.Hash, address common.A
|
|||||||
getLogs(blockHash: "%s", contract: "%s") {
|
getLogs(blockHash: "%s", contract: "%s") {
|
||||||
data
|
data
|
||||||
topics
|
topics
|
||||||
|
transaction {
|
||||||
|
hash
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`, hash.String(), address.String())
|
`, hash.String(), address.String())
|
||||||
|
@ -161,8 +161,9 @@ var _ = Describe("GraphQL", func() {
|
|||||||
|
|
||||||
expectedLogs := []graphql.LogResponse{
|
expectedLogs := []graphql.LogResponse{
|
||||||
{
|
{
|
||||||
Topics: test_helpers.MockLog1.Topics,
|
Topics: test_helpers.MockLog1.Topics,
|
||||||
Data: hexutil.Bytes(test_helpers.MockLog1.Data),
|
Data: hexutil.Bytes(test_helpers.MockLog1.Data),
|
||||||
|
Transaction: graphql.TransactionResp{Hash: test_helpers.MockTransactions[0].Hash()},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Expect(logs).To(Equal(expectedLogs))
|
Expect(logs).To(Equal(expectedLogs))
|
||||||
|
Loading…
Reference in New Issue
Block a user