Skip to content

Commit

Permalink
Log Event Trigger Capability Development: Part 2 (#14609)
Browse files Browse the repository at this point in the history
* Receive log as values.Value to preserve type info

* Test cursor usage of LogEventTrigger capability

* Added JSON schema for log event trigger capability

* Remove old override and generate log event capability

* Update JSON schema constraints

* Use types from generated pkg to reduce code duplication

* Generate SDK helper after JSON schema change

---------

Co-authored-by: Ryan Tinianov <[email protected]>
  • Loading branch information
kidambisrinivas and nolag authored Oct 2, 2024
1 parent eec0ff9 commit e724e5f
Show file tree
Hide file tree
Showing 12 changed files with 553 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/smartcontractkit/chainlink/v2/core/capabilities/triggers/logevent/logeventcap/log-event-trigger",
"$defs": {
"head": {
"type": "object",
"properties": {
"Height": {
"type": "string",
"minLength": 1
},
"Hash": {
"type": "string",
"minLength": 1
},
"Timestamp": {
"type": "integer",
"minimum": 0
}
}
},
"config": {
"type": "object",
"properties": {
"contractName": {
"type": "string",
"minLength": 1
},
"contractAddress": {
"type": "string",
"minLength": 1
},
"contractEventName": {
"type": "string",
"minLength": 1
},
"contractReaderConfig": {
"type": "object",
"properties": {
"contracts": {
"type": "object"
}
},
"required": ["contracts"]
}
},
"required": ["contractName", "contractAddress", "contractEventName", "contractReaderConfig"]
},
"output": {
"type": "object",
"properties": {
"Cursor": {
"type": "string",
"minLength": 1
},
"Head": {
"$ref": "#/$defs/head"
},
"Data": {
"type": "object"
}
},
"required": ["Cursor", "Head", "Data"]
}
},
"type": "object",
"properties": {
"Config": {
"$ref": "#/$defs/config"
},
"Outputs": {
"$ref": "#/$defs/output"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions core/capabilities/triggers/logevent/logeventcap/gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package logeventcap

import _ "github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli/cmd" // Required so that the tool is available to be run in go generate below.

//go:generate go run github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli/cmd/generate-types --dir $GOFILE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e724e5f

Please sign in to comment.