import type { Account, Address, Chain, Client, ContractFunctionReturnType, DeriveChain, GetChainParameter, Hash, Hex, Transport } from 'viem'; import { BaseError } from 'viem'; import { standardBridgeAbi } from '../abis/index.js'; import type { BaseWriteContractActionParameters } from '../core/baseWriteAction.js'; import type { GetContractAddressParameter } from '../types/utils.js'; /** * Action to deposit an ERC20 into an OptimismMintableERC20 | OptimismSuperchainERC20 counterpart. * Unless `unsafe` is set or the `targetChain` hasn't been specified, the remote token address will * be checked to ensure a pair-wise relationship between the tokens. Specify `remoteClient` to use an * already constructed client for the destination chain. * @category Types */ export type DepositERC20Parameters> = GetChainParameter & GetContractAddressParameter & BaseWriteContractActionParameters & { /** The address of the ERC20 to bridge */ tokenAddress: Address; /** The address of the OptimismMintableERC20 | OptimismSuperchainERC20 to bridge into */ remoteTokenAddress: Address; /** The amount of tokens to bridge */ amount: bigint; /** The recipient address to bridge to. Defaults to the calling account */ to?: Address; /** The minimums gas the relaying message will be executed with */ minGasLimit?: number; /** Metadata to attach to the bridged message */ extraData?: Hex; /** Client to use for the destination chain safety check */ remoteClient?: Client; /** Whether to skip the remote token check on the destination chain */ unsafe?: boolean; }; /** * Transaction hash of the depositing transaction. * @category Types */ export type DepositERC20ReturnType = Hash; /** * Return type of the StandardBridge bridgeERC20To function. * @category Types */ export type DepositERC20ContractReturnType = ContractFunctionReturnType; export type DepositERC20RemoteTokenMismatchErrorType = DepositERC20RemoteTokenMismatchError & { name: 'DepositERC20RemoteTokenMismatchError'; }; export declare class DepositERC20RemoteTokenMismatchError extends BaseError { constructor(local: Address, remote: Address); } /** * Deposit an ERC20 into an OptimismMintableERC20 | OptimismSuperchainERC20. * @category Actions * @param client - Client for the depositing chain * @param parameters - {@link DepositERC20Parameters} * @returns The transaction hash. {@link DepositERC20ReturnType} * @example * import { depositERC20 } from '@eth-optimism/viem' * import { op } from '@eth-optimism/viem/chains' * * const hash = await depositERC20(client, { * tokenAddress: '0x0000000000000000000000000000000000000000', * remoteTokenAddress: '0x0000000000000000000000000000000000000000', * amount: 1000000000000000000n, * targetChain: op, * }) */ export declare function depositERC20(client: Client, parameters: DepositERC20Parameters): Promise; /** * Estimate the gas cost of the {@link depositERC20} action. * @category Actions * @param client - Client for the depositing chain * @param parameters - {@link DepositERC20Parameters} * @returns The gas cost */ export declare function estimateDepositERC20Gas(client: Client, parameters: DepositERC20Parameters): Promise; /** * Simulate the {@link depositERC20} action. * @category Actions * @param client - Client for the depositing chain * @param parameters - {@link DepositERC20Parameters} * @returns The contract functions return value. {@link DepositERC20ContractReturnType} */ export declare function simulateDepositERC20(client: Client, parameters: DepositERC20Parameters): Promise;