diff --git a/README.md b/README.md index 26ae346..16c52f8 100644 --- a/README.md +++ b/README.md @@ -5,30 +5,30 @@ This is a Metaverse Tutorial series This is a series of Metaverse tutorials. To begin clone this repository -``` +```bash git clone https://github.com/antron3000/MetaverseTutorials.git ``` navigate to the tutorial directory -``` +```bash cd MetaverseTutorials ``` update your repo to the latest version of mvs-blockchain-js -``` +```bash git submodule update --init --recursive ``` Install the metaverse npm package -``` +```bash npm install metaversejs --save ``` Install the mvs-blockchain-js npm package -``` +```bash cd mvs-blockchain-js && npm install ``` @@ -65,7 +65,7 @@ Please follow the Environment setup instructions below before starting. Start by entering the "playground" directory. This is where you can build ALL your Metaverse apps during the tutorial. -``` +```bash cd tutorials/playground ``` @@ -82,7 +82,7 @@ For use in nodejs scripts, import mvs-blockchain from the mvs-blockchain folder, Inside the testscript, add: -``` +```javascript //import mvs-blockchain-js let blockchain = require('../../mvs-blockchain-js')({ url: "https://explorer-testnet.mvs.org/api/" @@ -102,20 +102,20 @@ console.log("Metaversjs has been successfully imported!") now run -``` +```bash node testScript.js ``` **Interact with metaverse via webapp** First create an html file -``` +```bash touch index.html ``` and add -``` +```html
@@ -130,25 +130,25 @@ and add To interact with webapps you must generate "index.js" from mvs-blockchain-js and "metaverse.min.js" from metaversejs. To generate these files you must clone each repository separately, namely [metaversjs](https://github.com/canguruhh/metaversejs) and [mvs-blockchain-js](https://github.com/mvs-org/mvs-blockchain-js) and simply run -``` +```bash grunt ``` This will generate javascript files into the /dist folder that you can import into your app. You don't have to worry about this for now. We have generated these files and placed them in the playground folder. To include them in your webapp just add these script tags into your html page. -``` +```html ``` Serve your webpage -``` +```python python -m SimpleHTTPServer 4444 ``` To test that the libraries have been successfully imported into your webpage, open the web console and enter -``` +```javascript blockchain = await Blockchain({url: "https://explorer-testnet.mvs.org/api/"}) blockchain diff --git a/tutorials/1-Metaverse-Wallet/README.md b/tutorials/1-Metaverse-Wallet/README.md index 9da1d4d..703be5d 100644 --- a/tutorials/1-Metaverse-Wallet/README.md +++ b/tutorials/1-Metaverse-Wallet/README.md @@ -30,7 +30,7 @@ Note: Explicit detailed instructions are given to work with Metaverse, but not a Start by setting up a directory to work in -``` +```bash cd MetaverseTutorials/tutorials/playground touch index.html touch tut1.js @@ -40,8 +40,8 @@ Create front end Open tut1.html and use this HTML front end as the base of your app. -``` -< +```html + @@ -83,7 +83,7 @@ You should now be set up to use the Metaverse javascript libraries. We are using First lets define some key variables -``` +```javascript var wallet //An object representing your Metaverse Wallet var mnemonic //A mnemonic code word used to generate your Wallet var addresses //An array containing addresses belonging to the wallet @@ -93,7 +93,7 @@ var balances //A JSON object containing Wallet balances Start by creating a function to generate a new mnemonic -``` +```javascript async function generateMnemonic(){ mnemonic = await Metaverse.wallet.generateMnemonic() } @@ -103,7 +103,7 @@ async function generateMnemonic(){ And a function to create a Wallet from the mnemonic, using the testnet keyword since we're on the testnet. -``` +```javascript async function createWallet(){ wallet = await Metaverse.wallet.fromMnemonic(mnemonic,'testnet') @@ -114,7 +114,7 @@ Once you've created a wallet you must get some testnet ETP from the testnet fauc A function to get Wallet balances -``` +```javascript async function getETPBalance(){ //Get the lastest Blockchain Length @@ -138,7 +138,7 @@ async function getETPBalance(){ And Finally a function to send ETP -``` +```javascript async function sendETP(amount){ @@ -193,7 +193,7 @@ var mnemonic = "van juice oak general lyrics gravity hammer shield over eager cr ``` -``` +```javascript run() async function run(){ @@ -219,20 +219,20 @@ You should see an ETP balance, and a transaction hash in your terminal. You can To interact with metaversejs in your webapp, you need to reference metaversejs in your HTML. -``` +```html ``` Also reference your tut1.js file. -``` +```html ``` Next serve the webpage with -``` +```python python -m SimpleHTTPServer 3333 ``` diff --git a/tutorials/2-Avatars-and-MSTs/README.md b/tutorials/2-Avatars-and-MSTs/README.md index 00b2899..41e12f6 100644 --- a/tutorials/2-Avatars-and-MSTs/README.md +++ b/tutorials/2-Avatars-and-MSTs/README.md @@ -27,7 +27,7 @@ Avatar certifications First lets create an html front end -``` +```html @@ -75,7 +75,7 @@ nodejs Create a function to register your avatar. -``` +```javascript async function registerAvatar(avatar_name,avatar_address) { let change_address = avatar_address @@ -102,7 +102,7 @@ return avatarInfo.address Create a function to issue an MST -``` +```javascript async function issueMST(issuer,symbol,max_supply,decimalPrecision,description){ @@ -130,7 +130,7 @@ async function issueMST(issuer,symbol,max_supply,decimalPrecision,description){ Create a function to get MST balance -``` +```javascript async function getBalances(){ let wallet = await Metaverse.wallet.fromMnemonic(mnemonic, 'testnet') @@ -148,7 +148,9 @@ async function getBalances(){ Create a function to transfer MST's -``` + +```javascript + async function transferMST(amount,recipient_address,MSTSymbol) { amount = parseInt(amount) @@ -178,7 +180,7 @@ async function transferMST(amount,recipient_address,MSTSymbol) { To interact with metaversejs in your webapp, you need to reference metaversejs in your HTML. -``` +```html @@ -186,7 +188,7 @@ To interact with metaversejs in your webapp, you need to reference metaversejs i Also reference your tut2.js file. -``` +```html diff --git a/tutorials/3-MITs/README.md b/tutorials/3-MITs/README.md index 4b7f91b..bcf3355 100644 --- a/tutorials/3-MITs/README.md +++ b/tutorials/3-MITs/README.md @@ -25,7 +25,8 @@ MIT's can be transferred between avatars. Only Avatars can issue MIT's First lets create an html front end -``` +```html + @@ -81,7 +82,8 @@ First lets create an html front end Create a function to issue an MIT -``` +```javascript + async function issueMIT(symbol, content,issuer_avatar){ var target = { @@ -111,7 +113,8 @@ async function issueMIT(symbol, content,issuer_avatar){ Create a function to get MIT Data. This will be a list of all MIT's owned by avatars in your mnemonic generated wallet -``` +```javascript + async function getMITData(addressArray){ //Get the lastest Blockchain Length let height = await blockchain.height() @@ -178,13 +181,13 @@ Integrate into your Dapp To interact with metaversejs in your webapp, you need to reference metaversejs in your HTML. -``` +```html ``` Also reference your tut3.js file. -``` +```html ```