private static void GerArg(List <CustomTransactionArgument> arguments, TransactionArgumentLCS item)
        {
            var transactionArgument = new CustomTransactionArgument();

            transactionArgument.ArgType = (uint)item.ArgTypeEnum;

            transactionArgument.Address   = item.Address.Value;
            transactionArgument.U64       = item.U64;
            transactionArgument.String    = item.String;
            transactionArgument.ByteArray = item.ByteArray;

            arguments.Add(transactionArgument);
        }
Exemplo n.º 2
0
        private void DeserializeRawTransaction(byte[] rawTxnBytes)
        {
            _rawTxnBytes = rawTxnBytes;
            RawTransaction rawTr = RawTransaction.Parser.ParseFrom(_rawTxnBytes);

            ExpirationTimeUnix = rawTr.ExpirationTime;
            ExpirationTime     = rawTr.ExpirationTime.UnixTimeStampToDateTime();

            GasUnitPrice = rawTr.GasUnitPrice;
            MaxGasAmount = rawTr.MaxGasAmount;
            PayloadCase  = (short)rawTr.PayloadCase;

            Sender   = BitConverter.ToString(rawTr.SenderAccount.ToByteArray()).Replace("-", "").ToLower();
            Receiver = BitConverter.ToString(rawTr.Program.Arguments[0]
                                             .Data.ToByteArray()).Replace("-", "").ToLower();
            Amount         = BitConverter.ToUInt64(rawTr.Program.Arguments[1].Data.ToByteArray());
            SequenceNumber = rawTr.SequenceNumber;

            List <CustomTransactionArgument> arguments = new List <CustomTransactionArgument>();

            foreach (var item in rawTr.Program.Arguments)
            {
                var transactionArgument = new CustomTransactionArgument();
                transactionArgument.Data = item.Data.ToByteArray();
                transactionArgument.Type = (short)item.Type;
                arguments.Add(transactionArgument);
            }

            List <byte[]> modules = new List <byte[]>();

            foreach (var item in rawTr.Program.Modules)
            {
                modules.Add(item.ToByteArray());
            }

            Program = new CustomProgram()
            {
                Arguments = arguments,
                Code      = rawTr.Program.Code.ToByteArray(),
                Modules   = modules
            };
        }