Documentation
¶
Index ¶
- Variables
- func BuildICAPacketData(msgs []*codectypes.Any) (icatypes.InterchainAccountPacketData, error)
- func BuildMsgSendTx(owner, connectionID string, relativeTimeout uint64, ...) (*controllertypes.MsgSendTx, error)
- func DecodePacketAcknowledgementJSON(ackJSON []byte) ([]byte, error)
- func ExtractRequestActionIDsFromAck(ackBytes []byte) ([]string, error)
- func ExtractRequestActionIDsFromTxMsgData(msgData *sdk.TxMsgData) []string
- func PackApproveAny(msg *actiontypes.MsgApproveAction) (*codectypes.Any, error)
- func PackApproveForICA(msg *actiontypes.MsgApproveAction) ([]byte, error)
- func PackRequestAny(msg *actiontypes.MsgRequestAction) (*codectypes.Any, error)
- func PackRequestForICA(msg *actiontypes.MsgRequestAction) ([]byte, error)
- func ParseTxHashJSON(txJSON []byte) (string, error)
- type Config
- type Controller
- func (c *Controller) AppPubkey() []byte
- func (c *Controller) Close() error
- func (c *Controller) EnsureICAAddress(ctx context.Context) (string, error)
- func (c *Controller) ICAAddress(ctx context.Context) (string, error)
- func (c *Controller) OwnerAddress() string
- func (c *Controller) SendApproveAction(ctx context.Context, msg *actiontypes.MsgApproveAction) (string, error)
- func (c *Controller) SendRequestAction(ctx context.Context, msg *actiontypes.MsgRequestAction) (*sdktypes.ActionResult, error)
- type PacketInfo
Constants ¶
This section is empty.
Variables ¶
var ErrAckNotFound = errors.New("acknowledgement event not found")
ErrAckNotFound is returned when no acknowledgement event is present for the packet.
var ErrICAAddressNotFound = errors.New("ica address not found")
ErrICAAddressNotFound is returned when no ICA address is registered yet.
var ErrPacketInfoNotFound = errors.New("send_packet event not found")
ErrPacketInfoNotFound is returned when no send_packet event is found in a tx.
Functions ¶
func BuildICAPacketData ¶
func BuildICAPacketData(msgs []*codectypes.Any) (icatypes.InterchainAccountPacketData, error)
BuildICAPacketData builds InterchainAccountPacketData for EXECUTE_TX with provided Any messages.
func BuildMsgSendTx ¶
func BuildMsgSendTx(owner, connectionID string, relativeTimeout uint64, packet icatypes.InterchainAccountPacketData) (*controllertypes.MsgSendTx, error)
BuildMsgSendTx constructs the controller-side MsgSendTx using provided owner/connection and packet data.
func DecodePacketAcknowledgementJSON ¶
DecodePacketAcknowledgementJSON extracts and base64-decodes the acknowledgement field.
func ExtractRequestActionIDsFromAck ¶
ExtractRequestActionIDsFromAck decodes an IBC acknowledgement containing a TxMsgData and returns any MsgRequestActionResponse action IDs found in the message responses.
func ExtractRequestActionIDsFromTxMsgData ¶
ExtractRequestActionIDsFromTxMsgData scans TxMsgData for MsgRequestActionResponse entries and returns the corresponding action IDs.
func PackApproveAny ¶
func PackApproveAny(msg *actiontypes.MsgApproveAction) (*codectypes.Any, error)
PackApproveAny wraps PackApproveForICA and returns the decoded Any.
func PackApproveForICA ¶
func PackApproveForICA(msg *actiontypes.MsgApproveAction) ([]byte, error)
PackApproveForICA packs a Lumera MsgApproveAction into protobuf Any bytes suitable for ICS-27 MsgSendTx.
func PackRequestAny ¶
func PackRequestAny(msg *actiontypes.MsgRequestAction) (*codectypes.Any, error)
PackRequestAny wraps PackRequestForICA and returns the decoded Any.
func PackRequestForICA ¶
func PackRequestForICA(msg *actiontypes.MsgRequestAction) ([]byte, error)
PackRequestForICA packs a Lumera MsgRequestAction into protobuf Any bytes suitable for embedding into an ICS-27 controller transaction (MsgSendTx) on a remote chain.
The returned bytes are the protobuf serialization of google.protobuf.Any, with type_url set to the Lumera MsgRequestAction URL and value set to the message bytes.
func ParseTxHashJSON ¶
ParseTxHashJSON extracts the tx hash from CLI JSON output and returns an error on failed codes.
Types ¶
type Config ¶
type Config struct {
// Controller holds the gRPC/chain configuration for the controller chain
// (the chain that signs and broadcasts MsgSendTx).
Controller base.Config
// Host holds the gRPC/chain configuration for the host chain
// (the chain where the ICA executes messages).
Host base.Config
// Keyring provides access to signing keys for both chains.
Keyring keyring.Keyring
// KeyName is the key name used for signing on the controller chain.
KeyName string
// HostKeyName is an optional separate key name for host chain operations.
// When empty, KeyName is used for both chains.
HostKeyName string
// ConnectionID is the IBC connection identifier on the controller chain.
ConnectionID string
// CounterpartyConnectionID is the IBC connection identifier on the host chain.
// When set, it is included in the ICA registration metadata.
CounterpartyConnectionID string
// Ordering specifies the IBC channel ordering (ORDERED or UNORDERED).
// Defaults to ORDERED.
Ordering channeltypes.Order
// RelativeTimeout is the timeout duration for ICA packets, relative to
// the current block time. Defaults to 10 minutes.
RelativeTimeout time.Duration
// PollDelay is the interval between polling attempts when waiting for
// ICA registration or acknowledgements. Defaults to 2 seconds.
PollDelay time.Duration
// PollRetries is the maximum number of polling attempts when waiting
// for ICA address registration. Defaults to 120.
PollRetries int
// AckRetries is the maximum number of polling attempts when waiting
// for an IBC packet acknowledgement. Defaults to 120.
AckRetries int
}
Config configures the ICA controller for a controller/host chain pair. Controller and host chains can use different key types (Cosmos or EVM) by importing keys under separate names into the same keyring and setting KeyName / HostKeyName independently.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages ICA registration and message execution via gRPC.
func NewController ¶
func NewController(ctx context.Context, cfg Config) (*Controller, error)
NewController creates a new ICA controller using gRPC-based queries and txs.
func (*Controller) AppPubkey ¶
func (c *Controller) AppPubkey() []byte
AppPubkey returns the pubkey bytes for ICA creator validation.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases gRPC connections held by the controller.
func (*Controller) EnsureICAAddress ¶
func (c *Controller) EnsureICAAddress(ctx context.Context) (string, error)
EnsureICAAddress resolves or registers an ICA address and waits for availability.
func (*Controller) ICAAddress ¶
func (c *Controller) ICAAddress(ctx context.Context) (string, error)
ICAAddress returns the ICA address if already registered.
func (*Controller) OwnerAddress ¶
func (c *Controller) OwnerAddress() string
OwnerAddress returns the controller owner address used for ICA registration.
func (*Controller) SendApproveAction ¶
func (c *Controller) SendApproveAction(ctx context.Context, msg *actiontypes.MsgApproveAction) (string, error)
SendApproveAction sends approve messages over ICA and returns the controller tx hash.
func (*Controller) SendRequestAction ¶
func (c *Controller) SendRequestAction(ctx context.Context, msg *actiontypes.MsgRequestAction) (*sdktypes.ActionResult, error)
SendRequestAction sends a request action over ICA and parses the ack for the action ID.
type PacketInfo ¶
PacketInfo captures the packet identifiers needed to query acknowledgements.
func ExtractPacketInfoFromTxJSON ¶
func ExtractPacketInfoFromTxJSON(txJSON []byte) (PacketInfo, error)
ExtractPacketInfoFromTxJSON parses a tx response JSON payload and returns the send_packet identifiers.