Skip to content

Commit 2b5b78e

Browse files
authored
feat: Add missing pubkey const generation (solana-foundation#3677)
1 parent b1cb54f commit 2b5b78e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lang/attribute/program/src/declare_program/mods/constants.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ pub fn gen_constants_mod(idl: &Idl) -> proc_macro2::TokenStream {
1313
let (ty, val) = match &c.ty {
1414
IdlType::Bytes => (quote!(&[u8]), quote! { &#val }),
1515
IdlType::String => (quote!(&str), val),
16+
IdlType::Pubkey => {
17+
let pubkey_str = c.value.to_string();
18+
(
19+
quote!(anchor_lang::prelude::Pubkey),
20+
quote!(anchor_lang::prelude::Pubkey::from_str_const(#pubkey_str)),
21+
)
22+
}
1623
_ => (convert_idl_type_to_syn_type(&c.ty).to_token_stream(), val),
1724
};
1825

0 commit comments

Comments
 (0)