37 lines
1.0 KiB
Rust
Raw Normal View History

2025-07-17 12:46:57 -03:00
use core::types::ProgramId;
2025-07-17 11:34:56 -03:00
use program_methods::{
PINATA_ELF, PINATA_ID, TRANSFER_ELF, TRANSFER_ID, {TRANSFER_MULTIPLE_ELF, TRANSFER_MULTIPLE_ID},
};
2025-07-17 12:46:57 -03:00
use serde::{Deserialize, Serialize};
2025-07-16 17:33:58 -03:00
2025-07-16 17:40:22 -03:00
pub trait Program {
2025-07-17 12:46:57 -03:00
const PROGRAM_ID: ProgramId;
2025-07-16 17:40:22 -03:00
const PROGRAM_ELF: &[u8];
type InstructionData: Serialize + for<'de> Deserialize<'de>;
}
2025-07-16 17:33:58 -03:00
2025-07-16 17:40:22 -03:00
pub struct TransferProgram;
impl Program for TransferProgram {
2025-07-17 12:46:57 -03:00
const PROGRAM_ID: ProgramId = TRANSFER_ID;
2025-07-16 17:33:58 -03:00
const PROGRAM_ELF: &[u8] = TRANSFER_ELF;
2025-07-17 11:29:35 -03:00
/// Amount to transfer
2025-07-16 17:33:58 -03:00
type InstructionData = u128;
}
2025-07-17 11:07:18 -03:00
pub struct TransferMultipleProgram;
impl Program for TransferMultipleProgram {
2025-07-17 12:46:57 -03:00
const PROGRAM_ID: ProgramId = TRANSFER_MULTIPLE_ID;
2025-07-17 11:07:18 -03:00
const PROGRAM_ELF: &[u8] = TRANSFER_MULTIPLE_ELF;
2025-07-17 11:29:35 -03:00
/// Amounts to transfer
2025-07-17 11:07:18 -03:00
type InstructionData = Vec<u128>;
}
2025-07-17 11:29:35 -03:00
pub struct PinataProgram;
impl Program for PinataProgram {
2025-07-17 16:05:24 -03:00
const PROGRAM_ID: ProgramId = PINATA_ID;
const PROGRAM_ELF: &[u8] = PINATA_ELF;
2025-07-17 11:29:35 -03:00
/// Preimage of target hash to win price
2025-07-17 16:05:24 -03:00
type InstructionData = Vec<u32>;
2025-07-17 11:29:35 -03:00
}