@bit-gpt/h402
Version:
BitGPT's 402 open protocol for blockchain-native payments
18 lines • 695 B
JavaScript
import { EvmNetworkToChainId, isEVMNetwork, } from "../types/shared/index.js";
/**
* Converts a network name to its corresponding chain ID
*
* @param network - The network name to convert to a chain ID
* @returns The chain ID for the specified network (number for EVM, string for Solana)
* @throws Error if the network is not supported
*/
export function getNetworkId(network) {
if (isEVMNetwork(network) && EvmNetworkToChainId.has(network)) {
return EvmNetworkToChainId.get(network);
}
if (network === "solana") {
return "mainnet"; // Solana mainnet identifier
}
throw new Error(`Unsupported network: ${network}`);
}
//# sourceMappingURL=network.js.map