-
Notifications
You must be signed in to change notification settings - Fork 237
devop: new networks #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
devop: new networks #603
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cc02c5c
Merge pull request #576 from enkryptcom/develop
kvhnuke 793d0f0
Merge pull request #591 from enkryptcom/develop
kvhnuke 620d312
Merge pull request #597 from enkryptcom/develop
kvhnuke f370ca3
Update Syscoin and Rollux integration.
DevElCuy 0b8b607
Remove duplicates and improve error handling of blockscout client.
DevElCuy 6c6360e
Refactor blockscout client's address handler.
DevElCuy 59e021b
feat: add 5ireChain
dung5ire de523f0
Add links to faucet and on-ramp.
DevElCuy ffdf960
Remove debug console.log statement.
DevElCuy ea3d27f
Merge pull request #602 from dung5ire/main
kvhnuke c64ec7b
devop: 5ire cleanup
kvhnuke 1d753c8
Merge pull request #601 from fernando-syslabs/main
kvhnuke d491816
devop: add 5ire, syscoin and form networks
kvhnuke f83eb37
devop: add new network tags
kvhnuke 8fedb67
devop: add new network tags
kvhnuke d24108a
fix: fallback to type 0 txs if basefeepergas array is empty
kvhnuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,11 @@ | ||
| import { NetworkNames } from '@enkryptcom/types'; | ||
|
|
||
| const newNetworks = [NetworkNames.Bitrock, NetworkNames.Fraxtal]; | ||
| const newNetworks = [ | ||
| NetworkNames.Form, | ||
| NetworkNames.Rollux, | ||
| NetworkNames.SyscoinNEVM, | ||
| NetworkNames.Fire, | ||
| ]; | ||
| const newSwaps: NetworkNames[] = []; | ||
|
|
||
| export { newNetworks, newSwaps }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
packages/extension/src/providers/ethereum/libs/assets-handlers/blockscout.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import { SupportedNetworkNames, TokenBalance } from './types/tokenbalance-mew'; | ||
| import { NetworkEndpoints } from '@/providers/ethereum/libs/activity-handlers/providers/etherscan/configs'; | ||
| import { NATIVE_TOKEN_ADDRESS } from '../common'; | ||
| import { numberToHex } from 'web3-utils'; | ||
|
|
||
| interface TokenBalanceType { | ||
| token: string; | ||
| quantity: string; | ||
| error?: unknown; | ||
| } | ||
|
|
||
| interface TokenResponseItem { | ||
| token: { | ||
| address: string; | ||
| decimals: string; | ||
| name: string; | ||
| symbol: string; | ||
| }; | ||
| value: string; | ||
| } | ||
|
|
||
| interface TokenResponse { | ||
| items: TokenResponseItem[]; | ||
| } | ||
|
|
||
| const getBlockscoutBalances = ( | ||
| chain: SupportedNetworkNames, | ||
| address: string, | ||
| ): Promise<TokenBalance[]> => { | ||
| const encodedAddress = encodeURIComponent(address); | ||
| const nativeTokenUrl = `${NetworkEndpoints[chain]}api/v2/addresses/${encodedAddress}`; | ||
| const tokenBalancesUrl = `${NetworkEndpoints[chain]}api/v2/addresses/${encodedAddress}/tokens?type=ERC-20`; | ||
kvhnuke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return Promise.all([ | ||
| fetch(nativeTokenUrl).then(res => res.json()), | ||
| fetch(tokenBalancesUrl).then(res => res.json()), | ||
| ]) | ||
| .then(([nativeResponse, tokenResponse]: [any, TokenResponse]) => { | ||
| if (!nativeResponse?.coin_balance || !tokenResponse?.items) { | ||
| return Promise.reject('Error fetching balance data'); | ||
| } | ||
|
|
||
| if (Number.isNaN(Number(nativeResponse.coin_balance))) { | ||
| return Promise.reject('Invalid native token balance'); | ||
| } | ||
|
|
||
| // Map native token balance | ||
| const nativeBalance: TokenBalanceType = { | ||
| token: NATIVE_TOKEN_ADDRESS, | ||
| quantity: nativeResponse.coin_balance, | ||
| }; | ||
|
|
||
| // Map token balances | ||
| const tokenBalances: TokenBalanceType[] = Array.isArray( | ||
| tokenResponse?.items, | ||
| ) | ||
| ? tokenResponse.items | ||
| .filter( | ||
| item => | ||
| item?.token?.address && | ||
| typeof item.token.address === 'string' && | ||
| item.value !== undefined, | ||
| ) | ||
| .map(item => ({ | ||
| token: item.token.address.toLowerCase(), | ||
| quantity: item.value, | ||
| })) | ||
| : []; | ||
|
|
||
| // Merge native token and token balances | ||
| const allBalances = [nativeBalance, ...tokenBalances]; | ||
|
|
||
| // Convert to TokenBalance format | ||
| return allBalances.map(tb => ({ | ||
| contract: tb.token, | ||
| balance: numberToHex(tb.quantity), // Convert to hex format | ||
| })); | ||
| }) | ||
| .catch(error => { | ||
| console.error('Error fetching balances:', error); | ||
| return [ | ||
| { | ||
| contract: NATIVE_TOKEN_ADDRESS, | ||
| balance: '0x0', | ||
| }, | ||
| ]; | ||
| }); | ||
| }; | ||
|
|
||
| export default getBlockscoutBalances; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ import { CoingeckoPlatform, NetworkNames } from '@enkryptcom/types'; | |
| import { CGToken, SupportedNetworkNames } from './types/tokenbalance-mew'; | ||
| const TOKEN_FETCH_TTL = 1000 * 60 * 60; | ||
| const TokenList: Record<SupportedNetworkNames, string> = { | ||
| [NetworkNames.SyscoinNEVM]: `https://tokens.coingecko.com/${CoingeckoPlatform.Syscoin}/all.json`, | ||
| [NetworkNames.Rollux]: `https://tokens.coingecko.com/${CoingeckoPlatform.Rollux}/all.json`, | ||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicate Rollux entry. The Rollux network has two entries in the TokenList:
Please remove one of the duplicate entries. |
||
| [NetworkNames.Binance]: `https://tokens.coingecko.com/${CoingeckoPlatform.Binance}/all.json`, | ||
| [NetworkNames.Ethereum]: `https://tokens.coingecko.com/${CoingeckoPlatform.Ethereum}/all.json`, | ||
| [NetworkNames.Matic]: `https://tokens.coingecko.com/${CoingeckoPlatform.Matic}/all.json`, | ||
|
|
@@ -26,7 +28,6 @@ const TokenList: Record<SupportedNetworkNames, string> = { | |
| [NetworkNames.Celo]: `https://tokens.coingecko.com/${CoingeckoPlatform.Celo}/all.json`, | ||
| [NetworkNames.TomoChain]: `https://tokens.coingecko.com/${CoingeckoPlatform.TomoChain}/all.json`, | ||
| [NetworkNames.Shibarium]: `https://tokens.coingecko.com/${CoingeckoPlatform.Shibarium}/all.json`, | ||
| [NetworkNames.Rollux]: `https://tokens.coingecko.com/${CoingeckoPlatform.Rollux}/all.json`, | ||
| [NetworkNames.Telos]: `https://tokens.coingecko.com/${CoingeckoPlatform.Telos}/all.json`, | ||
| [NetworkNames.Blast]: `https://tokens.coingecko.com/${CoingeckoPlatform.Blast}/all.json`, | ||
| [NetworkNames.Sanko]: `https://tokens.coingecko.com/${CoingeckoPlatform.Sanko}/all.json`, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/extension/src/providers/ethereum/networks/5ire.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import icon from './icons/5ire.svg'; | ||
| import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; | ||
| import { NetworkNames } from '@enkryptcom/types'; | ||
| import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; | ||
|
|
||
| const fireOptions: EvmNetworkOptions = { | ||
| name: NetworkNames.Fire, | ||
| name_long: '5ire Chain', | ||
| homePage: 'https://www.5ire.org', | ||
| blockExplorerTX: 'https://5irescan.io/tx/[[txHash]]', | ||
| blockExplorerAddr: 'https://5irescan.io/address/[[address]]', | ||
| chainID: '0x3e3', | ||
| isTestNetwork: false, | ||
| currencyName: '5IRE', | ||
| currencyNameLong: '5ire', | ||
| node: 'https://rpc.5ire.network', | ||
| icon, | ||
| coingeckoID: '5ire', | ||
| activityHandler: wrapActivityHandler(() => Promise.resolve([])), | ||
| }; | ||
|
|
||
| const fire = new EvmNetwork(fireOptions); | ||
|
|
||
| export default fire; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/extension/src/providers/ethereum/networks/form.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import icon from './icons/form.png'; | ||
| import { NetworkNames } from '@enkryptcom/types'; | ||
| import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; | ||
| import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; | ||
| import { EtherscanActivity } from '../libs/activity-handlers'; | ||
|
|
||
| const formOptions: EvmNetworkOptions = { | ||
| name: NetworkNames.Form, | ||
| name_long: 'Form Mainnet', | ||
| homePage: 'https://docs.form.network', | ||
| blockExplorerTX: 'https://explorer.form.network/tx/[[txHash]]', | ||
| blockExplorerAddr: 'https://explorer.form.network/address/[[address]]', | ||
| chainID: '0x1de', | ||
| isTestNetwork: false, | ||
| currencyName: 'ETH', | ||
| currencyNameLong: 'Ethereum', | ||
| node: 'wss://rpc.form.network/ws', | ||
| icon, | ||
| activityHandler: wrapActivityHandler(EtherscanActivity), | ||
| }; | ||
|
|
||
| const form = new EvmNetwork(formOptions); | ||
|
|
||
| export default form; |
3 changes: 3 additions & 0 deletions
3
packages/extension/src/providers/ethereum/networks/icons/5ire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
packages/extension/src/providers/ethereum/networks/syscoin/nevm-testnet.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import icon from '../icons/tsys_nevm.svg'; | ||
| import { NetworkNames } from '@enkryptcom/types'; | ||
| import { EvmNetwork, EvmNetworkOptions } from '../../types/evm-network'; | ||
| import { EtherscanActivity } from '../../libs/activity-handlers'; | ||
| import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; | ||
|
|
||
| const syscoinNEVMTestOptions: EvmNetworkOptions = { | ||
| name: NetworkNames.SyscoinNEVMTest, | ||
| name_long: 'Syscoin NEVM Testnet', | ||
| homePage: 'https://www.syscoin.org/', | ||
| blockExplorerTX: 'https://explorer.tanenbaum.io/tx/[[txHash]]', | ||
| blockExplorerAddr: 'https://explorer.tanenbaum.io/address/[[address]]', | ||
| chainID: '0x1644', | ||
| isTestNetwork: true, | ||
| currencyName: 'TSYS', | ||
| currencyNameLong: 'Test Syscoin', | ||
| node: 'wss://rpc.tanenbaum.io/wss', | ||
| icon, | ||
| buyLink: 'https://faucet.syscoin.org', | ||
| activityHandler: wrapActivityHandler(EtherscanActivity), | ||
| }; | ||
|
|
||
| const syscoinNEVMTest = new EvmNetwork(syscoinNEVMTestOptions); | ||
|
|
||
| export default syscoinNEVMTest; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.