import { HttpProvider } from 'open-jsonrpc-provider'; import { DownloadOption, IpLocation, ShardedNodes, TransactionOptions } from './types.js'; import { SelectMethod, ShardedNode } from '../common/index.js'; import { UploadOption, Uploader } from '../transfer/index.js'; import { StorageNode } from '../node/index.js'; import { RetryOpts } from '../types.js'; import { AbstractFile } from '../file/AbstractFile.js'; import { Signer } from 'ethers'; import { EncryptionHeader } from '../common/encryption.js'; export declare class Indexer extends HttpProvider { constructor(url: string); getShardedNodes(): Promise; getNodeLocations(): Promise>; getFileLocations(rootHash: string): Promise; /** * Select `expectedReplica` complete sharding sets from the indexer's * trusted nodes and return them as StorageNode clients. * * @param expectedReplica Number of full replicas required. * @param method Node ordering before selection (default 'min'). */ selectNodes(expectedReplica: number, method?: SelectMethod): Promise<[StorageNode[], Error | null]>; newUploaderFromIndexerNodes(blockchain_rpc: string, signer: Signer, expectedReplica: number, opts?: TransactionOptions): Promise<[Uploader | null, Error | null]>; upload(file: AbstractFile, blockchain_rpc: string, signer: Signer, uploadOpts?: UploadOption, retryOpts?: RetryOpts, opts?: TransactionOptions): Promise<[ ({ txHash: string; rootHash: string; txSeq: number; } | { txHashes: string[]; rootHashes: string[]; txSeqs: number[]; }), Error | null ]>; /** * Downloads a single file by root hash, writing to `filePath`. * Node.js only — uses the `fs` module. */ download(rootHash: string, filePath: string, proof?: boolean): Promise; /** * Downloads multiple files by root hashes and concatenates them. * Node.js only — uses the `fs` module. */ download(rootHashes: string[], filePath: string, proof?: boolean): Promise; private downloadFragments; private downloadSingle; /** * Downloads a single file into a Blob — browser and Node.js safe. * Fetches file locations from the indexer and selects nodes with * the 'random' method for load balancing. */ downloadToBlob(rootHash: string, opts?: DownloadOption): Promise<[Blob, Error | null]>; /** * Downloads multiple files and concatenates them into a single Blob — * browser and Node.js safe. When `decryption` is supplied, mirrors the * Go client's multi-root pattern: downloads each fragment raw, parses * the encryption header from fragment 0, and runs DecryptFragmentData * across fragments with correct CTR-offset tracking. */ downloadToBlob(rootHashes: string[], opts?: DownloadOption): Promise<[Blob, Error | null]>; private downloadFragmentsToBlob; private downloadSingleToBlob; /** * Peek at a file's first bytes to see whether it carries a v1 / v2 * encryption header, without downloading the whole file. * * Returns the parsed EncryptionHeader on match, or null if the file is * not encrypted (or the header is malformed). Use this to render * decryption UI (e.g. a key-input field) before the full download. */ peekHeader(rootHash: string): Promise<[EncryptionHeader | null, Error | null]>; /** * Creates a Downloader whose node list is the minimal covering set for * `rootHash`, selected with the 'random' method for load balancing. */ private newDownloaderFromIndexerNodes; } //# sourceMappingURL=Indexer.d.ts.map