Skip to content
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

Fixes for release v1.37.0 #2476

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion lib/contexts/rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function RewardsContextProvider({ children }: Props) {
// Save the API token to cookies and state
const saveApiToken = useCallback((token: string | undefined) => {
if (token) {
cookies.set(cookies.NAMES.REWARDS_API_TOKEN, token);
cookies.set(cookies.NAMES.REWARDS_API_TOKEN, token, { expires: 365 });
} else {
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/mixpanel/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import getPageType from './getPageType';
import getUuid from './getUuid';
import logEvent from './logEvent';
import reset from './reset';
import useInit from './useInit';
import useLogPageView from './useLogPageView';
import * as userProfile from './userProfile';
Expand All @@ -13,4 +14,5 @@ export {
getPageType,
getUuid,
userProfile,
reset,
};
10 changes: 10 additions & 0 deletions lib/mixpanel/reset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import mixpanel from 'mixpanel-browser';

import config from 'configs/app';

export default function reset() {
if (!config.features.mixpanel.isEnabled) {
return;
}
mixpanel.reset();
}
1 change: 1 addition & 0 deletions lib/web3/wagmiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const wagmi = (() => {
projectId: feature.walletConnect.projectId,
ssr: true,
batch: { multicall: { wait: 100 } },
syncConnectedChain: false,
});

return { config: wagmiAdapter.wagmiConfig, adapter: wagmiAdapter };
Expand Down
2 changes: 1 addition & 1 deletion mocks/address/tabCounters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AddressTabsCounters } from 'types/api/address';

export const base: AddressTabsCounters = {
internal_txs_count: 13,
internal_transactions_count: 13,
logs_count: 51,
token_balances_count: 3,
token_transfers_count: 3,
Expand Down
2 changes: 1 addition & 1 deletion stubs/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ADDRESS_COUNTERS: AddressCounters = {
};

export const ADDRESS_TABS_COUNTERS: AddressTabsCounters = {
internal_txs_count: 10,
internal_transactions_count: 10,
logs_count: 10,
token_balances_count: 10,
token_transfers_count: 10,
Expand Down
2 changes: 1 addition & 1 deletion types/api/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export type AddressWithdrawalsItem = {
};

export type AddressTabsCounters = {
internal_txs_count: number | null;
internal_transactions_count: number | null;
logs_count: number | null;
token_balances_count: number | null;
token_transfers_count: number | null;
Expand Down
2 changes: 1 addition & 1 deletion types/api/verifiedContracts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface VerifiedContractsSorting {
sort: 'balance' | 'txs_count';
sort: 'balance' | 'transactions_count';
order: 'asc' | 'desc';
}

Expand Down
2 changes: 1 addition & 1 deletion ui/address/contract/ContractSourceAddressSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ContractSourceAddressSelector = ({ className, selectedItem, onItemSelect,
<Select
options={ options }
name="contract-source-address"
defaultValue={ options[0].value }
defaultValue={ selectedItem.address }
onChange={ handleItemSelect }
isLoading={ isLoading }
maxW={{ base: '180px', lg: 'none' }}
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/BlocksTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const BlocksTableItem = ({ data, isLoading, enableTimeIncrement }: Props) => {
) }
{ !isRollup && !config.UI.views.block.hiddenFields?.base_fee && Boolean(baseFeeValue) && (
<Td fontSize="sm" isNumeric>
<Skeleton isLoaded={ !isLoading } display="inline-block">
<Skeleton isLoaded={ !isLoading } display="inline-block" whiteSpace="pre-wrap" wordBreak="break-word">
{ baseFeeValue }
</Skeleton>
</Td>
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const AddressPageContent = () => {
{
id: 'internal_txns',
title: 'Internal txns',
count: addressTabsCountersQuery.data?.internal_txs_count,
count: addressTabsCountersQuery.data?.internal_transactions_count,
component: <AddressInternalTxs scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
},
addressTabsCountersQuery.data?.celo_election_rewards_count ? {
Expand Down
13 changes: 8 additions & 5 deletions ui/snippets/auth/useLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ export default function useLogout() {

if (config.features.rewards.isEnabled) {
const rewardsToken = cookies.get(cookies.NAMES.REWARDS_API_TOKEN);
await apiFetch('rewards_logout', { fetchParams: {
method: 'POST',
headers: { Authorization: `Bearer ${ rewardsToken }` },
} });
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN);
if (rewardsToken) {
await apiFetch('rewards_logout', { fetchParams: {
method: 'POST',
headers: { Authorization: `Bearer ${ rewardsToken }` },
} });
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN);
}
}

queryClient.resetQueries({
Expand All @@ -51,6 +53,7 @@ export default function useLogout() {
});

mixpanel.logEvent(mixpanel.EventTypes.ACCOUNT_ACCESS, { Action: 'Logged out' }, { send_immediately: true });
mixpanel.reset();

if (
PROTECTED_ROUTES.includes(router.pathname) ||
Expand Down
6 changes: 6 additions & 0 deletions ui/txs/sortTxs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export default function sortTxs(sorting: TransactionsSortingValue | undefined) {
return compareBns(tx2.fee.value || 0, tx1.fee.value || 0);
case 'fee-asc':
return compareBns(tx1.fee.value || 0, tx2.fee.value || 0);
case 'block_number-asc': {
if (tx1.block_number && tx2.block_number) {
return tx1.block_number - tx2.block_number;
}
return 0;
}
default:
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions ui/txs/useTxsSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SORT_OPTIONS: Array<SelectOption<TransactionsSortingValue>> = [
{ label: 'Value descending', value: 'value-desc' },
{ label: 'Fee ascending', value: 'fee-asc' },
{ label: 'Fee descending', value: 'fee-desc' },
{ label: 'Block number ascending', value: 'block_number-asc' },
];

type SortingValue = TransactionsSortingValue | undefined;
Expand Down
10 changes: 8 additions & 2 deletions ui/verifiedContracts/VerifiedContractsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ const VerifiedContractsTable = ({ data, sort, setSorting, isLoading }: Props) =>
</Link>
</Th>
<Th width="130px" isNumeric>
<Link display="flex" alignItems="center" justifyContent="flex-end" onClick={ isLoading ? undefined : onSortToggle('txs_count') } columnGap={ 1 }>
{ sort?.includes('txs_count') && <IconSvg name="arrows/east" boxSize={ 4 } transform={ sortIconTransform }/> }
<Link
display="flex"
alignItems="center"
justifyContent="flex-end"
onClick={ isLoading ? undefined : onSortToggle('transactions_count') }
columnGap={ 1 }
>
{ sort?.includes('transactions_count') && <IconSvg name="arrows/east" boxSize={ 4 } transform={ sortIconTransform }/> }
Txs
</Link>
</Th>
Expand Down
6 changes: 3 additions & 3 deletions ui/verifiedContracts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export const SORT_OPTIONS: Array<SelectOption<VerifiedContractsSortingValue>> =
{ label: 'Default', value: undefined },
{ label: 'Balance descending', value: 'balance-desc' },
{ label: 'Balance ascending', value: 'balance-asc' },
{ label: 'Txs count descending', value: 'txs_count-desc' },
{ label: 'Txs count ascending', value: 'txs_count-asc' },
{ label: 'Txs count descending', value: 'transactions_count-desc' },
{ label: 'Txs count ascending', value: 'transactions_count-asc' },
];

export const SORT_SEQUENCE: Record<VerifiedContractsSortingField, Array<VerifiedContractsSortingValue | undefined>> = {
balance: [ 'balance-desc', 'balance-asc', undefined ],
txs_count: [ 'txs_count-desc', 'txs_count-asc', undefined ],
transactions_count: [ 'transactions_count-desc', 'transactions_count-asc', undefined ],
};
Loading