Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions framework/.changeset/v0.13.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `ReplayLogPollerFromBlock` function to Chainlink Client
31 changes: 31 additions & 0 deletions framework/clclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"regexp"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -1431,3 +1432,33 @@ func ImportP2PKeys(cl []*ChainlinkClient, keys [][]byte) error {
}
return eg.Wait()
}

func ReplayLogPollerFromBlock(cl []*ChainlinkClient, fromBlock, evmChainID int64) error {
eg := &errgroup.Group{}
for _, c := range cl {
eg.Go(func() error {
_, _, err := c.ReplayLogPollerFromBlock(fromBlock, evmChainID)
return err
})
}
return eg.Wait()
}

func (c *ChainlinkClient) ReplayLogPollerFromBlock(fromBlock, evmChainID int64) (*ReplayResponse, *http.Response, error) {
specObj := &ReplayResponse{}
resp, err := c.APIClient.R().
SetResult(&specObj).
SetQueryParams(map[string]string{
"family": "evm",
"ChainID": strconv.FormatInt(evmChainID, 10),
}).
SetPathParams(map[string]string{
"fromBlock": strconv.FormatInt(fromBlock, 10),
}).
Post("/v2/replay_from_block/{fromBlock}")
if err != nil {
return nil, nil, err
}

return specObj, resp.RawResponse, err
}
14 changes: 14 additions & 0 deletions framework/clclient/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package clclient
import (
"bytes"
"fmt"
"math/big"
"text/template"
"time"

Expand Down Expand Up @@ -1419,3 +1420,16 @@ type ForwarderAttributes struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

type ReplayResponse struct {
Data ReplayResponseData `json:"data"`
}

type ReplayResponseData struct {
Attributes ReplayResponseAttributes `json:"attributes"`
}

type ReplayResponseAttributes struct {
Message string `json:"message"`
EVMChainID *big.Int `json:"evmChainID"`
}
Loading