@forta/network
Version:
🌤️ A goodie to get chains common metadata.
2 lines (1 loc) • 2.71 kB
JavaScript
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n["@forta/network"]={}))})(this,function(n){"use strict";const e="Mainnet",l="Testnet",s=[],o=r=>`https://${r}`,a=r=>o(r),m=(r,c)=>c.length<=42?`${r}/address/${c}`:`${r}/tx/${c}`;class i{chainName="";chainDecimalId=0;chainId="";rpcUrl="";blockExplorerUrl="";shortName="";type=l;currency="ETH";constructor(c,t,u,C,U,F,G=l,B="ETH"){const v={chainId:t,chainDecimalId:c,shortName:u,chainName:C,rpcUrl:U,blockExplorerUrl:F,currency:B,type:G};Object.assign(this,v),s.push(v)}getExplorerURL=c=>m(this.blockExplorerUrl,c)}const M=new i(1,"0x1","Mainnet","Ethereum Main Network (Mainnet)",o("mainnet.infura.io/v3"),a("etherscan.io"),e),f=new i(3,"0x3","Ropsten","Ropsten Test Network",o("ropsten.infura.io/v3"),a("ropsten.etherscan.io")),k=new i(4,"0x4","Rinkeby","Rinkeby Test Network",o("rinkeby.infura.io/v3"),a("rinkeby.etherscan.io")),w=new i(5,"0x5","Goerli","Goerli Test Network",o("goerli.infura.io/v3"),a("goerli.etherscan.io")),T=new i(42,"0x2a","Kovan","Kovan Test Network",o("kovan.infura.io/v3"),a("kovan.etherscan.io")),h=new i(137,"0x89","Matic","Matic Mainnet",o("rpc-mainnet.maticvigil.com"),a("polygonscan.com"),e,"MATIC"),d=h,p=new i(42220,"0xa4ec","Celo","Celo Mainnet",o("forno.celo.org"),a("explorer.celo.org"),e,"CELO"),b=new i(250,"0xfa","Fantom","Fantom Mainnet",o("rpc.fantom.network"),a("ftmscan.com"),e,"FTM"),y=new i(43114,"0xa86a","Avalanche","Avalanche C-Chain",o("rpc.ankr.com/avalanche"),a("explorer.avax.network"),e,"AVAX"),E=new i(56,"0x38","Binance","Binance Smart Chain Mainnet",o("rpc.ankr.com/bsc"),a("bscscan.com"),e,"BNB"),N=new i(1313161554,"0x4e454152","Aurora","Aurora Mainnet",o("mainnet.aurora.dev"),a("aurorascan.dev"),e,"AURORA"),A=new i(4689,"0x1251","IoTeX","IoTeX Network Mainnet",o("rpc.ankr.com/iotex"),a("iotexscan.io"),e,"IOTX"),g=new i(100,"0x64","Gnosis","Gnosis Chain",o("rpc.xdaichain.com"),a("blockscout.com/xdai/mainnet"),e,"xDAI"),x=new i(1285,"0x505","Moonriver","Moonriver Chain",o("moonriver.public.blastapi.io"),a("moonriver.moonscan.io"),e,"MOVR"),I=new i(122,"0x7a","Fuse","Fuse Mainnet",o("rpc.fuse.io"),a("explorer.fuse.io"),e,"FUSE");function R(r,c){const t=s.find(u=>u.chainDecimalId===parseInt(c));return t?m(t.blockExplorerUrl,r):null}n.Aurora=N,n.Avalanche=y,n.Binance=E,n.Celo=p,n.Fantom=b,n.Fuse=I,n.Gnosis=g,n.Goerli=w,n.IoTeX=A,n.Kovan=T,n.MAINNET=e,n.Mainnet=M,n.Matic=d,n.Moonriver=x,n.NetworkList=s,n.Polygon=h,n.Rinkeby=k,n.Ropsten=f,n.TESTNET=l,n.getExplorerURL=R,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});