Deposit
Deposit ERC20 into the vault
const vault = '0x1234';
const pool = 1234;
const amount = 1000000n; // Using bigint for amount
const allowance = await sdk.portfolio.getAllowance(vault);
if (allowance === 0n) {
const approveTx = await sdk.actions.approve(vault, amount);
// Note: Drift returns transaction hash, wait method depends on your adapter
}
const depositTx = await sdk.actions.deposit(vault, pool, amount);
// With optional WriteOptions
const depositTxWithOptions = await sdk.actions.deposit(vault, pool, amount, {
gas: 300000n,
});
Deposit "on behalf" of another user (specifying shares receiver)
Depositing with any asset
Deposit ETH into the vault
Last updated