Exemple #1
0
        public static async Task <string> WaitTx(GeneralApi api, ByteString id)
        {
            while (true)
            {
                var result = await api.GetTransactionResultAsync(id);

                if (result.Value.ResultCode != TransactionResultCode.Pending)
                {
                    return(result.Value.ResultCode.ToString());
                }
            }
        }
        public async Task <TransactionResult> GetTransactionResult(string txId)
        {
            TransactionResult result;

            while ((result = _generalApi.GetTransactionResultAsync(ByteString.Parse(txId)).Result.Value).ResultCode
                   == TransactionResultCode.Pending)
            {
                // Waiting the tx to be include in block
                Thread.Sleep(1000);
            }

            if (result.ResultCode != TransactionResultCode.Success)
            {
                // Log failure here
                Console.WriteLine($"Transaction failed with result code {result.ResultCode}");
            }

            return(result);
        }