|
1 | 1 | use crate::empty_star_frame_instruction; |
2 | 2 | use crate::prelude::*; |
3 | 3 | use borsh::{BorshDeserialize, BorshSerialize}; |
| 4 | +use solana_program::rent::Rent; |
4 | 5 | use solana_program::system_program; |
| 6 | +#[allow(deprecated)] |
| 7 | +use solana_program::sysvar::recent_blockhashes::RecentBlockhashes; |
5 | 8 |
|
6 | 9 | /// Solana's system program. |
7 | 10 | #[derive(Debug, Copy, Clone, Align1)] |
@@ -95,43 +98,57 @@ empty_star_frame_instruction!(Transfer, TransferAccounts); |
95 | 98 | #[instruction_to_idl(program = SystemProgram)] |
96 | 99 | pub struct AdvanceNonceAccount; |
97 | 100 | /// Accounts for the [`AdvanceNonceAccount`] instruction. |
98 | | -#[derive(Debug, Clone, AccountSet)] |
99 | | -pub struct AdvanceNonceAccountAccounts<'info> { |
100 | | - pub nonce_account: Mut<AccountInfo<'info>>, |
101 | | - // todo: sysvars! |
102 | | - pub recent_blockhashes: AccountInfo<'info>, |
103 | | - pub nonce_authority: Signer<AccountInfo<'info>>, |
| 101 | +#[allow(deprecated)] |
| 102 | +mod advance_nonce { |
| 103 | + use super::*; |
| 104 | + #[derive(Debug, Clone, AccountSet)] |
| 105 | + pub struct AdvanceNonceAccountAccounts<'info> { |
| 106 | + pub nonce_account: Mut<AccountInfo<'info>>, |
| 107 | + pub recent_blockhashes: Sysvar<'info, RecentBlockhashes>, |
| 108 | + pub nonce_authority: Signer<AccountInfo<'info>>, |
| 109 | + } |
104 | 110 | } |
| 111 | +pub use advance_nonce::*; |
105 | 112 | empty_star_frame_instruction!(AdvanceNonceAccount, AdvanceNonceAccountAccounts); |
106 | 113 |
|
107 | 114 | // WithdrawNonceAccount |
108 | 115 | /// Withdraws funds from a nonce account. |
109 | 116 | #[derive(Copy, Clone, Debug, Eq, PartialEq, InstructionToIdl, BorshDeserialize, BorshSerialize)] |
110 | 117 | #[instruction_to_idl(program = SystemProgram)] |
111 | 118 | pub struct WithdrawNonceAccount(pub u64); |
112 | | -/// Accounts for the [`WithdrawNonceAccount`] instruction. |
113 | | -#[derive(Debug, Clone, AccountSet)] |
114 | | -pub struct WithdrawNonceAccountAccounts<'info> { |
115 | | - pub nonce_account: Mut<AccountInfo<'info>>, |
116 | | - pub recipient: Mut<AccountInfo<'info>>, |
117 | | - pub recent_blockhashes: AccountInfo<'info>, |
118 | | - pub rent: AccountInfo<'info>, |
119 | | - pub nonce_authority: Signer<AccountInfo<'info>>, |
| 119 | +#[allow(deprecated)] |
| 120 | +mod withdraw_nonce { |
| 121 | + use super::*; |
| 122 | + /// Accounts for the [`WithdrawNonceAccount`] instruction. |
| 123 | + #[derive(Debug, Clone, AccountSet)] |
| 124 | + pub struct WithdrawNonceAccountAccounts<'info> { |
| 125 | + pub nonce_account: Mut<AccountInfo<'info>>, |
| 126 | + pub recipient: Mut<AccountInfo<'info>>, |
| 127 | + pub recent_blockhashes: Sysvar<'info, RecentBlockhashes>, |
| 128 | + pub rent: Sysvar<'info, Rent>, |
| 129 | + pub nonce_authority: Signer<AccountInfo<'info>>, |
| 130 | + } |
120 | 131 | } |
| 132 | +pub use withdraw_nonce::*; |
121 | 133 | empty_star_frame_instruction!(WithdrawNonceAccount, WithdrawNonceAccountAccounts); |
122 | 134 |
|
123 | 135 | // InitializeNonceAccount |
124 | 136 | /// Drives the state of an uninitialized nonce account to initialized, setting the nonce value. |
125 | 137 | #[derive(Copy, Clone, Debug, Eq, PartialEq, InstructionToIdl, BorshDeserialize, BorshSerialize)] |
126 | 138 | #[instruction_to_idl(program = SystemProgram)] |
127 | 139 | pub struct InitializeNonceAccount(pub Pubkey); |
128 | | -/// Accounts for the [`InitializeNonceAccount`] instruction. |
129 | | -#[derive(Debug, Clone, AccountSet)] |
130 | | -pub struct InitializeNonceAccountAccounts<'info> { |
131 | | - pub nonce_account: Mut<AccountInfo<'info>>, |
132 | | - pub recent_blockhashes: AccountInfo<'info>, |
133 | | - pub rent: AccountInfo<'info>, |
| 140 | +#[allow(deprecated)] |
| 141 | +mod initialize_nonce { |
| 142 | + use super::*; |
| 143 | + /// Accounts for the [`InitializeNonceAccount`] instruction. |
| 144 | + #[derive(Debug, Clone, AccountSet)] |
| 145 | + pub struct InitializeNonceAccountAccounts<'info> { |
| 146 | + pub nonce_account: Mut<AccountInfo<'info>>, |
| 147 | + pub recent_blockhashes: Sysvar<'info, RecentBlockhashes>, |
| 148 | + pub rent: Sysvar<'info, Rent>, |
| 149 | + } |
134 | 150 | } |
| 151 | +pub use initialize_nonce::*; |
135 | 152 | empty_star_frame_instruction!(InitializeNonceAccount, InitializeNonceAccountAccounts); |
136 | 153 |
|
137 | 154 | // AuthorizeNonceAccount |
|
0 commit comments