New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@eot/eot

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@eot/eot

Client Module for EOT

latest
npmnpm
Version
1.0.15
Version published
Maintainers
1
Created
Source

Economy Of Truth Client Module

To install

npm install @eot/eot or yarn add @eot/ept

Create a new instance:

const Eot = require('@eot/eot');

const options = {
    adminPort  : 9001 //the admin port number, 
    chargePort : 9002 //the charges port number,
    env        : 'development', //the environment you're in 
    url        : '3.82.0.126',  // the remote URL or IP of the servers
    pubId      : '2' // your publisher ID
};

const eot = new Eot(options); // the new instance

For performance the module uses callbacks rather than promises.

Create a user

The userRef is metadata you can add to the user that relates to your data. Perhaps it's the id of the user in your database.

function createUser() {
    eot.createUser(userRef, createUserCallBack);
}

function createUserCallBack(err, res) {
    // the res body contains the following 

    res.eotId // the id of the user in the EOT db
    res.pubId // your publisher id
    res.userRef // the metadata you added
}

Purchase Token For a User

// purchase 100 tokens for a user with an eotId of 12
eot.purchaseTokens(12, 100, purchaseCallback);

function purchaseCallback(err, res) {
   // res will be a boolean
   if(res){
     console.log('success!')
   }
}

Get Some Users Tokens

Tokens are not removed from a users account merely listed.

// get 3 tokens for a user with an eotId of 12
eot.getTokens(12, 3, getTokensCallback);

function getTokensCallback(err, res) {
  // res is an array of tokens
  console.log(res[0])
}

Charge a User

This will remove the token from the user and move it to your account, providng they have not already spent it.

// charge a user with an eotId of 247 using token 123abc
eot.charge(247, '123abc', chargeCallback);

function chargeCallback(err, res) {
  // res will be OK or ERROR.
  if(res === 'OK'){
    console.log('success')
  }

  if(res === 'ERROR'){
    console.log('User does not own this token')
  }
}

FAQs

Package last updated on 09 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts