write_target

package
v0.0.0-...-29137c7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

NOTE: file is based on the generic write target capability, but we're slightly modifying it until the two implementations can be merged in particular, we need to invert the calling flow for Aptos so receiver is the entrypoint

Index

Constants

View Source
const (
	CapabilityName = "write"

	// Input keys
	KeySignedReport = "signed_report"

	// Static contract info
	ContractName                            = "forwarder"
	ContractMethodName_report               = "report"
	ContractMethodName_getTransmissionState = "getTransmissionState"
	ContractMethodName_getTransmitter       = "getTransmitter"
)

required field of target's config in the workflow spec

Variables

View Source
var DefaultConfigSet = Config{
	ConfirmerPollPeriod: *config.MustNewDuration(1 * time.Second),
	ConfirmerTimeout:    *config.MustNewDuration(10 * time.Second),
}

DefaultConfigSet is the default configuration for the write target component.

Functions

func NewMessageBuilder

func NewMessageBuilder(chainInfo ChainInfo, capInfo capabilities.CapabilityInfo) *messageBuilder

NewMessageBuilder creates a new message builder

func NewWriteTarget

func NewWriteTarget(opts WriteTargetOpts) capabilities.TargetCapability

TODO: opts.Config input is not validated for sanity

func NewWriteTargetID

func NewWriteTargetID(chainFamilyName, networkName, chainID, version string) (string, error)

NewWriteTargetID returns the capability ID for the write target

Types

type ChainInfo

type ChainInfo struct {
	ChainFamilyName string
	ChainID         string
	NetworkName     string
	NetworkNameFull string
}

ChainInfo contains the chain information (used as execution context)

type Config

type Config struct {
	ConfirmerPollPeriod config.Duration
	ConfirmerTimeout    config.Duration
}

Config defines the write target component configuration.

type ReqConfig

type ReqConfig struct {
	Address string
}

Capability-specific configuration

type TransmissionState

type TransmissionState struct {
	Transmitter string
	Success     bool
}

type WriteTargetOpts

type WriteTargetOpts struct {
	ID string

	// toml: [<CHAIN>.WriteTargetCap]
	Config Config
	// ChainInfo contains the chain information (used as execution context)
	// TODO: simplify by passing via ChainService.GetChainStatus fn
	ChainInfo ChainInfo

	Logger   logger.Logger
	Beholder *monitor.BeholderClient

	ChainService     commontypes.ChainService
	ContractReader   commontypes.ContractReader
	ChainWriter      commontypes.ContractWriter
	ConfigValidateFn func(config ReqConfig) error

	NodeAddress      string
	ForwarderAddress string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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