setStaker static method

TransactionInstruction setStaker({
  1. required Pubkey stakePoolAddress,
  2. required Pubkey staker,
  3. required Pubkey newStaker,
})

(Manager or staker only) Update staker.

Keys:

  • [w] stakePoolAddress - StakePool.
  • [s] staker - Manager or current staker.
  • '[]` newStaker - New staker pubkey.

Implementation

static TransactionInstruction setStaker({
  required final Pubkey stakePoolAddress,
  required final Pubkey staker,
  required final Pubkey newStaker,
}) {
  /// 0. `[w]` StakePool
  /// 1. `[s]` Manager or current staker
  /// 2. '[]` New staker pubkey
  final List<AccountMeta> keys = [
    AccountMeta.writable(stakePoolAddress),
    AccountMeta.signer(staker),
    AccountMeta(newStaker),
  ];

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