diff --git a/examples/custom-fragments/index.ts b/examples/custom-fragments/index.ts index 0d9f3b3e2..5d516eb87 100644 --- a/examples/custom-fragments/index.ts +++ b/examples/custom-fragments/index.ts @@ -22,7 +22,6 @@ const MyAccountFragment = graphql( picture } }`, - [], ); type MyAccount = FragmentOf; @@ -34,12 +33,7 @@ const client = PublicClient.create({ const account: MyAccount | null = await fetchAccount(client, { address: evmAddress('0x57b62a1571F4F09CDB4C3d93dA542bfe142D9F81'), -}).match( - (account) => account, - (error) => { - throw error; - }, -); +}).unwrapOr(null); export default [ `

${account?.username?.value}

`, diff --git a/packages/client/src/context.ts b/packages/client/src/context.ts index 2765caa29..7c0623a56 100644 --- a/packages/client/src/context.ts +++ b/packages/client/src/context.ts @@ -1,5 +1,5 @@ import type { EnvironmentConfig } from '@lens-protocol/env'; -import type { Account } from '@lens-protocol/graphql'; +import { type Account, AccountFragment } from '@lens-protocol/graphql'; import type { FragmentDocumentFor } from '@lens-protocol/graphql'; import { type IStorageProvider, InMemoryStorageProvider } from '@lens-protocol/storage'; import type { ClientConfig } from './config'; @@ -35,6 +35,6 @@ export function configureContext( debug: from.debug ?? false, origin: from.origin, storage: from.storage ?? new InMemoryStorageProvider(), - accountFragment: from.accountFragment, + accountFragment: from.accountFragment ?? AccountFragment, } as ContextFrom; }