| | |
| | | import org.web3j.tx.gas.StaticGasProvider; |
| | | |
| | | import java.math.BigInteger; |
| | | import java.net.ConnectException; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | webSocketClient = new WebSocketClient(new URI("wss://bsc-mainnet.nodereal.io/ws/v1/78074065950e4915aef4f12b6f357d16")); |
| | | ws = new WebSocketService(webSocketClient, true); |
| | | ws.connect(); |
| | | } catch (Exception e) { |
| | | try { |
| | | ws.close(); |
| | | |
| | | webSocketClient = new WebSocketClient(new URI("wss://bsc-mainnet.nodereal.io/ws/v1/78074065950e4915aef4f12b6f357d16")); |
| | | ws = new WebSocketService(webSocketClient, true); |
| | | ws.connect(); |
| | | } catch (Exception connectException) { |
| | | connectException.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | try { |
| | | web3j = Web3j.build(ws); |
| | | ChainEnum chain = ChainEnum.getValueByName(type); |
| | | assert chain != null; |