pawtils
Version:
This repository contains several utils to work with the cryptocurrency [Paw](https://paw.digital/) inside the browser.
118 lines • 5.22 kB
TypeScript
import { IAccountBalanceResponse } from "./rpc/account-balance";
import { IAccountHistoryResponse } from "./rpc/account-history";
import { IAccountInfoResponse } from "./rpc/account-info";
import { IAccountPendingResponse } from "./rpc/account-pending";
import { IAccountRepresentativeResponse } from "./rpc/account-representative";
import { IBlockProcessResponse } from "./rpc/block-process";
import { IWorkGenerateResponse } from "./rpc/work-generate";
export * from "./mnemonic";
export * from "./pow-cpu";
export * from "./pow-gpu";
export * from "./qr-code";
export * from "./utils";
/**
* The supported PoW generation modes
*/
export declare enum PROOF_OF_WORK_MODE {
AUTO = 0,
GPU = 1,
CPU = 2,
NODE = 3
}
/**
* Generates proof of work for the provided hash
* @param hash - The hash to generate work for
* @param mode - Optional proof of work mode to use
*/
export declare function generateProofOfWork(hash: Uint8Array, mode: PROOF_OF_WORK_MODE): Promise<Uint8Array>;
/**
* Sets the API URL of the node to perform requests with
*/
export declare function setAPIURL(url: string): Promise<void>;
/**
* Returns the API URL of the used node
*/
export declare function getAPIURL(): string;
/**
* Sets the provided proof of work mode
* @param mode - The proof of work mode to use
*/
export declare function setProofOfWorkMode(mode: PROOF_OF_WORK_MODE): void;
/**
* Returns the used proof of work mode
*/
export declare function getProofOfWorkMode(): PROOF_OF_WORK_MODE;
/**
* Sets the provided proof of work difficulty
* @param difficulty - The proof of work difficulty to use
*/
export declare function setProofOfWorkDifficulty(difficulty: number): void;
/**
* Returns the used proof of work difficulty
*/
export declare function getProofOfWorkDifficulty(): number;
/**
* Manually send a RPC request
* @param data - The request data to send
*/
export declare function fetchRPC(data: any): Promise<any>;
/**
* Calculates work on the NODE for the provided hash
* @param hash - The hash to calculate work for
*/
export declare function getWorkNODE(hash: Uint8Array): Promise<IWorkGenerateResponse>;
/**
* Returns the info of the provided account
* @param publicKey - The public key of the account to query for
*/
export declare function getAccountInfo(publicKey: Uint8Array): Promise<IAccountInfoResponse>;
/**
* Returns the balance of the provided account
* @param publicKey - The public key of the account to query for
*/
export declare function getAccountBalance(publicKey: Uint8Array): Promise<IAccountBalanceResponse>;
/**
* Returns the representative of the provided account
* @param publicKey - The public key of the account to query for
*/
export declare function getAccountRepresentative(publicKey: Uint8Array): Promise<IAccountRepresentativeResponse>;
/**
* Returns the history of the provided account
* @param publicKey - The public key of the account to query for
* @param count - Optional limit of history items to query
* @param reverse - Optionally query history items in reverse order
* @param head - Optional block head to start querying at
*/
export declare function getAccountHistory(publicKey: Uint8Array, count?: number, reverse?: boolean, head?: Uint8Array): Promise<IAccountHistoryResponse>;
/**
* Returns the pending blocks of the provided account
* @param publicKey - The public key of the account to query for
* @param count - Optional limit of pending blocks to query
* @param threshold - Optional minimum threshold of the pending blocks to query
*/
export declare function getAccountPending(publicKey: Uint8Array, count?: number, threshold?: bigint): Promise<IAccountPendingResponse>;
/**
* Open an account that is currently unopened
* @param privateKey - The private key of the account
* @param representative - The representative to link to the account
* @param pendingHash - The pending hash to open with
* @param pendingAmount - The pending amount to open with
*/
export declare function openAccount(privateKey: Uint8Array, representative: Uint8Array, pendingHash: Uint8Array, pendingAmount: bigint): Promise<IBlockProcessResponse>;
/**
* Receive a pending deposit for the given account
* @param privateKey - The private key of the account
* @param representative - The representative to link to the account
* @param pendingHash - The pending hash to receive
* @param pendingAmount - The pending amount to receive
*/
export declare function receiveAccount(privateKey: Uint8Array, representative: Uint8Array, pendingHash: Uint8Array, pendingAmount: bigint): Promise<IBlockProcessResponse>;
/**
* Send amount to the given the account
* @param srcPrivateKey - The private key of the sender account
* @param dstPublicKey - The public key of the receiver account
* @param representativePublicKey - The public key of the representative account to use
* @param amount - The amount to send
*/
export declare function sendAccount(srcPrivateKey: Uint8Array, dstPublicKey: Uint8Array, representativePublicKey: Uint8Array, amount: bigint): Promise<IBlockProcessResponse>;
//# sourceMappingURL=index.d.ts.map