UNPKG

@onekeyfe/blockchain-link

Version:

High-level javascript interface for blockchain communication

113 lines (112 loc) 2.59 kB
import { Transaction as BlockbookTransaction, VinVout } from './blockbook'; import { FormattedTransactionType as RippleTransaction } from 'ripple-lib'; export interface BlockchainSettings { name: string; worker: string | (() => any); server: string[]; debug?: boolean; timeout?: number; pingTimeout?: number; keepAlive?: boolean; } export interface TokenTransfer { type: 'sent' | 'recv' | 'self' | 'unknown'; name: string; symbol: string; address: string; decimals: number; amount: string; from?: string; to?: string; } export interface Target { n: number; addresses?: string[]; isAddress: boolean; amount?: string; coinbase?: string; isAccountTarget?: boolean; } export declare type TypedRawTransaction = { type: 'blockbook'; tx: BlockbookTransaction; } | { type: 'ripple'; tx: RippleTransaction; }; export declare type TransactionDetail = { vin: VinVout[]; vout: VinVout[]; size: number; totalInput: string; totalOutput: string; }; export interface Transaction { type: 'sent' | 'recv' | 'self' | 'unknown'; txid: string; blockTime?: number; blockHeight?: number; blockHash?: string; amount: string; fee: string; targets: Target[]; tokens: TokenTransfer[]; rbf?: boolean; ethereumSpecific?: BlockbookTransaction['ethereumSpecific']; details: TransactionDetail; } export interface Address { address: string; path: string; transfers: number; balance?: string; sent?: string; received?: string; } export interface AccountAddresses { change: Address[]; used: Address[]; unused: Address[]; } export interface TokenInfo { type: string; address: string; balance?: string; name?: string; symbol?: string; decimals: number; } export interface AccountInfo { descriptor: string; balance: string; availableBalance: string; empty: boolean; tokens?: TokenInfo[]; addresses?: AccountAddresses; history: { total: number; tokens?: number; unconfirmed: number; transactions?: Transaction[]; txids?: string[]; }; misc?: { nonce?: string; erc20Contract?: TokenInfo; sequence?: number; reserve?: string; }; page?: { index: number; size: number; total: number; }; marker?: { ledger: number; seq: number; }; } export interface SubscriptionAccountInfo { descriptor: string; addresses?: AccountAddresses; }