ica

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAckNotFound = errors.New("acknowledgement event not found")

ErrAckNotFound is returned when no acknowledgement event is present for the packet.

View Source
var ErrICAAddressNotFound = errors.New("ica address not found")

ErrICAAddressNotFound is returned when no ICA address is registered yet.

View Source
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

func DecodePacketAcknowledgementJSON(ackJSON []byte) ([]byte, error)

DecodePacketAcknowledgementJSON extracts and base64-decodes the acknowledgement field.

func ExtractRequestActionIDsFromAck

func ExtractRequestActionIDsFromAck(ackBytes []byte) ([]string, error)

ExtractRequestActionIDsFromAck decodes an IBC acknowledgement containing a TxMsgData and returns any MsgRequestActionResponse action IDs found in the message responses.

func ExtractRequestActionIDsFromTxMsgData

func ExtractRequestActionIDsFromTxMsgData(msgData *sdk.TxMsgData) []string

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

func ParseTxHashJSON(txJSON []byte) (string, error)

ParseTxHashJSON extracts the tx hash from CLI JSON output and returns an error on failed codes.

Types

type Config

type Config struct {
	Controller base.Config
	Host       base.Config
	Keyring    keyring.Keyring
	KeyName    string

	ConnectionID             string
	CounterpartyConnectionID string
	Ordering                 channeltypes.Order
	RelativeTimeout          time.Duration
	PollDelay                time.Duration
	PollRetries              int
	AckRetries               int
}

Config configures the ICA controller for a controller/host chain pair.

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

type PacketInfo struct {
	Port     string
	Channel  string
	Sequence uint64
}

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.

Jump to

Keyboard shortcuts

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