relayer

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainCanton   = "canton"
	ChainEthereum = "ethereum"
)

Chain identifiers used as canonical keys throughout the relayer.

View Source
const OffsetBegin = "BEGIN"

OffsetBegin is the special Canton ledger offset meaning "start from the beginning".

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainState

type ChainState struct {
	ChainID   string
	LastBlock uint64 // numeric block/offset; 0 for Canton
	Offset    string // string representation of the offset (block hash or ledger offset)
	UpdatedAt time.Time
}

ChainState tracks the last processed offset for a chain.

type Config

type Config struct {
	MaxTransferAmount  string        `yaml:"max_transfer_amount" validate:"required"`
	MinTransferAmount  string        `yaml:"min_transfer_amount" validate:"required"`
	RateLimitPerHour   int           `yaml:"rate_limit_per_hour" validate:"required,gt=0"`
	MaxRetries         int           `yaml:"max_retries" default:"5"`
	RetryDelay         time.Duration `yaml:"retry_delay" default:"60s"`
	ProcessingInterval time.Duration `yaml:"processing_interval" default:"30s"`

	// Canton stream settings
	CantonChainID    string `yaml:"canton_chain_id" validate:"required"`
	CantonStartBlock uint64 `yaml:"canton_start_block" default:"0"`
	CantonLookback   int64  `yaml:"canton_lookback_blocks" default:"1000"`

	// ETH stream settings
	EthChainID        string `yaml:"eth_chain_id" validate:"required"`
	EthStartBlock     uint64 `yaml:"eth_start_block" default:"0"`
	EthLookbackBlocks int64  `yaml:"eth_lookback_blocks" default:"1000"`
	EthTokenContract  string `yaml:"eth_token_contract" validate:"required"`
}

Config contains bridge operation settings

type Event

type Event struct {
	ID               string
	TransactionID    string
	SourceChain      string
	DestinationChain string
	SourceTxHash     string
	// SourceContractID carries the source-chain contract ID when applicable (e.g.
	// the Canton WithdrawalEvent ContractID used to call CompleteWithdrawal).
	SourceContractID  string
	TokenAddress      string
	Amount            string
	Sender            string
	Recipient         string
	Nonce             int64
	SourceBlockNumber uint64
}

Event represents a generic bridge event flowing from source to destination.

type Transfer

type Transfer struct {
	ID                string            `json:"id"`
	Direction         TransferDirection `json:"direction"`
	Status            TransferStatus    `json:"status"`
	SourceChain       string            `json:"source_chain"`
	DestinationChain  string            `json:"destination_chain"`
	SourceTxHash      string            `json:"source_tx_hash"`
	DestinationTxHash *string           `json:"destination_tx_hash"`
	TokenAddress      string            `json:"token_address"`
	Amount            string            `json:"amount"`
	Sender            string            `json:"sender"`
	Recipient         string            `json:"recipient"`
	Nonce             int64             `json:"nonce"`
	SourceBlockNumber uint64            `json:"source_block_number"`
	RetryCount        int               `json:"retry_count"`
	CreatedAt         time.Time         `json:"created_at"`
	UpdatedAt         time.Time         `json:"updated_at"`
	CompletedAt       *time.Time        `json:"completed_at"`
	ErrorMessage      *string           `json:"error_message"`
}

Transfer represents a cross-chain token transfer.

type TransferDirection

type TransferDirection string

TransferDirection indicates the direction of the transfer.

const (
	DirectionCantonToEthereum TransferDirection = "canton_to_ethereum"
	DirectionEthereumToCanton TransferDirection = "ethereum_to_canton"
)

type TransferStatus

type TransferStatus string

TransferStatus represents the current state of a cross-chain transfer.

const (
	TransferStatusPending   TransferStatus = "pending"
	TransferStatusCompleted TransferStatus = "completed"
	TransferStatusFailed    TransferStatus = "failed"
)

Directories

Path Synopsis
Package service provides the relayer HTTP service layer.
Package service provides the relayer HTTP service layer.

Jump to

Keyboard shortcuts

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