algorand-typescript

Enforces syntax rules and AVM patterns for Algorand TypeScript smart contracts.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/Rudhrakoushik10/RootNode --skill algorand-typescript-rudhrakoushik10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: algorand-typescript
Source: https://github.com/Rudhrakoushik10/RootNode/tree/main/projects/.opencode/skill/algorand-typescript
Command: npx skills add https://github.com/Rudhrakoushik10/RootNode --skill algorand-typescript-rudhrakoushik10

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Algorand smart contracts in TypeScript (PuyaTs) fails when developers use standard JavaScript patterns like number types, union types, or reference semantics, causing Puya compiler errors and runtime failures. ## Core Features & Use Cases - AVM Type Rules: Enforces uint64, bytes, and biguint usage instead of JavaScript number, with correct constructors like Uint64(). - Value Semantics Guidance: Explains when and why to use clone() for structs, arrays, and storage reads/writes. - Storage Patterns: Covers GlobalState, LocalState, Box, and BoxMap including MBR funding requirements for box storage. - Transactions & ABI: Details group transactions (gtxn), inner transactions (itxn) with fee pooling, method decorators, and lifecycle methods. - Use Case: When a Puya compiler error appears for Item | null union types or BoxMap writes fail, consult this Skill to apply the correct AVM-compatible pattern. ## Quick Start Ask how to fix a Puya compiler error or how to use a specific Algorand TypeScript feature like BoxMap, clone(), or inner transactions.

Frequently Asked Questions about algorand-typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Puya compiler errors in Algorand TypeScript?

Puya compiler errors usually come from using JavaScript patterns unsupported by the AVM. Replace `number` with `uint64` via `Uint64()`, remove union types like `Item | null`, and clone complex types before storage writes or array iteration.

What is clone() used for in Algorand TypeScript?

The clone() function enforces AVM value semantics for complex types like structs and arrays. Use it when reading from GlobalState, Box, BoxMap, or LocalState, when writing structs to storage, and before iterating arrays.

How do I use BoxMap storage in Algorand smart contracts?

BoxMap provides per-key storage without requiring user opt-in, declared as `BoxMap<Account, UserData>({ keyPrefix: 'u' })`. The app account must be funded first because each box increases the Minimum Balance Requirement.

Why does Algorand TypeScript reject JavaScript number types?

JavaScript `number` is signed and floating-point, while the AVM requires unsigned 64-bit integers. Puya rejects `number` entirely, so declare values as `uint64` and construct them with `Uint64()`, using `biguint` for values above 2^64.

How do inner transactions work in PuyaTs contracts?

Inner transactions use lowercase methods like `itxn.payment({ ... }).submit()` from the algorand-typescript package. Always set `fee: Uint64(0)` so the outer caller covers fees through fee pooling, preventing app account drain.

Can I use union types or string.length in Algorand TypeScript?

No, union types like `Item | null` and `string.length` are not supported by the AVM. Use boolean flags with default-initialized values instead of nullables, and check empty strings with `text !== ''`.