Skip to main content
Glama

bnbchain-mcp

Official
by bnb-chain
account.ts1.32 kB
import type { Hex } from "viem" import { privateKeyToAccount } from "viem/accounts" import Logger from "@/utils/logger" import { getClient } from "./client" export const getAddressFromPrivateKey = (privateKey: Hex) => { const account = privateKeyToAccount(privateKey) return account.address } export const getAccount = async ( network: "testnet" | "mainnet", privateKey: Hex ) => { const client = getClient(network) const account = await client.account.getAccount( getAddressFromPrivateKey(privateKey) ) return account } export const getAccountBalance = async ( network: "testnet" | "mainnet", { privateKey, address }: { privateKey?: Hex address?: string } ) => { const client = getClient(network) const account = await client.account.getAccountBalance({ address: address || getAddressFromPrivateKey(privateKey as Hex), denom: "BNB" }) return account.balance } export const getPaymentAccounts = async ( network: "testnet" | "mainnet", { address, privateKey }: { address?: string privateKey?: Hex } ) => { const client = getClient(network) return ( ( await client.payment.getPaymentAccountsByOwner({ owner: address || getAddressFromPrivateKey(privateKey as Hex) }) ).paymentAccounts || [] ) }

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