contract.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
  41. if (document.location.protocol === 'https:') {
  42. wsUrl = 'wss://test-ws.mee.chat'
  43. } else {
  44. wsUrl = 'ws://test-ws.mee.chat'
  45. }
  46. } else {
  47. if (document.location.protocol === 'https:') {
  48. wsUrl = 'wss://ws.mee.chat'
  49. } else {
  50. wsUrl = 'ws://ws.mee.chat'
  51. }
  52. }
  53. return wsUrl
  54. }
  55. export function getMiniWsUrl () {
  56. var wsUrl
  57. if (window.location.port === '8080' || /^test|\.webdev2\./.test(window.location.host)) {
  58. if (document.location.protocol === 'https:') {
  59. wsUrl = 'wss://test-ws-group.mee.chat'
  60. } else {
  61. wsUrl = 'ws://test-ws-group.mee.chat'
  62. }
  63. } else {
  64. if (document.location.protocol === 'https:') {
  65. wsUrl = 'wss://ws-group.mee.chat'
  66. } else {
  67. wsUrl = 'ws://ws-group.mee.chat'
  68. }
  69. }
  70. return wsUrl
  71. }
  72. // 主网
  73. export var mainNetMap = {
  74. 'eosplay': 'eosjs.eosplay.com',
  75. // 'hkeos': 'api.hkeos.com',
  76. 'cypherglass': 'api.cypherglass.com',
  77. 'eoscannon': 'mainnet.eoscannon.io',
  78. 'eosbeijing': 'api.eosbeijing.one',
  79. 'eosn': 'api.eosn.io',
  80. 'eosys': 'rpc.eosys.io',
  81. // 'eosnewyork': 'api.eosnewyork.io',
  82. 'get-scatter': 'nodes.get-scatter.com'
  83. // 'proxy': 'proxy.eosnode.tools'
  84. }