Repository: trustwallet/blockatlas
Pull request #875 (2020-02-15 00:36:43)

Add description and description to CoinInfo
Depends on merging this first: https://github.com/trustwallet/assets/pull/1235

Route for coin:
`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/info.json` and token `https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/binance/assets/BUSD-BD1/info.json`


Patch:
diff --git a/pkg/blockatlas/marketdata.go b/pkg/blockatlas/marketdata.go
index bb16b86..7e6c14f 100644
--- a/pkg/blockatlas/marketdata.go
+++ b/pkg/blockatlas/marketdata.go
@@ -48,14 +48,15 @@ type ChartCoinInfo struct {
 }
 
 type CoinInfo struct {
-	Name       string       `json:"name,omitempty"`
-	Website    string       `json:"website,omitempty"`
-	SourceCode string       `json:"source_code,omitempty"`
-	Whitepaper string       `json:"whitepaper,omitempty"`
-	Explorers  []Link       `json:"explorers,omitempty"`
-	Socials    []SocialLink `json:"socials,omitempty"`
-	Details    []Detail     `json:"details,omitempty"`
-	DataSource string       `json:"data_source,omitempty"`
+	Name             string       `json:"name,omitempty"`
+	Website          string       `json:"website,omitempty"`
+	SourceCode       string       `json:"source_code,omitempty"`
+	WhitePaper       string       `json:"white_paper,omitempty"`
+	Description      string       `json:"description,omitempty"`
+	ShortDescription string       `json:"short_description,omitempty"`
+	Explorers        []Link       `json:"explorers,omitempty"`
+	Socials          []SocialLink `json:"socials,omitempty"`
+	DataSource       string       `json:"data_source,omitempty"`
 }
 
 type SocialLink struct {
@@ -69,11 +70,6 @@ type Link struct {
 	Url  string `json:"url"`
 }
 
-type Detail struct {
-	Language    string `json:"language"`
-	Description string `json:"description"`
-}
-
 func (t *Ticker) SetCoinId(coinId uint) {
 	t.Coin = coinId
 	t.CoinName = ""
diff --git a/services/assets/info.go b/services/assets/info.go
index 416bed2..ca33c29 100644
--- a/services/assets/info.go
+++ b/services/assets/info.go
@@ -14,13 +14,13 @@ func GetCoinInfo(coinId int, token string) (info *blockatlas.CoinInfo, err error
 	}
 	url := getCoinInfoUrl(c, token)
 	request := blockatlas.InitClient(url)
-	err = request.GetWithCache(&info, "info/info.json", nil, time.Hour*1)
+	err = request.GetWithCache(&info, "/info.json", nil, time.Hour*1)
 	return
 }
 
 func getCoinInfoUrl(c coin.Coin, token string) string {
 	if len(token) == 0 {
-		return AssetsURL + c.Handle
+		return AssetsURL + c.Handle + "/info"
 	}
 	return AssetsURL + c.Handle + "/assets/" + token
 }


Test patch:
diff --git a/services/assets/info_test.go b/services/assets/info_test.go
index 6b5e5f7..bc7a280 100644
--- a/services/assets/info_test.go
+++ b/services/assets/info_test.go
@@ -15,10 +15,10 @@ func Test_getCoinInfoUrl(t *testing.T) {
 		args args
 		want string
 	}{
-		{"test Ethereum coin", args{coin.Ethereum(), ""}, AssetsURL + coin.Ethereum().Handle},
+		{"test Ethereum coin", args{coin.Ethereum(), ""}, AssetsURL + coin.Ethereum().Handle + "/info"},
 		{"test Ethereum token", args{coin.Ethereum(), "0x0000000000b3F879cb30FE243b4Dfee438691c04"}, AssetsURL + coin.Ethereum().Handle + "/assets/" + "0x0000000000b3F879cb30FE243b4Dfee438691c04"},
-		{"test Binance coin", args{coin.Binance(), ""}, AssetsURL + coin.Binance().Handle},
-		{"test Binance token", args{coin.Binance(), "0x0000000000b3F879cb30FE243b4Dfee438691c04"}, AssetsURL + coin.Binance().Handle + "/assets/" + "0x0000000000b3F879cb30FE243b4Dfee438691c04"},
+		{"test Binance coin", args{coin.Binance(), ""}, AssetsURL + coin.Binance().Handle + "/info"},
+		{"test Binance token", args{coin.Binance(), "BUSD-BD1"}, AssetsURL + coin.Binance().Handle + "/assets/" + "BUSD-BD1"},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {