Documentation
¶
Index ¶
- func CreateForwardMemo(conn *Transfer, receiver string) (string, string, error)
- func CreateTransferMsg(port, channel, memo, sender, receiver string, token sdk.Coin, height uint64) sdk.Msg
- func CreateTransferWithMemo(conn *Transfer, sourceChainID string, coin sdk.Coin, blockHeight uint64, ...) (sdk.Msg, error)
- type Connection
- type ConnectionRegistry
- func (r *ConnectionRegistry) GetAllConnections() []*Connection
- func (r *ConnectionRegistry) GetConnection(sourceChainID, destChainID string) (*Connection, error)
- func (r *ConnectionRegistry) RegisterConnection(connection *Connection) error
- func (r *ConnectionRegistry) RegisterConnections(connections []*Connection) error
- type DefaultTransferProvider
- func (p *DefaultTransferProvider) CreateTransferMsg(ctx context.Context, request *TransferRequest) (sdk.Msg, error)
- func (p *DefaultTransferProvider) ProcessTransferMsg(ctx context.Context, request *TransferRequest, transferMsg sdk.Msg) (*TransferResult, error)
- func (p *DefaultTransferProvider) Transfer(ctx context.Context, request *TransferRequest) (*TransferResult, error)
- type Forward
- type ForwardInfo
- type ForwardMemo
- type ForwardNextInfo
- type MessageHandler
- type Transfer
- type TransferProvider
- type TransferRequest
- type TransferResult
- type WasmExecInfo
- type WasmExecMemo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateForwardMemo ¶
createForwardMemo creates a properly formatted memo for IBC transfers based on connection type
func CreateTransferMsg ¶
Types ¶
type Connection ¶
type Connection struct {
Transfer *Transfer
SourcePrefix string
DestPrefix string
ForwardPrefix string
}
Connection manages IBC connections between chains
type ConnectionRegistry ¶
type ConnectionRegistry struct {
// contains filtered or unexported fields
}
ConnectionRegistry manages IBC connections between chains
func DefaultConnectionRegistry ¶
func DefaultConnectionRegistry() *ConnectionRegistry
DefaultConnectionRegistry creates a new registry
func NewConnectionRegistry ¶
func NewConnectionRegistry() *ConnectionRegistry
NewConnectionRegistry creates a new registry
func (*ConnectionRegistry) GetAllConnections ¶
func (r *ConnectionRegistry) GetAllConnections() []*Connection
GetAllConnections returns all registered connections
func (*ConnectionRegistry) GetConnection ¶
func (r *ConnectionRegistry) GetConnection(sourceChainID, destChainID string) (*Connection, error)
GetConnection retrieves an IBC connection from the registry
func (*ConnectionRegistry) RegisterConnection ¶
func (r *ConnectionRegistry) RegisterConnection(connection *Connection) error
RegisterConnection adds a new IBC connection to the registry
func (*ConnectionRegistry) RegisterConnections ¶
func (r *ConnectionRegistry) RegisterConnections(connections []*Connection) error
RegisterConnections adds multiple IBC connections to the registry
type DefaultTransferProvider ¶
type DefaultTransferProvider struct {
// contains filtered or unexported fields
}
DefaultTransferProvider implements the TransferProvider interface
func (*DefaultTransferProvider) CreateTransferMsg ¶ added in v0.0.6
func (p *DefaultTransferProvider) CreateTransferMsg(ctx context.Context, request *TransferRequest) (sdk.Msg, error)
CreateTransferMsg prepares an IBC transfer message for the given request
func (*DefaultTransferProvider) ProcessTransferMsg ¶ added in v0.0.6
func (p *DefaultTransferProvider) ProcessTransferMsg(ctx context.Context, request *TransferRequest, transferMsg sdk.Msg) (*TransferResult, error)
ProcessTransferMsg sends the transfer message and waits for confirmation if needed
func (*DefaultTransferProvider) Transfer ¶
func (p *DefaultTransferProvider) Transfer(ctx context.Context, request *TransferRequest) (*TransferResult, error)
Transfer initiates an IBC transfer between chains
type Forward ¶
type Forward struct {
ChainID string // Chain ID of the middle chain
Receiver string // TODO: remove this and just use the receiver address
Port string
Channel string
}
Forward represents a forward between two chains
type ForwardInfo ¶
type ForwardMemo ¶
type ForwardMemo struct {
Forward ForwardInfo `json:"forward"`
}
func (ForwardMemo) MarshalJSON ¶
func (f ForwardMemo) MarshalJSON() ([]byte, error)
MarshalJSON for ForwardMemo
type ForwardNextInfo ¶
type ForwardNextInfo struct {
Wasm WasmExecInfo `json:"wasm"`
}
func (ForwardNextInfo) MarshalJSON ¶
func (f ForwardNextInfo) MarshalJSON() ([]byte, error)
MarshalJSON for ForwardNextInfo
type MessageHandler ¶
type MessageHandler func(chainID string, msgs []sdk.Msg, isFeeClient bool, wrapAuthz bool) (*cosmosclient.Response, error)
MessageHandler is a callback function to execute messages
type Transfer ¶
type Transfer struct {
SourceChainID string // Chain ID of the source chain (e.g., "osmosis-1")
DestChainID string // Chain ID of the destination chain (e.g., "neutron-1")
Channel string // Channel ID on the source chain
Port string // Port ID on the source chain (usually "transfer")
Forward *Forward // Forwarding address on the destination chain (optional)
}
IBCTransfer represents an IBC connection between two chains
type TransferProvider ¶
type TransferProvider interface {
// Transfer initiates an IBC transfer between chains.
// If the WaitForCompletion flag is set to true in the request, this method will block
// until the transfer is completed or the timeout is reached.
Transfer(ctx context.Context, request *TransferRequest) (*TransferResult, error)
// CreateTransferMsg creates an IBC transfer message
CreateTransferMsg(ctx context.Context, request *TransferRequest) (sdk.Msg, error)
// ProcessTransferMsg processes a transfer message
ProcessTransferMsg(ctx context.Context, request *TransferRequest, transferMsg sdk.Msg) (*TransferResult, error)
}
TransferProvider defines the interface for IBC transfers between chains
func NewTransferProvider ¶
func NewTransferProvider( logger *zap.Logger, clientRegistry *connection.ClientRegistry, baseChainID string, signerAccount string, msgHandler MessageHandler, ) TransferProvider
NewTransferProvider creates a new IBC transfer provider
type TransferRequest ¶
type TransferRequest struct {
SourceChain string // Source chain ID
DestinationChain string // Destination chain ID
Sender string // Sender address on source chain
Receiver string // Receiver address on destination chain
Amount sdk.Coin // Amount to transfer
RecvDenom string // Denom of the token to receive
Timeout uint64 // Timeout in blocks
Fee sdk.Coins // Optional fee for the transfer
CompletionTimeout time.Duration // Maximum time to wait for transfer completion
}
TransferRequest contains all parameters needed for an IBC transfer
type TransferResult ¶
type TransferResult struct {
SourceTxHash string // Hash of the source chain transaction
DestTxHash string // Hash of the destination chain transaction if available
Error error // Error if transfer failed
SourceResponse *cosmosclient.Response // Source chain response
DestResponse *cosmosclient.Response // Destination chain response (if available)
}
TransferResult contains the result of a transfer operation
type WasmExecInfo ¶
type WasmExecInfo struct {
Contract string `json:"contract"`
Msg json.RawMessage `json:"msg"`
}
Structs for IBC memo formatting - defined flat to avoid nesting
func (WasmExecInfo) MarshalJSON ¶
func (w WasmExecInfo) MarshalJSON() ([]byte, error)
MarshalJSON for WasmExecInfo
type WasmExecMemo ¶
type WasmExecMemo struct {
Wasm WasmExecInfo `json:"wasm"`
}
func (WasmExecMemo) MarshalJSON ¶
func (w WasmExecMemo) MarshalJSON() ([]byte, error)
MarshalJSON for WasmExecMemo