UNPKG

@devgrid/bitcoin-core

Version:
160 lines (159 loc) 3.87 kB
export interface BitcoinCoreConfig { url: string; network: string; username: string; password: string; timeout: number; wallet?: string; } export interface CreateWalletOptions { wallet_name: string; disable_private_keys?: boolean; blank?: boolean; passphrase?: string; avoid_reuse?: boolean; descriptors?: boolean; load_on_startup?: boolean; external_signer?: boolean; } export interface TransactionInput { txid: string; vout: number; sequence?: number; witness?: string[]; scriptSig?: { asm: string; hex: string; }; } export interface TransactionOutput { value: number; n: number; scriptPubKey: { asm: string; hex: string; reqSigs?: number; type: string; addresses?: string[]; }; } export interface Transaction { txid: string; hash: string; version: number; size: number; vsize: number; weight: number; locktime: number; vin: TransactionInput[]; vout: TransactionOutput[]; blockhash?: string; confirmations?: number; blocktime?: number; time?: number; } export interface BlockHeader { hash: string; confirmations: number; height: number; version: number; versionHex: string; merkleroot: string; time: number; mediantime: number; nonce: number; bits: string; difficulty: number; chainwork: string; nTx: number; previousblockhash?: string; nextblockhash?: string; } export interface NetworkInfo { version: number; subversion: string; protocolversion: number; localservices: string; localrelay: boolean; timeoffset: number; connections: number; networkactive: boolean; networks: Network[]; relayfee: number; incrementalfee: number; } export interface Network { name: string; limited: boolean; reachable: boolean; proxy: string; proxy_randomize_credentials: boolean; } export type RPCParams = (string | number | boolean | object)[]; export interface RPCResponse<T = any> { result: T; error: null | { code: number; message: string; }; id: string | number; } export declare enum RPCErrorCode { INVALID_REQUEST = -32600, METHOD_NOT_FOUND = -32601, INVALID_PARAMS = -32602, INTERNAL_ERROR = -32603, PARSE_ERROR = -32700 } export type BitcoinAddressType = 'legacy' | 'p2sh-segwit' | 'bech32' | 'bech32m'; export type EstimateMode = 'unset' | 'economical' | 'conservative'; export type SignatureHashType = 'DEFAULT' | 'ALL' | 'NONE' | 'SINGLE' | 'ALL|ANYONECANPAY' | 'NONE|ANYONECANPAY' | 'SINGLE|ANYONECANPAY'; export interface CreateRawTransactionParams { inputs: TransactionInput[]; outputs: TransactionOutput[]; locktime?: number; replaceable?: boolean; } export interface SendToAddressParams { address: string; amount: number | string; comment?: string; comment_to?: string; subtractfeefromamount?: boolean; replaceable?: boolean; conf_target?: number; estimate_mode?: EstimateMode; avoid_reuse?: boolean; fee_rate?: number | string; verbose?: boolean; } export interface SendManyParams { dummy?: string; amounts: any; minconf?: number; comment?: string; subtractfeefrom?: any[]; replaceable?: boolean; conf_target?: number; estimate_mode?: EstimateMode; fee_rate?: number | string; verbose?: boolean; } export interface WalletOperationParams { minconf?: number; include_watchonly?: boolean; include_immature_coinbase?: boolean; avoid_reuse?: boolean; } export interface CacheEntry<T> { value: T; timestamp: number; ttl: number; } export interface BatchRequest { method: string; params?: Record<string, any>; options?: { wallet?: string; }; }