Skip to Content

Transfers

Transfers let you move balances/positions between subaccounts owned by the same authority.

Transfer a spot deposit between subaccounts

const marketIndex = 0; // e.g. USDC const amount = driftClient.convertToSpotPrecision(marketIndex, 100); await driftClient.transferDeposit(amount, marketIndex, 0, 1);
Method DriftClient.transferDepositReference ↗
Parameters:
NameTypeDefault
amountany
marketIndexnumber
fromSubAccountIdnumber
toSubAccountIdnumber
txParamsTxParams
Returns:
Promise<string>

Transfer a perp position between subaccounts

// Example: transfer 1 base unit of perp position from subaccount 0 -> 1 await driftClient.transferPerpPosition({ fromSubAccountId: 0, toSubAccountId: 1, marketIndex: 0, amount: driftClient.convertToPerpPrecision(1), });
Method DriftClient.transferPerpPositionReference ↗
Parameters:
NameTypeDefault
fromSubAccountIdnumber
toSubAccountIdnumber
marketIndexnumber
amountany
txParamsTxParams
Returns:
Promise<string>
Last updated on