cascade

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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 *zap.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
	// LogLevel controls SDK logging (debug, info, warn, error). Default is error.
	LogLevel string
}

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