Skip to content

Commit

Permalink
rename to ENVIRONMENT_VARIABLES
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec committed Aug 22, 2024
1 parent 19fa8d5 commit 490a5a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions playground/nextjs-app-router/components/OnchainProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { ENVARS, ENVIRONMENT } from '@/lib/constants';
import { ENVIRONMENT, ENVIRONMENT_VARIABLES } from '@/lib/constants';
import { OnchainKitProvider } from '@coinbase/onchainkit';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import type { ReactNode } from 'react';
Expand Down Expand Up @@ -34,7 +34,7 @@ function OnchainProviders({ children }: { children: ReactNode }) {
<WagmiProvider config={config} reconnectOnMount={false}>
<QueryClientProvider client={queryClient}>
<OnchainKitProvider
apiKey={ENVARS[ENVIRONMENT.API_KEY]}
apiKey={ENVIRONMENT_VARIABLES[ENVIRONMENT.API_KEY]}
chain={base}
schemaId="0xf8b05c79f090979bf4a80270aba232dff11a10d9ca55c4f88de95317970f0de9"
>
Expand Down
8 changes: 6 additions & 2 deletions playground/nextjs-app-router/components/demo/Swap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ENVARS, ENVIRONMENT } from '@/lib/constants';
import { ENVIRONMENT, ENVIRONMENT_VARIABLES } from '@/lib/constants';
import {
Swap,
SwapAmountInput,
Expand Down Expand Up @@ -95,7 +95,11 @@ function SwapComponent() {
token={usdcToken}
type="to"
/>
<SwapButton disabled={ENVARS[ENVIRONMENT.ENVIRONMENT] != 'preview'} />
<SwapButton
disabled={
ENVIRONMENT_VARIABLES[ENVIRONMENT.ENVIRONMENT] != 'preview'
}
/>
<SwapMessage />
</Swap>
) : (
Expand Down
9 changes: 5 additions & 4 deletions playground/nextjs-app-router/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const ENVIRONMENT = {

type EnvironmentKey = (typeof ENVIRONMENT)[keyof typeof ENVIRONMENT];

export const ENVARS: Record<EnvironmentKey, string | undefined> = {
[ENVIRONMENT.API_KEY]: process.env.NEXT_PUBLIC_OCK_API_KEY,
[ENVIRONMENT.ENVIRONMENT]: process.env.NEXT_PUBLIC_VERCEL_ENV,
};
export const ENVIRONMENT_VARIABLES: Record<EnvironmentKey, string | undefined> =
{
[ENVIRONMENT.API_KEY]: process.env.NEXT_PUBLIC_OCK_API_KEY,
[ENVIRONMENT.ENVIRONMENT]: process.env.NEXT_PUBLIC_VERCEL_ENV,
};

0 comments on commit 490a5a8

Please sign in to comment.