Пример #1
0
        public WalletAddress GetAddress(Currency currency, int chain, uint index)
        {
            var publicKeyBytes = KeyStorage.GetPublicKey(currency, chain, index);

            if (publicKeyBytes == null)
            {
                return(null);
            }

            var address = currency.AddressFromKey(publicKeyBytes);

            return(new WalletAddress
            {
                Currency = currency,
                Address = address,
                PublicKey = Convert.ToBase64String(publicKeyBytes),
                KeyIndex = new KeyIndex {
                    Chain = chain, Index = index
                }
            });
        }
Пример #2
0
        public WalletAddress GetAddress(Currency currency, int chain, uint index)
        {
            using var securePublicKey = KeyStorage.GetPublicKey(currency, chain, index);

            if (securePublicKey == null)
            {
                return(null);
            }

            using var publicKey = securePublicKey.ToUnsecuredBytes();

            var address = currency.AddressFromKey(publicKey);

            return(new WalletAddress
            {
                Currency = currency.Name,
                Address = address,
                PublicKey = Convert.ToBase64String(publicKey),
                KeyIndex = new KeyIndex {
                    Chain = chain, Index = index
                }
            });
        }