UNPKG

@sei-js/mcp-server

Version:

Model Context Protocol (MCP) server for interacting with EVM-compatible networks

18 lines (17 loc) 618 B
import { parseEther } from 'viem'; /** * Utility functions for formatting and parsing values */ export const utils = { // Convert ether to wei parseEther, // Format an object to JSON with bigint handling formatJson: (obj) => JSON.stringify(obj, (_, value) => (typeof value === 'bigint' ? value.toString() : value), 2), validateAddress: (address) => { // If it's already a valid Sei 0x address (0x followed by 40 hex chars), return it if (/^0x[a-fA-F0-9]{40}$/.test(address)) { return address; } throw new Error(`Invalid address: ${address}`); } };