deregister fixes

This commit is contained in:
Hardhat Chad
2024-05-13 15:06:14 +00:00
parent 56e20bf78e
commit a71024cfa1
3 changed files with 26 additions and 36 deletions

View File

@@ -258,6 +258,20 @@ pub fn register(signer: Pubkey) -> Instruction {
}
}
/// Builds a deregister instruction.
pub fn deregister(signer: Pubkey) -> Instruction {
let proof_pda = Pubkey::find_program_address(&[PROOF, signer.as_ref()], &crate::id());
Instruction {
program_id: crate::id(),
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new(proof_pda.0, false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
],
data: OreInstruction::Deregister.to_vec(),
}
}
/// Builds a mine instruction.
pub fn mine(signer: Pubkey, bus: Pubkey, nonce: u64) -> Instruction {
let proof = Pubkey::find_program_address(&[PROOF, signer.as_ref()], &crate::id()).0;