Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Batch Transactions

Queue separate intents and authorize the batch with one passkey ceremony. Use it when each action needs its own intent result.

Using BatchQueue

Each queue entry remains an independent intent; one passkey ceremony authorizes the complete batch. This is not a single atomic multicall or wallet_sendCalls request, so intents can have independent outcomes.

Install the SDK

npm install @rhinestone/1auth

Configure BatchQueueProvider

Wrap the app with BatchQueueProvider:

App.tsx
import { OneAuthClient } from '@rhinestone/1auth'
import { BatchQueueProvider } from '@rhinestone/1auth/react'
 
const client = new OneAuthClient({ 
  providerUrl: 'https://passkey.1auth.app', 
  clientId: 'my-app', 
 
}) 
 
export function App({ accountAddress }: { accountAddress?: string }) {
  return (
    <BatchQueueProvider client={client} accountAddress={accountAddress}> // [!code ++]
      <YourApp />
    </BatchQueueProvider> 
  )
}

Add items to the queue

Use useBatchQueue to add transactions:

Display the queue widget

Render BatchQueueWidget for queued items:

Chain validation

All calls in a batch must target the same chain:

const { addToBatch } = useBatchQueue()
 
// First call sets the batch chain
addToBatch({ to: '0x...', label: 'Action 1' }, 8453) // Base
 
// This will fail - different chain
const result = addToBatch({ to: '0x...', label: 'Action 2' }, 1) // Ethereum
if (!result.success) {
  console.log(result.error) // "Batch is set to Base..."
}

BatchQueueProvider props

PropTypeRequiredDescription
clientOneAuthClientYesSDK client instance
accountAddressAddressNoSmart account address used for signing and localStorage persistence (enables queue to survive page refresh)
childrenReactNodeYesChild components

useBatchQueue reference

PropertyTypeDescription
queueBatchedCall[]Array of queued calls
batchChainIdnumber | nullChain ID of the batch (set by first call)
addToBatch(call: IntentCall, chainId: number) => { success: boolean; error?: string }Add a call to queue
removeFromBatch(id: string) => voidRemove a specific call
clearBatch() => voidClear all calls
signAll(identity?: Address | { accountAddress: Address }) => Promise<SendIntentResult>Sign and submit all calls (a bare address is treated as the account address)
isSigningbooleanWhether signing is in progress
isExpandedbooleanWhether the widget is expanded
setExpanded(expanded: boolean) => voidSet widget expanded state

See the React Components reference for widget options.

Next steps