# Advanced Usage with wagmi

The Raydius SDK integrates seamlessly with wagmi, a collection of React hooks for Ethereum. Wagmi provides hooks for connecting to wallets, managing accounts, and interacting with contracts. Using wagmi simplifies the process of signing messages and transactions in your Raydius integration.

To ensure compatibility, we are using wagmi version 1.4.12. For detailed documentation, please refer to the [wagmi documentation](https://wagmi.sh/docs).

**Example: Signing a Message**

Here is an example of how to sign a message using wagmi with Raydius:

```typescript
import React from 'react'
import { useRaydius } from '@raydius/react'
import { useSignMessage } from 'wagmi'

export default function SignMessageComponent() {
  const { userAccount } = useRaydius()
  const { signMessage } = useSignMessage({
    message: 'Hello, world!',
  })

  const handleSignMessage = async () => {
    const { data, error } = await signMessage()
    if (error) {
      console.error('Error signing message:', error)
    } else {
      console.log('Signature:', data)
    }
  }

  return (
    <div>
      <button onClick={handleSignMessage}>Sign Message</button>
    </div>
  )
}
```

**Example: Sending a Transaction**

Here is an example of how to send a transaction using wagmi with Raydius:

```typescript
import React from 'react'
import { useRaydius } from '@raydius/react'
import { useSendTransaction } from 'wagmi'
import { parseEther } from 'ethers/lib/utils'

export default function SendTransactionComponent() {
  const { userAccount } = useRaydius()
  const { sendTransaction } = useSendTransaction()

  const handleSendTransaction = async () => {
    const { data, error } = await sendTransaction({
      request: {
        to: '0xRecipientAddress',
        value: parseEther('0.1'),
      },
    })
    if (error) {
      console.error('Error sending transaction:', error)
    } else {
      console.log('Transaction:', data)
    }
  }

  return (
    <div>
      <button onClick={handleSendTransaction}>Send Transaction</button>
    </div>
  )
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raydius-research.com/core-concepts/raydius-sdk/social-login-sdk/raydius-react-sdk/advanced-usage-with-wagmi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
