Documentation
¶
Index ¶
- Constants
- func EstimatedAttestationTime(instantFinality bool) time.Duration
- type AttestationStatus
- type Chain
- func ApplyRPCOverrides(chains []Chain, overrides map[string]string) []Chain
- func GetChainByDomain(domain uint32, testnet bool) (*Chain, error)
- func GetChainByName(name string, testnet bool) (*Chain, error)
- func GetChains(testnet bool) []Chain
- func GetMainnetChains() []Chain
- func GetTestnetChains() []Chain
- type DecodedMessage
- type FeeInfo
- type FeesResponse
- type IrisClient
- func (c *IrisClient) GetMessages(ctx context.Context, sourceDomain uint32, txHash string) (*MessagesResponse, error)
- func (c *IrisClient) GetTransferFees(ctx context.Context, sourceDomain, destDomain uint32) (*FeesResponse, error)
- func (c *IrisClient) PollForAttestation(ctx context.Context, sourceDomain uint32, txHash string, ...) (*Message, error)
- type Message
- type MessagesResponse
- type TransferOrchestrator
- type TransferParams
- type TransferStep
- type TransferType
- type TransferUpdate
Constants ¶
const ( Ethereum = "Ethereum" Avalanche = "Avalanche" OPMainnet = "OP Mainnet" Arbitrum = "Arbitrum" Base = "Base" PolygonPoS = "Polygon PoS" Unichain = "Unichain" Linea = "Linea" Codex = "Codex" Sonic = "Sonic" WorldChain = "World Chain" Sei = "Sei" XDC = "XDC" HyperEVM = "HyperEVM" Ink = "Ink" Plume = "Plume" )
Chain name constants for mainnet chains
const ( EthereumSepolia = "Ethereum Sepolia" AvalancheFuji = "Avalanche Fuji" OPSepolia = "OP Sepolia" ArbitrumSepolia = "Arbitrum Sepolia" BaseSepolia = "Base Sepolia" PolygonPoSAmoy = "Polygon PoS Amoy" LineaSepolia = "Linea Sepolia" ArcTestnet = "Arc Testnet" UnichainSepolia = "Unichain Sepolia" CodexTestnet = "Codex Testnet" SonicTestnet = "Sonic Testnet" WorldChainSepolia = "World Chain Sepolia" SeiTestnet = "Sei Testnet" XDCApothem = "XDC Apothem" HyperEVMTestnet = "HyperEVM Testnet" InkTestnet = "Ink Testnet" PlumeTestnet = "Plume Testnet" )
Chain name constants for testnet chains
Variables ¶
This section is empty.
Functions ¶
func EstimatedAttestationTime ¶
EstimatedAttestationTime returns the estimated time for attestation based on the chain
Types ¶
type AttestationStatus ¶
type AttestationStatus string
AttestationStatus represents the status of an attestation
const ( AttestationStatusPending AttestationStatus = "pending" AttestationStatusComplete AttestationStatus = "complete" )
type Chain ¶
type Chain struct {
Name string
ChainID *big.Int
Domain uint32
RPC string
TokenMessengerV2 string
MessageTransmitterV2 string
USDC string
Explorer string
IsTestnet bool
InstantFinality bool // Chains with instant finality don't need Fast Transfer distinction
}
Chain represents a blockchain configuration for CCTP V2
func ApplyRPCOverrides ¶
ApplyRPCOverrides applies RPC URL overrides from a map to the given chains. The map keys should be chain names, and the values should be the override RPC URLs. This allows integrating packages to customize RPC endpoints based on their configuration.
func GetChainByDomain ¶
GetChainByDomain returns a chain by its domain ID
func GetChainByName ¶
GetChainByName returns a chain by its name
func GetMainnetChains ¶
func GetMainnetChains() []Chain
GetMainnetChains returns all mainnet chain configurations
func GetTestnetChains ¶
func GetTestnetChains() []Chain
GetTestnetChains returns all testnet chain configurations
type DecodedMessage ¶
type DecodedMessage struct {
SourceDomain string `json:"sourceDomain"`
DestinationDomain string `json:"destinationDomain"`
Nonce string `json:"nonce"`
Sender string `json:"sender"`
Recipient string `json:"recipient"`
DestinationCaller string `json:"destinationCaller"`
MinFinalityThreshold string `json:"minFinalityThreshold"`
FinalityThresholdExecuted string `json:"finalityThresholdExecuted"`
MessageBody string `json:"messageBody"`
}
DecodedMessage represents the decoded CCTP message fields
type FeeInfo ¶
type FeeInfo struct {
FinalityThreshold uint32 `json:"finalityThreshold"`
MinimumFee uint32 `json:"minimumFee"` // in basis points (bps)
}
FeeInfo represents fee information for a specific finality threshold
type FeesResponse ¶
type FeesResponse struct {
Data []FeeInfo `json:"data"`
}
FeesResponse represents the response from /v2/burn/USDC/fees
type IrisClient ¶
type IrisClient struct {
// contains filtered or unexported fields
}
IrisClient is a client for Circle's Iris attestation service
func NewIrisClient ¶
func NewIrisClient(baseURL string) *IrisClient
NewIrisClient creates a new Iris API client
func (*IrisClient) GetMessages ¶
func (c *IrisClient) GetMessages(ctx context.Context, sourceDomain uint32, txHash string) (*MessagesResponse, error)
GetMessages fetches messages and attestations for a transaction
func (*IrisClient) GetTransferFees ¶
func (c *IrisClient) GetTransferFees(ctx context.Context, sourceDomain, destDomain uint32) (*FeesResponse, error)
GetTransferFees fetches the fee information for a transfer between two domains
type Message ¶
type Message struct {
Message string `json:"message"`
EventNonce string `json:"eventNonce"`
Attestation string `json:"attestation"`
DecodedMessage *DecodedMessage `json:"decodedMessage"`
CctpVersion int `json:"cctpVersion"`
Status AttestationStatus `json:"status"`
DelayReason string `json:"delayReason"`
}
Message represents a CCTP message
type MessagesResponse ¶
type MessagesResponse struct {
Messages []Message `json:"messages"`
}
MessagesResponse represents the response from /v2/messages
type TransferOrchestrator ¶
type TransferOrchestrator struct {
// contains filtered or unexported fields
}
TransferOrchestrator orchestrates the entire transfer workflow
func NewTransferOrchestrator ¶
func NewTransferOrchestrator( w *wallet.Wallet, params *TransferParams, irisBaseURL string, ) (*TransferOrchestrator, error)
NewTransferOrchestrator creates a new transfer orchestrator
func (*TransferOrchestrator) Close ¶
func (t *TransferOrchestrator) Close()
Close closes the RPC clients
func (*TransferOrchestrator) Execute ¶
func (t *TransferOrchestrator) Execute(ctx context.Context, updates chan<- TransferUpdate) error
Execute executes the complete transfer workflow
type TransferParams ¶
type TransferParams struct {
SourceChain *Chain
DestChain *Chain
Amount *big.Int
RecipientAddress common.Address
Testnet bool
TransferType TransferType // Fast, Standard, or Auto (default: Auto)
CachedBalance *big.Int // Optional: pre-fetched balance to skip redundant check
}
TransferParams holds parameters for a transfer
type TransferStep ¶
type TransferStep string
TransferStep represents a step in the transfer process
const ( StepCheckBalance TransferStep = "checking_balance" StepCheckAllowance TransferStep = "checking_allowance" StepApproving TransferStep = "approving" StepApprovingWait TransferStep = "approving_wait" StepBurning TransferStep = "burning" StepBurningWait TransferStep = "burning_wait" StepPollingAttestation TransferStep = "polling_attestation" StepMinting TransferStep = "minting" StepMintingWait TransferStep = "minting_wait" StepComplete TransferStep = "complete" StepError TransferStep = "error" )
type TransferType ¶
type TransferType string
TransferType represents the type of CCTP transfer
const ( TransferTypeFast TransferType = "fast" // Fast Transfer (~8-20 seconds, with fee) TransferTypeStandard TransferType = "standard" // Standard Transfer (~13-19 minutes, no fee) TransferTypeAuto TransferType = "auto" // Auto-select based on chain capabilities )
type TransferUpdate ¶
type TransferUpdate struct {
Step TransferStep
Message string
TxHash string
Error error
SourceChain *Chain
DestChain *Chain
}
TransferUpdate represents an update in the transfer process