@berrywallet/core
Version:
Berrywallet main Core for work with common cryptocurrencies like Bitcoin, Ethereum, Dash, Litecoin
45 lines (44 loc) • 2.18 kB
TypeScript
import BigNumber from 'bignumber.js';
import { Coin, Wallet } from '../../';
import { Destructable } from '../../utils';
import { Api, Events } from '../';
import * as Tracker from './tracker';
export { Tracker };
export declare type FeeType = 'low' | 'standard' | 'high';
export declare type FeeRecord = Record<FeeType, BigNumber>;
export declare type GasPrice = FeeRecord;
export interface INetworkClient extends Destructable {
getCoin(): Coin.CoinInterface;
getApiUrl(): string;
getWSUrl(): string;
getOptions(): Api.TAdapterOption;
getBlock(blockHash: string): Promise<Wallet.Entity.Block>;
getTx(txid: string): Promise<Wallet.Entity.WalletTransaction | undefined>;
getAddressTxs(address: string): Promise<Wallet.Entity.WalletTransaction[]>;
getBulkAddrsTxs(addrs: string[]): Promise<Wallet.Entity.WalletTransaction[]>;
broadCastTransaction(transaction: Coin.Transaction.Transaction): Promise<string>;
getTracker(): Tracker.ITrackerClient;
}
export interface IEthereumNetworkClient extends INetworkClient {
getGasPrice(): Promise<GasPrice>;
estimateGas(address: Coin.Key.Address, value: BigNumber): Promise<BigNumber>;
}
export declare abstract class NetworkClient implements INetworkClient {
protected readonly coin: Coin.CoinInterface;
protected readonly options: Api.TAdapterOption;
protected onBlocksCbs: Events.NewBlockCallback[];
protected onAddrTXCbs: Record<string, Events.NewTxCallback[]>;
constructor(coin: Coin.CoinInterface, options: Api.TAdapterOption);
abstract getTx(txid: string): Promise<Wallet.Entity.WalletTransaction | undefined>;
abstract getBlock(blockHash: string): Promise<Wallet.Entity.Block>;
abstract getAddressTxs(address: string): Promise<Wallet.Entity.WalletTransaction[]>;
abstract broadCastTransaction(transaction: Coin.Transaction.Transaction): Promise<string>;
getCoin(): Coin.CoinInterface;
getApiUrl(): string;
getWSUrl(): string;
enabledWS(): boolean;
getOptions(): Api.TAdapterOption;
getTracker(): Tracker.ITrackerClient;
getBulkAddrsTxs(addrs: string[]): Promise<Wallet.Entity.WalletTransaction[]>;
destruct(): void;
}