Skip to content
LogoLogo

Deposit with Wallet

wallet.deposit

Opens the connected Tempo wallet's deposit flow, with optional pre-filled fields.

This action invokes the wallet_deposit JSON-RPC method on the connected wallet, prompting the user to review and submit a deposit. Any fields you omit are left for the user to fill in.

Usage

example.ts
import { ,  } from 'viem/tempo'
import 'viem/window'
 
const  = .({
  : (.!),
})
 
const  = await ..({
  : '1.5',
  : 'pathusd',
})
 
.('Receipts:', ?.)
Receipts: [{ status: 'success', transactionHash: '0x1234...' }]

Recipes

Onboard Funds from a Known Chain

Pre-fill chainId when your onboarding flow already knows where the user's funds sit, such as bridging in from Ethereum.

example.ts
import { ,  } from 'viem/tempo'
import 'viem/window'
 
const  = .({
  : (.!),
})
 
await ..({
  : '250',
  : 1,
})

Deposit to a Labeled Exchange Address

Pass address and displayName when funds should land somewhere other than the connected account, such as a customer's virtual deposit address at an exchange.

example.ts
import { ,  } from 'viem/tempo'
import 'viem/window'
 
const  = .({
  : (.!),
})
 
await ..({
  : '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
  : 'Acme Exchange Deposit',
  : 'pathusd',
})

Return Value

type ReturnType =
  | {
      /** Receipts of any onchain operations performed during the deposit. */
      receipts?: readonly TransactionReceipt[] | undefined
    }
  | undefined

The wallet may return undefined (or an object with no receipts) if the deposit did not require any onchain operations.

Parameters

address

  • Type: Address

Deposit address to pre-fill.

amount

  • Type: string

Human-readable amount to pre-fill (for example, "1.5").

chainId

  • Type: number

Source chain ID to pre-fill.

displayName

  • Type: string

Human-readable account display name.

token

  • Type: Address | string

Token to pre-fill, accepted as either a contract address or a supported deposit token symbol. Omit to let the user choose.