Skip to content

Commit

Permalink
Move to all alchemy providers (#314)
Browse files Browse the repository at this point in the history
* move to all alchemy providers

Signed-off-by: Aaron Sutula <[email protected]>

* fix test call

Signed-off-by: Aaron Sutula <[email protected]>

---------

Signed-off-by: Aaron Sutula <[email protected]>
Co-authored-by: Aaron Sutula <[email protected]>
  • Loading branch information
asutula and asutula authored Aug 14, 2024
1 parent d003139 commit 68e63bc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 29 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"
1 change: 0 additions & 1 deletion packages/cli/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ async function startStudioApi({ store }: { store: Store }) {
process.env.DATA_SEAL_PASS!,
true,
"",
"",
);

// Create a local server to receive data from
Expand Down
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 ?? "",
);

1 comment on commit 68e63bc

@vercel
Copy link

@vercel vercel bot commented on 68e63bc Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.