setFundingAuthority static method

TransactionInstruction setFundingAuthority({
  1. required Pubkey stakePoolAddress,
  2. required Pubkey manager,
  3. required Pubkey? newAuthority,
  4. required FundingType fundingType,
})

(Manager only) Update SOL deposit, stake deposit, or SOL withdrawal authority.

Keys:

  • [w] stakePoolAddress - StakePool.
  • [s] manager - Manager.
  • '[]` newAuthority - New authority pubkey or none.

Data:

  • fundingType - The authority to update.

Implementation

static TransactionInstruction setFundingAuthority({
  // Keys
  required final Pubkey stakePoolAddress,
  required final Pubkey manager,
  required final Pubkey? newAuthority,
  // Data
  required final FundingType fundingType,
}) {
  /// 0. `[w]` StakePool
  /// 1. `[s]` Manager
  /// 2. '[]` New authority pubkey or none
  final List<AccountMeta> keys = [
    AccountMeta.writable(stakePoolAddress),
    AccountMeta.signer(manager),
    if (newAuthority != null)
      AccountMeta(newAuthority),
  ];

  final List<Iterable<int>> data = [
    borsh.enumeration(FundingType.values).encode(fundingType),
  ];

  return _instance.createTransactionIntruction(
    StakePoolInstruction.setFundingAuthority,
    keys: keys,
    data: data,
  );
}