etherscan-api
    Preparing search index...

    Interface EtherscanApi

    The namespaced Etherscan API returned by init.

    interface EtherscanApi {
        account: {
            balance(
                address: string | string[],
            ): Promise<EtherscanResponse<string | MultiBalanceItem[]>>;
            fundedby(address: string): Promise<EtherscanResponse<unknown>>;
            getdeposittxs(
                address: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<unknown>>;
            getminedblocks(address: string): Promise<EtherscanResponse<MinedBlock[]>>;
            getwithdrawaltxs(
                address: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<unknown>>;
            token1155tx(
                address: string,
                contractaddress?: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<Erc1155Transfer[]>>;
            tokenbalance(
                address?: string,
                tokenname?: string,
                contractaddress?: string,
            ): Promise<EtherscanResponse<string>>;
            tokennfttx(
                address: string,
                contractaddress?: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<Erc721Transfer[]>>;
            tokentx(
                address: string,
                contractaddress?: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<Erc20Transfer[]>>;
            txlist(
                address: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<NormalTransaction[]>>;
            txlistinternal(
                txhash?: string,
                address?: string,
                startblock?: string | number,
                endblock?: string | number,
                sort?: string,
            ): Promise<EtherscanResponse<InternalTransaction[]>>;
            txsBeaconWithdrawal(
                address: string,
                startblock?: string | number,
                endblock?: string | number,
                page?: number,
                offset?: number,
                sort?: string,
            ): Promise<EtherscanResponse<unknown>>;
        };
        block: {
            getblockcountdown(
                blockno: string | number,
            ): Promise<EtherscanResponse<BlockCountdown>>;
            getblocknobytime(
                timestamp: string | number,
                closest?: "before" | "after",
            ): Promise<EtherscanResponse<string>>;
            getblockreward(
                address: string,
                blockno?: string | number,
            ): Promise<EtherscanResponse<BlockReward>>;
        };
        contract: {
            checkproxyverification(
                guid: string,
            ): Promise<EtherscanResponse<string>>;
            checkverifystatus(guid: string): Promise<EtherscanResponse<string>>;
            getabi(address: string): Promise<EtherscanResponse<string>>;
            getcontractcreation(
                contractaddresses: string | string[],
            ): Promise<EtherscanResponse<ContractCreation[]>>;
            getsourcecode(
                address: string,
            ): Promise<EtherscanResponse<ContractSource[]>>;
            verifyproxycontract(
                address: string,
                expectedimplementation?: string,
            ): Promise<EtherscanResponse<string>>;
            verifysourcecode(
                params: VerifySourceCodeParams,
            ): Promise<EtherscanResponse<string>>;
            verifystylus(params: VerifyParams): Promise<EtherscanResponse<string>>;
            verifyvyper(params: VerifyParams): Promise<EtherscanResponse<string>>;
            verifyzksyncsourcecode(
                params: VerifyParams,
            ): Promise<EtherscanResponse<string>>;
        };
        gastracker: {
            gasestimate(
                gasprice: string | number,
            ): Promise<EtherscanResponse<string>>;
            gasoracle(): Promise<EtherscanResponse<GasOracle>>;
        };
        log: {
            getLogs(
                address?: string,
                fromBlock?: string | number,
                toBlock?: string | number,
                topic0?: string,
                topic0_1_opr?: string,
                topic1?: string,
                topic1_2_opr?: string,
                topic2?: string,
                topic2_3_opr?: string,
                topic3?: string,
                topic0_2_opr?: string,
                page?: number,
                offset?: number,
            ): Promise<EtherscanResponse<EventLog[]>>;
        };
        proxy: {
            eth_blockNumber(): Promise<EtherscanResponse<string>>;
            eth_call(
                to: string,
                data: string,
                tag: string,
            ): Promise<EtherscanResponse<string>>;
            eth_estimateGas(
                to: string,
                value: string,
                gasPrice: string,
                gas: string,
            ): Promise<EtherscanResponse<string>>;
            eth_gasPrice(): Promise<EtherscanResponse<string>>;
            eth_getBlockByNumber(
                tag: string,
                fullTransactions?: boolean,
            ): Promise<EtherscanResponse<unknown>>;
            eth_getBlockTransactionCountByNumber(
                tag: string,
            ): Promise<EtherscanResponse<string>>;
            eth_getCode(
                address: string,
                tag: string,
            ): Promise<EtherscanResponse<string>>;
            eth_getStorageAt(
                address: string,
                position: string,
                tag: string,
            ): Promise<EtherscanResponse<string>>;
            eth_getTransactionByBlockNumberAndIndex(
                tag: string,
                index: string,
            ): Promise<EtherscanResponse<unknown>>;
            eth_getTransactionByHash(
                txhash: string,
            ): Promise<EtherscanResponse<unknown>>;
            eth_getTransactionCount(
                address: string,
            ): Promise<EtherscanResponse<string>>;
            eth_getTransactionReceipt(
                txhash: string,
            ): Promise<EtherscanResponse<unknown>>;
            eth_getUncleByBlockNumberAndIndex(
                tag: string,
                index: string,
            ): Promise<EtherscanResponse<unknown>>;
            eth_sendRawTransaction(hex: string): Promise<EtherscanResponse<string>>;
        };
        stats: {
            ethprice(): Promise<EtherscanResponse<EthPrice>>;
            ethsupply(): Promise<EtherscanResponse<string>>;
            ethsupply2(): Promise<EtherscanResponse<string>>;
            nodecount(): Promise<EtherscanResponse<string>>;
            tokensupply(
                tokenname?: string | null,
                contractaddress?: string,
            ): Promise<EtherscanResponse<string>>;
        };
        transaction: {
            getstatus(txhash: string): Promise<EtherscanResponse<ExecutionStatus>>;
            gettxreceiptstatus(
                txhash: string,
            ): Promise<EtherscanResponse<ReceiptStatus>>;
        };
        usage: {
            chainlist(): Promise<EtherscanResponse<ChainListItem[]>>;
            getapilimit(): Promise<EtherscanResponse<unknown>>;
        };
    }
    Index

    Properties

    account: {
        balance(
            address: string | string[],
        ): Promise<EtherscanResponse<string | MultiBalanceItem[]>>;
        fundedby(address: string): Promise<EtherscanResponse<unknown>>;
        getdeposittxs(
            address: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<unknown>>;
        getminedblocks(address: string): Promise<EtherscanResponse<MinedBlock[]>>;
        getwithdrawaltxs(
            address: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<unknown>>;
        token1155tx(
            address: string,
            contractaddress?: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<Erc1155Transfer[]>>;
        tokenbalance(
            address?: string,
            tokenname?: string,
            contractaddress?: string,
        ): Promise<EtherscanResponse<string>>;
        tokennfttx(
            address: string,
            contractaddress?: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<Erc721Transfer[]>>;
        tokentx(
            address: string,
            contractaddress?: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<Erc20Transfer[]>>;
        txlist(
            address: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<NormalTransaction[]>>;
        txlistinternal(
            txhash?: string,
            address?: string,
            startblock?: string | number,
            endblock?: string | number,
            sort?: string,
        ): Promise<EtherscanResponse<InternalTransaction[]>>;
        txsBeaconWithdrawal(
            address: string,
            startblock?: string | number,
            endblock?: string | number,
            page?: number,
            offset?: number,
            sort?: string,
        ): Promise<EtherscanResponse<unknown>>;
    }

    Type Declaration

    • balance: function
      • Returns the balance of a specific account, or several accounts when given an array (uses the balancemulti action).

        Parameters

        • address: string | string[]

          A single address, or an array of addresses

        Returns Promise<EtherscanResponse<string | MultiBalanceItem[]>>

        api.account.balance('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae');
        
    • fundedby: function
    • getdeposittxs: function
      • Get the list of L2 deposit transactions for an address.

        Parameters

        • address: string

          Account address

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<unknown>>

    • getminedblocks: function
    • getwithdrawaltxs: function
      • Get the list of L2 withdrawal transactions for an address.

        Parameters

        • address: string

          Account address

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<unknown>>

    • token1155tx: function
      • Get a list of "ERC1155 - Token Transfer Events" by address.

        Parameters

        • address: string

          Account address

        • Optionalcontractaddress: string

          ERC1155 token contract address (omit for all tokens)

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<Erc1155Transfer[]>>

    • tokenbalance: function
      • Returns the amount of Tokens a specific account owns.

        Parameters

        • Optionaladdress: string

          Account address

        • Optionaltokenname: string

          Name of the token

        • Optionalcontractaddress: string

          Token contract address

        Returns Promise<EtherscanResponse<string>>

        api.account.tokenbalance(
        '0x4366ddc115d8cf213c564da36e64c8ebaa30cdbd',
        '',
        '0xe0b7927c4af23765cb51314a0e0521a9645f0e2a'
        );
    • tokennfttx: function
      • Get a list of "ERC721 - Token Transfer Events" by address.

        Parameters

        • address: string

          Account address

        • Optionalcontractaddress: string

          ERC721 token contract address (omit for all tokens)

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<Erc721Transfer[]>>

    • tokentx: function
      • Get a list of "ERC20 - Token Transfer Events" by address.

        Parameters

        • address: string

          Account address

        • Optionalcontractaddress: string

          ERC20 token contract address (omit for all tokens)

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<Erc20Transfer[]>>

    • txlist: function
      • Get a list of transactions for a specific address.

        Parameters

        • address: string

          Account address

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<NormalTransaction[]>>

        api.account.txlist('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', 1, 'latest', 1, 100, 'asc');
        
    • txlistinternal: function
      • Get a list of internal transactions.

        Parameters

        • Optionaltxhash: string

          Transaction hash. If specified then address is ignored

        • Optionaladdress: string

          Account address

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<InternalTransaction[]>>

        api.account.txlistinternal('0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170');
        
    • txsBeaconWithdrawal: function
      • Get the beacon chain withdrawals made to an address.

        Parameters

        • address: string

          Account address

        • Optionalstartblock: string | number

          Start block

        • Optionalendblock: string | number

          End block

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        • Optionalsort: string

          Sort asc/desc

        Returns Promise<EtherscanResponse<unknown>>

    block: {
        getblockcountdown(
            blockno: string | number,
        ): Promise<EtherscanResponse<BlockCountdown>>;
        getblocknobytime(
            timestamp: string | number,
            closest?: "before" | "after",
        ): Promise<EtherscanResponse<string>>;
        getblockreward(
            address: string,
            blockno?: string | number,
        ): Promise<EtherscanResponse<BlockReward>>;
    }

    Type Declaration

    • getblockcountdown: function
    • getblocknobytime: function
      • Returns the block number that was mined at a certain timestamp.

        Parameters

        • timestamp: string | number

          Unix timestamp in seconds

        • closest: "before" | "after" = 'before'

          Return the closest block 'before' (default) or 'after' the timestamp

        Returns Promise<EtherscanResponse<string>>

    • getblockreward: function
    contract: {
        checkproxyverification(guid: string): Promise<EtherscanResponse<string>>;
        checkverifystatus(guid: string): Promise<EtherscanResponse<string>>;
        getabi(address: string): Promise<EtherscanResponse<string>>;
        getcontractcreation(
            contractaddresses: string | string[],
        ): Promise<EtherscanResponse<ContractCreation[]>>;
        getsourcecode(
            address: string,
        ): Promise<EtherscanResponse<ContractSource[]>>;
        verifyproxycontract(
            address: string,
            expectedimplementation?: string,
        ): Promise<EtherscanResponse<string>>;
        verifysourcecode(
            params: VerifySourceCodeParams,
        ): Promise<EtherscanResponse<string>>;
        verifystylus(params: VerifyParams): Promise<EtherscanResponse<string>>;
        verifyvyper(params: VerifyParams): Promise<EtherscanResponse<string>>;
        verifyzksyncsourcecode(
            params: VerifyParams,
        ): Promise<EtherscanResponse<string>>;
    }

    Type Declaration

    gastracker: {
        gasestimate(
            gasprice: string | number,
        ): Promise<EtherscanResponse<string>>;
        gasoracle(): Promise<EtherscanResponse<GasOracle>>;
    }

    Type Declaration

    log: {
        getLogs(
            address?: string,
            fromBlock?: string | number,
            toBlock?: string | number,
            topic0?: string,
            topic0_1_opr?: string,
            topic1?: string,
            topic1_2_opr?: string,
            topic2?: string,
            topic2_3_opr?: string,
            topic3?: string,
            topic0_2_opr?: string,
            page?: number,
            offset?: number,
        ): Promise<EtherscanResponse<EventLog[]>>;
    }

    Type Declaration

    • getLogs: function
      • The Event Log API — an alternative to the native eth_getLogs. Only the arguments you provide are sent.

        Parameters

        • Optionaladdress: string

          Address to filter logs by

        • OptionalfromBlock: string | number

          From block

        • OptionaltoBlock: string | number

          To block

        • Optionaltopic0: string

          Topic 0 (32 bytes)

        • Optionaltopic0_1_opr: string

          and|or operator between topic0 & topic1

        • Optionaltopic1: string

          Topic 1 (32 bytes)

        • Optionaltopic1_2_opr: string

          and|or operator between topic1 & topic2

        • Optionaltopic2: string

          Topic 2 (32 bytes)

        • Optionaltopic2_3_opr: string

          and|or operator between topic2 & topic3

        • Optionaltopic3: string

          Topic 3 (32 bytes)

        • Optionaltopic0_2_opr: string

          and|or operator between topic0 & topic2

        • Optionalpage: number

          Page number

        • Optionaloffset: number

          Max records to return

        Returns Promise<EtherscanResponse<EventLog[]>>

    proxy: {
        eth_blockNumber(): Promise<EtherscanResponse<string>>;
        eth_call(
            to: string,
            data: string,
            tag: string,
        ): Promise<EtherscanResponse<string>>;
        eth_estimateGas(
            to: string,
            value: string,
            gasPrice: string,
            gas: string,
        ): Promise<EtherscanResponse<string>>;
        eth_gasPrice(): Promise<EtherscanResponse<string>>;
        eth_getBlockByNumber(
            tag: string,
            fullTransactions?: boolean,
        ): Promise<EtherscanResponse<unknown>>;
        eth_getBlockTransactionCountByNumber(
            tag: string,
        ): Promise<EtherscanResponse<string>>;
        eth_getCode(
            address: string,
            tag: string,
        ): Promise<EtherscanResponse<string>>;
        eth_getStorageAt(
            address: string,
            position: string,
            tag: string,
        ): Promise<EtherscanResponse<string>>;
        eth_getTransactionByBlockNumberAndIndex(
            tag: string,
            index: string,
        ): Promise<EtherscanResponse<unknown>>;
        eth_getTransactionByHash(
            txhash: string,
        ): Promise<EtherscanResponse<unknown>>;
        eth_getTransactionCount(
            address: string,
        ): Promise<EtherscanResponse<string>>;
        eth_getTransactionReceipt(
            txhash: string,
        ): Promise<EtherscanResponse<unknown>>;
        eth_getUncleByBlockNumberAndIndex(
            tag: string,
            index: string,
        ): Promise<EtherscanResponse<unknown>>;
        eth_sendRawTransaction(hex: string): Promise<EtherscanResponse<string>>;
    }

    Type Declaration

    • eth_blockNumber: function
    • eth_call: function
      • Executes a new message call immediately without creating a transaction (hex).

        Parameters

        • to: string

          Address to execute against

        • data: string

          Hash of the method signature and encoded parameters

        • tag: string

          Block number tag

        Returns Promise<EtherscanResponse<string>>

    • eth_estimateGas: function
      • Estimates the gas needed for a transaction without adding it to the chain (hex).

        Parameters

        • to: string

          Address to interact with

        • value: string

          Value sent in the transaction

        • gasPrice: string

          Gas price in wei

        • gas: string

          Gas provided

        Returns Promise<EtherscanResponse<string>>

    • eth_gasPrice: function
    • eth_getBlockByNumber: function
      • Returns information about a block by block number.

        Parameters

        • tag: string

          Block number tag, e.g. '0x10d4f'

        • fullTransactions: boolean = true

          When true (default) returns full transaction objects, otherwise only hashes

        Returns Promise<EtherscanResponse<unknown>>

    • eth_getBlockTransactionCountByNumber: function
      • Returns the number of transactions in a block matching the given block number (hex).

        Parameters

        • tag: string

          Block number tag

        Returns Promise<EtherscanResponse<string>>

    • eth_getCode: function
      • Returns code at a given address (hex).

        Parameters

        • address: string

          Address to get code from

        • tag: string

          Block number tag

        Returns Promise<EtherscanResponse<string>>

    • eth_getStorageAt: function
      • Returns the value from a storage position at a given address (hex).

        Parameters

        • address: string

          Address to get storage from

        • position: string

          Storage position

        • tag: string

          Block number tag

        Returns Promise<EtherscanResponse<string>>

    • eth_getTransactionByBlockNumberAndIndex: function
      • Returns information about a transaction by block number and index.

        Parameters

        • tag: string

          Block number tag

        • index: string

          Transaction index position

        Returns Promise<EtherscanResponse<unknown>>

    • eth_getTransactionByHash: function
    • eth_getTransactionCount: function
      • Returns the number of transactions sent from an address (hex).

        Parameters

        • address: string

          Account address

        Returns Promise<EtherscanResponse<string>>

    • eth_getTransactionReceipt: function
    • eth_getUncleByBlockNumberAndIndex: function
      • Returns information about an uncle by block number and index.

        Parameters

        • tag: string

          Block number tag

        • index: string

          Uncle index position

        Returns Promise<EtherscanResponse<unknown>>

    • eth_sendRawTransaction: function
      • Submits a pre-signed transaction for broadcast. Resolves with the tx hash.

        Parameters

        • hex: string

          Serialized signed message

        Returns Promise<EtherscanResponse<string>>

    stats: {
        ethprice(): Promise<EtherscanResponse<EthPrice>>;
        ethsupply(): Promise<EtherscanResponse<string>>;
        ethsupply2(): Promise<EtherscanResponse<string>>;
        nodecount(): Promise<EtherscanResponse<string>>;
        tokensupply(
            tokenname?: string | null,
            contractaddress?: string,
        ): Promise<EtherscanResponse<string>>;
    }

    Type Declaration

    transaction: {
        getstatus(txhash: string): Promise<EtherscanResponse<ExecutionStatus>>;
        gettxreceiptstatus(
            txhash: string,
        ): Promise<EtherscanResponse<ReceiptStatus>>;
    }

    Type Declaration

    usage: {
        chainlist(): Promise<EtherscanResponse<ChainListItem[]>>;
        getapilimit(): Promise<EtherscanResponse<unknown>>;
    }

    Type Declaration