routescan-client
Version:
A set of classes to work with evm-compatible blockchain observers
795 lines (789 loc) • 27.6 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
BlockExplorerAction: () => BlockExplorerAction,
BlockExplorerClosest: () => BlockExplorerClosest,
BlockExplorerCodeFormat: () => BlockExplorerCodeFormat,
BlockExplorerCommon: () => BlockExplorerCommon,
BlockExplorerEthereum: () => BlockExplorerEthereum,
BlockExplorerModule: () => BlockExplorerModule,
BlockExplorerRoutescan: () => BlockExplorerRoutescan,
BlockExplorerSort: () => BlockExplorerSort,
BlockExplorerStatus: () => BlockExplorerStatus,
BlockExplorerTag: () => BlockExplorerTag,
BlockExplorerTopicOperation: () => BlockExplorerTopicOperation,
Chain: () => Chain
});
module.exports = __toCommonJS(index_exports);
// src/types/chains.ts
var Chain = /* @__PURE__ */ ((Chain2) => {
Chain2[Chain2["NotSpecified"] = 0] = "NotSpecified";
Chain2[Chain2["Ethereum"] = 1] = "Ethereum";
Chain2[Chain2["EthereumGoerli"] = 5] = "EthereumGoerli";
Chain2[Chain2["EthereumHolesky"] = 17e3] = "EthereumHolesky";
Chain2[Chain2["EthereumSepolia"] = 11155111] = "EthereumSepolia";
Chain2[Chain2["Optimism"] = 10] = "Optimism";
Chain2[Chain2["OptimismGoerli"] = 420] = "OptimismGoerli";
Chain2[Chain2["OptimismSepolia"] = 11155420] = "OptimismSepolia";
Chain2[Chain2["FlareMainnet"] = 14] = "FlareMainnet";
Chain2[Chain2["FlareTestnet"] = 114] = "FlareTestnet";
Chain2[Chain2["Cronos"] = 25] = "Cronos";
Chain2[Chain2["CronosTestnet"] = 338] = "CronosTestnet";
Chain2[Chain2["BinanceSmartChain"] = 56] = "BinanceSmartChain";
Chain2[Chain2["BinanceSmartChainTestnet"] = 97] = "BinanceSmartChainTestnet";
Chain2[Chain2["BinanceOpBnbMainnet"] = 204] = "BinanceOpBnbMainnet";
Chain2[Chain2["BinanceOpBnbTestnet"] = 5611] = "BinanceOpBnbTestnet";
Chain2[Chain2["Polygon"] = 137] = "Polygon";
Chain2[Chain2["PolygonMumbai"] = 80001] = "PolygonMumbai";
Chain2[Chain2["PolygonAmoy"] = 80002] = "PolygonAmoy";
Chain2[Chain2["Mint"] = 185] = "Mint";
Chain2[Chain2["MintSepolia"] = 1687] = "MintSepolia";
Chain2[Chain2["Fantom"] = 250] = "Fantom";
Chain2[Chain2["FantomTestnet"] = 4002] = "FantomTestnet";
Chain2[Chain2["Filecoin"] = 314] = "Filecoin";
Chain2[Chain2["ZkSyncEra"] = 324] = "ZkSyncEra";
Chain2[Chain2["Mantle"] = 5e3] = "Mantle";
Chain2[Chain2["MantleSepolia"] = 5003] = "MantleSepolia";
Chain2[Chain2["Base"] = 8453] = "Base";
Chain2[Chain2["BaseGoerli"] = 84531] = "BaseGoerli";
Chain2[Chain2["BaseSepolia"] = 84532] = "BaseSepolia";
Chain2[Chain2["Arbitrum"] = 42161] = "Arbitrum";
Chain2[Chain2["ArbitrumNova"] = 42170] = "ArbitrumNova";
Chain2[Chain2["ArbitrumGoerli"] = 421613] = "ArbitrumGoerli";
Chain2[Chain2["ArbitrumSepolia"] = 421614] = "ArbitrumSepolia";
Chain2[Chain2["AvalancheCChain"] = 43114] = "AvalancheCChain";
Chain2[Chain2["AvalancheCChainFuji"] = 43113] = "AvalancheCChainFuji";
Chain2[Chain2["Celo"] = 42220] = "Celo";
Chain2[Chain2["CeloAlfajores"] = 44787] = "CeloAlfajores";
Chain2[Chain2["Linea"] = 59144] = "Linea";
Chain2[Chain2["LineaGoerli"] = 59140] = "LineaGoerli";
Chain2[Chain2["LineaSepolia"] = 59141] = "LineaSepolia";
Chain2[Chain2["Taiko"] = 167e3] = "Taiko";
Chain2[Chain2["TaikoHeklaL2"] = 167009] = "TaikoHeklaL2";
Chain2[Chain2["Dexalot"] = 432204] = "Dexalot";
Chain2[Chain2["DexalotTestnet"] = 432201] = "DexalotTestnet";
Chain2[Chain2["Palm"] = 11297108109] = "Palm";
Chain2[Chain2["PalmTestnet"] = 11297108099] = "PalmTestnet";
return Chain2;
})(Chain || {});
// src/data/chains.ts
var chains = [
{
id: 1 /* Ethereum */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.etherscan.io/api"
},
{
id: 17e3 /* EthereumHolesky */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-holesky.etherscan.io/api"
},
{
id: 11155111 /* EthereumSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia.etherscan.io/api"
},
{
id: 10 /* Optimism */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-optimistic.etherscan.io/api"
},
{
id: 11155420 /* OptimismSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia-optimistic.etherscan.io/api"
},
{
id: 56 /* BinanceSmartChain */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.bscscan.com/api"
},
{
id: 97 /* BinanceSmartChainTestnet */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-testnet.bscscan.com/api"
},
{
id: 204 /* BinanceOpBnbMainnet */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-opbnb.bscscan.com/api"
},
{
id: 5611 /* BinanceOpBnbTestnet */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-opbnb-testnet.bscscan.com/api"
},
{
id: 250 /* Fantom */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.ftmscan.com/api"
},
{
id: 4002 /* FantomTestnet */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-testnet.ftmscan.com/api"
},
{
id: 137 /* Polygon */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.polygonscan.com/api"
},
{
id: 80001 /* PolygonMumbai */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-testnet.polygonscan.com/api"
},
{
id: 80002 /* PolygonAmoy */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-amoy.polygonscan.com/api"
},
{
id: 8453 /* Base */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.basescan.org/api"
},
{
id: 84532 /* BaseSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia.basescan.org/api"
},
{
id: 42161 /* Arbitrum */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.arbiscan.io/api"
},
{
id: 42170 /* ArbitrumNova */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-nova.arbiscan.io/api"
},
{
id: 421614 /* ArbitrumSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia.arbiscan.io/api"
},
{
id: 43114 /* AvalancheCChain */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api"
},
{
id: 43113 /* AvalancheCChainFuji */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/testnet/evm/43113/etherscan/api"
},
{
id: 42220 /* Celo */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.celoscan.io/api"
},
{
id: 44787 /* CeloAlfajores */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-alfajores.celoscan.io/api"
},
{
id: 59144 /* Linea */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.lineascan.build/api"
},
{
id: 59141 /* LineaSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia.lineascan.build/api"
},
{
id: 167e3 /* Taiko */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.taikoscan.io/api"
},
{
id: 167009 /* TaikoHeklaL2 */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-hekla.taikoscan.io/api"
},
{
id: 432204 /* Dexalot */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/mainnet/evm/432204/etherscan/api"
},
{
id: 432201 /* DexalotTestnet */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/testnet/evm/432201/etherscan/api"
},
{
id: 14 /* FlareMainnet */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/mainnet/evm/14/etherscan/api"
},
{
id: 114 /* FlareTestnet */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/testnet/evm/114/etherscan/api"
},
{
id: 5e3 /* Mantle */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api.mantlescan.xyz/api"
},
{
id: 5003 /* MantleSepolia */,
blockExplorerType: "ethereum" /* Ethereum */,
blockExplorerUrl: "https://api-sepolia.mantlescan.xyz/api"
},
{
id: 185 /* Mint */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/mainnet/evm/185/etherscan/api"
},
{
id: 1687 /* MintSepolia */,
blockExplorerType: "routescan" /* Routescan */,
blockExplorerUrl: "https://api.routescan.io/v2/network/testnet/evm/1687/etherscan/api"
}
];
// src/classes/Transport.ts
var import_axios = __toESM(require("axios"));
var AxiosTransport = class {
constructor(url, apiKey, options = {}) {
this.url = url;
this.apiKey = apiKey;
this.options = options;
}
async get(options) {
const { apiKey } = this;
const response = await import_axios.default.get(this.url, {
...this.options,
headers: {
"User-Agent": ""
},
params: {
apikey: apiKey,
...options
}
});
return response;
}
async post(options = {}, params = {}) {
const { apiKey } = this;
const response = await import_axios.default.post(this.url, options, {
...this.options,
params: {
apikey: apiKey,
...params
},
headers: {
"User-Agent": ""
}
});
return response;
}
getApiKey() {
return this.apiKey;
}
getUrl() {
return this.url;
}
};
// src/types/params.ts
var BlockExplorerModule = /* @__PURE__ */ ((BlockExplorerModule2) => {
BlockExplorerModule2["Account"] = "account";
BlockExplorerModule2["Block"] = "block";
BlockExplorerModule2["Contract"] = "contract";
BlockExplorerModule2["Logs"] = "logs";
BlockExplorerModule2["Proxy"] = "proxy";
BlockExplorerModule2["Transaction"] = "transaction";
return BlockExplorerModule2;
})(BlockExplorerModule || {});
var BlockExplorerAction = /* @__PURE__ */ ((BlockExplorerAction2) => {
BlockExplorerAction2["Balance"] = "balance";
BlockExplorerAction2["BalanceMulti"] = "balancemulti";
BlockExplorerAction2["GetBlockByTime"] = "getblocknobytime";
BlockExplorerAction2["GetBlockCountdown"] = "getblockcountdown";
BlockExplorerAction2["GetLogs"] = "getLogs";
BlockExplorerAction2["TokenBalance"] = "tokenbalance";
BlockExplorerAction2["TxList"] = "txlist";
BlockExplorerAction2["TokenTxList"] = "tokentx";
BlockExplorerAction2["TxListInternal"] = "txlistinternal";
BlockExplorerAction2["eth_blockNumber"] = "eth_blockNumber";
BlockExplorerAction2["eth_getBlockByNumber"] = "eth_getBlockByNumber";
BlockExplorerAction2["eth_getUncleByBlockNumberAndIndex"] = "eth_getUncleByBlockNumberAndIndex";
BlockExplorerAction2["eth_getBlockTransactionCountByNumber"] = "eth_getBlockTransactionCountByNumber";
BlockExplorerAction2["eth_getTransactionByHash"] = "eth_getTransactionByHash";
BlockExplorerAction2["eth_getTransactionByBlockNumberAndIndex"] = "eth_getTransactionByBlockNumberAndIndex";
BlockExplorerAction2["eth_getTransactionCount"] = "eth_getTransactionCount";
BlockExplorerAction2["eth_sendRawTransaction"] = "eth_sendRawTransaction";
BlockExplorerAction2["eth_getTransactionReceipt"] = "eth_getTransactionReceipt";
BlockExplorerAction2["eth_call"] = "eth_call";
BlockExplorerAction2["eth_getCode"] = "eth_getCode";
BlockExplorerAction2["eth_getStorageAt"] = "eth_getStorageAt";
BlockExplorerAction2["eth_gasPrice"] = "eth_gasPrice";
BlockExplorerAction2["eth_estimateGas"] = "eth_estimateGas";
BlockExplorerAction2["GetStatus"] = "getstatus";
BlockExplorerAction2["GetTexReceiptStatus"] = "gettxreceiptstatus";
BlockExplorerAction2["VerifySourceCode"] = "verifysourcecode";
return BlockExplorerAction2;
})(BlockExplorerAction || {});
var BlockExplorerTag = /* @__PURE__ */ ((BlockExplorerTag2) => {
BlockExplorerTag2["Earliest"] = "earliest";
BlockExplorerTag2["Pending"] = "pending";
BlockExplorerTag2["Latest"] = "latest";
return BlockExplorerTag2;
})(BlockExplorerTag || {});
var BlockExplorerStatus = /* @__PURE__ */ ((BlockExplorerStatus2) => {
BlockExplorerStatus2["Success"] = "1";
BlockExplorerStatus2["Fail"] = "0";
return BlockExplorerStatus2;
})(BlockExplorerStatus || {});
var BlockExplorerSort = /* @__PURE__ */ ((BlockExplorerSort2) => {
BlockExplorerSort2["Asc"] = "asc";
BlockExplorerSort2["Desc"] = "desc";
return BlockExplorerSort2;
})(BlockExplorerSort || {});
var BlockExplorerClosest = /* @__PURE__ */ ((BlockExplorerClosest2) => {
BlockExplorerClosest2["Before"] = "before";
BlockExplorerClosest2["After"] = "after";
return BlockExplorerClosest2;
})(BlockExplorerClosest || {});
var BlockExplorerTopicOperation = /* @__PURE__ */ ((BlockExplorerTopicOperation2) => {
BlockExplorerTopicOperation2["And"] = "and";
BlockExplorerTopicOperation2["Or"] = "or";
return BlockExplorerTopicOperation2;
})(BlockExplorerTopicOperation || {});
var BlockExplorerCodeFormat = /* @__PURE__ */ ((BlockExplorerCodeFormat2) => {
BlockExplorerCodeFormat2["SoliditySingleFile"] = "solidity-single-file";
BlockExplorerCodeFormat2["SolidityStandardJsonInput"] = "solidity-standard-json-input";
return BlockExplorerCodeFormat2;
})(BlockExplorerCodeFormat || {});
// src/classes/BlockExplorer.ts
var TX_NO_FOUND_MESSAGE = "No transactions found";
var BlockExplorerCommon = class _BlockExplorerCommon {
constructor(options) {
this.chain = 0 /* NotSpecified */;
const { apiKey = "", chain, url = "", axiosOptions = {} } = options;
this.chain = chain;
const transportUrl = url || this.getBlockExplorerUrl(chain);
this.transport = new AxiosTransport(transportUrl, apiKey, axiosOptions);
}
static build(options) {
try {
const { chain } = options;
const chainOptions = _BlockExplorerCommon.getChainOptions(chain);
const { blockExplorerType } = chainOptions;
switch (blockExplorerType) {
case "ethereum" /* Ethereum */:
return new BlockExplorerEthereum(options);
case "routescan" /* Routescan */:
return new BlockExplorerRoutescan(options);
}
} catch (e) {
return new BlockExplorerEthereum(options);
}
}
getChain() {
return this.chain;
}
getApiKey() {
return this.transport.getApiKey();
}
getUrl() {
return this.transport.getUrl();
}
static getChainOptions(chain) {
if (!chain) {
throw new Error(`Chain id not specified`);
}
const chainOptions = chains.find(({ id }) => id === chain);
if (!chainOptions) {
throw new Error(`Chain with id of ${chain} is not supported`);
}
return chainOptions;
}
};
var BlockExplorerEthereum = class extends BlockExplorerCommon {
checkResponseStatus(response) {
if (response.data.status && response.data.status !== "1" /* Success */) {
throw new Error(JSON.stringify(response.data));
}
if (response.data?.error?.message) {
throw new Error(JSON.stringify(response.data));
}
}
async getBlockCountdownTime(options) {
const response = await this.transport.get({
...options,
module: "block" /* Block */,
action: "getblockcountdown" /* GetBlockCountdown */
});
this.checkResponseStatus(response);
return response.data.result;
}
async getBlockNumberByTimestamp(options) {
const { closest = "after" /* After */, timestamp } = options;
const response = await this.transport.get({
module: "block" /* Block */,
action: "getblocknobytime" /* GetBlockByTime */,
closest,
timestamp
});
this.checkResponseStatus(response);
return Number(response.data.result);
}
async getAccountBalance(options) {
const { address, tag = "latest" /* Latest */ } = options;
const response = await this.transport.get({
module: "account" /* Account */,
action: "balance" /* Balance */,
address,
tag
});
this.checkResponseStatus(response);
return BigInt(response.data.result);
}
async getAccountsBalances(options) {
const { address, tag = "latest" /* Latest */ } = options;
const response = await this.transport.get({
module: "account" /* Account */,
action: "balancemulti" /* BalanceMulti */,
address,
tag
});
this.checkResponseStatus(response);
return response.data.result.map(({ account, balance }) => ({
account,
balance: BigInt(balance)
}));
}
async getNormalTxListByAddress(options) {
const response = await this.transport.get({
...options,
module: "account" /* Account */,
action: "txlist" /* TxList */
});
if (response.data.message === TX_NO_FOUND_MESSAGE) {
return [];
}
this.checkResponseStatus(response);
return response.data.result;
}
async getInternalTxListByAddress(options) {
const response = await this.transport.get({
...options,
module: "account" /* Account */,
action: "txlistinternal" /* TxListInternal */
});
if (response.data.message === TX_NO_FOUND_MESSAGE) {
return [];
}
this.checkResponseStatus(response);
return response.data.result;
}
async getInternalTxListByTxHash(options) {
const response = await this.transport.get({
...options,
module: "account" /* Account */,
action: "txlistinternal" /* TxListInternal */
});
if (response.data.message === TX_NO_FOUND_MESSAGE) {
return [];
}
this.checkResponseStatus(response);
return response.data.result;
}
async getErc20TokenTransferEventsList(options) {
const response = await this.transport.get({
...options,
module: "account" /* Account */,
action: "tokentx" /* TokenTxList */
});
this.checkResponseStatus(response);
return response.data.result;
}
async getAccountTokenBalance(options) {
const { address, contractAddress, tag = "latest" /* Latest */ } = options;
const response = await this.transport.get({
module: "account" /* Account */,
action: "tokenbalance" /* TokenBalance */,
address,
contractaddress: contractAddress,
tag
});
this.checkResponseStatus(response);
return BigInt(response.data.result);
}
async getEventLogsByAddress(options) {
const response = await this.transport.get({
...options,
module: "logs" /* Logs */,
action: "getLogs" /* GetLogs */
});
this.checkResponseStatus(response);
return response.data.result;
}
async getEventLogsByTopics(options) {
const response = await this.transport.get({
...options,
module: "logs" /* Logs */,
action: "getLogs" /* GetLogs */
});
this.checkResponseStatus(response);
return response.data.result;
}
async getEventLogsByAddressFiltered(options) {
const response = await this.transport.get({
...options,
module: "logs" /* Logs */,
action: "getLogs" /* GetLogs */
});
this.checkResponseStatus(response);
return response.data.result;
}
getBlockExplorerUrl(chain = this.chain) {
const chainOptions = BlockExplorerCommon.getChainOptions(chain);
const { blockExplorerUrl } = chainOptions;
return blockExplorerUrl;
}
/**
* Contracts
* https://routescan.io/documentation/etherscan-compatibility/contracts
*/
async verifySoliditySourceCode(options) {
const response = await this.transport.post(
{
...options
},
{
module: "contract" /* Contract */,
action: "verifysourcecode" /* VerifySourceCode */
}
);
this.checkResponseStatus(response);
return response.data.result;
}
/**
* Geth/Parity Proxy
* https://docs.etherscan.io/api-endpoints/geth-parity-proxy
*/
async eth_blockNumber() {
const { chain: chainid } = this;
const response = await this.transport.get({
chainid,
module: "proxy" /* Proxy */,
action: "eth_blockNumber" /* eth_blockNumber */
});
this.checkResponseStatus(response);
return BigInt(response.data.result);
}
async eth_getBlockByNumber(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getBlockByNumber" /* eth_getBlockByNumber */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getUncleByBlockNumberAndIndex(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getUncleByBlockNumberAndIndex" /* eth_getUncleByBlockNumberAndIndex */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getBlockTransactionCountByNumber(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getBlockTransactionCountByNumber" /* eth_getBlockTransactionCountByNumber */
});
this.checkResponseStatus(response);
return BigInt(response.data.result);
}
async eth_getTransactionByHash(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getTransactionByHash" /* eth_getTransactionByHash */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getTransactionByBlockNumberAndIndex(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getTransactionByBlockNumberAndIndex" /* eth_getTransactionByBlockNumberAndIndex */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getTransactionCount(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getTransactionCount" /* eth_getTransactionCount */
});
this.checkResponseStatus(response);
return BigInt(response.data.result);
}
async eth_sendRawTransaction(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_sendRawTransaction" /* eth_sendRawTransaction */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getTransactionReceipt(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getTransactionReceipt" /* eth_getTransactionReceipt */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_call(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_call" /* eth_call */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getCode(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getCode" /* eth_getCode */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_getStorageAt(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_getStorageAt" /* eth_getStorageAt */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_gasPrice() {
const { chain: chainid } = this;
const response = await this.transport.get({
chainid,
module: "proxy" /* Proxy */,
action: "eth_gasPrice" /* eth_gasPrice */
});
this.checkResponseStatus(response);
return response.data.result;
}
async eth_estimateGas(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "proxy" /* Proxy */,
action: "eth_estimateGas" /* eth_estimateGas */
});
this.checkResponseStatus(response);
return response.data.result;
}
async getContractExecutionStatus(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "transaction" /* Transaction */,
action: "getstatus" /* GetStatus */
});
this.checkResponseStatus(response);
return response.data.result;
}
async checkTransactionReceiptStatus(options) {
const { chain: chainid } = this;
const response = await this.transport.get({
...options,
chainid,
module: "transaction" /* Transaction */,
action: "gettxreceiptstatus" /* GetTexReceiptStatus */
});
this.checkResponseStatus(response);
return response.data.result;
}
};
var BlockExplorerRoutescan = class extends BlockExplorerEthereum {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BlockExplorerAction,
BlockExplorerClosest,
BlockExplorerCodeFormat,
BlockExplorerCommon,
BlockExplorerEthereum,
BlockExplorerModule,
BlockExplorerRoutescan,
BlockExplorerSort,
BlockExplorerStatus,
BlockExplorerTag,
BlockExplorerTopicOperation,
Chain
});
//# sourceMappingURL=index.js.map