Пример #1
0
        public void BuildTokenFreezeMessageTest()
        {
            Wallet w = new Wallet("1E5B4C6DDDB2BDD6B40344808812D6D3254D7D4E105A52BA51C032EB7BAC1035", Network.Test);

            w.SetSequence(0);//Have to reset, wallet automatically refreshes it's sequence on creation
            var msgBytes    = BroadcastMessageBuilder.BuildTokenFreezeMessage("BNB", 1, w);
            var msgStr      = BitConverter.ToString(msgBytes).Replace("-", "").ToUpper();
            var expectedStr = "9A01F0625DEE0A24E774B32D0A141B0A2CFFAE1193EE0BDE3E01C62E34D82E3BFA0A1203424E421880C2D72F126E0A26EB5AE9872103D2B6A5194D34703971E6C7544B2E5CE687AF7CF58346F662936D8E26C20A30131240A9A436A15F7239EB2A9265C84C88925561A9B44E54A159F121921D10853D4EFB52520FC963942F602C552AA87B6D4B401632E3C1305B3D993DAF926D6717BB1118ECE028";

            Assert.AreEqual(msgStr, expectedStr);
        }
Пример #2
0
        private static void BroadcastRPC()
        {
            Client        client    = new Client(privateKey, Network.Test);
            NodeRPCClient clientRPC = new NodeRPCClient("wss://seed-pre-s3.binance.org/websocket");

            //Streamline send 20 times
            for (int i = 0; i < 20; i++)
            {
                var msg  = BroadcastMessageBuilder.BuildTokenFreezeMessage("BNB", (decimal)0.001, client.Wallet);
                var resp = clientRPC.BroadcastTransaction(msg, RPCBroadcastMode.async);
                client.Wallet.IncrementSequence();
                cwf(resp);
            }
        }
Пример #3
0
 public BroadcastResponse FreezeToken(string coin, decimal amount)
 {
     //Ensure no other broadcast transaction interferes with sequence until it hit the blockchain
     lock (BroadcastLockObject)
     {
         if (VerifySequenceBeforeSend)
         {
             Wallet.RefreshSequence();
         }
         var msg    = BroadcastMessageBuilder.BuildTokenFreezeMessage(coin, amount, Wallet);
         var result = HTTP.BroadcastToBlockchain(msg, WaitForTransactionConfirmationOnBroadcast);
         if (result.ok)
         {
             _wallet.IncrementSequence();
         }
         return(result);
     }
 }