iota-basic
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Iota-basic

Build Status Coverage Status dependencies Status devDependencies Status AUR NSP Status TypeScript Iota-Basic was born out of my desire to write my own wallet or program that interacts with Iota's tangle ledger. There are many pieces to learn in order to successfully interact with the API, and Iota-Basic aims to simplify that by bringing them all together and integrating them for you in one module.This library automatically detects if you are running in Node or in the browser and uses different implementations for generating seeds or doing proof of work behind the scenes. The way you interact with the library remains the same. This library provides the necessary binaries (From the official release repo) for the 3 major platforms (mac, linux, windows) when running on node, and it also provides the interface for the webgl2 implementation if you are in a browser. The goal is to reduce the learning curve for anyone who wants to code with Iota tangle and do simple code interactions.

Only Node version 8.x.x is supported at this time due to FFI not working on node version 9. related issue: https://github.com/node-ffi/node-ffi/issues/438

NOTE: As of version 2.0 seed generation has been moved as a directive from the foundation for no 3rd party seed generators.

Using npm:

$ npm i --save iota-basic

In Node.js:

//with imports
import { Iota } from 'iota-basic';
 
//with require
const Iota = require('iota-basic').Iota;
 
const iota = new Iota("YOURSEED9999999999999999999999999999999999999999999999999999999999999");
 
//send iota to someone doing pow locally
iota.sendTransaction("RECEIVEADDRESS9999",1).then((success)=>{
    console.log("success",success);
});
 
//with await async
const success = await iota.sendTransaction("RECEIVEADDRESS9999",1);
 
//sending data
const success = await iota.sendTransaction("RECEIVEADDRESS9999",1, {data: "someData"});
 
//sending data with valid tag (27 characters or less, all TRYTES)
const success = await iota.sendTransaction("RECEIVEADDRESS9999",1, {data: "someData"}, "TAG9");
 
//getting accountdata for your seed
const accountData = await iota.getAccountData();
 
//just return the balance of your seed
const balance = await iota.getBalance();
 
//get the checksum for your seed to know that you entered it correctly
const checkSum = await iota.getCheckSum();
 
//get the receive address for your seed without any transactions
const receiveAddress = await iota.getReceiveAddress();
 

Index

External modules


Package Sidebar

Install

npm i iota-basic

Weekly Downloads

1

Version

2.1.0

License

GPL-3.0

Unpacked Size

263 kB

Total Files

34

Last publish

Collaborators

  • thedewpoint