Skip to content

Commit

Permalink
[Codegen] Remove PreferedSymbol, generate enum by handle (#40)
Browse files Browse the repository at this point in the history
* remove PreferedSymbol, generate enum by handle

* add test target
  • Loading branch information
hewigovens authored Jan 24, 2021
1 parent 98c4cbf commit 8638b40
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 218 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/bin

test: test-networks
go test -v ./...

test-networks:
cd ./networks; \
go test -v ./...; \

generate-coins:
@echo " > Generating coin file"
GOBIN=$(GOBIN) go run -tags=coins coin/gen.go
4 changes: 2 additions & 2 deletions address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ func EIP55ChecksumWanchain(address string) (string, error) {

func ToEIP55ByCoinID(str string, coinID uint) (string, error) {
switch coinID {
case coin.ETH, coin.POA, coin.ETC, coin.TOMO, coin.CLO, coin.TT, coin.GO:
case coin.ETHEREUM, coin.POA, coin.CLASSIC, coin.TOMOCHAIN, coin.CALLISTO, coin.THUNDERTOKEN, coin.GOCHAIN:
return EIP55Checksum(str)
case coin.WAN:
case coin.WANCHAIN:
return EIP55ChecksumWanchain(str)
default:
return str, nil
Expand Down
22 changes: 11 additions & 11 deletions address/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ func TestToEIP55ByCoinID(t *testing.T) {
name, address, expectedAddress string
coinID uint
}{
{"Ethereum", addr1, addr1EIP55, coin.ETH},
{"Ethereum Classic", addr1, addr1EIP55, coin.ETC},
{"Ethereum", addr1, addr1EIP55, coin.ETHEREUM},
{"Ethereum Classic", addr1, addr1EIP55, coin.CLASSIC},
{"POA", addr1, addr1EIP55, coin.POA},
{"Callisto", addr1, addr1EIP55, coin.CLO},
{"Tomochain", addr1, addr1EIP55, coin.TOMO},
{"Thunder", addr1, addr1EIP55, coin.TT},
{"Thunder", addr1, addr1EIP55, coin.TT},
{"GoChain", addr1, addr1EIP55, coin.GO},
{"Wanchain 1", wanAddrLowercase, wanAddrEIP55ChecksumWanchain, coin.WAN},
{"Wanchain 2", wanAddrEIP55Checksum, wanAddrEIP55ChecksumWanchain, coin.WAN},
{"Non Ethereum like chain 1", "", "", coin.TRX},
{"Non Ethereum like chain 2", addr1, addr1, coin.BNB},
{"Callisto", addr1, addr1EIP55, coin.CALLISTO},
{"Tomochain", addr1, addr1EIP55, coin.TOMOCHAIN},
{"Thunder", addr1, addr1EIP55, coin.THUNDERTOKEN},
{"Thunder", addr1, addr1EIP55, coin.THUNDERTOKEN},
{"GoChain", addr1, addr1EIP55, coin.GOCHAIN},
{"Wanchain 1", wanAddrLowercase, wanAddrEIP55ChecksumWanchain, coin.WANCHAIN},
{"Wanchain 2", wanAddrEIP55Checksum, wanAddrEIP55ChecksumWanchain, coin.WANCHAIN},
{"Non Ethereum like chain 1", "", "", coin.TRON},
{"Non Ethereum like chain 2", addr1, addr1, coin.BINANCE},
}
)

Expand Down
Loading

0 comments on commit 8638b40

Please sign in to comment.