As the issuer, you can apply controls that the network enforces. In this step
you use the simplest: freeze the holder’s account, watch their transfer fail,
then thaw it. Step 3 made your wallet the asset’s freeze authority, so you can.
Freeze and thaw the holder
Save this asfreeze-holder.ts next to client.ts and run
npx tsx freeze-holder.ts. It reads the asset from asset.json (exf.json in
the CLI tab) and the holder from holder.json.
TypeScript
Output of npx tsx freeze-holder.tsLocal test network (Surfpool)
npx tsx freeze-holder.ts
Froze the holder's EXF accountTransfer blocked: account is frozen
Thawed. Transfer sent: 3Bnnn7495CMuoae88MuQsRKpDVsRqEpZRuYSPkP4hSRSyPA48ZXvpLWZAo8eXK8YbiARbYyQYn8nEnPucU3s5Sri
Holder balance: 90 EXF
Confirmed
findAssociatedTokenPda(...)works out the holder’s EXF token account, the one step 4 opened.sendBack()builds a transfer of 10 EXF from the holder back to you, signed by the holder. Your wallet pays the fee.
- Freeze.
freezeAccount(...), signed by your wallet as the freeze authority, freezes the holder’s EXF account. - Try a transfer. Token-2022 rejects any transfer out of a frozen account
(error 17,
AccountFrozen). It fails in the RPC node’s pre-send simulation, so it never lands and costs nothing. The script printsTransfer blocked: account is frozen. - Thaw.
thawAccount(...)unfreezes the account, and the same transfer goes through. The holder ends with 90 EXF.
Next steps
Issue an asset
Add an approval list and a pause switch that the network enforces on every
transfer.
Learn how Solana works
Accounts, transactions, programs, and fees: the building blocks behind each
step.