예제 #1
0
파일: Matcher.cs 프로젝트: 0bsnetwork/ZbsCS
        public string PlaceOrder(PrivateKeyAccount sender, Order order)
        {
            var bytes = order.GetBytes();

            order.Signature = sender.Sign(bytes);

            var json = order.GetJson();

            return(Http.Post($"{_host}/matcher/orderbook", json));
        }
예제 #2
0
파일: Matcher.cs 프로젝트: 0bsnetwork/ZbsCS
        private static NameValueCollection GetProtectionHeaders(PrivateKeyAccount account)
        {
            long timestamp = Utils.CurrentTimestamp();
            var  stream    = new MemoryStream(40);
            var  writer    = new BinaryWriter(stream);

            writer.Write(account.PublicKey);
            writer.WriteLong(timestamp);
            var signature = account.Sign(stream);

            return(new NameValueCollection
            {
                { "Timestamp", Convert.ToString(timestamp) },
                { "Signature", signature.ToBase58() }
            });
        }
예제 #3
0
파일: Matcher.cs 프로젝트: 0bsnetwork/ZbsCS
        public static DictionaryObject MakeOrderCancelRequest(PrivateKeyAccount sender, string orderId)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            writer.Write(sender.PublicKey);
            writer.Write(Base58.Decode(orderId));
            var signature = sender.Sign(stream);

            return(new DictionaryObject
            {
                { "sender", sender.PublicKey.ToBase58() },
                { "orderId", orderId },
                { "signature", signature.ToBase58() }
            });
        }
예제 #4
0
파일: Matcher.cs 프로젝트: 0bsnetwork/ZbsCS
        public static DictionaryObject MakeCancelAllRequest(PrivateKeyAccount sender)
        {
            long timestamp = Utils.CurrentTimestamp();
            var  stream    = new MemoryStream();
            var  writer    = new BinaryWriter(stream);

            writer.Write(sender.PublicKey);
            writer.WriteLong(timestamp);
            var signature = sender.Sign(stream);

            return(new DictionaryObject
            {
                { "sender", sender.PublicKey.ToBase58() },
                { "timestamp", timestamp },
                { "signature", signature.ToBase58() }
            });
        }
예제 #5
0
 public static T Sign <T>(this T transaction, PrivateKeyAccount account, int proofIndex = 0) where T : Transaction
 {
     transaction.Proofs[proofIndex] = account.Sign(transaction.GetBody());
     return(transaction);
 }
예제 #6
0
 public static Order Sign(this Order order, PrivateKeyAccount account)
 {
     order.Signature = account.Sign(order.GetBytes());
     return(order);
 }