Skip to content

Commit

Permalink
additional coins
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlong committed Dec 14, 2018
1 parent 97462ab commit ba67b5b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
24 changes: 24 additions & 0 deletions balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ func CryptoBalance(coin, address string) string {
fmt.Println(err)
return "0"
}
case "BCH":
balance, err = BitcoinBalance(BCHapi, address)
if err != nil {
fmt.Println(err)
return "0"
}
case "BCHTEST":
balance, err = BitcoinBalance(BCHTESTapi, address)
if err != nil {
fmt.Println(err)
return "0"
}
case "BTCTEST":
balance, err = BitcoinBalance(BTCTESTapi, address)
if err != nil {
Expand All @@ -32,10 +44,22 @@ func CryptoBalance(coin, address string) string {
if err != nil {
return "0"
}
case "DASH":
balance, err = BitcoinBalance(DASHapi, address)
if err != nil {
return "0"
}
case "ZCASH":
balance, err = BitcoinBalance(ZCASHapi, address)
if err != nil {
return "0"
}
case "ETH":
balance = EthBalance(eth, address)
case "ROPSTEN":
balance = EthBalance(ropsten, address)
case "RINKEBY":
balance = EthBalance(rinkeby, address)
default:
balance = "0"
}
Expand Down
5 changes: 5 additions & 0 deletions ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
var (
eth *ethclient.Client
ropsten *ethclient.Client
rinkeby *ethclient.Client
)

func LoadEthBlockchains() error {
Expand All @@ -27,6 +28,10 @@ func LoadEthBlockchains() error {
if err != nil {
return err
}
rinkeby, err = ethclient.Dial(RINKEBYapi)
if err != nil {
return err
}
return err
}

Expand Down
4 changes: 2 additions & 2 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func StartHTTPServer() {
r := Router()
srv := &http.Server{
Addr: "0.0.0.0:9090",
WriteTimeout: time.Second * 5,
ReadTimeout: time.Second * 5,
WriteTimeout: time.Second * 10,
ReadTimeout: time.Second * 10,
IdleTimeout: time.Second * 30,
Handler: r,
}
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ var (
LTCTESTapi string
ETHapi string
ROPSTENapi string
RINKEBYapi string
DASHapi string
ZCASHapi string
BCHapi string
BCHTESTapi string
statusHourHits int64
)

Expand Down
5 changes: 5 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func GetEnv() {
LTCTESTapi = os.Getenv("LTCTEST")
ETHapi = os.Getenv("ETH")
ROPSTENapi = os.Getenv("ROPSTEN")
RINKEBYapi = os.Getenv("RINKEBY")
DASHapi = os.Getenv("DASH")
ZCASHapi = os.Getenv("ZCASH")
BCHapi = os.Getenv("BCH")
BCHTESTapi = os.Getenv("BCHTEST")
}

func CoinMarketCapTicker() {
Expand Down

0 comments on commit ba67b5b

Please sign in to comment.