Skip to content

Commit

Permalink
BAPP-670: Bump OCK version w dropdown fix (#1182)
Browse files Browse the repository at this point in the history
* bump ock version w dropdown fix

* reset

* BaseName -> Basename

* rename imports

* reset

* fix
  • Loading branch information
kirkas authored Oct 31, 2024
1 parent 59785fb commit 8364e53
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 63 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/(basenames)/name/[username]/ProfileProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import AnalyticsProvider from 'apps/web/contexts/Analytics';
import UsernameProfileProvider from 'apps/web/src/components/Basenames/UsernameProfileContext';

Expand All @@ -9,7 +9,7 @@ const usernameProfileAnalyticContext = 'username_profile';

type ProfileProvidersProps = {
children: React.ReactNode;
username: BaseName;
username: Basename;
};

export default function ProfileProviders({ children, username }: ProfileProvidersProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import ProfileProviders from 'apps/web/app/(basenames)/name/[username]/ProfileProviders';
import ErrorsProvider from 'apps/web/contexts/Errors';
import FrameBuilder from 'apps/web/src/components/Basenames/ConfigureFramesPageContent/FrameBuilder';
Expand All @@ -7,11 +7,11 @@ import { redirectIfNotNameOwner } from 'apps/web/src/utils/redirectIfNotNameOwne
import { formatDefaultUsername } from 'apps/web/src/utils/usernames';

export type ConfigureFramesProps = {
params: { username: BaseName };
params: { username: Basename };
};

export default async function ConfigureFrames({ params }: ConfigureFramesProps) {
let username = await formatDefaultUsername(decodeURIComponent(params.username) as BaseName);
let username = await formatDefaultUsername(decodeURIComponent(params.username) as Basename);
await redirectIfNotNameOwner(username);

return (
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/(basenames)/name/[username]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import ProfileProviders from 'apps/web/app/(basenames)/name/[username]/ProfileProviders';
import ErrorsProvider from 'apps/web/contexts/Errors';
import UsernameProfile from 'apps/web/src/components/Basenames/UsernameProfile';
Expand All @@ -12,7 +12,7 @@ import classNames from 'classnames';
import { Metadata } from 'next';

export type UsernameProfileProps = {
params: { username: BaseName };
params: { username: Basename };
};

export async function generateMetadata({ params }: UsernameProfileProps): Promise<Metadata> {
Expand All @@ -35,7 +35,7 @@ export async function generateMetadata({ params }: UsernameProfileProps): Promis
}

export default async function Username({ params }: UsernameProfileProps) {
let username = await formatDefaultUsername(decodeURIComponent(params.username) as BaseName);
let username = await formatDefaultUsername(decodeURIComponent(params.username) as Basename);
await redirectIfNotNameOwner(username);

const usernameProfilePageClasses = classNames(
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@coinbase/cookie-banner": "^1.0.3",
"@coinbase/cookie-manager": "^1.1.1",
"@coinbase/onchainkit": "^0.28.5",
"@coinbase/onchainkit": "^0.35.2",
"@datadog/browser-logs": "^5.23.3",
"@datadog/browser-rum": "^5.23.3",
"@frames.js/render": "^0.3.14",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/pages/api/basenames/metadata/[tokenId].ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { premintMapping } from 'apps/web/pages/api/basenames/metadata/premintsMapping';
import L2Resolver from 'apps/web/src/abis/L2Resolver';
import { USERNAME_L2_RESOLVER_ADDRESSES } from 'apps/web/src/addresses/usernames';
Expand Down Expand Up @@ -51,7 +51,7 @@ export default async function GET(request: Request) {
args: [namehashNode],
functionName: 'name',
});
nameExpires = await getBasenameNameExpires(basenameFormatted as BaseName);
nameExpires = await getBasenameNameExpires(basenameFormatted as Basename);
} catch (error) {
logger.error('Error getting token metadata', error);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/BasenameIdentity/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { USERNAME_L2_RESOLVER_ADDRESSES } from 'apps/web/src/addresses/usernames';
import BasenameAvatar from 'apps/web/src/components/Basenames/BasenameAvatar';
import useBasenameChain from 'apps/web/src/hooks/useBasenameChain';
import { truncateMiddle } from 'libs/base-ui/utils/string';
import { useEnsAddress } from 'wagmi';

export default function BasenameIdentity({ username }: { username: BaseName }) {
export default function BasenameIdentity({ username }: { username: Basename }) {
const { basenameChain } = useBasenameChain();

const { data: basenameAddress } = useEnsAddress({
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/components/Basenames/BasenameAvatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import { BaseName } from '@coinbase/onchainkit/identity';

import { Basename } from '@coinbase/onchainkit/identity';
import LottieAnimation from 'apps/web/src/components/LottieAnimation';
import useBaseEnsAvatar from 'apps/web/src/hooks/useBaseEnsAvatar';
import ImageWithLoading from 'apps/web/src/components/ImageWithLoading';
Expand All @@ -14,7 +13,7 @@ export default function BasenameAvatar({
width,
height,
}: {
basename: BaseName;
basename: Basename;
wrapperClassName?: string;
animate?: boolean;
width?: number | `${number}` | undefined;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Basenames/RegistrationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import { BatchCallsStatus } from 'apps/web/src/hooks/useWriteContractsWithLogs';
import { WriteTransactionWithReceiptStatus } from 'apps/web/src/hooks/useWriteContractWithReceipt';
import useBaseEnsName from 'apps/web/src/hooks/useBaseEnsName';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';

export enum RegistrationSteps {
Search = 'search',
Expand All @@ -54,7 +54,7 @@ export type RegistrationContextProps = {
setRegistrationStep: Dispatch<SetStateAction<RegistrationSteps>>;
selectedName: string;
setSelectedName: Dispatch<SetStateAction<string>>;
selectedNameFormatted: BaseName;
selectedNameFormatted: Basename;
years: number;
setYears: Dispatch<SetStateAction<number>>;
redirectToProfile: () => void;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Basenames/UsernamePill/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { Address } from 'viem';

export enum UsernamePillVariants {
Expand All @@ -7,7 +7,7 @@ export enum UsernamePillVariants {
}
export type UsernamePillProps = {
variant: UsernamePillVariants;
username: BaseName;
username: Basename;
address?: Address;
isRegistering?: boolean;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { USERNAME_L2_RESOLVER_ADDRESSES } from 'apps/web/src/addresses/usernames';
import useBaseEnsName from 'apps/web/src/hooks/useBaseEnsName';
import useBasenameChain from 'apps/web/src/hooks/useBasenameChain';
Expand All @@ -24,12 +24,12 @@ export enum UsernameProfileSteps {}

export type UsernameProfileContextProps = {
// Profile details
profileUsername: BaseName;
profileUsername: Basename;
profileAddress?: Address;

// Profile owner
profileEditorAddress?: Address;
profileOwnerUsername?: BaseName;
profileOwnerUsername?: Basename;
profileRefetch: () => Promise<void>;

// State
Expand Down Expand Up @@ -67,7 +67,7 @@ export const UsernameProfileContext = createContext<UsernameProfileContextProps>

type UsernameProfileProviderProps = {
children: ReactNode;
username: BaseName;
username: Basename;
};

export default function UsernameProfileProvider({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ConnectWallet,
Wallet,
WalletDropdown,
WalletDropdownBaseName,
WalletDropdownBasename,
WalletDropdownDisconnect,
WalletDropdownLink,
} from '@coinbase/onchainkit/wallet';
Expand Down Expand Up @@ -156,7 +156,7 @@ export function ConnectWalletButton({
/>
<EthBalance className="font-display" />
</Identity>
<WalletDropdownBaseName className="font-display hover:bg-gray-40/20" />
<WalletDropdownBasename className="font-display hover:bg-gray-40/20" />
<WalletDropdownLink
icon="wallet"
href="https://wallet.coinbase.com"
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/useBaseEnsAvatar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useBasenameChain from 'apps/web/src/hooks/useBasenameChain';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { useEnsAvatar } from 'wagmi';
import { USERNAME_L2_RESOLVER_ADDRESSES } from 'apps/web/src/addresses/usernames';
import { CLOUDFARE_IPFS_PROXY } from 'apps/web/src/utils/urls';
Expand All @@ -8,7 +8,7 @@ export type UseBaseEnsNameProps = {
name?: BaseEnsNameData;
};

export type BaseEnsNameData = BaseName | undefined;
export type BaseEnsNameData = Basename | undefined;

// Wrapper around onchainkit's useName
export default function useBaseEnsAvatar({ name }: UseBaseEnsNameProps) {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/hooks/useBaseEnsName.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Address, isAddress } from 'viem';
import useBasenameChain from 'apps/web/src/hooks/useBasenameChain';
import { BaseName, GetNameReturnType, useName } from '@coinbase/onchainkit/identity';
import { Basename, GetNameReturnType, useName } from '@coinbase/onchainkit/identity';
import { UseQueryResult } from '@tanstack/react-query';

export type UseBaseEnsNameProps = {
address?: Address;
};

export type BaseEnsNameData = BaseName | undefined;
export type BaseEnsNameData = Basename | undefined;

// Wrapper around onchainkit's useName
export default function useBaseEnsName({ address }: UseBaseEnsNameProps) {
Expand All @@ -24,7 +24,7 @@ export default function useBaseEnsName({ address }: UseBaseEnsNameProps) {
},
) as UseQueryResult<GetNameReturnType, Error>;

const ensNameTyped = data ? (data as BaseName) : undefined;
const ensNameTyped = data ? (data as Basename) : undefined;

return {
data: ensNameTyped,
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/useBasenameChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useMemo } from 'react';
import { base, baseSepolia, Chain } from 'viem/chains';
import { createPublicClient, http } from 'viem';
import { cdpBaseRpcEndpoint, cdpBaseSepoliaRpcEndpoint } from 'apps/web/src/cdp/constants';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { getChainForBasename } from 'apps/web/src/utils/usernames';
import { isDevelopment } from 'apps/web/src/constants';

Expand All @@ -22,7 +22,7 @@ export function isBasenameSupportedChain(chainId: number) {
return supportedChainIds.includes(chainId);
}

export default function useBasenameChain(username?: BaseName) {
export default function useBasenameChain(username?: Basename) {
const { chain: connectedChain } = useAccount();

const basenameChain: Chain = useMemo(() => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/useSetPrimaryBasename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from 'apps/web/src/addresses/usernames';
import useBasenameChain from 'apps/web/src/hooks/useBasenameChain';
import { useCallback, useEffect } from 'react';
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import { useAccount } from 'wagmi';
import useBaseEnsName from 'apps/web/src/hooks/useBaseEnsName';
import { useErrors } from 'apps/web/contexts/Errors';
Expand All @@ -22,7 +22,7 @@ import { useUsernameProfile } from 'apps/web/src/components/Basenames/UsernamePr
*/

type UseSetPrimaryBasenameProps = {
secondaryUsername: BaseName;
secondaryUsername: Basename;
};

export default function useSetPrimaryBasename({ secondaryUsername }: UseSetPrimaryBasenameProps) {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/utils/redirectIfNotNameOwner.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BaseName } from '@coinbase/onchainkit/identity';
import { Basename } from '@coinbase/onchainkit/identity';
import {
getBasenameAddress,
getBasenameEditor,
getBasenameOwner,
} from 'apps/web/src/utils/usernames';
import { redirect } from 'next/navigation';

export async function redirectIfNotNameOwner(username: BaseName) {
export async function redirectIfNotNameOwner(username: Basename) {
const [address, editor, owner] = await Promise.all([
getBasenameAddress(username),
getBasenameEditor(username),
Expand Down
Loading

0 comments on commit 8364e53

Please sign in to comment.