Skip to content

Commit

Permalink
Feature/external links (#257)
Browse files Browse the repository at this point in the history
* allows adding external links
  • Loading branch information
r0wdy1 authored Jan 29, 2024
1 parent 2f7b029 commit 9e3baf7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/NetworkDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ const poolsByChainId = chainIds.map(chainId => {
return {
chainId,
pools: Object.values(poolsWithAliases).filter(pool => pool.chainId === chainId),
external: Object.entries(config.chains).find(([k,_]) => Number(k) === chainId)[1]["external"]
};
});

const Content = ({ switchToPool, currentPool, close }) => {
const { t } = useTranslation();
const [openedChainId, setOpenedChainId] = useState(currentPool.chainId);

const showPools = useCallback(chainId => {
const showPools = useCallback((chainId,external) => {
if(external) {
window.open(external);
return;
}
if (openedChainId === chainId) {
setOpenedChainId(null);
} else {
Expand All @@ -46,10 +51,10 @@ const Content = ({ switchToPool, currentPool, close }) => {
return (
<Container>
<Title>{t('networks.title')}</Title>
{poolsByChainId.map(({ chainId, pools }, index) =>
{poolsByChainId.map(({ chainId, pools,external }, index) =>
<React.Fragment key={index}>
<OptionButton
onClick={() => showPools(chainId)}
onClick={() => showPools(chainId,external)}
className={openedChainId === chainId ? 'active' : ''}
>
<RowSpaceBetween>
Expand Down
23 changes: 22 additions & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ const config = {
addressPrefix: 'zkbob_optimism_eth',
paymentContractAddress: '0x7a8006Ea0Dda93C56E60187Bd55109AbfF486c6F',
},
'USDT-tron': {
chainId: 728126428,
poolAddress: 'TXViaNRhEugXpAZApviBqBnbTSKUgejnR9',
tokenAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
relayerUrls: ['https://relayer-tron-mpc.zkbob.com'],
delegatedProverUrls: [],
coldStorageConfigPath: '',
tokenSymbol: 'USDT',
tokenDecimals: 6,
feeDecimals: 2,
depositScheme: 'approve',
minTxAmount: 50000n, // 0.05 USDT
addressPrefix: 'zkbob_tron',
isTron: true,
},
},
chains: {
'137': {
Expand All @@ -74,6 +89,11 @@ const config = {
'10': {
rpcUrls: ['https://rpc.ankr.com/optimism'],
},

'728126428': {
rpcUrls: ['https://few-methodical-breeze.tron-mainnet.quiknode.pro/c9e0de7204463ff25a6ca3afd1bd32caf880561e', 'https://api.trongrid.io'],
external: "https://tron.zkbob.com/"
},
},
snarkParams: process.env.REACT_APP_HOSTING === 'netlify' ? {
transferParamsUrl: 'https://r2.zkbob.com/transfer_params_22022023.bin',
Expand Down Expand Up @@ -205,7 +225,8 @@ const config = {
rpcUrls: ['https://goerli.optimism.io']
},
'3448148188': {
rpcUrls: ['https://nile.trongrid.io']
rpcUrls: ['https://nile.trongrid.io'],
external: "https://deploy-preview-250--shimmering-douhua-023cc6.netlify.app"
},
},
snarkParams: {
Expand Down
8 changes: 8 additions & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export const NETWORKS = {
address: 'https://nile.tronscan.org/#/address/%s',
tx: 'https://nile.tronscan.org/#/transaction/%s',
},
},
728126428: {
name: 'Tron',
icon: require('assets/tron.png'),
blockExplorerUrls: {
address: 'https://tronscan.org/#/address/%s',
tx: 'https://tronscan.org/#/transaction/%s',
},
}
};

Expand Down

0 comments on commit 9e3baf7

Please sign in to comment.