Skip to content

Commit 3084407

Browse files
vutuanlinh2k2claude
andcommitted
fix: resolve typecheck errors and update deposit button style
- Fix NetworkType usage in processLeaderboardRecord.ts (use string literal) - Add chainId parameter to getCachedTokenMetadata call in RestakingAssetsTable - Import EIP1193Provider from viem in useViemWalletClient - Update Deposit button in VaultsTable to match Redeem button style 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 9a4f453 commit 3084407

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

apps/leaderboard/src/features/leaderboard/utils/processLeaderboardRecord.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const processLeaderboardRecord = (
170170
pageIndex: number,
171171
pageSize: number,
172172
activity?: ActivityData,
173-
network: NetworkType = NetworkType.Mainnet,
173+
network: NetworkType = 'MAINNET',
174174
): Account | null => {
175175
if (!record) {
176176
return null;

apps/tangle-dapp/src/components/LiquidStaking/VaultsTable.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ const COLUMN_HELPER = createColumnHelper<VaultWithAssetInfo>();
3636

3737
const shortenAddress = (address: Address) =>
3838
`${address.slice(0, 6)}...${address.slice(-4)}`;
39-
const TABLE_ACTION_BUTTON_CLASS =
40-
'uppercase body4 font-semibold transition-all duration-200 bg-purple-10 dark:bg-purple-120 text-purple-70 dark:text-purple-40 hover:bg-purple-20 dark:hover:bg-purple-110 border border-purple-30 dark:border-purple-100';
4139

4240
const COLUMNS = [
4341
COLUMN_HELPER.accessor('operator', {
@@ -113,19 +111,15 @@ const COLUMNS = [
113111
id: 'actions',
114112
header: () => null,
115113
cell: ({ row }) => (
116-
<TableCellWrapper removeRightBorder className="p-3 justify-center">
117-
<Link
118-
to={`${PagePath.LIQUID_STAKING_DEPOSIT}?vault=${row.original.address}`}
119-
onClick={(e) => e.stopPropagation()}
120-
>
121-
<Button
122-
size="sm"
123-
variant="utility"
124-
className={TABLE_ACTION_BUTTON_CLASS}
114+
<TableCellWrapper removeRightBorder>
115+
<div className="flex items-center justify-end gap-2">
116+
<Link
117+
to={`${PagePath.LIQUID_STAKING_DEPOSIT}?vault=${row.original.address}`}
118+
onClick={(e) => e.stopPropagation()}
125119
>
126-
Deposit
127-
</Button>
128-
</Link>
120+
<Button size="sm">Deposit</Button>
121+
</Link>
122+
</div>
129123
</TableCellWrapper>
130124
),
131125
enableSorting: false,

apps/tangle-dapp/src/components/tables/RestakingAssetsTable.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FC, useMemo } from 'react';
22
import { BN } from '@polkadot/util';
33
import { TokenIcon } from '@tangle-network/icons';
44
import Spinner from '@tangle-network/icons/Spinner';
5+
import { useChainId } from 'wagmi';
56
import HeaderCell from '@tangle-network/tangle-shared-ui/components/tables/HeaderCell';
67
import TableCellWrapper from '@tangle-network/tangle-shared-ui/components/tables/TableCellWrapper';
78
import TableStatus from '@tangle-network/tangle-shared-ui/components/tables/TableStatus';
@@ -59,13 +60,17 @@ const TABLE_ACTION_BUTTON_CLASS =
5960
const isFallbackSymbol = (symbol: string) =>
6061
symbol.startsWith('0x') || symbol.includes('...');
6162

62-
const resolveTokenIconSymbol = (symbol: string, address: Address) => {
63-
const cached = getCachedTokenMetadata(address);
63+
const resolveTokenIconSymbol = (
64+
chainId: number,
65+
symbol: string,
66+
address: Address,
67+
) => {
68+
const cached = getCachedTokenMetadata(chainId, address);
6469
const candidate = cached?.symbol ?? symbol;
6570
return isFallbackSymbol(candidate) ? null : candidate;
6671
};
6772

68-
const getColumns = () => [
73+
const getColumns = (chainId: number) => [
6974
COLUMN_HELPER.accessor('id', {
7075
header: () => <HeaderCell title="Asset" />,
7176
cell: (props) => (
@@ -74,6 +79,7 @@ const getColumns = () => [
7479
<div className="flex items-center justify-center w-10 h-10">
7580
{(() => {
7681
const iconSymbol = resolveTokenIconSymbol(
82+
chainId,
7783
props.row.original.symbol,
7884
props.row.original.tokenAddress,
7985
);
@@ -202,6 +208,8 @@ export const RestakingAssetsTable: FC<Props> = ({
202208
delegator,
203209
isLoading,
204210
}) => {
211+
const chainId = useChainId();
212+
205213
const protocolAssetMap = useMemo(() => {
206214
const map = new Map<string, RestakingAsset>();
207215
restakingAssets?.forEach((asset) => {
@@ -249,14 +257,14 @@ export const RestakingAssetsTable: FC<Props> = ({
249257
() =>
250258
({
251259
data: tableData,
252-
columns: getColumns(),
260+
columns: getColumns(chainId),
253261
getCoreRowModel: getCoreRowModel(),
254262
getSortedRowModel: getSortedRowModel(),
255263
getPaginationRowModel: getPaginationRowModel(),
256264
autoResetPageIndex: false,
257265
enableSortingRemoval: false,
258266
}) satisfies TableOptions<RestakeAssetRow>,
259-
[tableData],
267+
[tableData, chainId],
260268
),
261269
);
262270

libs/tangle-shared-ui/src/hooks/useViemWalletClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
44
import {
55
createWalletClient,
66
custom,
7+
EIP1193Provider,
78
http,
89
Transport,
910
WalletClient,

0 commit comments

Comments
 (0)