Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 7730a44

Browse files
authored
[i18n] zh build/apis (#924)
* [i18n] zh build/apis * typo
1 parent 81a1597 commit 7730a44

File tree

5 files changed

+204
-77
lines changed

5 files changed

+204
-77
lines changed
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
export default {
22
"fullnode-rest-api-reference": {
3-
title: "全节点 REST API 参考",
3+
title: "Fullnode REST API Reference",
44
theme: {
55
toc: false,
66
layout: "full",
77
sidebar: false,
88
},
9-
href: "/en/build/apis/fullnode-rest-api-reference",
109
},
11-
"fullnode-rest-api": "全节点 REST API 指南",
10+
"fullnode-rest-api": "Fullnode REST API Guide",
1211
"indexer-graphql-api": {
13-
title: "索引器 GraphQL API",
14-
href: "/zh/build/indexer",
15-
},
16-
"data-providers": {
17-
title: "数据提供商",
18-
href: "/en/build/apis/data-providers",
12+
title: "Indexer GraphQL API",
13+
href: "/en/build/indexer",
1914
},
15+
"data-providers": "Data Providers",
2016
"faucet-api": {
21-
title: "水龙头 API",
22-
href: "/en/build/apis/faucet-api",
23-
},
24-
"aptos-labs-developer-portal": {
25-
title: "API 网关",
26-
href: "/en/build/apis/aptos-labs-developer-portal",
17+
title: "Faucet API",
2718
},
19+
"aptos-labs-developer-portal": "API Gateway",
2820
};

apps/nextra/pages/zh/build/apis/aptos-labs-developer-portal.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ import { Callout } from "nextra/components";
66

77
# Aptos Labs Aptos Build
88

9-
[Aptos Build](https://build.aptoslabs.com) is your gateway to access Aptos Labs provided APIs in a quick and easy fashion to power your dapp. Beyond API access it offers gas station and no code indexing services.
10-
11-
Learn more about Aptos Build at the dedicated [Aptos Build docs site](https://build.aptoslabs.com/docs).
9+
[Aptos Build](https://build.aptoslabs.com) 是你快速便捷接入 Aptos Labs 提供的 API 的入口,为你的 dapp 提供动力。除了 API 访问外,它还提供 gas 加油站和无代码索引服务。了解更多关于 Aptos Build 的信息,请访问专属的 [Aptos Build 文档站点](https://build.aptoslabs.com/docs)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: "数据提供商"
3+
---
4+
5+
# 数据提供商
6+
7+
如果您需要访问 Aptos 区块链数据但无需实时获取。
8+
我们提供了几种选项让您可以通过 SQL 或 UI 仪表盘访问这些数据。
9+
这类数据通常用于分析场景,因为它支持聚合操作。
10+
11+
## 数据端点概览
12+
13+
直接访问全节点将获取最新数据(除非是归档全节点,否则不包含历史数据),使用 [REST API](../apis.mdx#aptos-fullnode)
14+
15+
在此之上的索引器层提供 [GRPC 交易流](../indexer/txn-stream/aptos-hosted-txn-stream)
16+
17+
基于这个交易流,我们构建了一些可通过 [GraphQL](../indexer/) 查询的产品逻辑表
18+
19+
由于交易解析逻辑是 [公开的](https://github.com/aptos-labs/aptos-indexer-processors-v2),部分供应商已实现类似的解析逻辑来创建数据表子集并开放查询。
20+
21+
## SQL 数据表
22+
23+
索引器定义了多个处理器来创建不同的数据库表。
24+
25+
### 核心表
26+
27+
这些表直接解析自节点 API 响应,一种方案是将它们拆分为以下表:
28+
29+
- 区块 - 版本号、区块高度、epoch、时间戳
30+
- 交易 - 版本号、发送方、入口函数、gas
31+
- 签名 - 签名类型、签名者、费用支付地址
32+
- 事件 - 事件类型和数据
33+
34+
我们将数据存储为表项(table items)、资源(resources)或模块(modules):
35+
36+
- (写入集)变更 - 变更索引、变更类型、资源地址
37+
- 表项 - 表键、表句柄、键(内容与类型)、值(内容与类型)
38+
- (Move)资源 - 资源地址、资源类型、数据
39+
- (Move)模块 - 已部署模块的字节码
40+
41+
## 链下数据供应商
42+
43+
我们大多数数据供应商仅提供核心数据集。
44+
以下是 [部分供应商列表](https://aptosfoundation.org/currents/aptos-on-chain-data-capabilities-with-dune-nansen-and-other-providers)
45+
46+
### Google BigQuery 公共数据集
47+
48+
通过 [Google 公共数据](https://console.cloud.google.com/marketplace/product/bigquery-public-data/crypto-aptos-mainnet-us) 提供数据
49+
50+
![bq_sql](/screenshots/bq_sql.png)
51+
52+
我们还提供了 [使用上述资源](https://github.com/aptos-labs/explorer/tree/main/analytics) 的分析查询示例
53+
54+
### Dune
55+
56+
我们的仪表盘地址:https://dune.com/aptos/aptos-chain-metrics-overview
57+
58+
### Flipside
59+
60+
另一个仪表盘供应商,核心表中的签名已合并至 `fact_transactions`
61+
他们还提供了一些便利表(DeFi、NFT、价格),[表清单](https://flipsidecrypto.github.io/aptos-models/#!/overview)
62+
63+
### Artemis
64+
65+
提供 [关键指标](https://app.artemis.xyz/project/aptos) 和图表构建工具
66+
67+
### Nansen
68+
69+
提供 [关键指标](https://app.nansen.ai/macro/blockchains?chain=aptos) 及账户附加功能
70+
71+
### Allium
72+
73+
原始数据地址:https://docs.allium.so/historical-data/supported-blockchains/move-ecosystem/aptos
74+
75+
### Sentio
76+
77+
他们在这里提供了指南:https://docs.sentio.xyz/docs/aptos 数据可以在 data source -> external project -> sentio/aptos-overview 路径下找到
78+
他们还提供交易的堆栈追踪功能
79+
80+
### Space and Time
81+
82+
数据可以在这里查看:https://app.spaceandtime.ai/data-sets?selectedChain=aptos
83+
他们还有一些非核心表(Token、Staking 等)
84+
85+
## 其他供应商
86+
87+
我们还有一些面向更企业级使用场景的合作伙伴- [Token Terminal](https://tokenterminal.com/resources/articles/aptos-data-partnership)
88+
- [The Tie](https://www.thetie.io/insights/news/introducing-aptos-ecosystem-dashboard-and-on-chain-data/)
89+
- [Elliptic](https://www.elliptic.co/media-center/elliptic-partners-with-aptos-foundation-as-a-data-integration-provider-to-offer-compliance-screening-and-risk-services-for-aptos-network)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Faucet API"
3+
---
4+
5+
# Faucet API
6+
7+
开发者可以通过 faucet 在 devnet 上获取 `APT` 代币。在 testnet 上只能通过 [mint 页面](/network/faucet) 进行铸造。Mainnet 不提供此功能。
8+
9+
各网络的 faucet 端点如下:
10+
11+
- Devnet: https://faucet.devnet.aptoslabs.com
12+
13+
## 使用 Faucet
14+
15+
每个 SDK 都集成了对 devnet faucet 的支持。以下是几个示例,更多详细信息请参阅各 [SDK 的文档](../sdks.mdx)
16+
17+
### 在钱包中使用 Faucet
18+
19+
大多数钱包(如 [Petra](https://aptosfoundation.org/ecosystem/project/petra)[Pontem](https://aptosfoundation.org/ecosystem/project/pontem-wallet))都会提供 devnet 的 faucet 按钮。完整钱包列表请查看 [Aptos 钱包生态](https://aptosfoundation.org/ecosystem/projects/wallets)
20+
21+
### 在 Aptos CLI 中使用 Faucet
22+
23+
完成 [CLI 设置](../cli/setup-cli.mdx) 后,可以直接调用 fund-with-faucet 命令。金额单位是 Octas(1 APT = 100,000,000 Octas)。
24+
25+
```bash filename="Terminal"
26+
aptos account fund-with-faucet --account 0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6 --amount 100000000
27+
```
28+
29+
### 在 TypeScript SDK 中使用 Faucet
30+
31+
以下示例向账户 `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6` 转账 1 APT。金额单位是 Octas(1 APT = 100,000,000 Octas)。
32+
33+
```ts filename="index.ts"
34+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
35+
36+
const aptos = new Aptos(new AptosConfig({network: Network.Devnet}));
37+
aptos.fundAccount({accountAddress: "0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6", amount: 100000000});
38+
```
39+
40+
### 在 Go SDK 中使用 Faucet
41+
42+
以下示例向账户 `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6` 转账 1 APT。金额单位是 Octas(1 APT = 100,000,000 Octas)。
43+
44+
```go filename="index.go"
45+
import "github.com/aptos-labs/aptos-go-sdk"
46+
47+
func main() {
48+
client, err := aptos.NewClient(aptos.LocalnetConfig)
49+
if err != nil {
50+
panic(err)
51+
}
52+
53+
client.Fund("0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6", 100000000)
54+
}
55+
```
56+
57+
### 调用 Faucet:其他非 SDK 支持语言
58+
59+
如需在其他语言中调用 faucet,有两种选择:
60+
61+
1. 根据 [OpenAPI 规范](https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/doc/spec.yaml) 生成客户端
62+
2. 自行调用 faucet 接口
63+
64+
自行调用时,需要构建类似以下的请求:
65+
66+
```bash filename="Terminal"
67+
curl -X POST 'https://faucet.devnet.aptoslabs.com/mint?amount=10000&address=0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6'
68+
```
69+
这意味着向地址 `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6` 铸造 10000 个 [octas](../../network/glossary.mdx#Octa)

apps/nextra/pages/zh/build/apis/fullnode-rest-api.mdx

Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,94 +5,74 @@ title: "Fullnode Rest API"
55
import { Callout } from 'nextra/components'
66
import { Card, Cards } from '@components/index'
77

8-
# Aptos Fullnode REST API
8+
# Aptos 全节点 REST API
99

10-
This API - embedded into Fullnodes - provides a simple, low latency, yet low-level way of reading state and submitting transactions to the Aptos Blockchain. It also supports transaction simulation.
11-
For more advanced queries, we recommend using the [Indexer GraphQL API](../indexer.mdx).
10+
API 内置于全节点中,提供了一种简单、低延迟但底层的方式来读取状态和向 Aptos 区块链提交交易。它还支持交易模拟功能。
11+
如需进行更高级的查询,我们推荐使用 [索引器 GraphQL API](../indexer.mdx)
1212

13-
## Fullnode REST API Explorer
13+
## 全节点 REST API 浏览器
1414

1515
<Cards>
1616
<Card href="https://api.mainnet.aptoslabs.com/v1/spec#/">
17-
<Card.Title linkType="external">Mainnet Fullnode REST API</Card.Title>
18-
<Card.Description>REST API Explorer for Mainnet</Card.Description>
17+
<Card.Title linkType="external">主网全节点 REST API</Card.Title>
18+
<Card.Description>主网 REST API 浏览器</Card.Description>
1919
</Card>
2020
<Card href="https://api.testnet.aptoslabs.com/v1/spec#/">
21-
<Card.Title linkType="external">Testnet Fullnode REST API</Card.Title>
22-
<Card.Description>REST API Explorer for Testnet</Card.Description>
21+
<Card.Title linkType="external">测试网全节点 REST API</Card.Title>
22+
<Card.Description>测试网 REST API 浏览器</Card.Description>
2323
</Card>
2424
<Card href="https://api.devnet.aptoslabs.com/v1/spec#/">
25-
<Card.Title linkType="external">Devnet Fullnode REST API</Card.Title>
26-
<Card.Description>REST API Explorer for Devnet</Card.Description>
25+
<Card.Title linkType="external">开发网全节点 REST API</Card.Title>
26+
<Card.Description>开发网 REST API 浏览器</Card.Description>
2727
</Card>
2828
</Cards>
2929

30-
## Understanding rate limits
30+
## 理解速率限制
3131

32-
As with the [Aptos Indexer](../indexer/aptos-hosted.mdx), the Aptos REST API has rate limits based on compute units. You can learn more about how the ratelimiting works by reading the [Aptos Build docs](https://build.aptoslabs.com/docs/start/billing).
32+
[Aptos 索引器](../indexer/indexer-api.mdx) 类似,Aptos REST API 也基于计算单元设有速率限制。您可以通过阅读 [Aptos Build 文档](https://build.aptoslabs.com/docs/start/billing) 了解更多关于速率限制的工作原理。
3333

34-
## Viewing current and historical state
34+
## 查看当前和历史状态
3535

36-
Most integrations into the Aptos blockchain benefit from a holistic and comprehensive overview of the current and
37-
historical state of the blockchain. Aptos provides historical transactions, state, and events, all the result of
38-
transaction execution.
36+
大多数与 Aptos 区块链的集成都需要全面了解区块链当前和历史状态。Aptos 提供了历史交易、状态和事件,这些都是交易执行的结果。
3937

40-
- Historical transactions specify the execution status, output, and tie to related events. Each transaction has a unique
41-
version number associated with it that dictates its global sequential ordering in the history of the blockchain ledger.
42-
- The state is the representation of all transaction outputs up to a specific version. In other words, a state version
43-
is the accumulation of all transactions inclusive of that transaction version.
44-
- As transactions execute, they may emit events. [Events](../../network/blockchain/events.mdx) are hints about changes in on-chain
45-
data.
38+
- 历史交易包含执行状态、输出以及与相关事件的关联。每笔交易都有一个唯一的版本号,用于确定其在区块链账本历史中的全局顺序。
39+
- 状态表示截至特定版本的所有交易输出。换句话说,状态版本是包含该交易版本之前所有交易的累积结果。
40+
- 交易执行时可能会触发事件。[事件](../../network/blockchain/events.mdx) 是关于链上数据变更的提示信息。
4641

4742
<Callout type="info">
48-
Ensure the [fullnode](../../network/nodes/networks.mdx) you are communicating with is up-to-date. The fullnode must reach the
49-
version containing your transaction to retrieve relevant data from it. There can be latency from the fullnodes
50-
retrieving state from [validator fullnodes](../../network/blockchain/fullnodes.mdx), which in turn rely upon
51-
[validator nodes](../../network/blockchain/validator-nodes.mdx) as the source of truth.
43+
请确保您通信的 [全节点](../../network/nodes/networks.mdx) 是最新版本。全节点必须达到包含您交易的版本才能从中检索相关数据。全节点从 [验证器全节点](../../network/blockchain/apis.mdx) 获取状态可能存在延迟,而验证器全节点又以 [验证器节点](../../network/blockchain/validator-nodes.mdx) 作为真实数据源。
5244
</Callout>
5345

54-
The storage service on a node employs two forms of pruning that erase data from nodes:
46+
节点上的存储服务采用两种数据修剪机制来清除数据:
5547

56-
- state
57-
- events, transactions, and everything else
48+
- 状态数据
49+
- 事件、交易等其他所有数据虽然可以禁用其中任一功能,但存储状态版本并不是特别可持续的做法。
5850

59-
While either of these may be disabled, storing the state versions is not particularly sustainable.
51+
可以通过在 `storage_config.rs` 中将 [`enable_ledger_pruner`](https://github.com/aptos-labs/aptos-core/blob/cf0bc2e4031a843cdc0c04e70b3f7cd92666afcf/config/src/config/storage_config.rs#L141) 设置为 `false` 来禁用事件和交易剪枝功能。这在 Mainnet 中是默认行为。在不久的将来,Aptos 将提供索引器来减少直接从节点查询的需求。
6052

61-
Events and transactions pruning can be disabled via setting the [`enable_ledger_pruner`](https://github.com/aptos-labs/aptos-core/blob/cf0bc2e4031a843cdc0c04e70b3f7cd92666afcf/config/src/config/storage_config.rs#L141)
62-
to `false` in `storage_config.rs`. This is default behavior in Mainnet. In the near future, Aptos will provide indexers
63-
that mitigate the need to directly query from a node.
53+
REST API 提供以下方式查询交易和事件:
6454

65-
The REST API offers querying transactions and events in these ways:
55+
- [按账户查询交易](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_account_transactions)
56+
- [按版本查询交易](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_transaction_by_version)
57+
- [按事件句柄查询事件](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_events_by_event_handle)
6658

67-
- [Transactions for an account](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_account_transactions)
68-
- [Transactions by version](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_transaction_by_version)
69-
- [Events by event handle](https://api.devnet.aptoslabs.com/v1/spec#/operations/get_events_by_event_handle)
59+
## 使用 View 函数读取状态
7060

71-
## Reading state with the View function
61+
通过 API 调用时,View 函数不会修改区块链状态。[View 函数](https://github.com/aptos-labs/aptos-core/blob/main/api/src/view_function.rs) 及其 [输入参数](https://github.com/aptos-labs/aptos-core/blob/main/api/types/src/view.rs) 可用于通过 Move 读取潜在的复杂链上状态。例如,您可以评估拍卖合约中的最高出价者。以下是相关文件:
7262

73-
View functions do not modify blockchain state when called from the API. A [View function](https://github.com/aptos-labs/aptos-core/blob/main/api/src/view_function.rs)
74-
and its [input](https://github.com/aptos-labs/aptos-core/blob/main/api/types/src/view.rs) can be used to read
75-
potentially complex on-chain state using Move. For example, you can evaluate who has the highest bid in an auction
76-
contract. Here are related files:
63+
- [`view_function.rs`](https://github.com/aptos-labs/aptos-core/blob/main/api/src/tests/view_function.rs) 示例
64+
- 相关 [Move](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/aptos-move/framework/aptos-framework/sources/coin.move#L226) 代码
65+
- [规范说明](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/api/doc/spec.yaml#L8513)
7766

78-
- [`view_function.rs`](https://github.com/aptos-labs/aptos-core/blob/main/api/src/tests/view_function.rs) for an example
79-
- related [Move](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/aptos-move/framework/aptos-framework/sources/coin.move#L226) code
80-
- [specification](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/api/doc/spec.yaml#L8513).
67+
View 函数的运行方式类似于 Aptos 模拟 API,但没有副作用且具有可访问的输出路径。可以通过 `/view` 端点调用 View 函数。调用 View 函数需要提供模块名、函数名以及输入类型参数和值。
8168

82-
The view function operates like the Aptos simulation API,
83-
though with no side effects and an accessible output path. View functions can be called via the `/view` endpoint. Calls
84-
to view functions require the module and function names along with input type parameters and values.
69+
函数不必是不可变的才能标记为 `#[view]`,但如果函数是可变的,通过 API 调用时不会导致状态变更。如果要标记可变函数为 `#[view]`,建议将其设为私有,以防止在运行时被恶意调用。
8570

86-
A function does not have to be immutable to be tagged as `#[view]`, but if the function is mutable it will not result in
87-
state mutation when called from the API. If you want to tag a mutable function as `#[view]`, consider making it private
88-
so that it cannot be maliciously called during runtime.
71+
要使用 View 函数,需要通过 [Aptos CLI](../cli.mdx) [发布模块](../cli/working-with-move-contracts.mdx)
8972

90-
In order to use the View functions, you need to [publish the module](../cli/working-with-move-contracts.mdx)
91-
through the [Aptos CLI](../cli.mdx).
73+
在 Aptos CLI 中,View 函数请求示例如下:
9274

93-
In the Aptos CLI, a view function request would look like this:
94-
95-
```bash filename="Terminal"
75+
```bash filename="终端"
9676
aptos move view --function-id devnet::message::get_message --profile devnet --args address:devnet
9777
{
9878
"Result": [
@@ -101,7 +81,7 @@ aptos move view --function-id devnet::message::get_message --profile devnet --ar
10181
}
10282
```
10383

104-
In the TypeScript SDK, a view function request would look like this:
84+
TypeScript SDK 中,View 函数请求示例如下:
10585

10686
```ts filename="index.ts"
10787
import { Aptos } from "@aptos-labs/ts-sdk";
@@ -116,5 +96,4 @@ const [balance] = aptos.view<[string]>({
11696
expect(balance).toBe("100000000");
11797
```
11898

119-
The view function returns a list of values as a vector. By default, the results are returned in JSON format; however,
120-
they can be optionally returned in Binary Canonical Serialization (BCS) encoded format.
99+
视图函数返回一个值列表作为向量。默认情况下,结果以 JSON 格式返回;不过,也可以选择以 Binary Canonical Serialization (BCS) 编码格式返回。

0 commit comments

Comments
 (0)