private bool GetContractAbi(string txId, out string contractAbi) { contractAbi = string.Empty; int checkTimes = 10; while (checkTimes > 0) { var ci = new CommandInfo("get_tx_result"); ci.Parameter = txId; CH.RpcGetTxResult(ci); if (ci.Result) { ci.GetJsonInfo(); ci.JsonInfo = ci.JsonInfo; string deployResult = ci.JsonInfo["result"]["result"]["tx_status"].ToString(); Logger.WriteInfo($"Transaction: {txId}, Status: {deployResult}"); if (deployResult == "Mined") { contractAbi = ci.JsonInfo["result"]["result"]["return"].ToString(); ContractAbi = contractAbi; Logger.WriteInfo($"Get contract ABI: TxId: {txId}, ABI address: {contractAbi}"); return(true); } checkTimes--; Thread.Sleep(2000); } } return(false); }
public void CheckTransactionResult(out CommandInfo ci, string txId, int checkTimes = 15) { ci = new CommandInfo("get_tx_result"); ci.Parameter = txId; while (checkTimes > 0) { CH.RpcGetTxResult(ci); if (ci.Result) { ci.GetJsonInfo(); ci.JsonInfo = ci.JsonInfo; string txResult = ci.JsonInfo["result"]["result"]["tx_status"].ToString(); Logger.WriteInfo($"Transaction: {txId}, Status: {txResult}"); if (txResult == "Mined") { return; } } checkTimes--; Thread.Sleep(2000); } Logger.WriteError(ci.JsonInfo.ToString()); Assert.IsTrue(false, "Transaction execute status cannot mined."); }