Skip to content
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
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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
```

Expand All @@ -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/"
Expand All @@ -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
<html>
<head>
<meta charset="utf-8">
Expand All @@ -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
<script src = "metaverse.min.js"></script>
<script src = "index.min.js"></script>
```

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
Expand Down
24 changes: 12 additions & 12 deletions tutorials/1-Metaverse-Wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,8 +40,8 @@ Create front end

Open tut1.html and use this HTML front end as the base of your app.

```
<<!DOCTYPE html>
```html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -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
Expand All @@ -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()
}
Expand All @@ -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')

Expand All @@ -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
Expand All @@ -138,7 +138,7 @@ async function getETPBalance(){

And Finally a function to send ETP

```
```javascript

async function sendETP(amount){

Expand Down Expand Up @@ -193,7 +193,7 @@ var mnemonic = "van juice oak general lyrics gravity hammer shield over eager cr

```

```
```javascript
run()

async function run(){
Expand All @@ -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
<script type="text/javascript" src="/dist/metaverse.min.js"></script>
```

Also reference your tut1.js file.

```
```html
<script type="text/javascript" src="tut1.js"></script>
```

Next serve the webpage with


```
```python
python -m SimpleHTTPServer 3333
```

Expand Down
16 changes: 9 additions & 7 deletions tutorials/2-Avatars-and-MSTs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Avatar certifications

First lets create an html front end

```
```html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
Expand Down Expand Up @@ -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
Expand All @@ -102,7 +102,7 @@ return avatarInfo.address

Create a function to issue an MST

```
```javascript

async function issueMST(issuer,symbol,max_supply,decimalPrecision,description){

Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down Expand Up @@ -178,15 +180,15 @@ async function transferMST(amount,recipient_address,MSTSymbol) {

To interact with metaversejs in your webapp, you need to reference metaversejs in your HTML.

```
```html

<script type="text/javascript" src="/dist/metaverse.min.js"></script>

```

Also reference your tut2.js file.

```
```html

<script type="text/javascript" src="tut2.js"></script>

Expand Down
13 changes: 8 additions & 5 deletions tutorials/3-MITs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -178,13 +181,13 @@ Integrate into your Dapp

To interact with metaversejs in your webapp, you need to reference metaversejs in your HTML.

```
```html
<script type="text/javascript" src="/dist/metaverse.min.js"></script>
```

Also reference your tut3.js file.

```
```html
<script type="text/javascript" src="tut3.js"></script>
```

Expand Down