예제 #1
0
        /// <summary>
        /// If [account] is not specified, returns the server's total available balance.
        /// If [account] is specified, returns the balance in the account.
        /// </summary>
        /// <param name="account">The account to get the balance for.</param>
        /// <returns>The balance of the account or the total wallet.</returns>
        public decimal GetBalance(string account = "")
        {
            var epStr = string.IsNullOrEmpty(account)
                ? MakeRequest <string>("getbalance", EmptyString)
                : MakeRequest <string>("getbalance", account);

            return(EpUtil.EpToDecimal(epStr));
        }
예제 #2
0
 /// <summary>
 /// Amount is a real and is rounded to the nearest 0.00000001.
 /// </summary>
 /// <param name="amount">Amount of transaction fee.</param>
 /// <returns>True if succesfull.</returns>
 public bool SetTxFee(decimal amount)
 {
     return(MakeRequest <bool>("settxfee", EpUtil.DecimalToEp(amount)));
 }
예제 #3
0
 /// <summary>
 /// Amount is a real and is rounded to 8 decimal places. Returns the transaction ID txid if successful.
 /// </summary>
 /// <param name="bitcoinAddress">Bitcoin address to sent to.</param>
 /// <param name="amount">Amount to send.</param>
 /// <param name="comment">Comment to go with the transaction.</param>
 /// <param name="commentTo">Comment for the 'to' field.</param>
 /// <returns>The transaction ID if succesful.</returns>
 public string SendToAddress(string bitcoinAddress, decimal amount, string comment, string commentTo)
 {
     return(MakeRequest <string>("sendtoaddress", bitcoinAddress, EpUtil.DecimalToEp(amount), comment, commentTo));
 }
예제 #4
0
        /// <summary>
        /// Send bitcoins to multiple addresses in one transaction.
        /// Amounts are double-precision floating point numbers.
        /// </summary>
        /// <param name="fromAccount">The account to send the bitcoins from.</param>
        /// <param name="toBitcoinAddress">A dictionary of address to send bitcoins to. The key is the address, the value is the amount of bitcoins to send.</param>
        /// <param name="minConf"></param>
        /// <param name="comment">A comment to provide with the transaction.</param>
        /// <returns>The transaction ID if succesful.</returns>
        public string SendMany(string fromAccount, Dictionary <string, decimal> toBitcoinAddress, int minConf = 1, string comment = "")
        {
            Dictionary <string, string> toBitcoinAddressEp = toBitcoinAddress.ToDictionary(item => item.Key, item => EpUtil.DecimalToEp(item.Value));

            return(MakeRequest <string>("sendmany", fromAccount, toBitcoinAddressEp, minConf, comment));
        }
예제 #5
0
 /// <summary>
 /// Amount is a real and is rounded to 8 decimal places. Will send the given amount to
 /// the given address, ensuring the account has a valid balance using [minconf]
 /// confirmations. Returns the transaction ID if successful (not in JSON object).
 /// </summary>
 /// <param name="fromAccount">From account.</param>
 /// <param name="toBitcoinAddress">Bitcoin address to move bitcoins to.</param>
 /// <param name="amount">Amount to move.</param>
 /// <param name="minConf"></param>
 /// <param name="comment">Comment to go with the transaction.</param>
 /// <param name="commentTo">Comment in the 'to' field.</param>
 /// <returns>The transaction ID if succesful.</returns>
 public string SendFrom(string fromAccount, string toBitcoinAddress, decimal amount, int minConf = 1, string comment = "", string commentTo = "")
 {
     return(MakeRequest <string>("sendfrom", fromAccount, toBitcoinAddress, EpUtil.DecimalToEp(amount), minConf, comment, commentTo));
 }
예제 #6
0
        /// <summary>
        /// Returns the total amount received by bitcoinaddress in transactions with at
        /// least [minconf] confirmations. While some might consider this obvious, value
        /// reported by this only considers *receiving* transactions. It does not check
        /// payments that have been made *from* this address. In other words, this is
        /// not "getaddressbalance". Works only for addresses in the local wallet,
        /// external addresses will always show 0.
        /// </summary>
        /// <param name="bitcoinAddress">The address to get the balance for.</param>
        /// <param name="minconf">Minimum amount of confirmations before a transaction is included.</param>
        /// <returns>The total amount received by the bitcoinaddress.</returns>
        public decimal GetReceivedByAddress(string bitcoinAddress, int minconf = 1)
        {
            var epStr = MakeRequest <string>("getreceivedbyaddress", bitcoinAddress, minconf);

            return(EpUtil.EpToDecimal(epStr));
        }