keywords.
Every word, and the Rust or Anchor it becomes. Straight from the README, 29 rows.
| typeshi | Rust / Anchor |
|---|---|
gm!("<program id>")lesson | declare_id! |
stealth_launch name { }lesson | the program, #[program] pub mod name |
frame Name { } / term_sheetlesson | account data, #[account] #[derive(InitSpace)] pub struct |
cap_table Name { }lesson | #[derive(Accounts)] struct Name<'info>, lifetimes added for you |
alpha_leak Name { }lesson | an event, #[event] |
cope { Name = "message" }lesson | your own codes in enum Cope |
type_shi X = T; / deadass X: T = v; | pub type / pub const |
#[on_god]lesson | immutable: any mut on that account fails to compile |
this_is_fine!(); | the program's panic handler (behind the custom-panic feature) |
lock_in fn / ape fn / few_understand fnlesson | an instruction that writes (or it fails to compile) / any instruction / a private helper |
ctx (first param)lesson | ctx: Context<PascalCaseOfTheFn> |
-> W / W<T> / ebitda | Result<()> / Result<T> / Result<()> |
were_so_back!()lesson | Ok(()) |
L("msg") / its_so_over!("msg") / rekt! | err! / return err!, with your message as a new error code |
seethe!(expr, "msg") / fired!("msg")lesson | .map_err(...)? / panic! |
any check with , "msg" or , cuz "msg" | your message becomes an error code |
bull c { } bear { }, a mogs b, diamond_hands / paper_handslesson | if c { } else { }, a > b, true / false |
#[tokenmaxx] / #[vc_backed] | logs stripped / locked for 4 years (and slower) |
ser / exit_liquidity / cabal / anon / kollesson | cap_table accounts, typed for you: caller (mut signer), payer (mut signer), admin (signer), anyone (signer), fee receiver (mut). Also system_program, token_program |
rent_free / golden_parachute = x / graduate = nlesson | init / close = x / realloc = n |
per_my_last_email!(feed.n) / mark_to_market!(feed.n = v)lesson | read / write ctx.accounts.feed.n |
number_go_up!(x, n) / aura_farm!(x, n) / ascend!(x)lesson | checked add / add and log +n aura / bump a layout version |
trust_me_bro! / funds_are_safu! / margin_call! / fren!(k in list)lesson | require! / require! (0x3) / fails when true (0x2) / allowlist |
wen!(ts) / hodl!(ts) / touch_grass!(deadline)lesson | fails before ts (0x4) / fails after deadline |
probably_nothing!("fmt", ..) / probably_nothing!(Event { .. })lesson | msg! / emit! |
bags!(acc) / looksmaxx!(n) / bps!(a, r) / bonding_curve!(s, b, m)lesson | lamports / "1.23M" / a * r / 10_000 / b + m * s, all checked |
full_send!(a => b, n) / printer_go_brrr! / lp_burned!lesson | System transfer (0x6 when broke) / SPL mint_to / burn |
mint_revoked! / freeze_revoked! / liquidated!(a => d) / layoffs!(a, b => d) | drop mint / freeze authority / close one / close many |
hostile_takeover!(x.cabal => k) / bundled! { } / mew!() / wen_moon() | hand over authority / one atomic block / nothing / "soon™" |
29 of 29
how it works
- tokens, not regex.typeshi reads
.shias Rust tokens with real line and column numbers, then rewrites the slang into plain Anchor. - printed like a human wrote it.the result is parsed with
synand printed withprettyplease.typeshi buildthen runsanchor build. - errors find their way home.every token remembers where it came from, so when rustc complains about the generated
.rs, typeshi points at the line you wrote.
For code that holds money on a public chain, that last part matters: the code that runs is the code you can see. Read the generated Rust before you deploy anything. The confession macros really do what they say.