1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { getMainnet } from './getMainnet.js'
- import { isDev, getUserOpt } from '@/util/util.js'
- // EOS配置
- export async function getNetwork () {
- var newwork = {
- protocol: 'https',
- blockchain: 'eos',
- port: '443'
- }
- // 并发请求,获取最快主网
- if (isDev()) {
- newwork['host'] = 'localnet.eosget.io'
- newwork['chainId'] = 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f'
- } else {
- if (getUserOpt('eosType') == 'meetone') {
- newwork['host'] = 'fullnode.meet.one'
- newwork['chainId'] = 'cfe6486a83bad4962f232d48003b1824ab5665c36778141034d75e57b956e422'
- } else {
- newwork['host'] = await getMainnet()
- newwork['chainId'] = 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
- }
- }
- return newwork
- }
- // 修改eos配置
- export function changeNewWork (host) {
- return {
- protocol: 'https',
- blockchain: 'eos',
- host,
- port: '443',
- chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
- }
- }
- // WebSocket
- export function getWsUrl () {
- var wsUrl
- var wsProtocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://'
- if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
- wsUrl = wsProtocol + 'test-ws.mee.chat'
- } else if (/^new[-.]/.test(window.location.host)) {
- wsUrl = wsProtocol + 'new-ws.mee.chat'
- } else {
- wsUrl = wsProtocol + 'ws.mee.chat'
- }
- return wsUrl
- }
- export function getMiniWsUrl () {
- var wsUrl
- var wsProtocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://'
- if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
- wsUrl = wsProtocol + 'test-ws-group.mee.chat'
- } else if (/^new[-.]/.test(window.location.host)) {
- wsUrl = wsProtocol + 'new-ws-group.mee.chat'
- } else {
- wsUrl = wsProtocol + 'ws-group.mee.chat'
- }
- return wsUrl
- }
- // 主网
- export var mainNetMap = {
- 'eoscannon': 'mainnet.eoscannon.io',
- 'eosbeijing': 'api.eosbeijing.one',
- 'eosys': 'rpc.eosys.io',
- 'proxy': 'proxy.eosnode.tools',
- 'eosio': 'mainnet.eosio.sg',
- 'jeda': 'api.jeda.one',
- 'oraclechain': 'api.oraclechain.io',
- 'eosasia': 'geo.eosasia.one'
- }
|