@ocap/client 1.28.5 → 1.28.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/base.js +1 -3
- package/dist/base.js.map +1 -1
- package/dist/browser.d.ts +270 -175
- package/dist/bundle.js +1 -1
- package/dist/extension.js +0 -8
- package/dist/extension.js.map +1 -1
- package/dist/lite.js +0 -1
- package/dist/lite.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/report.html +2 -2
- package/docs/QUERIES.md +2 -2
- package/docs/README.md +2 -2
- package/docs/api-reference-client-methods.ja.md +6 -1
- package/docs/api-reference-client-methods.md +5 -0
- package/docs/api-reference-client-methods.zh-TW.md +6 -1
- package/docs/api-reference-client-methods.zh.md +6 -1
- package/docs/api-reference-data-types.ja.md +6 -1
- package/docs/api-reference-data-types.md +6 -1
- package/docs/api-reference-data-types.zh-TW.md +6 -1
- package/docs/api-reference-data-types.zh.md +6 -1
- package/docs/api-reference-low-level-api.ja.md +9 -5
- package/docs/api-reference-low-level-api.md +9 -5
- package/docs/api-reference-low-level-api.zh-TW.md +9 -5
- package/docs/api-reference-low-level-api.zh.md +9 -5
- package/docs/api-reference-query-mutation-methods.ja.md +5 -3
- package/docs/api-reference-query-mutation-methods.md +4 -2
- package/docs/api-reference-query-mutation-methods.zh-TW.md +5 -3
- package/docs/api-reference-query-mutation-methods.zh.md +5 -3
- package/docs/api-reference-transaction-helpers.ja.md +6 -1
- package/docs/api-reference-transaction-helpers.md +5 -0
- package/docs/api-reference-transaction-helpers.zh-TW.md +6 -1
- package/docs/api-reference-transaction-helpers.zh.md +6 -1
- package/docs/api-reference.ja.md +1 -1
- package/docs/api-reference.md +1 -1
- package/docs/api-reference.zh-TW.md +1 -1
- package/docs/api-reference.zh.md +1 -1
- package/docs/core-concepts-client-architecture.ja.md +16 -11
- package/docs/core-concepts-client-architecture.md +16 -11
- package/docs/core-concepts-client-architecture.zh-TW.md +16 -11
- package/docs/core-concepts-client-architecture.zh.md +16 -11
- package/docs/core-concepts-event-subscriptions.ja.md +12 -7
- package/docs/core-concepts-event-subscriptions.md +12 -7
- package/docs/core-concepts-event-subscriptions.zh-TW.md +12 -7
- package/docs/core-concepts-event-subscriptions.zh.md +12 -7
- package/docs/core-concepts-gas-payment.ja.md +7 -3
- package/docs/core-concepts-gas-payment.md +7 -3
- package/docs/core-concepts-gas-payment.zh-TW.md +7 -3
- package/docs/core-concepts-gas-payment.zh.md +7 -3
- package/docs/core-concepts-transaction-lifecycle.ja.md +15 -7
- package/docs/core-concepts-transaction-lifecycle.md +15 -7
- package/docs/core-concepts-transaction-lifecycle.zh-TW.md +15 -7
- package/docs/core-concepts-transaction-lifecycle.zh.md +15 -7
- package/docs/core-concepts.ja.md +1 -1
- package/docs/core-concepts.md +1 -1
- package/docs/core-concepts.zh-TW.md +1 -1
- package/docs/core-concepts.zh.md +1 -1
- package/docs/getting-started-basic-usage.ja.md +6 -1
- package/docs/getting-started-basic-usage.md +6 -1
- package/docs/getting-started-basic-usage.zh-TW.md +6 -1
- package/docs/getting-started-basic-usage.zh.md +6 -1
- package/docs/getting-started-installation.ja.md +7 -3
- package/docs/getting-started-installation.md +7 -3
- package/docs/getting-started-installation.zh-TW.md +7 -3
- package/docs/getting-started-installation.zh.md +7 -3
- package/docs/getting-started.ja.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/getting-started.zh-TW.md +1 -1
- package/docs/getting-started.zh.md +1 -1
- package/docs/how-to-guides-delegate-permissions.ja.md +4 -1
- package/docs/how-to-guides-delegate-permissions.md +3 -0
- package/docs/how-to-guides-delegate-permissions.zh-TW.md +4 -1
- package/docs/how-to-guides-delegate-permissions.zh.md +4 -1
- package/docs/how-to-guides-manage-accounts.ja.md +4 -3
- package/docs/how-to-guides-manage-accounts.md +4 -3
- package/docs/how-to-guides-manage-accounts.zh-TW.md +4 -3
- package/docs/how-to-guides-manage-accounts.zh.md +4 -3
- package/docs/how-to-guides-manage-assets.ja.md +6 -2
- package/docs/how-to-guides-manage-assets.md +6 -2
- package/docs/how-to-guides-manage-assets.zh-TW.md +6 -2
- package/docs/how-to-guides-manage-assets.zh.md +6 -2
- package/docs/how-to-guides-manage-tokens.ja.md +8 -1
- package/docs/how-to-guides-manage-tokens.md +8 -1
- package/docs/how-to-guides-manage-tokens.zh-TW.md +8 -1
- package/docs/how-to-guides-manage-tokens.zh.md +8 -1
- package/docs/how-to-guides-stake-tokens-and-assets.ja.md +11 -5
- package/docs/how-to-guides-stake-tokens-and-assets.md +11 -5
- package/docs/how-to-guides-stake-tokens-and-assets.zh-TW.md +11 -5
- package/docs/how-to-guides-stake-tokens-and-assets.zh.md +11 -5
- package/docs/how-to-guides-transfer-tokens-and-nfts.ja.md +8 -6
- package/docs/how-to-guides-transfer-tokens-and-nfts.md +8 -6
- package/docs/how-to-guides-transfer-tokens-and-nfts.zh-TW.md +8 -6
- package/docs/how-to-guides-transfer-tokens-and-nfts.zh.md +8 -6
- package/docs/how-to-guides.ja.md +1 -1
- package/docs/how-to-guides.md +1 -1
- package/docs/how-to-guides.zh-TW.md +1 -1
- package/docs/how-to-guides.zh.md +1 -1
- package/docs/overview.ja.md +5 -3
- package/docs/overview.md +5 -3
- package/docs/overview.zh-TW.md +5 -3
- package/docs/overview.zh.md +5 -3
- package/examples/asset.js +0 -2
- package/examples/create-secondary-token.js +0 -2
- package/examples/declare.js +0 -1
- package/examples/delegate-exchange-both.js +1 -3
- package/examples/delegate-exchange.js +1 -3
- package/examples/delegate-transfer.js +0 -1
- package/examples/exchange-secondary-token.js +0 -2
- package/examples/exchange.js +0 -2
- package/examples/migrate-account.js +0 -1
- package/examples/run-no-debug.sh +0 -0
- package/examples/run.sh +0 -0
- package/examples/subscribe.js +0 -2
- package/examples/transfer-asset.js +0 -2
- package/examples/transfer-primary-token.js +0 -1
- package/examples/transfer-secondary-token.js +0 -2
- package/lib/base.js +1 -3
- package/lib/base.js.map +1 -1
- package/lib/extension.js +0 -8
- package/lib/extension.js.map +1 -1
- package/lib/lite.js +0 -1
- package/lib/lite.js.map +1 -1
- package/lib/module.js +1 -1
- package/lib/module.js.map +1 -1
- package/lib/node.d.ts +270 -175
- package/lib/node.js +1 -1
- package/lib/node.js.map +1 -1
- package/package.json +30 -32
|
@@ -4,6 +4,7 @@ This guide will walk you through the essential steps to get started with the OCA
|
|
|
4
4
|
|
|
5
5
|
Following this guide, you should have a working client instance ready to interact with the blockchain in just a few minutes.
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 1. Initialize the Client
|
|
8
9
|
|
|
9
10
|
First, you need to import the `@ocap/client` package and create an instance of `GraphQLClient`. The constructor takes the GraphQL endpoint of the blockchain node you want to connect to. For this guide, we will use the public endpoint for the ArcBlock Beta Chain.
|
|
@@ -19,6 +20,7 @@ console.log('OCAP Client initialized!');
|
|
|
19
20
|
|
|
20
21
|
This creates a client instance that is pre-configured with methods for querying the chain, sending transactions, and more.
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
## 2. Query the Blockchain
|
|
23
25
|
|
|
24
26
|
Now that the client is initialized, you can perform a simple read-only operation to verify the connection. The `getChainInfo` method is perfect for this, as it fetches basic information about the connected blockchain and doesn't require any authentication.
|
|
@@ -36,6 +38,7 @@ Now that the client is initialized, you can perform a simple read-only operation
|
|
|
36
38
|
|
|
37
39
|
If the request is successful, the `info` object will be logged to the console, containing details about the chain such as its ID, network, and supported transaction types. This confirms your client is successfully communicating with the blockchain node.
|
|
38
40
|
|
|
41
|
+
|
|
39
42
|
## 3. Prepare an Account
|
|
40
43
|
|
|
41
44
|
To send transactions (write operations), you need a wallet. You can generate a new wallet locally. This wallet represents your on-chain account identity.
|
|
@@ -60,6 +63,7 @@ To make your new account active, you need to fund it with some test tokens. You
|
|
|
60
63
|
Visit the faucet and send some TBA to your newly generated address to activate it.
|
|
61
64
|
</x-card>
|
|
62
65
|
|
|
66
|
+
|
|
63
67
|
## 4. Query Account State
|
|
64
68
|
|
|
65
69
|
Once you have funded your new account using the faucet, you can query its state to verify the balance.
|
|
@@ -80,8 +84,9 @@ Once you have funded your new account using the faucet, you can query its state
|
|
|
80
84
|
|
|
81
85
|
The `state` object in the response will contain your account's address, balance, nonce (number of transactions sent), and other details. Seeing a non-zero balance confirms that your account has received the tokens from the faucet and is now active on the blockchain.
|
|
82
86
|
|
|
87
|
+
|
|
83
88
|
## Next Steps
|
|
84
89
|
|
|
85
90
|
You have successfully set up the OCAP Client, connected to the blockchain, and verified your account. You are now ready to explore more advanced operations.
|
|
86
91
|
|
|
87
|
-
Check out the [How-to Guides](./how-to-guides.md) to learn how to perform common tasks like transferring tokens, managing assets, and more.
|
|
92
|
+
Check out the [How-to Guides](./how-to-guides.md) to learn how to perform common tasks like transferring tokens, managing assets, and more.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
遵循本指南,您應該能在幾分鐘內擁有一個可運作的客戶端實例,準備好與區塊鏈進行互動。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 1. 初始化客戶端
|
|
8
9
|
|
|
9
10
|
首先,您需要匯入 `@ocap/client` 套件並建立一個 `GraphQLClient` 的實例。建構函式需要傳入您想連接的區塊鏈節點的 GraphQL 端點。在本指南中,我們將使用 ArcBlock Beta 鏈的公開端點。
|
|
@@ -19,6 +20,7 @@ console.log('OCAP Client initialized!');
|
|
|
19
20
|
|
|
20
21
|
這會建立一個客戶端實例,該實例已預先配置了查詢鏈、發送交易等方法。
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
## 2. 查詢區塊鏈
|
|
23
25
|
|
|
24
26
|
既然客戶端已初始化,您可以執行一個簡單的唯讀操作來驗證連接。`getChainInfo` 方法非常適合此用途,因為它會擷取有關所連接區塊鏈的基本資訊,且不需要任何身份驗證。
|
|
@@ -36,6 +38,7 @@ console.log('OCAP Client initialized!');
|
|
|
36
38
|
|
|
37
39
|
如果請求成功,`info` 物件將會被記錄到主控台,其中包含鏈的詳細資訊,例如其 ID、網路和支援的交易類型。這確認了您的客戶端已成功與區塊鏈節點通訊。
|
|
38
40
|
|
|
41
|
+
|
|
39
42
|
## 3. 準備帳戶
|
|
40
43
|
|
|
41
44
|
要發送交易(寫入操作),您需要一個錢包。您可以在本地產生一個新錢包。這個錢包代表您在鏈上的帳戶身份。
|
|
@@ -60,6 +63,7 @@ console.log('SecretKey:', wallet.secretKey);
|
|
|
60
63
|
訪問水龍頭並發送一些 TBA 到您新產生的地址以啟動它。
|
|
61
64
|
</x-card>
|
|
62
65
|
|
|
66
|
+
|
|
63
67
|
## 4. 查詢帳戶狀態
|
|
64
68
|
|
|
65
69
|
一旦您使用水龍頭為您的新帳戶注資後,您可以查詢其狀態以驗證餘額。
|
|
@@ -80,8 +84,9 @@ console.log('SecretKey:', wallet.secretKey);
|
|
|
80
84
|
|
|
81
85
|
`state` 物件在回應中將包含您帳戶的地址、餘額、nonce(已發送的交易數量)以及其他詳細資訊。看到非零餘額即確認您的帳戶已從水龍頭收到代幣,並已在區塊鏈上啟用。
|
|
82
86
|
|
|
87
|
+
|
|
83
88
|
## 後續步驟
|
|
84
89
|
|
|
85
90
|
您已成功設定 OCAP Client、連接到區塊鏈並驗證了您的帳戶。現在,您已準備好探索更進階的操作。
|
|
86
91
|
|
|
87
|
-
查看 [操作指南](./how-to-guides.md) 以學習如何執行常見任務,例如轉移代幣、管理資產等。
|
|
92
|
+
查看 [操作指南](./how-to-guides.md) 以學習如何執行常見任務,例如轉移代幣、管理資產等。
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
遵循本指南,您应该能在几分钟内拥有一个可以与区块链交互的正常工作的客户端实例。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 1. 初始化客户端
|
|
8
9
|
|
|
9
10
|
首先,您需要导入 `@ocap/client` 包并创建一个 `GraphQLClient` 实例。构造函数接收您想要连接的区块链节点的 GraphQL 端点。在本指南中,我们将使用 ArcBlock Beta Chain 的公共端点。
|
|
@@ -19,6 +20,7 @@ console.log('OCAP Client initialized!');
|
|
|
19
20
|
|
|
20
21
|
这将创建一个客户端实例,该实例已预先配置了用于查询链、发送交易等方法。
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
## 2. 查询区块链
|
|
23
25
|
|
|
24
26
|
客户端初始化后,您可以执行一个简单的只读操作来验证连接。`getChainInfo` 方法非常适合此目的,因为它会获取所连接区块链的基本信息,且无需任何身份验证。
|
|
@@ -36,6 +38,7 @@ console.log('OCAP Client initialized!');
|
|
|
36
38
|
|
|
37
39
|
如果请求成功,`info` 对象将被打印到控制台,其中包含链的 ID、网络和支持的交易类型等详细信息。这确认了您的客户端已成功与区块链节点通信。
|
|
38
40
|
|
|
41
|
+
|
|
39
42
|
## 3. 准备账户
|
|
40
43
|
|
|
41
44
|
要发送交易(写操作),您需要一个钱包。您可以在本地生成一个新钱包。这个钱包代表您在链上的账户身份。
|
|
@@ -60,6 +63,7 @@ console.log('SecretKey:', wallet.secretKey);
|
|
|
60
63
|
访问水龙头,向您新生成的地址发送一些 TBA 来激活它。
|
|
61
64
|
</x-card>
|
|
62
65
|
|
|
66
|
+
|
|
63
67
|
## 4. 查询账户状态
|
|
64
68
|
|
|
65
69
|
当您使用水龙头为新账户充值后,您可以查询其状态以验证余额。
|
|
@@ -80,8 +84,9 @@ console.log('SecretKey:', wallet.secretKey);
|
|
|
80
84
|
|
|
81
85
|
响应中的 `state` 对象将包含您账户的地址、余额、nonce(已发送交易数量)和其他详细信息。看到非零余额即确认您的账户已从水龙头收到代币,并且现已在区块链上激活。
|
|
82
86
|
|
|
87
|
+
|
|
83
88
|
## 后续步骤
|
|
84
89
|
|
|
85
90
|
您已成功设置 OCAP Client、连接到区块链并验证了您的账户。现在您可以开始探索更高级的操作。
|
|
86
91
|
|
|
87
|
-
查阅 [操作指南](./how-to-guides.md) 以学习如何执行转账代币、管理资产等常见任务。
|
|
92
|
+
查阅 [操作指南](./how-to-guides.md) 以学习如何执行转账代币、管理资产等常见任务。
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
OCAP Client は、アプリケーションを OCAP ブロックチェーンに接続するための JavaScript ライブラリです。Node.js とブラウザ環境の両方で動作します。このガイドでは、パッケージマネージャーを使用してクライアントをインストールする方法を説明します。
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## 前提条件
|
|
6
7
|
|
|
7
8
|
開始する前に、次のものがインストールされていることを確認してください:
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* [Node.js](https://nodejs.org/) (npm パッケージマネージャーを含みます)
|
|
11
|
+
* [pnpm](https://pnpm.io/) (任意ですが、推奨されます)
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
## パッケージのインストール
|
|
13
15
|
|
|
@@ -31,6 +33,7 @@ pnpm install @ocap/client
|
|
|
31
33
|
|
|
32
34
|
このコマンドはパッケージをダウンロードし、プロジェクトの依存関係に追加します。
|
|
33
35
|
|
|
36
|
+
|
|
34
37
|
## インストールの確認
|
|
35
38
|
|
|
36
39
|
インストールが完了したら、JavaScript ファイルにインポートすることで、パッケージが正しくインストールされていることを確認できます。`test-client.js` という名前のファイルを作成し、次のコードを追加します:
|
|
@@ -53,8 +56,9 @@ node test-client.js
|
|
|
53
56
|
|
|
54
57
|
コンソールに成功メッセージが出力され、クライアントが使用できる状態であることが確認できるはずです。
|
|
55
58
|
|
|
59
|
+
|
|
56
60
|
## 次のステップ
|
|
57
61
|
|
|
58
62
|
クライアントのインストールが完了したので、ブロックチェーンに接続してリクエストを開始する準備ができました。次のセクションに進み、基本を学びましょう。
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
* **[基本操作](./getting-started-basic-usage.md)**: クライアントを初期化し、最初のクエリを実行する方法を学びます。
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
The OCAP Client is a JavaScript library that connects your application to an OCAP blockchain. It works in both Node.js and browser environments. This guide will walk you through installing the client using a package manager.
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## Prerequisites
|
|
6
7
|
|
|
7
8
|
Before you begin, ensure you have the following installed:
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* [Node.js](https://nodejs.org/) (which includes the npm package manager)
|
|
11
|
+
* [pnpm](https://pnpm.io/) (optional, but recommended)
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
## Install the Package
|
|
13
15
|
|
|
@@ -31,6 +33,7 @@ pnpm install @ocap/client
|
|
|
31
33
|
|
|
32
34
|
This command will download the package and add it to your project's dependencies.
|
|
33
35
|
|
|
36
|
+
|
|
34
37
|
## Verify Installation
|
|
35
38
|
|
|
36
39
|
After the installation is complete, you can verify that the package is correctly installed by importing it into a JavaScript file. Create a file named `test-client.js` and add the following code:
|
|
@@ -53,8 +56,9 @@ node test-client.js
|
|
|
53
56
|
|
|
54
57
|
You should see the success message printed to the console, confirming that the client is ready to use.
|
|
55
58
|
|
|
59
|
+
|
|
56
60
|
## Next Steps
|
|
57
61
|
|
|
58
62
|
Now that you have the client installed, you're ready to connect to the blockchain and start making requests. Continue to the next section to learn the basics.
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
* **[Basic Usage](./getting-started-basic-usage.md)**: Learn how to initialize the client and make your first query.
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
OCAP Client 是一套 JavaScript 函式庫,可將您的應用程式連接到 OCAP 區塊鏈。它同時適用於 Node.js 和瀏覽器環境。本指南將引導您使用套件管理器安裝此用戶端。
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## 先決條件
|
|
6
7
|
|
|
7
8
|
在開始之前,請確保您已安裝以下項目:
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* [Node.js](https://nodejs.org/) (其中包含 npm 套件管理器)
|
|
11
|
+
* [pnpm](https://pnpm.io/) (選用,但建議使用)
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
## 安裝套件
|
|
13
15
|
|
|
@@ -31,6 +33,7 @@ pnpm install @ocap/client
|
|
|
31
33
|
|
|
32
34
|
此指令將下載該套件並將其新增至您專案的依賴項中。
|
|
33
35
|
|
|
36
|
+
|
|
34
37
|
## 驗證安裝
|
|
35
38
|
|
|
36
39
|
安裝完成後,您可以透過將套件匯入一個 JavaScript 檔案來驗證其是否已正確安裝。建立一個名為 `test-client.js` 的檔案,並新增以下程式碼:
|
|
@@ -53,8 +56,9 @@ node test-client.js
|
|
|
53
56
|
|
|
54
57
|
您應該會看到成功訊息輸出到主控台,這表示用戶端已準備就緒,可供使用。
|
|
55
58
|
|
|
59
|
+
|
|
56
60
|
## 後續步驟
|
|
57
61
|
|
|
58
62
|
現在您已經安裝了用戶端,可以準備連接到區塊鏈並開始發送請求。請繼續下一節來學習基礎知識。
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
* **[基本用法](./getting-started-basic-usage.md)**:學習如何初始化用戶端並進行您的第一次查詢。
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
OCAP Client 是一个 JavaScript 库,可将您的应用程序连接到 OCAP 区块链。它同时适用于 Node.js 和浏览器环境。本指南将引导您使用包管理器安装该客户端。
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## 前提条件
|
|
6
7
|
|
|
7
8
|
在开始之前,请确保您已安装以下软件:
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* [Node.js](https://nodejs.org/)(包含 npm 包管理器)
|
|
11
|
+
* [pnpm](https://pnpm.io/)(可选,但推荐使用)
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
## 安装软件包
|
|
13
15
|
|
|
@@ -31,6 +33,7 @@ pnpm install @ocap/client
|
|
|
31
33
|
|
|
32
34
|
此命令将下载该软件包并将其添加到您项目的依赖项中。
|
|
33
35
|
|
|
36
|
+
|
|
34
37
|
## 验证安装
|
|
35
38
|
|
|
36
39
|
安装完成后,您可以通过将其导入 JavaScript 文件来验证软件包是否已正确安装。创建一个名为 `test-client.js` 的文件,并添加以下代码:
|
|
@@ -53,8 +56,9 @@ node test-client.js
|
|
|
53
56
|
|
|
54
57
|
您应该会在控制台中看到打印出的成功消息,这确认了客户端已准备就绪,可以使用。
|
|
55
58
|
|
|
59
|
+
|
|
56
60
|
## 后续步骤
|
|
57
61
|
|
|
58
62
|
既然您已经安装了客户端,就可以连接到区块链并开始发出请求了。请继续阅读下一部分,学习基础知识。
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
* **[基本用法](./getting-started-basic-usage.md)**:学习如何初始化客户端并发起您的第一个查询。
|
package/docs/getting-started.md
CHANGED
|
@@ -13,4 +13,4 @@ Follow these simple steps to begin interacting with the network.
|
|
|
13
13
|
</x-card>
|
|
14
14
|
</x-cards>
|
|
15
15
|
|
|
16
|
-
Once you've completed these initial steps, you'll be ready to explore more advanced features. For practical, task-oriented examples, be sure to check out the [How-to Guides](./how-to-guides.md).
|
|
16
|
+
Once you've completed these initial steps, you'll be ready to explore more advanced features. For practical, task-oriented examples, be sure to check out the [How-to Guides](./how-to-guides.md).
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
このガイドでは、委任の付与、使用、取り消しの手順を説明します。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 委任の付与
|
|
8
9
|
|
|
9
10
|
別のアカウントを承認するには、`delegate` メソッドを使用します。誰に委任するのか、そしてどの特定のトランザクションタイプを送信することを許可するのかを指定する必要があります。各権限には、関連するトークンや資産などの制限を設けることもできます。
|
|
@@ -85,6 +86,7 @@ async function grantPermission() {
|
|
|
85
86
|
grantPermission();
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
|
|
88
90
|
## 受任者としてトランザクションを送信する
|
|
89
91
|
|
|
90
92
|
委任が完了すると、受任者のウォレットはトランザクションパラメータで `delegator` のアドレスを指定することで、承認されたトランザクションを送信できます。トランザクションは受任者によって署名されますが、委任者に代わって実行され、トランザクション手数料は委任者のアカウントから支払われます。
|
|
@@ -118,6 +120,7 @@ async function sendDelegatedTransaction() {
|
|
|
118
120
|
// sendDelegatedTransaction();
|
|
119
121
|
```
|
|
120
122
|
|
|
123
|
+
|
|
121
124
|
## 委任の取り消し
|
|
122
125
|
|
|
123
126
|
委任者は `revokeDelegate` メソッドを使用して、付与された権限をいつでも取り消すことができます。特定の受任者に対してどのトランザクションタイプを取り消すかを指定する必要があります。
|
|
@@ -164,4 +167,4 @@ async function revokePermission() {
|
|
|
164
167
|
// revokePermission();
|
|
165
168
|
```
|
|
166
169
|
|
|
167
|
-
このトランザクションが確認されると、`delegateeWallet` は `delegatorWallet` に代わって `transfer` トランザクションを送信できなくなります。
|
|
170
|
+
このトランザクションが確認されると、`delegateeWallet` は `delegatorWallet` に代わって `transfer` トランザクションを送信できなくなります。
|
|
@@ -4,6 +4,7 @@ Delegating permissions is a powerful feature that allows one account (the delega
|
|
|
4
4
|
|
|
5
5
|
This guide will walk you through granting, using, and revoking delegations.
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## Granting Delegation
|
|
8
9
|
|
|
9
10
|
To authorize another account, you use the `delegate` method. You must specify who you are delegating to and which specific transaction types they are allowed to send. Each permission can also have limits, such as which tokens or assets can be involved.
|
|
@@ -85,6 +86,7 @@ async function grantPermission() {
|
|
|
85
86
|
grantPermission();
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
|
|
88
90
|
## Sending a Transaction as a Delegatee
|
|
89
91
|
|
|
90
92
|
Once delegated, the delegatee wallet can send the authorized transaction by specifying the `delegator`'s address in the transaction parameters. The transaction is signed by the delegatee, but executed on behalf of the delegator, and the transaction fees are paid from the delegator's account.
|
|
@@ -118,6 +120,7 @@ async function sendDelegatedTransaction() {
|
|
|
118
120
|
// sendDelegatedTransaction();
|
|
119
121
|
```
|
|
120
122
|
|
|
123
|
+
|
|
121
124
|
## Revoking Delegation
|
|
122
125
|
|
|
123
126
|
The delegator can revoke any granted permissions at any time using the `revokeDelegate` method. You need to specify which transaction types to revoke for a given delegatee.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
本指南將引導您完成授予、使用和撤銷委派的過程。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 授予委派
|
|
8
9
|
|
|
9
10
|
若要授權另一個帳戶,您需要使用 `delegate` 方法。您必須指定要委派給誰,以及他們被允許發送哪些特定交易類型。每項權限還可以設定限制,例如可以涉及哪些代幣或資產。
|
|
@@ -84,6 +85,7 @@ async function grantPermission() {
|
|
|
84
85
|
grantPermission();
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
|
|
87
89
|
## 作為受派人發送交易
|
|
88
90
|
|
|
89
91
|
一旦獲得委派,受派人錢包可以透過在交易參數中指定 `delegator` 的地址來發送已授權的交易。該交易由受派人簽署,但代表委派人執行,交易費用從委派人的帳戶中支付。
|
|
@@ -117,6 +119,7 @@ async function sendDelegatedTransaction() {
|
|
|
117
119
|
// sendDelegatedTransaction();
|
|
118
120
|
```
|
|
119
121
|
|
|
122
|
+
|
|
120
123
|
## 撤銷委派
|
|
121
124
|
|
|
122
125
|
委派人可以隨時使用 `revokeDelegate` 方法撤銷任何已授予的權限。您需要為指定的受派人指定要撤銷哪些交易類型。
|
|
@@ -163,4 +166,4 @@ async function revokePermission() {
|
|
|
163
166
|
// revokePermission();
|
|
164
167
|
```
|
|
165
168
|
|
|
166
|
-
此交易確認後,`delegateeWallet` 將無法再代表 `delegatorWallet` 發送 `transfer` 交易。
|
|
169
|
+
此交易確認後,`delegateeWallet` 將無法再代表 `delegatorWallet` 發送 `transfer` 交易。
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
本指南将引导您完成授予、使用和撤销委托的全过程。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 授予委托
|
|
8
9
|
|
|
9
10
|
要授权另一个账户,您可以使用 `delegate` 方法。您必须指定委托给谁以及他们被允许发送哪些具体的交易类型。每项权限还可以设置限制,例如可以涉及哪些代币或资产。
|
|
@@ -84,6 +85,7 @@ async function grantPermission() {
|
|
|
84
85
|
grantPermission();
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
|
|
87
89
|
## 作为受托人发送交易
|
|
88
90
|
|
|
89
91
|
一旦获得委托,受托人钱包就可以通过在交易参数中指定 `delegator` 的地址来发送已授权的交易。该交易由受托人签名,但代表委托人执行,交易费用从委托人的账户中支付。
|
|
@@ -117,6 +119,7 @@ async function sendDelegatedTransaction() {
|
|
|
117
119
|
// sendDelegatedTransaction();
|
|
118
120
|
```
|
|
119
121
|
|
|
122
|
+
|
|
120
123
|
## 撤销委托
|
|
121
124
|
|
|
122
125
|
委托人可以随时使用 `revokeDelegate` 方法撤销任何已授予的权限。您需要为指定的受托人指明要撤销哪些交易类型。
|
|
@@ -163,4 +166,4 @@ async function revokePermission() {
|
|
|
163
166
|
// revokePermission();
|
|
164
167
|
```
|
|
165
168
|
|
|
166
|
-
此交易确认后,`delegateeWallet` 将无法再代表 `delegatorWallet` 发送 `transfer` 交易。
|
|
169
|
+
此交易确认后,`delegateeWallet` 将无法再代表 `delegatorWallet` 发送 `transfer` 交易。
|
|
@@ -4,12 +4,13 @@ OCAP を利用したブロックチェーンにおいて、アカウントとは
|
|
|
4
4
|
|
|
5
5
|
このガイドでは、アカウントを新しいキーセットに移行するという、重要なアカウント管理操作に焦点を当てます。これは、アドレス、残高、またはアセットを変更することなくアカウントの所有権を変更できる、不可欠なセキュリティ機能です。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## アカウントを新しいキーに移行する
|
|
8
9
|
|
|
9
10
|
`migrateAccount` 関数を使用すると、既存のアカウントアドレスを新しい公開キーに関連付けることができます。これは、次のような複数のシナリオで役立ちます。
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
* **キーの漏洩**:秘密キーが漏洩した疑いがある場合、アカウントを新しい安全なキーペアに移行して不正アクセスを防ぐことができます。
|
|
13
|
+
* **セキュリティのアップグレード**:古いタイプのキーから、より新しく安全なキーに移行したい場合があるかもしれません。
|
|
13
14
|
|
|
14
15
|
この操作は、ブロックチェーン上の履歴と状態を維持しながら、アカウントの制御を効果的に移転します。
|
|
15
16
|
|
|
@@ -70,4 +71,4 @@ migrate();
|
|
|
70
71
|
|
|
71
72
|
---
|
|
72
73
|
|
|
73
|
-
キーを移行してアカウントを保護する方法がわかったので、次はプライマリーキーを共有することなく、他のアカウントに限定的な権限を付与する方法を学びたいと思うかもしれません。詳細については、[権限の委任](./how-to-guides-delegate-permissions.md)ガイドを参照してください。
|
|
74
|
+
キーを移行してアカウントを保護する方法がわかったので、次はプライマリーキーを共有することなく、他のアカウントに限定的な権限を付与する方法を学びたいと思うかもしれません。詳細については、[権限の委任](./how-to-guides-delegate-permissions.md)ガイドを参照してください。
|
|
@@ -4,12 +4,13 @@ On an OCAP-powered blockchain, an account is fundamentally a state associated wi
|
|
|
4
4
|
|
|
5
5
|
This guide focuses on a critical account management operation: migrating an account to a new set of keys. This is an essential security feature that allows you to change the ownership of an account without altering its address, balance, or assets.
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## Migrate an Account to New Keys
|
|
8
9
|
|
|
9
10
|
The `migrateAccount` function allows you to associate an existing account address with a new public key. This is useful in several scenarios, such as:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
* **Key Compromise**: If you suspect your private key has been exposed, you can migrate the account to a new, secure key pair to prevent unauthorized access.
|
|
13
|
+
* **Upgrading Security**: You might want to migrate from an older key type to a newer, more secure one.
|
|
13
14
|
|
|
14
15
|
This operation effectively transfers control of the account while preserving its history and state on the blockchain.
|
|
15
16
|
|
|
@@ -70,4 +71,4 @@ migrate();
|
|
|
70
71
|
|
|
71
72
|
---
|
|
72
73
|
|
|
73
|
-
Now that you know how to secure your account by migrating keys, you might want to learn how to grant limited permissions to other accounts without sharing your primary keys. See the [Delegate Permissions](./how-to-guides-delegate-permissions.md) guide for more details.
|
|
74
|
+
Now that you know how to secure your account by migrating keys, you might want to learn how to grant limited permissions to other accounts without sharing your primary keys. See the [Delegate Permissions](./how-to-guides-delegate-permissions.md) guide for more details.
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
本指南著重於一項關鍵的帳號管理操作:將帳號遷移到一組新的金鑰。這是一項重要的安全功能,可讓您在不改變帳號地址、餘額或資產的情況下,變更帳號的所有權。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 將帳號遷移至新金鑰
|
|
8
9
|
|
|
9
10
|
`migrateAccount` 函式可讓您將現有帳號地址與一個新的公鑰關聯起來。這在多種情況下都很有用,例如:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
* **金鑰洩露**:如果您懷疑自己的私鑰可能已經洩露,可以將帳號遷移到一對新的、安全的金鑰對,以防止未經授權的存取。
|
|
13
|
+
* **升級安全性**:您可能希望從舊的金鑰類型遷移到更新、更安全的類型。
|
|
13
14
|
|
|
14
15
|
此操作有效地轉移了帳號的控制權,同時保留其在區塊鏈上的歷史和狀態。
|
|
15
16
|
|
|
@@ -70,4 +71,4 @@ migrate();
|
|
|
70
71
|
|
|
71
72
|
---
|
|
72
73
|
|
|
73
|
-
現在您已了解如何透過遷移金鑰來保護您的帳號,您可能想學習如何在不分享主金鑰的情況下,授予有限權限給其他帳號。請參閱 [委派權限](./how-to-guides-delegate-permissions.md) 指南以獲取更多詳細資訊。
|
|
74
|
+
現在您已了解如何透過遷移金鑰來保護您的帳號,您可能想學習如何在不分享主金鑰的情況下,授予有限權限給其他帳號。請參閱 [委派權限](./how-to-guides-delegate-permissions.md) 指南以獲取更多詳細資訊。
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
本指南重点介绍一个关键的账户管理操作:将账户迁移到一组新的密钥。这是一项重要的安全功能,允许您在不改变账户地址、余额或资产的情况下更改账户的所有权。
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## 将账户迁移到新密钥
|
|
8
9
|
|
|
9
10
|
`migrateAccount` 函数允许您将一个现有的账户地址与一个新的公钥关联起来。这在多种场景下都很有用,例如:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
* **密钥泄露**:如果您怀疑自己的私钥已被泄露,可以将账户迁移到一个新的、安全的密钥对,以防止未经授权的访问。
|
|
13
|
+
* **升级安全性**:您可能希望从旧的密钥类型迁移到更新、更安全的密钥类型。
|
|
13
14
|
|
|
14
15
|
此操作可以有效地转移账户的控制权,同时保留其在区块链上的历史和状态。
|
|
15
16
|
|
|
@@ -70,4 +71,4 @@ migrate();
|
|
|
70
71
|
|
|
71
72
|
---
|
|
72
73
|
|
|
73
|
-
现在您已经了解了如何通过迁移密钥来保护您的账户,您可能想学习如何在不共享主密钥的情况下向其他账户授予有限的权限。更多详情请参阅[委托权限](./how-to-guides-delegate-permissions.md)指南。
|
|
74
|
+
现在您已经了解了如何通过迁移密钥来保护您的账户,您可能想学习如何在不共享主密钥的情况下向其他账户授予有限的权限。更多详情请参阅[委托权限](./how-to-guides-delegate-permissions.md)指南。
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
このガイドでは、OCAP クライアントを使用して、アセットとしても知られる非代替性トークン(NFT)のライフサイクル全体を管理するための包括的なウォークスルーを提供します。新しいアセットをゼロから作成し、そのプロパティを更新し、標準化されたミントのためのアセットファクトリーを設立し、そのファクトリーから新しいアセットを取得する方法を学びます。
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## 新しいアセットの作成
|
|
6
7
|
|
|
7
8
|
`createAsset` メソッドを使用して、ブロックチェーン上にユニークでスタンドアロンなアセットを作成できます。各アセットには、その初期プロパティから派生したユニークなオンチェーンアドレスが割り当てられます。
|
|
@@ -60,6 +61,7 @@ createNewAsset();
|
|
|
60
61
|
|
|
61
62
|
---
|
|
62
63
|
|
|
64
|
+
|
|
63
65
|
## 既存アセットの更新
|
|
64
66
|
|
|
65
67
|
アセットが `readonly: false` で作成された場合、`updateAsset` メソッドを使用してその `moniker` と `data` フィールドを変更できます。アセットは、そのユニークなアドレスによって識別されます。
|
|
@@ -109,6 +111,7 @@ updateExistingAsset();
|
|
|
109
111
|
|
|
110
112
|
---
|
|
111
113
|
|
|
114
|
+
|
|
112
115
|
## アセットファクトリーの作成
|
|
113
116
|
|
|
114
117
|
アセットファクトリーは、複数の類似したアセットを作成するためのテンプレートです。新しいアセットをミントするための構造、ルール、ロジックを定義し、それぞれを個別に作成するよりも効率的です。これは、イベントチケット、証明書、コレクティブルの発行などのユースケースに最適です。
|
|
@@ -170,7 +173,6 @@ createFactory();
|
|
|
170
173
|
<x-field data-name="wallet" data-type="WalletObject" data-required="true" data-desc="ファクトリー所有者のウォレットオブジェクト。"></x-field>
|
|
171
174
|
</x-field-group>
|
|
172
175
|
|
|
173
|
-
|
|
174
176
|
### 戻り値
|
|
175
177
|
|
|
176
178
|
トランザクションハッシュと新しいファクトリーのオンチェーンアドレスを含む配列に解決される `Promise`。
|
|
@@ -179,6 +181,7 @@ createFactory();
|
|
|
179
181
|
|
|
180
182
|
---
|
|
181
183
|
|
|
184
|
+
|
|
182
185
|
## ファクトリーからのアセットの取得
|
|
183
186
|
|
|
184
187
|
ファクトリーからアセットを取得するのは2段階のプロセスです。まず、ミントデータを準備し、これにより作成されるアセットをプレビューできます。次に、トランザクションをブロックチェーンに送信して、アセットを正式に取得します。
|
|
@@ -256,6 +259,7 @@ acquireNewAsset();
|
|
|
256
259
|
|
|
257
260
|
---
|
|
258
261
|
|
|
262
|
+
|
|
259
263
|
## ファクトリーからのアセットのミント
|
|
260
264
|
|
|
261
265
|
ユーザー主導の `acquireAsset` フローに加えて、承認された発行者(ファクトリー所有者や信頼された発行者など)がアセットをミントし、ユーザーのアカウントに直接送信できます。このプロセスでも `preMintAsset` を使用してデータを準備しますが、最終的なトランザクションは発行者によって署名された `mintAsset` です。
|
|
@@ -329,4 +333,4 @@ mintNewAsset();
|
|
|
329
333
|
|
|
330
334
|
`mintAsset` 操作のトランザクションハッシュに解決される `Promise`。
|
|
331
335
|
|
|
332
|
-
<x-field data-name="response" data-type="Promise<string>" data-desc="transactionHash"></x-field>
|
|
336
|
+
<x-field data-name="response" data-type="Promise<string>" data-desc="transactionHash"></x-field>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This guide provides a comprehensive walkthrough of managing the entire lifecycle of Non-Fungible Tokens (NFTs), also known as assets, using the OCAP Client. You will learn how to create new assets from scratch, update their properties, establish an asset factory for standardized minting, and acquire new assets from that factory.
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## Create a New Asset
|
|
6
7
|
|
|
7
8
|
You can create a unique, standalone asset on the blockchain using the `createAsset` method. Each asset is assigned a unique on-chain address derived from its initial properties.
|
|
@@ -60,6 +61,7 @@ A `Promise` that resolves to an array containing the transaction hash and the ne
|
|
|
60
61
|
|
|
61
62
|
---
|
|
62
63
|
|
|
64
|
+
|
|
63
65
|
## Update an Existing Asset
|
|
64
66
|
|
|
65
67
|
If an asset was created with `readonly: false`, you can modify its `moniker` and `data` fields using the `updateAsset` method. The asset is identified by its unique address.
|
|
@@ -109,6 +111,7 @@ A `Promise` that resolves to the transaction hash.
|
|
|
109
111
|
|
|
110
112
|
---
|
|
111
113
|
|
|
114
|
+
|
|
112
115
|
## Create an Asset Factory
|
|
113
116
|
|
|
114
117
|
An Asset Factory is a template for creating multiple, similar assets. It defines the structure, rules, and logic for minting new assets, which is more efficient than creating each one individually. This is ideal for use cases like issuing event tickets, certificates, or collectibles.
|
|
@@ -170,7 +173,6 @@ createFactory();
|
|
|
170
173
|
<x-field data-name="wallet" data-type="WalletObject" data-required="true" data-desc="The wallet object of the factory's owner."></x-field>
|
|
171
174
|
</x-field-group>
|
|
172
175
|
|
|
173
|
-
|
|
174
176
|
### Returns
|
|
175
177
|
|
|
176
178
|
A `Promise` that resolves to an array containing the transaction hash and the new factory's on-chain address.
|
|
@@ -179,6 +181,7 @@ A `Promise` that resolves to an array containing the transaction hash and the ne
|
|
|
179
181
|
|
|
180
182
|
---
|
|
181
183
|
|
|
184
|
+
|
|
182
185
|
## Acquire an Asset from a Factory
|
|
183
186
|
|
|
184
187
|
Acquiring an asset from a factory is a two-step process. First, you prepare the minting data, which allows you to preview the asset that will be created. Second, you submit the transaction to the blockchain to officially acquire the asset.
|
|
@@ -256,6 +259,7 @@ A `Promise` that resolves to the transaction hash for the `acquireAsset` operati
|
|
|
256
259
|
|
|
257
260
|
---
|
|
258
261
|
|
|
262
|
+
|
|
259
263
|
## Mint an Asset from a Factory
|
|
260
264
|
|
|
261
265
|
In addition to the user-led `acquireAsset` flow, an authorized issuer (such as the factory owner or a trusted issuer) can mint an asset and send it directly to a user's account. This process also uses `preMintAsset` to prepare the data, but the final transaction is `mintAsset`, signed by the issuer.
|
|
@@ -329,4 +333,4 @@ mintNewAsset();
|
|
|
329
333
|
|
|
330
334
|
A `Promise` that resolves to the transaction hash for the `mintAsset` operation.
|
|
331
335
|
|
|
332
|
-
<x-field data-name="response" data-type="Promise<string>" data-desc="transactionHash"></x-field>
|
|
336
|
+
<x-field data-name="response" data-type="Promise<string>" data-desc="transactionHash"></x-field>
|