From 756d37bb10ced7af7c510d8a1a75067ff834b0c3 Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Fri, 27 Sep 2024 04:16:55 +0800 Subject: [PATCH] [update] fa --- apps/nextra/next-env.d.ts | 2 +- .../build/guides/system-integrators-guide.mdx | 10 ++++++- .../build/smart-contracts/fungible-asset.mdx | 2 +- apps/nextra/utils/generated/localeMap.ts | 28 +++++++++++++------ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/apps/nextra/next-env.d.ts b/apps/nextra/next-env.d.ts index 4f11a03dc..a4a7b3f5c 100644 --- a/apps/nextra/next-env.d.ts +++ b/apps/nextra/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/apps/nextra/pages/en/build/guides/system-integrators-guide.mdx b/apps/nextra/pages/en/build/guides/system-integrators-guide.mdx index 92b485b15..fa157dc89 100644 --- a/apps/nextra/pages/en/build/guides/system-integrators-guide.mdx +++ b/apps/nextra/pages/en/build/guides/system-integrators-guide.mdx @@ -306,9 +306,17 @@ For any `FungibleStore` s, [`fungible_asset::transfer`](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/fungible_asset.move#L347) would be invoked with `FungibleStore` object addresses. +It is noted in the migration phase from coin to FA, withdraw/deposit/transfer FA paired from coin should +call `0x1::coin::deposit/withdraw/transfer`(coin module API) to transfer the asset because the account may have the asset in both +form but fungible asset API can only move FA part but not the coin part. In contrast, coin API could move both parts. For other FA, +since it does not have a paired coin type, only fungible asset API can be used to move assets. +To know which API to call, please refer to [`concurrent_fungible_asset_balance`](../../../indexer/fungible-asset-balances.mdx) table `standard` field, where "v1" means using coin API and "v2" means using fungible asset API. + ### Current balance for Fungible Asset -The current balance for an APT FA of FungibleStore is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::FungibleStore`. The balance is stored as `balance`. The resource also contains a metadata object of the FA type and the frozen status. The address of the primary fungible store can be calculated as `sha3_256(32-byte account address | 32-byte metadata object address | 0xFC)`. The metadata object address of APT FA is `0xA`. +Indexer users can just query [`concurrent_fungible_asset_balance`](../../indexer/fungible-asset-balances.mdx) to get the balance. + +For node API, the current balance for an APT FA of FungibleStore is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::FungibleStore`. The balance is stored as `balance`. The resource also contains a metadata object of the FA type and the frozen status. The address of the primary fungible store can be calculated as `sha3_256(32-byte account address | 32-byte metadata object address | 0xFC)`. The metadata object address of APT FA is `0xA`. Aptos users have the option to upgrade to concurrent fungible balance to allow parallelization of balance updates, improving the performance of a single account. When a user has upgraded a fungible store balance to support concurrent update, the fungible store object will have another resource `ConcurrentFungibleBalance` that contains the balance of the store, and the `balance` field of FungibleStore will be set to 0. The current balance for an APT FA of `ConcurrentFungibleBalance` (if exists) is available at the account resources URL: `https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::ConcurrentFungibleBalance`. diff --git a/apps/nextra/pages/en/build/smart-contracts/fungible-asset.mdx b/apps/nextra/pages/en/build/smart-contracts/fungible-asset.mdx index 17a1ab910..d9e56098d 100644 --- a/apps/nextra/pages/en/build/smart-contracts/fungible-asset.mdx +++ b/apps/nextra/pages/en/build/smart-contracts/fungible-asset.mdx @@ -417,7 +417,7 @@ There are two changes needed for off-chain services: Since a user may possess **both** a `coin` balance and a paired FA balance, off-chain applications should be updated to reflect the **sum** of both the `coin` balance and its paired FA balance. -- For Aptos Indexer users, you may utilize a new table called `current_unified_fungible_asset_balances` to obtain the latest sum of coin balance and FA balance representing the same asset type. +- For Aptos Indexer users, you may utilize the table called `current_fungible_asset_balances` to obtain the latest sum of coin balance and FA balance representing the same asset type. If the FA has a paired coin type, the asset type would be set to the coin type, such as `0x1::aptos_coin::AptosCoin`. Otherwise, for FA not paired from a coin, the asset type would be the metadata address. Users could filter by this field to get the FA balance of their interest. - For users employing Node API or other customized indexing, they should add the balance of the paired FA in users' `FungibleStore` and `ConcurrentFungibleBalance` if any of them exist to the coin balance. To retrieve the balance of the `PrimaryFungibleStore` for a paired FA to an existing `coin` of type `CoinType`: diff --git a/apps/nextra/utils/generated/localeMap.ts b/apps/nextra/utils/generated/localeMap.ts index 381f4aead..85acecfdc 100644 --- a/apps/nextra/utils/generated/localeMap.ts +++ b/apps/nextra/utils/generated/localeMap.ts @@ -4,21 +4,30 @@ export const localeMap = { "/build/apis/aptos-labs-developer-portal": { - "en": true + "en": true, + "zh": true }, "/build/apis/data-providers": { - "en": true + "en": true, + "zh": true }, "/build/apis/faucet-api": { - "en": true + "en": true, + "zh": true }, "/build/apis/fullnode-rest-api-reference": { - "en": true + "en": true, + "zh": true }, "/build/apis/fullnode-rest-api": { - "en": true + "en": true, + "zh": true }, "/build/apis": { + "en": true, + "zh": true + }, + "/build/cli/formatting-move-contracts": { "en": true }, "/build/cli/install-cli/install-cli-linux": { @@ -131,7 +140,8 @@ export const localeMap = { "en": true }, "/build/get-started": { - "en": true + "en": true, + "zh": true }, "/build/guides/aptos-keyless/how-keyless-works": { "en": true @@ -574,9 +584,6 @@ export const localeMap = { "/build/smart-contracts/objects": { "en": true }, - "/build/smart-contracts/pokemon/[name]": { - "en": true - }, "/build/smart-contracts/prover/prover-guide": { "en": true }, @@ -755,6 +762,9 @@ export const localeMap = { "/network/blockchain/events": { "en": true }, + "/network/blockchain/execution": { + "en": true + }, "/network/blockchain/fullnodes": { "en": true },