cascade

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 22 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 PackApproveForICA

func PackApproveForICA(msg *actiontypes.MsgApproveAction) ([]byte, error)

PackApproveForICA packs a Lumera MsgApproveAction into protobuf Any bytes suitable for ICS-27 MsgSendTx.

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 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) (string, error)

UploadToSupernode uploads the file bytes to SuperNodes keyed by actionID and waits for completion. Returns the resulting taskID upon success.

type Config

type Config struct {
	ChainID  string
	GRPCAddr string
	Address  string
	KeyName  string
	Timeout  time.Duration
}

Config for a cascade client

type DownloadOption

type DownloadOption func(*DownloadOptions)

DownloadOption is a functional option for Download

type DownloadOptions

type DownloadOptions struct {
}

DownloadOptions configures cascade download

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 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
}

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