Skip to content

Commit

Permalink
feat: add uxuywallet
Browse files Browse the repository at this point in the history
  • Loading branch information
joewang committed Sep 26, 2024
1 parent 48552cb commit 2d17d40
Show file tree
Hide file tree
Showing 26 changed files with 755 additions and 465 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock = true
strict-peer-dependencies = false
dedupe-peer-dependents = true
package-manager-strict = false

2 changes: 1 addition & 1 deletion examples/with-create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"typescript": "5.5.2",
"util": "0.12.5",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-app-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-custom-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-mint-nft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-rainbow-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-siwe-iron-session/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-dom": "^18.3.1",
"siwe": "^2.1.4",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-siwe-next-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react-dom": "^18.3.1",
"siwe": "^2.1.4",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-wallet-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9",
"wagmi": "3.0.0",
"@tanstack/react-query": "^5.51.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"typescript": "5.5.2",
"viem": "2.17.0",
"vitest": "2.0.5",
"wagmi": "^2.12.9"
"wagmi": "3.0.0"
},
"packageManager": "[email protected]",
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-rainbowkit/generated-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9"
"wagmi": "3.0.0"
},
"devDependencies": {
"@types/node": "^20.14.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-rainbowkit/templates/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.17.0",
"wagmi": "^2.12.9"
"wagmi": "3.0.0"
},
"devDependencies": {
"@types/node": "^20.14.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-dom": "^18.3.1",
"siwe": "^2.1.4",
"viem": "2.17.0",
"wagmi": "^2.12.9"
"wagmi": "3.0.0"
},
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/rainbow-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"react": ">=18",
"react-dom": ">=18",
"viem": "2.x",
"wagmi": "^2.9.0"
"wagmi": "3.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/rainbowkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"react": ">=18",
"react-dom": ">=18",
"viem": "2.x",
"wagmi": "^2.9.0"
"wagmi": "3.0.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.2.0",
Expand Down
34 changes: 18 additions & 16 deletions packages/rainbowkit/src/config/getDefaultConfig.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import type { Transport } from 'viem';
import { http, type CreateConfigParameters } from 'wagmi';
import { createConfig } from 'wagmi';
import type { RainbowKitChain } from '../components/RainbowKitProvider/RainbowKitChainContext';
import type { WalletList } from '../wallets/Wallet';
import { computeWalletConnectMetaData } from '../wallets/computeWalletConnectMetaData';
import { connectorsForWallets } from '../wallets/connectorsForWallets';
import type { Transport } from "viem";
import { http, type CreateConfigParameters } from "wagmi";
import { createConfig } from "wagmi";
import type { RainbowKitChain } from "../components/RainbowKitProvider/RainbowKitChainContext";
import type { WalletList } from "../wallets/Wallet";
import { computeWalletConnectMetaData } from "../wallets/computeWalletConnectMetaData";
import { connectorsForWallets } from "../wallets/connectorsForWallets";
import {
coinbaseWallet,
metaMaskWallet,
rainbowWallet,
safeWallet,
uxuyWallet,
walletConnectWallet,
} from '../wallets/walletConnectors';
} from "../wallets/walletConnectors";

export type _chains = readonly [RainbowKitChain, ...RainbowKitChain[]];

// Define the '_transports' type as a Record
// It maps each 'Chain' id to a 'Transport'
export type _transports = Record<_chains[number]['id'], Transport>;
export type _transports = Record<_chains[number]["id"], Transport>;

interface GetDefaultConfigParameters<
chains extends _chains,
transports extends _transports,
transports extends _transports
> extends Omit<
CreateConfigParameters<chains, transports>,
// If you use 'client' you can't use 'transports' (we force to use 'transports')
// More info here https://wagmi.sh/core/api/createConfig#client
// We will also use our own 'connectors' instead of letting user specifying it
'client' | 'connectors'
"client" | "connectors"
> {
appName: string;
appDescription?: string;
Expand All @@ -39,9 +40,9 @@ interface GetDefaultConfigParameters<

const createDefaultTransports = <
chains extends _chains,
transports extends _transports,
transports extends _transports
>(
chains: chains,
chains: chains
): transports => {
const transportsObject = chains.reduce((acc: transports, chain) => {
const key = chain.id as keyof transports;
Expand All @@ -54,7 +55,7 @@ const createDefaultTransports = <

export const getDefaultConfig = <
chains extends _chains,
transports extends _transports,
transports extends _transports
>({
appName,
appDescription,
Expand All @@ -76,12 +77,13 @@ export const getDefaultConfig = <
const connectors = connectorsForWallets(
wallets || [
{
groupName: 'Popular',
groupName: "Popular",
wallets: [
safeWallet,
rainbowWallet,
coinbaseWallet,
metaMaskWallet,
uxuyWallet,
walletConnectWallet,
],
},
Expand All @@ -93,7 +95,7 @@ export const getDefaultConfig = <
appUrl,
appIcon,
walletConnectParameters: { metadata },
},
}
);

return createConfig({
Expand Down
20 changes: 11 additions & 9 deletions packages/rainbowkit/src/wallets/getDefaultWallets.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { CreateConnectorFn } from 'wagmi';
import type { WalletList } from './Wallet';
import type { CreateConnectorFn } from "wagmi";
import type { WalletList } from "./Wallet";
import {
type ConnectorsForWalletsParameters,
connectorsForWallets,
} from './connectorsForWallets';
import { coinbaseWallet } from './walletConnectors/coinbaseWallet/coinbaseWallet';
import { metaMaskWallet } from './walletConnectors/metaMaskWallet/metaMaskWallet';
import { rainbowWallet } from './walletConnectors/rainbowWallet/rainbowWallet';
import { safeWallet } from './walletConnectors/safeWallet/safeWallet';
import { walletConnectWallet } from './walletConnectors/walletConnectWallet/walletConnectWallet';
} from "./connectorsForWallets";
import { coinbaseWallet } from "./walletConnectors/coinbaseWallet/coinbaseWallet";
import { metaMaskWallet } from "./walletConnectors/metaMaskWallet/metaMaskWallet";
import { rainbowWallet } from "./walletConnectors/rainbowWallet/rainbowWallet";
import { safeWallet } from "./walletConnectors/safeWallet/safeWallet";
import { uxuyWallet } from "./walletConnectors/uxuyWallet/uxuyWallet";
import { walletConnectWallet } from "./walletConnectors/walletConnectWallet/walletConnectWallet";

export function getDefaultWallets(parameters: ConnectorsForWalletsParameters): {
connectors: CreateConnectorFn[];
Expand All @@ -20,12 +21,13 @@ export function getDefaultWallets(): { wallets: WalletList };
export function getDefaultWallets(parameters?: ConnectorsForWalletsParameters) {
const wallets: WalletList = [
{
groupName: 'Popular',
groupName: "Popular",
wallets: [
safeWallet,
rainbowWallet,
coinbaseWallet,
metaMaskWallet,
uxuyWallet,
walletConnectWallet,
],
},
Expand Down
Loading

0 comments on commit 2d17d40

Please sign in to comment.