Skip to main content
Glama

bnbchain-mcp

Official
by bnb-chain
transactions.ts1.48 kB
import { type Address, type EstimateGasParameters, type Hash, type TransactionReceipt } from "viem" import { getPublicClient } from "./clients.js" /** * Get a transaction by hash for a specific network */ export async function getTransaction(hash: Hash, network = "ethereum") { const client = getPublicClient(network) return await client.getTransaction({ hash }) } /** * Get a transaction receipt by hash for a specific network */ export async function getTransactionReceipt( hash: Hash, network = "ethereum" ): Promise<TransactionReceipt> { const client = getPublicClient(network) return await client.getTransactionReceipt({ hash }) } /** * Get the transaction count for an address for a specific network */ export async function getTransactionCount( address: Address, network = "ethereum" ): Promise<number> { const client = getPublicClient(network) const count = await client.getTransactionCount({ address }) return Number(count) } /** * Estimate gas for a transaction for a specific network */ export async function estimateGas( params: EstimateGasParameters, network = "ethereum" ): Promise<bigint> { const client = getPublicClient(network) return await client.estimateGas(params) } /** * Get the chain ID for a specific network */ export async function getChainId(network = "ethereum"): Promise<number> { const client = getPublicClient(network) const chainId = await client.getChainId() return Number(chainId) }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bnb-chain/bnbchain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server