private void SetupOracleApis() { var neoPlatform = Settings.Oracle.SwapPlatforms.FirstOrDefault(x => x.Chain == SwapPlatformChain.Neo); if (neoPlatform != null && neoPlatform.Enabled) { var neoScanURL = Settings.Oracle.NeoscanUrl; this._neoAPI = new Neo.Core.RemoteRPCNode(neoScanURL, neoPlatform.RpcNodes); this._neoAPI.SetLogger((s) => Logger.Message(s)); this._neoScanAPI = new NeoScanAPI(neoScanURL, Logger, _nexus, _nodeKeys); } var bscPlatform = Settings.Oracle.SwapPlatforms.FirstOrDefault(x => x.Chain == SwapPlatformChain.BSC); if (bscPlatform != null && bscPlatform.Enabled) { var bscWIF = Settings.GetInteropWif(Nexus, _nodeKeys, BSCWallet.BSCPlatform); var bscKeys = PhantasmaKeys.FromWIF(bscWIF); this._bscAPI = new EthAPI(SwapPlatformChain.BSC, this.Nexus, this.Settings, new EthAccount(bscKeys.PrivateKey.ToHex()), Logger); } var ethPlatform = Settings.Oracle.SwapPlatforms.FirstOrDefault(x => x.Chain == SwapPlatformChain.Ethereum); if (ethPlatform != null && ethPlatform.Enabled) { var ethWIF = Settings.GetInteropWif(Nexus, _nodeKeys, EthereumWallet.EthereumPlatform); var ethKeys = PhantasmaKeys.FromWIF(ethWIF); this._ethAPI = new EthAPI(SwapPlatformChain.Ethereum, this.Nexus, this.Settings, new EthAccount(ethKeys.PrivateKey.ToHex()), Logger); } this._cryptoCompareAPIKey = Settings.Oracle.CryptoCompareAPIKey; if (!string.IsNullOrEmpty(this._cryptoCompareAPIKey)) { Logger.Message($"CryptoCompare API enabled."); } else { throw new Exception($"CryptoCompare API key missing, oracles won't work properly and oracles are no longer optional..."); } }
private void SetupOracleApis() { var neoScanURL = Settings.Oracle.NeoscanUrl; var neoRpcList = Settings.Oracle.NeoRpcNodes; this._neoAPI = new Neo.Core.RemoteRPCNode(neoScanURL, neoRpcList.ToArray()); this._neoAPI.SetLogger((s) => Logger.Message(s)); var ethRpcList = Settings.Oracle.EthRpcNodes; var ethWIF = Settings.GetInteropWif(Nexus, _nodeKeys, EthereumWallet.EthereumPlatform); var ethKeys = PhantasmaKeys.FromWIF(ethWIF); this._ethAPI = new EthAPI(this.Nexus, this.Settings, new EthAccount(ethKeys.PrivateKey.ToHex()), Logger); this._neoScanAPI = new NeoScanAPI(neoScanURL, Logger, _nexus, _nodeKeys); this._cryptoCompareAPIKey = Settings.Oracle.CryptoCompareAPIKey; if (!string.IsNullOrEmpty(this._cryptoCompareAPIKey)) { Logger.Message($"CryptoCompare API enabled..."); } }