@ocap/client 1.28.6 → 1.28.8

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.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/dist/base.js +1 -3
  3. package/dist/base.js.map +1 -1
  4. package/dist/browser.d.ts +270 -175
  5. package/dist/bundle.js +1 -1
  6. package/dist/extension.js +0 -8
  7. package/dist/extension.js.map +1 -1
  8. package/dist/lite.js +0 -1
  9. package/dist/lite.js.map +1 -1
  10. package/dist/module.js +1 -1
  11. package/dist/module.js.map +1 -1
  12. package/dist/report.html +2 -2
  13. package/docs/QUERIES.md +2 -2
  14. package/docs/README.md +2 -2
  15. package/docs/api-reference-client-methods.ja.md +6 -1
  16. package/docs/api-reference-client-methods.md +5 -0
  17. package/docs/api-reference-client-methods.zh-TW.md +6 -1
  18. package/docs/api-reference-client-methods.zh.md +6 -1
  19. package/docs/api-reference-data-types.ja.md +6 -1
  20. package/docs/api-reference-data-types.md +6 -1
  21. package/docs/api-reference-data-types.zh-TW.md +6 -1
  22. package/docs/api-reference-data-types.zh.md +6 -1
  23. package/docs/api-reference-low-level-api.ja.md +9 -5
  24. package/docs/api-reference-low-level-api.md +9 -5
  25. package/docs/api-reference-low-level-api.zh-TW.md +9 -5
  26. package/docs/api-reference-low-level-api.zh.md +9 -5
  27. package/docs/api-reference-query-mutation-methods.ja.md +5 -3
  28. package/docs/api-reference-query-mutation-methods.md +4 -2
  29. package/docs/api-reference-query-mutation-methods.zh-TW.md +5 -3
  30. package/docs/api-reference-query-mutation-methods.zh.md +5 -3
  31. package/docs/api-reference-transaction-helpers.ja.md +6 -1
  32. package/docs/api-reference-transaction-helpers.md +5 -0
  33. package/docs/api-reference-transaction-helpers.zh-TW.md +6 -1
  34. package/docs/api-reference-transaction-helpers.zh.md +6 -1
  35. package/docs/api-reference.ja.md +1 -1
  36. package/docs/api-reference.md +1 -1
  37. package/docs/api-reference.zh-TW.md +1 -1
  38. package/docs/api-reference.zh.md +1 -1
  39. package/docs/core-concepts-client-architecture.ja.md +16 -11
  40. package/docs/core-concepts-client-architecture.md +16 -11
  41. package/docs/core-concepts-client-architecture.zh-TW.md +16 -11
  42. package/docs/core-concepts-client-architecture.zh.md +16 -11
  43. package/docs/core-concepts-event-subscriptions.ja.md +12 -7
  44. package/docs/core-concepts-event-subscriptions.md +12 -7
  45. package/docs/core-concepts-event-subscriptions.zh-TW.md +12 -7
  46. package/docs/core-concepts-event-subscriptions.zh.md +12 -7
  47. package/docs/core-concepts-gas-payment.ja.md +7 -3
  48. package/docs/core-concepts-gas-payment.md +7 -3
  49. package/docs/core-concepts-gas-payment.zh-TW.md +7 -3
  50. package/docs/core-concepts-gas-payment.zh.md +7 -3
  51. package/docs/core-concepts-transaction-lifecycle.ja.md +15 -7
  52. package/docs/core-concepts-transaction-lifecycle.md +15 -7
  53. package/docs/core-concepts-transaction-lifecycle.zh-TW.md +15 -7
  54. package/docs/core-concepts-transaction-lifecycle.zh.md +15 -7
  55. package/docs/core-concepts.ja.md +1 -1
  56. package/docs/core-concepts.md +1 -1
  57. package/docs/core-concepts.zh-TW.md +1 -1
  58. package/docs/core-concepts.zh.md +1 -1
  59. package/docs/getting-started-basic-usage.ja.md +6 -1
  60. package/docs/getting-started-basic-usage.md +6 -1
  61. package/docs/getting-started-basic-usage.zh-TW.md +6 -1
  62. package/docs/getting-started-basic-usage.zh.md +6 -1
  63. package/docs/getting-started-installation.ja.md +7 -3
  64. package/docs/getting-started-installation.md +7 -3
  65. package/docs/getting-started-installation.zh-TW.md +7 -3
  66. package/docs/getting-started-installation.zh.md +7 -3
  67. package/docs/getting-started.ja.md +1 -1
  68. package/docs/getting-started.md +1 -1
  69. package/docs/getting-started.zh-TW.md +1 -1
  70. package/docs/getting-started.zh.md +1 -1
  71. package/docs/how-to-guides-delegate-permissions.ja.md +4 -1
  72. package/docs/how-to-guides-delegate-permissions.md +3 -0
  73. package/docs/how-to-guides-delegate-permissions.zh-TW.md +4 -1
  74. package/docs/how-to-guides-delegate-permissions.zh.md +4 -1
  75. package/docs/how-to-guides-manage-accounts.ja.md +4 -3
  76. package/docs/how-to-guides-manage-accounts.md +4 -3
  77. package/docs/how-to-guides-manage-accounts.zh-TW.md +4 -3
  78. package/docs/how-to-guides-manage-accounts.zh.md +4 -3
  79. package/docs/how-to-guides-manage-assets.ja.md +6 -2
  80. package/docs/how-to-guides-manage-assets.md +6 -2
  81. package/docs/how-to-guides-manage-assets.zh-TW.md +6 -2
  82. package/docs/how-to-guides-manage-assets.zh.md +6 -2
  83. package/docs/how-to-guides-manage-tokens.ja.md +8 -1
  84. package/docs/how-to-guides-manage-tokens.md +8 -1
  85. package/docs/how-to-guides-manage-tokens.zh-TW.md +8 -1
  86. package/docs/how-to-guides-manage-tokens.zh.md +8 -1
  87. package/docs/how-to-guides-stake-tokens-and-assets.ja.md +11 -5
  88. package/docs/how-to-guides-stake-tokens-and-assets.md +11 -5
  89. package/docs/how-to-guides-stake-tokens-and-assets.zh-TW.md +11 -5
  90. package/docs/how-to-guides-stake-tokens-and-assets.zh.md +11 -5
  91. package/docs/how-to-guides-transfer-tokens-and-nfts.ja.md +8 -6
  92. package/docs/how-to-guides-transfer-tokens-and-nfts.md +8 -6
  93. package/docs/how-to-guides-transfer-tokens-and-nfts.zh-TW.md +8 -6
  94. package/docs/how-to-guides-transfer-tokens-and-nfts.zh.md +8 -6
  95. package/docs/how-to-guides.ja.md +1 -1
  96. package/docs/how-to-guides.md +1 -1
  97. package/docs/how-to-guides.zh-TW.md +1 -1
  98. package/docs/how-to-guides.zh.md +1 -1
  99. package/docs/overview.ja.md +5 -3
  100. package/docs/overview.md +5 -3
  101. package/docs/overview.zh-TW.md +5 -3
  102. package/docs/overview.zh.md +5 -3
  103. package/examples/asset.js +0 -2
  104. package/examples/create-secondary-token.js +0 -2
  105. package/examples/declare.js +0 -1
  106. package/examples/delegate-exchange-both.js +1 -3
  107. package/examples/delegate-exchange.js +1 -3
  108. package/examples/delegate-transfer.js +0 -1
  109. package/examples/exchange-secondary-token.js +0 -2
  110. package/examples/exchange.js +0 -2
  111. package/examples/migrate-account.js +0 -1
  112. package/examples/run-no-debug.sh +0 -0
  113. package/examples/run.sh +0 -0
  114. package/examples/subscribe.js +0 -2
  115. package/examples/transfer-asset.js +0 -2
  116. package/examples/transfer-primary-token.js +0 -1
  117. package/examples/transfer-secondary-token.js +0 -2
  118. package/lib/base.js +1 -3
  119. package/lib/base.js.map +1 -1
  120. package/lib/extension.js +0 -8
  121. package/lib/extension.js.map +1 -1
  122. package/lib/lite.js +0 -1
  123. package/lib/lite.js.map +1 -1
  124. package/lib/module.js +1 -1
  125. package/lib/module.js.map +1 -1
  126. package/lib/node.d.ts +270 -175
  127. package/lib/node.js +1 -1
  128. package/lib/node.js.map +1 -1
  129. package/package.json +30 -32
@@ -2,11 +2,12 @@
2
2
 
3
3
  OCAP Client 通过 GraphQL 与区块链进行交互。其方法主要分为两类:
4
4
 
5
- * **查询 (Queries)**:这些是只读操作,用于从区块链中获取数据,例如检索账户状态、列出交易或获取常规链信息。它们不会改变链的状态。
6
- * **变更 (Mutations)**:这些是写入操作,会修改区块链的状态。发送交易是变更操作的主要示例。
5
+ * **查询 (Queries)**:这些是只读操作,用于从区块链中获取数据,例如检索账户状态、列出交易或获取常规链信息。它们不会改变链的状态。
6
+ * **变更 (Mutations)**:这些是写入操作,会修改区块链的状态。发送交易是变更操作的主要示例。
7
7
 
8
8
  本节提供了该客户端所有可用的查询和变更方法的完整参考。
9
9
 
10
+
10
11
  ## 查询方法
11
12
 
12
13
  查询用于从区块链中检索数据。以下是所有可用查询方法的完整列表。
@@ -771,6 +772,7 @@ OCAP Client 通过 GraphQL 与区块链进行交互。其方法主要分为两
771
772
  <x-field data-name="tokenFactories" data-type="IndexedTokenFactoryState[]" data-desc="通证工厂状态对象的数组。"></x-field>
772
773
  </x-field>
773
774
 
775
+
774
776
  ## 变更方法
775
777
 
776
778
  变更用于发送修改区块链状态的交易。
@@ -811,4 +813,4 @@ try {
811
813
  } catch (error) {
812
814
  console.error('Failed to send transaction:', error);
813
815
  }
814
- ```
816
+ ```
@@ -6,6 +6,7 @@
6
6
 
7
7
  ---
8
8
 
9
+
9
10
  ## アカウント管理
10
11
 
11
12
  ### migrateAccount
@@ -102,6 +103,7 @@ console.log('Revocation tx hash:', txHash);
102
103
 
103
104
  ---
104
105
 
106
+
105
107
  ## アセット (NFT) 管理
106
108
 
107
109
  ### createAsset
@@ -277,6 +279,7 @@ console.log('Mint asset tx hash:', txHash);
277
279
 
278
280
  ---
279
281
 
282
+
280
283
  ## トークン管理
281
284
 
282
285
  ### createTokenFactory
@@ -411,6 +414,7 @@ console.log('Burn token tx hash:', txHash);
411
414
 
412
415
  ---
413
416
 
417
+
414
418
  ## 転送と交換
415
419
 
416
420
  ### transfer
@@ -527,6 +531,7 @@ console.log('Exchange tx hash:', txHash);
527
531
 
528
532
  ---
529
533
 
534
+
530
535
  ## ステーキング
531
536
 
532
537
  ### stake
@@ -646,4 +651,4 @@ const txHash = await client.slashStake({
646
651
  wallet: slasherWallet,
647
652
  });
648
653
  console.log('Slash stake tx hash:', txHash);
649
- ```
654
+ ```
@@ -6,6 +6,7 @@ For a deeper understanding of the underlying transaction lifecycle, see [Core Co
6
6
 
7
7
  ---
8
8
 
9
+
9
10
  ## Account Management
10
11
 
11
12
  ### migrateAccount
@@ -102,6 +103,7 @@ console.log('Revocation tx hash:', txHash);
102
103
 
103
104
  ---
104
105
 
106
+
105
107
  ## Asset (NFT) Management
106
108
 
107
109
  ### createAsset
@@ -277,6 +279,7 @@ console.log('Mint asset tx hash:', txHash);
277
279
 
278
280
  ---
279
281
 
282
+
280
283
  ## Token Management
281
284
 
282
285
  ### createTokenFactory
@@ -411,6 +414,7 @@ console.log('Burn token tx hash:', txHash);
411
414
 
412
415
  ---
413
416
 
417
+
414
418
  ## Transfer & Exchange
415
419
 
416
420
  ### transfer
@@ -527,6 +531,7 @@ console.log('Exchange tx hash:', txHash);
527
531
 
528
532
  ---
529
533
 
534
+
530
535
  ## Staking
531
536
 
532
537
  ### stake
@@ -6,6 +6,7 @@
6
6
 
7
7
  ---
8
8
 
9
+
9
10
  ## 帳戶管理
10
11
 
11
12
  ### migrateAccount
@@ -102,6 +103,7 @@ console.log('撤銷委託交易雜湊值:', txHash);
102
103
 
103
104
  ---
104
105
 
106
+
105
107
  ## 資產 (NFT) 管理
106
108
 
107
109
  ### createAsset
@@ -277,6 +279,7 @@ console.log('鑄造資產交易雜湊值:', txHash);
277
279
 
278
280
  ---
279
281
 
282
+
280
283
  ## 代幣管理
281
284
 
282
285
  ### createTokenFactory
@@ -411,6 +414,7 @@ console.log('銷毀代幣交易雜湊值:', txHash);
411
414
 
412
415
  ---
413
416
 
417
+
414
418
  ## 轉帳與交換
415
419
 
416
420
  ### transfer
@@ -527,6 +531,7 @@ console.log('交換交易雜湊值:', txHash);
527
531
 
528
532
  ---
529
533
 
534
+
530
535
  ## 質押
531
536
 
532
537
  ### stake
@@ -646,4 +651,4 @@ const txHash = await client.slashStake({
646
651
  wallet: slasherWallet,
647
652
  });
648
653
  console.log('削減質押交易雜湊值:', txHash);
649
- ```
654
+ ```
@@ -6,6 +6,7 @@
6
6
 
7
7
  ---
8
8
 
9
+
9
10
  ## 账户管理
10
11
 
11
12
  ### migrateAccount
@@ -102,6 +103,7 @@ console.log('Revocation tx hash:', txHash);
102
103
 
103
104
  ---
104
105
 
106
+
105
107
  ## 资产 (NFT) 管理
106
108
 
107
109
  ### createAsset
@@ -277,6 +279,7 @@ console.log('Mint asset tx hash:', txHash);
277
279
 
278
280
  ---
279
281
 
282
+
280
283
  ## 通证管理
281
284
 
282
285
  ### createTokenFactory
@@ -411,6 +414,7 @@ console.log('Burn token tx hash:', txHash);
411
414
 
412
415
  ---
413
416
 
417
+
414
418
  ## 转账与交换
415
419
 
416
420
  ### transfer
@@ -527,6 +531,7 @@ console.log('Exchange tx hash:', txHash);
527
531
 
528
532
  ---
529
533
 
534
+
530
535
  ## 质押
531
536
 
532
537
  ### stake
@@ -646,4 +651,4 @@ const txHash = await client.slashStake({
646
651
  wallet: slasherWallet,
647
652
  });
648
653
  console.log('Slash stake tx hash:', txHash);
649
- ```
654
+ ```
@@ -20,4 +20,4 @@ OCAPクライアントAPIリファレンスへようこそ。このセクショ
20
20
  <x-card data-title="データ型" data-icon="lucide:box" data-href="/api-reference/data-types">
21
21
  クライアントAPI全体で使用されるすべてのカスタムデータ構造、入力パラメータ、およびレスポンスオブジェクトを定義します。
22
22
  </x-card>
23
- </x-cards>
23
+ </x-cards>
@@ -20,4 +20,4 @@ Explore the following sections to dive deeper into the client's capabilities:
20
20
  <x-card data-title="Data Types" data-icon="lucide:box" data-href="/api-reference/data-types">
21
21
  Defines all the custom data structures, input parameters, and response objects used throughout the client API.
22
22
  </x-card>
23
- </x-cards>
23
+ </x-cards>
@@ -20,4 +20,4 @@
20
20
  <x-card data-title="資料類型" data-icon="lucide:box" data-href="/api-reference/data-types">
21
21
  定義了整個客戶端 API 中使用的所有自訂資料結構、輸入參數和回應物件。
22
22
  </x-card>
23
- </x-cards>
23
+ </x-cards>
@@ -20,4 +20,4 @@
20
20
  <x-card data-title="数据类型" data-icon="lucide:box" data-href="/api-reference/data-types">
21
21
  定义了整个客户端 API 中使用的所有自定义数据结构、输入参数和响应对象。
22
22
  </x-card>
23
- </x-cards>
23
+ </x-cards>
@@ -9,9 +9,12 @@ OCAP Client は、さまざまな JavaScript 環境や特定のユースケー
9
9
  以下の図は、異なるクライアント実装間の関係を示しています。
10
10
 
11
11
  <!-- DIAGRAM_IMAGE_START:architecture:4:3 -->
12
+
12
13
  ![Client Architecture](assets/diagram/core-concepts-client-architecture-01.jpg)
14
+
13
15
  <!-- DIAGRAM_IMAGE_END -->
14
16
 
17
+
15
18
  ## クライアント実装
16
19
 
17
20
  以下に、利用可能な各クライアントとその想定されるユースケースの内訳を示します。
@@ -20,10 +23,10 @@ OCAP Client は、さまざまな JavaScript 環境や特定のユースケー
20
23
 
21
24
  これは、他のすべてのクライアントが拡張する、基礎となる軽量なクライアントです。ブロックチェーンとの通信に不可欠な機能を提供します。
22
25
 
23
- - GraphQL のクエリとミューテーションの送信。
24
- - リアルタイムのイベントサブスクリプションのための WebSocket 接続の確立。
25
- - スポンサー付きトランザクションのためのガス支払いヘッダーの処理。
26
- - 環境に依存しませんが、サブスクリプションを使用する場合は、WebSocket と EventEmitter の互換性のある実装を提供する必要があります。
26
+ * GraphQL のクエリとミューテーションの送信。
27
+ * リアルタイムのイベントサブスクリプションのための WebSocket 接続の確立。
28
+ * スポンサー付きトランザクションのためのガス支払いヘッダーの処理。
29
+ * 環境に依存しませんが、サブスクリプションを使用する場合は、WebSocket と EventEmitter の互換性のある実装を提供する必要があります。
27
30
 
28
31
  このクライアントは、基本的な読み取り専用機能のみが必要で、依存関係を最小限に抑えたい場合に最適です。
29
32
 
@@ -41,16 +44,17 @@ OCAP Client は、さまざまな JavaScript 環境や特定のユースケー
41
44
 
42
45
  フロントエンドのウェブアプリケーション向けに設計された `GraphqlClientLite` は `GraphQLClientBase` を拡張し、最小限のバンドルサイズに最適化されています。Node.js 固有の依存関係を `wolfy87-eventemitter` のようなブラウザ互換の代替品に置き換えます。パフォーマンスと読み込み時間が重要なウェブアプリケーションを構築している場合、このクライアントは、フル機能のヘルパーメソッドスイートの余分な重みなしに、OCAP のコア機能を提供します。
43
46
 
47
+
44
48
  ## どのクライアントを使用すべきか?
45
49
 
46
50
  どのクライアントを選択すべきかを判断するために、各シナリオで推奨されるクライアントの概要を以下に示します。
47
51
 
48
- | 環境 | ユースケース | 推奨クライアント | インポートパス |
49
- | :---------- | :------------------------------------------- | :----------------------- | :---------------------- |
50
- | Node.js | バックエンドサービス、スクリプト、CLI ツール | `NativeGraphqlClient` | `@ocap/client/node` |
51
- | ブラウザ | 一般的なウェブアプリケーション(例:React, Vue) | `GraphQLClient` | `@ocap/client` |
52
- | ブラウザ | バンドルサイズに敏感なアプリケーション | `GraphqlClientLite` | `@ocap/client/lite` |
53
- | 任意 | 読み取り専用、最小限の機能が必要 | `GraphQLClientBase` | `@ocap/client/base` |
52
+ | 環境 | ユースケース | 推奨クライアント | インポートパス |
53
+ | :------ | :---------------------------- | :-------------------- | :------------------ |
54
+ | Node.js | バックエンドサービス、スクリプト、CLI ツール | `NativeGraphqlClient` | `@ocap/client/node` |
55
+ | ブラウザ | 一般的なウェブアプリケーション(例:React, Vue) | `GraphQLClient` | `@ocap/client` |
56
+ | ブラウザ | バンドルサイズに敏感なアプリケーション | `GraphqlClientLite` | `@ocap/client/lite` |
57
+ | 任意 | 読み取り専用、最小限の機能が必要 | `GraphQLClientBase` | `@ocap/client/base` |
54
58
 
55
59
  ### インポートの例
56
60
 
@@ -71,8 +75,9 @@ const GraphqlClientLite = require('@ocap/client/lite');
71
75
  const client = new GraphqlClientLite('https://beta.abtnetwork.io/api');
72
76
  ```
73
77
 
78
+
74
79
  ## まとめ
75
80
 
76
81
  さまざまなクライアント実装を理解することで、アプリケーションの環境と要件に最も適した情報に基づいた選択ができます。適切なクライアントを選択することで、パフォーマンス、バンドルサイズ、使いやすさを最適化できます。
77
82
 
78
- クライアントアーキテクチャを理解したところで、トランザクションがどのように構築され、処理されるかについてさらに深く掘り下げることができます。詳細は [トランザクションのライフサイクル](./core-concepts-transaction-lifecycle.md) ガイドをご覧ください。
83
+ クライアントアーキテクチャを理解したところで、トランザクションがどのように構築され、処理されるかについてさらに深く掘り下げることができます。詳細は [トランザクションのライフサイクル](./core-concepts-transaction-lifecycle.md) ガイドをご覧ください。
@@ -9,9 +9,12 @@ All client variations are built upon a common base, `GraphQLClientBase`, which p
9
9
  The following diagram illustrates the relationship between the different client implementations:
10
10
 
11
11
  <!-- DIAGRAM_IMAGE_START:architecture:4:3 -->
12
+
12
13
  ![Client Architecture](assets/diagram/core-concepts-client-architecture-01.jpg)
14
+
13
15
  <!-- DIAGRAM_IMAGE_END -->
14
16
 
17
+
15
18
  ## Client Implementations
16
19
 
17
20
  Here's a breakdown of each available client and its intended use case.
@@ -20,10 +23,10 @@ Here's a breakdown of each available client and its intended use case.
20
23
 
21
24
  This is the foundational, lightweight client that all other clients extend. It provides the essential features for communicating with the blockchain:
22
25
 
23
- - Sending GraphQL queries and mutations.
24
- - Establishing WebSocket connections for real-time event subscriptions.
25
- - Handling gas payment headers for sponsored transactions.
26
- - It is environment-agnostic but requires you to provide compatible implementations for WebSockets and EventEmitters if you use subscriptions.
26
+ * Sending GraphQL queries and mutations.
27
+ * Establishing WebSocket connections for real-time event subscriptions.
28
+ * Handling gas payment headers for sponsored transactions.
29
+ * It is environment-agnostic but requires you to provide compatible implementations for WebSockets and EventEmitters if you use subscriptions.
27
30
 
28
31
  This client is ideal if you only need basic, read-only functionality and want to minimize dependencies.
29
32
 
@@ -41,16 +44,17 @@ This client is specifically optimized for the Node.js runtime. It extends the fu
41
44
 
42
45
  Designed for front-end web applications, the `GraphqlClientLite` extends `GraphQLClientBase` and is optimized for minimal bundle size. It swaps out Node.js-specific dependencies for browser-compatible alternatives like `wolfy87-eventemitter`. If you are building a web application where performance and load times are critical, this client provides the core OCAP functionality without the extra weight of the full helper method suite.
43
46
 
47
+
44
48
  ## Which Client Should I Use?
45
49
 
46
50
  To help you decide, here is a summary of the recommended client for each scenario:
47
51
 
48
- | Environment | Use Case | Recommended Client | Import Path |
49
- | :---------- | :------------------------------------------- | :----------------------- | :---------------------- |
50
- | Node.js | Backend services, scripts, CLI tools | `NativeGraphqlClient` | `@ocap/client/node` |
51
- | Browser | General web applications (e.g., React, Vue) | `GraphQLClient` | `@ocap/client` |
52
- | Browser | Bundle-size sensitive applications | `GraphqlClientLite` | `@ocap/client/lite` |
53
- | Any | Read-only, minimal functionality required | `GraphQLClientBase` | `@ocap/client/base` |
52
+ | Environment | Use Case | Recommended Client | Import Path |
53
+ | :---------- | :------------------------------------------ | :-------------------- | :------------------ |
54
+ | Node.js | Backend services, scripts, CLI tools | `NativeGraphqlClient` | `@ocap/client/node` |
55
+ | Browser | General web applications (e.g., React, Vue) | `GraphQLClient` | `@ocap/client` |
56
+ | Browser | Bundle-size sensitive applications | `GraphqlClientLite` | `@ocap/client/lite` |
57
+ | Any | Read-only, minimal functionality required | `GraphQLClientBase` | `@ocap/client/base` |
54
58
 
55
59
  ### Example Imports
56
60
 
@@ -71,8 +75,9 @@ const GraphqlClientLite = require('@ocap/client/lite');
71
75
  const client = new GraphqlClientLite('https://beta.abtnetwork.io/api');
72
76
  ```
73
77
 
78
+
74
79
  ## Summary
75
80
 
76
81
  Understanding the different client implementations allows you to make an informed choice that best fits your application's environment and requirements. By selecting the appropriate client, you can optimize for performance, bundle size, and ease of use.
77
82
 
78
- Now that you understand the client architecture, you can dive deeper into how transactions are constructed and processed. Learn more in the [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md) guide.
83
+ Now that you understand the client architecture, you can dive deeper into how transactions are constructed and processed. Learn more in the [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md) guide.
@@ -9,9 +9,12 @@ OCAP 用戶端採用模組化架構設計,以滿足不同 JavaScript 環境和
9
9
  下圖說明了不同用戶端實作之間的關係:
10
10
 
11
11
  <!-- DIAGRAM_IMAGE_START:architecture:4:3 -->
12
+
12
13
  ![Client Architecture](assets/diagram/core-concepts-client-architecture-01.jpg)
14
+
13
15
  <!-- DIAGRAM_IMAGE_END -->
14
16
 
17
+
15
18
  ## 用戶端實作
16
19
 
17
20
  以下是每種可用用戶端及其預期使用情境的詳細說明。
@@ -20,10 +23,10 @@ OCAP 用戶端採用模組化架構設計,以滿足不同 JavaScript 環境和
20
23
 
21
24
  這是所有其他用戶端擴充的基礎輕量級用戶端。它提供了與區塊鏈通訊的基本功能:
22
25
 
23
- - 傳送 GraphQL 查詢和變更。
24
- - 建立 WebSocket 連線以進行即時事件訂閱。
25
- - 處理贊助交易的 Gas 支付標頭。
26
- - 它與環境無關,但如果您使用訂閱功能,則需要為 WebSocket 和 EventEmitter 提供相容的實作。
26
+ * 傳送 GraphQL 查詢和變更。
27
+ * 建立 WebSocket 連線以進行即時事件訂閱。
28
+ * 處理贊助交易的 Gas 支付標頭。
29
+ * 它與環境無關,但如果您使用訂閱功能,則需要為 WebSocket 和 EventEmitter 提供相容的實作。
27
30
 
28
31
  如果您只需要基本的唯讀功能並希望最小化依賴性,那麼此用戶端是理想的選擇。
29
32
 
@@ -41,16 +44,17 @@ OCAP 用戶端採用模組化架構設計,以滿足不同 JavaScript 環境和
41
44
 
42
45
  專為前端網頁應用程式設計,`GraphqlClientLite` 擴充了 `GraphQLClientBase`,並針對最小化套件大小進行了最佳化。它將 Node.js 特有的依賴項替換為瀏覽器相容的替代方案,例如 `wolfy87-eventemitter`。如果您正在建構一個對效能和載入時間至關重要的網頁應用程式,此用戶端可以在不增加完整輔助方法套件額外負擔的情況下,提供核心的 OCAP 功能。
43
46
 
47
+
44
48
  ## 我該使用哪個用戶端?
45
49
 
46
50
  為幫助您決定,以下是針對各種情境的建議用戶端摘要:
47
51
 
48
- | 環境 | 使用情境 | 建議的用戶端 | 匯入路徑 |
49
- | :---------- | :------------------------------------------- | :----------------------- | :---------------------- |
50
- | Node.js | 後端服務、指令碼、CLI 工具 | `NativeGraphqlClient` | `@ocap/client/node` |
51
- | 瀏覽器 | 一般網頁應用程式 (例如 React、Vue) | `GraphQLClient` | `@ocap/client` |
52
- | 瀏覽器 | 對套件大小敏感的應用程式 | `GraphqlClientLite` | `@ocap/client/lite` |
53
- | 任何環境 | 唯讀、需要最少功能 | `GraphQLClientBase` | `@ocap/client/base` |
52
+ | 環境 | 使用情境 | 建議的用戶端 | 匯入路徑 |
53
+ | :------ | :---------------------- | :-------------------- | :------------------ |
54
+ | Node.js | 後端服務、指令碼、CLI 工具 | `NativeGraphqlClient` | `@ocap/client/node` |
55
+ | 瀏覽器 | 一般網頁應用程式 (例如 React、Vue) | `GraphQLClient` | `@ocap/client` |
56
+ | 瀏覽器 | 對套件大小敏感的應用程式 | `GraphqlClientLite` | `@ocap/client/lite` |
57
+ | 任何環境 | 唯讀、需要最少功能 | `GraphQLClientBase` | `@ocap/client/base` |
54
58
 
55
59
  ### 匯入範例
56
60
 
@@ -71,8 +75,9 @@ const GraphqlClientLite = require('@ocap/client/lite');
71
75
  const client = new GraphqlClientLite('https://beta.abtnetwork.io/api');
72
76
  ```
73
77
 
78
+
74
79
  ## 總結
75
80
 
76
81
  了解不同的用戶端實作,能讓您根據應用程式的環境和需求做出明智的選擇。透過選擇適當的用戶端,您可以針對效能、套件大小和易用性進行最佳化。
77
82
 
78
- 現在您已經了解了用戶端架構,可以更深入地研究交易是如何建構和處理的。請在 [交易生命週期](./core-concepts-transaction-lifecycle.md) 指南中了解更多資訊。
83
+ 現在您已經了解了用戶端架構,可以更深入地研究交易是如何建構和處理的。請在 [交易生命週期](./core-concepts-transaction-lifecycle.md) 指南中了解更多資訊。
@@ -9,9 +9,12 @@ OCAP 客户端采用模块化架构设计,以满足不同 JavaScript 环境和
9
9
  下图说明了不同客户端实现之间的关系:
10
10
 
11
11
  <!-- DIAGRAM_IMAGE_START:architecture:4:3 -->
12
+
12
13
  ![Client Architecture](assets/diagram/core-concepts-client-architecture-01.jpg)
14
+
13
15
  <!-- DIAGRAM_IMAGE_END -->
14
16
 
17
+
15
18
  ## 客户端实现
16
19
 
17
20
  以下是每种可用客户端及其预期用例的详细说明。
@@ -20,10 +23,10 @@ OCAP 客户端采用模块化架构设计,以满足不同 JavaScript 环境和
20
23
 
21
24
  这是所有其他客户端都扩展的基础、轻量级客户端。它提供了与区块链通信的基本功能:
22
25
 
23
- - 发送 GraphQL 查询和变更。
24
- - 建立用于实时事件订阅的 WebSocket 连接。
25
- - 处理用于代付交易的 gas 支付头。
26
- - 它与环境无关,但如果您使用订阅功能,则需要为 WebSocket 和 EventEmitter 提供兼容的实现。
26
+ * 发送 GraphQL 查询和变更。
27
+ * 建立用于实时事件订阅的 WebSocket 连接。
28
+ * 处理用于代付交易的 gas 支付头。
29
+ * 它与环境无关,但如果您使用订阅功能,则需要为 WebSocket 和 EventEmitter 提供兼容的实现。
27
30
 
28
31
  如果您只需要基本的只读功能并希望最小化依赖项,那么这个客户端是理想的选择。
29
32
 
@@ -41,16 +44,17 @@ OCAP 客户端采用模块化架构设计,以满足不同 JavaScript 环境和
41
44
 
42
45
  `GraphqlClientLite` 专为前端 Web 应用程序设计,它扩展了 `GraphQLClientBase` 并为最小化包体积进行了优化。它将 Node.js 特定的依赖项替换为浏览器兼容的替代品,如 `wolfy87-eventemitter`。如果您正在构建一个性能和加载时间至关重要的 Web 应用程序,该客户端可以在不增加完整辅助方法套件额外负担的情况下提供核心 OCAP 功能。
43
46
 
47
+
44
48
  ## 我应该使用哪个客户端?
45
49
 
46
50
  为了帮助您做出决定,以下是针对每种场景推荐的客户端摘要:
47
51
 
48
- | 环境 | 使用场景 | 推荐客户端 | 导入路径 |
49
- | :---------- | :------------------------------------------- | :----------------------- | :---------------------- |
50
- | Node.js | 后端服务、脚本、CLI 工具 | `NativeGraphqlClient` | `@ocap/client/node` |
51
- | 浏览器 | 通用 Web 应用(例如 React、Vue) | `GraphQLClient` | `@ocap/client` |
52
- | 浏览器 | 对包体积敏感的应用 | `GraphqlClientLite` | `@ocap/client/lite` |
53
- | 任何环境 | 只读,仅需最少功能 | `GraphQLClientBase` | `@ocap/client/base` |
52
+ | 环境 | 使用场景 | 推荐客户端 | 导入路径 |
53
+ | :------ | :---------------------- | :-------------------- | :------------------ |
54
+ | Node.js | 后端服务、脚本、CLI 工具 | `NativeGraphqlClient` | `@ocap/client/node` |
55
+ | 浏览器 | 通用 Web 应用(例如 React、Vue) | `GraphQLClient` | `@ocap/client` |
56
+ | 浏览器 | 对包体积敏感的应用 | `GraphqlClientLite` | `@ocap/client/lite` |
57
+ | 任何环境 | 只读,仅需最少功能 | `GraphQLClientBase` | `@ocap/client/base` |
54
58
 
55
59
  ### 导入示例
56
60
 
@@ -71,8 +75,9 @@ const GraphqlClientLite = require('@ocap/client/lite');
71
75
  const client = new GraphqlClientLite('https://beta.abtnetwork.io/api');
72
76
  ```
73
77
 
78
+
74
79
  ## 总结
75
80
 
76
81
  了解不同的客户端实现,可以帮助您根据应用程序的环境和需求做出明智的选择。通过选择合适的客户端,您可以优化性能、包体积和易用性。
77
82
 
78
- 现在您已经了解了客户端架构,可以更深入地了解交易是如何构建和处理的。请在[交易生命周期](./core-concepts-transaction-lifecycle.md)指南中了解更多信息。
83
+ 现在您已经了解了客户端架构,可以更深入地了解交易是如何构建和处理的。请在[交易生命周期](./core-concepts-transaction-lifecycle.md)指南中了解更多信息。
@@ -4,12 +4,14 @@ OCAP Clientは、アプリケーションがオンチェーンアクティビテ
4
4
 
5
5
  特定のイベントトピックをサブスクライブすることで、新しいトランザクションが作成されたとき、アセットが転送されたとき、またはトークンが交換されたときなど、さまざまなオンチェーンイベントの即時通知を受け取ることができます。これは、ブロックチェーンの状態変化にリアルタイムで反応する、レスポンシブでインタラクティブなアプリケーションを構築するために不可欠です。これらのイベントが何によってトリガーされるかをより深く理解するには、[トランザクションライフサイクル](./core-concepts-transaction-lifecycle.md)を確認することをお勧めします。
6
6
 
7
+
7
8
  ## 仕組み
8
9
 
9
10
  内部では、イベントを最初にサブスクライブすると、OCAP Clientは自動的にブロックチェーンノードの指定されたエンドポイントへのWebSocket接続を確立します。この接続は維持され、イベントが発生するとすぐにノードがクライアントにイベントデータを直接プッシュできるようになります。
10
11
 
11
12
  クライアントはWebSocket接続のライフサイクルを管理します。初回接続を処理し、接続をアクティブに保つためにハートビートメッセージを送信し、接続が切断された場合に再接続を試みます。これにより、最小限の設定で安定した信頼性の高いイベントストリームが保証されます。
12
13
 
14
+
13
15
  ## イベントのサブスクライブ
14
16
 
15
17
  イベントのリッスンを開始するには、`subscribe` メソッドを使用します。イベントトピック(イベントを識別する文字列)と、そのイベントが受信されるたびに実行されるコールバック関数を提供します。
@@ -38,12 +40,13 @@ client.subscribe('tx.create', handleNewTransaction);
38
40
 
39
41
  イベントトピックは通常、`tx.<transaction_type>` のパターンに従います。以下にいくつかの一般的な例を示します。
40
42
 
41
- | トピック | 説明 |
42
- |---|---|
43
- | `tx.create` | 新しいトランザクションが正常に処理され、ブロックに追加されたときに発行されます。 |
44
- | `tx.transfer_v2` | 特に `transferV2` トランザクションが発生したときに発行されます。 |
45
- | `tx.exchange_v2` | `exchangeV2` (アトミックスワップ) トランザクションが完了したときに発行されます。 |
46
- | `tx.create_asset` | 新しいアセット (NFT) が作成されたときに発行されます。 |
43
+ | トピック | 説明 |
44
+ | ----------------- | ------------------------------------------------ |
45
+ | `tx.create` | 新しいトランザクションが正常に処理され、ブロックに追加されたときに発行されます。 |
46
+ | `tx.transfer_v2` | 特に `transferV2` トランザクションが発生したときに発行されます。 |
47
+ | `tx.exchange_v2` | `exchangeV2` (アトミックスワップ) トランザクションが完了したときに発行されます。 |
48
+ | `tx.create_asset` | 新しいアセット (NFT) が作成されたときに発行されます。 |
49
+
47
50
 
48
51
  ## イベントのサブスクライブ解除
49
52
 
@@ -66,6 +69,7 @@ client.unsubscribe('tx.create');
66
69
  <x-field data-name="callback" data-type="Function" data-required="false" data-desc="オプション。削除する特定のコールバック関数。省略した場合、指定されたトピックのすべてのリスナーが削除されます。"></x-field>
67
70
  </x-field-group>
68
71
 
72
+
69
73
  ## 完全な例
70
74
 
71
75
  イベントのサブスクライブ、トリガー、そしてサブスクライブ解除を実演する完全な例を以下に示します。
@@ -116,8 +120,9 @@ const main = async () => {
116
120
  main().catch(console.error);
117
121
  ```
118
122
 
123
+
119
124
  ## まとめ
120
125
 
121
126
  イベントサブスクリプションは、OCAP Clientを使用して動的なdAppを構築するためのコア機能です。信頼性の高いWebSocket接続を使用してオンチェーンイベントにリアルタイムで反応するための、シンプルかつ強力なAPIを提供します。`subscribe` および `unsubscribe` メソッドを使用することで、アプリケーション内のリアルタイムデータフローを効率的に管理できます。
122
127
 
123
- トランザクションがどのように構築・送信され、それがこれらのイベントを生成するかの詳細については、[トランザクションライフサイクル](./core-concepts-transaction-lifecycle.md)のドキュメントを参照してください。イベントリスナーと組み合わせると便利な、ユーザーのトランザクション手数料をスポンサーする方法については、[ガス支払い](./core-concepts-gas-payment.md)をお読みください。
128
+ トランザクションがどのように構築・送信され、それがこれらのイベントを生成するかの詳細については、[トランザクションライフサイクル](./core-concepts-transaction-lifecycle.md)のドキュメントを参照してください。イベントリスナーと組み合わせると便利な、ユーザーのトランザクション手数料をスポンサーする方法については、[ガス支払い](./core-concepts-gas-payment.md)をお読みください。
@@ -4,12 +4,14 @@ The OCAP Client provides a powerful, real-time event subscription system that al
4
4
 
5
5
  By subscribing to specific event topics, you can receive instant notifications for a wide range of on-chain events, such as when a new transaction is created, an asset is transferred, or a token is exchanged. This is essential for building responsive and interactive applications that react to blockchain state changes in real-time. For a deeper understanding of what triggers these events, you might want to review the [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md).
6
6
 
7
+
7
8
  ## How It Works
8
9
 
9
10
  Under the hood, when you first subscribe to an event, the OCAP Client automatically establishes a WebSocket connection to the designated endpoint of the blockchain node. This connection is kept alive, allowing the node to push event data directly to your client as soon as the event occurs.
10
11
 
11
12
  The client manages the WebSocket connection lifecycle for you. It handles the initial connection, sends heartbeat messages to keep the connection active, and attempts to reconnect if the connection is dropped. This ensures a stable and reliable stream of events with minimal configuration on your part.
12
13
 
14
+
13
15
  ## Subscribing to Events
14
16
 
15
17
  To start listening for events, you use the `subscribe` method. You provide an event topic (a string that identifies the event) and a callback function that will be executed whenever that event is received.
@@ -38,12 +40,13 @@ client.subscribe('tx.create', handleNewTransaction);
38
40
 
39
41
  Event topics generally follow the pattern `tx.<transaction_type>`. Here are some common examples:
40
42
 
41
- | Topic | Description |
42
- |---|---|
43
- | `tx.create` | Fired when any new transaction is successfully processed and added to a block. |
44
- | `tx.transfer_v2` | Fired specifically when a `transferV2` transaction occurs. |
45
- | `tx.exchange_v2` | Fired when an `exchangeV2` (atomic swap) transaction is completed. |
46
- | `tx.create_asset` | Fired when a new asset (NFT) is created. |
43
+ | Topic | Description |
44
+ | ----------------- | ------------------------------------------------------------------------------ |
45
+ | `tx.create` | Fired when any new transaction is successfully processed and added to a block. |
46
+ | `tx.transfer_v2` | Fired specifically when a `transferV2` transaction occurs. |
47
+ | `tx.exchange_v2` | Fired when an `exchangeV2` (atomic swap) transaction is completed. |
48
+ | `tx.create_asset` | Fired when a new asset (NFT) is created. |
49
+
47
50
 
48
51
  ## Unsubscribing from Events
49
52
 
@@ -66,6 +69,7 @@ client.unsubscribe('tx.create');
66
69
  <x-field data-name="callback" data-type="Function" data-required="false" data-desc="Optional. The specific callback function to remove. If omitted, all listeners for the given topic will be removed."></x-field>
67
70
  </x-field-group>
68
71
 
72
+
69
73
  ## Complete Example
70
74
 
71
75
  Here is a complete example that demonstrates subscribing to an event, triggering it, and then unsubscribing.
@@ -116,8 +120,9 @@ const main = async () => {
116
120
  main().catch(console.error);
117
121
  ```
118
122
 
123
+
119
124
  ## Summary
120
125
 
121
126
  Event subscriptions are a core feature for building dynamic dApps with the OCAP Client. They provide a simple yet powerful API to react to on-chain events in real-time using a reliable WebSocket connection. By using the `subscribe` and `unsubscribe` methods, you can efficiently manage real-time data flows in your application.
122
127
 
123
- For more details on how transactions are constructed and sent, which in turn generate these events, see the [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md) documentation. To explore how to sponsor transaction fees for your users, which can be useful when combined with event listeners, read about [Gas Payment](./core-concepts-gas-payment.md).
128
+ For more details on how transactions are constructed and sent, which in turn generate these events, see the [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md) documentation. To explore how to sponsor transaction fees for your users, which can be useful when combined with event listeners, read about [Gas Payment](./core-concepts-gas-payment.md).