Skip to content

Commit

Permalink
chore: fmt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu committed May 13, 2024
1 parent 029affc commit 6865031
Show file tree
Hide file tree
Showing 82 changed files with 3,360 additions and 2,154 deletions.
252 changes: 159 additions & 93 deletions website/docs/dapp/TutorialOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,97 +1,163 @@
import Link from "@docusaurus/Link";
import { TutorialHeaderProps } from "@site/src/components/TutorialHeader";

const TRANSFEROVERVIEW: TutorialHeaderProps =
{
time: "2 - 5 min",
topics: [
{ label: "Cell Model", link:"/docs/tech-explanation/cell-model" },
{ label: "Transaction", link:"/docs/tech-explanation/glossary#transaction" },
{ label: "Witness", link:"/docs/tech-explanation/glossary#witness" },
{ label: "Signature", link:"/docs/tech-explanation/glossary#cryptographic-signature" },
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link href={"https://nodejs.org/en"} target="_blank" rel="noopener noreferrer">
Node.js
</Link>{' and '}
<Link href={"https://yarnpkg.com/"} target="_blank" rel="noopener noreferrer">
Yarn
</Link>
</div>,
<div>CKB dev environment: <Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>OffCKB</Link></div>
],
}
const WRITEOVERVIEW: TutorialHeaderProps =
{
time: "2 - 5 min",
topics: [
{ label: "Cell Model", link:"/docs/tech-explanation/cell-model" },
{ label: "Data", link:"/docs/tech-explanation/glossary#data" },
{ label: "Transaction Hash", link:"/docs/tech-explanation/glossary#transaction-hash" },
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link href={"https://nodejs.org/en"} target="_blank" rel="noopener noreferrer">
Node.js
</Link>{' and '}
<Link href={"https://yarnpkg.com/"} target="_blank" rel="noopener noreferrer">
Yarn
</Link>
</div>,
<div>CKB dev environment: <Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>OffCKB</Link></div>
],
}
const TOKENOVERVIEW: TutorialHeaderProps =
{
time: "5 - 10 min",
topics: [
{ label: "UDT", link:"/docs/tech-explanation/glossary#udt" },
{ label: "Fungible Token", link:"/docs/tech-explanation/glossary#fungible-token" },
{ label: "xUDT", link:"https://github.com/XuJiandong/rfcs/blob/xudt/rfcs/0052-extensible-udt/0052-extensible-udt.md" },
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link href={"https://nodejs.org/en"} target="_blank" rel="noopener noreferrer">
Node.js
</Link>{' and '}
<Link href={"https://yarnpkg.com/"} target="_blank" rel="noopener noreferrer">
Yarn
</Link>
</div>,
<div>CKB dev environment: <Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>OffCKB</Link></div>
],
}
const DOBOVERVIEW: TutorialHeaderProps =
{
time: "5 - 10 min",
topics: [
{ label: "DOB", link:'/docs/tech-explanation/glossary#digital-object-dob' },
{ label: "NFT", link: '/docs/tech-explanation/glossary#non-fungible-token' },
{ label: "Spore Protocol", link: 'https://spore.pro' },
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link href={"https://nodejs.org/en"} target="_blank" rel="noopener noreferrer">
Node.js
</Link>{' and '}
<Link href={"https://yarnpkg.com/"} target="_blank" rel="noopener noreferrer">
Yarn
</Link>
</div>,
<div>CKB dev environment: <Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>OffCKB</Link></div>
],
}


export {
TRANSFEROVERVIEW,
WRITEOVERVIEW,
TOKENOVERVIEW,
DOBOVERVIEW
const TRANSFEROVERVIEW: TutorialHeaderProps = {
time: "2 - 5 min",
topics: [
{ label: "Cell Model", link: "/docs/tech-explanation/cell-model" },
{
label: "Transaction",
link: "/docs/tech-explanation/glossary#transaction",
},
{ label: "Witness", link: "/docs/tech-explanation/glossary#witness" },
{
label: "Signature",
link: "/docs/tech-explanation/glossary#cryptographic-signature",
},
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link
href={"https://nodejs.org/en"}
target="_blank"
rel="noopener noreferrer"
>
Node.js
</Link>
{" and "}
<Link
href={"https://yarnpkg.com/"}
target="_blank"
rel="noopener noreferrer"
>
Yarn
</Link>
</div>,
<div>
CKB dev environment:{" "}
<Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>
OffCKB
</Link>
</div>,
],
};

const WRITEOVERVIEW: TutorialHeaderProps = {
time: "2 - 5 min",
topics: [
{ label: "Cell Model", link: "/docs/tech-explanation/cell-model" },
{ label: "Data", link: "/docs/tech-explanation/glossary#data" },
{
label: "Transaction Hash",
link: "/docs/tech-explanation/glossary#transaction-hash",
},
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link
href={"https://nodejs.org/en"}
target="_blank"
rel="noopener noreferrer"
>
Node.js
</Link>
{" and "}
<Link
href={"https://yarnpkg.com/"}
target="_blank"
rel="noopener noreferrer"
>
Yarn
</Link>
</div>,
<div>
CKB dev environment:{" "}
<Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>
OffCKB
</Link>
</div>,
],
};
const TOKENOVERVIEW: TutorialHeaderProps = {
time: "5 - 10 min",
topics: [
{ label: "UDT", link: "/docs/tech-explanation/glossary#udt" },
{
label: "Fungible Token",
link: "/docs/tech-explanation/glossary#fungible-token",
},
{
label: "xUDT",
link: "https://github.com/XuJiandong/rfcs/blob/xudt/rfcs/0052-extensible-udt/0052-extensible-udt.md",
},
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link
href={"https://nodejs.org/en"}
target="_blank"
rel="noopener noreferrer"
>
Node.js
</Link>
{" and "}
<Link
href={"https://yarnpkg.com/"}
target="_blank"
rel="noopener noreferrer"
>
Yarn
</Link>
</div>,
<div>
CKB dev environment:{" "}
<Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>
OffCKB
</Link>
</div>,
],
};
const DOBOVERVIEW: TutorialHeaderProps = {
time: "5 - 10 min",
topics: [
{
label: "DOB",
link: "/docs/tech-explanation/glossary#digital-object-dob",
},
{
label: "NFT",
link: "/docs/tech-explanation/glossary#non-fungible-token",
},
{ label: "Spore Protocol", link: "https://spore.pro" },
],
tools: [
<div>An IDE/Editor that supports TypeScript</div>,
<div>
<Link
href={"https://nodejs.org/en"}
target="_blank"
rel="noopener noreferrer"
>
Node.js
</Link>
{" and "}
<Link
href={"https://yarnpkg.com/"}
target="_blank"
rel="noopener noreferrer"
>
Yarn
</Link>
</div>,
<div>
CKB dev environment:{" "}
<Link to={"/docs/node/run-devnet-node/#quick-setup-with-offckb"}>
OffCKB
</Link>
</div>,
],
};

export { TRANSFEROVERVIEW, WRITEOVERVIEW, TOKENOVERVIEW, DOBOVERVIEW };
20 changes: 16 additions & 4 deletions website/docs/dapp/_SetupProjectContent.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import ImgContainer from '@components/ImgContainer';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import ImgContainer from "@components/ImgContainer";
import useBaseUrl from "@docusaurus/useBaseUrl";

To interact with the dApp, ensure that your Devnet is up and running. After installing [@offckb/cli](https://www.npmjs.com/package/@offckb/cli), open a terminal and start the Devnet with the following command:
Expand All @@ -9,13 +9,16 @@ To interact with the dApp, ensure that your Devnet is up and running. After inst
<Tabs>
<TabItem value="offckb-node" label="Command">
```

```bash
offckb node
```

```mdx-code-block
</TabItem>
<TabItem value="offckb-node-result" label="Response">
```

```bash
/bin/sh: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb: No such file or directory
/Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1..
Expand All @@ -32,6 +35,7 @@ CKB output: 2024-03-20 07:56:45.320 +00:00 main INFO ckb_db_migration Init data

CKB output: 2024-03-20 07:56:45.329 +00:00 main INFO ckb_launcher Touch chain spec hash: Byte32(0x3036c73473a371f3aa61c588c38924a93fb8513e481fa7c8d884fc4cf5fd368a)
```

```mdx-code-block
</TabItem>
</Tabs>
Expand All @@ -43,13 +47,16 @@ You might want to check pre-funded accounts and copy private keys for later use.
<Tabs>
<TabItem value="offckb-accounts" label="Command">
```

```bash
offckb accounts
```

```mdx-code-block
</TabItem>
<TabItem value="offckb-accounts-result" label="Response">
```

```bash
Print account list, each account is funded with 42_000_000_00000000 capacity in the genesis block.
[
Expand All @@ -75,9 +82,10 @@ Print account list, each account is funded with 42_000_000_00000000 capacity in
address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt435c3epyrupszm7khk6weq5lrlyt52lg48ucew',
args: '0x758d311c8483e0602dfad7b69d9053e3f917457d'
},
#...
#...
]
```

```mdx-code-block
</TabItem>
</Tabs>
Expand All @@ -91,18 +99,22 @@ Navigate to your project, install the node dependencies, and start running the e
<Tabs>
<TabItem value="offckb-yarn-start" label="Command">
```

```bash
yarn && NETWORK=devnet yarn start
```

```mdx-code-block
</TabItem>
<TabItem value="offckb-yarn-start-result" label="Response">
```

```bash
$ parcel index.html
Server running at http://localhost:1234
✨ Built in 66ms
```

```mdx-code-block
</TabItem>
</Tabs>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/_SwitchToTestnet.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
So now your app works great on the local blockchain, you might want to switch it to different environments like Testnet and Mainnet.

To do this, you need to update the chain config and related code.
To do this, you need to update the chain config and related code.

Open the `ckb.ts` in your project root dir, change the `lumosConfig` and `CKB_RPC_URL`:

Expand Down
5 changes: 3 additions & 2 deletions website/docs/dapp/create-dob.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
id: create-dob
title: Create a DOB
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import TutorialHeader from "@components/TutorialHeader";
import { DOBOVERVIEW } from "./TutorialOverview.tsx";
import SetupProject from "./SetupProject.tsx";
Expand Down
10 changes: 6 additions & 4 deletions website/docs/dapp/create-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
id: create-token
title: Create a Fungible Token
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import TutorialHeader from "@components/TutorialHeader";
import { TOKENOVERVIEW } from "./TutorialOverview.tsx";
import SetupProject from "./SetupProject.tsx";
Expand Down Expand Up @@ -46,7 +47,7 @@ cd docs.nervos.org/examples/xudt

### Step 2: Start the Devnet

<SetupProject imageSrc="img/dapps/issue-token-dapp.jpg"/>
<SetupProject imageSrc="img/dapps/issue-token-dapp.jpg" />

## Behind the Scene

Expand All @@ -71,7 +72,8 @@ export async function issueToken(privKey: string, amount: string) {
```

This function accepts two parameters:
- `privKey`: The private key of the issuer

- `privKey`: The private key of the issuer
- `amount`: The amount of token

Note that we aim to create an output Cell whose [type script](/docs/tech-explanation/glossary#type-script) is an xUDT script. The args of this xUDT script are the issuer's lock script hash, which is why we include the following lines of code:
Expand Down
Loading

0 comments on commit 6865031

Please sign in to comment.