diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 80ef2a5..8d09d1a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -37,4 +37,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.50.1 + version: v1.52.2 diff --git a/Makefile b/Makefile index 66a589e..cc937bb 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,9 @@ lint: go-lint-install go-lint go-lint-install: ifeq (,$(wildcard test -f bin/golangci-lint)) @echo " > Installing golint" - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.50.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.52.2 endif go-lint: @echo " > Running golint" - bin/golangci-lint run --timeout=2m \ No newline at end of file + bin/golangci-lint run --timeout=2m diff --git a/coin/coins.go b/coin/coins.go index d88d847..47debd5 100644 --- a/coin/coins.go +++ b/coin/coins.go @@ -1,6 +1,6 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2023-04-03 19:43:37.161039 +0300 EEST m=+0.003908626 +// 2023-05-02 20:44:37.644868 +0200 CEST m=+0.003585168 // using data from coins.yml package coin @@ -136,6 +136,7 @@ const ( POLYGONZKEVM = 10001101 ZKSYNC = 10000324 SUI = 784 + STRIDE = 40000118 ) var Coins = map[uint]Coin{ @@ -1049,6 +1050,16 @@ var Coins = map[uint]Coin{ MinConfirmations: 0, Blockchain: "Sui", }, + STRIDE: { + ID: 40000118, + Handle: "stride", + Symbol: "STRD", + Name: "Stride", + Decimals: 6, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Cosmos", + }, } var Chains = map[string]Coin{ @@ -1962,6 +1973,16 @@ var Chains = map[string]Coin{ MinConfirmations: 0, Blockchain: "Sui", }, + Stride().Handle: { + ID: 40000118, + Handle: "stride", + Symbol: "STRD", + Name: "Stride", + Decimals: 6, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Cosmos", + }, } func Ethereum() Coin { @@ -2327,3 +2348,7 @@ func Zksync() Coin { func Sui() Coin { return Coins[SUI] } + +func Stride() Coin { + return Coins[STRIDE] +} diff --git a/coin/coins.yml b/coin/coins.yml index f3a4408..d7792e6 100644 --- a/coin/coins.yml +++ b/coin/coins.yml @@ -692,3 +692,10 @@ name: Sui decimals: 9 blockchain: Sui + +- id: 40000118 + symbol: STRD + handle: stride + name: Stride + decimals: 6 + blockchain: Cosmos diff --git a/coin/models.go b/coin/models.go index dcba701..47e836a 100644 --- a/coin/models.go +++ b/coin/models.go @@ -132,6 +132,8 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) { return fmt.Sprintf("https://explorer.zksync.io/address/%s", tokenID), nil case SUI: return fmt.Sprintf("https://explorer.sui.io/address/%s", tokenID), nil + case STRIDE: + return fmt.Sprintf("https://www.mintscan.io/stride/account/%s", tokenID), nil } return "", errors.New("no explorer for coin: " + c.Handle) diff --git a/coin/models_test.go b/coin/models_test.go index d1ccc2b..e8b8345 100644 --- a/coin/models_test.go +++ b/coin/models_test.go @@ -284,6 +284,16 @@ func TestGetCoinExploreURL(t *testing.T) { want: "https://explorer.sui.io/address/test", wantErr: false, }, + { + name: "Test Stride", + args: args{ + addr: "test", + tokenType: "Stride", + chain: Stride(), + }, + want: "https://www.mintscan.io/stride/account/test", + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/types/chain.go b/types/chain.go index 039a3a1..dba8633 100644 --- a/types/chain.go +++ b/types/chain.go @@ -111,6 +111,8 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) { return coin.Zksync(), nil case SUI: return coin.Sui(), nil + case STRIDE: + return coin.Stride(), nil } return coin.Coin{}, errors.New("unknown asset type: " + assetType) diff --git a/types/token.go b/types/token.go index 2c3a134..0a53cef 100644 --- a/types/token.go +++ b/types/token.go @@ -89,6 +89,7 @@ const ( POLYGONZKEVM TokenType = "ZKEVM" ZKSYNC TokenType = "ZKSYNC" SUI TokenType = "SUI" + STRIDE TokenType = "STRIDE" ) const ( @@ -167,6 +168,7 @@ func GetTokenTypes() []TokenType { POLYGONZKEVM, ZKSYNC, SUI, + STRIDE, } } @@ -234,6 +236,8 @@ func GetTokenType(c uint, tokenID string) (string, bool) { return string(TON), true case coin.SUI: return string(SUI), true + case coin.STRIDE: + return string(STRIDE), true default: return "", false } @@ -283,7 +287,7 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) { case TON, POLYGONZKEVM, ZKSYNC, SUI: return TokenVersionV12, nil case ERC721, ERC1155, EOS, NEP5, VET, ONTOLOGY, THETA, TOMO, POA, OASIS, ALGORAND, - KAVAERC20, METER, EVMOS_ERC20, KIP20, MOONBEAM, KLAYTN, METIS, MOONRIVER, BOBA: + KAVAERC20, METER, EVMOS_ERC20, KIP20, MOONBEAM, KLAYTN, METIS, MOONRIVER, BOBA, STRIDE: return TokenVersionUndefined, nil default: // This should not happen, as it is guarded by TestGetTokenVersionImplementEverySupportedTokenTypes @@ -371,6 +375,8 @@ func GetEthereumTokenTypeByIndex(coinIndex uint) (TokenType, error) { tokenType = ZKSYNC case coin.SUI: tokenType = SUI + case coin.STRIDE: + tokenType = STRIDE } if tokenType == "" { diff --git a/types/token_test.go b/types/token_test.go index 143a308..7ca6a18 100644 --- a/types/token_test.go +++ b/types/token_test.go @@ -323,6 +323,12 @@ func TestGetTokenType(t *testing.T) { want: string(SUI), wantBool: true, }, + { + name: "Stride", + args: args{coin.STRIDE, ""}, + want: string(STRIDE), + wantBool: true, + }, } for _, tt := range tests { @@ -484,6 +490,13 @@ func TestGetTokenVersion(t *testing.T) { TokenVersionV12, nil, }, + + { + "Stride token version", + args{t: string(STRIDE)}, + TokenVersionUndefined, + nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {