mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
- Rename all @blockscout/* npm packages to @luxfi/* aliases (150+ files) - Override blue accent colors to gray for monochrome theme - Fix dropdown/menu/popover fonts to use Geist Sans - Change Latest Blocks to horizontal scrolling layout - Show dashes instead of zeros for validator stats on error - Fix GHA deploy step to use correct deployment name
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import type * as multichain from '@luxfi/multichain-aggregator-types';
|
|
|
|
export function getName(data: { chain_infos: Record<string, multichain.GetAddressResponse_ChainInfo> }) {
|
|
const chainInfos = Object.values(data.chain_infos ?? {});
|
|
const isContractChains = chainInfos.filter((chainInfo) => chainInfo.is_contract);
|
|
const names = isContractChains.map((chainInfo) => chainInfo.contract_name);
|
|
|
|
if (names.some((name) => !name)) {
|
|
return;
|
|
}
|
|
|
|
const uniqueNames = [ ...new Set(names) ];
|
|
|
|
if (uniqueNames.length === 1) {
|
|
return uniqueNames[0];
|
|
}
|
|
}
|
|
|
|
export function isContract(data: { chain_infos: Record<string, multichain.GetAddressResponse_ChainInfo> } | undefined) {
|
|
if (!data) {
|
|
return false;
|
|
}
|
|
|
|
const chainInfos = Object.values(data.chain_infos ?? {});
|
|
const isContractChains = chainInfos.filter((chainInfo) => chainInfo.is_contract);
|
|
return isContractChains.length > chainInfos.length / 2;
|
|
}
|
|
|
|
export function isVerified(data: { chain_infos: Record<string, multichain.GetAddressResponse_ChainInfo> } | undefined) {
|
|
if (!data) {
|
|
return false;
|
|
}
|
|
|
|
const chainInfos = Object.values(data.chain_infos ?? {});
|
|
const isContractChains = chainInfos.filter((chainInfo) => chainInfo.is_contract);
|
|
const isVerifiedChains = chainInfos.filter((chainInfo) => chainInfo.is_verified);
|
|
return isVerifiedChains.length > 0 && isVerifiedChains.length === isContractChains.length;
|
|
}
|