diff --git a/coin/coins.go b/coin/coins.go index 750e1b1..cd1da1b 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-04-15 15:30:07.029969 +0400 +04 m=+0.002842751 +// 2024-05-13 21:16:45.813175 +0900 KST m=+0.002488334 // 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,120 +46,122 @@ 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 + 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 + 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 ) var Coins = map[uint]Coin{ @@ -1417,6 +1419,28 @@ var Coins = map[uint]Coin{ Blockchain: "Ethereum", IsTokenSupported: true, }, + BLAST: { + ID: 81457, + Handle: "blast", + Symbol: "ETH", + Name: "Blast", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, + SCROLL: { + ID: 534352, + Handle: "scroll", + Symbol: "ETH", + Name: "Scroll", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, } var Chains = map[string]Coin{ @@ -2674,6 +2698,28 @@ var Chains = map[string]Coin{ Blockchain: "Ethereum", IsTokenSupported: true, }, + Blast().Handle: { + ID: 81457, + Handle: "blast", + Symbol: "ETH", + Name: "Blast", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, + Scroll().Handle: { + ID: 534352, + Handle: "scroll", + Symbol: "ETH", + Name: "Scroll", + Decimals: 18, + BlockTime: 0, + MinConfirmations: 0, + Blockchain: "Ethereum", + IsTokenSupported: true, + }, } func Ethereum() Coin { @@ -3131,3 +3177,12 @@ func Zetaevm() Coin { func Merlin() Coin { return Coins[MERLIN] } + +func Blast() Coin { + return Coins[BLAST] +} + +func Scroll() Coin { + return Coins[SCROLL] +} + diff --git a/coin/coins.yml b/coin/coins.yml index d217afd..6a07a48 100644 --- a/coin/coins.yml +++ b/coin/coins.yml @@ -1021,3 +1021,19 @@ decimals: 18 blockchain: Ethereum isTokenSupported: true + +- id: 81457 + symbol: ETH + handle: blast + name: Blast + decimals: 18 + blockchain: Ethereum + isTokenSupported: true + +- id: 534352 + symbol: ETH + handle: scroll + name: Scroll + decimals: 18 + blockchain: Ethereum + isTokenSupported: true diff --git a/coin/models.go b/coin/models.go index 7fec490..1fb023c 100644 --- a/coin/models.go +++ b/coin/models.go @@ -171,6 +171,10 @@ func GetCoinExploreURL(c Coin, tokenID, tokenType string) (string, error) { return fmt.Sprintf("https://explorer.zetachain.com/address/%s", tokenID), nil case BITCOIN: return fmt.Sprintf("https://unisat.io/brc20/%s", tokenID), nil + case BLAST: + return fmt.Sprintf("https://blastscan.io/token/%s", tokenID), nil + case SCROLL: + return fmt.Sprintf("https://scrollscan.com/token/%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 9055775..0659dfe 100644 --- a/coin/models_test.go +++ b/coin/models_test.go @@ -397,6 +397,26 @@ func TestGetCoinExploreURL(t *testing.T) { want: "https://explorer.celo.org/mainnet/address/0x639A647fbe20b6c8ac19E48E2de44ea792c62c5C", wantErr: false, }, + { + name: "Test Blast", + args: args{ + addr: "0x4300000000000000000000000000000000000004", + tokenType: "BLAST", + chain: Blast(), + }, + want: "https://blastscan.io/token/0x4300000000000000000000000000000000000004", + wantErr: false, + }, + { + name: "Test Scroll", + args: args{ + addr: "0xf55bec9cafdbe8730f096aa55dad6d22d44099df", + tokenType: "SCROLL", + chain: Scroll(), + }, + want: "https://scrollscan.com/token/0xf55bec9cafdbe8730f096aa55dad6d22d44099df", + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -456,6 +476,8 @@ var evmCoinsTestSet = map[uint]struct{}{ MANTA: {}, ZETAEVM: {}, MERLIN: {}, + BLAST: {}, + SCROLL: {}, } // 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 7c9cea7..45a355f 100644 --- a/types/chain.go +++ b/types/chain.go @@ -167,6 +167,10 @@ func GetChainFromAssetType(assetType string) (coin.Coin, error) { return coin.Zetaevm(), nil case MERLIN: return coin.Merlin(), nil + case BLAST: + return coin.Blast(), nil + case SCROLL: + return coin.Scroll(), nil } return coin.Coin{}, errors.New("unknown asset type: " + assetType) diff --git a/types/token.go b/types/token.go index 9dd6370..d3f1809 100644 --- a/types/token.go +++ b/types/token.go @@ -118,6 +118,8 @@ const ( ZETACHAIN TokenType = "ZETACHAIN" ZETAEVM TokenType = "ZETAEVM" MERLIN TokenType = "MERLIN" + BLAST TokenType = "BLAST" + SCROLL TokenType = "SCROLL" ) const ( @@ -138,6 +140,7 @@ const ( TokenVersionV15 TokenVersion = 15 TokenVersionV16 TokenVersion = 16 TokenVersionV17 TokenVersion = 17 + TokenVersionV18 TokenVersion = 18 TokenVersionUndefined TokenVersion = -1 ) @@ -228,6 +231,8 @@ func GetTokenTypes() []TokenType { ZETACHAIN, ZETAEVM, MERLIN, + BLAST, + SCROLL, } } @@ -339,6 +344,10 @@ func GetTokenType(c uint, tokenID string) (string, bool) { return string(ZETACHAIN), true case coin.ZETAEVM: return string(ZETAEVM), true + case coin.BLAST: + return string(BLAST), true + case coin.SCROLL: + return string(SCROLL), true default: return "", false } @@ -396,6 +405,8 @@ func GetTokenVersion(tokenType string) (TokenVersion, error) { return TokenVersionV16, nil case MERLIN: return TokenVersionV17, nil + case BLAST, SCROLL: + return TokenVersionV18, 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 @@ -511,6 +522,10 @@ func GetEthereumTokenTypeByIndex(coinIndex uint) (TokenType, error) { tokenType = ZETAEVM case coin.MERLIN: tokenType = MERLIN + case coin.BLAST: + tokenType = BLAST + case coin.SCROLL: + tokenType = SCROLL } if tokenType == "" { diff --git a/types/token_test.go b/types/token_test.go index 2b775ce..2c3867c 100644 --- a/types/token_test.go +++ b/types/token_test.go @@ -365,6 +365,18 @@ func TestGetTokenType(t *testing.T) { want: string(ZETAEVM), wantBool: true, }, + { + name: "Blast", + args: args{coin.BLAST, ""}, + want: string(BLAST), + wantBool: true, + }, + { + name: "Scroll", + args: args{coin.SCROLL, ""}, + want: string(SCROLL), + wantBool: true, + }, } for _, tt := range tests { @@ -579,6 +591,18 @@ func TestGetTokenVersion(t *testing.T) { TokenVersionV17, nil, }, + { + "BLAST token version", + args{t: string(BLAST)}, + TokenVersionV18, + nil, + }, + { + "SCROLL token version", + args{t: string(SCROLL)}, + TokenVersionV18, + nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {