コード例 #1
0
        public void GetWalletTest(string seedPhrase, bool isChange, int walletId, string actualAddress)
        {
            // #1
            var wallet  = ElectrumMnemonic.GetWallet(seedPhrase, walletId, isChange);
            var actual1 = wallet
                          .GetPublicKey()
                          .GetAddress(ScriptPubKeyType.Legacy, Network.Main)
                          .ToString();

            Assert.Equal(actualAddress, actual1);

            // #2
            var actual2 = ElectrumMnemonic.GetWalletAddress(seedPhrase, walletId, isChange);

            Assert.Equal(actualAddress, actual2);

            // #3
            var root = ElectrumMnemonic.GetExtRoot(seedPhrase);

            var wallet3 = ElectrumMnemonic.GetWallet(root, walletId, isChange);
            var actual3 = wallet3
                          .GetPublicKey()
                          .GetAddress(ScriptPubKeyType.Legacy, Network.Main)
                          .ToString();

            Assert.Equal(actualAddress, actual3);

            // #4
            var actual4 = ElectrumMnemonic.GetWalletAddress(root, walletId, isChange);

            Assert.Equal(actualAddress, actual4);
        }
コード例 #2
0
        public void GetExtRootTest(string input, string expected)
        {
            var actual      = ElectrumMnemonic.GetExtRoot(input);
            var actualXpriv = actual.GetWif(Network.Main).ToString();

            Assert.Equal(expected, actualXpriv);
        }