-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.tsx
More file actions
26 lines (23 loc) · 780 Bytes
/
index.tsx
File metadata and controls
26 lines (23 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use client'
import styles from '../styles/Home.module.css'
import { BuiltInChainId, SwapWidget } from '@vvs-finance/swap-widget'
export default function Home() {
return (
<div className={styles.page}>
<main className={styles.main}>
<SwapWidget
getQuoteApiClientId={getClientIdFromEnv}
selfConnectingChainId={parseInt(process.env.NEXT_PUBLIC_SELF_CONNECTING_CHAIN_ID ?? '338')}
/>
</main>
</div>
)
}
function getClientIdFromEnv(chainId: BuiltInChainId): string {
switch (chainId) {
case BuiltInChainId.CRONOS_MAINNET:
return process.env.NEXT_PUBLIC_SWAP_WIDGET_QUOTE_API_CLIENT_ID_25!
case BuiltInChainId.CRONOS_TESTNET:
return process.env.NEXT_PUBLIC_SWAP_WIDGET_QUOTE_API_CLIENT_ID_338!
}
}