From 13a525c3788be8a03ce4c1f7cd5271ba395d2a0b Mon Sep 17 00:00:00 2001 From: futantan Date: Fri, 1 Dec 2023 17:53:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20imporove=20token=20m?= =?UTF-8?q?essaging=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extra-features/token-messaging.mdx | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pages/tokenscript/extra-features/token-messaging.mdx b/pages/tokenscript/extra-features/token-messaging.mdx index 63e9b3e..5dcad6a 100644 --- a/pages/tokenscript/extra-features/token-messaging.mdx +++ b/pages/tokenscript/extra-features/token-messaging.mdx @@ -1,12 +1,14 @@ # How to build Secure Messaging between ERC721 NFT owners -1. Install tokenscript CLI by running command ```npm i -g @tokenscript/cli``` +1. Clone Token Messaging template from the [Template Center](https://github.com/SmartTokenLabs/TokenScript-Templates) -2. Clone Git repo https://github.com/SmartTokenLabs/TokenScript-Templates - its list of TokenScript Templates +```sh copy +npx degit SmartTokenLabs/TokenScript-Templates/erc-721-messaging erc-721-messaging +``` -3. Open folder ```/erc-721-messaging``` +2. Open folder `/erc-721-messaging` -4. Replace Contract Address and chain ID in /tokenscript.xml, example: +3. Replace Contract Address and chain ID in /tokenscript.xml, example: ``` @@ -14,11 +16,17 @@ ``` -5. Run command ```npm i``` to install all dependencies +4. Install TokenScript CLI: + +```sh npm2yarn copy +npm i -g @tokenscript/cli +``` + +5. Run command `npm i` to install all dependencies -6. Run command ```npm run build``` to build TSML file **out/tokenscript.tsml** +6. Run command `npm run build` to build TSML file **out/tokenscript.tsml** -7. Run ```tokenscript emulate``` to preview your tokenscript in action +7. Run `tokenscript emulate` to preview your tokenscript in action 8. If TokenScript works as expected then copy file **out/tokenscript.tsml** to some HTTPS hosting and save file URL @@ -26,11 +34,8 @@ Now you can use this URL in tokenscript viewer. Don't forget to replace variable This is template of TokenScript viewer for your TokenScript file: -``` +```sh https://viewer-staging.tokenscript.org/?chain=${chainId}&contract=${contractAddress}&tokenscriptUrl=${encodeURIComponent(tokenScriptFileURL)} ``` - - Thats it, ready for messaging. -