@wttp/site
Version:
Web3 Transfer Protocol (WTTP) - Site Contracts and deployment tools
45 lines • 1.6 kB
TypeScript
import { type LOCATEResponseStruct, type RangeStruct } from "@wttp/core";
/**
* Fetches a resource directly from a WTTP site contract
*
* @param siteAddress - The address of the WTTP site contract
* @param path - The path to the resource
* @param options - Optional parameters for the request
* @returns The response from the site with full content
*/
export declare function fetchResource(siteAddress: string, path?: string, options?: {
ifModifiedSince?: number;
ifNoneMatch?: string;
range?: RangeStruct;
headRequest?: boolean;
datapoints?: boolean;
chainId?: number;
}): Promise<{
response: LOCATEResponseStruct;
content?: Uint8Array;
}>;
/**
* Reads content from an array of datapoints using the DPS contract
*
* @param siteAddress - The address of the WTTP site (to get DPS reference)
* @param dataPoints - Array of datapoint addresses
* @param chainId - Optional chain ID for ESP deployments
* @returns Combined content from all datapoints
*/
export declare function readDataPointsContent(siteAddress: string, dataPoints: string[], chainId?: number): Promise<Uint8Array>;
export declare function isText(mimeType: string): boolean;
/**
* Main function to fetch a resource from a WTTP site
*/
export declare function main(siteAddress: string, path: string, options?: {
ifModifiedSince?: number;
ifNoneMatch?: string;
range?: RangeStruct;
headRequest?: boolean;
datapoints?: boolean;
chainId?: number;
}): Promise<{
response: LOCATEResponseStruct;
content?: Uint8Array;
}>;
//# sourceMappingURL=fetchResource.d.ts.map