diff --git a/site/docs/components/AppDemo.tsx b/site/docs/components/AppDemo.tsx index 50fbf9f094..c2e8c4fc5d 100644 --- a/site/docs/components/AppDemo.tsx +++ b/site/docs/components/AppDemo.tsx @@ -9,24 +9,16 @@ import '@coinbase/onchainkit/styles.css'; import { createWalletClient } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; import { useTheme } from '../contexts/Theme.tsx'; -import { type Account } from 'viem'; const queryClient = new QueryClient(); +const DEFAULT_DEMO_PK = + '0x1234567890123456789012345678901234567890123456789012345678901234'; + const demoWalletConnector = () => () => { - const demoWalletPK = import.meta.env.VITE_DEMO_WALLET_PK; + const demoWalletPK = import.meta.env.VITE_DEMO_WALLET_PK || DEFAULT_DEMO_PK; - let account: Account | undefined; - if (demoWalletPK) { - try { - account = privateKeyToAccount(demoWalletPK as `0x${string}`); - } catch (error) { - console.error('Failed to create account from private key:', error); - return null; - } - } else { - return null; - } + const account = privateKeyToAccount(demoWalletPK as `0x${string}`); const client = createWalletClient({ account,