Skip to content

Commit

Permalink
move to all alchemy providers
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Sutula <[email protected]>
  • Loading branch information
asutula committed Aug 13, 2024
1 parent d003139 commit 1c4b1b1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 28 deletions.
6 changes: 2 additions & 4 deletions packages/api/src/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export function appRouter(
createInviteLink: (seal: string) => string,
dataSealPass: string,
isLocalDev: boolean,
infuraKey: string,
quickNodeKey: string,
alchemyKey: string,
) {
const mailApi = initMailApi(mailApiKey);
const sendInvite = createSendInvite(
Expand All @@ -41,8 +40,7 @@ export function appRouter(
environments: environmentsRouter(store),
deployments: deploymentsRouter(store),
providers: providersRouter(isLocalDev, {
infura: infuraKey,
quickNode: quickNodeKey,
alchemy: alchemyKey,
}),
users: usersRouter(store),
});
Expand Down
22 changes: 4 additions & 18 deletions packages/chains/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { configureChains } from "@wagmi/core";
import { infuraProvider } from "@wagmi/core/providers/infura";
import { jsonRpcProvider } from "@wagmi/core/providers/jsonRpc";
import { alchemyProvider } from "@wagmi/core/providers/alchemy";
import { publicProvider } from "@wagmi/core/providers/public";
import { defineChain } from "viem";
import {
Expand All @@ -21,8 +20,7 @@ import {
} from "viem/chains";

export interface ApiKeys {
infura?: string;
quickNode?: string;
alchemy?: string;
}

// Note: copied from [email protected]
Expand Down Expand Up @@ -78,22 +76,10 @@ function supportedChains(isLocalDev = false) {
}

function configuredChains(isLocalDev = false, apiKeys?: ApiKeys) {
const infuraKey = apiKeys?.infura ?? "";
const quickNodeKey = apiKeys?.quickNode ?? "";
const alchemyKey = apiKeys?.alchemy ?? "";

return configureChains(supportedChains(isLocalDev), [
infuraProvider({ apiKey: infuraKey }),
jsonRpcProvider({
rpc: (chain) => {
let slug = "breakit";
if (chain.id === arbitrumNova.id) {
slug = "nova-mainnet";
}
return {
http: `https://skilled-yolo-mountain.${slug}.quiknode.pro/${quickNodeKey}/`,
};
},
}),
alchemyProvider({ apiKey: alchemyKey }),
publicProvider(),
]);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ SESSION_COOKIE_NAME="STUDIO_SESSION"
SESSION_COOKIE_PASS="secure password secure password secure password secure password secure password secure password secure password"
DATA_SEAL_PASS="secure password secure password secure password secure password secure password secure password secure password"
POSTMARK_API_KEY=fillme(optional)
NEXT_PUBLIC_API_ROUTER_INFURA_KEY="api key"
NEXT_PUBLIC_API_ROUTER_QUICK_NODE_KEY="api key"
NEXT_PUBLIC_API_ROUTER_ALCHEMY_KEY="api key"
3 changes: 1 addition & 2 deletions packages/web/components/wagmi-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const { chains, publicClient, webSocketPublicClient } = configuredChains(
(window.location?.hostname === "localhost" ||
window.location?.hostname === "127.0.0.1"),
{
infura: process.env.NEXT_PUBLIC_API_ROUTER_INFURA_KEY ?? "",
quickNode: process.env.NEXT_PUBLIC_API_ROUTER_QUICK_NODE_KEY ?? "",
alchemy: process.env.NEXT_PUBLIC_API_ROUTER_ALCHEMY_KEY ?? "",
},
);

Expand Down
3 changes: 1 addition & 2 deletions packages/web/lib/api-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export const apiRouter = appRouter(
(seal) => `${baseUrl}/invite?seal=${seal}`,
process.env.DATA_SEAL_PASS!,
process.env.NODE_ENV === "development",
process.env.NEXT_PUBLIC_API_ROUTER_INFURA_KEY ?? "",
process.env.NEXT_PUBLIC_API_ROUTER_QUICK_NODE_KEY ?? "",
process.env.NEXT_PUBLIC_API_ROUTER_ALCHEMY_KEY ?? "",
);

0 comments on commit 1c4b1b1

Please sign in to comment.