Skip to content

Latest commit

 

History

History
766 lines (479 loc) · 14.6 KB

File metadata and controls

766 lines (479 loc) · 14.6 KB

Table of Contents

etherscan/api

Parameters

  • apiKey string (optional) Your Etherscan APIkey
  • chain string (optional) Testnet chain keys [ropsten, rinkeby, kovan]
  • timeout number (optional) Timeout in milliseconds for requests, default 10000

etherscan/api

log

proxy

stats

block

transaction

contract

account

getLogs

The Event Log API was designed to provide an alternative to the native eth_getLogs.

Parameters

  • address
  • fromBlock
  • toBlock
  • topic0
  • topic0_1_opr
  • topic1
  • topic1_2_opr
  • topic2
  • topic2_3_opr
  • topic3
  • topic0_2_opr

getLogs

returns the status of a specific transaction hash

Parameters

  • address
  • fromBlock string fromBlock
  • toBlock string toBlock
  • topic0 string topic (32 Bytes per topic)
  • topic0_1_opr string and|or between topic0 & topic1
  • topic1 string topic (32 Bytes per topic)
  • topic1_2_opr string and|or between topic1 & topic2
  • topic2 string topic (32 Bytes per topic)
  • topic2_3_opr string and|or between topic2 & topic3
  • topic3 string topic (32 Bytes per topic)
  • topic0_2_opr string and|or between topic0 & topic2

Examples

https://etherscan.io/apis#logs

Returns Promise<object>

eth_blockNumber

Returns the number of most recent block

Examples

var block = api.proxy.eth_blockNumber();

Returns Promise<integer>

eth_getBlockByNumber

Returns information about a block by block number.

Parameters

Examples

var blockNumber = api.proxy.eth_getBlockByNumber('0x10d4f');

Returns Promise<integer>

eth_getUncleByBlockNumberAndIndex

Returns information about a uncle by block number.

Parameters

Examples

var res = api.proxy.eth_getUncleByBlockNumberAndIndex('0x210A9B', '0x0');

Returns Promise<object>

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block from a block matching the given block number

Parameters

Examples

var res = api.proxy.eth_getBlockTransactionCountByNumber('0x10FB78');

Returns Promise<object>

eth_getTransactionByHash

Returns the information about a transaction requested by transaction hash

Parameters

  • txhash
  • hash string Transaction hash

Examples

var res = api.proxy.eth_getTransactionByHash('0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1');

Returns Promise<object>

eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position

Parameters

Examples

var res = api.proxy.eth_getTransactionByBlockNumberAndIndex('0x10d4f', '0x0');

Returns Promise<object>

eth_getTransactionCount

Returns the number of transactions sent from an address

Parameters

  • address string Address of the transaction

Examples

var res = api.proxy.eth_getTransactionCount('0x2910543af39aba0cd09dbb2d50200b3e800a63d2', 'latest');

Returns Promise<object>

eth_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions

Parameters

  • hex string Serialized Message

Examples

var res = api.proxy.eth_sendRawTransaction('0xf904808000831cfde080');

Returns Promise<object>

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash

Parameters

  • txhash string Transaction hash

Examples

var ret = api.proxy.eth_getTransactionReceipt('0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1');

Returns Promise<object>

eth_call

Executes a new message call immediately without creating a transaction on the block chain

Parameters

Examples

var res = api.proxy.eth_call('0xAEEF46DB4855E25702F8237E8f403FddcaF931C0', '0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724', 'latest');

Returns Promise<object>

eth_getCode

Returns code at a given address

Parameters

Examples

var res = api.proxy.eth_getCode('0xf75e354c5edc8efed9b59ee9f67a80845ade7d0c',  'latest');

Returns Promise<object>

eth_getStorageAt

Returns the value from a storage position at a given address.

Parameters

Examples

var res = api.proxy.eth_getStorageAt('0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd', '0x0',  'latest');

Returns Promise<object>

eth_gasPrice

Returns the current price per gas in wei. var gasprice = api.proxy.eth_gasPrice();

Returns Promise<object>

eth_estimateGas

Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas

Parameters

Returns Promise<object>

tokensupply

Returns the supply of Tokens

Parameters

  • tokenname string Name of the Token
  • contractaddress string Address from token contract

Examples

var supply = api.stats.tokensupply(null, '0x57d90b64a1a57749b0f932f1a3395792e12e7055');

Returns Promise<object>

ethsupply

Returns total supply of ether var supply = api.stats.ethsupply();

Returns Promise<integer>

ethprice

Returns the price of ether now

Examples

var price = api.stats.ethprice();

Returns Promise<integer>

getblockreward

Find the block reward for a given address and block

Parameters

  • address string Address of the block
  • blockno string Block number

Returns Promise<object>

getstatus

returns the status of a specific transaction hash

Parameters

  • txhash string Transaction hash

Returns Promise<object>

getabi

Returns the ABI/Interface of a given contract

Parameters

  • address string Contract address

Examples

api.contract
 .getabi('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
 .at('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
 .memberId('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
 .then(console.log)

Returns Promise<object>

tokenbalance

Returns the amount of Tokens a specific account owns.

Parameters

  • address string Contract address
  • tokenname string Name of the token
  • contractaddress string Contract address

Examples

var supply = api.account.tokenbalance(
      '0x4366ddc115d8cf213c564da36e64c8ebaa30cdbd',
      '',
      '0xe0b7927c4af23765cb51314a0e0521a9645f0e2a' // DGD contract address
);

Returns Promise<object>

balance

Returns the balance of a sepcific account

Parameters

Examples

var balance = api.account.balance('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae');

Returns Promise<object>

txlistinternal

Get a list of internal transactions

Parameters

  • txhash string Transaction hash. If specified then address will be ignored
  • address string Transaction address
  • startblock string start looking here
  • endblock string end looking there
  • sort string Sort asc/desc

Examples

var txlist = api.account.txlistinternal('0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170');

Returns Promise<object>

txlist

Get a list of transactions for a specfic address

Parameters

  • address string Transaction address
  • startblock string start looking here
  • endblock string end looking there
  • page number Page number
  • offset number Max records to return
  • sort string Sort asc/desc

Examples

var txlist = api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 1, 100, 'asc');

Returns Promise<object>

getminedblocks

Get a list of blocks that a specific account has mineds

Parameters

  • address string Transaction hash

Examples

var txlist = api.account.getminedblocks('0x9dd134d14d1e65f84b706d6f205cd5b1cd03a46b');

tokentx

[BETA] Get a list of "ERC20 - Token Transfer Events" by Address

Parameters

  • address string Account address
  • contractaddress string Address of ERC20 token contract (if not specified lists transfers for all tokens)
  • startblock string start looking here
  • endblock string end looking there
  • sort string Sort asc/desc

Examples

var txlist = api.account.tokentx('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', '0x5F988D968cb76c34C87e6924Cc1Ef1dCd4dE75da', 1, 'latest', 'asc');

Returns Promise<object>

pickChainUrl

Parameters

Returns string

getRequest

Parameters

  • query

Returns Promise<any>