1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- // This file is autogenerated with https://github.com/acheroncrypto/native-to-anchor
- use anchor_lang::prelude::*;
- declare_id!("11111111111111111111111111111111");
- #[program]
- pub mod spl_record {
- use super::*;
- pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
- Ok(())
- }
- pub fn write(ctx: Context<Write>, offset: u64, data: Vec<u8>) -> Result<()> {
- Ok(())
- }
- pub fn set_authority(ctx: Context<SetAuthority>) -> Result<()> {
- Ok(())
- }
- pub fn close_account(ctx: Context<CloseAccount>) -> Result<()> {
- Ok(())
- }
- }
- #[derive(Accounts)]
- pub struct Initialize<'info> {
- #[account(mut)]
- record_account: AccountInfo<'info>,
- authority: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct Write<'info> {
- #[account(mut)]
- record_account: AccountInfo<'info>,
- signer: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct SetAuthority<'info> {
- #[account(mut)]
- record_account: AccountInfo<'info>,
- signer: Signer<'info>,
- new_authority: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct CloseAccount<'info> {
- #[account(mut)]
- record_account: AccountInfo<'info>,
- signer: Signer<'info>,
- #[account(mut)]
- receiver: AccountInfo<'info>,
- }
- #[account]
- pub struct RecordData {
- /// Struct version, allows for upgrades to the program
- pub version: u8,
- /// The account allowed to update the data
- pub authority: Pubkey,
- /// The data contained by the account, could be anything serializable
- pub data: Data,
- }
- #[derive(AnchorSerialize, AnchorDeserialize)]
- pub struct Data {
- /// The data contained by the account, could be anything or serializable
- pub bytes: [u8; 8],
- }
- #[error_code]
- pub enum RecordError {
- /// Incorrect authority provided on update or delete
- #[msg("Incorrect authority provided on update or delete")]
- IncorrectAuthority,
- /// Calculation overflow
- #[msg("Calculation overflow")]
- Overflow,
- }
|