コード例 #1
0
        /// <summary>
        ///     Generates Transaction XDR object.
        /// </summary>
        /// <returns></returns>
        public xdr.Transaction ToXdr()
        {
            // fee
            var fee = new Uint32 { InnerValue = Fee };

            // sequenceNumber
            var sequenceNumberUint = new Uint64 { InnerValue = SequenceNumber };
            var sequenceNumber = new SequenceNumber { InnerValue = sequenceNumberUint };

            // sourceAccount
            var sourceAccount = new AccountID { InnerValue = SourceAccount.XdrPublicKey };

            // operations
            var operations = new xdr.Operation[Operations.Length];

            for (var i = 0; i < Operations.Length; i++)
                operations[i] = Operations[i].ToXdr();

            // ext
            var ext = new xdr.Transaction.TransactionExt { Discriminant = 0 };

            var transaction = new xdr.Transaction
            {
                Fee = fee,
                SeqNum = sequenceNumber,
                SourceAccount = sourceAccount,
                Operations = operations,
                Memo = Memo.ToXdr(),
                TimeBounds = TimeBounds?.ToXdr(),
                Ext = ext
            };
            return transaction;
        }
コード例 #2
0
        /// <summary>
        ///     Generates Transaction XDR object.
        /// </summary>
        /// <returns></returns>
        public xdr.Transaction ToXdr()
        {
            // fee
            Uint32 fee = new Uint32 {
                InnerValue = Fee
            };

            // sequenceNumber
            Int64          sequenceNumberUint = new Int64(SequenceNumber);
            SequenceNumber sequenceNumber     = new SequenceNumber {
                InnerValue = sequenceNumberUint
            };

            // sourceAccount
            AccountID sourceAccount = new AccountID {
                InnerValue = SourceAccount.XdrPublicKey
            };

            // operations
            xdr.Operation[] operations = new xdr.Operation[Operations.Length];

            for (int i = 0; i < Operations.Length; i++)
            {
                operations[i] = Operations[i].ToXdr();
            }

            // ext
            xdr.Transaction.TransactionExt ext = new xdr.Transaction.TransactionExt {
                Discriminant = 0
            };

            xdr.Transaction transaction = new xdr.Transaction
            {
                Fee           = fee,
                SeqNum        = sequenceNumber,
                SourceAccount = sourceAccount,
                Operations    = operations,
                Memo          = Memo.ToXdr(),
                TimeBounds    = TimeBounds?.ToXdr(),
                Ext           = ext
            };
            return(transaction);
        }