From 4f5b9358f7617a22f3be4385f5c1e2f436ec1f52 Mon Sep 17 00:00:00 2001 From: texuf Date: Tue, 10 Sep 2024 11:08:54 -0700 Subject: [PATCH] Playground: dynamically generate environment switcher i wanted to connect to alpha! --- .../src/components/dialog/env-switcher.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/playground/src/components/dialog/env-switcher.tsx b/packages/playground/src/components/dialog/env-switcher.tsx index 098ee25df..94c9c17a4 100644 --- a/packages/playground/src/components/dialog/env-switcher.tsx +++ b/packages/playground/src/components/dialog/env-switcher.tsx @@ -6,13 +6,14 @@ import { useWaitForTransaction, } from 'wagmi' -import { base, baseSepolia, foundry } from 'viem/chains' +import { foundry } from 'viem/chains' import { useRiverConnection } from '@river-build/react-sdk' import { makeRiverConfig } from '@river-build/sdk' import { privateKeyToAccount } from 'viem/accounts' import { parseEther } from 'viem' import { useState } from 'react' import { useNavigate } from 'react-router-dom' +import { getWeb3Deployment, getWeb3Deployments } from '@river-build/web3' import { deleteAuth, storeAuth } from '@/utils/persist-auth' import { useEthersSigner } from '@/utils/viem-to-ethers' import { Button } from '../ui/button' @@ -28,11 +29,11 @@ import { import { Input } from '../ui/input' import { Label } from '../ui/label' -const environments = [ - { id: 'gamma', name: 'Gamma', chainId: baseSepolia.id }, - { id: 'omega', name: 'Omega', chainId: base.id }, - { id: 'local_multi', name: 'Local Multi', chainId: foundry.id }, -] as const +const environments = getWeb3Deployments().map((id) => ({ + id: id, + name: id, + chainId: getWeb3Deployment(id).base.chainId, +})) export type Env = (typeof environments)[number]