$ show FuelLabs/fuels-ts
This repository is the official TypeScript SDK for the Fuel Network blockchain, structured as a monorepo using pnpm and Turbo. It provides a comprehensive suite of libraries for wallet management, transaction construction, smart contract interaction (contracts, predicates, scripts), and code generation from Sway ABIs. The codebase includes a CLI tool (`fuels`) for project scaffolding, building, deploying, and running local test nodes. It supports both Node.js and browser environments, evidenced by dual build configurations and React-based dApp templates. The architecture relies heavily on generated GraphQL operations and external binary dependencies (`forc`, `fuel-core`) which are managed internally via installation scripts.
The LLM identified 3 files worth highlighting for reuse:
Implements the core serialization logic for Fuel VM types. The AbstractCoder class defines the interface for encoding/decoding data structures, with specific implementations for complex types like Vec, Struct, Enum, and Option. This component demonstrates high craftsmanship by handling variable-length data, padding, and type resolution in a modular way, making it safely reusable for any project requiring ABI-compatible serialization.
Defines the `BaseTransactionRequest` and `ScriptTransactionRequest` classes. This module encapsulates the complex logic of building blockchain transactions, including policy management (Tip, MaxFee), UTXO funding, gas estimation, and resource caching. It abstracts away the low-level details of transaction assembly, allowing developers to construct valid transactions through a fluent API.
Orchestrates the generation of TypeScript types and factory classes from Sway contract ABIs. It uses Handlebars templates to render contract interfaces and factories based on the parsed ABI JSON. This component is reusable for any project needing type-safe interaction with compiled Sway programs, handling the bridge between the Sway compiler output and TypeScript consumption.