Repository: trustwallet/blockatlas
Pull request #950 (2020-03-02 14:19:50)

Minor: Update images to use assets repository
## Summary

The README.md file is using the deprecated (as of August 09, 2019) [TrustWallet/tokens](https://github.com/trustwallet/tokens) repository to fetch coins / tokens logo for display.

## Proposal

This PR updates the README.md to use the new repository in charge of this job, which is [TrustWallet/assets](https://github.com/trustwallet/assets).

It also update the website for Ethereum Classic.


Patch:
diff --git a/README.md b/README.md
index 1d77263..f29a0b9 100644
--- a/README.md
+++ b/README.md
@@ -17,26 +17,26 @@ The observer API watches the chain for new transactions and generates notificati
 
 #### Supported Coins
 
-<a href="https://binance.com" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/714.png" width="32" /></a>
-<a href="https://nimiq.com" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/242.png" width="32" /></a>
-<a href="https://ripple.com" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/144.png" width="32" /></a>
-<a href="https://stellar.org" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/148.png" width="32" /></a>
-<a href="https://kin.org" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/2017.png" width="32" /></a>
-<a href="https://tezos.com" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/1729.png" width="32" /></a>
-<a href="https://aion.network" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/425.png" width="32" /></a>
-<a href="https://ethereum.org" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/60.png" width="32" /></a>
-<a href="https://ethereumclassic.github.io" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/61.png" width="32" /></a>
-<a href="https://poa.network" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/178.png" width="32" /></a>
-<a href="https://callisto.network" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/820.png" width="32" /></a>
-<a href="https://gochain.io" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/6060.png" width="32" /></a>
-<a href="https://wanchain.org" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/5718350.png" width="32" /></a>
-<a href="https://thundercore.com" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/1001.png" width="32" /></a>
-<a href="https://icon.foundation" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/74.png" width="32" /></a>
-<a href="https://tron.network" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/195.png" width="32" /></a>
-<a href="https://vechain.org/" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/818.png" width="32" /></a>
-<a href="https://www.thetatoken.org/" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/500.png" width="32" /></a>
-<a href="https://cosmos.network/" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/118.png" width="32" /></a>
-<a href="https://bitcoin.org/" target="_blank"><img src="https://raw.githubusercontent.com/TrustWallet/tokens/master/coins/0.png" width="32" /></a>
+<a href="https://binance.com" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/binance/info/logo.png" width="32" /></a>
+<a href="https://nimiq.com" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nimiq/info/logo.png" width="32" /></a>
+<a href="https://ripple.com" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png" width="32" /></a>
+<a href="https://stellar.org" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png" width="32" /></a>
+<a href="https://kin.org" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/kin/info/logo.png" width="32" /></a>
+<a href="https://tezos.com" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tezos/info/logo.png" width="32" /></a>
+<a href="https://aion.network" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aion/info/logo.png" width="32" /></a>
+<a href="https://ethereum.org" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png" width="32" /></a>
+<a href="https://ethereumclassic.org/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/classic/info/logo.png" width="32" /></a>
+<a href="https://poa.network" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/poa/info/logo.png" width="32" /></a>
+<a href="https://callisto.network" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/callist/info/logo.png" width="32" /></a>
+<a href="https://gochain.io" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/gochain/info/logo.png" width="32" /></a>
+<a href="https://wanchain.org" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/wanchain/info/logo.png" width="32" /></a>
+<a href="https://thundercore.com" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/thundertoken/info/logo.png" width="32" /></a>
+<a href="https://icon.foundation" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/icon/info/logo.png" width="32" /></a>
+<a href="https://tron.network" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png" width="32" /></a>
+<a href="https://vechain.org/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/vechain/info/logo.png" width="32" /></a>
+<a href="https://www.thetatoken.org/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/theta/info/logo.png" width="32" /></a>
+<a href="https://cosmos.network/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cosmos/info/logo.png" width="32" /></a>
+<a href="https://bitcoin.org/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png" width="32" /></a>
 <a href="https://harmony.one/" target="_blank"><img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/harmony/info/logo.png" width="32" /></a>
 
 ## Setup
diff --git a/platform/ethereum/model.go b/platform/ethereum/model.go
index e4f2e33..d8464d0 100644
--- a/platform/ethereum/model.go
+++ b/platform/ethereum/model.go
@@ -11,13 +11,8 @@ type Page struct {
 }
 
 type TokenPage struct {
-	Total uint    `json:"total"`
-	Docs  []Token `json:"docs"`
-}
-
-type Token struct {
-	Balance  string   `json:"balance"`
-	Contract Contract `json:"contract"`
+	Total uint       `json:"total"`
+	Docs  []Contract `json:"docs"`
 }
 
 type Doc struct {
@@ -54,7 +49,6 @@ type Contract struct {
 	Decimals    uint   `json:"decimals"`
 	TotalSupply string `json:"totalSupply,omitempty"`
 	Name        string `json:"name"`
-	Contract    string `json:"contract,omitempty"`
 }
 
 type NodeInfo struct {
diff --git a/platform/ethereum/token.go b/platform/ethereum/token.go
index cce551a..78b15f8 100644
--- a/platform/ethereum/token.go
+++ b/platform/ethereum/token.go
@@ -13,13 +13,13 @@ func (p *Platform) GetTokenListByAddress(address string) (blockatlas.TokenPage,
 }
 
 // NormalizeToken converts a Ethereum token into the generic model
-func NormalizeToken(srcToken *Token, coinIndex uint) (t blockatlas.Token, ok bool) {
+func NormalizeToken(srcToken *Contract, coinIndex uint) (t blockatlas.Token, ok bool) {
 	t = blockatlas.Token{
-		Name:     srcToken.Contract.Name,
-		Symbol:   srcToken.Contract.Symbol,
-		TokenID:  srcToken.Contract.Contract,
+		Name:     srcToken.Name,
+		Symbol:   srcToken.Symbol,
+		TokenID:  srcToken.Address,
 		Coin:     coinIndex,
-		Decimals: srcToken.Contract.Decimals,
+		Decimals: srcToken.Decimals,
 		Type:     blockatlas.TokenTypeERC20,
 	}
 
@@ -27,7 +27,7 @@ func NormalizeToken(srcToken *Token, coinIndex uint) (t blockatlas.Token, ok boo
 }
 
 // NormalizeTxs converts multiple Ethereum tokens
-func NormalizeTokens(srcTokens []Token, p Platform) []blockatlas.Token {
+func NormalizeTokens(srcTokens []Contract, p Platform) []blockatlas.Token {
 	tokenPage := make([]blockatlas.Token, 0)
 	for _, srcToken := range srcTokens {
 		token, ok := NormalizeToken(&srcToken, p.CoinIndex)


Test patch:
diff --git a/platform/ethereum/token_test.go b/platform/ethereum/token_test.go
index 1a87cdf..a2e9fdd 100644
--- a/platform/ethereum/token_test.go
+++ b/platform/ethereum/token_test.go
@@ -10,21 +10,17 @@ import (
 
 const tokenSrc = `
 {
-	"balance": "0",
-	"contract": {
-		"contract": "0xa14839c9837657efcde754ebeaf5cbecdd801b2a",
-		"address": "0xa14839c9837657efcde754ebeaf5cbecdd801b2a",
-		"name": "FusChain",
-		"decimals": 18,
-		"symbol": "FUS"
-	}
+	"address": "0xa14839c9837657EFcDE754EbEAF5cbECDd801B2A",
+	"name": "FusChain",
+	"decimals": 18,
+	"symbol": "FUS"
 }`
 
 var tokenDst = blockatlas.Token{
 	Name:     "FusChain",
 	Symbol:   "FUS",
 	Decimals: 18,
-	TokenID:  "0xa14839c9837657efcde754ebeaf5cbecdd801b2a",
+	TokenID:  "0xa14839c9837657EFcDE754EbEAF5cbECDd801B2A",
 	Coin:     coin.ETH,
 	Type:     blockatlas.TokenTypeERC20,
 }
@@ -44,7 +40,7 @@ func TestNormalizeToken(t *testing.T) {
 }
 
 func testNormalizeToken(t *testing.T, _test *testToken) {
-	var token Token
+	var token Contract
 	err := json.Unmarshal([]byte(_test.apiResponse), &token)
 	if err != nil {
 		t.Error(err)