DocsMethod reference

Borrow methods

Prepare collateral and debt changes through the supported SDK methods.

Both methods use Ethereum long positions only, in the ETH or BTC market.

depositAndMint

Add collateral, mint fxUSD, or combine both in one planned action.

Input
market, positionId (0 for new), userAddress, depositTokenAddress, depositAmount, mintAmount. Amounts are nonnegative; they cannot both be zero.
Output
Ordered txs plus position ID, leverage, execution price, collateral, and debt details.
Review and refresh
The deposit is in the chosen collateral token's units; the mint amount is in fxUSD units. Sign any exact approval, wait for its receipt, then sign the action. Reload positions after its canonical receipt.

repayAndWithdraw

Repay fxUSD, withdraw long collateral, or do both.

Input
market, existing positionId, userAddress, repayAmount, withdrawAmount, withdrawTokenAddress. Amounts are nonnegative; they cannot both be zero.
Output
Ordered txs plus position ID, leverage, execution price, collateral, and debt details.
Review and refresh
Repayment uses fxUSD units; withdrawal uses the chosen collateral token's units. Any repayment approval is bound to the action's fee-adjusted amount. A failure stops subsequent steps. Reload positions after the canonical action receipt.

FxAeon permits ETH, stETH, WETH, or wstETH collateral for the ETH market and WBTC for BTC. Neither method accepts a position side or route-target parameter. See the Borrow planners (opens in a new tab).