Skip to content

Commit

Permalink
refactor: 💡 imporove token messaging doc
Browse files Browse the repository at this point in the history
  • Loading branch information
futantan committed Dec 1, 2023
1 parent 942ec02 commit 13a525c
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions pages/tokenscript/extra-features/token-messaging.mdx
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
# 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:

```
<ts:contract interface="erc721" name="Token">
<ts:address network="80001">0xe84Be2e18304AcF07ba2f11e37EABC321f4DC6Df</ts:address>
</ts:contract>
```

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

Now you can use this URL in tokenscript viewer. Don't forget to replace variables with values **chainId** , **contractAddress** and replace **tokenScriptFileURL** with its value, its URL, where TSML file located.

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.

0 comments on commit 13a525c

Please sign in to comment.