コード例 #1
0
        public void TokenUnfreezeTest()
        {
            //List<String> words = Arrays.asList("trial raw kiss bench silent crystal clever cloud chapter obvious error income mechanic attend army outer found cube tribe sort south possible scene fox".split(" "));
            //Wallet wallet = Wallet.createWalletFromMnemonicCode(words, BinanceDexEnvironment.TEST_NET);
            Wallet wallet = Wallet.FromPrivateKey("84c4226a24732e2d832e9d932779adfb9b95401ee607086967c7c5bba1e3a18e", BinanceDexEnvironment.TEST_NET);

            Assert.Equal("tbnb1mrslq6lhglm3jp7pxzlk8u4549pmtp9sgvn2rc", wallet.Address);

            wallet.AccountNumber = 0;
            wallet.Sequence      = 9L;
            wallet.ChainId       = "test-chain-n4b735";

            TransactionOption options = new TransactionOption {
                Memo = "", Source = 0, Data = null
            };
            TransactionRequest assembler = new TransactionRequest(wallet, options);

            TokenUnfreeze tokenUnfreeze = new TokenUnfreeze()
            {
                Amount = "1",
                Symbol = "NNB-C3F"
            };

            //TokenUnfreezeMessage msgBean = assembler.createTokenUnfreezeMessage(tu);
            //byte[] encodedMsg = assembler.encodeTokenUnfreezeMessage(msgBean);
            //Assert.assertEquals("6515ff0d0a14d8e1f06bf747f71907c130bf63f2b4a943b584b012074e4e422d4333461880c2d72f", EncodeUtils.bytesToHex(encodedMsg));
            //byte[] signature = assembler.sign(msgBean);
            //Assert.assertEquals("9ceabe0262a75b0da7556303580f56a094486cc9938a728f903a57054061bd833288979fbc8dc5ee07743df5110cb773c25d9974f34158a4f6ed6ac6899740c2".toLowerCase(), EncodeUtils.bytesToHex(signature));
            //byte[] encodedSignature = assembler.encodeSignature(signature);
            //Assert.assertEquals("0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c12409ceabe0262a75b0da7556303580f56a094486cc9938a728f903a57054061bd833288979fbc8dc5ee07743df5110cb773c25d9974f34158a4f6ed6ac6899740c22009", EncodeUtils.bytesToHex(encodedSignature));
            //Assert.assertEquals("9c01f0625dee0a286515ff0d0a14d8e1f06bf747f71907c130bf63f2b4a943b584b012074e4e422d4333461880c2d72f126c0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c12409ceabe0262a75b0da7556303580f56a094486cc9938a728f903a57054061bd833288979fbc8dc5ee07743df5110cb773c25d9974f34158a4f6ed6ac6899740c22009", EncodeUtils.bytesToHex(assembler.encodeStdTx(encodedMsg, encodedSignature)));

            string build = assembler.BuildTokenUnfreeze(tokenUnfreeze);

            Assert.Equal("9c01f0625dee0a286515ff0d0a14d8e1f06bf747f71907c130bf63f2b4a943b584b012074e4e422d4333461880c2d72f126c0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c12409ceabe0262a75b0da7556303580f56a094486cc9938a728f903a57054061bd833288979fbc8dc5ee07743df5110cb773c25d9974f34158a4f6ed6ac6899740c22009", build, true);
        }