> For the complete documentation index, see [llms.txt](/llms.txt).

# useSignatureRequest

Hook to send a JSON-RPC signing request through Wallet Services. Unlike signing directly with `connection.ethereumProvider`, Wallet Services shows the user a confirmation screen in the in-app browser before it signs.

### Import

```tsx
import { useSignatureRequest } from '@web3auth/react-native-sdk'

```

### Usage

```tsx
import { useSignatureRequest, useWeb3Auth } from '@web3auth/react-native-sdk'
import { Button, Text, View } from 'react-native'
import { createWalletClient, custom, parseEther, stringToHex, toHex } from 'viem'

function SigningView() {
  const { request, loading, error } = useSignatureRequest()
  const { connection } = useWeb3Auth()

  const getAddress = async () => {
    const walletClient = createWalletClient({
      transport: custom(connection!.ethereumProvider!),
    })
    const [address] = await walletClient.getAddresses()
    return address
  }

  const signPersonalMessage = async () => {
    const address = await getAddress()
    const signature = await request('personal_sign', [
      stringToHex('Hello from Embedded Wallets'),
      address,
    ])
    console.log('Signature:', signature)
  }

  const sendTransaction = async () => {
    const address = await getAddress()
    const txHash = await request('eth_sendTransaction', [
      {
        from: address,
        to: '0x0000000000000000000000000000000000000001',
        value: toHex(parseEther('0.001')),
      },
    ])
    console.log('Transaction hash:', txHash)
  }

  return (
    <View>
      <Button title="Sign message" disabled={loading} onPress={signPersonalMessage} />
      <Button title="Send ETH" disabled={loading} onPress={sendTransaction} />
      {error && <Text>{error.message}</Text>}
    </View>
  )
}

```

### Return type

```tsx
import { type IUseSignatureRequest } from '@web3auth/react-native-sdk'

```

#### `request`

`(method: string, params: unknown[], path?: string) => Promise<string>`

Opens Wallet Services with a confirmation screen for the JSON-RPC request and resolves with the result after the user approves. If the user rejects or the request fails, `request` resolves with `undefined` and sets `error`. The optional `path` is `wallet/request` by default.

Common `method` values:

| Method                 | Description                              |
| ---------------------- | ---------------------------------------- |
| `personal_sign`        | Sign a personal message (EIP-191).       |
| `eth_signTypedData_v4` | Sign typed structured data (EIP-712).    |
| `eth_sendTransaction`  | Sign and send a transaction.             |
| `eth_signTransaction`  | Sign a transaction without broadcasting. |

#### `loading`

`boolean`

`true` while the request is waiting for the user or the network.

#### `error`

`Web3authRNError | null`

Error from the most recent `request` call, or `null`.
