UNPKG

@gotake/gotake-sdk

Version:

SDK for interacting with GoTake blockchain contracts

98 lines (97 loc) 3.49 kB
export var NetworkId; (function (NetworkId) { NetworkId[NetworkId["ETHEREUM_MAINNET"] = 1] = "ETHEREUM_MAINNET"; NetworkId[NetworkId["ETHEREUM_GOERLI"] = 5] = "ETHEREUM_GOERLI"; NetworkId[NetworkId["ETHEREUM_SEPOLIA"] = 11155111] = "ETHEREUM_SEPOLIA"; NetworkId[NetworkId["BASE_MAINNET"] = 8453] = "BASE_MAINNET"; NetworkId[NetworkId["BASE_GOERLI"] = 84531] = "BASE_GOERLI"; NetworkId[NetworkId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA"; // Add more supported networks })(NetworkId || (NetworkId = {})); // Predefined network configurations export const NETWORKS = { [NetworkId.ETHEREUM_MAINNET]: { id: NetworkId.ETHEREUM_MAINNET, name: 'Ethereum Mainnet', rpcUrl: 'https://mainnet.infura.io/v3/${INFURA_API_KEY}', blockExplorer: 'https://etherscan.io', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "1", // 1 Gwei for Ethereum Mainnet }, [NetworkId.ETHEREUM_GOERLI]: { id: NetworkId.ETHEREUM_GOERLI, name: 'Ethereum Goerli', rpcUrl: 'https://goerli.infura.io/v3/${INFURA_API_KEY}', blockExplorer: 'https://goerli.etherscan.io', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "1", // 1 Gwei for Ethereum Goerli }, [NetworkId.ETHEREUM_SEPOLIA]: { id: NetworkId.ETHEREUM_SEPOLIA, name: 'Ethereum Sepolia', rpcUrl: 'https://sepolia.infura.io/v3/${INFURA_API_KEY}', blockExplorer: 'https://sepolia.etherscan.io', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "1", // 1 Gwei for Ethereum Sepolia }, [NetworkId.BASE_MAINNET]: { id: NetworkId.BASE_MAINNET, name: 'Base Mainnet', rpcUrl: 'https://mainnet.base.org', blockExplorer: 'https://basescan.org', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "0.001", // 0.001 Gwei for Base Mainnet }, [NetworkId.BASE_GOERLI]: { id: NetworkId.BASE_GOERLI, name: 'Base Goerli', rpcUrl: 'https://goerli.base.org', blockExplorer: 'https://goerli.basescan.org', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "0.001", // 0.001 Gwei for Base Goerli }, [NetworkId.BASE_SEPOLIA]: { id: NetworkId.BASE_SEPOLIA, name: 'Base Sepolia', rpcUrl: 'https://sepolia.base.org', blockExplorer: 'https://sepolia-explorer.base.org', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18, }, maxPriorityFeePerGas: "0.001", // 0.001 Gwei for Base Sepolia contracts: { videoPayment: '0x55F0d265eaFe039618C2f179667a03fA035C6e6B', mockERC20: '0x4D1F4F683AB7122fBb77aB544aC03c5678acA968', }, }, }; // Find network by name export function getNetworkByName(name) { return Object.values(NETWORKS).find((network) => (network === null || network === void 0 ? void 0 : network.name.toLowerCase()) === name.toLowerCase()); } // Find network by ID export function getNetworkById(id) { return NETWORKS[id]; }