Skip to content
Closed
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.10.10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Extend clclient to support querying /v2/keys/workflow.
25 changes: 25 additions & 0 deletions framework/clclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,31 @@ func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *ht
return vrfKey, resp.RawResponse, err
}

// ReadWorkflowKeys reads all Workflow keys from the Chainlink node
func (c *ChainlinkClient) ReadWorkflowKeys() (*WorkflowKeys, *http.Response, error) {
workflowKeys := &WorkflowKeys{}
framework.L.Info().Str(NodeURL, c.Config.URL).Msg("Reading Workflow Keys")
resp, err := c.APIClient.R().
SetResult(workflowKeys).
Get("/v2/keys/workflow")
if err != nil {
return nil, nil, err
}
if len(workflowKeys.Data) == 0 {
framework.L.Warn().Str(NodeURL, c.Config.URL).Msg("Found no Workflow Keys on the node")
}
return workflowKeys, resp.RawResponse, err
}

// MustReadWorkflowKeys reads all Workflow keys from the Chainlink node
func (c *ChainlinkClient) MustReadWorkflowKeys() (*WorkflowKeys, *http.Response, error) {
workflowKeys, res, err := c.ReadWorkflowKeys()
if err != nil {
return nil, res, err
}
return workflowKeys, res, VerifyStatusCode(res.StatusCode, http.StatusOK)
}

// CreateCSAKey creates a CSA key on the Chainlink node, only 1 CSA key per node
func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) {
csaKey := &CSAKey{}
Expand Down
16 changes: 16 additions & 0 deletions framework/clclient/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,22 @@ type VRFKeys struct {
Data []VRFKey `json:"data"`
}

// WorkflowKeyAttributes is the model that represents the created workflow key attributes when read
type WorkflowKeyAttributes struct {
PublicKey string `json:"publicKey"`
}

// WorkflowKey is the model that represents the created workflow key when read
type WorkflowKey struct {
ID string
Attributes WorkflowKeyAttributes
}

// WorkflowKeys is the model that represents the created workflow keys when read
type WorkflowKeys struct {
Data []WorkflowKey `json:"data"`
}

// OCRKeys is the model that represents the created OCR keys when read
type OCRKeys struct {
Data []OCRKeyData `json:"data"`
Expand Down
Loading