#![deny(missing_docs)]
mod entrypoint;
pub mod processor;
pub use {
solana_account_info, solana_instruction, solana_msg, solana_program_entrypoint,
solana_program_error, solana_pubkey,
};
use {
solana_instruction::{AccountMeta, Instruction},
solana_pubkey::Pubkey,
};
pub mod v1 {
solana_pubkey::declare_id!("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo");
}
solana_pubkey::declare_id!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
pub fn build_memo(memo: &[u8], signer_pubkeys: &[&Pubkey]) -> Instruction {
Instruction {
program_id: id(),
accounts: signer_pubkeys
.iter()
.map(|&pubkey| AccountMeta::new_readonly(*pubkey, true))
.collect(),
data: memo.to_vec(),
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_build_memo() {
let signer_pubkey = Pubkey::new_unique();
let memo = "🐆".as_bytes();
let instruction = build_memo(memo, &[&signer_pubkey]);
assert_eq!(memo, instruction.data);
assert_eq!(instruction.accounts.len(), 1);
assert_eq!(instruction.accounts[0].pubkey, signer_pubkey);
}
}