diff --git a/coin/coins.go b/coin/coins.go index b9dd2a5..e79e0e0 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 -// 2024-05-31 22:36:18.175544 -0300 -03 m=+0.002313543 +// 2024-06-14 09:56:59.135704 -0300 -03 m=+0.004544632 // using data from coins.yml package coin @@ -23,7 +23,7 @@ type Coin struct { BlockTime int MinConfirmations int64 Blockchain string // Name of the Blockchain which core is used for this network - IsTokenSupported bool // Indicate whether the backend supports token parsing for this network + IsTokenSupported bool // Indicate whether the backend supports token parsing for this network } type AssetID string @@ -46,124 +46,125 @@ func (c Coin) TokenAssetID(t string) AssetID { } const ( - ETHEREUM = 60 - CLASSIC = 61 - ICON = 74 - COSMOS = 118 - RIPPLE = 144 - STELLAR = 148 - POA = 178 - TRON = 195 - FIO = 235 - NIMIQ = 242 - IOTEX = 304 - IOTEXEVM = 10004689 - ZILLIQA = 313 - AION = 425 - AETERNITY = 457 - KAVA = 459 - THETA = 500 - BINANCE = 714 - VECHAIN = 818 - CALLISTO = 820 - TOMOCHAIN = 889 - THUNDERTOKEN = 1001 - ONTOLOGY = 1024 - TEZOS = 1729 - KIN = 2017 - NEBULAS = 2718 - GOCHAIN = 6060 - WANCHAIN = 5718350 - WAVES = 5741564 - BITCOIN = 0 - LITECOIN = 2 - DOGE = 3 - DASH = 5 - VIACOIN = 14 - GROESTLCOIN = 17 - ZCASH = 133 - FIRO = 136 - BITCOINCASH = 145 - RAVENCOIN = 175 - QTUM = 2301 - ZELCASH = 19167 - DECRED = 42 - ALGORAND = 283 - NANO = 165 - DIGIBYTE = 20 - HARMONY = 1023 - KUSAMA = 434 - POLKADOT = 354 - SOLANA = 501 - NEAR = 397 - ELROND = 508 - SMARTCHAIN = 20000714 - FILECOIN = 461 - OASIS = 474 - MONACOIN = 22 - BITCOINGOLD = 156 - EOS = 194 - TERRA = 330 - BAND = 494 - NEO = 888 - CARDANO = 1815 - NULS = 8964 - POLYGON = 966 - THORCHAIN = 931 - OPTIMISM = 10000070 - XDAI = 10000100 - AVALANCHEC = 10009000 - HECO = 10000553 - FANTOM = 10000250 - ARBITRUM = 10042221 - CELO = 52752 - RONIN = 10002020 - OSMOSIS = 10000118 - CRONOS = 10000025 - KCC = 10000321 - AURORA = 1323161554 - KAVAEVM = 10002222 - METER = 18000 - EVMOS = 10009001 - NATIVEEVMOS = 20009001 - OKC = 996 - CRYPTOORG = 394 - APTOS = 637 - MOONBEAM = 10001284 - KLAYTN = 10008217 - METIS = 10001088 - MOONRIVER = 10001285 - BOBA = 10000288 - TON = 607 - POLYGONZKEVM = 10001101 - ZKSYNC = 10000324 - SUI = 784 - STRIDE = 40000118 - NEUTRON = 90000118 - STARGAZE = 20000118 - NATIVEINJECTIVE = 10000060 - CFXEVM = 1030 - ACALA = 787 - ACALAEVM = 10000787 - BASE = 8453 - AKASH = 17000118 - AGORIC = 564 - AXELAR = 50000118 - JUNO = 30000118 - SEI = 19000118 - NEON = 245022934 - OPBNB = 204 - LINEA = 59144 - GBNB = 5600 - MANTLE = 5000 - MANTA = 169 - ZETACHAIN = 10007000 - ZETAEVM = 20007000 - MERLIN = 4200 - BLAST = 81457 - SCROLL = 534352 + ETHEREUM = 60 + CLASSIC = 61 + ICON = 74 + COSMOS = 118 + RIPPLE = 144 + STELLAR = 148 + POA = 178 + TRON = 195 + FIO = 235 + NIMIQ = 242 + IOTEX = 304 + IOTEXEVM = 10004689 + ZILLIQA = 313 + AION = 425 + AETERNITY = 457 + KAVA = 459 + THETA = 500 + BINANCE = 714 + VECHAIN = 818 + CALLISTO = 820 + TOMOCHAIN = 889 + THUNDERTOKEN = 1001 + ONTOLOGY = 1024 + TEZOS = 1729 + KIN = 2017 + NEBULAS = 2718 + GOCHAIN = 6060 + WANCHAIN = 5718350 + WAVES = 5741564 + BITCOIN = 0 + LITECOIN = 2 + DOGE = 3 + DASH = 5 + VIACOIN = 14 + GROESTLCOIN = 17 + ZCASH = 133 + FIRO = 136 + BITCOINCASH = 145 + RAVENCOIN = 175 + QTUM = 2301 + ZELCASH = 19167 + DECRED = 42 + ALGORAND = 283 + NANO = 165 + DIGIBYTE = 20 + HARMONY = 1023 + KUSAMA = 434 + POLKADOT = 354 + SOLANA = 501 + NEAR = 397 + ELROND = 508 + SMARTCHAIN = 20000714 + FILECOIN = 461 + OASIS = 474 + MONACOIN = 22 + BITCOINGOLD = 156 + EOS = 194 + TERRA = 330 + BAND = 494 + NEO = 888 + CARDANO = 1815 + NULS = 8964 + POLYGON = 966 + THORCHAIN = 931 + OPTIMISM = 10000070 + XDAI = 10000100 + AVALANCHEC = 10009000 + HECO = 10000553 + FANTOM = 10000250 + ARBITRUM = 10042221 + CELO = 52752 + RONIN = 10002020 + OSMOSIS = 10000118 + CRONOS = 10000025 + KCC = 10000321 + AURORA = 1323161554 + KAVAEVM = 10002222 + METER = 18000 + EVMOS = 10009001 + NATIVEEVMOS = 20009001 + OKC = 996 + CRYPTOORG = 394 + APTOS = 637 + MOONBEAM = 10001284 + KLAYTN = 10008217 + METIS = 10001088 + MOONRIVER = 10001285 + BOBA = 10000288 + TON = 607 + POLYGONZKEVM = 10001101 + ZKSYNC = 10000324 + SUI = 784 + STRIDE = 40000118 + NEUTRON = 90000118 + STARGAZE = 20000118 + NATIVEINJECTIVE = 10000060 + CFXEVM = 1030 + ACALA = 787 + ACALAEVM = 10000787 + BASE = 8453 + AKASH = 17000118 + AGORIC = 564 + AXELAR = 50000118 + JUNO = 30000118 + SEI = 19000118 + NEON = 245022934 + OPBNB = 204 + LINEA = 59144 + GBNB = 5600 + MANTLE = 5000 + MANTA = 169 + ZETACHAIN = 10007000 + ZETAEVM = 20007000 + MERLIN = 4200 + BLAST = 81457 + SCROLL = 534352 INTERNET_COMPUTER = 223 - BOUNCEBIT = 6001 + BOUNCEBIT = 6001 + ZKLINKNOVA = 810180 ) var Coins = map[uint]Coin{ @@ -1465,6 +1466,17 @@ var Coins = map[uint]Coin{ Blockchain: "Ethereum", IsTokenSupported: false, }, + ZKLINKNOVA: { + ID: 810180, + Handle: "zklinknova", + Symbol: "ETH", + Name: "zkLink Nova", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, } var Chains = map[string]Coin{ @@ -2766,6 +2778,17 @@ var Chains = map[string]Coin{ Blockchain: "Ethereum", IsTokenSupported: false, }, + Zklinknova().Handle: { + ID: 810180, + Handle: "zklinknova", + Symbol: "ETH", + Name: "zkLink Nova", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, } func Ethereum() Coin { @@ -3240,3 +3263,6 @@ func Bouncebit() Coin { return Coins[BOUNCEBIT] } +func Zklinknova() Coin { + return Coins[ZKLINKNOVA] +} diff --git a/coin/coins.yml b/coin/coins.yml index b4fc4c8..3feef37 100644 --- a/coin/coins.yml +++ b/coin/coins.yml @@ -1053,3 +1053,11 @@ decimals: 18 blockchain: Ethereum isTokenSupported: false + +- id: 810180 + symbol: ETH + handle: zklinknova + name: zkLink Nova + decimals: 18 + blockchain: Ethereum + isTokenSupported: true diff --git a/coin/models.go b/coin/models.go index 1fb023c..257c41a 100644 --- a/coin/models.go +++ b/coin/models.go @@ -175,6 +175,8 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) { return fmt.Sprintf("https://blastscan.io/token/%s", tokenID), nil case SCROLL: return fmt.Sprintf("https://scrollscan.com/token/%s", tokenID), nil + case ZKLINKNOVA: + return fmt.Sprintf("https://explorer.zklink.io/address/%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 e99541a..eaebc66 100644 --- a/coin/models_test.go +++ b/coin/models_test.go @@ -417,6 +417,16 @@ func TestGetCoinExploreURL(t *testing.T) { want: "https://scrollscan.com/token/0xf55bec9cafdbe8730f096aa55dad6d22d44099df", wantErr: false, }, + { + name: "Test zkLink Nova - Dai", + args: args{ + addr: "0xF573fA04A73d5AC442F3DEa8741317fEaA3cDeab", + tokenType: "ZKLINKNOVA", + chain: Zklinknova(), + }, + want: "https://explorer.zklink.io/address/0xF573fA04A73d5AC442F3DEa8741317fEaA3cDeab", + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -479,6 +489,7 @@ var evmCoinsTestSet = map[uint]struct{}{ BLAST: {}, SCROLL: {}, BOUNCEBIT: {}, + ZKLINKNOVA: {}, } // TestEvmCoinsList This test will automatically fail when new EVM chain is added to coins.yml diff --git a/types/chain.go b/types/chain.go index f4b7188..1cd4878 100644 --- a/types/chain.go +++ b/types/chain.go @@ -175,6 +175,8 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) { return coin.Internet_computer(), nil case BOUNCEBIT: return coin.Bouncebit(), nil + case ZKLINKNOVA: + return coin.Zklinknova(), nil } return coin.Coin{}, errors.New("unknown asset type: " + assetType) diff --git a/types/token.go b/types/token.go index 7b3b6b1..6202aca 100644 --- a/types/token.go +++ b/types/token.go @@ -122,6 +122,7 @@ const ( SCROLL TokenType = "SCROLL" ICP TokenType = "ICP" BOUNCEBIT TokenType = "BOUNCEBIT" + ZKLINKNOVA TokenType = "ZKLINKNOVA" ) const ( @@ -144,6 +145,7 @@ const ( TokenVersionV17 TokenVersion = 17 TokenVersionV18 TokenVersion = 18 TokenVersionV19 TokenVersion = 19 + TokenVersionV20 TokenVersion = 20 TokenVersionUndefined TokenVersion = -1 ) @@ -238,6 +240,7 @@ func GetTokenTypes() []TokenType { SCROLL, ICP, BOUNCEBIT, + ZKLINKNOVA, } } @@ -357,6 +360,8 @@ func GetTokenType(c uint, tokenID string) (string, bool) { return string(ICP), true case coin.BOUNCEBIT: return string(BOUNCEBIT), true + case coin.ZKLINKNOVA: + return string(ZKLINKNOVA), true default: return "", false } @@ -418,6 +423,8 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) { return TokenVersionV18, nil case BOUNCEBIT: return TokenVersionV19, nil + case ZKLINKNOVA: + return TokenVersionV20, nil case ERC721, ERC1155, EOS, NEP5, VET, ONTOLOGY, THETA, TOMO, POA, OASIS, ALGORAND, METER, EVMOS_ERC20, KIP20, STRIDE, NEUTRON, FA2, CARDANO, NATIVEEVMOS, CRYPTOORG, COSMOS, OSMOSIS, STARGAZE: return TokenVersionUndefined, nil @@ -539,6 +546,8 @@ func GetEthereumTokenTypeByIndex(coinIndex uint) (TokenType, error) { tokenType = SCROLL case coin.BOUNCEBIT: tokenType = BOUNCEBIT + case coin.ZKLINKNOVA: + tokenType = ZKLINKNOVA } if tokenType == "" { diff --git a/types/token_test.go b/types/token_test.go index 8e7cacf..f194f96 100644 --- a/types/token_test.go +++ b/types/token_test.go @@ -388,6 +388,12 @@ func TestGetTokenType(t *testing.T) { want: string(BOUNCEBIT), wantBool: true, }, + { + name: "ZkLinkNova", + args: args{coin.ZKLINKNOVA, ""}, + want: string(ZKLINKNOVA), + wantBool: true, + }, } for _, tt := range tests { @@ -620,6 +626,12 @@ func TestGetTokenVersion(t *testing.T) { TokenVersionV19, nil, }, + { + "ZKLINKNOVA token version", + args{t: string(ZKLINKNOVA)}, + TokenVersionV20, + nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {