cascade

package
v1.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 CreateApproveActionMessage

func CreateApproveActionMessage(_ context.Context, actionID string, opts ...ApproveOption) (*actiontypes.MsgApproveAction, error)

CreateApproveActionMessage builds a MsgApproveAction using options for creator address. Required: WithApproveCreator(...)

func CreateRequestActionMessage

func CreateRequestActionMessage(_ context.Context, creator string, filePath string, opts ...UploadOption) (*actiontypes.MsgRequestAction, []byte, error)

CreateRequestActionMessage is a package-level helper that builds a MsgRequestAction for Cascade using only local file information (no network calls). It returns the constructed message and the metadata bytes used inside it.

This function mirrors (*Client).CreateRequestActionMessage but avoids depending on SuperNode SDK; it prepares minimal metadata from the provided file path so it can be used in offline ICA examples/tests.

func DecodePacketAcknowledgementJSON added in v1.0.5

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

DecodePacketAcknowledgementJSON extracts and base64-decodes the acknowledgement field.

func ExtractRequestActionIDsFromAck added in v1.0.5

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 added in v1.0.5

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

ExtractRequestActionIDsFromTxMsgData scans TxMsgData for MsgRequestActionResponse entries and returns the corresponding action IDs.

func PackApproveAny added in v1.0.5

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 added in v1.0.5

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 added in v1.0.5

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

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

func SendApproveActionMessage

func SendApproveActionMessage(ctx context.Context, msg *actiontypes.MsgApproveAction, opts ...ApproveOption) (string, error)

SendApproveActionMessage signs, simulates and broadcasts the approve message using the provided blockchain client option. Returns tx hash.

Types

type ApproveOption

type ApproveOption func(*ApproveOptions)

func WithApproveBlockchain

func WithApproveBlockchain(bc *blockchain.Client) ApproveOption

WithApproveBlockchain provides the blockchain client used for signing/broadcasting

func WithApproveCreator

func WithApproveCreator(creator string) ApproveOption

WithApproveCreator sets the creator (Lumera account / ICA host address) for approve helpers

func WithApproveMemo

func WithApproveMemo(memo string) ApproveOption

WithApproveMemo sets an optional memo (idempotency key or note)

type ApproveOptions

type ApproveOptions struct {
	Creator    string
	Memo       string
	Blockchain *blockchain.Client
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides access to cascade operations (wraps SuperNode SDK)

func New

func New(ctx context.Context, cfg Config, kr keyring.Keyring) (*Client, error)

New creates a new cascade client

func (*Client) Close

func (c *Client) Close() error

Close closes the cascade client

func (*Client) CreateApproveActionMessage

func (c *Client) CreateApproveActionMessage(_ context.Context, creator string, actionID string) (*actiontypes.MsgApproveAction, error)

CreateApproveActionMessage constructs a MsgApproveAction without broadcasting it.

func (*Client) CreateRequestActionMessage

func (c *Client) CreateRequestActionMessage(ctx context.Context, creator string, filePath string, options *UploadOptions) (*actiontypes.MsgRequestAction, []byte, error)

CreateRequestActionMessage builds Cascade metadata and constructs a MsgRequestAction without broadcasting it. Returns the built Cosmos message and the serialized metadata bytes used in the message.

func (*Client) Download

func (c *Client) Download(ctx context.Context, actionID string, outputDir string, opts ...DownloadOption) (*types.DownloadResult, error)

Download downloads a file from Cascade

func (*Client) SendApproveActionMessage

func (c *Client) SendApproveActionMessage(ctx context.Context, bc *blockchain.Client, msg *actiontypes.MsgApproveAction, memo string) (*types.ActionResult, error)

SendApproveActionMessage signs, simulates and broadcasts the provided approve message.

func (*Client) SendRequestActionMessage

func (c *Client) SendRequestActionMessage(ctx context.Context, bc *blockchain.Client, msg *actiontypes.MsgRequestAction,
	memo string, options *UploadOptions) (*types.ActionResult, error)

SendRequestActionMessage signs, simulates and broadcasts the provided request message. "memo" can be used to pass an optional filename or idempotency key.

func (*Client) SetLogger

func (c *Client) SetLogger(logger sdklog.Logger)

SetLogger configures optional diagnostics logging.

func (*Client) SubscribeToAllEvents

func (c *Client) SubscribeToAllEvents(ctx context.Context, handler sdkEvent.Handler) error

SubscribeToAllEvents subscribes to all event types

func (*Client) SubscribeToEvents

func (c *Client) SubscribeToEvents(ctx context.Context, eventType sdkEvent.EventType, handler sdkEvent.Handler) error

SubscribeToEvents subscribes to specific event types

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, creator string, bc *blockchain.Client, filePath string, opts ...UploadOption) (*types.CascadeResult, error)

Upload provides a one-shot convenience helper that performs:

  1. CreateRequestActionMessage
  2. SendRequestActionMessage
  3. UploadToSupernode

func (*Client) UploadToSupernode

func (c *Client) UploadToSupernode(ctx context.Context, actionID string, filePath string, signerAddr ...string) (string, error)

UploadToSupernode uploads the file bytes to SuperNodes keyed by actionID and waits for completion. Optional signerAddr overrides the bech32 address used for ADR-36 signing. Returns the resulting taskID upon success.

type Config

type Config struct {
	ChainID  string
	GRPCAddr string
	Address  string
	KeyName  string
	// ICAOwnerKeyName is the local key name for the ICA controller owner.
	ICAOwnerKeyName string
	// ICAOwnerHRP is the bech32 prefix for the ICA controller owner chain.
	ICAOwnerHRP string
	Timeout     time.Duration
}

Config for a cascade client

type DownloadOption

type DownloadOption func(*DownloadOptions)

DownloadOption is a functional option for Download

func WithDownloadSignerAddress added in v1.0.5

func WithDownloadSignerAddress(addr string) DownloadOption

WithDownloadSignerAddress overrides the signer address used for download signatures.

type DownloadOptions

type DownloadOptions struct {
	SignerAddr string
}

DownloadOptions configures cascade download

type ICASendFunc added in v1.0.5

type ICASendFunc func(ctx context.Context, msg *actiontypes.MsgRequestAction, meta []byte, filePath string, options *UploadOptions) (*types.ActionResult, error)

ICASendFunc sends a MsgRequestAction via ICA and returns the resulting action result. It should be used when registering actions through an interchain account.

type PacketInfo added in v1.0.5

type PacketInfo struct {
	Port     string
	Channel  string
	Sequence uint64
}

PacketInfo captures the packet identifiers needed to query acknowledgements.

func ExtractPacketInfoFromTxJSON added in v1.0.5

func ExtractPacketInfoFromTxJSON(txJSON []byte) (PacketInfo, error)

ExtractPacketInfoFromTxJSON parses a tx response JSON payload and returns the send_packet identifiers.

type TaskInfo

type TaskInfo struct {
	TaskID string
}

TaskInfo contains task information

type TaskManager

type TaskManager struct {
	// contains filtered or unexported fields
}

TaskManager manages task lifecycle

func NewTaskManager

func NewTaskManager(client snsdk.Client) *TaskManager

NewTaskManager creates a new task manager

func (*TaskManager) Wait

func (tm *TaskManager) Wait(ctx context.Context, taskID string) (*TaskInfo, error)

Wait waits for a task to complete

type UploadOption

type UploadOption func(*UploadOptions)

UploadOption is a functional option for Upload

func WithAppPubkey added in v1.0.5

func WithAppPubkey(pubkey []byte) UploadOption

WithAppPubkey sets the app pubkey used for ICA creator signature validation.

func WithICACreatorAddress added in v1.0.5

func WithICACreatorAddress(addr string) UploadOption

WithICACreatorAddress sets the ICA creator address on MsgRequestAction.

func WithICASendFunc added in v1.0.5

func WithICASendFunc(fn ICASendFunc) UploadOption

WithICASendFunc provides a hook to send the request message via ICA.

func WithID added in v1.0.2

func WithID(id string) UploadOption

WithID sets a custom ID

func WithPublic

func WithPublic(public bool) UploadOption

WithPublic sets the public flag

type UploadOptions

type UploadOptions struct {
	ID                string // optional custom ID for the upload
	Public            bool   // whether the uploaded file will be accessible publicly
	ICACreatorAddress string // optional ICA creator address used in MsgRequestAction
	AppPubkey         []byte // optional app pubkey for ICA creator validation
	ICASendFunc       ICASendFunc
}

UploadOptions configures cascade upload

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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