lang: Include `pubkey!` macro in `prelude` (#3026)

This commit is contained in:
acheron 2024-06-15 12:57:13 +02:00 committed by GitHub
parent 81c2519a9b
commit 1c2aabe315
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -400,7 +400,7 @@ pub mod prelude {
accounts::signer::Signer, accounts::system_account::SystemAccount,
accounts::sysvar::Sysvar, accounts::unchecked_account::UncheckedAccount, constant,
context::Context, context::CpiContext, declare_id, declare_program, emit, err, error,
event, program, require, require_eq, require_gt, require_gte, require_keys_eq,
event, program, pubkey, require, require_eq, require_gt, require_gte, require_keys_eq,
require_keys_neq, require_neq,
solana_program::bpf_loader_upgradeable::UpgradeableLoaderState, source,
system_program::System, zero_copy, AccountDeserialize, AccountSerialize, Accounts,

View File

@ -1,6 +1,5 @@
use anchor_lang::prelude::*;
use anchor_spl::{token, token_interface};
use std::str::FromStr;
declare_id!("id11111111111111111111111111111111111111111");
@ -221,7 +220,7 @@ impl Default for State {
i128_field: i128::MIN / 2 - 10,
bytes_field: vec![1, 2, 255, 254],
string_field: String::from("hello"),
pubkey_field: Pubkey::from_str("EPZP2wrcRtMxrAPJCXVEQaYD9eH7fH7h12YqKDcd4aS7").unwrap(),
pubkey_field: pubkey!("EPZP2wrcRtMxrAPJCXVEQaYD9eH7fH7h12YqKDcd4aS7"),
vec_field: vec![1, 2, 100, 1000, u64::MAX],
vec_struct_field: vec![FooStruct::default()],
option_field: None,