Skip to content

Commit

Permalink
Add GetBalanceMinConfType to specify balance type.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi committed Feb 19, 2016
1 parent 2d67a90 commit c222e4a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions wallet.go
Expand Up @@ -1903,6 +1903,29 @@ func (c *Client) GetBalanceMinConf(account string, minConfirms int) (dcrutil.Amo
return c.GetBalanceMinConfAsync(account, minConfirms).Receive()
}

// GetBalanceMinConfTypeAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetBalanceMinConfType for the blocking version and more details.
func (c *Client) GetBalanceMinConfTypeAsync(account string, minConfirms int, balanceType string) FutureGetBalanceResult {
cmd := dcrjson.NewGetBalanceCmd(&account, &minConfirms, &balanceType)
return c.sendCmd(cmd)
}

// GetBalanceMinConfType returns the available balance from the server for the
// specified account using the specified number of minimum confirmations and
// balance type. The account may be "*" for all accounts.
//
// See GetBalanceMinConf to use the default balance type.
func (c *Client) GetBalanceMinConfType(account string, minConfirms int, balanceType string) (dcrutil.Amount, error) {
if c.config.EnableBCInfoHacks {
response := c.GetBalanceMinConfAsync(account, minConfirms)
return FutureGetBalanceParseResult(response).Receive()
}
return c.GetBalanceMinConfTypeAsync(account, minConfirms, balanceType).Receive()
}

// FutureGetReceivedByAccountResult is a future promise to deliver the result of
// a GetReceivedByAccountAsync or GetReceivedByAccountMinConfAsync RPC
// invocation (or an applicable error).
Expand Down

0 comments on commit c222e4a

Please sign in to comment.