Do not export when not required
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2024-03-23 14:06:38 -06:00
parent 7d52632af6
commit 92a6246052
3 changed files with 9 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ import (
const fiatConvertURL = "https://api.coingecko.com/api/v3/coins/bitcoin?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false"
type FiatConversion struct {
type coinGeckoResponse struct {
MarketData struct {
CurrentPrice struct {
CAD int `json:"cad"`
@@ -15,8 +15,8 @@ type FiatConversion struct {
} `json:"market_data"`
}
func (c *client) ConvertBTCToCAD(amount int) (int, error) {
fiatConversion := &FiatConversion{}
func (c *client) convertBTCToCAD(amount int) (int, error) {
coinGeckoData := &coinGeckoResponse{}
req, err := http.NewRequest("GET", fiatConvertURL, nil)
if err != nil {
@@ -28,10 +28,10 @@ func (c *client) ConvertBTCToCAD(amount int) (int, error) {
return 0, fmt.Errorf("http GET request failed: %v", err)
}
err = c.processResponse(res, fiatConversion)
err = c.processResponse(res, coinGeckoData)
if err != nil {
return 0, fmt.Errorf("failed to process response: %v", err)
}
return (amount * int(fiatConversion.MarketData.CurrentPrice.CAD*1000)) / 100000000, nil // one BTC = one hundred million satoshi's
return (amount * int(coinGeckoData.MarketData.CurrentPrice.CAD*1000)) / 100000000, nil // one BTC = one hundred million satoshi's
}