Skip to content

Rewrite transaction docs for address balances and tx.coin/tx.balance#897

Open
hayes-mysten wants to merge 4 commits intomainfrom
mh--address-balance-docs
Open

Rewrite transaction docs for address balances and tx.coin/tx.balance#897
hayes-mysten wants to merge 4 commits intomainfrom
mh--address-balance-docs

Conversation

@hayes-mysten
Copy link
Copy Markdown
Contributor

@hayes-mysten hayes-mysten commented Feb 25, 2026

Description

Rewrites the transaction documentation to cover the new address balance system and the tx.coin()/tx.balance() APIs added in #963.

Changes

New documentation section: transactions/ — replaces the old transaction-building/ directory with a reorganized set of pages:

  • basics.mdx — Building transactions from scratch: creating transactions, sending SUI/tokens, Move calls, codegen, chaining commands, batch transfers, thunks, serialization
  • coins-and-balances.mdx — Dedicated page for the coin/balance dual system: tx.coin(), tx.balance(), coinWithBalance, resolution paths (Path 1: all-balance direct withdrawal, Path 2: merge-and-split), manual coin operations, address balance withdrawals/deposits, getBalance/listCoins
  • signing-and-execution.mdx — Simulation, keypair signing, dApp Kit hooks, manual execution, result observation, waitForTransaction, gas configuration (defaults, explicit settings, address balance gas, tx.gas), sponsored transactions (coin-based and address-balance flows)
  • reference.mdx — Complete reference for all commands (splitCoins, mergeCoins, transferObjects, moveCall, makeMoveVec, publish, upgrade) and input types (pure values, vectors/options, BCS, object references, object helpers, withdrawals)
  • offline.mdx — Offline building with shared/party objects and address balances, owned object inputs, expiration configuration, serialization

Other doc updates:

  • Removes old transaction-building/ pages (basics, gas, sponsored-transactions, offline, intents)
  • Updates sui/meta.json to point to new transactions section, removes pages that no longer exist (install, llm-docs, hello-sui, faucet)
  • Minor fixes to other package docs (dapp-kit, bcs, zksend, kiosk, codegen index pages)

Test plan

  • Verified docs build with pnpm --filter @mysten/docs build
  • Reviewed all code examples for accuracy against the current tx.coin()/tx.balance() API and resolver implementation
  • Checked cross-links between pages

AI Assistance Notice

Please disclose the usage of AI. This is primarily to help inform reviewers of how careful they need to review PRs, and to keep track of AI usage across our team. Please fill this out accurately, and do not modify the content or heading for this section!

  • This PR was primarily written by AI.
  • I used AI for docs / tests, but manually wrote the source code.
  • I used AI to understand the problem space / repository.
  • I did not use AI for this PR.

@hayes-mysten hayes-mysten requested a review from a team as a code owner February 25, 2026 22:20
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sui-typescript-docs Ready Ready Preview, Comment Apr 10, 2026 6:18pm

Request Review

@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env February 25, 2026 22:21 — with GitHub Actions Inactive
Comment thread packages/bcs/README.md
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 25, 2026

⚠️ 🦋 Changesets Warning: This PR has changes to public npm packages, but does not contain a changeset. You can create a changeset easily by running pnpm changeset in the root of the Sui repo, and following the prompts. If your change does not need a changeset (e.g. a documentation-only change), you can ignore this message. This warning will be removed when a changeset is added to this pull request.

Learn more about Changesets.

Comment thread packages/docs/content/sui/clients/core.mdx Outdated
Comment thread packages/docs/content/sui/index.mdx Outdated
Run it:

```sh
node balance.js
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably use ts for our examples

@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 221c623 to 120e526 Compare March 28, 2026 05:02
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env March 28, 2026 05:02 — with GitHub Actions Inactive
@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 120e526 to 2f73513 Compare March 28, 2026 05:07
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env March 28, 2026 05:07 — with GitHub Actions Inactive
@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 2f73513 to 9328cc4 Compare March 28, 2026 05:15
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env March 28, 2026 05:15 — with GitHub Actions Inactive
@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 9328cc4 to 5fd1d81 Compare March 28, 2026 05:18
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env March 28, 2026 05:18 — with GitHub Actions Inactive
@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 5fd1d81 to 7b1b356 Compare March 28, 2026 05:18
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env March 28, 2026 05:19 — with GitHub Actions Inactive
@hayes-mysten
Copy link
Copy Markdown
Contributor Author

@jessiemongeon1 this PR rewrites a big chunk of the docs to be more inline with how we want people to create transactions and updates everything to use address balances (where appropriate)

Copy link
Copy Markdown
Contributor

@jessiemongeon1 jessiemongeon1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed for style guide compliance, page structure/IA will be addressed in the docs audit we do in a few weeks

Comment on lines +6 to +13
Every interaction with the Sui network goes through a transaction. Sui transactions are
[programmable transaction blocks (PTBs)](https://docs.sui.io/guides/developer/transactions/prog-txn-blocks)
— a sequence of commands that execute on inputs to produce a result. Commands within a transaction
can call Move functions, transfer objects, split and merge coins, and more. You can chain the result
of one command into a subsequent command, composing complex operations in a single transaction.

All commands in a transaction execute atomically: if any command fails, the entire transaction is
rolled back and none of its effects are applied.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every interaction with the Sui network goes through a transaction. Sui transactions are
[programmable transaction blocks (PTBs)](https://docs.sui.io/guides/developer/transactions/prog-txn-blocks)
— a sequence of commands that execute on inputs to produce a result. Commands within a transaction
can call Move functions, transfer objects, split and merge coins, and more. You can chain the result
of one command into a subsequent command, composing complex operations in a single transaction.
All commands in a transaction execute atomically: if any command fails, the entire transaction is
rolled back and none of its effects are applied.
Every interaction with the Sui network goes through a transaction. Sui transactions are a sequence of commands called [programmable transaction blocks (PTBs)](https://docs.sui.io/guides/developer/transactions/prog-txn-blocks) that execute on inputs to produce a result. Commands within a transaction can call Move functions, transfer objects, split and merge coins, and more. You can chain the result
of one command into a subsequent command, composing complex operations in a single transaction.
All commands in a transaction execute atomically. If any command fails, the entire transaction is
rolled back and none of its effects are applied.

All commands in a transaction execute atomically: if any command fails, the entire transaction is
rolled back and none of its effects are applied.

For a deeper look at the transaction model, see the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For a deeper look at the transaction model, see the
For more information on transaction model, see the


## Sending SUI

The preferred way to send SUI is with `tx.balance()` and `balance::send_funds`, which deposits
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The preferred way to send SUI is with `tx.balance()` and `balance::send_funds`, which deposits
It is recommended to send SUI is with `tx.balance()` and `balance::send_funds`, which deposits

tx.transferObjects([tx.coin({ balance: 1n * MIST_PER_SUI })], '0xRecipientAddress');
```

Both `tx.balance()` and `tx.coin()` automatically draw from your coin objects and address balances —
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Both `tx.balance()` and `tx.coin()` automatically draw from your coin objects and address balances
Both `tx.balance()` and `tx.coin()` automatically draw from your coin objects and address balances.

```

Both `tx.balance()` and `tx.coin()` automatically draw from your coin objects and address balances —
you don't need to manage individual coins yourself. See [Coins and Balances](./coins-and-balances)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
you don't need to manage individual coins yourself. See [Coins and Balances](./coins-and-balances)
You don't need to manage individual coins yourself. See [Coins and Balances](./coins-and-balances)


## Sign without executing

Sometimes you need the signature without immediately executing — for multi-sig, sponsored
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sometimes you need the signature without immediately executing for multi-sig, sponsored
Sometimes you need the signature without immediately executing, such as for multi-sig, sponsored

| Field | Description |
| ---------------- | --------------------------------------------------- |
| `transaction` | The full transaction data (sender, commands, gas) |
| `effects` | Execution effects (created/mutated/deleted objects) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `effects` | Execution effects (created/mutated/deleted objects) |
| `effects` | Execution effects (created, mutated, or deleted objects) |


### Checking success or failure

Every transaction result is a discriminated union — always check which variant you received:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every transaction result is a discriminated union — always check which variant you received:
Every transaction result is a discriminated union. Always check which variant you received:


## Gas configuration

Every Sui transaction costs gas. The SDK handles gas automatically in most cases — it sets the gas
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every Sui transaction costs gas. The SDK handles gas automatically in most cases — it sets the gas
Every Sui transaction costs gas. The SDK handles gas automatically in most cases. It sets the gas

Comment on lines +264 to +266
1. **Gas price** — uses the network's reference gas price
2. **Gas budget** — simulates the transaction and uses the result to set an appropriate budget
3. **Gas payment** — uses address balances, falling back to coin objects when the balance is below
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. **Gas price** — uses the network's reference gas price
2. **Gas budget** — simulates the transaction and uses the result to set an appropriate budget
3. **Gas payment** — uses address balances, falling back to coin objects when the balance is below
1. **Gas price**: Uses the network's reference gas price
2. **Gas budget**: Simulates the transaction and uses the result to set an appropriate budget
3. **Gas payment**: Uses address balances, falling back to coin objects when the balance is below

Copy link
Copy Markdown
Contributor

@jessiemongeon1 jessiemongeon1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed for style guide compliance, page structure/IA will be addressed in the docs audit we do in a few weeks

hayes-mysten and others added 4 commits April 10, 2026 11:07
Move docs to new directory structure. Content rewrite follows in next commit.

- basics.mdx → transactions/basics.mdx
- offline.mdx → transactions/offline.mdx
- intents.mdx → transactions/coins-and-balances.mdx
- gas.mdx → transactions/signing-and-execution.mdx
- _meta.json → transactions/meta.json
- Delete sponsored-transactions.mdx (merged into signing-and-execution.mdx)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrite all transaction documentation to cover address balances,
tx.coin(), tx.balance(), and the new intent resolution system.

- basics.mdx: Use tx.coin() as primary API, add codegen, thunks, serialization
- coins-and-balances.mdx: Full rewrite covering dual coin/balance system,
  resolution paths, tx.withdrawal(), manual operations, getBalance/listCoins
- signing-and-execution.mdx: Full rewrite covering simulation, keypair signing,
  dApp Kit, sponsored transactions (coin-based and address-balance flows),
  gas configuration, waitForTransaction
- reference.mdx: New comprehensive command and input reference
- offline.mdx: Rewrite for address balance workflows, party objects, expiration
- Update other doc pages for consistency (dapp-kit, bcs, kiosk, etc.)

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

- Add gasless transactions section to coins-and-balances docs aligned
  with Sui docs PR language and linking to upstream guides
- Update sui-tools Docker image to 53de0108 (latest with arm64 support)
- Fix grpc-transport e2e test to dynamically import optional native gRPC
  dependencies so the file loads and skips gracefully when not installed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add internal link and anchor validation to docs validation script
- Add `test` script to docs package so validation runs in CI
- Fix broken links:
  - kiosk managing.mdx: anchor → page link for kiosk-transaction
  - kiosk purchasing.mdx: fix anchor slug for introduction heading
  - migrations/0.38.mdx: fix anchor slug (#module-packages → #module-structure)
  - migrations/sui-1.0.mdx: fix link to removed intents page

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hayes-mysten hayes-mysten force-pushed the mh--address-balance-docs branch from 4b43ed4 to 857cd21 Compare April 10, 2026 18:15
@hayes-mysten hayes-mysten temporarily deployed to sui-typescript-aws-kms-test-env April 10, 2026 18:15 — with GitHub Actions Inactive
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.

2 participants