> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://sdk.railnet.org/api/mcp` to find what you need.

# useDepositConduitCall

Resolves a deposit call and the `queryId` it will create, as a TanStack Query result.

* Reads the conduit's vehicle; sends nothing. See [Call builders](/actions/callBuilders).

## Import

```ts
import { useDepositConduitCall } from '@railnetorg/railnet-sdk/react'
```

## Usage

```tsx
import { useDepositConduitCall } from '@railnetorg/railnet-sdk/react'
import { randomSalt } from '@railnetorg/railnet-sdk'
import { erc20Abi } from 'viem'
import { useAccount, useReadContract, useSimulateContract, useWriteContract } from 'wagmi'
import { useState } from 'react'

export function DepositButton({
  conduit,
  token,
  amount,
}: { conduit: Address; token: Address; amount: bigint }) {
  const { address } = useAccount()
  // one salt for the whole operation: a new one is a different query
  const [salt] = useState(() => randomSalt())

  const { data: allowance } = useReadContract({
    address: token,
    abi: erc20Abi,
    functionName: 'allowance',
    args: address ? [address, conduit] : undefined,
    query: { enabled: Boolean(address) },
  })

  const { data: deposit } = useDepositConduitCall({
    conduit,
    token,
    amount,
    sender: address,
    salt,
  })

  const { data: simulation } = useSimulateContract({
    ...deposit?.call,
    query: { enabled: Boolean(deposit) && (allowance ?? 0n) >= amount },
  })
  const { writeContract } = useWriteContract()

  return (
    <button
      onClick={() => simulation && writeContract(simulation.request)}
      disabled={!simulation}
    >
      Deposit
    </button>
  )
}
```

Once sent, `deposit.queryId` is the key an indexer holds.

## Returns

A TanStack Query result over `{ call, query, queryId, vehicle }`, with its `queryKey` attached.
`call` goes to wagmi's `useSimulateContract` and `useWriteContract`. See
[Sending from React](/guides/sendingFromReact).

## Parameters

Everything [`getDepositConduitCall`](/actions/getDepositConduitCall) takes, with `sender` allowed to
be `undefined` (the query is skipped until a wallet is connected), plus:

`sender` is the account that sends the transaction, a Safe or a batch included. See [The sender](/guides/depositingAndRedeeming#the-sender).

### chainId (optional)

* **Type:** `number`
* **Default:** the connected chain

### enabled (optional)

* **Type:** `boolean`
* **Default:** `true`

## Query options

[`depositConduitCallQueryOptions`](/react/queryOptions) is this read as TanStack Query options, with
`depositConduitCallQueryKey` and `depositConduitCallQueryPrefix` for invalidation.

```ts
import { depositConduitCallQueryOptions } from '@railnetorg/railnet-sdk/react'

await queryClient.prefetchQuery(depositConduitCallQueryOptions(client, parameters))
```
