@ocap/client 1.25.3 → 1.25.4

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 (48) hide show
  1. package/README.md +76 -80
  2. package/dist/report.html +1 -1
  3. package/docs/_sidebar.md +22 -0
  4. package/docs/api-reference-client-methods.md +229 -0
  5. package/docs/api-reference-client-methods.zh.md +229 -0
  6. package/docs/api-reference-data-types.md +482 -0
  7. package/docs/api-reference-data-types.zh.md +482 -0
  8. package/docs/api-reference-low-level-api.md +228 -0
  9. package/docs/api-reference-low-level-api.zh.md +228 -0
  10. package/docs/api-reference-query-mutation-methods.md +814 -0
  11. package/docs/api-reference-query-mutation-methods.zh.md +814 -0
  12. package/docs/api-reference-transaction-helpers.md +649 -0
  13. package/docs/api-reference-transaction-helpers.zh.md +649 -0
  14. package/docs/api-reference.md +23 -0
  15. package/docs/api-reference.zh.md +23 -0
  16. package/docs/core-concepts-client-architecture.md +102 -0
  17. package/docs/core-concepts-client-architecture.zh.md +102 -0
  18. package/docs/core-concepts-event-subscriptions.md +123 -0
  19. package/docs/core-concepts-event-subscriptions.zh.md +123 -0
  20. package/docs/core-concepts-gas-payment.md +111 -0
  21. package/docs/core-concepts-gas-payment.zh.md +111 -0
  22. package/docs/core-concepts-transaction-lifecycle.md +183 -0
  23. package/docs/core-concepts-transaction-lifecycle.zh.md +183 -0
  24. package/docs/core-concepts.md +22 -0
  25. package/docs/core-concepts.zh.md +22 -0
  26. package/docs/getting-started-basic-usage.md +87 -0
  27. package/docs/getting-started-basic-usage.zh.md +87 -0
  28. package/docs/getting-started-installation.md +60 -0
  29. package/docs/getting-started-installation.zh.md +60 -0
  30. package/docs/getting-started.md +16 -0
  31. package/docs/getting-started.zh.md +16 -0
  32. package/docs/how-to-guides-delegate-permissions.md +167 -0
  33. package/docs/how-to-guides-delegate-permissions.zh.md +167 -0
  34. package/docs/how-to-guides-manage-accounts.md +73 -0
  35. package/docs/how-to-guides-manage-accounts.zh.md +73 -0
  36. package/docs/how-to-guides-manage-assets.md +255 -0
  37. package/docs/how-to-guides-manage-assets.zh.md +255 -0
  38. package/docs/how-to-guides-manage-tokens.md +179 -0
  39. package/docs/how-to-guides-manage-tokens.zh.md +179 -0
  40. package/docs/how-to-guides-stake-tokens-and-assets.md +205 -0
  41. package/docs/how-to-guides-stake-tokens-and-assets.zh.md +205 -0
  42. package/docs/how-to-guides-transfer-tokens-and-nfts.md +179 -0
  43. package/docs/how-to-guides-transfer-tokens-and-nfts.zh.md +179 -0
  44. package/docs/how-to-guides.md +27 -0
  45. package/docs/how-to-guides.zh.md +27 -0
  46. package/docs/overview.md +70 -0
  47. package/docs/overview.zh.md +70 -0
  48. package/package.json +14 -14
@@ -0,0 +1,70 @@
1
+ # Overview
2
+
3
+ The OCAP Client is a powerful and versatile JavaScript library designed to connect your applications to an OCAP-powered blockchain. It provides a streamlined, developer-friendly interface for reading and writing data, managing digital assets, and listening for on-chain events. The client can be used in any Node.js or browser-based environment, offering a single solution for both backend services and frontend applications.
4
+
5
+ At its core, the client simplifies blockchain interaction by abstracting away the complexities of transaction encoding and signing. It uses a GraphQL API for all communication with the blockchain node over HTTP/S, making it easy to query chain data and submit transactions.
6
+
7
+ ```d2 Client Architecture Overview icon=mdi:graphql
8
+ direction: down
9
+
10
+ your-app: {
11
+ label: "Your Application\n(Node.js or Browser)"
12
+ shape: rectangle
13
+ }
14
+
15
+ ocap-client: {
16
+ label: "@ocap/client"
17
+ shape: rectangle
18
+ style.fill: "#f0f9ff"
19
+ }
20
+
21
+ ocap-node: {
22
+ label: "OCAP Blockchain Node"
23
+ shape: cylinder
24
+ }
25
+
26
+ your-app -> ocap-client: "High-level API Calls\n(e.g., transfer(), createAsset())"
27
+ ocap-client -> ocap-node: "GraphQL Queries/Mutations (HTTP/S)\nEvent Subscriptions (WebSocket)"
28
+
29
+ ```
30
+
31
+ ### Key Features
32
+
33
+ The OCAP Client is organized into several distinct groups of methods to handle different aspects of blockchain communication:
34
+
35
+ <x-cards data-columns="2">
36
+ <x-card data-title="Queries" data-icon="lucide:search">
37
+ Read any data from the blockchain, including blocks, transactions, account states, asset details, and general chain information.
38
+ </x-card>
39
+ <x-card data-title="Mutations & Senders" data-icon="lucide:send">
40
+ Write data to the blockchain. Use high-level helper methods like `transfer` or `createAsset` to easily prepare, sign, and send transactions.
41
+ </x-card>
42
+ <x-card data-title="Subscriptions" data-icon="lucide:radio-tower">
43
+ Listen for real-time on-chain events. Subscribe to topics and receive updates as they happen via a WebSocket connection.
44
+ </x-card>
45
+ <x-card data-title="Coders & Signers" data-icon="lucide:edit">
46
+ For advanced use cases, you can encode and sign transactions manually, giving you full control over the transaction lifecycle.
47
+ </x-card>
48
+ </x-cards>
49
+
50
+ ### Important Concepts
51
+
52
+ - **Automatic Account Creation**: On an OCAP-powered chain, a new account is automatically created on-chain when it receives its first incoming transaction (e.g., receiving tokens). You don't need a separate transaction to initialize an account.
53
+
54
+ - **Gasless Transactions**: The client supports a gas payment mechanism where a designated "gas payer" wallet can sponsor transaction fees for other users. This enables you to create seamless, gas-free experiences for your application's users.
55
+
56
+ ### Where to Go Next
57
+
58
+ Ready to start building? Here are some helpful links to get you moving:
59
+
60
+ <x-cards data-columns="3">
61
+ <x-card data-title="Getting Started" data-icon="lucide:rocket" data-href="/getting-started">
62
+ Install the client, connect to the Beta chain, and make your first query in under 30 minutes.
63
+ </x-card>
64
+ <x-card data-title="How-to Guides" data-icon="lucide:book-open" data-href="/how-to-guides">
65
+ Follow step-by-step tutorials for common tasks like creating NFTs, transferring tokens, and staking.
66
+ </x-card>
67
+ <x-card data-title="API Reference" data-icon="lucide:code" data-href="/api-reference">
68
+ Dive into the complete API documentation for detailed information on every method, parameter, and data type.
69
+ </x-card>
70
+ </x-cards>
@@ -0,0 +1,70 @@
1
+ # 概述
2
+
3
+ OCAP Client 是一个功能强大且用途广泛的 JavaScript 库,旨在将您的应用程序连接到由 OCAP 驱动的区块链。它提供了一个简化的、对开发者友好的界面,用于读取和写入数据、管理数字资产以及监听链上事件。该客户端可用于任何 Node.js 或基于浏览器的环境,为后端服务和前端应用程序提供统一的解决方案。
4
+
5
+ 其核心在于,该客户端通过抽象交易编码和签名的复杂性来简化与区块链的交互。它通过 HTTP/S 使用 GraphQL API 与区块链节点进行所有通信,使得查询链上数据和提交交易变得简单。
6
+
7
+ ```d2 客户端架构概述 icon=mdi:graphql
8
+ direction: down
9
+
10
+ your-app: {
11
+ label: "你的应用程序\n(Node.js 或浏览器)"
12
+ shape: rectangle
13
+ }
14
+
15
+ ocap-client: {
16
+ label: "@ocap/client"
17
+ shape: rectangle
18
+ style.fill: "#f0f9ff"
19
+ }
20
+
21
+ ocap-node: {
22
+ label: "OCAP 区块链节点"
23
+ shape: cylinder
24
+ }
25
+
26
+ your-app -> ocap-client: "高层 API 调用\n(例如,transfer()、createAsset())"
27
+ ocap-client -> ocap-node: "GraphQL 查询/变更 (HTTP/S)\n事件订阅 (WebSocket)"
28
+
29
+ ```
30
+
31
+ ### 主要特性
32
+
33
+ OCAP Client 被组织成几个不同的方法组,以处理区块链通信的不同方面:
34
+
35
+ <x-cards data-columns="2">
36
+ <x-card data-title="查询" data-icon="lucide:search">
37
+ 从区块链读取任何数据,包括区块、交易、账户状态、资产详情和常规链信息。
38
+ </x-card>
39
+ <x-card data-title="变更与发送器" data-icon="lucide:send">
40
+ 向区块链写入数据。使用诸如 `transfer` 或 `createAsset` 等高层辅助方法,轻松准备、签名和发送交易。
41
+ </x-card>
42
+ <x-card data-title="订阅" data-icon="lucide:radio-tower">
43
+ 监听实时链上事件。订阅主题并通过 WebSocket 连接接收实时更新。
44
+ </x-card>
45
+ <x-card data-title="编码器与签名器" data-icon="lucide:edit">
46
+ 对于高级用例,您可以手动编码和签署交易,从而完全控制交易的生命周期。
47
+ </x-card>
48
+ </x-cards>
49
+
50
+ ### 重要概念
51
+
52
+ - **自动创建账户**:在 OCAP 驱动的链上,当一个新账户收到其第一笔入账交易(例如,接收代币)时,该账户会自动在链上创建。您无需通过单独的交易来初始化账户。
53
+
54
+ - **无 Gas 费交易**:客户端支持一种 Gas 费支付机制,即由指定的“Gas 费支付方”钱包为其他用户代付交易费用。这使您能够为应用程序的用户创建无缝、免 Gas 费的体验。
55
+
56
+ ### 下一步
57
+
58
+ 准备好开始构建了吗?这里有一些有用的链接可以帮助您快速上手:
59
+
60
+ <x-cards data-columns="3">
61
+ <x-card data-title="入门指南" data-icon="lucide:rocket" data-href="/getting-started">
62
+ 安装客户端,连接到 Beta 链,并在 30 分钟内完成您的第一次查询。
63
+ </x-card>
64
+ <x-card data-title="操作指南" data-icon="lucide:book-open" data-href="/how-to-guides">
65
+ 遵循分步教程,完成创建 NFT、转移代币和质押等常见任务。
66
+ </x-card>
67
+ <x-card data-title="API 参考" data-icon="lucide:code" data-href="/api-reference">
68
+ 深入了解完整的 API 文档,获取有关每个方法、参数和数据类型的详细信息。
69
+ </x-card>
70
+ </x-cards>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocap/client",
3
- "version": "1.25.3",
3
+ "version": "1.25.4",
4
4
  "description": "graphql client to read/write data on arcblock blockchain",
5
5
  "keywords": [
6
6
  "graphql",
@@ -40,17 +40,17 @@
40
40
  "react-app-polyfill": "^1.0.6",
41
41
  "readable-stream": "3.6.0",
42
42
  "wolfy87-eventemitter": "^5.2.9",
43
- "@arcblock/did": "1.25.3",
44
- "@arcblock/jwt": "1.25.3",
45
- "@arcblock/ws": "1.25.3",
46
- "@arcblock/did-util": "1.25.3",
47
- "@ocap/asset": "1.25.3",
48
- "@ocap/mcrypto": "1.25.3",
49
- "@ocap/message": "1.25.3",
50
- "@ocap/proto": "1.25.3",
51
- "@ocap/tx-util": "1.25.3",
52
- "@ocap/util": "1.25.3",
53
- "@ocap/wallet": "1.25.3"
43
+ "@arcblock/did": "1.25.4",
44
+ "@arcblock/did-util": "1.25.4",
45
+ "@arcblock/jwt": "1.25.4",
46
+ "@arcblock/ws": "1.25.4",
47
+ "@ocap/asset": "1.25.4",
48
+ "@ocap/mcrypto": "1.25.4",
49
+ "@ocap/message": "1.25.4",
50
+ "@ocap/proto": "1.25.4",
51
+ "@ocap/tx-util": "1.25.4",
52
+ "@ocap/util": "1.25.4",
53
+ "@ocap/wallet": "1.25.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "babel-cli": "^6.26.0",
@@ -71,8 +71,8 @@
71
71
  "webpack": "^5.94.0",
72
72
  "webpack-bundle-analyzer": "^4.10.2",
73
73
  "webpack-cli": "^5.1.4",
74
- "@ocap/e2e-test": "1.25.3",
75
- "@ocap/tx-protocols": "1.25.3"
74
+ "@ocap/e2e-test": "1.25.4",
75
+ "@ocap/tx-protocols": "1.25.4"
76
76
  },
77
77
  "remarkConfig": {
78
78
  "plugins": [