Skip to content

Commit c9c23f3

Browse files
Merge pull request #411 from BootNodeDev/feat/410-add-issue-connector
feat: add porto and config
2 parents 3ba2072 + 208bb16 commit c9c23f3

File tree

11 files changed

+1847
-455
lines changed

11 files changed

+1847
-455
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PUBLIC_APP_DESCRIPTION=''
99
PUBLIC_APP_URL=''
1010
# App's logo. Optional.
1111
PUBLIC_APP_LOGO=''
12+
13+
# Enable Ithaca Porto connector. Optional. Default true.
14+
PUBLIC_ENABLE_PORTO=true
1215
# Include testnets. Optional.
1316
PUBLIC_INCLUDE_TESTNETS=true
1417

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
*.sln
1212
*.sw?
1313
tsconfig.tsbuildinfo
14+
.tool-versions
1415

1516
# Project folders
1617
typedoc
@@ -37,4 +38,4 @@ npm-debug.log*
3738
yarn-debug.log*
3839
yarn-error.log*
3940
pnpm-debug.log*
40-
lerna-debug.log*
41+
lerna-debug.log*

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
"@chakra-ui/react": "^3.17.0",
3030
"@emotion/react": "^11.14.0",
3131
"@lifi/sdk": "^3.6.13",
32+
"@rainbow-me/rainbowkit": "^2.2.9",
33+
"@reown/appkit": "^1.8.10",
34+
"@reown/appkit-adapter-wagmi": "^1.8.10",
3235
"@t3-oss/env-core": "^0.13.4",
3336
"@tanstack/react-query": "^5.75.7",
3437
"@tanstack/react-router": "^1.120.3",
@@ -41,14 +44,15 @@
4144
"graphql": "^16.11.0",
4245
"graphql-request": "^7.1.2",
4346
"next-themes": "^0.4.6",
47+
"porto": "^0.2.28",
4448
"react": "19.1.0",
4549
"react-dom": "19.1.0",
4650
"react-error-boundary": "^6.0.0",
4751
"react-jazzicon": "^1.0.4",
4852
"react-number-format": "^5.4.4",
4953
"use-debounce": "^10.0.4",
50-
"viem": "^2.29.1",
51-
"wagmi": "^2.15.2",
54+
"viem": "^2.37.9",
55+
"wagmi": "^2.17.5",
5256
"zod": "^3.24.4"
5357
},
5458
"devDependencies": {
@@ -91,11 +95,16 @@
9195
"onlyBuiltDependencies": [
9296
"@biomejs/biome",
9397
"@parcel/watcher",
98+
"@reown/appkit",
9499
"@swc/core",
95-
"ufferutil",
96-
"sbuild",
100+
"bufferutil",
97101
"eccak",
98-
"tf-8-validate"
102+
"esbuild",
103+
"keccak",
104+
"sbuild",
105+
"tf-8-validate",
106+
"ufferutil",
107+
"utf-8-validate"
99108
]
100109
}
101110
}

pnpm-lock.yaml

Lines changed: 1753 additions & 397 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/sharedComponents/ui/Header/MobileMenu/MobileMenu.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Logo from '@/src/components/sharedComponents/ui/Header/Logo'
22
import MainMenu from '@/src/components/sharedComponents/ui/Header/MainMenu'
33
import { SwitchThemeButton } from '@/src/components/sharedComponents/ui/SwitchThemeButton'
44
import { ConnectWalletButton } from '@/src/providers/Web3Provider'
5-
import { chakra } from '@chakra-ui/react'
5+
import { Box, chakra } from '@chakra-ui/react'
66
import { Drawer } from '@chakra-ui/react'
77
import { useTheme } from 'next-themes'
88
import { useState } from 'react'
@@ -118,10 +118,12 @@ export const MobileMenu = () => {
118118
flexDirection="column"
119119
rowGap={6}
120120
>
121-
<ConnectWalletButton
121+
<Box
122122
marginBottom={10}
123123
maxWidth="fit-content"
124-
/>
124+
>
125+
<ConnectWalletButton />
126+
</Box>
125127
<MainMenu />
126128
<SwitchThemeButton
127129
marginTop="auto"

src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const env = createEnv({
2222
PUBLIC_APP_LOGO: z.string().optional(),
2323
PUBLIC_APP_NAME: z.string().min(1),
2424
PUBLIC_APP_URL: z.string().optional(),
25+
PUBLIC_ENABLE_PORTO: zBoolean,
2526
PUBLIC_USE_DEFAULT_TOKENS: zBoolean,
2627
PUBLIC_INFURA_KEY: z.string().optional(),
2728
PUBLIC_NATIVE_TOKEN_ADDRESS: z

src/lib/wallets/connectkit.config.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ConnectKitButton, ConnectKitProvider, type Types, getDefaultConfig } fr
77
import type { FC, ReactNode } from 'react'
88
import type { Address } from 'viem'
99
import { normalize } from 'viem/ens'
10+
1011
import { createConfig, useEnsAvatar, useEnsName } from 'wagmi'
1112

1213
interface Props {

src/lib/wallets/portoInit.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { env } from '@/src/env'
2+
import { Porto } from 'porto'
3+
4+
if (env.PUBLIC_ENABLE_PORTO) {
5+
try {
6+
Porto.create()
7+
} catch (error) {
8+
console.error('Failed to initialize Porto:', error)
9+
}
10+
}

src/lib/wallets/rainbowkit.config.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
* version used: 2.0.8
44
*/
55

6-
// import { type ReactNode } from 'react'
6+
// import type { ReactNode } from 'react'
77

8-
// import { RainbowKitProvider, type AvatarComponent, ConnectButton } from '@rainbow-me/rainbowkit'
9-
// import { getDefaultConfig } from 'connectkit'
10-
// import { createConfig } from 'wagmi'
8+
// import { type AvatarComponent, ConnectButton, RainbowKitProvider } from '@rainbow-me/rainbowkit'
9+
// import { getDefaultConfig } from '@rainbow-me/rainbowkit';
1110

1211
// import { env } from '@/src/env'
1312
// import { chains, transports } from '@/src/lib/networks.config'
1413

15-
// import CustomAvatar from '@/src/components/sharedComponents/ui/Avatar'
14+
// import CustomAvatar from '@/src/components/sharedComponents/Avatar'
1615

1716
// export const WalletProvider = ({ children }: { children: ReactNode }) => {
1817
// return (
@@ -30,6 +29,7 @@
3029

3130
// // Required API Keys
3231
// walletConnectProjectId: env.PUBLIC_WALLETCONNECT_PROJECT_ID,
32+
// projectId: env.PUBLIC_WALLETCONNECT_PROJECT_ID,
3333

3434
// // Required App Info
3535
// appName: env.PUBLIC_APP_NAME,
@@ -40,6 +40,4 @@
4040
// appIcon: env.PUBLIC_APP_LOGO,
4141
// } as const
4242

43-
// const rainbowkitConfig = getDefaultConfig(defaultConfig)
44-
45-
// export const config = createConfig(rainbowkitConfig)
43+
// export const config = getDefaultConfig(defaultConfig)

src/lib/wallets/web3modal.config.tsx

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,54 @@
33
* version used: 4.2.1
44
*/
55

6-
// import { type FC, type DetailedHTMLProps, type HTMLAttributes, type PropsWithChildren } from 'react'
7-
8-
// import { createWeb3Modal, defaultWagmiConfig } from '@web3modal/wagmi'
9-
10-
// import { env } from '@/src/env'
11-
12-
// import { chains, transports } from '@/src/lib/networks.config'
13-
14-
// export const WalletProvider: FC<PropsWithChildren> = ({ children }) => children
15-
16-
// declare global {
17-
// namespace JSX {
18-
// interface IntrinsicElements {
19-
// 'w3m-button': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
20-
// }
21-
// }
22-
// }
23-
// export const ConnectWalletButton = ({ label = 'Connect' }: { label?: string }) => (
24-
// <w3m-button label={label} />
25-
// )
26-
27-
// // Required API Keys
28-
// const projectId = env.PUBLIC_WALLETCONNECT_PROJECT_ID
29-
30-
// export const config = defaultWagmiConfig({
31-
// chains,
32-
// projectId,
33-
// metadata: {
34-
// // Required App Info
35-
// name: env.PUBLIC_APP_NAME,
36-
// description: env.PUBLIC_APP_DESCRIPTION ?? '',
37-
// url: env.PUBLIC_APP_URL ?? '',
38-
// icons: [env.PUBLIC_APP_LOGO ?? ''],
39-
// },
40-
// transports,
41-
// })
42-
43-
// createWeb3Modal({
44-
// wagmiConfig: config,
45-
// projectId,
46-
// })
6+
import type { DetailedHTMLProps, FC, HTMLAttributes, PropsWithChildren } from 'react'
7+
8+
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'
9+
import { createAppKit } from '@reown/appkit/react'
10+
11+
import { env } from '@/src/env'
12+
13+
import { chains } from '@/src/lib/networks.config'
14+
import type { Chain } from 'viem'
15+
16+
export const WalletProvider: FC<PropsWithChildren> = ({ children }) => children
17+
18+
declare global {
19+
namespace JSX {
20+
interface IntrinsicElements {
21+
'w3m-button': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>
22+
}
23+
}
24+
}
25+
export const ConnectWalletButton = ({ label = 'Connect' }: { label?: string }) => (
26+
<appkit-button label={label} />
27+
)
28+
29+
// Required API Keys
30+
const projectId = env.PUBLIC_WALLETCONNECT_PROJECT_ID
31+
32+
const metadata = {
33+
// Required App Info
34+
name: env.PUBLIC_APP_NAME,
35+
description: env.PUBLIC_APP_DESCRIPTION ?? '',
36+
url: env.PUBLIC_APP_URL ?? '',
37+
icons: [env.PUBLIC_APP_LOGO ?? ''],
38+
}
39+
40+
// TODO avoid readonly types mismatch
41+
const wagmiAdapter = new WagmiAdapter({
42+
networks: chains as unknown as Chain[],
43+
projectId,
44+
})
45+
46+
createAppKit({
47+
adapters: [wagmiAdapter],
48+
networks: chains as unknown as [Chain, ...Chain[]],
49+
metadata: metadata,
50+
projectId,
51+
features: {
52+
analytics: true,
53+
},
54+
})
55+
56+
export const config = wagmiAdapter.wagmiConfig

0 commit comments

Comments
 (0)