withdrawCall
withdrawCall(
options):OutputType
Defined in: packages/synapse-core/src/pay/withdraw.ts:215
Create a call to the withdraw function
This function is used to create a call to the withdraw function for use with sendCalls, sendTransaction, multicall, estimateContractGas, or simulateContract.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | OptionsType | withdrawCall.OptionsType |
Returns
Section titled “Returns”The call to the withdraw function withdrawCall.OutputType
Throws
Section titled “Throws”Errors withdrawCall.ErrorType
Example
Section titled “Example”import { withdrawCall } from '@filoz/synapse-core/pay'import { createWalletClient, http, parseUnits } from 'viem'import { privateKeyToAccount } from 'viem/accounts'import { simulateContract } from 'viem/actions'import { calibration } from '@filoz/synapse-core/chains'
const account = privateKeyToAccount('0x...')const client = createWalletClient({ account, chain: calibration, transport: http(),})
// Use with simulateContractconst { request } = await simulateContract(client, withdrawCall({ chain: calibration, amount: parseUnits('100', 18),}))
console.log(request)