contract.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // import { getMainnet } from './getMainnet.js'
  2. // EOS配置
  3. export function getNetwork () {
  4. var newwork = {}
  5. // 并发请求,获取最快主网
  6. // EOS_HOST = await getMainnet()
  7. if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
  8. newwork = {
  9. protocol: 'https',
  10. blockchain: 'eos',
  11. port: '443',
  12. host: 'localnet.eosget.io',
  13. chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f'
  14. }
  15. } else {
  16. newwork = {
  17. protocol: EOS_PROTOCOL,
  18. blockchain: 'eos',
  19. // host: 'nodes.get-scatter.com',
  20. port: EOS_PORT,
  21. host: EOS_HOST,
  22. chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
  23. }
  24. }
  25. return newwork
  26. }
  27. // 修改eos配置
  28. export function changeNewWork (host) {
  29. return {
  30. protocol: 'https',
  31. blockchain: 'eos',
  32. host,
  33. port: '',
  34. chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
  35. }
  36. }
  37. // WebSocket
  38. export function getWsUrl () {
  39. var wsUrl
  40. var wsProtocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://'
  41. if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
  42. wsUrl = wsProtocol + 'test-ws.mee.chat'
  43. } else if (/^new[-.]/.test(window.location.host)) {
  44. wsUrl = wsProtocol + 'new-ws.mee.chat'
  45. } else {
  46. wsUrl = wsProtocol + 'ws.mee.chat'
  47. }
  48. return wsUrl
  49. }
  50. export function getMiniWsUrl () {
  51. var wsUrl
  52. var wsProtocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://'
  53. if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
  54. wsUrl = wsProtocol + 'test-ws-group.mee.chat'
  55. } else if (/^new[-.]/.test(window.location.host)) {
  56. wsUrl = wsProtocol + 'new-ws-group.mee.chat'
  57. } else {
  58. wsUrl = wsProtocol + 'ws-group.mee.chat'
  59. }
  60. return wsUrl
  61. }
  62. // 主网
  63. export var mainNetMap = {
  64. 'eosplay': 'eosjs.eosplay.com',
  65. // 'hkeos': 'api.hkeos.com',
  66. 'cypherglass': 'api.cypherglass.com',
  67. 'eoscannon': 'mainnet.eoscannon.io',
  68. 'eosbeijing': 'api.eosbeijing.one',
  69. 'eosn': 'api.eosn.io',
  70. 'eosys': 'rpc.eosys.io',
  71. // 'eosnewyork': 'api.eosnewyork.io',
  72. 'get-scatter': 'nodes.get-scatter.com'
  73. // 'proxy': 'proxy.eosnode.tools'
  74. }