Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleWallet"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="network">The network.</param>
 /// <param name="wlt">The WLT.</param>
 /// <param name="encryptedPrivateKey">The encrypted private key.</param>
 internal SimpleWallet(string name, NetworkType.Types network, WalletObject wlt, EncryptedPrivateKey encryptedPrivateKey)
 {
     Name = name;
     EncryptedPrivateKey = encryptedPrivateKey;
     WalletObj           = wlt;
     Network             = network;
 }
Exemplo n.º 2
0
        internal static SimpleWallet CreateNewSimpleWallet(string name, Password password, PrivateAccount account, NetworkType.Types network)
        {
            var encKey = new EncryptedPrivateKey(CryptoUtils.EncodePrivateKey(account.PrivateKey, password.Value));

            var wlt = new WalletObject()
            {
                Accounts = new WalletAccounts()
                {
                    Account = new List <WalletAccount>
                    {
                        new WalletAccount
                        {
                            Address   = account.Address.Plain,
                            Algo      = "pass:bip32",
                            Brain     = false,
                            Child     = "",
                            Encrypted = encKey.EncryptedKey,
                            Iv        = encKey.Iv,
                            Label     = "Primary",
                            Network   = network.GetNetwork()
                        }
                    }
                },
                Name       = name,
                PrivateKey = ""
            };

            return(new SimpleWallet(name, network, wlt, encKey));
        }
Exemplo n.º 3
0
        private static string WalletAdapter(WalletObject wlt)
        {
            var newString = JsonConvert.SerializeObject(wlt);

            return(FindAndReplace(newString));
        }