Skip to content

surfer77/ethmimo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

JS library for Mimo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%