no truncation logs

This commit is contained in:
Hardhat Chad
2025-07-10 08:42:32 -07:00
parent 6955c33aba
commit 8c5fcb02ce
12 changed files with 168 additions and 95 deletions

View File

@@ -2,7 +2,7 @@ use spl_associated_token_account::get_associated_token_address;
use steel::*;
use crate::{
consts::{MINT_ADDRESS, TREASURY_ADDRESS},
consts::{BLOCK, MINT_ADDRESS, TREASURY_ADDRESS},
instruction::*,
state::*,
};
@@ -87,6 +87,25 @@ pub fn close(
}
}
pub fn log(signer: Pubkey, msg: &[u8]) -> Instruction {
let mut data = Log {}.to_bytes();
data.extend_from_slice(msg);
Instruction {
program_id: crate::ID,
accounts: vec![AccountMeta::new(signer, true)],
data: data,
}
}
pub fn program_log(block_id: u64, block_info: AccountInfo, msg: &[u8]) -> Result<(), ProgramError> {
invoke_signed(
&log(*block_info.key, msg),
&[block_info.clone()],
&crate::ID,
&[BLOCK, &block_id.to_le_bytes()],
)
}
pub fn mine(signer: Pubkey, id: u64, amount: u64) -> Instruction {
let block_adddress = block_pda(id).0;
let market_address = market_pda(id).0;