@zerochain/sdk
Version:
The Züs JS SDK is a JavaScript client library that provides a convenient interface for interacting with the Züs Network. It allows developers to perform various operations such as creating and managing allocations, uploading and downloading files, executi
38 lines (37 loc) • 1.5 kB
TypeScript
/**
* Converts a hexadecimal string to a Uint8Array.
*
* @param str The hexadecimal string to convert.
* @returns The Uint8Array bytes representation of the hexadecimal string.
*/
export declare const hexStringToByte: (str: string) => Uint8Array<ArrayBuffer>;
/**
* Sleep is used when awaiting for Go Wasm to initialize.
* It uses the lowest possible sane delay time (via requestAnimationFrame).
* However, if the window is not focused, requestAnimationFrame never returns.
* A timeout will ensure to be called after 50 ms, regardless of whether or not
* the tab is in focus.
*/
export declare const sleep: (ms?: number) => Promise<number | void>;
export declare const getBls: () => Promise<any>;
/** Converts SAS token to ZCN */
export declare const sasTokenToZcn: (token?: number) => number;
/**
* Converts ZCN to SAS token
* Note: SAS can never be a float number
*/
export declare const zcnToSasToken: (zcn?: number) => number;
type DecodedAuthTicket = {
fileName?: string;
walletId?: string;
lookupHash?: string;
referenceType?: string;
allocationId?: string;
isEncrypted?: boolean;
};
/** decodeAuthTicket decodes the Authticket */
export declare const decodeAuthTicket: (authTicket: string) => DecodedAuthTicket;
export declare const bufferToByteString: (buffer: Buffer<ArrayBuffer>) => string;
export declare const fileToBuffer: (file: File) => Promise<Buffer<ArrayBuffer>>;
export declare const fileToByteString: (file: File) => Promise<string>;
export {};