UNPKG

nano-wallet-js-test-1

Version:

SDK for developers to create and interact with Nanocurrency wallet easily

50 lines (49 loc) 1.5 kB
import NanoRPC, { NanoRpcConfig } from '../rpc/RpcController'; import BaseController from '../BaseController'; export interface NanoWalletConfig extends NanoRpcConfig { privateKey: string; representative: string; minAmountRaw?: string; } export interface ReceivableBlock { blockHash: string; amount: string; } export interface NanoWalletState { balance: string; receivable: string; receivableBlocks: ReceivableBlock[]; frontier: string | null; representative: string | null; } export default class NanoWallet extends BaseController<NanoWalletConfig, NanoWalletState> { rpc: NanoRPC; publicKey: string; account: string; defaultConfig: NanoWalletConfig; defaultState: NanoWalletState; constructor(config: NanoWalletConfig, state?: NanoWalletState | null); sync(): Promise<void>; workGenerate(hash: string, threshold: string): Promise<string>; getReceivable(): Promise<{ receivableBlocks: ReceivableBlock[]; receivable: string; }>; receive(link: string): Promise<{ hash: string; }>; send(to: string, amount: string): Promise<{ hash: string; }>; sweep(to: string): Promise<{ hash: string; }>; setRepresentative(account?: string): Promise<{ hash: string; }>; get balance(): string; get receivable(): string; get receivableBlocks(): ReceivableBlock[]; get frontier(): string | null; get currentRepresentative(): string | null; }