Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update the switchToTestnet mdx #340

Merged
merged 3 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions website/docs/dapp/_SwitchToTestnet.mdx
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
So now your app works great on the local blockchain, you might want to switch it to different environments like Testnet and Mainnet.
So now your dApp 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.

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

```ts
//export const lumosConfig: config.Config = devConfig as config.Config;
export const lumosConfig = config.predefined.AGGRON4 as config.Config;

//export const CKB_RPC_URL = 'http://localhost:8114';
export const CKB_RPC_URL = "https://testnet.ckb.dev/rpc";
```

Actually, we have the corresponding Testnet version examples for all these tutorials. The source code of the Testnet version is in [https://github.com/nervosnetwork/docs.nervos.org/tree/develop/examples](https://github.com/nervosnetwork/docs.nervos.org/tree/develop/examples), you can clone the repo and start running on Testnet.
To do that, just change the environment variable `NETWORK` to `testnet`:

```sh
git clone https://github.com/nervosnetwork/docs.nervos.org.git
cd docs.nervos.org/examples/<example-name>
yarn && yarn start
export NETWORK=testnet
```

For more details, check out the [README.md](https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/simple-transfer/README.md);
For more details, check out the <a href={props.readmeLink}>README.md</a>.
2 changes: 1 addition & 1 deletion website/docs/dapp/create-dob.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ By following this tutorial this far, you have mastered how digital-object works

## Next Step

<SwitchToTestnet />
<SwitchToTestnet readmeLink="https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/create-dob/README.md" />

## Additional Resources

Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/create-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ By following this tutorial this far, you have mastered how custom tokens work on

## Next Step

<SwitchToTestnet />
<SwitchToTestnet readmeLink="https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/README.md" />

## Additional Resources

Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/transfer-ckb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ By following this tutorial this far, you have mastered how transfer balance work

## Next Step

<SwitchToTestnet />
<SwitchToTestnet readmeLink="https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/simple-transfer/README.md" />

## Additional Resources

Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/write-message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ By following this tutorial this far, you have mastered how storing data on Cells

## Next Step

<SwitchToTestnet />
<SwitchToTestnet readmeLink="https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/write-and-read-message/README.md" />

## Additional Resources

Expand Down
Loading