From 41120b4f3d7b7afce75c5d710e4a3b39fa237a3e Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 17 Dec 2024 12:00:24 +0100 Subject: [PATCH 1/9] do logout from rewards service only if token is preset --- ui/snippets/auth/useLogout.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui/snippets/auth/useLogout.ts b/ui/snippets/auth/useLogout.ts index be9ac90ee9..2759e8864c 100644 --- a/ui/snippets/auth/useLogout.ts +++ b/ui/snippets/auth/useLogout.ts @@ -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({ From 93883995046afade0dd08292c0d18e46909c053d Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 17 Dec 2024 12:12:07 +0100 Subject: [PATCH 2/9] [skip ci] reset mixpanel on logout --- lib/mixpanel/index.ts | 2 ++ lib/mixpanel/reset.ts | 10 ++++++++++ ui/snippets/auth/useLogout.ts | 1 + 3 files changed, 13 insertions(+) create mode 100644 lib/mixpanel/reset.ts diff --git a/lib/mixpanel/index.ts b/lib/mixpanel/index.ts index 72f7be7285..b1ac13bb87 100644 --- a/lib/mixpanel/index.ts +++ b/lib/mixpanel/index.ts @@ -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'; @@ -13,4 +14,5 @@ export { getPageType, getUuid, userProfile, + reset, }; diff --git a/lib/mixpanel/reset.ts b/lib/mixpanel/reset.ts new file mode 100644 index 0000000000..489646d725 --- /dev/null +++ b/lib/mixpanel/reset.ts @@ -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(); +} diff --git a/ui/snippets/auth/useLogout.ts b/ui/snippets/auth/useLogout.ts index 2759e8864c..849f701293 100644 --- a/ui/snippets/auth/useLogout.ts +++ b/ui/snippets/auth/useLogout.ts @@ -53,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) || From 799962ab85c685f14bf254743e3992364ca43914 Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 17 Dec 2024 13:12:35 +0100 Subject: [PATCH 3/9] [skip ci] reown: don't sync connected chain --- lib/web3/wagmiConfig.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web3/wagmiConfig.ts b/lib/web3/wagmiConfig.ts index 423b4b9b7e..387a9bdd16 100644 --- a/lib/web3/wagmiConfig.ts +++ b/lib/web3/wagmiConfig.ts @@ -31,6 +31,7 @@ const wagmi = (() => { projectId: feature.walletConnect.projectId, ssr: true, batch: { multicall: { wait: 100 } }, + syncConnectedChain: false, }); return { config: wagmiAdapter.wagmiConfig, adapter: wagmiAdapter }; From 9d77a1565f51b739063f7ac469d3066ec66ab040 Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 17 Dec 2024 18:28:32 +0100 Subject: [PATCH 4/9] [skip ci] add line wrapping for blocks base fee --- ui/blocks/BlocksTableItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/blocks/BlocksTableItem.tsx b/ui/blocks/BlocksTableItem.tsx index bb0d4411c4..48114e1ea5 100644 --- a/ui/blocks/BlocksTableItem.tsx +++ b/ui/blocks/BlocksTableItem.tsx @@ -136,7 +136,7 @@ const BlocksTableItem = ({ data, isLoading, enableTimeIncrement }: Props) => { ) } { !isRollup && !config.UI.views.block.hiddenFields?.base_fee && Boolean(baseFeeValue) && ( - + { baseFeeValue } From 70d9673b13b9014bd78a95645a85d112e7ed684f Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Dec 2024 08:21:07 +0100 Subject: [PATCH 5/9] fix sorting of verified contracts --- types/api/verifiedContracts.ts | 2 +- ui/verifiedContracts/VerifiedContractsTable.tsx | 10 ++++++++-- ui/verifiedContracts/utils.ts | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/types/api/verifiedContracts.ts b/types/api/verifiedContracts.ts index 12d45f31fc..975c46ed8b 100644 --- a/types/api/verifiedContracts.ts +++ b/types/api/verifiedContracts.ts @@ -1,5 +1,5 @@ export interface VerifiedContractsSorting { - sort: 'balance' | 'txs_count'; + sort: 'balance' | 'transactions_count'; order: 'asc' | 'desc'; } diff --git a/ui/verifiedContracts/VerifiedContractsTable.tsx b/ui/verifiedContracts/VerifiedContractsTable.tsx index dd08f964c3..3c2ec3c526 100644 --- a/ui/verifiedContracts/VerifiedContractsTable.tsx +++ b/ui/verifiedContracts/VerifiedContractsTable.tsx @@ -40,8 +40,14 @@ const VerifiedContractsTable = ({ data, sort, setSorting, isLoading }: Props) => - - { sort?.includes('txs_count') && } + + { sort?.includes('transactions_count') && } Txs diff --git a/ui/verifiedContracts/utils.ts b/ui/verifiedContracts/utils.ts index c8bb5a5e35..489cc9030e 100644 --- a/ui/verifiedContracts/utils.ts +++ b/ui/verifiedContracts/utils.ts @@ -5,11 +5,11 @@ export const SORT_OPTIONS: Array> = { 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> = { balance: [ 'balance-desc', 'balance-asc', undefined ], - txs_count: [ 'txs_count-desc', 'txs_count-asc', undefined ], + transactions_count: [ 'transactions_count-desc', 'transactions_count-asc', undefined ], }; From 5b4bdff9cf259b2476fc144ebf462da6b7a66ebb Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Dec 2024 08:24:12 +0100 Subject: [PATCH 6/9] fix counters for internal txs on address page --- mocks/address/tabCounters.ts | 2 +- stubs/address.ts | 2 +- types/api/address.ts | 2 +- ui/pages/Address.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mocks/address/tabCounters.ts b/mocks/address/tabCounters.ts index 3853ffab4d..85c3cd1e9a 100644 --- a/mocks/address/tabCounters.ts +++ b/mocks/address/tabCounters.ts @@ -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, diff --git a/stubs/address.ts b/stubs/address.ts index acd1c1d03e..17140ff986 100644 --- a/stubs/address.ts +++ b/stubs/address.ts @@ -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, diff --git a/types/api/address.ts b/types/api/address.ts index 6b6e1a2818..765561a3fa 100644 --- a/types/api/address.ts +++ b/types/api/address.ts @@ -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; diff --git a/ui/pages/Address.tsx b/ui/pages/Address.tsx index 0fa028ae2f..0b1d80c05e 100644 --- a/ui/pages/Address.tsx +++ b/ui/pages/Address.tsx @@ -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: , }, addressTabsCountersQuery.data?.celo_election_rewards_count ? { From f4d0eadf9f956e8bee358fa6fd6f9752270c361c Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Dec 2024 08:44:45 +0100 Subject: [PATCH 7/9] fix sorting by block number on transactions page --- ui/txs/sortTxs.ts | 6 ++++++ ui/txs/useTxsSort.tsx | 1 + 2 files changed, 7 insertions(+) diff --git a/ui/txs/sortTxs.ts b/ui/txs/sortTxs.ts index 3993612e4c..a66afab633 100644 --- a/ui/txs/sortTxs.ts +++ b/ui/txs/sortTxs.ts @@ -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; } diff --git a/ui/txs/useTxsSort.tsx b/ui/txs/useTxsSort.tsx index b3a77e5514..8999f3388c 100644 --- a/ui/txs/useTxsSort.tsx +++ b/ui/txs/useTxsSort.tsx @@ -15,6 +15,7 @@ export const SORT_OPTIONS: Array> = [ { 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; From b38ff3e220db13537d936d617b3d43550d0a496b Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Dec 2024 12:03:21 +0100 Subject: [PATCH 8/9] fix contract source address selector --- ui/address/contract/ContractSourceAddressSelector.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/address/contract/ContractSourceAddressSelector.tsx b/ui/address/contract/ContractSourceAddressSelector.tsx index 0bb39c6f20..aa61b96732 100644 --- a/ui/address/contract/ContractSourceAddressSelector.tsx +++ b/ui/address/contract/ContractSourceAddressSelector.tsx @@ -60,7 +60,7 @@ const ContractSourceAddressSelector = ({ className, selectedItem, onItemSelect,