/// <summary> /// Send packet from wallet to seed nodes. /// </summary> /// <param name="packet"></param> /// <param name="certificate"></param> /// <param name="isEncrypted"></param> public async Task <bool> SendPacketWallet(string packet, string certificate, bool isEncrypted) { if (WalletPhase == ClassConnectorSettingEnumeration.WalletCreateType || WalletPhase == string.Empty) // Not allow to create a wallet on non-permanent seed nodes. { if (ClassConnectorSetting.SeedNodeIp.ContainsKey(_seedNodeConnector.ReturnCurrentSeedNodeHost())) { if (!ClassConnectorSetting.SeedNodeIp[_seedNodeConnector.ReturnCurrentSeedNodeHost()].Item2) { return(false); } } else { return(false); } } return(await _seedNodeConnector.SendPacketToSeedNodeAsync(EncryptPacketWallet(packet), certificate, false, isEncrypted)); }
public static async Task <bool> CheckWalletAddressExistAsync(string walletAddress) { try { string request = ClassConnectorSettingEnumeration.WalletTokenType + "|" + ClassRpcWalletCommand.TokenCheckWalletAddressExist + "|" + walletAddress; string result = await ClassRemoteApi.ProceedHttpRequest("http://" + classSeedNodeConnector.ReturnCurrentSeedNodeHost() + ":" + ClassConnectorSetting.SeedNodeTokenPort + "/", request); if (result == string.Empty || result == ClassApiEnumeration.PacketNotExist) { return(false); } else { JObject resultJson = JObject.Parse(result); if (resultJson.ContainsKey(ClassMiningPoolRequest.SubmitResult)) { string resultCheckWalletAddress = resultJson[ClassMiningPoolRequest.SubmitResult].ToString(); if (resultCheckWalletAddress.Contains("|")) { var splitResultCheckWalletAddress = resultCheckWalletAddress.Split(new[] { "|" }, StringSplitOptions.None); if (splitResultCheckWalletAddress[0] == ClassRpcWalletCommand.SendTokenCheckWalletAddressInvalid) { return(false); } else if (splitResultCheckWalletAddress[0] == ClassRpcWalletCommand.SendTokenCheckWalletAddressValid) { return(true); } else { return(false); } } else { return(false); } } else { return(false); } } } catch { return(false); } }