Skip to content

ottokafka/iQuote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Test it out Here: iQoute

image

Developers follow this guide below

Getting Started

  1. Using the Terminal git clone https://github.com/ottokafka/IQuote.git

  2. Open the directory of the download and open index.html

image

  1. You will see this:

image

image

  1. Install the Web Extension Wallet. Go to the github link

Chrome extention wallet

  1. in the terminal git clone https://github.com/ChengOrangeJu/WebExtensionWallet.git

  2. in Chrome browser: More tools / Extensions

image

click enable developer and click LOAD UNPACKED

image

Select WebExtensionWallet folder and click SELECT

image

You will see this below

image

Open the extension and select testnet. Note: if you can't find the web extension on chrome it might be hidden so just click the hidden field where I icon might be. it worked for me or create a short cut key for that extension.

image

unlock your wallet and send NAS to your self

image

you will see this after you sumbit nas to yourself

image

Now go back to the main Dapp the index.html file and refresh the page. You can go ahead and use this Dapp now.

image

Create a Quote such as this example and sign your name. Click Submit and this will save it to the Nebulas blockchain

image

Now search your name that your used

image

The Results will show

image

Below is the full Smart Contract used for this Dapp

"use strict";

var UserInput = function(text) {
	if (text) {
		var obj = JSON.parse(text);
		this.key = obj.key;
		this.value = obj.value;
	} else {
	    this.key = "";
	    this.value = "";
	}
};

UserInput.prototype = {
	toString: function () {
		return JSON.stringify(this);
	}
};

var Quotes = function () {
    LocalContractStorage.defineMapProperty(this, "repo", {
        parse: function (text) {
            return new UserInput(text);
        },
        stringify: function (o) {
            return o.toString();
        }
    });
};

Quotes.prototype = {
    init: function () {
        
    },

    save: function (key, value) {
        key = key.trim();
        value = value.trim();
        if (key === "" || value === ""){
            throw new Error("empty key / value");
        }
        var usersName = this.repo.get(key);
        if (usersName){
            throw new Error("This Name is already being used");
        }
        usersName = new UserInput();
        usersName.key = key;
        usersName.value = value;

        this.repo.put(key, usersName);
    },

    get: function (key) {
        key = key.trim();
        if ( key === "" ) {
            throw new Error("empty key")
        }
        return this.repo.get(key);
    }
};

module.exports = Quotes;

Releases

No releases published

Packages

No packages published