Skip to content

Commit e5b7d7c

Browse files
author
Mike MacCana
committed
docs: truth audit across READMEs
Read every README against the underlying code and fixed claims that no longer hold. Also applied the agreed token-terminology rules across prose: no 'SPL Token(s)', no 'Token-2022' / 'Token 2022'. Use 'tokens', 'Classic Token Program', 'Token Extensions' / 'Token Extensions Program'. 'instruction handler' (not 'instruction') when referring to the Rust pub fn under #[program]. Behaviour changes: - Delete orphan dir tokens/token-extensions/transfer-hook/pblock-list/. PR #20 renamed pblock-list → block-list but left the parent shell behind with a stale README that referenced a non-existent pinocchio/ subdir. Real claim drift fixed (README claimed X, code does Y): - tokens/token-fundraiser/anchor: duration field is u16 (not u8); Contributor struct has a bump field; handlers are free pub fn handle_*(accounts: &mut X, ...) (not impl<'info>); amount >= MIN_AMOUNT_TO_RAISE (not >); 1_u64.pow (not 1_u8.pow); FundraiserError::FundraiserEnded (not FundraisingEnded); added missing check_contributions handler description; documented the duration-check semantics (see WARNING below). - tokens/nft-operations/anchor: code pattern shifted from impl<'info> X<'info> { pub fn ... } to free pub fn handler(accounts: &mut X, bumps: &XBumps). Rewrote all three handler code blocks. Also fixed INSTRUCTIONS_ID → INSTRUCTIONS_SYSVAR_ID with a note about the Anchor 1.0 sysvar-id move. - basics/close-account/anchor: README described a 'destroy-an-account' program with TypeScript tests using fetchNullable. Actual program is 'close-account', files are create_user.rs and close_user.rs, tests are Rust litesvm (cargo test). Rewrote the README to match. - basics/cross-program-invocation: dependency uses features = ["cpi"] (which enables no-entrypoint), not features = ["no-entrypoint"] directly. Documented the cpi feature. - tokens/token-extensions/nft-meta-data-pointer/anchor-example: MAX_ENERGY = 100 (not 10); programs/extension_nft (underscore, not hyphen); there is no update_energy.rs instruction handler (the refill is computed in PlayerData::update_energy in state/player_data.rs); file tree updated to match actual layout. - compression/cnft-burn, cnft-vault, cutils anchor READMEs: stripped references to non-existent tests/ directories and stale devnet program IDs (the lib.rs declare_id! values are different and the README values can't be verified). cutils also claimed 'pins Anchor 0.26.0' but Cargo.toml uses anchor-lang = "1.0.0". - tokens/token-extensions/transfer-hook/whitelist/anchor: fixed broken link to ../../pblock-list/ → ../../block-list/. - tokens/token-extensions/transfer-hook/block-list/readme.md: this lowercase readme.md was not updated in the May 12 style pass. Rewrote to match the styled tone and the actual handler names (Init, BlockWallet, UnblockWallet, SetupExtraMetas, TxHook) and dispatcher in pinocchio/program/src/lib.rs. Removed the unverifiable devnet links and dead transaction URLs; left only the declare_id! with a note on how to check deployment. Terminology sweep (prose only; directory paths and Rust identifiers like Program<'info, Token2022> / TOKEN_2022_PROGRAM_ID unchanged): - 'SPL Token', 'SPL Tokens', 'the SPL Token Program' → 'tokens', 'Classic Token Program' depending on context. - 'Token-2022', 'Token 2022' → 'Token Extensions' / 'Token Extensions Program'. - 'the transfer() instruction provided by the SPL Token Program' → 'the Classic Token Program's transfer instruction handler'. WARNING — code bugs noticed but not fixed in this PR: token-fundraiser/anchor has comparison operators that look inverted relative to their error names: contribute.rs:72 — require!(duration <= elapsed_days, FundraiserEnded) refund.rs:60 — require!(duration >= elapsed_days, FundraiserNotEnded) One of these is wrong. The README now describes what the code actually does and flags this for any future reader. Did not change program logic in a docs PR. Out of scope (deliberately not touched): - spl-token-minter directory rename (would break links). - Whether the block-list/pinocchio Pinocchio program is currently shippable / CI-green (separate ongoing investigation). - block-list/readme.md → README.md rename (file rename, not content).
1 parent 8abb5d1 commit e5b7d7c

19 files changed

Lines changed: 406 additions & 867 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ Create an NFT collection, mint NFTs, and verify NFTs as part of a collection usi
153153

154154
[⚓ Anchor](./tokens/nft-operations/anchor) [💫 Quasar](./tokens/nft-operations/quasar)
155155

156-
### SPL Token Minter
156+
### Token Minter
157157

158-
Mint tokens from inside your own program using the Token program.
158+
Mint tokens from inside your own program using the Classic Token Program.
159159

160160
[⚓ Anchor](./tokens/spl-token-minter/anchor) [💫 Quasar](./tokens/spl-token-minter/quasar) [🦀 Native](./tokens/spl-token-minter/native)
161161

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
# Destroy an Account
1+
# Close Account
22

3-
1. A `PDA` is created using the [create_user.rs](programs/destroy-an-account/src/instructions/create_user.rs) instruction.
3+
Two instruction handlers: `create_user` initializes a PDA `UserState` account, and `close_user` closes it and returns the rent to the user.
4+
5+
1. `create_user` initializes the PDA with Anchor's `init` constraint:
46

57
```rust
68
#[account(
79
init,
8-
seeds = [User::PREFIX.as_bytes(), user.key().as_ref()],
910
payer = user,
10-
space = User::SIZE,
11+
space = UserState::DISCRIMINATOR.len() + UserState::INIT_SPACE,
12+
seeds = [b"USER", user.key().as_ref()],
1113
bump,
1214
)]
13-
pub user_account: Box<Account<'info, User>>,
15+
pub user_account: Account<'info, UserState>,
1416
```
1517

16-
2. The account is closed in [destroy_user.rs](programs/destroy-an-account/src/instructions/destroy_user.rs), using Anchor's `close` helper on the account info:
18+
See [`programs/close-account/src/instructions/create_user.rs`](programs/close-account/src/instructions/create_user.rs).
19+
20+
2. `close_user` closes the account using Anchor's `close` constraint, which returns lamports to the given account:
1721

1822
```rust
19-
user_account.close(user.to_account_info())?;
23+
#[account(
24+
mut,
25+
seeds = [b"USER", user.key().as_ref()],
26+
bump = user_account.bump,
27+
close = user, // close account and return lamports to user
28+
)]
29+
pub user_account: Account<'info, UserState>,
2030
```
2131

22-
3. The test [destroy-an-account.ts](tests/destroy-an-account.ts) verifies that the account is null both before creation and after closing, via `fetchNullable`:
32+
See [`programs/close-account/src/instructions/close_user.rs`](programs/close-account/src/instructions/close_user.rs).
2333

24-
```typescript
25-
const userAccountBefore = await program.account.user.fetchNullable(userAccountAddress, "processed");
26-
assert.equal(userAccountBefore, null);
27-
// ...
28-
const userAccountAfter = await program.account.user.fetchNullable(userAccountAddress, "processed");
29-
assert.notEqual(userAccountAfter, null);
30-
```
34+
## Tests
35+
36+
Tests live in [`programs/close-account/tests/test_close_account.rs`](programs/close-account/tests/test_close_account.rs) and run against litesvm. `Anchor.toml`'s `scripts.test` is `cargo test`, so `anchor test` builds the program and runs the Rust tests:
37+
38+
```bash
39+
anchor test
40+
```

basics/cross-program-invocation/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@ In the `lever` crate's `Cargo.toml`:
2626
no-entrypoint = []
2727
```
2828

29-
Then, in the `hand` crate, import `lever` with that feature enabled:
29+
In this example each crate also defines a `cpi` feature that depends on `no-entrypoint`, so callers can pick the more descriptive name:
30+
31+
```toml
32+
[features]
33+
no-entrypoint = []
34+
cpi = ["no-entrypoint"]
35+
```
36+
37+
Then, in the `hand` crate, import `lever` with the `cpi` feature enabled:
3038

3139
```toml
3240
[dependencies]
33-
lever = { path = "../lever", features = ["no-entrypoint"] }
41+
cross-program-invocatio-native-lever = { path = "../lever", features = ["cpi"] }
3442
```
3543

36-
In the `lever` crate, gate the `entrypoint!` macro on the feature being absent:
44+
In the `lever` crate, gate the `entrypoint!` macro on the `no-entrypoint` feature being absent:
3745

3846
```rust
3947
#[cfg(not(feature = "no-entrypoint"))]

compression/cnft-burn/anchor/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ An Anchor program that burns compressed NFTs (cNFTs) in your collection. The pro
44

55
## Components
66

7-
- `programs/` — the Anchor program.
8-
- `tests/`tests for the program.
7+
- `programs/cnft-burn/` — the Anchor program.
8+
- `migrations/`deployment script.
99

10-
## Deployment
10+
There is no `tests/` directory in this example today. The program is intended to be deployed and exercised against a real cluster.
1111

12-
The program is deployed on devnet at `FbeHkUEevbhKmdk5FE5orcTaJkCYn5drwZoZXaxQXXNn`. To deploy your own copy, change the program ID in `lib.rs` and `Anchor.toml`.
12+
## Deployment
1313

14-
## How to run
14+
The program ID declared in [`programs/cnft-burn/src/lib.rs`](programs/cnft-burn/src/lib.rs) is `C6qxH8n6mZxrrbtMtYWYSp8JR8vkQ55X1o4EBg7twnMv`. Whether this address is currently deployed on any cluster is not tracked in this repo — verify with `solana program show <id>` against the cluster you care about.
1515

16-
1. Configure the RPC endpoint in `cnft-burn.ts`.
17-
2. `anchor build` from the example root.
18-
3. `anchor deploy` to deploy to your chosen cluster.
19-
4. `pnpm test` to run the tests.
16+
To deploy your own copy, change the program ID in `lib.rs` and `Anchor.toml`, then run `anchor build && anchor deploy`.
2017

2118
## Acknowledgements
2219

compression/cnft-vault/anchor/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ Use this as a reference for working with cNFTs in your own programs.
1313

1414
## Components
1515

16-
- `programs/` — the Anchor program.
17-
- `tests/` — TypeScript client-side tests.
18-
- `tests/scripts/` — standalone scripts you can run individually. `withdrawWithLookup.ts` demonstrates using the program with Address Lookup Tables.
16+
- `programs/cnft-vault/` — the Anchor program.
17+
18+
There is no `tests/` directory in this example today. The program is intended to be deployed and exercised against a real cluster.
1919

2020
## Deployment
2121

22-
Deployed on devnet at `CNftyK7T8udPwYRzZUMWzbh79rKrz9a5GwV2wv7iEHpk`. To deploy your own, change the program ID in `lib.rs` and `Anchor.toml`.
22+
The program ID declared in [`programs/cnft-vault/src/lib.rs`](programs/cnft-vault/src/lib.rs) is `Fd4iwpPWaCU8BNwGQGtvvrcvG4Tfizq3RgLm8YLBJX6D`. Whether this address is currently deployed on any cluster is not tracked in this repo — verify with `solana program show <id>` against the cluster you care about.
23+
24+
To deploy your own copy, change the program ID in `lib.rs` and `Anchor.toml`, then run `anchor build && anchor deploy`.
2325

2426
## Limitations
2527

compression/cutils/anchor/README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,20 @@ Use this as a reference for working with cNFTs in your own programs.
1111

1212
## Components
1313

14-
- `programs/` — the Anchor program. The setup uses a `validate`/`actuate` pattern via Anchor's `access_control` macro; this pairs well with the cNFT verification logic.
15-
- `tests/` — TypeScript tests.
16-
- `setup.ts` — run first if you don't already have a collection with a merkle tree.
17-
- `tests.ts` — individual minting and verification tests.
14+
- `programs/cutils/` — the Anchor program. The setup uses a `validate`/`actuate` pattern via Anchor's `access_control` macro; this pairs well with the cNFT verification logic.
15+
16+
There is no `tests/` directory in this example today. The program is intended to be deployed and exercised against a real cluster.
1817

1918
## Deployment
2019

21-
Deployed on devnet at `burZc1SfqbrAP35XG63YZZ82C9Zd22QUwhCXoEUZWNF`. To deploy your own, change the program ID in `lib.rs` and `Anchor.toml`.
20+
The program ID declared in [`programs/cutils/src/lib.rs`](programs/cutils/src/lib.rs) is `BuFyrgRYzg2nPhqYrxZ7d9uYUs4VXtxH71U8EcoAfTQZ`. Whether this address is currently deployed on any cluster is not tracked in this repo — verify with `solana program show <id>` against the cluster you care about.
21+
22+
To deploy your own copy, change the program ID in `lib.rs` and `Anchor.toml`, then run `anchor build && anchor deploy`.
2223

2324
## Limitations
2425

2526
Reference implementation only.
2627

27-
**This example pins Anchor 0.26.0** because of mpl-bubblegum dependency constraints at the time of writing.
28-
29-
## How to run
30-
31-
1. Configure the RPC endpoint in `utils/readAPI.ts`.
32-
2. `cd` to the example root.
33-
3. `pnpm install`.
34-
4. (Optional) `npx tsx tests/setup.ts` to create an NFT collection and its merkle tree.
35-
5. Comment out the tests you don't want to run in `tests/tests.ts`.
36-
6. If minting, set your NFT URI.
37-
7. If verifying, set the asset ID (cNFT mint address) you want to verify.
38-
8. Run `anchor test --skip-build --skip-deploy --skip-local-validator`.
39-
9. View your cNFTs on devnet via the Solflare wallet.
40-
10. You may also want to change the wallet path in `Anchor.toml`.
41-
4228
## Acknowledgements
4329

4430
- [@nickfrosty](https://twitter.com/nickfrosty) for the sample code and [live demo](https://youtu.be/LxhTxS9DexU).

tokens/create-token/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Create an SPL Token
1+
# Create a Token
22

3-
Create an SPL Token on Solana with metadata such as a symbol and an icon.
3+
Create a token on Solana with metadata such as a symbol and an icon.
44

5-
All tokens on Solana — including NFTs are SPL Tokens. They follow the SPL Token standard (similar in spirit to ERC-20).
5+
All fungible assets and NFTs on Solana are tokens. They follow the Classic Token Program standard (similar in spirit to ERC-20), or the newer Token Extensions standard.
66

77
```text
8-
Default SPL Tokens : 9 decimals
9-
NFTs : 0 decimals
8+
Typical fungible tokens : 9 decimals
9+
NFTs : 0 decimals
1010
```
1111

1212
## How decimals work
@@ -19,7 +19,7 @@ For a token JOE with 9 decimals:
1919

2020
## Mint and metadata
2121

22-
An SPL Token is represented onchain by a **Mint Account**:
22+
A token is represented onchain by a **Mint Account**:
2323

2424
```typescript
2525
{
@@ -41,9 +41,11 @@ Metadata about a mint — name, symbol, image URI — lives in a separate **Meta
4141
}
4242
```
4343

44-
> Metaplex is the de facto standard for SPL Token metadata on Solana. The [Metaplex Token Metadata Program](https://docs.metaplex.com/) is what creates these metadata accounts.
44+
> Metaplex is the de facto standard for token metadata on Solana with the Classic Token Program. The [Metaplex Token Metadata Program](https://docs.metaplex.com/) creates these metadata accounts.
45+
>
46+
> Tokens using the Token Extensions metadata extension store metadata directly on the mint and don't need a separate Metaplex account.
4547
46-
## Steps to create an SPL Token
48+
## Steps to create a token
4749

4850
1. Create an account for the mint.
4951
2. Initialize that account as a Mint Account.

tokens/nft-minter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# NFT Minter
22

3-
Minting NFTs is the same as [minting any SPL Token on Solana](../spl-token-minter/), with one extra step at the end.
3+
Minting NFTs is the same as [minting any token on Solana](../spl-token-minter/), with one extra step at the end.
44

5-
When you mint SPL Tokens, you can in most cases continue to mint more tokens later, growing the supply. An NFT is supposed to have a supply of **one**. So we need to make sure no more can ever be minted.
5+
When you mint tokens, you can in most cases continue to mint more later, growing the supply. An NFT is supposed to have a supply of **one**, so no more can ever be minted.
66

77
The way to do that is to remove the mint authority from the mint:
88

0 commit comments

Comments
 (0)