@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
78 lines (77 loc) • 2.91 kB
TypeScript
import type { WasmType } from '@/types';
import type { ActiveWallet, BasicWallet, NetworkDomain } from '@/types/wallet';
/** Creates wallet keys including wallet ID, public key, and private key using BLS (Boneh-Lynn-Shacham) cryptography. */
export declare const createWalletKeys: (
/** Optional 24 word [bip39](https://iancoleman.io/bip39/) mnemonic phrase. */
customBip39Mnemonic?: string) => Promise<{
keys: {
walletId: string;
/** BLS public key */
publicKey: string;
/** BLS private key */
privateKey: string;
walletMnemonic: string;
};
mnemonic: string;
}>;
/** Retrieves the public encryption key for a wallet. */
export declare const getPublicEncryptionKey: ({ keys, domain, }: {
keys: {
walletId: string;
/** BLS public key */
publicKey: string;
/** BLS private key */
privateKey: string;
walletMnemonic: string;
};
domain: NetworkDomain;
}) => Promise<string>;
/** Create a new wallet. Also, helps to recover a wallet using its mnemonic phrase. */
export declare const createWallet: ({ domain, walletName, customBip39Mnemonic, }: {
domain: NetworkDomain;
walletName?: string;
/**
* Optional 24 word [bip39](https://iancoleman.io/bip39/) mnemonic phrase for wallet recovery.
* If `customBip39Mnemonic` is not provided, a new mnemonic will be generated.
*/
customBip39Mnemonic?: string;
}) => Promise<BasicWallet>;
export declare const isWalletId: (walletId: string) => boolean;
export declare const getGosdkVersion: (domain: string) => Promise<string>;
export declare const getLookupHash: ({ domain, allocationId, filePath, wallet, }: {
domain: NetworkDomain;
allocationId: string;
filePath: string;
wallet: ActiveWallet;
}) => Promise<string>;
/** makeSCRestAPICall issues a request to the public API of one of the smart contracts
* @returns Response in JSON string
*/
export declare const makeSCRestAPICall: ({ domain, scType, endpoint: relativePath, params, }: {
domain: NetworkDomain;
/** Smart contract type */
scType: "sharders" | "miners";
/** Relative path of the endpoint */
endpoint: string;
/** Parameters in JSON format */
params?: Record<string, string>;
}) => Promise<string>;
/** @returns Wasm type. If SDK is not initialized, `returns undefined` */
export declare const getWasmType: () => WasmType | undefined;
/**
* send tokens to a client ID / wallet ID
*
* @returns The transaction hash.
*/
export declare const send: ({ wallet, domain, toClientId, tokens, fee, desc, }: {
wallet: ActiveWallet;
domain: NetworkDomain;
/** Client ID / Wallet ID to send tokens to */
toClientId: string;
/** Number of tokens to send */
tokens: number;
/** Transaction fee */
fee: number;
/** Description of the transaction */
desc: string;
}) => Promise<string>;