Skip to content

New version of Fast SDK#52

Open
KcatMa wants to merge 25 commits intomainfrom
new-fast-sdk
Open

New version of Fast SDK#52
KcatMa wants to merge 25 commits intomainfrom
new-fast-sdk

Conversation

@KcatMa
Copy link
Copy Markdown
Contributor

@KcatMa KcatMa commented Apr 4, 2026

No description provided.

kaichii and others added 25 commits March 26, 2026 17:08
…ation

- Deleted multiple test files including config, entrypoints, errors, keys, rpc, and utils tests to streamline the codebase.
- Introduced a new base TypeScript configuration file (tsconfig.base.json) to standardize compiler options across the project.
- Updated the main tsconfig.json to reference the new base configuration and set up project references for better modularity.
- Added a turbo.json file to manage build tasks and improve development workflow.
…functionality

- Introduced FAST_NETWORK_IDS constant for network identification.
- Removed serialization and hashing functions from schema, moving them to a new utils module.
- Updated types to enforce FastNetworkId in transactions.
- Created a new FastProvider class with improved transaction submission and account info retrieval.
- Added normalization functions for address and signature handling.
- Implemented tests for FastProvider and Signer to ensure correct functionality.
- Enhanced Signer class to support typed data signing and verification.
Migrate x402-sdk into the fast-sdk monorepo as a new package.
Rewrites all imports to use @fastxyz/fast-sdk, @fastxyz/allset-sdk,
and @fastxyz/fast-schema workspace dependencies.

Key changes:
- AllSetProvider → executeIntent() + FastWalletLike adapter
- FastWallet.send() → TransactionBuilder + Signer + FastProvider
- BCS types from @fastxyz/fast-schema bcsSchema
- getCertificateHash → hashHex(bcsSchema.VersionedTransaction, ...)
- Hardcoded network configs (no AllSetProvider dependency)
…tion

- Introduced x402-server package with types, utilities, middleware, and payment handling.
- Added x402-types package for shared types and utilities across x402 ecosystem.
- Implemented tests for middleware, payment functions, and utilities in x402-server.
- Created comprehensive type definitions for payment requirements, network configurations, and utility functions.
- Established TypeScript configuration for both packages.
- Included README and documentation for x402-types with usage examples.
feat: add @fastxyz/x402-sdk package
* feat(fast-cli) cli up to fast

* refactor(fast-cli) output logic

* fix(fast-cli) fix pnpm lock

* fix(fast-cli) import problem

* Add missing bech32 dependency

* Fix RPC URLs

* Fix info balance schema mismatch

* Finish the fast send command functionalities

* Add pre-commit Prettier format hook and format all the files to keep files formatting consistent

* feat: refactor bridge logic and extract claim handling into separate modules

* refactor: simplify function signatures and improve formatting in claims.ts

* Enhance history and send command functionalities with portal API integration and token resolution improvements

* Remove pre-commit auto formatting hook

* refactor(fast-cli) remove redundant helper function

* feat(fast-cli): scaffold citty runner and global args

* refactor(fast-cli): migrate account commands to citty

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): migrate network commands to citty

* refactor(fast-cli): migrate info commands to citty

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(fast-cli): validate --limit/--offset are non-negative integers

* refactor(fast-cli): migrate send command to citty

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): wire citty root command and entrypoint

Remove @effect/cli from cli-config.ts (rootOptions/provideCliConfig no longer needed), rewrite cli.ts with citty defineCommand, and rewrite main.ts with runMain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style(fast-cli): apply biome formatter to network-config.ts

* fix(fast-cli): restore --json envelope for citty arg-parsing errors

* fix(fast-cli): strip ANSI escapes from JSON error messages

* fix(fast-cli): wrap key-file IO in Effect.try for typed errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(fast-cli): wrap fromHex in Effect.try for typed hex errors

* refactor(fast-cli): defer file validation to NetworkConfig.add

* fix(fast-cli): catch RPC failures with Effect and fix address field

* refactor(fast-cli): split errors by domain and add mapToStorageError helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): use mapToStorageError helper in storage services

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(fast-cli): use InvalidConfigError for custom network decode failure

* refactor(fast-cli): preserve service error types in send handler

Remove the .pipe(Effect.mapError(...)) that was converting NetworkNotFoundError
and other service errors into TransactionFailedError, erasing specific error
types and producing misleading exit codes (TX_FAILED instead of NETWORK_NOT_FOUND).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli) password service

* docs(fast-cli): SQLite storage refactor spec and plan

* chore(fast-cli): add better-sqlite3, remove proper-lockfile

* feat(fast-cli): add crypto module for seed encrypt/decrypt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add SQLite database service

* refactor(fast-cli): rewrite account-store with SQLite

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): rewrite history-store with SQLite

* refactor(fast-cli): rewrite network-config with SQLite

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): wire SQLite layer, delete JSON storage

Replace NodeContext/KeystoreV3 foundation with DatabaseLive, move
AccountStoreLive to tier1, fix send.ts to use makeHistoryEntry instead
of HistoryEntry class constructor. Delete keystore-v3.ts, schemas/keyfile.ts,
and schemas/accounts.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(fast-cli): Drizzle adoption spec/plan + crypto.ts lint

* feat(fast-cli): add Drizzle schema and config

* refactor(fast-cli): wrap better-sqlite3 in Drizzle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): use Drizzle queries in account-store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): use Drizzle queries in history-store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): use Drizzle queries in network-config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): replace raw SQL bootstrap with Drizzle migrations

* refactor(fast-cli): database using migrate

* refactor(fast-cli): merge password + confirm into unified Prompt service

* style(fast-cli): refactor prompt.ts with type aliases and factory functions

* fix(fast-cli): distinguish Ctrl+C (cancel error) from declining (silent return) in confirm prompt

* style(fast-cli) change the structure of service files

* refactor(fast-cli): centralize env vars in Env service

* refactor(fast-cli): use Option for env vars

* refactor(fast-cli): restructure config service + optique migration docs

* chore(fast-cli): add @optique/core, remove citty

* feat(fast-cli): define optique parser tree for all commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(fast-cli): create app.ts with unified layer + runner

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): unified entrypoint with optique parse + error handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor(fast-cli): update all command files to optique handler pattern

Convert all 16 leaf command files from citty defineCommand wrappers to
plain Effect handler functions, delete the 3 citty subcommand index
files, and add missing EnvLive to the app layer so PromptLive resolves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): rename Output ok/fail, remove Env service, delete old bootstrap files

- Rename OutputShape.success → ok and .error → fail; update all callers
- Remove Env service (env.ts deleted); password env-var now resolved by optique
- Simplify PromptLive: drop Env dependency and env fallback check in passwordPrompt
- Delete cli-globals.ts, cli-runner.ts, layers.ts (replaced by app.ts in Task 5)
- Remove unused @clack/prompts dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): unified error handling via InternalError + writeFail

* refactor(fast-cli): use runParserSync for auto help/version/error handling

* docs(fast-cli): add descriptions to all CLI commands

* style(fast-cli): linter fixes + help-text polish plan

* docs(fast-cli): add metavars and descriptions to all CLI options

Every option(), argument(), string(), and integer() call in cli.ts now
has a descriptive metavar and/or description so --help output is
agent-friendly (no bare STRING tokens remain).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): replace dispatch switch with handler registry

Removes 16 static handler imports and a 40-line switch block, replacing
them with a Record<CommandName, () => Promise<Handler>> registry that
uses dynamic import(). Adding a new command is now a one-line addition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(fast-cli): command registry plan + main.ts lint

* refactor(fast-cli): export globalOptions + add globalPreParser with passThrough

* refactor(fast-cli): export { cmd, handler } from all command files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add commands barrel for array dispatch

* refactor(fast-cli): two-pass parse + command array dispatch, zero raw argv

* refactor(fast-cli): Option.fromNullable, Command type, VERSION to constants

* refactor(fast-cli): annotate all commands with Command type, remove all casts

* fix(fast-cli): fix Command handler type — use any for args, safety from parser

* refactor(fast-cli): generic Command<TArgs> — zero any, type-safe at definition

* fix(fast-cli): proper type-safe dispatch with die() helper and one documented cast

* refactor(fast-cli): add AllSet service, remove direct SDK imports from send.ts

* style(fast-cli) biome format

* feat(fast-cli): add NoDefaultNetworkError

* refactor(fast-cli): move exitCode/errorCode onto error classes, delete maps

Each error class now carries its own readonly exitCode (1 or 2) and
errorCode (SCREAMING_SNAKE_CASE) fields. Removes exitCodeMap, errorCodeMap,
toExitCode, and toErrorCode; adds CliErrorMeta interface. Callers updated
to use err.exitCode and err.errorCode directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): replace NetworkError with FastSdkError for SDK failures

* fix(fast-cli): extract message from SDK errors instead of String(e)

* refactor(fast-cli): align CustomNetworkConfig with NetworkConfig, user provides networkId

* docs(fast-cli): schema-first config spec + plan + fast.ts lint

* feat(fast-cli): add JSON manifests, derive types from schemas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add AppConfig service with pure functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): rename Config → ClientConfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(fast-cli): wire AppConfig, update consumers, delete bundled.ts + constants.ts

* refactor(fast-cli): adopt Effect.Service, add database query helper, fix error imports

- Convert storage services (network, account, history) from Context.Tag +
  separate Layer to Effect.Service pattern — types are inferred, no manual
  shape interfaces or type aliases needed.
- Add `query` helper to DatabaseShape that wraps sync db operations in
  Effect.try with DatabaseError, replacing ad-hoc Effect.try/StorageError
  throughout storage layer.
- Extract method implementations as top-level functions to keep flat
  indentation while Effect.Service wires them in the factory.
- Fix ClientError union importing DatabaseError from SDK instead of local
  io.ts (SDK version lacks exitCode/errorCode).
- Fix list() and remove() in network.ts using getDefault(db) as a sync
  value when it returns an Effect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(fast-cli): add fund & pay commands design spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(fast-cli): add fund & pay implementation plan

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(fast-cli): add payment error classes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add X402Service

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(fast-cli): add fund and pay parsers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add fund fiat command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add fund crypto command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add pay command

Implements the x402 pay command that supports dry-run inspection and
live payment via Fast and EVM wallets, with history recording.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): register fund fiat and fund crypto commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(fast-cli): resolve all pre-existing type errors

- Add FileIOError to ClientError union
- Remove stale helpers.js re-export
- Fix InvalidNetworkConfigError using { name } not { message }
- Fix TokenNotFoundError using { token } not { name }
- Cast viem types in allset.ts and send.ts (duplicate viem versions)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(fast-cli): derive help from parser, fix ramp URL

- Replace hardcoded top-level help with DocPage derived from parser
  definitions, split into "Commands" and "Global options" sections
- Handle --help after command tokens (e.g. `fast account --help`)
  via argv check + getDocPageSync contextual docs
- Fix fund fiat URL: ramp.fast.xyz (not allramp.fast.xyz)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(fast-cli): use correct ramp URL query param (?to=)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(fast-cli): add unencrypted keystore design spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(fast-cli): add unencrypted keystore implementation plan

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(fast-cli): add encrypted column to accounts schema

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add storeSeed/loadSeed routing functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): support unencrypted accounts in store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(fast-cli): add required option to password prompt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(fast-cli): use optional password in create/import

* feat(fast-cli): conditional password prompt for signing

* feat(fast-cli): update CLI entry point to main.ts and enhance JSON output handling

* refactor: rename fast-sdk to sdk across the repository

* refactor: update imports from @fastxyz/fast-sdk to @fastxyz/sdk across the codebase

* feat(fast-cli): enhance error handling with command suggestions and improve migration folder resolution

* fix: standardize table formatting and improve readability in SPEC.md

* feat(SPEC.md): enhance password handling and keyfile storage for non-interactive mode

---------

Co-authored-by: Yuqing Zhai <kevinzhai2003@outlook.com>
Co-authored-by: Xiaohong <xiaohong@fast.xyz>
Co-authored-by: Chenglong Ma <chenglong@fast.xyz>
Co-authored-by: Kai Qi <kai@fast.xyz>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants