coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

lang: add anchor_lang::pubkey macro for declaring const Pubkey values #3021

Closed mina86 closed 2 weeks ago

mina86 commented 2 weeks ago

anchor_lang::solana_program::pubkey macro doesn’t work because it expands to code using ::solana_program::pubkey::Pubkey type (note leading ::). Since programs using anchor-lang crate usually don’t include solana-program dependency, that symbol ends up unresolved.

Introduce anchor_lang::pubkey macro which accesses solana_program via anchor_lang instead. This is analogous to declare_id macro which also had to be repeated in anchor-lang.

vercel[bot] commented 2 weeks ago

@mina86 is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

mina86 commented 2 weeks ago

Done.

Yes, if Solana dropped :: prefix, this as well as declare_id definitions wouldn’t be necessary in Anchor. Looks like they don’t have appetite for that though.