Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/run-confidential-assets-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ runs:
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v4

# Run package install at root. This sets up the parent vitest config.
# Run package install for all workspace members.
- run: pnpm install --frozen-lockfile
shell: bash

# Install the dependencies for the Confidential Assets tests
- run: cd confidential-assets && pnpm install --frozen-lockfile
# Build the root SDK so confidential-assets can resolve @aptos-labs/ts-sdk.
- run: pnpm build
shell: bash

# Run the Confidential Assets tests.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ examples/typescript/facoin/facoin.json
.env
.env.*
*.tgz

# Turborepo
.turbo
66 changes: 47 additions & 19 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,52 @@ This is the **Aptos TypeScript SDK** (`@aptos-labs/ts-sdk`), a comprehensive SDK
- **Node**: use the version in `.node-version` (currently `v22.12.0`). `package.json` requires `node >= 20`.
- **pnpm**: repo uses `pnpm` (see `.tool-versions`, `package.json#packageManager`).

## Repo Layout

- **SDK source**: `src/`
- **SDK tests**: `tests/`
- Vitest uses `tests/preTest.ts` (globalSetup with setup/teardown) to start/stop a local Aptos node.
- **Examples**: `examples/`
- `examples/typescript`, `examples/typescript-esm`, `examples/javascript` use a **linked** SDK (`link:../..`).
- **Confidential assets SDK**: `confidential-assets/` (separate package + tests)
- **Docs output**: `docs/` (large; includes versioned typedoc output)
- **Utility scripts**: `scripts/` (`checkVersion.sh`, `updateVersion.sh`, `generateDocs.sh`)
## Repo Layout (Turborepo Monorepo)

This repository uses **Turborepo** for monorepo orchestration with **pnpm workspaces**.

- **Root package** (`@aptos-labs/ts-sdk`): The main SDK lives at the repository root
- `src/` — SDK source
- `tests/` — SDK tests (Vitest uses `tests/preTest.ts` globalSetup to start/stop a local Aptos node)
- `scripts/` — Utility scripts (`checkVersion.sh`, `updateVersion.sh`, `generateDocs.sh`)
- **`packages/`** — Shared libraries and internal packages (add new packages here)
- **`apps/`** — Applications (add new apps here)
- **`confidential-assets/`** — Confidential assets SDK (workspace member)
- **`examples/`** — Example projects (workspace members, use `workspace:*` for SDK dependency)
- **`projects/`** — Demo projects like gas-station (workspace members)
- **`docs/`** — Versioned TypeDoc output (large; generated)
- **`turbo.json`** — Turborepo task pipeline configuration
- **`pnpm-workspace.yaml`** — pnpm workspace package definitions

## Common Commands

### SDK-specific (root package)

```bash
pnpm install # Install dependencies (CI uses --frozen-lockfile)
pnpm build # Build CJS + ESM output to dist/
pnpm fmt # Format code with Biome
pnpm install # Install all workspace dependencies
pnpm build # Build the SDK (CJS + ESM output to dist/)
pnpm fmt # Format SDK code with Biome
pnpm _fmt # Check formatting without writing (what CI runs)
pnpm lint # Run Biome linter
pnpm check # Run Biome check (lint + format)
pnpm test # Run all tests (unit + e2e)
pnpm lint # Run Biome linter on SDK
pnpm check # Run Biome check (lint + format) on SDK
pnpm test # Run all SDK tests (unit + e2e)
vitest run <file> # Run a specific test file (e.g., vitest run keyless.test.ts)
pnpm doc # Generate TypeDoc documentation
pnpm check-version # Verify version consistency across files
pnpm update-version # Bump version everywhere + regenerate docs
pnpm indexer-codegen # Generate GraphQL types from indexer schema
```

### Turborepo workspace-wide commands

```bash
pnpm build:all # Build all workspace packages via Turborepo
pnpm test:all # Test all workspace packages via Turborepo
pnpm lint:all # Lint all workspace packages via Turborepo
pnpm check:all # Check all workspace packages via Turborepo
pnpm fmt:all # Format all workspace packages via Turborepo
```

## Commit Guidelines

Before every commit:
Expand Down Expand Up @@ -91,12 +109,20 @@ pnpm test

### Confidential Assets Package

The confidential-assets package is a pnpm workspace member. Its dependencies are installed with the root `pnpm install` — no separate install step is needed.

```bash
pnpm install --frozen-lockfile
cd confidential-assets && pnpm install --frozen-lockfile
pnpm install # Installs deps for all workspace members
cd confidential-assets && pnpm test
```

Or build/test everything via Turborepo:

```bash
pnpm build:all # Builds SDK first, then confidential-assets
pnpm test:all # Tests all workspace packages
```

When changing shared infra (vitest config, root tooling), ensure confidential-assets still works.

## Architecture
Expand Down Expand Up @@ -164,8 +190,10 @@ const aptos = new Aptos(new AptosConfig({ network: Network.TESTNET, clientConfig
## Guardrails

- **Prefer the repo scripts** (`pnpm build`, `pnpm test`, `pnpm check`, `pnpm fmt`) over ad-hoc commands.
- **Use turbo scripts** (`pnpm build:all`, `pnpm test:all`) when changes span multiple workspace packages.
- **Avoid massive diffs in `docs/`** unless the change is intentionally about docs generation/version bumps.
- Keep changes tight and CI-aligned; if you touch build/lint/test infra, run the corresponding commands locally.
- **Adding new packages**: Create a new directory under `packages/` (for libraries) or `apps/` (for applications) with its own `package.json`. It will automatically be picked up by pnpm workspaces and Turborepo.

## Cursor Cloud specific instructions

Expand All @@ -183,7 +211,7 @@ Docker is pre-installed and the daemon is running. The Docker socket at `/var/ru

### Build Before Testing Examples

Examples under `examples/` link to the root SDK via `link:../..`. Always run `pnpm build` in the repo root before working with examples.
Examples under `examples/` are workspace members using `workspace:*` for the SDK dependency. Always run `pnpm build` in the repo root before working with examples.

### Known Flaky Test

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T
- Fix quickstart and example code that used deprecated `getAccountResource` with `CoinStore` to check balances; replaced with `getAccountAPTAmount` which works after the FungibleAsset migration
- Update `simple_transfer` examples (TypeScript, TypeScript ESM, JavaScript) and `multi_agent_transfer` to use `getAccountAPTAmount` instead of `0x1::coin::balance` view function
- Update `simple_transfer` and JavaScript examples to use `0x1::aptos_account::transfer` instead of `0x1::coin::transfer`
- Increase `confidential-assets` test funding from 1 APT to 10 APT to prevent `INSUFFICIENT_BALANCE_FOR_TRANSACTION_FEE` failures after the default `maxGasAmount` increase to 2,000,000

## Added

- Add Turborepo monorepo configuration with `turbo.json` and `pnpm-workspace.yaml` for orchestrating builds, tests, and linting across multiple packages
- Add `packages/` and `apps/` directories for organizing new workspace packages and applications
- Add turbo-powered workspace scripts: `build:all`, `test:all`, `lint:all`, `check:all`, `fmt:all`
- Wire up `confidential-assets` as a pnpm workspace member with `workspace:*` protocol for the `@aptos-labs/ts-sdk` dependency
- Add e2e tests for external signer flow (build → getSigningMessage → sign externally → submit) to verify the flow works correctly with the latest SDK version
- Add MultiKey (K-of-N mixed key types) transfer example (`examples/typescript/multikey_transfer.ts`)
- Add MultiEd25519 (K-of-N Ed25519) transfer example (`examples/typescript/multi_ed25519_transfer.ts`)
Expand Down
26 changes: 22 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

This is the **Aptos TypeScript SDK** (`@aptos-labs/ts-sdk`), a comprehensive SDK for interacting with the Aptos blockchain. It provides account management, transaction building/submission, data querying, digital assets, keyless authentication, and more.

## Monorepo Structure

This repository uses **Turborepo** with **pnpm workspaces**. The main SDK lives at the root; additional packages go in `packages/` and apps in `apps/`.

## Common Commands

### SDK-specific (root package)

```bash
pnpm install # Install dependencies (CI uses --frozen-lockfile)
pnpm build # Build CJS + ESM output to dist/
pnpm install # Install all workspace dependencies
pnpm build # Build the SDK (CJS + ESM output to dist/)
pnpm fmt # Format code with Biome
pnpm _fmt # Check formatting without writing (what CI runs)
pnpm lint # Run Biome linter
Expand All @@ -23,6 +29,16 @@ pnpm update-version # Bump version everywhere + regenerate docs
pnpm indexer-codegen # Generate GraphQL types from indexer schema
```

### Turborepo workspace-wide commands

```bash
pnpm build:all # Build all workspace packages via Turborepo
pnpm test:all # Test all workspace packages via Turborepo
pnpm lint:all # Lint all workspace packages via Turborepo
pnpm check:all # Check all workspace packages via Turborepo
pnpm fmt:all # Format all workspace packages via Turborepo
```

## Commit Guidelines

Before every commit:
Expand Down Expand Up @@ -77,8 +93,10 @@ const aptos = new Aptos(new AptosConfig({ network: Network.TESTNET }));

## Related Packages

- `examples/` - TypeScript/JS examples using linked SDK (`link:../..`)
- `confidential-assets/` - Separate confidential assets SDK package
- `packages/` - Shared libraries and internal packages (add new packages here)
- `apps/` - Applications (add new apps here)
- `confidential-assets/` - Confidential assets SDK (workspace member)
- `examples/` - TypeScript/JS examples (workspace members, use `workspace:*` for SDK dependency)
- `projects/` - Demo projects (gas station)

## Version Management
Expand Down
Empty file added apps/.gitkeep
Empty file.
9 changes: 1 addition & 8 deletions confidential-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@noble/hashes": "^1.5.0"
},
"devDependencies": {
"@aptos-labs/ts-sdk": "workspace:*",
"@swc/cli": "^0.8.0",
"@swc/core": "^1.15.18",
"@types/node": "^22.19.13",
Expand All @@ -61,13 +62,5 @@
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"vitest": "^4.0.18"
},
"pnpm": {
"overrides": {
"glob@^10": "^10.5.0",
"minimatch@^9": "^9.0.7",
"file-type": "21.3.3",
"yauzl": "3.2.1"
}
}
}
Loading
Loading