UNPKG

blockchain-wallet-ts

Version:

TypeScript wrapper for Blockchain.info's wallet API

74 lines (73 loc) 1.85 kB
import { ServiceMyWalletApi } from './Interfaces/ServiceMyWalletApi'; import ApiClient, { ApiClientConfig } from './Providers/ApiClient'; export default class BlockchainHDWallet extends ApiClient { /** * HD account xPub. */ protected readonly xpub: string; /** * HD account index. */ protected readonly index: number; /** * Blockchain.com wallet ID. */ protected readonly guid: string; /** * Blockchain.com wallet password. */ protected readonly password: string; /** * API path root. */ protected get basePath(): string; /** * Parameters to be included in every API request. */ protected get baseParams(): { password: string; }; /** * Blockchain HD Wallet constructor. */ constructor(config: BlockchainHDWalletConfig); /** * Wallet metadata. */ get data(): Promise<ServiceMyWalletApi.Response.getHD>; /** * Fetch balance for current wallet. */ get balance(): Promise<ServiceMyWalletApi.Response.fetchBalance>; /** * Fetch receiving Bitcoin address for current wallet. */ get receivingAddress(): Promise<ServiceMyWalletApi.Response.receiveAddressHD>; /** * Archive the current address/account. */ archive(): Promise<unknown>; /** * Remove the current address/account from the archive, making it active again. */ unarchive(): Promise<unknown>; } interface BlockchainHDWalletConfig extends ApiClientConfig { /** * Wallet GUID. */ guid: string; /** * Wallet password. */ password: string; /** * Account xPub */ xpub: string; /** * Address index. */ index: number; } export {};