Closed possib1e closed 6 years ago
Setting up event listeners..
2bundle-cn.js:74323 cool loader
bundle-cn.js:71534 WebSocket connection to 'wss://mainnet.infura.io/_ws' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
WebsocketProvider @ bundle-cn.js:71534
bundle-cn.js:71708 connection not open on send()
WebsocketProvider.send @ bundle-cn.js:71708
bundle-cn.js:73955 incoming..
bundle-cn.js:73957 Bridge reporting Error: connection not open
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699 null Subscription object
bundle-cn.js:73959 closing and reopening.. Error: connection not open
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699 null Subscription
bundle-cn.js:73960 Uncaught TypeError: this.listen is not a function
at Subscription.callback (bundle-cn.js:73960)
at bundle-cn.js:66634
at bundle-cn.js:66050
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699
bundle-cn.js:66983 Uncaught (in promise) Error: Couldn't decode uint256 from ABI: 0x
at SolidityTypeUInt.formatOutputUInt [as _outputFormatter] (bundle-cn.js:66983)
at SolidityTypeUInt.SolidityType.decode (bundle-cn.js:67916)
at bundle-cn.js:67426
at Array.forEach (
里面有个错误是,'wss://mainnet.infura.io/_ws' ,连接主网错误?可是我是部署在本地ganache的啊
truffle migrate --reset正常,有最终的合约地址, npm install & npm run start 前端也可以启动,会输出调用了那些JS,CSS资源, 但是访问页面http://127.0.0.1/play,一直显示加载中,没变化, 我看浏览器控制台是显示这些错误,请问怎么办? Setting up event listeners.. bundle-cn.js:74323 cool loader bundle-cn.js:66983 Uncaught (in promise) Error: Couldn't decode uint256 from ABI: 0x at SolidityTypeUInt.formatOutputUInt [as _outputFormatter] (bundle-cn.js:66983) at SolidityTypeUInt.SolidityType.decode (bundle-cn.js:67916) at bundle-cn.js:67426 at Array.forEach () at ABICoder.decodeParameters (bundle-cn.js:67425) at Contract._decodeMethodReturn (bundle-cn.js:69571) at Method.outputFormatter (bundle-cn.js:69924) at Method.formatOutput (bundle-cn.js:65227) at sendTxCallback (bundle-cn.js:65539) at bundle-cn.js:66061 at XMLHttpRequest.request.onreadystatechange (bundle-cn.js:71135) bundle-cn.js:71534 WebSocket connection to 'wss://mainnet.infura.io/_ws' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received bundle-cn.js:71708 connection not open on send() bundle-cn.js:73955 incoming.. bundle-cn.js:73957 Bridge reporting Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription {id: null, callback: ƒ, arguments: Array(1), _reconnectIntervalId: null, options: {…}, …} object bundle-cn.js:73959 closing and reopening.. Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription {id: null, callback: ƒ, arguments: Array(1), _reconnectIntervalId: null, options: {…}, …} bundle-cn.js:73960 Uncaught TypeError: this.listen is not a function at Subscription.callback (bundle-cn.js:73960) at bundle-cn.js:66634 at bundle-cn.js:66050 at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699
{{address}} 问题看这里: https://github.com/gudqs7/fomo3d_truffle/issues/1#issuecomment-420171739
至于报错问题, 应该是 provider 地址不正确? 比如你是本地 rpc, 那你
{
name: "Browser",
API: "http://127.0.0.1:8545"//https://ropsten.infura.io/v3/09c30ad18ed145c3997b0621e1816909"
}
这里就应该改成 本地的 连接, 注意端口可能不同
里面有个错误是,'wss://mainnet.infura.io/_ws' ,连接主网错误?可是我是部署在本地ganache的啊
wss 是 web socket, 暂时没啥用, 出错不影响运行
嗯,看了之前address那个问题,意思是现在address需要自己去bundle-cn.js去修改那3个地址吗,还有关于游戏激活的操作是不是不需要操作,不需要安装本地remix-ide,已经默认操作了。
嗯,看了之前address那个问题,意思是现在address需要自己去bundle-cn.js去修改那3个地址吗,还有关于游戏激活的操作是不是不需要操作,不需要安装本地remix-ide,已经默认操作了。
嗯, 3个用一个修改一个Fomo3D就行, 激活现在的版本已经做了
还是出错,我使用本地的ganache,我的执行顺序如下
1.truffle compile
首先编译时候出问题,Error: Cannot find module 'truffle-hdwallet-provider',我查看了下truffle.js,里面的第一句是
const HDWalletProvider = require("truffle-hdwallet-provider");
我就把它个注释掉了,就可以了。
2.truffle migrate --reset
部署成功,得到合约地址
3.修改前端数据
修改bundle-cn.js,把Browser的API修改成本地,把合约地址修改成上一步得到的地址 name: "Browser", API: "http://127.0.0.1:8545"
name: "Fomo3D",
model: Ethereum.Fomo3D,
address: "0x1c8cf15dc62fe6fb1ff3f582c0ec1e5f063c46c8"
4.启动前端
npm install & npm run start
可以启动前端,但是页面访问时候一直显示在加载中,
Setting up event listeners.. 2bundle-cn.js:74323 cool loader bundle-cn.js:74520 Uncaught (in promise) Object bundle-cn.js:71534 WebSocket connection to 'wss://mainnet.infura.io/_ws' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received WebsocketProvider @ bundle-cn.js:71534 bundle-cn.js:71708 connection not open on send() WebsocketProvider.send @ bundle-cn.js:71708 bundle-cn.js:73955 incoming.. bundle-cn.js:73957 Bridge reporting Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription object bundle-cn.js:73959 closing and reopening.. Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription bundle-cn.js:73960 Uncaught TypeError: this.listen is not a function at Subscription.callback (bundle-cn.js:73960) at bundle-cn.js:66634 at bundle-cn.js:66050 at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699
还是出错,我使用本地的ganache,我的执行顺序如下
1.truffle compile
首先编译时候出问题,Error: Cannot find module 'truffle-hdwallet-provider',我查看了下truffle.js,里面的第一句是
const HDWalletProvider = require("truffle-hdwallet-provider");
我就把它个注释掉了,就可以了。
2.truffle migrate --reset
部署成功,得到合约地址
3.修改前端数据
修改bundle-cn.js,把Browser的API修改成本地,把合约地址修改成上一步得到的地址 name: "Browser", API: "http://127.0.0.1:8545"
name: "Fomo3D", model: Ethereum.Fomo3D, address: "0x1c8cf15dc62fe6fb1ff3f582c0ec1e5f063c46c8"
4.启动前端
npm install & npm run start
可以启动前端,但是页面访问时候一直显示在加载中,
Setting up event listeners.. 2bundle-cn.js:74323 cool loader bundle-cn.js:74520 Uncaught (in promise) Object bundle-cn.js:71534 WebSocket connection to 'wss://mainnet.infura.io/_ws' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received WebsocketProvider @ bundle-cn.js:71534 bundle-cn.js:71708 connection not open on send() WebsocketProvider.send @ bundle-cn.js:71708 bundle-cn.js:73955 incoming.. bundle-cn.js:73957 Bridge reporting Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription object bundle-cn.js:73959 closing and reopening.. Error: connection not open at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699 null Subscription bundle-cn.js:73960 Uncaught TypeError: this.listen is not a function at Subscription.callback (bundle-cn.js:73960) at bundle-cn.js:66634 at bundle-cn.js:66050 at WebsocketProvider.send (bundle-cn.js:71714) at bundle-cn.js:71699
看看是不是有个 请求卡住了... 那个用来获取 eth 汇率的, 把请求注释掉
if(!testnet) { await JUST.connect({ providers: [ { name: "Metamask", API: (typeof web3 !== "undefined" ? web3 : false) }, { name: "Browser", API: "http://127.0.0.1:8545"//"https://mainnet.infura.io/v3/09c30ad18ed145c3997b0621e1816909" }, { name: "Websocket", API: new w3Constructor( new w3Constructor.providers.WebsocketProvider("wss://mainnet.infura.io/_ws")) } ], contracts: [ { name: "Fomo3D", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" } ] }) } else { await JUST.connect({ providers: [ { name: "Metamask", API: (typeof web3 !== "undefined" ? web3 : false) }, { name: "Browser", API: "http://127.0.0.1:8545"//"https://ropsten.infura.io/v3/09c30ad18ed145c3997b0621e1816909" }, { name: "Websocket", API: new w3Constructor( new w3Constructor.providers.WebsocketProvider("wss://mainnet.infura.io/_ws")) } ], contracts: [ { name: "Fomo3D", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" }, { name: "Quick", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" }, { name: "P3D", model: Ethereum.P3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" } ] }) }
既然合约部署在本地,name: "Browser"改成本地127了,那么name: "Websocket",还是用主网的?ganache好像不支持websocket的?
if(!testnet) { await JUST.connect({ providers: [ { name: "Metamask", API: (typeof web3 !== "undefined" ? web3 : false) }, { name: "Browser", API: "http://127.0.0.1:8545"//"https://mainnet.infura.io/v3/09c30ad18ed145c3997b0621e1816909" }, { name: "Websocket", API: new w3Constructor( new w3Constructor.providers.WebsocketProvider("wss://mainnet.infura.io/_ws")) } ], contracts: [ { name: "Fomo3D", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" } ] }) } else { await JUST.connect({ providers: [ { name: "Metamask", API: (typeof web3 !== "undefined" ? web3 : false) }, { name: "Browser", API: "http://127.0.0.1:8545"//"https://ropsten.infura.io/v3/09c30ad18ed145c3997b0621e1816909" }, { name: "Websocket", API: new w3Constructor( new w3Constructor.providers.WebsocketProvider("wss://mainnet.infura.io/_ws")) } ], contracts: [ { name: "Fomo3D", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" }, { name: "Quick", model: Ethereum.Fomo3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" }, { name: "P3D", model: Ethereum.P3D, address: "0x1c0b676fa38e24aceb186ebc281494a00b2ca4ce" } ] }) }
既然合约部署在本地,name: "Browser"改成本地127了,那么name: "Websocket",还是用主网的?ganache好像不支持websocket的?
额, 是不支持, 但也不需要, ws 不是用来刷新页面的, 所以不需要关注他, 刷新用的是 metamask 的东西, 咦 这么说在没有 metamask 的环境可能用上 ws 了吧, 但是 infura 的 ws 又老是有问题, 所以不要管他了
truffle migrate --reset正常,有最终的合约地址, npm install & npm run start 前端也可以启动,会输出调用了那些JS,CSS资源, 但是访问页面http://127.0.0.1/play,一直显示加载中,没变化, 我看浏览器控制台是显示这些错误,请问怎么办? Setting up event listeners.. bundle-cn.js:74323 cool loader bundle-cn.js:66983 Uncaught (in promise) Error: Couldn't decode uint256 from ABI: 0x at SolidityTypeUInt.formatOutputUInt [as _outputFormatter] (bundle-cn.js:66983) at SolidityTypeUInt.SolidityType.decode (bundle-cn.js:67916) at bundle-cn.js:67426 at Array.forEach ()
at ABICoder.decodeParameters (bundle-cn.js:67425)
at Contract._decodeMethodReturn (bundle-cn.js:69571)
at Method.outputFormatter (bundle-cn.js:69924)
at Method.formatOutput (bundle-cn.js:65227)
at sendTxCallback (bundle-cn.js:65539)
at bundle-cn.js:66061
at XMLHttpRequest.request.onreadystatechange (bundle-cn.js:71135)
bundle-cn.js:71534 WebSocket connection to 'wss://mainnet.infura.io/_ws' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
bundle-cn.js:71708 connection not open on send()
bundle-cn.js:73955 incoming..
bundle-cn.js:73957 Bridge reporting Error: connection not open
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699 null
Subscription {id: null, callback: ƒ, arguments: Array(1), _reconnectIntervalId: null, options: {…}, …}
object
bundle-cn.js:73959 closing and reopening.. Error: connection not open
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699 null
Subscription {id: null, callback: ƒ, arguments: Array(1), _reconnectIntervalId: null, options: {…}, …}
bundle-cn.js:73960 Uncaught TypeError: this.listen is not a function
at Subscription.callback (bundle-cn.js:73960)
at bundle-cn.js:66634
at bundle-cn.js:66050
at WebsocketProvider.send (bundle-cn.js:71714)
at bundle-cn.js:71699