From d687a84d84dfeec633c5a2ed92f0c3da1d42bb83 Mon Sep 17 00:00:00 2001 From: RetricSu Date: Mon, 4 Mar 2024 22:54:26 +0800 Subject: [PATCH] feat: add xudt issue token template (#34) * wip: add xudt issue token template * chore: fix lint * wip: add check issued token button * wip: add some notes * chore: update transfer template name --- .gitignore | 2 + Makefile | 2 +- docs/develop.md | 11 ++- src/cfg/select.ts | 15 ++- templates/transfer/index.html | 2 +- templates/transfer/index.tsx | 2 +- templates/xudt/index.html | 2 +- templates/xudt/index.tsx | 69 +++++++++++-- templates/xudt/lib.ts | 180 +++++++++++++++++++--------------- templates/xudt/package.json | 2 +- templates/xudt/scheme.ts | 27 +++++ 11 files changed, 213 insertions(+), 101 deletions(-) create mode 100644 templates/xudt/scheme.ts diff --git a/.gitignore b/.gitignore index 88a580b..0aa975b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ ckb/devnet/data/ data/ dist/ .vscode +templates/*/ckb.ts +templates/*/config.json diff --git a/Makefile b/Makefile index ea5952a..4f3f32c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all omnilock anyone-can-pay spore +.PHONY: all omnilock anyone-can-pay xudt spore all: omnilock anyone-can-pay xudt spore diff --git a/docs/develop.md b/docs/develop.md index 3142979..92b040e 100644 --- a/docs/develop.md +++ b/docs/develop.md @@ -1,8 +1,15 @@ ## Development -### Add templates +### Add Dapp templates -TODO +Assuming you are trying to add a new template named `my-awesome-template` into `offckb`: + +1. add your typescript project inside the `templates` folder: `templates/my-awesome-template` +2. copy `templates/ckb.ts` and `templates/config.json` into your project + - `cp templates/ckb.ts templates/my-awesome-template` + - `cp templates/config.json templates/my-awesome-template` +3. finish your `my-awesome-template` with `ckb.ts` and `config.json` +4. done ### Update built-in scripts diff --git a/src/cfg/select.ts b/src/cfg/select.ts index 279b9b1..f19285f 100644 --- a/src/cfg/select.ts +++ b/src/cfg/select.ts @@ -6,21 +6,20 @@ export async function selectTemplate() { message: 'Select a dapp template', choices: [ { - name: 'Transfer CKB', + name: 'View and Transfer Balance', value: 'transfer', - description: 'a simple dapp to check CKB balance and transfer CKB from address to address', + description: 'a simple dapp to check CKB balance and transfer CKB', }, - new Separator(), { - name: 'Issue Token With XUDT scripts(coming)', + name: 'Issue Token via XUDT scripts', value: 'xudt', - description: 'a simple dapp to issue your own token with XUDT scripts(coming)', - disabled: true, + description: 'a simple dapp to issue your own token via XUDT scripts', }, + new Separator(), { - name: 'Issue Token With Max Supply via Omnilock And XUDT scripts(coming)', + name: 'Issue Token With Max Supply Limit via Omnilock And XUDT scripts(coming)', value: 'xudt', - description: 'a simple dapp to issue your own token with XUDT scripts', + description: 'a simple dapp to issue your own token with max supply limit via XUDT scripts', disabled: true, }, { diff --git a/templates/transfer/index.html b/templates/transfer/index.html index 343dc8d..2e31d84 100644 --- a/templates/transfer/index.html +++ b/templates/transfer/index.html @@ -4,7 +4,7 @@ - Transfer CKB + View and Transfer Balance
diff --git a/templates/transfer/index.tsx b/templates/transfer/index.tsx index ce1bf68..6715a2c 100644 --- a/templates/transfer/index.tsx +++ b/templates/transfer/index.tsx @@ -55,7 +55,7 @@ export function App() { return (
-

Transfer CKB between addresses

+

View and Transfer Balance