bundle

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigTemplate

func DefaultConfigTemplate() []byte

DefaultConfigTemplate returns the shared gomplate template for generating config.yaml. This covers the standard watcher config used extensions.

func ResolveConfigTemplate

func ResolveConfigTemplate(b *Bundle) []byte

ResolveConfigTemplate returns the bundle's custom template if set, otherwise the shared default. Extensions with custom config fields can override the default by setting Bundle.ConfigTemplate.

Types

type Bundle

type Bundle struct {
	// Service identifies the extension (e.g. "dta", "dvp", "test_consumer").
	// An empty string means this is the generic/fallback event-listener.
	Service string

	// WasmBinary is the pre-compiled WASM binary, populated via //go:embed.
	WasmBinary []byte

	// ConfigTemplate is an optional gomplate template for generating config.yaml.
	// When nil, ResolveConfigTemplate falls back to the shared default template.
	// Set this only when an extension needs custom config fields beyond the
	// standard event-listener structure.
	ConfigTemplate []byte

	// Contracts lists the on-chain contracts this extension interacts with.
	// Nil for the generic bundle (user provides ABI at deploy time).
	Contracts []Contract

	// Events lists the subscribable events this extension supports.
	// Nil for the generic bundle (user provides events at deploy time).
	Events []Event
}

Bundle is the deployment artifact for an extension watcher workflow. Extensions produce these; the CREC backend consumes them.

func (*Bundle) FindTriggerContract

func (b *Bundle) FindTriggerContract(eventName string) *Contract

FindTriggerContract returns the Contract that emits the given event, or nil if not found.

func (*Bundle) HasEvent

func (b *Bundle) HasEvent(eventName string) bool

HasEvent reports whether the bundle contains the named event.

func (*Bundle) Validate

func (b *Bundle) Validate() error

Validate checks the bundle for configuration errors. It verifies that required fields are set, that contract and event names are unique, that ABI strings are valid JSON, and that every event's TriggerContract references an existing contract.

type Contract

type Contract struct {
	// Name is the logical contract identifier (e.g. "DTARequestManagement").
	Name string

	// ABI is the full ABI JSON string (or subset of event signatures) for the contract.
	ABI string
}

Contract describes a contract the watcher needs access to.

type Event

type Event struct {
	// Name is the Solidity event name (e.g. "SubscriptionRequested").
	Name string

	// TriggerContract is the Contract.Name that emits this event.
	TriggerContract string

	// Description is a human-readable summary of the event.
	Description string

	// ParamsSchema is the JSON Schema for decoded Solidity event parameters (chain_event.params).
	ParamsSchema json.RawMessage

	// DataSchema is the JSON Schema for enrichment/reference data, or nil if no enrichment.
	DataSchema json.RawMessage
}

Event describes a subscribable event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL