public TransactionResultCode.TransactionResultCodeEnum GetTransactionResult(TransactionResponse tx)
        {
            var xdr      = Convert.FromBase64String(tx.ResultXdr);
            var reader   = new XdrDataInputStream(xdr);
            var txResult = TransactionResult.Decode(reader);

            return(txResult.Result.Discriminant.InnerValue);
        }
        public long GetAccountMergeAmount(string resultXdrBase64, int operationIndex)
        {
            var xdr      = Convert.FromBase64String(resultXdrBase64);
            var txResult = TransactionResult.Decode(new XdrDataInputStream(xdr));
            var merge    = txResult.Result.Results[operationIndex];

            if (merge.Tr.AccountMergeResult != null && merge.Tr.AccountMergeResult.Discriminant.InnerValue == AccountMergeResultCode.AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS)
            {
                var amount = merge.Tr.AccountMergeResult.SourceAccountBalance.InnerValue;
                return(amount);
            }

            return(0);
        }
Пример #3
0
        public static string CreateTransactionResultXDR(XDR.OperationResult.OperationResultTr operationResultTr)
        {
            var transactionResult = new XDR.TransactionResult();

            transactionResult.Result = new XDR.TransactionResult.TransactionResultResult();
            transactionResult.Result.Discriminant.InnerValue = XDR.TransactionResultCode.TransactionResultCodeEnum.txFAILED;
            transactionResult.Result.Results = new XDR.OperationResult[1];
            transactionResult.Ext            = new XDR.TransactionResult.TransactionResultExt();
            transactionResult.FeeCharged     = new XDR.Int64(100L);

            var operationResult = new XDR.OperationResult();

            operationResult.Tr = operationResultTr;

            transactionResult.Result.Results[0] = operationResult;

            var outputStream = new XDR.XdrDataOutputStream();

            XDR.TransactionResult.Encode(outputStream, transactionResult);
            return(Convert.ToBase64String(outputStream.ToArray()));
        }
 public static void Encode(XdrDataOutputStream stream, TransactionResultPair encodedTransactionResultPair)
 {
     Hash.Encode(stream, encodedTransactionResultPair.TransactionHash);
     TransactionResult.Encode(stream, encodedTransactionResultPair.Result);
 }
 public static void Encode(XdrDataOutputStream stream, TransactionResult encodedTransactionResult)
 {
     Int64.Encode(stream, encodedTransactionResult.FeeCharged);
     TransactionResultResult.Encode(stream, encodedTransactionResult.Result);
     TransactionResultExt.Encode(stream, encodedTransactionResult.Ext);
 }