mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* fail the app start if multichain config or essential dapps config were not generated properly * add timeouts for essential dapps and multichain config generators * fix "add to wallet" button in address tokens table * [skip ci] update docs * fix tx tables when there are no fee and value columns * add support for promoted multichain provider * fixes * change action button logic * fix tests * fix * hide "add network" button for multichain * shorten the amount of txs on multichain homepage * change name formatting for multichain button * add bright color variants and lg size for badges * fix y-axis margin calculation for chart with custom tick formatter * superchain bug fixes * bump versions of react and nextjs * update screenshot * bump dappscout-iframe --------- Co-authored-by: Max Alekseenko <[email protected]>
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { Address } from 'types/api/address';
|
|
|
|
import config from 'configs/app';
|
|
import type { LinkProps } from 'toolkit/chakra/link';
|
|
import { Link } from 'toolkit/chakra/link';
|
|
|
|
const feature = config.features.multichainButton;
|
|
|
|
interface Props extends LinkProps {
|
|
addressData?: Address;
|
|
}
|
|
|
|
const AddressMultichainInfoButton = ({ addressData, ...rest }: Props) => {
|
|
if (!feature.isEnabled) {
|
|
return null;
|
|
}
|
|
|
|
const promotedProvider = feature.providers.find((provider) => provider.promo);
|
|
|
|
if (!promotedProvider) {
|
|
return null;
|
|
}
|
|
|
|
if (!addressData || (addressData.is_contract && addressData.proxy_type !== 'eip7702')) {
|
|
return null;
|
|
}
|
|
|
|
const url = (() => {
|
|
try {
|
|
const url = new URL(promotedProvider.urlTemplate.replace('{address}', addressData.hash));
|
|
url.searchParams.append('utm_source', 'blockscout');
|
|
url.searchParams.append('utm_medium', 'address');
|
|
return url.toString();
|
|
} catch (error) {}
|
|
return null;
|
|
})();
|
|
|
|
if (!url) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Link
|
|
href={ url }
|
|
variant="underlaid"
|
|
external={ promotedProvider.dappId ? false : true }
|
|
flexShrink={ 0 }
|
|
{ ...rest }
|
|
>
|
|
Multichain info
|
|
</Link>
|
|
);
|
|
};
|
|
|
|
export default React.memo(AddressMultichainInfoButton);
|