SPLTokenSwapProgram.deposit constructor
SPLTokenSwapProgram.deposit({
- required SolAddress tokenSwap,
- required SolAddress authority,
- required SolAddress userTransferAuthority,
- required SolAddress sourceA,
- required SolAddress sourceB,
- required SolAddress intoA,
- required SolAddress intoB,
- required SolAddress poolToken,
- required SolAddress poolAccount,
- required SolAddress mintA,
- required SolAddress mintB,
- required SolAddress swapProgramId,
- required SolAddress tokenProgramIdA,
- required SolAddress tokenProgramIdB,
- required SolAddress poolTokenProgramId,
- required SPLTokenSwapDepositLayout layout,
Deposit both types of tokens into the pool. The output is a "pool" token representing ownership in the pool. Inputs are converted to the current ratio.
Implementation
factory SPLTokenSwapProgram.deposit(
{
/// Token-swap
required SolAddress tokenSwap,
/// swap authority
required SolAddress authority,
/// user transfer authority
required SolAddress userTransferAuthority,
// token_a user transfer authority can transfer amount
required SolAddress sourceA,
/// token_b user transfer authority can transfer amount
required SolAddress sourceB,
/// token_a Base Account to deposit into.
required SolAddress intoA,
/// token_b Base Account to deposit into.
required SolAddress intoB,
/// Pool MINT account, swap authority is the owner.
required SolAddress poolToken,
/// Pool Account to deposit the generated tokens
required SolAddress poolAccount,
/// Token A mint
required SolAddress mintA,
/// Token B mint
required SolAddress mintB,
required SolAddress swapProgramId,
/// Token A program id
required SolAddress tokenProgramIdA,
/// Token B program id
required SolAddress tokenProgramIdB,
/// Pool Token program id
required SolAddress poolTokenProgramId,
required SPLTokenSwapDepositLayout layout}) {
return SPLTokenSwapProgram(
layout: layout,
keys: [
tokenSwap.toReadOnly(),
authority.toReadOnly(),
userTransferAuthority.toSigner(),
sourceA.toWritable(),
sourceB.toWritable(),
intoA.toWritable(),
intoB.toWritable(),
poolToken.toWritable(),
poolAccount.toWritable(),
mintA.toReadOnly(),
mintB.toReadOnly(),
tokenProgramIdA.toReadOnly(),
tokenProgramIdB.toReadOnly(),
poolTokenProgramId.toReadOnly(),
],
programId: swapProgramId);
}