async public static Task <List <string> > GetWallets(BitcoinClient bitcoinClient)
        {
            Wallet wallet    = new Wallet(bitcoinClient);
            string walletDir = await wallet.ListWalletDir();

            WalletDir   walletDir1 = JsonSerializer.Deserialize <WalletDir>(walletDir);
            List <Wllt> wllt       = walletDir1.Result.Wallets;

            List <string> wallets = new List <string>();

            foreach (Wllt w in wllt)
            {
                wallets.Add(w.Name);
            }

            return(wallets);
        }
Exemple #2
0
        public HttpRequest(BitcoinClient bitcoinClient, string activeWallet = null)
        {
            this.bitcoinClient = bitcoinClient;
            this.nodeAddress   = activeWallet;
            if (nodeAddress != null)
            {
                nodeAddress = bitcoinClient.NodeAddress + "/wallet/" + activeWallet;
            }
            else
            {
                nodeAddress = bitcoinClient.NodeAddress;
            }


            httpClient         = new HttpClient();
            httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, nodeAddress);
            httpClient.DefaultRequestHeaders
            .Accept
            .Add(new MediaTypeWithQualityHeaderValue("application/json"));

            byteArrayPassword = Encoding.ASCII.GetBytes(bitcoinClient.UserPassword);
            base64            = Convert.ToBase64String(byteArrayPassword);
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64);
        }