import type { Block, BlockTag, BlockWithTransactions, FeeData, Filter, FilterByBlockHash, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '@ethersproject/abstract-provider'; import type { BigNumber, BigNumberish } from '@ethersproject/bignumber'; import type { Network as EthersNetworkAlias } from '@ethersproject/networks/lib/types'; import type { Deferrable } from '@ethersproject/properties'; import { AssetTransfersParams, AssetTransfersResponse, AssetTransfersWithMetadataParams, AssetTransfersWithMetadataResponse, DeployResult, TokenBalancesResponse, TokenMetadataResponse, TransactionReceiptsParams, TransactionReceiptsResponse } from '../types/types'; /** * The core namespace contains all commonly-used [Ethers.js * Provider](https://docs.ethers.io/v5/api/providers/api-providers/#AlchemyProvider) * methods. If you are already using Ethers.js, you should be simply able to * replace the Ethers.js Provider object with `alchemy.core` when accessing * provider methods and it should just work. * * Do not call this constructor directly. Instead, instantiate an Alchemy object * with `const alchemy = new Alchemy(config)` and then access the core namespace * via `alchemy.core`. */ export declare class CoreNamespace { private readonly config; /** * Returns the balance of a given address as of the provided block. * * @param addressOrName The address or name of the account to get the balance for. * @param blockTag The optional block number or hash to get the balance for. * Defaults to 'latest' if unspecified. * @public */ getBalance(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise; /** * Returns the contract code of the provided address at the block. If there is * no contract deployed, the result is `0x`. * * @param addressOrName The address or name of the account to get the code for. * @param blockTag The optional block number or hash to get the code for. * Defaults to 'latest' if unspecified. * @public */ getCode(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise; /** * Return the value of the provided position at the provided address, at the * provided block in `Bytes32` format. * * @param addressOrName The address or name of the account to get the code for. * @param position The position of the storage slot to get. * @param blockTag The optional block number or hash to get the code for. * Defaults to 'latest' if unspecified. * @public */ getStorageAt(addressOrName: string | Promise, position: BigNumberish | Promise, blockTag?: BlockTag | Promise): Promise; /** * Returns the number of transactions ever sent from the provided address, as * of the provided block tag. This value is used as the nonce for the next * transaction from the address sent to the network. * * @param addressOrName The address or name of the account to get the nonce for. * @param blockTag The optional block number or hash to get the nonce for. * @public */ getTransactionCount(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise; /** * Returns the block from the network based on the provided block number or * hash. Transactions on the block are represented as an array of transaction * hashes. To get the full transaction details on the block, use * {@link getBlockWithTransactions} instead. * * @param blockHashOrBlockTag The block number or hash to get the block for. * @public */ getBlock(blockHashOrBlockTag: BlockTag | string | Promise): Promise; /** * Returns the block from the network based on the provided block number or * hash. Transactions on the block are represented as an array of * {@link TransactionResponse} objects. * * @param blockHashOrBlockTag The block number or hash to get the block for. * @public */ getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise): Promise; /** * Returns the {@link EthersNetworkAlias} Alchemy is connected to. * * @public */ getNetwork(): Promise; /** * Returns the block number of the most recently mined block. * * @public */ getBlockNumber(): Promise; /** * Returns the best guess of the current gas price to use in a transaction. * * @public */ getGasPrice(): Promise; /** * Returns the recommended fee data to use in a transaction. * * For an EIP-1559 transaction, the maxFeePerGas and maxPriorityFeePerGas * should be used. * * For legacy transactions and networks which do not support EIP-1559, the * gasPrice should be used. * * @public */ getFeeData(): Promise; /** * Returns a Promise which will stall until the network has heen established, * ignoring errors due to the target node not being active yet. * * This can be used for testing or attaching scripts to wait until the node is * up and running smoothly. * * @public */ ready(): Promise; /** * Returns the result of executing the transaction, using call. A call does * not require any ether, but cannot change any state. This is useful for * calling getters on Contracts. * * @param transaction The transaction to execute. * @param blockTag The optional block number or hash to get the call for. * @public */ call(transaction: Deferrable, blockTag?: BlockTag | Promise): Promise; /** * Returns an estimate of the amount of gas that would be required to submit * transaction to the network. * * An estimate may not be accurate since there could be another transaction on * the network that was not accounted for, but after being mined affects the * relevant state. * * @param transaction The transaction to estimate gas for. * @public */ estimateGas(transaction: Deferrable): Promise; /** * Returns the transaction with hash or null if the transaction is unknown. * * If a transaction has not been mined, this method will search the * transaction pool. Various backends may have more restrictive transaction * pool access (e.g. if the gas price is too low or the transaction was only * recently sent and not yet indexed) in which case this method may also return null. * * NOTE: This is an alias for {@link TransactNamespace.getTransaction}. * * @param transactionHash The hash of the transaction to get. * @public */ getTransaction(transactionHash: string | Promise): Promise; /** * Returns the transaction receipt for hash or null if the transaction has not * been mined. * * To stall until the transaction has been mined, consider the * waitForTransaction method below. * * @param transactionHash The hash of the transaction to get. * @public */ getTransactionReceipt(transactionHash: string | Promise): Promise; /** * Submits transaction to the network to be mined. The transaction must be * signed, and be valid (i.e. the nonce is correct and the account has * sufficient balance to pay for the transaction). * * NOTE: This is an alias for {@link TransactNamespace.getTransaction}. * * @param signedTransaction The signed transaction to send. * @public */ sendTransaction(signedTransaction: string | Promise): Promise; /** * Returns a promise which will not resolve until specified transaction hash is mined. * * If {@link confirmations} is 0, this method is non-blocking and if the * transaction has not been mined returns null. Otherwise, this method will * block until the transaction has confirmed blocks mined on top of the block * in which it was mined. * * NOTE: This is an alias for {@link TransactNamespace.getTransaction}. * * @param transactionHash The hash of the transaction to wait for. * @param confirmations The number of blocks to wait for. * @param timeout The maximum time to wait for the transaction to confirm. * @public */ waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise; /** * Returns an array of logs that match the provided filter. * * @param filter The filter object to use. * @public */ getLogs(filter: Filter | FilterByBlockHash | Promise): Promise>; /** * Allows sending a raw message to the Alchemy backend. * * @param method The method to call. * @param params The parameters to pass to the method. * @public */ send(method: string, params: Array): Promise; /** * Finds the address that deployed the provided contract and block number it * was deployed in. * * NOTE: This method performs a binary search across all blocks since genesis * and can take a long time to complete. This method is a convenience method * that will eventually be replaced by a single call to an Alchemy endpoint * with this information cached. * * @param contractAddress - The contract address to find the deployer for. * @beta */ findContractDeployer(contractAddress: string): Promise; /** * Returns the token balances for a specific owner address given a list of contracts. * * @param address The owner address to get the token balances for. * @param contractAddresses A list of contract addresses to check. If omitted, * the top 100 tokens by 24 hour volume will be checked. * @public */ getTokenBalances(address: string, contractAddresses?: string[]): Promise; /** * Returns metadata for a given token contract address. * * @param address The contract address to get metadata for. * @public */ getTokenMetadata(address: string): Promise; /** * Get transactions for specific addresses. See the web documentation for the * full details: * https://docs.alchemy.com/alchemy/enhanced-apis/transfers-api#alchemy_getassettransfers * * This overload requires {@link AssetTransfersWithMetadataParams.withMetadata} * to be set to `true`, which results in additional metadata returned in the * response object. * * @param params An object containing fields for the asset transfer query * @public */ getAssetTransfers(params: AssetTransfersWithMetadataParams): Promise; /** * Get transactions for specific addresses. See the web documentation for the * full details: * https://docs.alchemy.com/alchemy/enhanced-apis/transfers-api#alchemy_getassettransfers * * @param params An object containing fields for the asset transfer query. * @public */ getAssetTransfers(params: AssetTransfersParams): Promise; /** * Gets all transaction receipts for a given block by number or block hash. * * @param params An object containing fields for the transaction receipt query. * @public */ getTransactionReceipts(params: TransactionReceiptsParams): Promise; }