depositSync
depositSync(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/pay/deposit.ts:159
Deposit funds into the Filecoin Pay contract and wait for confirmation
Deposits ERC20 tokens and waits for the transaction to be confirmed. Returns the receipt with the DepositRecorded event.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain, Account> | The viem client with account to use for the transaction. |
options | OptionsType | depositSync.OptionsType |
Returns
Section titled “Returns”The transaction receipt and extracted event depositSync.OutputType
Throws
Section titled “Throws”Errors depositSync.ErrorType
Example
Section titled “Example”import { depositSync } 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 { receipt, event } = await depositSync(client, { amount: parseUnits('100', 18), onHash: (hash) => console.log('Transaction sent:', hash),})
console.log('Deposited amount:', event.args.amount)console.log('To:', event.args.to)