UNPKG

crypto-janitor

Version:

The Crypto Janitor provides a simple interface for fetching and cleaning crypto account data.

94 lines (93 loc) 3.89 kB
import BaseConnection, { Transaction, Order } from "../target.types/base"; /** * @description A Etherscan Implementation of BaseConnection */ export default class Etherscan extends BaseConnection { client: any; address: string; rawTransactions: Array<any>; transactions: Array<any>; fallbackDataSources: Array<string>; currentDataSource: any; availableDataSources: any; /** * @description Create Ledger instance * @param {string} address - CVS file with transactions * @param {string} apiKey - Etherscan API key * @param {string} marketDataSource - Name of implmented */ constructor(address: string, apiKey: string, marketDataSource?: string); /** * @description JSON object representing connection * @override BaseConnection.toJSON * @return {any} */ toJSON(): any; /** * HELPER * @description Parse out transactions and order from ledger entry group * @param {string} symbol - Currency symbol * @param {Array<string>} exclude - An array of connection names to exclude from the check * @return {any} Market data source (ccxt public connection) */ findMarketForQuote(symbol: string, exclude?: Array<string>): Promise<{ dataSource: any; attempted: string[]; }>; /** * HELPER * @description Parse out transactions and order from ledger entry group * @param {any} entryGroup - Unformatted ledger transaction * @return {Promise<Transaction | Order>} Formatted transaction */ _parseEntryGroup(entryGroup: any): Promise<Transaction | Order>; /** * @description Fetch and clean transactions * @override BaseConnection.initialize * @param {boolean} forceReload - (Optional) Additional paramaters * @return {Promise<void>} */ initialize(forceReload?: boolean): Promise<void>; /** * Fetch Account transactions by type, symbol, and/or since a certain time * @param {string | Array<string>} type (Optional) Transaction type(s) * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of deposit objects */ filterTransactions(type?: string | Array<string>, since?: number): Promise<Array<any>>; /** * @description Filter for address withdrawals * @override BaseConnection.getWithdrawals * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of withdrawal objects */ getWithdrawals(since?: number): Promise<Array<any>>; /** * @description Filter for address deposits * @override BaseConnection.getDeposits * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of deposit objects */ getDeposits(since?: number): Promise<Array<any>>; /** * @description Filter for address orders * @override BaseConnection.getOrders * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of deposit objects */ getOrders(since?: number): Promise<Array<any>>; /** * @description Get address transactions (withdrawals, deposits, and orders) * @override BaseConnection.getTransactions * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of withdrawal objects */ getTransactions(since?: number): Promise<Array<any>>; /** * @description Get all address transactions (withdrawals, deposits, and interest) * @override BaseConnection.getAllTransactions * @param {number} since (Optional) Timestamp to get transactions since * @return {Promise<Array<any>>} Array of transaction objects */ getAllTransactions(since?: number): Promise<Array<any>>; }