Esempio n. 1
0
        public void VoteTest()
        {
            //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);

            Vote vote = new Vote()
            {
                ProposalId = 347,
                Option     = 1
            };

            //VoteMessage voteMessage = assembler.createVoteMessage(vote);
            //byte[] encodedMsg = assembler.encodeVoteMessage(voteMessage);
            //Assert.Equal("a1cadd3608db021214d8e1f06bf747f71907c130bf63f2b4a943b584b01801", EncodeUtils.bytesToHex(encodedMsg));
            //byte[] signature = assembler.sign(voteMessage);
            //Assert.Equal("37f4f39cf414461c478f166a2d59705dd8566fd573214c5c002a075d6a6d86c237d6f237c35983d001e4b322b1d0f9cef9328d670f163600e3af2226792c4b16".toLowerCase(), EncodeUtils.bytesToHex(signature));
            //byte[] encodedSignature = assembler.encodeSignature(signature);
            //Assert.Equal("0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c124037f4f39cf414461c478f166a2d59705dd8566fd573214c5c002a075d6a6d86c237d6f237c35983d001e4b322b1d0f9cef9328d670f163600e3af2226792c4b162009", EncodeUtils.bytesToHex(encodedSignature));
            //Assert.Equal("9301f0625dee0a1fa1cadd3608db021214d8e1f06bf747f71907c130bf63f2b4a943b584b01801126c0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c124037f4f39cf414461c478f166a2d59705dd8566fd573214c5c002a075d6a6d86c237d6f237c35983d001e4b322b1d0f9cef9328d670f163600e3af2226792c4b162009", EncodeUtils.bytesToHex(assembler.encodeStdTx(encodedMsg, encodedSignature)));

            string build = assembler.BuildVote(vote);

            Assert.Equal("9301f0625dee0a1fa1cadd3608db021214d8e1f06bf747f71907c130bf63f2b4a943b584b01801126c0a26eb5ae987210280ec8943329305e43b2e6112728423ef9f9a7e7125621c3545c2f30ce08bf83c124037f4f39cf414461c478f166a2d59705dd8566fd573214c5c002a075d6a6d86c237d6f237c35983d001e4b322b1d0f9cef9328d670f163600e3af2226792c4b162009", build, true);
        }