Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit caeadd4

Browse files
committed
make program-ids crate
1 parent b38b97c commit caeadd4

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ members = [
3434
"memo/program",
3535
"name-service/program",
3636
"managed-token/program",
37+
"program-ids",
3738
"record/program",
3839
"shared-memory/program",
3940
"single-pool/cli",

program-ids/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "spl-program-id"
3+
version = "1.0.0"
4+
description = "Solana Program Library Program IDs"
5+
authors = ["Solana Labs Maintainers <[email protected]>"]
6+
repository = "https://github.com/solana-labs/solana-program-library"
7+
license = "Apache-2.0"
8+
edition = "2021"
9+
10+
11+
[dependencies]
12+
solana-program = "2.0.0"

program-ids/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPL Program IDs
2+
3+
This crate defines program IDs for all SPL programs,
4+
so you if you can import a program ID without importing
5+
entire programs.
6+
7+
## Example
8+
```rust
9+
use spl_program_ids::token::ID;
10+
```

program-ids/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//! SPL Program IDs
2+
3+
macro_rules! delcare_id_mod {
4+
($mod_name:ident, $id_bs58:literal) => {
5+
pub mod $mod_name {
6+
::solana_program::declare_id!($id_bs58);
7+
}
8+
}
9+
}
10+
11+
delcare_id_mod!(account_compression, "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK");
12+
13+
#[cfg(test)]
14+
mod tests {
15+
use super::account_compression;
16+
17+
#[test]
18+
fn test_declare_id_mod() {
19+
assert_eq!(account_compression::ID.to_string(), "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK");
20+
}
21+
}

0 commit comments

Comments
 (0)