Skip to content

Commit cd80ad8

Browse files
committed
docs: update to help devs understand what CCC is
1 parent dd8fa32 commit cd80ad8

13 files changed

Lines changed: 219 additions & 159 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
push:
99
branches:
1010
- master
11-
- 'releases/**'
11+
- "releases/**"
1212

1313
concurrency: ${{ github.workflow }}-${{ github.ref }}
1414

README.md

Lines changed: 53 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -33,87 +33,36 @@
3333
<br />
3434
Interoperate with wallets from different chain ecosystems.
3535
<br />
36-
Fully enabling CKB's Turing completeness and cryptographic freedom power.
36+
Fully enabling CKB's Turing completeness and cryptographic freedom.
3737
</p>
3838

3939
## Use Cases
4040

41-
<p align="center">
42-
<a href="https://app.ckbccc.com/">
43-
<img src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/appPreview.png" width="50%" />
44-
</a>
45-
</p>
41+
We design CCC to optimize various use cases, including:
4642

47-
For non-developers, you can [try CCC's app now here](https://app.ckbccc.com/) ([Project source code](https://github.com/ckb-devrel/ccc/tree/master/packages/demo)). It showcases how to use CCC for some basic scenarios in CKB:
48-
49-
- [Sign and verify any message.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/Sign/page.tsx>) ([Playground](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/sign.ts))
50-
- [Transfer native CKB token.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/Transfer/page.tsx>) ([Playground](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transfer.ts))
51-
- [Transfer UDT token.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/TransferUdt/page.tsx>) ([Playground](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transferUdt.ts))
52-
- See [Misc: Single-Use-Seals](https://talk.nervos.org/t/en-cn-misc-single-use-seals/8279) to learn how token issuing works in the cell model.
53-
- [Issue xUDT token with the Single-Use Lock.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/IssueXUdtSus/page.tsx>)
54-
- [Issue xUDT token controlled by a Type ID cell.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/IssueXUdtTypeId/page.tsx>)
55-
- [Spore Protocol](https://docs.spore.pro/) SDK.
56-
- [Create spore cluster.](<https://github.com/ckb-devrel/ccc/blob/master/packages/demo/src/app/connected/(tools)/CreateSporeCluster/page.tsx>)
57-
- [Mint spore.](<https://github.com/ckb-devrel/ccc/blob/master/packages/demo/src/app/connected/(tools)/MintSpore/page.tsx>)
58-
- [Transfer/Melt spore.](<https://github.com/ckb-devrel/ccc/blob/master/packages/demo/src/app/connected/(tools)/TransferSpore/page.tsx>)
59-
- [Transfer spore cluster.](<https://github.com/ckb-devrel/ccc/blob/master/packages/demo/src/app/connected/(tools)/TransferSporeCluster/page.tsx>)
60-
- [Manage Nervos DAO.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/NervosDao/page.tsx>)
61-
- [Transfer native CKB token with time lock.](<https://github.com/ckb-devrel/ccc/blob/master/packages/demo/src/app/connected/(tools)/TimeLockedTransfer/page.tsx>)
62-
- [Calculate the CKB hash of any messages.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/utils/(tools)/Hash/page.tsx>)
63-
- [Generate mnemonic and keypairs. Encrypt to a keystore.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/utils/(tools)/Mnemonic/page.tsx>)
64-
- [Decrypt a keystore.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/utils/(tools)/Keystore/page.tsx>)
65-
- [Transfer the native CKB token with the old Lumos SDK.](<https://github.com/ckb-devrel/ccc/tree/master/packages/demo/src/app/connected/(tools)/TransferLumos/page.tsx>)
43+
- **Learn CKB**: Numerous [basic code examples and web demos based on CCC](https://github.com/ckb-devrel/ccc?tab=readme-ov-file#examples) help you quickly understand how CKB works.
44+
- **Analyze Data**: Leverage CCC to interact with CKB nodes and process blockchain data programmatically.
45+
- [**Compose Transaction**](https://github.com/ckb-devrel/ccc?tab=readme-ov-file#transaction-composing): Highly intuitive and customizable transaction composition, with helpers to simplify the process.
46+
- **Sign Easily**: Unified Signing interface with pre-built signing methods to interoperate with multiple chains seamlessly.
47+
- **Connect Wallets**: Integrate the connector component in a minute or smoothly build a customized wallet connection UI, enabling your app to reach a wider audience.
6648

67-
## Examples
49+
Read our [documents](https://docs.ckbccc.com) or [API reference](https://api.ckbccc.com) to learn more about CCC. If you are new to the CKB, we also recommend [Nervos CKB Docs](https://docs.nervos.org/) for basic knowledge.
6850

69-
<p align="center">
70-
<a href="https://live.ckbccc.com/">
71-
<img src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/preview.png" width="90%" />
72-
</a>
73-
</p>
74-
75-
Check our [full documents for all detailed APIs](https://docs.ckbccc.com) to understand these examples better. If you are new to the CKB, we recommend checking [Nervos CKB Docs](https://docs.nervos.org/) for basic knowledge. We build examples based on [the CCC playground](https://live.ckbccc.com/).
51+
## Try in the Playground
7652

7753
<p align="center">
7854
<a href="https://live.ckbccc.com/">
79-
<img src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/playgroundCell.png" width="40%" />
55+
<img src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/preview.png" width="70%" />
8056
</a>
8157
</p>
8258

83-
Cells are represented with graphs in the playground. The three layers of cells represent occupancy, type and lock from inside to outside. The filled center circle means that all CKB of this cell is used to store data.
84-
85-
When cells share the same color, the same script governs them. They are owned by the same address (the outside ring) or the same type of assets (the inside ring). Check the script details in the "Scripts" tab.
86-
87-
### Transaction Composing
88-
89-
Here's an example for transferring CKB:
90-
91-
```typescript
92-
const tx = ccc.Transaction.from({
93-
outputs: [{ lock: toLock, capacity: ccc.fixedPointFrom(amount) }],
94-
});
95-
```
96-
97-
Tell CCC what you need, and then...
98-
99-
```typescript
100-
await tx.completeInputsByCapacity(signer);
101-
await tx.completeFeeBy(signer); // Transaction fee rate is calculated automatically
102-
const txHash = await signer.sendTransaction(tx);
103-
```
104-
105-
We have done everything!
59+
The CCC Playground is an integrated testing environment in web browsers that supports data visualization and code-sharing. [Click the link](https://live.ckbccc.com/) to run your code without the annoying preparation and watch how the code works, exploring CCC's capabilities.
10660

107-
- [Use specified wallet in custom UI.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/customUi.ts)
108-
- [Use all supported wallets in custom UI.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/customUiWithController.ts)
109-
- [Sign and verify any message.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/sign.ts)
110-
- [Transfer native CKB token.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transfer.ts)
111-
- [Transfer all native CKB token.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transferAll.ts)
112-
- [Transfer UDT token.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transferUdt.ts)
61+
For an explanation of the visual elements and interface components in the playground, please refer to [the CCC Playground guide](https://docs.ckbccc.com/docs/playground).
11362

114-
## Quick Start with `create-ccc-app` (Recommended)
63+
## Quick Start with `create-ccc-app`
11564

116-
To quickly bootstrap a new CCC-based application, you can use our CLI tool `create-ccc-app`:
65+
Besides short testing, CCC is also suitable for building scalable applications. To get started quickly, you can use our CLI tool `create-ccc-app` to bootstrap a new CCC-based application:
11766

11867
```bash
11968
# Using npx
@@ -130,29 +79,63 @@ yarn create ccc-app my-ccc-app
13079
pnpm create ccc-app my-ccc-app
13180
```
13281

133-
Follow the prompts to select your preferred framework template and start building your CCC application.
82+
Follow the prompts to select your preferred framework template and begin building your CCC application.
13483

13584
## Manual Installation
13685

137-
We design CCC for both front-end and back-end developers. You need only one package to fulfil all your needs:
86+
Whether you are a front-end or back-end developer, CCC provides helpful tools and capabilities:
13887

13988
- [NodeJS](https://www.npmjs.com/package/@ckb-ccc/shell): `npm install @ckb-ccc/shell`
14089
- [Custom UI](https://www.npmjs.com/package/@ckb-ccc/ccc): `npm install @ckb-ccc/ccc`
14190
- [Web Component](https://www.npmjs.com/package/@ckb-ccc/connector): `npm install @ckb-ccc/connector`
142-
- [React](https://www.npmjs.com/package/@ckb-ccc/connector-react) ([Docs](https://docs.ckbccc.com/modules/_ckb_ccc_connector_react.html)): `npm install @ckb-ccc/connector-react`
91+
- [React](https://www.npmjs.com/package/@ckb-ccc/connector-react) ([Docs](https://api.ckbccc.com/modules/_ckb_ccc_connector_react.html)): `npm install @ckb-ccc/connector-react`
14392

144-
CCC exports everything on the `ccc` object:
93+
All exports from CCC are available on the `ccc` object to help with code completion:
14594

14695
```typescript
14796
import { ccc } from "@ckb-ccc/<package-name>";
14897
```
14998

150-
For advanced developers, we provided the `cccA` object to fulfil all your needs. You should notice that these interfaces are not stable:
99+
If you are an advanced developer and wish to customize your code heavily, the `<package-name>/advanced` entry point exports `cccA`, which contains almost everything else. Be aware that these interfaces are not stable:
151100

152101
```typescript
153102
import { cccA } from "@ckb-ccc/<package-name>/advanced";
154103
```
155104

105+
## Examples
106+
107+
<p align="center">
108+
<a href="https://app.ckbccc.com/">
109+
<img src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/appPreview.png" width="50%" />
110+
</a>
111+
</p>
112+
113+
The CCC App is a mini-toolset for CKB, showcasing some basic scenarios. You can still [try the CCC App here](https://app.ckbccc.com) even if you are not a developer. To learn more about the app's features, visit [the documentation](https://docs.ckbccc.com/docs/ccc-app).
114+
115+
### Transaction Composing
116+
117+
Let's start with a minimal example for transferring CKB:
118+
119+
```typescript
120+
const tx = ccc.Transaction.from({
121+
outputs: [{ lock: toLock, capacity: ccc.fixedPointFrom(amount) }],
122+
});
123+
```
124+
125+
Define the essential outputs of the transaction, and then...
126+
127+
```typescript
128+
await tx.completeInputsByCapacity(signer);
129+
await tx.completeFeeBy(signer); // Transaction fee rate is calculated automatically
130+
const txHash = await signer.sendTransaction(tx);
131+
```
132+
133+
That's it! The transaction is sent.
134+
135+
[Click here to read the full example of transferring native CKB token.](https://live.ckbccc.com/?src=https://raw.githubusercontent.com/ckb-devrel/ccc/refs/heads/master/packages/examples/src/transfer.ts)
136+
137+
Additional examples can be found in [the documentation](https://docs.ckbccc.com/docs/code-examples).
138+
156139
## Build and Run
157140

158141
Run the demo of CCC in two steps:

packages/connector-react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Before using the Connector, wrap your UI with the CCC Provider:
4444
<ccc.Provider>{/* Your application */}</ccc.Provider>
4545
```
4646

47-
Check [the document for @ckb-ccc/connector-react](https://docs.ckbccc.com/modules/_ckb_ccc_connector_react.index.ccc.html) for more information.
47+
Check [the document for @ckb-ccc/connector-react](https://api.ckbccc.com/modules/_ckb_ccc_connector_react.index.ccc.html) for more information.
4848

4949
<h3 align="center">
5050
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-devrel/ccc">GitHub Repo</a>.

packages/core/src/client/clientTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ export class ErrorClientMaxFeeRateExceeded extends ErrorClientBase {
555555
const limit = numFrom(limitLike).toString();
556556
const actual = numFrom(actualLike).toString();
557557
super({
558-
message: `Max fee rate exceeded limit ${limit}, actual ${actual}. Developer might forgot to complete transaction fee before sending. See https://docs.ckbccc.com/classes/_ckb_ccc_core.index.ccc.Transaction.html#completeFeeBy.`,
558+
message: `Max fee rate exceeded limit ${limit}, actual ${actual}. Developer might forgot to complete transaction fee before sending. See https://api.ckbccc.com/classes/_ckb_ccc_core.index.ccc.Transaction.html#completeFeeBy.`,
559559
data: JSON.stringify({ limit, actual }),
560560
});
561561
}

0 commit comments

Comments
 (0)