123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- use anchor_lang::prelude::*;
- declare_id!("9NxAd91hhJ3ZBTHytYP894y4ESRKG7n8VbLgdyYGJFLB");
- #[program]
- pub mod native_system {
- use super::*;
- pub fn create_account(
- ctx: Context<CreateAccount>,
- lamports: u64,
- space: u64,
- owner: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn assign(ctx: Context<Assign>, owner: Pubkey) -> Result<()> {
- Ok(())
- }
- pub fn transfer(ctx: Context<Transfer>, lamports: u64) -> Result<()> {
- Ok(())
- }
- pub fn create_account_with_seed(
- ctx: Context<CreateAccountWithSeed>,
- base: Pubkey,
- seed: String,
- lamports: u64,
- space: u64,
- owner: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn advance_nonce_account(
- ctx: Context<AdvanceNonceAccount>,
- authorized: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn withdraw_nonce_account(ctx: Context<WithdrawNonceAccount>, lamports: u64) -> Result<()> {
- Ok(())
- }
- pub fn initialize_nonce_account(
- ctx: Context<InitializeNonceAccount>,
- authorized: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn authorize_nonce_account(
- ctx: Context<AuthorizeNonceAccount>,
- authorized: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn allocate(ctx: Context<Allocate>, space: u64) -> Result<()> {
- Ok(())
- }
- pub fn allocate_with_seed(
- ctx: Context<AllocateWithSeed>,
- base: Pubkey,
- seed: String,
- space: u64,
- owner: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn assign_with_seed(
- ctx: Context<AssignWithSeed>,
- base: Pubkey,
- seed: String,
- owner: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- pub fn transfer_with_seed(
- ctx: Context<TransferWithSeed>,
- lamports: u64,
- seed: String,
- owner: Pubkey,
- ) -> Result<()> {
- Ok(())
- }
- }
- #[derive(Accounts)]
- pub struct CreateAccount<'info> {
- #[account(mut)]
- from: Signer<'info>,
- #[account(mut)]
- to: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct Assign<'info> {
- #[account(mut)]
- pubkey: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct Transfer<'info> {
- #[account(mut)]
- from: Signer<'info>,
- #[account(mut)]
- /// CHECK:
- to: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct CreateAccountWithSeed<'info> {
- #[account(mut)]
- from: Signer<'info>,
- #[account(mut)]
- /// CHECK:
- to: AccountInfo<'info>,
- base: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct AdvanceNonceAccount<'info> {
- #[account(mut)]
- /// CHECK:
- nonce: AccountInfo<'info>,
- /// CHECK:
- recent_blockhashes: AccountInfo<'info>,
- authorized: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct WithdrawNonceAccount<'info> {
- #[account(mut)]
- /// CHECK:
- nonce: AccountInfo<'info>,
- #[account(mut)]
- /// CHECK:
- to: AccountInfo<'info>,
- /// CHECK:
- recent_blockhashes: AccountInfo<'info>,
- rent: Sysvar<'info, Rent>,
- authorized: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct InitializeNonceAccount<'info> {
- #[account(mut)]
- nonce: Signer<'info>,
- /// CHECK:
- recent_blockhashes: AccountInfo<'info>,
- rent: Sysvar<'info, Rent>,
- }
- #[derive(Accounts)]
- pub struct AuthorizeNonceAccount<'info> {
- #[account(mut)]
- /// CHECK:
- nonce: AccountInfo<'info>,
- authorized: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct Allocate<'info> {
- #[account(mut)]
- pubkey: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct AllocateWithSeed<'info> {
- #[account(mut)]
- /// CHECK:
- account: AccountInfo<'info>,
- base: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct AssignWithSeed<'info> {
- #[account(mut)]
- /// CHECK:
- account: AccountInfo<'info>,
- base: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct TransferWithSeed<'info> {
- #[account(mut)]
- /// CHECK:
- from: AccountInfo<'info>,
- base: Signer<'info>,
- #[account(mut)]
- /// CHECK:
- to: AccountInfo<'info>,
- }
- #[derive(AnchorSerialize, AnchorDeserialize, Clone)]
- pub struct FeeCalculator {
- pub lamports_per_signature: u64,
- }
- #[account]
- pub struct Nonce {
- pub version: u32,
- pub state: u32,
- pub authorized_pubkey: Pubkey,
- pub nonce: Pubkey,
- pub fee_calculator: FeeCalculator,
- }
|