#macro #variables #solana #global #bump #declare #ellipsis

macro ellipsis-macros

Ellipsis Solana Macros

2 releases

0.1.1 Dec 1, 2022
0.1.0 Dec 1, 2022

#19 in #declare

Download history 276/week @ 2023-11-30 212/week @ 2023-12-07 230/week @ 2023-12-14 220/week @ 2023-12-21 90/week @ 2023-12-28 199/week @ 2024-01-04 240/week @ 2024-01-11 225/week @ 2024-01-18 257/week @ 2024-01-25 186/week @ 2024-02-01 213/week @ 2024-02-08 304/week @ 2024-02-15 329/week @ 2024-02-22 344/week @ 2024-02-29 341/week @ 2024-03-07 276/week @ 2024-03-14

1,360 downloads per month
Used in 8 crates (3 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

use ellipsis_macros::declare_id;
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

use ellipsis_macros::declare_pda;
declare_id!(
  "F46iAvcTENE8BBpSaQnumRw868p9o37AFhFvBkfKqu1e",
  "9BoN4yBYwH63LFM9fDamaHK62YjM56hWYZqok7MnAakJ",
  "hello"
);

lib.rs:

These macros are used cede generation in Solana smart contracts

Currently, the implemented macros can generate static program IDs and deterministic program derived addresses (the bump seed is autogenerated).

The code is forked from the Solana SDK (https://github.com/solana-labs/solana/blob/master/sdk/macro/src/lib.rs) and modified to support new features.

Dependencies

~16–26MB
~428K SLoC