Exemple #1
0
        public string BuildNewOrder(NewOrder newOrder)
        {
            Wallet.EnsureWalletIsReady();
            NewOrderMessage msgBean = CreateNewOrderMessage(newOrder);

            byte[] msg       = EncodeNewOrderMessage(msgBean);
            byte[] signature = EncodeSignature(Sign(msgBean));
            byte[] stdTx     = EncodeStdTx(msg, signature);
            return(EncodeUtils.ByteArrayToHex(stdTx));
        }
Exemple #2
0
 private byte[] EncodeNewOrderMessage(NewOrderMessage newOrderMessage)
 {
     proto.NewOrder newOrder = new proto.NewOrder
     {
         Sender      = ByteString.CopyFrom(Wallet.AddressBytes),
         Id          = newOrderMessage.Id,
         Symbol      = newOrderMessage.Symbol,
         Ordertype   = newOrderMessage.OrderType,
         Side        = newOrderMessage.Side,
         Price       = newOrderMessage.Price,
         Quantity    = newOrderMessage.Quantity,
         Timeinforce = newOrderMessage.TimeInForce
     };
     return(EncodeUtils.AminoWrap(newOrder.ToByteArray(), MessageType.GetTransactionType(EMessageType.NewOrder), false));
 }