Skip to content

Commit c720e07

Browse files
committed
Merge branch 'feat/wallet-connect' of github.com-ift:status-im/status-web into chore/update-wallet-connect-impl
2 parents 3f80bdb + 1b860d2 commit c720e07

File tree

20 files changed

+2227
-2692
lines changed

20 files changed

+2227
-2692
lines changed

.changeset/famous-deers-sell.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@status-im/status-network': patch
3+
'hub': patch
4+
---
5+
6+
add wallet connect

apps/api/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@
1717
"dependencies": {
1818
"@status-im/wallet": "workspace:*",
1919
"@trpc/client": "10.45.2",
20-
"@trpc/server": "10.45.2",
2120
"@trpc/next": "10.45.2",
21+
"@trpc/server": "10.45.2",
22+
"next": "15.3.0",
2223
"react": "^19.0.0",
2324
"react-dom": "^19.0.0",
24-
"next": "15.3.0",
2525
"zod": "^3.23.8"
2626
},
2727
"devDependencies": {
28-
"typescript": "^5",
28+
"@eslint/eslintrc": "^3.1.0",
29+
"@next/eslint-plugin-next": "15.3.0",
2930
"@types/node": "^20",
3031
"@types/react": "^19",
3132
"@types/react-dom": "^19",
3233
"eslint": "^9",
3334
"eslint-config-next": "15.3.0",
34-
"@eslint/eslintrc": "^3",
35-
"globals": "^15.12.0"
35+
"globals": "^15.12.0",
36+
"typescript": "^5.6.2"
3637
},
3738
"engines": {
3839
"node": "20.x"

apps/hub/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,32 @@
2121
"@status-im/icons": "workspace:*",
2222
"@status-im/status-network": "workspace:*",
2323
"@tanstack/react-table": "^8.21.3",
24+
"@status-im/wallet": "workspace:*",
25+
"@tanstack/react-query": "5.66.0",
2426
"@vercel/analytics": "^1.5.0",
27+
"connectkit": "^1.9.0",
2528
"cva": "1.0.0-beta.1",
2629
"framer-motion": "^12.0.6",
27-
"next": "15.1.6",
30+
"next": "15.3.0",
2831
"next-mdx-remote": "^5.0.0",
29-
"react": "^19.0.0",
30-
"react-dom": "^19.0.0",
3132
"react-hook-form": "^7.45.1",
33+
"pino-pretty": "^13.1.1",
34+
"react": "19.1.0",
35+
"react-dom": "19.1.0",
3236
"rehype-slug": "^6.0.0",
3337
"siwe": "^2.3.2",
3438
"ts-pattern": "^5.6.2",
3539
"viem": "^2.21.1",
36-
"zod": "^3.21.4"
40+
"zod": "^3.21.4",
41+
"wagmi": "2.15.2"
3742
},
3843
"devDependencies": {
3944
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
4045
"@next/eslint-plugin-next": "15.3.0",
4146
"@status-im/eslint-config": "workspace:*",
4247
"@types/node": "^20",
43-
"@types/react": "^19",
44-
"@types/react-dom": "^19",
48+
"@types/react": "19.1.0",
49+
"@types/react-dom": "19.1.0",
4550
"eslint-config-next": "15.1.6",
4651
"eslint-plugin-tailwindcss": "^3.17.4",
4752
"lint-staged": "^15.4.3",

apps/hub/postcss.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ const config = {
33
plugins: {
44
tailwindcss: {},
55
},
6-
};
6+
}
77

8-
export default config;
8+
export default config
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use client'
2+
3+
import { Button, ShortenAddress } from '@status-im/status-network/components'
4+
import { ConnectKitButton } from 'connectkit'
5+
import { useAccount } from 'wagmi'
6+
7+
import type { ComponentProps } from 'react'
8+
9+
type Props = {
10+
size?: ComponentProps<typeof Button>['size']
11+
label?: string
12+
}
13+
14+
const ConnectButton = (props: Props) => {
15+
const { size = '32', label = 'Connect wallet' } = props
16+
17+
const { address, isConnected } = useAccount()
18+
19+
return (
20+
<ConnectKitButton.Custom>
21+
{({ show }) => {
22+
return (
23+
<Button
24+
onClick={show}
25+
variant={isConnected ? 'secondary' : 'primary'}
26+
size={size}
27+
>
28+
{address && isConnected ? (
29+
<ShortenAddress address={address} />
30+
) : (
31+
label
32+
)}
33+
</Button>
34+
)
35+
}}
36+
</ConnectKitButton.Custom>
37+
)
38+
}
39+
40+
export { ConnectButton }
41+
export type { Props as ConnectButtonProps }

apps/hub/src/app/_components/top-bar.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import { Button, IconButton, Tag } from '@status-im/components'
44
import { SettingsIcon } from '@status-im/icons/20'
5-
import {
6-
Button as ButtonPrimary,
7-
Link,
8-
} from '@status-im/status-network/components'
5+
import { Link } from '@status-im/status-network/components'
96
import Image from 'next/image'
107

8+
import { ConnectButton } from './connect-button'
9+
1110
interface TopBarProps {
1211
onMenuToggle: () => void
1312
}
@@ -64,7 +63,7 @@ export function TopBar({ onMenuToggle }: TopBarProps) {
6463
</div>
6564

6665
{/* Connect Wallet Button */}
67-
<ButtonPrimary size="32">Connect Wallet</ButtonPrimary>
66+
<ConnectButton />
6867

6968
{/* Settings Button */}
7069
<IconButton variant="ghost" icon={<SettingsIcon />} />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use client'
2+
3+
import { ConnectKitProvider as ConnectKit } from 'connectkit'
4+
5+
type ConnectKitProviderProps = {
6+
children: React.ReactNode
7+
}
8+
9+
export function ConnectKitProvider({ children }: ConnectKitProviderProps) {
10+
return (
11+
<ConnectKit theme="auto" mode="light">
12+
{children}
13+
</ConnectKit>
14+
)
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use client'
2+
3+
import { ConnectKitProvider } from './connectkit-provider'
4+
import { QueryClientProvider } from './query-client-provider'
5+
import { WagmiProvider } from './wagmi-provider'
6+
7+
interface ProvidersProps {
8+
children: React.ReactNode
9+
}
10+
11+
export function Providers({ children }: ProvidersProps) {
12+
return (
13+
<WagmiProvider>
14+
<QueryClientProvider>
15+
<ConnectKitProvider>{children}</ConnectKitProvider>
16+
</QueryClientProvider>
17+
</WagmiProvider>
18+
)
19+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use client'
2+
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
4+
5+
import type React from 'react'
6+
7+
const queryClient = new QueryClient({
8+
defaultOptions: {
9+
queries: {
10+
retry: false,
11+
retryOnMount: false,
12+
refetchOnMount: false,
13+
refetchOnWindowFocus: false,
14+
refetchOnReconnect: false,
15+
},
16+
},
17+
})
18+
19+
type Props = {
20+
children: React.ReactNode
21+
}
22+
23+
function _QueryClientProvider(props: Props) {
24+
const { children } = props
25+
26+
return (
27+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
28+
)
29+
}
30+
31+
export { _QueryClientProvider as QueryClientProvider }
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
'use client'
2+
3+
import { createConfig, http, WagmiProvider as WagmiProviderBase } from 'wagmi'
4+
import { mainnet } from 'wagmi/chains'
5+
import { injected } from 'wagmi/connectors'
6+
7+
import type React from 'react'
8+
9+
export const config = createConfig({
10+
chains: [mainnet],
11+
ssr: false,
12+
connectors: [injected()],
13+
transports: {
14+
// todo: replace public clients
15+
[mainnet.id]: http(),
16+
},
17+
})
18+
19+
declare module 'wagmi' {
20+
interface Register {
21+
config: typeof config
22+
}
23+
}
24+
25+
type Props = {
26+
children: React.ReactNode
27+
}
28+
29+
function WagmiProvider(props: Props) {
30+
const { children } = props
31+
32+
return (
33+
<WagmiProviderBase
34+
config={
35+
config as unknown as React.ComponentProps<
36+
typeof WagmiProviderBase
37+
>['config']
38+
}
39+
>
40+
{children}
41+
</WagmiProviderBase>
42+
)
43+
}
44+
45+
export { config as wagmiConfig, WagmiProvider }

0 commit comments

Comments
 (0)