@evmexplorer/blockscout
Version:
EVM Explorer TypeScript BlockScout V2 sdk
491 lines (482 loc) • 15.4 kB
TypeScript
type TokenBlockscout = {
address: string;
circulating_market_cap: string | null;
decimals: string | null;
exchange_rate: string | null;
holders: string;
icon_url: string | null;
name: string;
symbol: string;
total_supply: string | null;
type: 'ERC-20' | 'ERC-721' | 'ERC-1155';
volume_24h: string | null;
};
declare function fetchTokenInfo(address: string, chainId?: number): Promise<TokenBlockscout>;
type NFTIdBlockscout = {
animation_url: null | string;
external_app_url: null | string;
id: string;
image_url: string;
is_unique: boolean;
media_type: null;
media_url: string;
metadata: NFTMetadataBlockscout;
owner: NFTOwnerBlockscout;
thumbnails: null;
token: TokenBlockscout;
};
type NFTOwnerBlockscout = {
ens_domain_name: null | string;
hash: string;
implementations: [];
is_contract: boolean;
is_scam: boolean;
is_verified: boolean;
metadata: null;
name: null | string;
private_tags: [];
proxy_type: null;
public_tags: [];
watchlist_names: [];
};
type NFTMetadataBlockscout = {
attributes: {
trait_type: string;
value: string;
}[];
description?: string;
external_url?: string;
home_url?: string;
image?: string;
image_url?: string;
name?: string;
properties?: [];
tags?: string[];
year?: number;
};
declare function fetchNFTIdInfo(contract: string, id: string, chainId?: number): Promise<NFTIdBlockscout>;
type Fee = {
type: string;
value: string;
};
type DecodedInput = {
method_call: string;
method_id: string;
parameters: TransactionParameter[];
};
type TransactionParameter = {
name: string;
type: string;
value: string;
};
type TokenTransferBlockscout = {
block_hash: string;
from: TransactionAddressBlockscout;
to: TransactionAddressBlockscout;
log_index: string;
method: null;
timestamp: null;
token: TokenBlockscout;
total: {
token_id: string;
decimals?: string | null;
value?: string;
};
tx_hash: string;
type: string;
};
type TransactionAddressBlockscout = {
ens_domain_name: string | null;
hash: string;
implementations: [];
is_contract: boolean;
is_scam?: boolean;
is_verified: boolean;
metadata: Object | null;
name: string | null;
private_tags: [];
proxy_type: string | null;
public_tags: [];
watchlist_names: [];
};
type TransactionBlockscout = {
priority_fee: string | null;
tx_burnt_fee: string | null;
raw_input: string;
result: 'success' | 'Reverted';
hash: string;
max_fee_per_gas: string;
revert_reason: Object | null;
confirmation_duration: number[];
type: number;
token_transfers_overflow: null;
confirmations: number;
position: number;
max_priority_fee_per_gas: string;
transaction_tag: null;
created_contract: null | TransactionAddressBlockscout;
value: string;
tx_types: string[];
from: TransactionAddressBlockscout;
gas_used: string;
status: 'ok' | 'error';
to: TransactionAddressBlockscout | null;
authorization_list: [];
method: string | null;
fee: Fee;
tx_tag: null;
actions: [];
gas_limit: string;
gas_price: string;
decoded_input: DecodedInput | null;
has_error_in_internal_txs?: boolean;
token_transfers: null | TokenTransferBlockscout[];
base_fee_per_gas: string;
timestamp?: string;
nonce: number;
block?: number | null;
transaction_types: string[];
exchange_rate: string;
block_number: number;
has_error_in_internal_transactions: boolean;
};
type NextPageParams = {
block_number: number;
fee: string;
hash: string;
index: number;
inserted_at: string;
items_count: number;
value: string;
};
declare function fetchTransactionBlockscout(hash: string, chainId?: number): Promise<TransactionBlockscout>;
type AddressInfoBlockscout = {
block_number_balance_updated_at: number;
coin_balance: string;
creation_transaction_hash: string | null;
creator_address_hash: string | null;
ens_domain_name: string | null;
exchange_rate: string;
has_beacon_chain_withdrawals: boolean;
has_decompiled_code: boolean;
has_logs: boolean;
has_token_transfers: boolean;
has_tokens: boolean;
has_validated_blocks: boolean;
hash: string;
implementations: [];
is_contract: boolean;
is_scam: boolean;
is_verified: boolean | null;
metadata: null;
name: string;
private_tags: [];
proxy_type: null;
public_tags: [];
token: TokenBlockscout | null;
watchlist_address_id: null;
watchlist_names: [];
};
type AddressTransactionsBlockscout = {
items: TransactionBlockscout[];
next_page_params: NextPageParams | null;
};
type CountersContractBlockscout = {
gas_usage_count: string;
token_transfers_count: string;
transactions_count: string;
validations_count: string;
};
type InternalTransactionsObject = {
block_index: number;
block_number: number;
created_contract: null;
error: null;
from: TransactionAddressBlockscout;
gas_limit: string;
index: number;
success: boolean;
timestamp: string;
to: TransactionAddressBlockscout;
transaction_hash: string;
transaction_index: number;
type: 'delegatecall' | 'call';
value: string;
};
type NextPageInternalParams = {
block_number: number;
index: number;
items_count: number;
transaction_index: number;
};
type InternalTransactionsBlockscout = {
items: InternalTransactionsObject[];
next_page_params: NextPageInternalParams;
};
type TokenTransfersObject = {
block_hash: string;
block_number: number;
from: TransactionAddressBlockscout;
log_index: number;
method: string;
timestamp: string;
to: TransactionAddressBlockscout;
token: TokenBlockscout;
total: {
decimals: number | null;
value: string;
};
transaction_hash: string;
type: 'token_transfer' | 'token_transfers' | 'token_minting';
};
type NextPageTokenTransfersParams = {
block_number: number;
index: number;
};
type TokenTransfersBlockscout = {
items: TokenTransfersObject[];
next_page_params: NextPageTokenTransfersParams;
};
declare function fetchAddressCounters(address: string, chainId?: number): Promise<CountersContractBlockscout>;
declare function fetchAddressTransactions(address: string, parameters?: string, chainId?: number): Promise<AddressTransactionsBlockscout>;
declare function fetchAddressInfo(address: string, chainId?: number): Promise<AddressInfoBlockscout>;
declare function fetchInternalTransactionsBlockscout(address: string, parameters?: string, chainId?: number): Promise<InternalTransactionsBlockscout>;
declare function fetchTokenTransfersBlockscout(address: string, parameters?: string, chainId?: number): Promise<TokenTransfersBlockscout>;
type AddressTokens = {
token: {
address: string;
circulating_market_cap: string | null;
decimals: string | null;
exchange_rate: string | null;
holders: string;
icon_url: string | null;
name: string;
symbol: string;
total_supply: string;
type: 'ERC-20' | 'ERC-721';
volume_24h: string | null;
};
token_id: null;
token_instance: null;
value: string;
};
declare function fetchTokensAddress(address: string, chainId?: number): Promise<AddressTokens[]>;
type BlockInfoBlockscout = {
base_fee_per_gas: string;
blob_gas_price: string | null;
blob_gas_used: string;
blob_transaction_count: number;
burnt_blob_fees: string;
burnt_fees: string;
burnt_fees_percentage: number;
difficulty: string;
excess_blob_gas: string;
gas_limit: string;
gas_target_percentage: number;
gas_used: string;
gas_used_percentage: number;
hash: string;
height: number;
miner: TransactionAddressBlockscout;
nonce: string;
parent_hash: string;
priority_fee: string;
rewards: [{
reward: string;
type: 'Miner Reward';
}];
size: number;
timestamp: string;
total_difficulty: string;
transaction_count: number;
transaction_fees: string;
type: 'block';
uncles_hashes: [];
withdrawals_count: number;
};
type BlockTransactionsBlockscout = {
items: TransactionBlockscout[];
next_page_params: {
block_number: number;
index: number;
items_count: number;
};
};
declare function fetchBlockInfoBlockscout(block: number, chainId?: number): Promise<BlockInfoBlockscout>;
declare function fetchBlockTransactionsBlockscout(block: number, chainId?: number): Promise<BlockTransactionsBlockscout>;
type ABIInputsOutputs = {
internalType: string;
name: string;
type: string;
};
type ABIJsonObject = {
constant?: boolean;
anonymous?: boolean;
inputs: Array<ABIInputsOutputs>;
name?: string;
outputs?: Array<ABIInputsOutputs>;
payable?: boolean;
stateMutability?: 'payable' | 'nonpayable';
type: 'function' | 'fallback' | 'event';
};
type ABIJsonObjectReads = {
inputs: Array<ABIInputsOutputs>;
method_id: string;
name: string;
names?: Array<string>;
outputs: Array<ABIInputsOutputs>;
stateMutability: 'view';
type: 'function';
};
type ABIJsonObjectWrites = {
inputs: Array<ABIInputsOutputs>;
method_id: string;
name: string;
names?: Array<string>;
outputs: Array<ABIInputsOutputs>;
stateMutability: 'nonpayable';
type: 'function';
};
type SmartContract = {
has_methods_read: boolean;
is_self_destructed: boolean;
has_custom_methods_write: boolean;
file_path: string;
source_code: string;
deployed_bytecode: string;
optimization_enabled: boolean;
verified_twin_address_hash: string | null;
is_verified: boolean;
compiler_settings: {
libraries: Object | {
[key: string]: Object;
};
metadata: {
bytecodeHash: string;
};
optimizer: {
enabled: boolean;
runs: number;
};
outputSelection?: {
[key: string]: Object;
};
remappings?: [];
};
optimizations_runs: number;
sourcify_repo_url: string | null;
decoded_constructor_args: Array<string | Object> | null;
has_methods_write: boolean;
compiler_version: string;
is_verified_via_verifier_alliance: boolean;
verified_at: string;
implementations: Array<{
address: string;
name: string;
}>;
proxy_type: null | 'eip1967';
external_libraries: [];
creation_bytecode: string;
name: string;
is_blueprint: boolean;
license_type: string;
is_fully_verified: boolean;
has_methods_read_proxy: boolean;
is_vyper_contract: boolean;
is_verified_via_eth_bytecode_db: boolean;
language: 'solidity';
evm_version: 'istanbul';
can_be_visualized_via_sol2uml: boolean;
has_methods_write_proxy: boolean;
has_custom_methods_read: boolean;
is_verified_via_sourcify: boolean;
additional_sources: [];
certified: boolean;
abi: Array<ABIJsonObject>;
is_changed_bytecode: boolean;
is_partially_verified: boolean;
constructor_args: string | null;
};
type ContractReadQuery = {
result: {
output: Array<{
type: string;
value: string;
}>;
names: Array<string>;
};
is_error: boolean;
};
declare function fetchSmartContractBlockscout(address: string, chainId?: number): Promise<SmartContract>;
declare function fetchSmartContractReadMethodsBlockscout(address: string, chainId?: number): Promise<Array<ABIJsonObjectReads>>;
declare function fetchSmartContractWriteMethodsBlockscout(address: string, chainId?: number): Promise<Array<ABIJsonObjectWrites>>;
declare function fetchSmartContractQueryReadBlockscout(address: string, method_id: string, args?: Array<string>, chainId?: number): Promise<ContractReadQuery>;
type SearchItemsBlockscout = {
address: string;
address_url?: string;
certified: boolean;
ens_info?: ENSInfo;
circulating_market_cap?: string | null;
exchange_rate?: string | null;
icon_url?: string | null;
is_smart_contract_verified: boolean;
is_verified_via_admin_panel?: boolean;
name: string | null;
priority: 0 | 2;
symbol?: string;
token_type?: 'ERC-20' | 'ERC-721' | 'ERC-1155';
token_url?: string;
total_supply?: string;
type: 'token' | 'ens_domain';
url: string;
};
type ENSInfo = {
name: string;
address_hash: string;
expiry_data: null;
names_count: number;
};
type NextPageSearch = {
address_hash: string;
block_hash: string | null;
holder_count: number;
inserted_at: string;
item_type: string;
items_count: number;
name: string;
q: string;
transaction_hash: string | null;
};
type SearchBlockscout = {
items: SearchItemsBlockscout[] | [];
next_page_params: NextPageSearch | null;
};
declare function fetchSearchBlockscout(search: string, chainId?: number): Promise<SearchBlockscout>;
type StatsBlockscout = {
average_block_time: number;
coin_image: string;
coin_price: string;
coin_price_change_percentage: number;
gas_price_updated_at: string;
gas_prices: {
average: number;
fast: number;
slow: number;
};
gas_prices_update_in: number;
gas_used_today: string;
market_cap: string;
network_utilization_percentage: number;
secondary_coin_image: null;
secondary_coin_price: null;
static_gas_price: null | string;
total_addresses: string;
total_blocks: string;
total_gas_used: string;
total_transactions: string;
transactions_today: string;
tvl: null;
};
declare function fetchStatsBlockscout(chainId?: number): Promise<StatsBlockscout>;
declare function getChainProviderBlockscout(chainId?: number): string;
export { type ABIInputsOutputs, type ABIJsonObject, type ABIJsonObjectReads, type ABIJsonObjectWrites, type AddressInfoBlockscout, type AddressTokens, type AddressTransactionsBlockscout, type BlockInfoBlockscout, type BlockTransactionsBlockscout, type ContractReadQuery, type CountersContractBlockscout, type DecodedInput, type Fee, type InternalTransactionsBlockscout, type InternalTransactionsObject, type NFTIdBlockscout, type NFTOwnerBlockscout, type NextPageInternalParams, type NextPageSearch, type NextPageTokenTransfersParams, type SearchBlockscout, type SearchItemsBlockscout, type SmartContract, type StatsBlockscout, type TokenBlockscout, type TokenTransferBlockscout, type TokenTransfersBlockscout, type TokenTransfersObject, type TransactionAddressBlockscout, type TransactionBlockscout, type TransactionParameter, fetchAddressCounters, fetchAddressInfo, fetchAddressTransactions, fetchBlockInfoBlockscout, fetchBlockTransactionsBlockscout, fetchInternalTransactionsBlockscout, fetchNFTIdInfo, fetchSearchBlockscout, fetchSmartContractBlockscout, fetchSmartContractQueryReadBlockscout, fetchSmartContractReadMethodsBlockscout, fetchSmartContractWriteMethodsBlockscout, fetchStatsBlockscout, fetchTokenInfo, fetchTokenTransfersBlockscout, fetchTokensAddress, fetchTransactionBlockscout, getChainProviderBlockscout };