Beispiel #1
0
        public void BuildCancelOrderMessageTest()
        {
            Wallet w = new Wallet("1E5B4C6DDDB2BDD6B40344808812D6D3254D7D4E105A52BA51C032EB7BAC1035", Network.Test);

            w.SetSequence(0);//Have to reset, wallet automatically refreshes it's sequence on creation
            var msgBytes    = BroadcastMessageBuilder.BuildCancelOrderMessage("000-EF6_BNB", "34D5035164CA688605D4423668931B692BBD2654-28", w);
            var msgStr      = BitConverter.ToString(msgBytes).Replace("-", "").ToUpper();
            var expectedStr = "CA01F0625DEE0A54166E681B0A141B0A2CFFAE1193EE0BDE3E01C62E34D82E3BFA0A120B3030302D4546365F424E421A2B333444353033353136344341363838363035443434323336363839333142363932424244323635342D3238126E0A26EB5AE9872103D2B6A5194D34703971E6C7544B2E5CE687AF7CF58346F662936D8E26C20A3013124089FE21047FDC597C7AE434A8DB91E38796C933D029FA2CD7BA3B3C8D519C6D472F3B84CAA4FC75863033D7EE843BA2E4C0D8E0465BDC3EC7834FE581A7F355AC18ECE028";

            Assert.AreEqual(msgStr, expectedStr);
        }
Beispiel #2
0
 public BroadcastResponse CancelOrder(string symbol, string refId)
 {
     //Ensure no other broadcast transaction interferes with sequence until it hit the blockchain
     lock (BroadcastLockObject)
     {
         if (VerifySequenceBeforeSend)
         {
             Wallet.RefreshSequence();
         }
         var msg    = BroadcastMessageBuilder.BuildCancelOrderMessage(symbol, refId, Wallet);
         var result = HTTP.BroadcastToBlockchain(msg, WaitForTransactionConfirmationOnBroadcast);
         if (result.ok)
         {
             _wallet.IncrementSequence();
         }
         return(result);
     }
 }