Documentation
¶
Index ¶
- func CreateApproveActionMessage(_ context.Context, actionID string, opts ...ApproveOption) (*actiontypes.MsgApproveAction, error)
- func SendApproveActionMessage(ctx context.Context, msg *actiontypes.MsgApproveAction, opts ...ApproveOption) (string, error)
- type ApproveOption
- type ApproveOptions
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateApproveActionMessage(_ context.Context, creator string, actionID string) (*actiontypes.MsgApproveAction, error)
- func (c *Client) CreateRequestActionMessage(ctx context.Context, creator string, filePath string, options *UploadOptions) (*actiontypes.MsgRequestAction, []byte, error)
- func (c *Client) Download(ctx context.Context, actionID string, outputDir string, opts ...DownloadOption) (*types.DownloadResult, error)
- func (c *Client) SendApproveActionMessage(ctx context.Context, bc *blockchain.Client, msg *actiontypes.MsgApproveAction, ...) (*types.ActionResult, error)
- func (c *Client) SendRequestActionMessage(ctx context.Context, bc *blockchain.Client, msg *actiontypes.MsgRequestAction, ...) (*types.ActionResult, error)
- func (c *Client) SetLogger(logger *zap.Logger)
- func (c *Client) SubscribeToAllEvents(ctx context.Context, handler sdkEvent.Handler) error
- func (c *Client) SubscribeToEvents(ctx context.Context, eventType sdkEvent.EventType, handler sdkEvent.Handler) error
- func (c *Client) Upload(ctx context.Context, creator string, bc *blockchain.Client, filePath string, ...) (*types.CascadeResult, error)
- func (c *Client) UploadToSupernode(ctx context.Context, actionID string, filePath string, signerAddr ...string) (string, error)
- type Config
- type DownloadOption
- type DownloadOptions
- type ICASendFunc
- type TaskInfo
- type TaskManager
- type UploadOption
- type UploadOptions
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 (*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) SubscribeToAllEvents ¶
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:
- CreateRequestActionMessage
- SendRequestActionMessage
- 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 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
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.
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