Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
release: 1.0.1-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbrugneaux committed Jun 27, 2023
1 parent 0ec5573 commit 97412bb
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/rainbowkit-celo/lists/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
safeWallet,
braveWallet,
} from "@rainbow-me/rainbowkit/wallets";
import { Valora, CeloWallet } from "@celo/rainbowkit-celo/wallets";
import { Valora, CeloWallet } from "../wallets";

import type { Chain } from "@rainbow-me/rainbowkit";

Expand Down
10 changes: 5 additions & 5 deletions packages/rainbowkit-celo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@celo/rainbowkit-celo",
"author": "cLabs",
"version": "1.0.0",
"version": "1.0.1-beta.1",
"description": "Quickly Setup RainbowKit for Celo",
"homepage": "https://rainbowkit-with-celo.vercel.app/",
"repository": {
Expand Down Expand Up @@ -76,12 +76,12 @@
"build": "tsc -b"
},
"dependencies": {
"@wagmi/chains": "^0.2.22"
"@wagmi/chains": "^1.3.0"
},
"peerDependencies": {
"@rainbow-me/rainbowkit": "^1.0.0",
"viem": "^0.3.21",
"wagmi": "^1.0.0"
"@rainbow-me/rainbowkit": "^1.0.3",
"viem": "^1.1.8",
"wagmi": "^1.3.1"
},
"devDependencies": {
"@types/react": "^17.0.37",
Expand Down
13 changes: 13 additions & 0 deletions packages/rainbowkit-celo/utils/getWalletConnectUri.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Note: taken from https://github.com/rainbow-me/rainbowkit/blob/main/packages/rainbowkit/src/utils/getWalletConnectUri.ts#L3
// since they don't expose it
import type { Connector } from "wagmi/connectors";

export async function getWalletConnectUri(
connector: Connector,
version: "1" | "2"
): Promise<string> {
const provider = await connector.getProvider();
return version === "2"
? new Promise<string>((resolve) => provider.once("display_uri", resolve))
: provider.connector.uri;
}
4 changes: 3 additions & 1 deletion packages/rainbowkit-celo/wallets/celo-terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Wallet,
} from "@rainbow-me/rainbowkit";
import { Alfajores, Baklava, Celo } from "@celo/rainbowkit-celo/chains";
import { getWalletConnectUri } from "../utils/getWalletConnectUri";

interface CeloTerminalOptions {
chains: Chain[];
Expand All @@ -21,6 +22,7 @@ export const CeloTerminal = ({
iconBackground: "#FFF",
createConnector: () => {
const connector = getWalletConnectConnector({
version: "2",
chains,
projectId,
});
Expand All @@ -29,7 +31,7 @@ export const CeloTerminal = ({
connector,
desktop: {
getUri: async () => {
const { uri } = (await connector.getProvider()).connector;
const uri = await getWalletConnectUri(connector, "2");
// Note: This doesn't work. I'll try to have a PR to add deeplinking to CeloTerminal - Nicolas
return `https://celoterminal.com/wc?uri=${encodeURIComponent(uri)}`;
},
Expand Down
11 changes: 5 additions & 6 deletions packages/rainbowkit-celo/wallets/celo-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import type { Chain, Wallet } from "@rainbow-me/rainbowkit";
import { getWalletConnectConnector } from "@rainbow-me/rainbowkit";

import { Alfajores, Baklava, Celo } from "@celo/rainbowkit-celo/chains";
import { getWalletConnectUri } from "../utils/getWalletConnectUri";

interface CeloWalletOptions {
export interface CeloWalletOptions {
chains: Chain[];
projectId: string;
}
Expand All @@ -18,20 +19,18 @@ export const CeloWallet = ({
iconBackground: "#FFF",
createConnector: () => {
const connector = getWalletConnectConnector({
version: "2",
chains,
projectId,
});
return {
connector,
mobile: {
getUri: async () => {
const { uri } = (await connector.getProvider()).connector;
return uri;
},
getUri: () => getWalletConnectUri(connector, "2"),
},
desktop: {
getUri: async () => {
const { uri } = (await connector.getProvider()).connector;
const uri = await getWalletConnectUri(connector, "2");
return `celowallet://wc?uri=${encodeURIComponent(uri)}`;
},
},
Expand Down
15 changes: 10 additions & 5 deletions packages/rainbowkit-celo/wallets/valora.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import type { Chain, Wallet } from "@rainbow-me/rainbowkit";
import { getWalletConnectConnector } from "@rainbow-me/rainbowkit";
import {
Chain,
getWalletConnectConnector,
Wallet,
} from "@rainbow-me/rainbowkit";

import {
Alfajores,
Baklava,
Celo,
Cannoli,
} from "@celo/rainbowkit-celo/chains";
import { getWalletConnectUri } from "../utils/getWalletConnectUri";

// rainbowkit utils has it but doesn't export it :/
function isAndroid(): boolean {
Expand All @@ -15,7 +19,7 @@ function isAndroid(): boolean {
);
}

interface ValoraOptions {
export interface ValoraOptions {
chains: Chain[];
projectId: string;
}
Expand All @@ -36,22 +40,23 @@ export const Valora = ({
},
createConnector: () => {
const connector = getWalletConnectConnector({
version: "2",
chains,
projectId,
});
return {
connector,
mobile: {
getUri: async () => {
const { uri } = (await connector.getProvider()).connector;
const uri = await getWalletConnectUri(connector, "2");
return isAndroid()
? uri
: // ideally this would use the WalletConnect registry, but this will do for now
`https://valoraapp.com/wc?uri=${encodeURIComponent(uri)}`;
},
},
qrCode: {
getUri: async () => (await connector.getProvider()).connector.uri,
getUri: () => getWalletConnectUri(connector, "2"),
instructions: {
learnMoreUrl: "https://valoraapp.com/learn",
steps: [
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1517,11 +1517,16 @@
resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-0.2.16.tgz#a726716e4619ec1c192b312e23f9c38407617aa0"
integrity sha512-rkWaI2PxCnbD8G07ZZff5QXftnSkYL0h5f4DkHCG3fGYYr/ZDvmCL4bMae7j7A9sAif1csPPBmbCzHp3R5ogCQ==

"@wagmi/[email protected]", "@wagmi/chains@^0.2.22":
"@wagmi/[email protected]":
version "0.2.22"
resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-0.2.22.tgz#25e511e134a00742e4fbf5108613dadf876c5bd9"
integrity sha512-TdiOzJT6TO1JrztRNjTA5Quz+UmQlbvWFG8N41u9tta0boHA1JCAzGGvU6KuIcOmJfRJkKOUIt67wlbopCpVHg==

"@wagmi/chains@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-1.3.0.tgz#a17438d44abe98fdf1ec3a91df115c6bfaed39c0"
integrity sha512-7tyr1irTZQpA4/4HoIiJP3XYZuJIZuWiZ1V1j5WEG3cjm8TXIlMEzO0N+hT/cZKw4/UtF2EukvB8GkDWa2S77w==

"@wagmi/[email protected]":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-1.0.2.tgz#114822768bd56a9a62c8d12b9ba6895bc7f7b616"
Expand Down

0 comments on commit 97412bb

Please sign in to comment.