AssociatedTokenAccountProgram.recoverNested constructor

AssociatedTokenAccountProgram.recoverNested({
  1. required SolAddress nestedAssociatedToken,
  2. required SolAddress nestedMint,
  3. required SolAddress destinationAssociatedToken,
  4. required SolAddress ownerAssociatedToken,
  5. required SolAddress ownerMint,
  6. required SolAddress owner,
  7. SolAddress tokenProgramId = SPLTokenProgramConst.tokenProgramId,
  8. SolAddress associatedTokenProgramId = AssociatedTokenAccountProgramConst.associatedTokenProgramId,
})

Factory method for recovering a nested associated token account

Implementation

factory AssociatedTokenAccountProgram.recoverNested({
  /// Nested associated token account
  required SolAddress nestedAssociatedToken,

  /// Token mint for the nested associated token account
  required SolAddress nestedMint,

  /// Wallet's associated token account
  required SolAddress destinationAssociatedToken,

  /// Owner associated token account address
  required SolAddress ownerAssociatedToken,

  /// Token mint for the owner associated token account
  required SolAddress ownerMint,

  /// Wallet address for the owner associated token account
  required SolAddress owner,

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

  /// SPL Associated Token program account
  SolAddress associatedTokenProgramId =
      AssociatedTokenAccountProgramConst.associatedTokenProgramId,
}) {
  return AssociatedTokenAccountProgram(
      keys: [
        nestedAssociatedToken.toWritable(),
        nestedMint.toReadOnly(),
        destinationAssociatedToken.toWritable(),
        ownerAssociatedToken.toWritable(),
        ownerMint.toReadOnly(),
        owner.toSignerAndWritable(),
        tokenProgramId.toReadOnly(),
      ],
      programId: associatedTokenProgramId,
      layout: AssociatedTokenAccountProgramRecoverNestedLayout());
}