SPLTokenSwapProgram.create constructor
SPLTokenSwapProgram.create({
- required SolAddress tokenSwapAccount,
- required SolAddress authority,
- required SolAddress tokenAccountA,
- required SolAddress tokenAccountB,
- required SolAddress tokenPool,
- required SolAddress feeAccount,
- required SolAddress tokenAccountPool,
- required SolAddress poolTokenProgramId,
- required SolAddress swapProgramId,
- required SPLTokenSwapInitSwapLayout layout,
Initializes a new swap
Implementation
factory SPLTokenSwapProgram.create(
{
/// New Token-swap to create.
required SolAddress tokenSwapAccount,
/// swap authority derived from
required SolAddress authority,
/// token_a Account. Must be non zero, owned by swap authority.
required SolAddress tokenAccountA,
/// token_b Account. Must be non zero, owned by swap authority.
required SolAddress tokenAccountB,
/// Pool Token Account to deposit trading and withdraw fees.
required SolAddress tokenPool,
required SolAddress feeAccount,
/// Pool Token Account to deposit the initial pool token
required SolAddress tokenAccountPool,
/// Pool Token program id
required SolAddress poolTokenProgramId,
required SolAddress swapProgramId,
required SPLTokenSwapInitSwapLayout layout}) {
return SPLTokenSwapProgram(
layout: layout,
keys: [
tokenSwapAccount.toWritable(),
authority.toReadOnly(),
tokenAccountA.toReadOnly(),
tokenAccountB.toReadOnly(),
tokenPool.toWritable(),
feeAccount.toReadOnly(),
tokenAccountPool.toWritable(),
poolTokenProgramId.toReadOnly(),
],
programId: swapProgramId);
}