sendCallsSync
Action that requests for the wallet to sign and broadcast a batch of calls (transactions) to the network synchronously.
Waits for the calls to be included in a block before returning.
Import
ts
import { sendCallsSync } from '@wagmi/core'
Usage
ts
import { parseEther } from 'viem'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const status = await sendCallsSync(config, {
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
]
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
Parameters
ts
import { type SendCallsSyncParameters } from '@wagmi/core'
account
Account | Address | null | undefined
Account to execute the calls.
If set to null
, it is assumed that the wallet will handle filling the sender of the calls.
ts
import { parseEther } from 'viem'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const status = await sendCallsSync(config, {
account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
],
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
calls
{ to: Hex, data?: Hex, value?: bigint }[]
Calls to execute.
ts
import { parseEther } from 'viem'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const status = await sendCallsSync(config, {
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
],
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
capabilities
WalletCapabilities | undefined
Capability metadata for the calls (e.g. specifying a paymaster).
ts
import { parseEther } from 'viem'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const status = await sendCallsSync(config, {
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
],
capabilities: {
paymasterService: {
url: 'https://...'
}
}
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
chainId
number | undefined
The target chain ID to broadcast the calls.
ts
import { parseEther } from 'viem'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const status = await sendCallsSync(config, {
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
],
chainId: 10,
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
connector
Connector | undefined
Connector to get send the calls with.
ts
import { parseEther } from 'viem'
import { getConnections } from '@wagmi/core'
import { sendCallsSync } from '@wagmi/core'
import { config } from './config'
const connections = getConnections(config)
const status = await sendCallsSync(config, {
calls: [
{
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: parseEther('1')
},
{
data: '0xdeadbeef',
to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
},
],
connector: connections[0]?.connector,
})
ts
import { createConfig, http } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'
export const config = createConfig({
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
Return Type
ts
import { type SendCallsSyncReturnType } from '@wagmi/core'
{ id: string; capabilities?: WalletCapabilities | undefined }
Identifier of the call batch.
Error
ts
import { type SendCallsSyncErrorType } from '@wagmi/core'
TanStack Query
ts
import {
type SendCallsSyncData,
type SendCallsSyncOptions,
type SendCallsSyncQueryFnData,
type SendCallsSyncQueryKey,
sendCallsSyncQueryKey,
sendCallsSyncQueryOptions,
} from '@wagmi/core/query'