Full lesson
CancelChain
Revoke recurring-charge permissions on Solana in two clicks and one signature — the next charge is refused on chain. Devnet only.
What it does
From the project README:
A subscriptions dashboard for Solana. Connect a wallet and see every recurring-charge permission ever granted from it — whichever app granted it — then revoke any of them with one signature, so that the next attempt to charge is refused **by the protocol**, not by us.
- Original
- CancelChain-ai/CancelChain
- SuperStack fork
- Blockchains/CancelChain @
c53e15f - Stars
- 0
- Last push (original)
- 2026-10-25
- Languages
- TypeScript, HTML, JavaScript, CSS, PLpgSQL
- Detected stack
- @solana/kit
- Categories
- Infrastructure & Tooling
- Licence
- MIT
- Homepage
- https://cancelchain-ai.github.io/CancelChain/
Architecture
233 source files. By extension: .ts ×202, .tsx ×28, .js ×3.
| Top-level directory | Source files |
|---|---|
apps | 136 |
packages | 58 |
tests | 22 |
tools | 17 |
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/cancelchain/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
tools/merchant-sim/src/charge.ts L397–420 @ c53e15f · MIT · original const code = programErrorCodeOf(error) if (code !== null) return String(code) return runtimeErrorLabelOf(error) ?? 'other'} type SignatureStatus = { err: unknown slot: Slot} /** * Рівно та частина RPC, якою користується спроба списання. Вужчий тип, ніж * `Rpc<SolanaRpcApi>`, з тієї самої причини, що й у `packages/chain/read.ts`: * методи kit перевантажені за кодуванням, і підробити їх у тесті означало б * підробити всі перевантаження. Справжній клієнт відповідає цьому типу * структурно — це перевіряє `charge.test.ts`. */export type ChargeRpc = { getLatestBlockhash(config?: { commitment?: Commitment }): { send(): Promise<{ value: { blockhash: Blockhash; lastValidBlockHeight: bigint } }> } sendTransaction(- Line 415
getLatestBlockhash(config?: { commitment?: Commitment }): {: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 420
sendTransaction(: Submits the signed transaction to the cluster.
tools/merchant-sim/src/plan.ts L385–408 @ c53e15f · MIT · original const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS let pda: Address let plan: CreatePlanTransaction try { pda = await findPlanAddress({ owner: input.merchant.address, planId: input.terms.planId }) const { value } = await rpc.getLatestBlockhash({ commitment }).send() plan = await buildCreatePlanTransaction({ ...input, lifetime: { blockhash: toBlockhash(value.blockhash), lastValidBlockHeight: value.lastValidBlockHeight, }, }) } catch (error) { return { outcome: 'not-sent', pda: null, signature: null, detail: detailOf(error) } } let sendError: unknown = null try { await rpc .sendTransaction(plan.wireTransactionBase64, { encoding: 'base64', preflightCommitment: commitment,- Line 391
const { value } = await rpc.getLatestBlockhash({ commitment }).send(): Fetches a recent blockhash. Transactions expire if it gets too old. - Line 406
.sendTransaction(plan.wireTransactionBase64, {: Submits the signed transaction to the cluster.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | pnpm -r --parallel dev |
. | npm run build | pnpm -r build |
. | npm run test | pnpm -r --parallel test |
. | npm run lint | biome check . |
packages/push | npm run test | vitest run |
packages/db | npm run test | vitest run |
packages/chain | npm run test | vitest run |
packages/shared | npm run test | vitest run |
apps/indexer | npm run dev | tsx watch --env-file-if-exists=../../.env src/index.ts |
apps/indexer | npm run start | tsx src/index.ts |
apps/indexer | npm run test | vitest run |
apps/web | npm run dev | vite |
apps/web | npm run build | vite build |
apps/web | npm run test | vitest run |
apps/api | npm run dev | tsx watch --env-file-if-exists=../../.env src/index.ts |
apps/api | npm run start | tsx src/index.ts |
What you could build from it
- Fork the SuperStack copy and extend it within the Infrastructure & Tooling gaps listed on the idea page.
- Learn the pattern first: Building and sending transactions from a client
- Learn the pattern first: Anchor account constraints