4 releases (2 breaking)

new 0.3.0 Apr 22, 2025
0.2.0 Jan 18, 2025
0.1.1 Dec 1, 2022
0.1.0 Dec 1, 2022

#1314 in Procedural macros

Download history 346/week @ 2024-12-31 486/week @ 2025-01-07 735/week @ 2025-01-14 523/week @ 2025-01-21 384/week @ 2025-01-28 702/week @ 2025-02-04 830/week @ 2025-02-11 703/week @ 2025-02-18 950/week @ 2025-02-25 723/week @ 2025-03-04 638/week @ 2025-03-11 609/week @ 2025-03-18 1387/week @ 2025-03-25 648/week @ 2025-04-01 830/week @ 2025-04-08 727/week @ 2025-04-15

3,653 downloads per month
Used in 9 crates (4 directly)

Apache-2.0

8KB
143 lines

Implemented Macros

declare_id!

This functions exactly like the declare_id! macro in the solana_program package. Call it at the top of your program to create a global variable called ID. Note: you must import Pubkey from either solana_program or solana_sdk for this to work.

use ellipsis_macros::declare_id;
use solana_sdk::pubkey::Pubkey;
declare_id!("9BoN4yBYwH63LFM9fDamaHK62YjM56hWYZqok7MnAakJ");

declare_pda!

This macro takes in a base58-encoded PDA, a base-58 encoded program id, and a string literal representing the seed of the PDA. The macro will check that the supplied PDA is indeed the output of calling find_program_address on the program id and seed. If this succeeds, then the bump seed will be written to a variable called BUMP and the PDA will be written to a variable called ID. Note: you must import Pubkey from either solana_program or solana_sdk for this to work.

use ellipsis_macros::declare_pda;
use solana_sdk::pubkey::Pubkey;
declare_pda!(
  "F46iAvcTENE8BBpSaQnumRw868p9o37AFhFvBkfKqu1e",
  "9BoN4yBYwH63LFM9fDamaHK62YjM56hWYZqok7MnAakJ",
  "hello"
);

Dependencies

~11–20MB
~303K SLoC