This commit is contained in:
1 parent
64f7eed9fd
commit
4c01dc4ea2
19 files changed
+4
-4
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package bitcoin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type Address struct {
|
||||
Address string `json:"address"`
|
||||
ChainStats struct {
|
||||
FundedTxoCount int `json:"funded_txo_count"`
|
||||
FundedTxoSum int `json:"funded_txo_sum"`
|
||||
SpentTxoCount int `json:"spent_txo_count"`
|
||||
SpentTxoSum int `json:"spent_txo_sum"`
|
||||
TxCount int `json:"tx_count"`
|
||||
} `json:"chain_stats"`
|
||||
MempoolStats struct {
|
||||
FundedTxoCount int `json:"funded_txo_count"`
|
||||
FundedTxoSum int `json:"funded_txo_sum"`
|
||||
SpentTxoCount int `json:"spent_txo_count"`
|
||||
SpentTxoSum int `json:"spent_txo_sum"`
|
||||
TxCount int `json:"tx_count"`
|
||||
} `json:"mempool_stats"`
|
||||
}
|
||||
|
||||
// GetAddress returns an Address struct populated with data from blockstream.info
|
||||
// for a given BTC address
|
||||
func (c *client) GetAddress(address string) (*Address, error) {
|
||||
addressResponse := &Address{}
|
||||
|
||||
err := c.get(fmt.Sprintf("address/%s", address), addressResponse, url.Values{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return addressResponse, nil
|
||||
}
|
||||
Reference in new issue
Block a user