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 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 ¶
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.