Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,327 changes: 159 additions & 2,168 deletions .ai/categories/basics.md

Large diffs are not rendered by default.

3,786 changes: 247 additions & 3,539 deletions .ai/categories/dapps.md

Large diffs are not rendered by default.

2,633 changes: 128 additions & 2,505 deletions .ai/categories/infrastructure.md

Large diffs are not rendered by default.

2,625 changes: 124 additions & 2,501 deletions .ai/categories/networks.md

Large diffs are not rendered by default.

2,235 changes: 107 additions & 2,128 deletions .ai/categories/parachains.md

Large diffs are not rendered by default.

3,235 changes: 140 additions & 3,095 deletions .ai/categories/polkadot-protocol.md

Large diffs are not rendered by default.

493 changes: 0 additions & 493 deletions .ai/categories/reference.md

Large diffs are not rendered by default.

2,906 changes: 83 additions & 2,823 deletions .ai/categories/smart-contracts.md

Large diffs are not rendered by default.

6,252 changes: 1,152 additions & 5,100 deletions .ai/categories/tooling.md

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions .ai/pages/smart-contracts-libraries-wagmi.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ cd wagmi-polkadot-hub

## Install Dependencies

Install Wagmi and its peer dependencies:
Install Wagmi v3 and its peer dependencies:

```bash
npm install wagmi viem @tanstack/react-query
npm install wagmi@3 viem @tanstack/react-query
```

## Configure Wagmi for Polkadot Hub
Expand Down Expand Up @@ -140,12 +140,12 @@ Create a component to connect wallets to your dApp. Create a file named `app/com
"use client";

import React from "react";
import { useConnect, useAccount, useDisconnect } from "wagmi";
import { useConnect, useConnection, useDisconnect } from "wagmi";
import { injected } from "wagmi/connectors";

export function ConnectWallet() {
const { connect } = useConnect();
const { address, isConnected } = useAccount();
const { address, isConnected } = useConnection();
const { disconnect } = useDisconnect();

if (isConnected) {
Expand All @@ -170,7 +170,7 @@ This component uses the following React hooks:

- **[`useConnect`](https://wagmi.sh/react/api/hooks/useConnect#useconnect){target=\_blank}**: Provides functions and state for connecting the user's wallet to your dApp. The `connect` function initiates the connection flow with the specified connector.
- **[`useDisconnect`](https://wagmi.sh/react/api/hooks/useDisconnect#usedisconnect){target=\_blank}**: Provides a function to disconnect the currently connected wallet.
- **[`useAccount`](https://2.x.wagmi.sh/react/api/hooks/useAccount#useaccount){target=\_blank}**: Returns data about the connected account, including the address and connection status.
- **[`useConnection`](https://wagmi.sh/react/api/hooks/useConnection#useconnection){target=\_blank}**: Returns data about the connected account, including the address and connection status. In Wagmi v3, `useAccount` has been renamed to `useConnection`.

## Fetch Blockchain Data

Expand All @@ -179,10 +179,10 @@ Wagmi provides various hooks to fetch blockchain data. Here's an example compone
```typescript title="app/components/BlockchainInfo.tsx"
"use client";

import { useBlockNumber, useBalance, useAccount } from "wagmi";
import { useBlockNumber, useBalance, useConnection } from "wagmi";

export function BlockchainInfo() {
const { address } = useAccount();
const { address } = useConnection();
// Get the latest block number
const { data: blockNumber } = useBlockNumber({ watch: true });

Expand Down Expand Up @@ -373,10 +373,10 @@ Update your main page to combine all the components. Create or update the file `
import { BlockchainInfo } from "./components/BlockchainInfo";
import { ConnectWallet } from "./components/ConnectWallet";
import { StorageContract } from "./components/StorageContract";
import { useAccount } from "wagmi";
import { useConnection } from "wagmi";

export default function Home() {
const { isConnected } = useAccount();
const { isConnected } = useConnection();

return (
<main>
Expand Down
Loading
Loading