depositForAccount
Deposit collateral into a subaccount’s available balance — the balance instant trading spends and withdrawals draw from. Calls AccountLayer.depositForAccount, which pulls the collateral from the connected wallet into the SYMMIO core and credits the subaccount. For the instant (lowcap) flow this is the whole funding step: deposited funds are directly tradeable, with no allocate step afterwards. See Balance Model.
Requires a prior ERC-20 approval of the collateral token to the SYMMIO core (symmioAddress) — the core is the
contract that pulls the funds, so approving the AccountLayer address makes the deposit revert. See
getCollateralAllowance and approveCollateral under SYMMIO
Contract.
import { depositForAccount } from "@symmio/trading-core";
const hash = await depositForAccount(config, {
account: "0xsub...",
amount: 1_000000n, // collateral decimals (e.g. 1 USDC at 6 decimals)
});Parameters
accountAddressrequiredThe subaccount (or virtual account) to credit. The signer must equal its on-chain owner.
amountbigintrequiredAmount of collateral to deposit, in the collateral token’s decimals
(getChainConfig().addresses.collateralDecimals) — not 18 decimals.
chainIdnumberoptionalOptional chain override.
simulateBeforeWritebooleanoptionalDry-run via simulateContract first (defaults to the config’s setting, itself true by default).
Returns
HashThe broadcast tx hash. Dry-run without sending via simulateDepositForAccount(config, params).
Related
- Balance Model — which balance a deposit credits, and why you don’t allocate.
getAccountBalanceOf— read the credited available balance back.depositAndAllocateForAccount— the classic-pool variant.