Create a new CascadeUploader instance
SNApiClient for making sn-api requests
Port for accessing blockchain capabilities
Bech32 address of the signer
Universal signer for signing operations
Chain ID for signing operations
Optional configuration
Upload a file to Cascade storage
This method orchestrates the complete upload workflow:
The file to upload (as Blob, ArrayBuffer, or Uint8Array)
Upload parameters including action ID
Promise resolving to the completed upload task
const uploader = new CascadeUploader(snapiClient, chainPort);
// Upload from a file input
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];
const result = await uploader.uploadFile(file, {
actionId: 'action-123',
taskOptions: {
pollInterval: 2000,
timeout: 300000
}
});
console.log('Upload complete:', result);
CascadeUploader manages the complete file upload workflow.
This class integrates all components of the storage layer to provide a simple, high-level API for uploading files to Cascade. It handles: