Coder Social home page Coder Social logo

ethmimo's Introduction

ethmimo

The JS library for the Mimo protocol. Use it to build third-party apps for Mimo and build Dapps leveraging profiles on ENS.

Install

npm ethmimo web3 ipfs

Quick Start

How to setup Mimo

const Mimo = require('ethmimo');
const IPFS = require('ipfs');
const Web3 = require('web3');

// set up necessary nodes
const ipfs = new IPFS();
const web3 = new Web3();

// Set up Mimo
const mimo = new Mimo(web3, ipfs);

How to create and save a profile

// Set up a DB for an ENS name
const alice = await mimo.createProfile('alice.mimoapp.eth');

// save the DB address to the blockchain
mimo.saveProfile(alice, web3.eth.accounts[0]);

// You MUST save your profile after creating it

How to open a profile

// Set up a DB for an ENS name
const bob = await mimo.openProfile('bobsburgers.eth');

How to add data to a profile DB

// add data to the DB
// You must include a signature of the data by the owner of the profile
bob.add({bio: 'I <3 ETH!'}, <signature>);

// You DON'T need to save your profile after adding data

How to get a profile DB's logs

// Get all data published to a user's DB
await mimo.getHistory('bobsburgers.eth')
.then(logs => console.log(logs));

// You can also pass a DB object
mimo.getHistory(alice)
.then(logs => console.log(logs));

How to get the current state of a profile

// Get the current state of a profile
await mimo.getState('bobsburgers.eth')
.then(state => console.log(state));

// You can also pass a DB object
mimo.getState(alice)
.then(state => console.log(state));

Extra utils

// Get the owner of an ENS name
await mimo.owner('gitcoin.eth');
// >> 0xddf369c3bf18b1b12ea295d597b943b955ef4671

// Checks if an ENS name is registered/valid
await mimo.isNameValid('gitcoin.eth');
// >> true

// Check if an unlocked account is the owner of a given ENS name
await mimo.isAccountOwner('gitcoin.eth', web3.eth.accounts[0]);
// >> true/false

Documentation

To learn more about DB specific methods, see the OrbitDB documentation here.

To learn more about MimoStore and ethmimo-orbit, see the documentation here.

Contributing

Please DM me on Twitter (@ghiliweld) if you're interested in helping, my DMs are open!

PRs are open too!

License

MIT © 2018 Ghilia Weldesselasie

ethmimo's People

Contributors

ghiliweld avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.