SPLTokenSwapProgram.depoitSingleToken constructor

SPLTokenSwapProgram.depoitSingleToken({
  1. required SolAddress tokenSwap,
  2. required SolAddress authority,
  3. required SolAddress userTransferAuthority,
  4. required SolAddress source,
  5. required SolAddress intoA,
  6. required SolAddress intoB,
  7. required SolAddress poolToken,
  8. required SolAddress poolAccount,
  9. required SolAddress sourceMint,
  10. required SolAddress sourceTokenProgramId,
  11. required SolAddress poolTokenProgramId,
  12. required SPLTokenSwapDepositSingleTokenLayout layout,
  13. required SolAddress swapProgramId,
})

Deposit one type of tokens into the pool. The output is a "pool" token representing ownership into the pool. Input token is converted as if a swap and deposit all token types were performed.

Implementation

factory SPLTokenSwapProgram.depoitSingleToken({
  /// Token-swap
  required SolAddress tokenSwap,

  /// swap authority
  required SolAddress authority,

  ///  user transfer authority
  required SolAddress userTransferAuthority,

  /// SOURCE Account, amount is transferable by
  /// user transfer authority,
  required SolAddress source,

  /// token_a Swap Account, may deposit INTO.
  required SolAddress intoA,

  /// token_b Swap Account, may deposit INTO.
  required SolAddress intoB,

  /// Pool MINT account, swap authority is the owner.
  required SolAddress poolToken,

  /// Pool Account to deposit the generated tokens, user is
  /// the owner.
  required SolAddress poolAccount,

  /// Token (A|B) SOURCE mint
  required SolAddress sourceMint,

  /// Token (A|B) SOURCE program id
  required SolAddress sourceTokenProgramId,

  /// Pool Token program id
  required SolAddress poolTokenProgramId,
  required SPLTokenSwapDepositSingleTokenLayout layout,
  required SolAddress swapProgramId,
}) {
  return SPLTokenSwapProgram(
      layout: layout,
      keys: [
        tokenSwap.toReadOnly(),
        authority.toReadOnly(),
        userTransferAuthority.toSigner(),
        source.toWritable(),
        intoA.toWritable(),
        intoB.toWritable(),
        poolToken.toWritable(),
        poolAccount.toWritable(),
        sourceMint.toReadOnly(),
        sourceTokenProgramId.toReadOnly(),
        poolTokenProgramId.toReadOnly(),
      ],
      programId: swapProgramId);
}