depositWithPermit
depositWithPermit(
client,options):Promise<`0x${string}`>
Defined in: packages/synapse-core/src/pay/deposit-with-permit.ts:78
Deposit funds into the Filecoin Pay contract using an ERC-2612 permit
Signs an EIP-712 permit for the token and calls the depositWithPermit contract function
to approve and deposit in a single transaction (no prior ERC20 approval needed).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain, Account> | The viem client with account to use for the transaction. |
options | OptionsType | depositWithPermit.OptionsType |
Returns
Section titled “Returns”Promise<`0x${string}`>
The transaction hash
Throws
Section titled “Throws”Errors depositWithPermit.ErrorType
Example
Section titled “Example”import { depositWithPermit } from '@filoz/synapse-core/pay'import { createWalletClient, http, parseUnits } from 'viem'import { privateKeyToAccount } from 'viem/accounts'import { calibration } from '@filoz/synapse-core/chains'
const account = privateKeyToAccount('0x...')const client = createWalletClient({ account, chain: calibration, transport: http(),})
const hash = await depositWithPermit(client, { amount: parseUnits('100', 18),})
console.log(hash)