Rewrite transaction docs for address balances and tx.coin/tx.balance#897
Rewrite transaction docs for address balances and tx.coin/tx.balance#897hayes-mysten wants to merge 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
42a9624 to
bbdd6b6
Compare
bbdd6b6 to
a88a4e8
Compare
a88a4e8 to
680b84a
Compare
680b84a to
d99280b
Compare
| Run it: | ||
|
|
||
| ```sh | ||
| node balance.js |
There was a problem hiding this comment.
we should probably use ts for our examples
d99280b to
cf957a1
Compare
cf957a1 to
25b1d80
Compare
32545fb to
50dcbbc
Compare
221c623 to
120e526
Compare
120e526 to
2f73513
Compare
2f73513 to
9328cc4
Compare
9328cc4 to
5fd1d81
Compare
5fd1d81 to
7b1b356
Compare
|
@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) |
7b1b356 to
4caa6c6
Compare
f893b9d to
4b43ed4
Compare
jessiemongeon1
left a comment
There was a problem hiding this comment.
Reviewed for style guide compliance, page structure/IA will be addressed in the docs audit we do in a few weeks
| 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. |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| 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 — |
There was a problem hiding this comment.
| 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) |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| 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) | |
There was a problem hiding this comment.
| | `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: |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| 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 |
| 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 |
There was a problem hiding this comment.
| 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 |
jessiemongeon1
left a comment
There was a problem hiding this comment.
Reviewed for style guide compliance, page structure/IA will be addressed in the docs audit we do in a few weeks
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>
4b43ed4 to
857cd21
Compare
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 oldtransaction-building/directory with a reorganized set of pages: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/listCoinswaitForTransaction, gas configuration (defaults, explicit settings, address balance gas,tx.gas), sponsored transactions (coin-based and address-balance flows)splitCoins,mergeCoins,transferObjects,moveCall,makeMoveVec,publish,upgrade) and input types (pure values, vectors/options, BCS, object references, object helpers, withdrawals)Other doc updates:
transaction-building/pages (basics, gas, sponsored-transactions, offline, intents)sui/meta.jsonto point to newtransactionssection, removes pages that no longer exist (install, llm-docs, hello-sui, faucet)Test plan
pnpm --filter @mysten/docs buildtx.coin()/tx.balance()API and resolver implementationAI Assistance Notice