Skip to content

Instantly share code, notes, and snippets.

@tempofeng
Created August 2, 2019 07:59
Show Gist options
  • Save tempofeng/78457f314198ce877bb2855a74a8c9be to your computer and use it in GitHub Desktop.
Save tempofeng/78457f314198ce877bb2855a74a8c9be to your computer and use it in GitHub Desktop.
export interface EthApi {
/**
* List normal transactions to/from an ETH address.
*
* @param startBlock Starting block. It's inclusive.
* @param endBlock Ending block. It's inclusive.
* @param limit The max number of transactions returned.
* @param sort Sorting order.
*/
listTransactions(address: string, startBlock?: number, endBlock?: number, limit: number = 10000, sort: string = "asc" | "desc"): Transaction[];
/**
* List internal transactions to/from an ETH address.
*
* @param startBlock Starting block. It's inclusive.
* @param endBlock Ending block. It's inclusive.
* @param limit The max number of internal transactions returned.
* @param sort Sorting order.
*/
listInternalTransactions(address: string, startBlock?: number, endBlock?: number, limit: number = 10000, sort: string = "asc" | "desc"): InternalTx[];
/**
* List ERC-20 token transfers to/from an ETH address.
*
* @param startBlock Starting block. It's inclusive.
* @param endBlock Ending block. It's inclusive.
* @param limit The max number of token transfers returned.
* @param sort Sorting order.
*/
listTokenTransfers(address: string, startBlock?: number, endBlock?: number, limit: number = 10000, sort: string = "asc" | "desc"): TokenTransfer[];
/**
* Get the ETH balance of an address.
*/
getEthBalance(address: string): BigNumber;
/**
* Get all of the ERC-20 balances of an ETH address.
*
* @returns A dictionary contains all the balances by tokenContractAddress. Ex: An account with 1 ZRX will be:
* {
* "0xe41d2489571d322189246dafa5ebde1f4699f498": 1000000000000000000
* }
*/
getTokenBalances(address: string): Dictionary<BigNumber>;
}
export interface Transaction {
blockNumber: string;
timeStamp: string;
hash: string;
nonce: string;
blockHash: string;
transactionIndex: string;
from: string;
to: string;
value: string;
gas: string;
gasPrice: string;
isError: string;
txreceipt_status: string;
input: string;
contractAddress: string;
cumulativeGasUsed: string;
gasUsed: string;
confirmations: string;
}
export interface InternalTransaction {
blockNumber: string;
timeStamp: string;
hash: string;
from: string;
to: string;
value: string;
contractAddress: string;
input: string;
type: string;
gas: string;
gasUsed: string;
traceId: string;
isError: string;
errCode: string;
}
export interface TokenTransfer {
blockNumber: string;
timeStamp: string;
hash: string;
nonce: string;
blockHash: string;
from: string;
contractAddress: string;
to: string;
value: string;
tokenName: string;
tokenSymbol: string;
tokenDecimal: string;
transactionIndex: string;
gas: string;
gasPrice: string;
gasUsed: string;
cumulativeGasUsed: string;
input: string;
confirmations: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment