SPLTokenProgram.closeAccount constructor

SPLTokenProgram.closeAccount({
  1. required SolAddress account,
  2. required SolAddress destination,
  3. required SolAddress authority,
  4. SolAddress programId = SPLTokenProgramConst.tokenProgramId,
  5. List<SolAddress> multiSigners = const [],
})

Close an account by transferring all its SOL to the destination account. Non-native accounts may only be closed if its token amount is zero.

Implementation

factory SPLTokenProgram.closeAccount(
    {
    /// The account to close.
    required SolAddress account,

    /// The destination account.
    required SolAddress destination,

    /// The account's owner.
    required SolAddress authority,
    SolAddress programId = SPLTokenProgramConst.tokenProgramId,

    /// Multisignature owner
    List<SolAddress> multiSigners = const []}) {
  return SPLTokenProgram(
      layout: SPLTokenCloseAccountLayout(),
      keys: SPLTokenUtils.buildKeys(keys: [
        account.toWritable(),
        destination.toWritable(),
      ], owner: authority, multiSigners: multiSigners),
      programId: programId);
}