Skip to content

Commit

Permalink
Remove the state attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Aursen committed Nov 25, 2022
1 parent a73bd72 commit c837737
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 1,607 deletions.
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 19 additions & 24 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use anchor_lang::solana_program::hash::Hash;
use anchor_lang::solana_program::instruction::{AccountMeta, Instruction};
use anchor_lang::solana_program::program_error::ProgramError;
use anchor_lang::solana_program::pubkey::Pubkey;
use anchor_lang::solana_program::system_program;
use anchor_lang::{AccountDeserialize, Discriminator, InstructionData, ToAccountMetas};
use regex::Regex;
use solana_account_decoder::UiAccountEncoding;
Expand Down Expand Up @@ -176,10 +175,6 @@ impl Program {
})
}

pub fn state<T: AccountDeserialize>(&self) -> Result<T, ClientError> {
self.account(anchor_lang::__private::state::address(&self.program_id))
}

pub fn rpc(&self) -> RpcClient {
RpcClient::new_with_commitment(
self.cfg.cluster.url().to_string(),
Expand Down Expand Up @@ -496,25 +491,25 @@ impl<'a> RequestBuilder<'a> {

pub fn instructions(&self) -> Result<Vec<Instruction>, ClientError> {
let mut accounts = match self.namespace {
RequestNamespace::State { new } => match new {
false => vec![AccountMeta::new(
anchor_lang::__private::state::address(&self.program_id),
false,
)],
true => vec![
AccountMeta::new_readonly(self.payer.pubkey(), true),
AccountMeta::new(
anchor_lang::__private::state::address(&self.program_id),
false,
),
AccountMeta::new_readonly(
Pubkey::find_program_address(&[], &self.program_id).0,
false,
),
AccountMeta::new_readonly(system_program::ID, false),
AccountMeta::new_readonly(self.program_id, false),
],
},
// RequestNamespace::State { new } => match new {
// // false => vec![AccountMeta::new(
// // anchor_lang::__private::state::address(&self.program_id),
// // false,
// // )],
// true => vec![
// AccountMeta::new_readonly(self.payer.pubkey(), true),
// // AccountMeta::new(
// // anchor_lang::__private::state::address(&self.program_id),
// // false,
// // ),
// AccountMeta::new_readonly(
// Pubkey::find_program_address(&[], &self.program_id).0,
// false,
// ),
// AccountMeta::new_readonly(system_program::ID, false),
// AccountMeta::new_readonly(self.program_id, false),
// ],
// },
_ => Vec::new(),
};
accounts.extend_from_slice(&self.accounts);
Expand Down
2 changes: 0 additions & 2 deletions lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ anchor-debug = [
"anchor-attribute-interface/anchor-debug",
"anchor-attribute-program/anchor-debug",
"anchor-attribute-program/anchor-debug",
"anchor-attribute-state/anchor-debug",
"anchor-derive-accounts/anchor-debug"
]

Expand All @@ -31,7 +30,6 @@ anchor-attribute-account = { path = "./attribute/account", version = "0.25.0" }
anchor-attribute-constant = { path = "./attribute/constant", version = "0.25.0" }
anchor-attribute-error = { path = "./attribute/error", version = "0.25.0" }
anchor-attribute-program = { path = "./attribute/program", version = "0.25.0" }
anchor-attribute-state = { path = "./attribute/state", version = "0.25.0" }
anchor-attribute-interface = { path = "./attribute/interface", version = "0.25.0" }
anchor-attribute-event = { path = "./attribute/event", version = "0.25.0" }
anchor-derive-accounts = { path = "./derive/accounts", version = "0.25.0" }
Expand Down
22 changes: 0 additions & 22 deletions lang/attribute/state/Cargo.toml

This file was deleted.

92 changes: 0 additions & 92 deletions lang/attribute/state/src/lib.rs

This file was deleted.

149 changes: 0 additions & 149 deletions lang/src/accounts/cpi_state.rs

This file was deleted.

6 changes: 0 additions & 6 deletions lang/src/accounts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ pub mod boxed;
pub mod cpi_account;
#[doc(hidden)]
#[allow(deprecated)]
pub mod cpi_state;
#[doc(hidden)]
#[allow(deprecated)]
pub mod loader;
pub mod program;
#[doc(hidden)]
#[allow(deprecated)]
pub mod program_account;
pub mod signer;
#[doc(hidden)]
#[allow(deprecated)]
pub mod state;
pub mod system_account;
pub mod sysvar;
pub mod unchecked_account;

0 comments on commit c837737

Please sign in to comment.