UNPKG

mochimo-wallet

Version:

Mochimo HD Wallet Implementation with React Integration

84 lines (83 loc) 1.95 kB
/** * Network node information */ export interface NetworkNode { host: string; port: number; updateTime: string; } /** * Response from tag resolution */ export interface TagResolveResponse { success: boolean; unanimous: boolean; addressConsensus: string; balanceConsensus: string; quorum: Array<{ node: NetworkNode; address: string; balance: string; }>; } /** * Response from transaction push */ export interface TransactionResponse { status: 'success' | 'error'; data?: { sent: number; txid: string; }; error?: string; } /** * Response from tag activation */ export interface TagActivationResponse { status: 'success' | 'error'; message: string; data?: { txid?: string; amount?: string; }; } /** * Network service interface */ export interface NetworkService { apiUrl: string; /** * Resolves a tag to its current WOTS address and balance * @param tag The tag to resolve */ resolveTag(tag: string): Promise<TagResolveResponse>; /** * Pushes a transaction to the network * @param transaction Serialized transaction * @param recipients Optional number of recipients */ pushTransaction(transaction: string, recipients?: number): Promise<TransactionResponse>; /** * Activates a tag with its first WOTS address * @param wotsAddress The WOTS address to activate */ activateTag(wotsAddress: string): Promise<TagActivationResponse>; /** * Gets the current network status */ getNetworkStatus(): Promise<{ height: number; nodes: NetworkNode[]; }>; /** * Gets a tag's WOTS address balance * @param tag The tag to get the balance of */ getBalance(tag: string): Promise<string>; } export interface NetworkState { blockHeight: number; isConnected: boolean; error: string | null; }