Skip to content
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 as freeze-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 account
Transfer blocked: account is frozen
Thawed. Transfer sent: 3Bnnn7495CMuoae88MuQsRKpDVsRqEpZRuYSPkP4hSRSyPA48ZXvpLWZAo8eXK8YbiARbYyQYn8nEnPucU3s5Sri
Holder balance: 90 EXF
Confirmed
What the code does:
  • 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.
Then, in order:
  1. Freeze. freezeAccount(...), signed by your wallet as the freeze authority, freezes the holder’s EXF account.
  2. 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 prints Transfer blocked: account is frozen.
  3. Thaw. thawAccount(...) unfreezes the account, and the same transfer goes through. The holder ends with 90 EXF.
Freezing only affects this one account: the holder’s other tokens, and everyone else’s EXF, keep moving.

​Next steps

Or build something real with a tutorial: