docs: align TS SDK docs with post-FA APT patterns (aptos-ts-sdk #852)#404
docs: align TS SDK docs with post-FA APT patterns (aptos-ts-sdk #852)#404gregnazario merged 2 commits intomainfrom
Conversation
- Use getAccountAPTAmount instead of getAccountResource(CoinStore) - Add maxGasAmount for devnet faucet compatibility - Match aptos-ts-sdk PR #852 patterns (en + zh)
- Fetch Data: getAccountAPTAmount + generic getAccountResource example (en, zh) - First transaction: correct balance-check notes; zh uses aptos_account::transfer - Account abstraction: aptos_account::transfer; fix invalid new build.simple (en, zh)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the Aptos docs (EN + ZH) to align TypeScript (and some Python) SDK examples with post–Fungible Asset migration patterns, avoiding reliance on legacy CoinStore<...AptosCoin> resources that may be absent for new accounts.
Changes:
- Updated TS SDK quickstarts/examples to use
getAccountAPTAmountfor APT balances and0x1::aptos_account::transferfor transfers. - Added
options: { maxGasAmount: 100_000 }to TS transaction build examples to better fit common devnet faucet funding assumptions. - Refreshed account abstraction and first-transaction guides (EN + ZH) to use
aptos_account::transfer, adjusted explanatory asides, and removed an unused Python import (ZH).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/content/docs/build/sdks/ts-sdk/quickstart.mdx | Switches balance reads to getAccountAPTAmount, updates transfer function, adds maxGasAmount option. |
| src/content/docs/zh/build/sdks/ts-sdk/quickstart.mdx | Same as EN quickstart changes, localized. |
| src/content/docs/build/sdks/ts-sdk/fetch-data-via-sdk.mdx | Adds FA-migration note, leads with getAccountAPTAmount, updates generic resource example to 0x1::account::Account. |
| src/content/docs/zh/build/sdks/ts-sdk/fetch-data-via-sdk.mdx | Same as EN fetch-data changes, localized. |
| src/content/docs/build/sdks/ts-sdk/account/account-abstraction.mdx | Updates transfer entry function to aptos_account::transfer and fixes an invalid new ...build.simple usage to await ...build.simple. |
| src/content/docs/zh/build/sdks/ts-sdk/account/account-abstraction.mdx | Same as EN account-abstraction changes, localized. |
| src/content/docs/build/guides/first-transaction.mdx | Updates asides to describe post-FA balance lookup behavior (TS + Python). |
| src/content/docs/zh/build/guides/first-transaction.mdx | Updates TS/Python transfer examples to aptos_account::transfer and removes unused Python import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## Using Generic Queries | ||
|
|
||
| Some queries are intentionally broad, but this can make inferring the proper return type difficult. To accommodate that, these broad requests like `getAccountResources` allow you to specify what the expected response type should be. | ||
| Some queries are intentionally broad, but this can make inferring the proper return type difficult. To accommodate that, broad requests like `getAccountResources` allow you to specify what the expected response type should be when you use `getAccountResource`. |
There was a problem hiding this comment.
The wording here is internally inconsistent: it cites getAccountResources as the “broad request”, but then says you specify the expected type “when you use getAccountResource”. Since the example is getAccountResource<T>(...), consider rephrasing to describe getAccountResource (or show an example for getAccountResources) to avoid confusing readers about which API supports generic typing.
| Some queries are intentionally broad, but this can make inferring the proper return type difficult. To accommodate that, broad requests like `getAccountResources` allow you to specify what the expected response type should be when you use `getAccountResource`. | |
| Some queries are intentionally broad, but this can make inferring the proper return type difficult. To accommodate that, broad requests like `getAccountResource` allow you to specify the expected response type by using a generic type parameter. |
| ## 使用通用查询 | ||
|
|
||
| 某些查询设计上是宽泛的,但这可能使得推断正确的返回类型变得困难.为了适应这种情况,像 `getAccountResources` 这样的广泛请求允许你指定预期的响应类型. | ||
| 某些查询设计上是宽泛的,但这可能使得推断正确的返回类型变得困难.为了适应这种情况,像 `getAccountResources` 这样的广泛请求允许你在使用 `getAccountResource` 时指定预期的响应类型. |
There was a problem hiding this comment.
This sentence mixes getAccountResources and getAccountResource in a way that’s confusing: it says broad requests like getAccountResources let you specify the expected type “when using getAccountResource”. Since the snippet uses getAccountResource<T>(...), consider rewriting to directly explain getAccountResource’s generic type parameter (or add a separate example for getAccountResources).
| 某些查询设计上是宽泛的,但这可能使得推断正确的返回类型变得困难.为了适应这种情况,像 `getAccountResources` 这样的广泛请求允许你在使用 `getAccountResource` 时指定预期的响应类型. | |
| 某些查询在设计上是宽泛的,但这可能使得推断正确的返回类型变得困难.为了解决这一问题,你可以在调用 `getAccountResource<T>` 时通过泛型类型参数 `T` 明确指定预期的响应类型,从而让 TypeScript 正确推断返回值. |
| function: "0x1::aptos_account::transfer", | ||
| functionArguments: [bob.accountAddress, 100], | ||
| }, | ||
| // Lower default gas fits typical devnet faucet funding (1 APT) |
There was a problem hiding this comment.
The comment implies maxGasAmount maps directly to an APT budget, but maxGasAmount is a gas unit cap; the maximum fee is maxGasAmount * gasUnitPrice (in octas). Consider adjusting the wording to avoid suggesting a direct “1 APT” equivalence, or mention the fee formula to prevent misunderstandings.
| // Lower default gas fits typical devnet faucet funding (1 APT) | |
| // Gas unit cap suitable for typical devnet faucet funding (for example, 1 APT); | |
| // actual max fee paid is maxGasAmount * gasUnitPrice (in octas) |
| function: "0x1::aptos_account::transfer", | ||
| functionArguments: [bob.accountAddress, 100], | ||
| }, | ||
| // 降低默认 gas 上限以适配常见 devnet 水龙头额度(1 APT) |
There was a problem hiding this comment.
这里的注释把 maxGasAmount 和「1 APT」直接关联容易误导:maxGasAmount 是 gas 单位上限,最大手续费实际是 maxGasAmount * gasUnitPrice(octas)。建议改写注释,避免让读者误以为 maxGasAmount 直接表示 APT 额度,或补充手续费计算方式。
| // 降低默认 gas 上限以适配常见 devnet 水龙头额度(1 APT) | |
| // 将默认 gas 上限设为 100_000 个 gas 单位。实际最高手续费为 maxGasAmount * gasUnitPrice(以 octa 计),请根据账户余额(例如 devnet 常见的 1 APT 水龙头额度)调整。 |
Summary
Mirrors the intent of aptos-ts-sdk#852: after the Fungible Asset migration, new accounts may not have legacy
CoinStore<...AptosCoin>, so docs should usegetAccountAPTAmountand0x1::aptos_account::transferfor APT quickstarts and examples.Changes
getAccountResource+CoinStorebalance reads withgetAccountAPTAmount; addmaxGasAmount: 100_000ontransaction.build.simplefor typical devnet faucet limits; useTRANSFER_AMOUNTin the full example.getAccountAPTAmountand FA migration note; generic typing example now uses0x1::account::Accountinstead ofCoinStore.getAccountAPTAmount/ balance APIs instead of CoinStore.aptos_account::transfer; drop unusedTypeTagimport.aptos_account::transfer; fix invalidnew aptos.transaction.build.simplein the complex guide (ZH + EN).Testing
pnpm lintpnpm format:content(pre-commit remark on staged MDX)astro check(pre-push)Notes
es/) tree is not present in this repo; EN + ZH updated per project guidelines.