Skip to content

Feat/update rainbowkit v2.2.6#32

Open
hicaru wants to merge 3 commits intoZilliqa:mainfrom
hicaru:feat/update-rainbowkit-v2.2.6
Open

Feat/update rainbowkit v2.2.6#32
hicaru wants to merge 3 commits intoZilliqa:mainfrom
hicaru:feat/update-rainbowkit-v2.2.6

Conversation

@hicaru
Copy link

@hicaru hicaru commented Jun 11, 2025

  • added ZilPay
  • updated rainbowkit

google-labs-jules bot and others added 3 commits June 11, 2025 08:54
Update RainbowKit to v2.2.6 and adapt to wagmi v2

This commit updates @rainbow-me/rainbowkit to version 2.2.6 and its peer dependencies (wagmi to v2.9.2, viem to v2.10.9).

Key changes include:
- Updated package.json and package-lock.json with new dependency versions.
- Refactored `src/App.tsx` to align with wagmi v2 APIs:
    - Replaced `useNetwork` with `useChainId`.
    - Updated contract interaction hooks (usePrepareContractWrite to direct useWriteContract pattern).
    - Replaced `useSwitchNetwork` with `useSwitchChain`.
    - Replaced `useWaitForTransaction` with `useWaitForTransactionReceipt`.
    - Adjusted how properties like `enabled`, `onError` are passed to hooks.
    - Replaced `erc20ABI` import from `wagmi` with `erc20Abi` from `viem`.
    - Removed 'watch: true' from `useBalance` and `useContractRead` queries, aligning with TanStack Query v5 patterns.
- Updated `src/config/wallet.ts` for new RainbowKit/wagmi configuration:
    - Removed `configureChains` and `publicProvider`.
    - Defined chains directly.
    - Used `http` transport in `createConfig`.
- Updated `src/main.tsx` to remove the 'chains' prop from `RainbowKitProvider`.
- Restored "Add to Metamask" functionality in `src/components/AddToken.tsx`:
    - Implemented `wallet_watchAsset` RPC call via `getConnectorClient().request()` due to issues locating a direct 'watchAsset' import in wagmi@2.9.2.
- Added `@tanstack/react-query` as a direct dependency to resolve a build error.

The project now successfully builds with the updated dependencies.
Update RainbowKit to v2.2.6 and adapt to wagmi v2

This commit updates @rainbow-me/rainbowkit to version 2.2.6 and its peer dependencies (wagmi to v2.9.2, viem to v2.10.9).

Key changes include:
- Updated package.json and package-lock.json with new dependency versions.
- Refactored `src/App.tsx` to align with wagmi v2 APIs:
    - Replaced `useNetwork` with `useChainId`.
    - Updated contract interaction hooks (usePrepareContractWrite to direct useWriteContract pattern).
    - Replaced `useSwitchNetwork` with `useSwitchChain`.
    - Replaced `useWaitForTransaction` with `useWaitForTransactionReceipt`.
    - Adjusted how properties like `enabled`, `onError` are passed to hooks.
    - Replaced `erc20ABI` import from `wagmi` with `erc20Abi` from `viem`.
    - Removed 'watch: true' from `useBalance` and `useContractRead` queries, aligning with TanStack Query v5 patterns.
- Updated `src/config/wallet.ts` for new RainbowKit/wagmi configuration:
    - Removed `configureChains` and `publicProvider`.
    - Defined chains directly.
    - Used `http` transport in `createConfig`.
- Updated `src/main.tsx` to remove the 'chains' prop from `RainbowKitProvider`.
- Restored "Add to Metamask" functionality in `src/components/AddToken.tsx`:
    - Implemented `wallet_watchAsset` RPC call via `getConnectorClient().request()` due to issues locating a direct 'watchAsset' import in wagmi@2.9.2.
- Added `@tanstack/react-query` as a direct dependency to resolve a build error.

The project now successfully builds with the updated dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant