mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* debug wallet client error * Support raw text/html for NFT animation on the token instance page Resolves #2609 * fix writing to a contract with dynamic provider * change default interval for hot contracts * wait for load event of NFT embed frame * update screenshots * add network validation mode to dynamic provider * add rootstock mainnet preset * update preset for rootsrock mainnet * [skip ci] disable essential dapps for rootstock mainnet * pass required flag to FormFieldSelect controller * bump dynamic version * fix rabby wallet tx write
39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
import type { HotContractsSortingValue, HotContractsSortingField, HotContractsInterval } from 'types/api/contracts';
|
|
|
|
import getQueryParamString from 'lib/router/getQueryParamString';
|
|
import type { SelectOption } from 'toolkit/chakra/select';
|
|
|
|
export const SORT_OPTIONS: Array<SelectOption<HotContractsSortingValue>> = [
|
|
{ label: 'Default', value: 'default' },
|
|
{ label: 'Txs count descending', value: 'transactions_count-desc' },
|
|
{ label: 'Txs count ascending', value: 'transactions_count-asc' },
|
|
{ label: 'Gas used descending', value: 'total_gas_used-desc' },
|
|
{ label: 'Gas used ascending', value: 'total_gas_used-asc' },
|
|
];
|
|
|
|
export const SORT_SEQUENCE: Record<HotContractsSortingField, Array<HotContractsSortingValue>> = {
|
|
transactions_count: [ 'transactions_count-desc', 'transactions_count-asc', 'default' ],
|
|
total_gas_used: [ 'total_gas_used-desc', 'total_gas_used-asc', 'default' ],
|
|
};
|
|
|
|
export const INTERVAL_ITEMS: Array<{ id: HotContractsInterval; labelShort: string; labelFull: string }> = [
|
|
{ id: '5m', labelShort: '5m', labelFull: '5 minutes' },
|
|
{ id: '1h', labelShort: '1h', labelFull: '1 hour' },
|
|
{ id: '3h', labelShort: '3h', labelFull: '3 hours' },
|
|
{ id: '1d', labelShort: '1D', labelFull: '1 day' },
|
|
{ id: '7d', labelShort: '1W', labelFull: '1 week' },
|
|
{ id: '30d', labelShort: '1M', labelFull: '1 month' },
|
|
];
|
|
|
|
export const getIntervalValueFromQuery = (query: string | Array<string> | undefined): HotContractsInterval => {
|
|
const queryString = getQueryParamString(query);
|
|
if (queryString) {
|
|
const interval = INTERVAL_ITEMS.find(item => item.id === queryString);
|
|
if (interval) {
|
|
return interval.id;
|
|
}
|
|
}
|
|
|
|
return '1d';
|
|
};
|