GQL API for getStorageAt and getLogs #69

Closed
ashwinphatak wants to merge 5 commits from ashwinp-gql-get-storage into master
Showing only changes of commit ed053f536a - Show all commits

View File

@ -4,18 +4,12 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
gqlclient "github.com/machinebox/graphql" gqlclient "github.com/machinebox/graphql"
) )
type Client struct {
client *gqlclient.Client
timeout time.Duration
}
type StorageResponse struct { type StorageResponse struct {
Cid string `json:"cid"` Cid string `json:"cid"`
IpldBlock hexutil.Bytes `json:"ipldBlock"` IpldBlock hexutil.Bytes `json:"ipldBlock"`
@ -35,6 +29,10 @@ type GetLogs struct {
Responses []LogResponse `json:"getLogs"` Responses []LogResponse `json:"getLogs"`
} }
type Client struct {
client *gqlclient.Client
}
func NewClient(endpoint string) *Client { func NewClient(endpoint string) *Client {
client := gqlclient.NewClient(endpoint) client := gqlclient.NewClient(endpoint)
return &Client{client: client} return &Client{client: client}