Skip to content

Commit

Permalink
feat(celo): add celo support to frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers committed Oct 23, 2023
1 parent 052f501 commit 882dfc7
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 22 deletions.
2 changes: 1 addition & 1 deletion defender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"deploy:test": "pnpm build && pnpm setup:test",
"deploy:prod": "pnpm build && pnpm setup:prod",
"setup:test": "npx tsx src/setup.ts TEST",
"setup:prod": "npx tsx src/setup.ts src/setup.ts PROD"
"setup:prod": "npx tsx src/setup.ts PROD"
},
"dependencies": {
"@hypercerts-org/contracts": "0.8.11",
Expand Down
21 changes: 19 additions & 2 deletions frontend/components/dapp-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ import {
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import React, { ReactNode, useEffect } from "react";
import { Chain, goerli, optimism, sepolia } from "viem/chains";
import { celo, Chain, goerli, optimism, sepolia } from "viem/chains";
import { configureChains, WagmiConfig, createConfig } from "wagmi";
import { publicProvider } from "wagmi/providers/public";

import {
Valora,
CeloWallet,
CeloTerminal,
MetaMask as CeloMetaMask,
} from "@celo/rainbowkit-celo/wallets";

const queryClient = new QueryClient();

const TEST_CHAINS = [goerli, sepolia];
const PROD_CHAINS = [optimism];
const PROD_CHAINS = [optimism, celo];

export const CHAINS = (isProduction ? PROD_CHAINS : TEST_CHAINS) as Chain[];

Expand Down Expand Up @@ -72,6 +79,16 @@ const connectors = connectorsForWallets([
zerionWallet({ chains, projectId }),
],
},
{
groupName: "Recommended with CELO",
wallets: [
Valora({ chains, projectId }),
CeloWallet({ chains, projectId }),
CeloTerminal({ chains, projectId }),
CeloMetaMask({ chains, projectId }),
walletConnectWallet({ projectId, chains }),
],
},
{
groupName: "Injected",
wallets: [injectedWallet({ chains })],
Expand Down
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
},
"dependencies": {
"@apollo/client": "^3.7.4",
"@celo/rainbowkit-celo": "^1.1.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@graphprotocol/client-cli": "^2.2.16",
"@hypercerts-org/contracts": "0.8.11",
"@hypercerts-org/observabletreemap": "workspace: *",
"@hypercerts-org/sdk": "0.8.10",
"@hypercerts-org/sdk": "0.8.16",
"@mui/icons-material": "^5.11.9",
"@mui/material": "^5.11.2",
"@mui/x-date-pickers": "^5.0.12",
Expand Down
132 changes: 116 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hypercerts-org/sdk",
"version": "0.8.14",
"version": "0.8.16",
"description": "SDK for hypercerts protocol",
"repository": "[email protected]:hypercerts-org/hypercerts.git",
"author": "Hypercerts team",
Expand Down
5 changes: 4 additions & 1 deletion sdk/src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const getConfig = (overrides: Partial<HypercertClientConfig>) => {
unsafeForceOverrideConfig: overrides.unsafeForceOverrideConfig,
};
} else {
if (!chainId || [5, 10, 11155111].indexOf(chainId) === -1) {
if (!chainId || [5, 10, 42220, 11155111].indexOf(chainId) === -1) {
throw new UnsupportedChainError(`chainId=${chainId} is not yet supported`, {
chainID: chainId?.toString() || "undefined",
});
Expand Down Expand Up @@ -87,6 +87,9 @@ const getChainConfig = (overrides: Partial<HypercertClientConfig>) => {
case 10:
chainName = "optimism-mainnet";
break;
case 42220:
chainName = "celo";
break;
case 11155111:
chainName = "sepolia";
break;
Expand Down

0 comments on commit 882dfc7

Please sign in to comment.