Skip to content

Commit

Permalink
default const
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer committed Dec 17, 2024
1 parent da34aad commit a848a27
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions site/docs/components/AppDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a848a27

Please sign in to comment.