1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use {
    anchor_lang::{
        solana_program::{
            instruction::{AccountMeta, Instruction},
            pubkey::Pubkey,
            system_program,
        },
        InstructionData,
    },
    clockwork_queue_program::objects::Trigger,
    clockwork_utils::InstructionData as ClockworkInstructionData,
};

pub fn queue_create(
    authority: Pubkey,
    id: String,
    kickoff_instruction: ClockworkInstructionData,
    payer: Pubkey,
    queue: Pubkey,
    trigger: Trigger,
) -> Instruction {
    Instruction {
        program_id: clockwork_queue_program::ID,
        accounts: vec![
            AccountMeta::new_readonly(authority, true),
            AccountMeta::new(payer, true),
            AccountMeta::new(queue, false),
            AccountMeta::new_readonly(system_program::ID, false),
        ],
        data: clockwork_queue_program::instruction::QueueCreate {
            id,
            kickoff_instruction,
            trigger,
        }
        .data(),
    }
}