AssociatedTokenAccountProgram.associatedTokenAccountIdempotent constructor

AssociatedTokenAccountProgram.associatedTokenAccountIdempotent({
  1. required SolAddress payer,
  2. required SolAddress associatedToken,
  3. required SolAddress owner,
  4. required SolAddress mint,
  5. SolAddress tokenProgramId = SPLTokenProgramConst.tokenProgramId,
  6. SolAddress associatedTokenProgramId = AssociatedTokenAccountProgramConst.associatedTokenProgramId,
})

Factory method for creating an associated token account idempotent

Implementation

factory AssociatedTokenAccountProgram.associatedTokenAccountIdempotent({
  /// Payer of the initialization fees
  required SolAddress payer,

  /// New associated token account
  required SolAddress associatedToken,

  /// Owner of the new account
  required SolAddress owner,

  /// Token mint account
  required SolAddress mint,

  /// SPL Token program account
  SolAddress tokenProgramId = SPLTokenProgramConst.tokenProgramId,

  /// SPL Associated Token program account
  SolAddress associatedTokenProgramId =
      AssociatedTokenAccountProgramConst.associatedTokenProgramId,
}) {
  return _associatedTokenAccount(
      payer: payer,
      associatedToken: associatedToken,
      owner: owner,
      mint: mint,
      tokenProgramId: tokenProgramId,
      programId: associatedTokenProgramId,
      layout: AssociatedTokenAccountProgramIdempotentLayout());
}