JSPM

  • Created
  • Published
  • Downloads 816
  • Score
    100M100P100Q95831F
  • License MIT

Tezos JavaScript API

Package Exports

  • sotez

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sotez) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sotez - A JS Library for Tezos

npm Build Status

Getting Started

npm install sotez
// Import library or individual modules
import Sotez, { utility, forge, crypto, ledger } from 'sotez';

// Or using require
const Sotez = require('sotez').default;
const { utility, forge, crypto, ledger } = require('sotez');
const sotez = new Sotez('http://127.0.0.1:8732');

const example = async () => {
  // A secret key or a ledger must be imported to sign transactions
  // await sotez.importLedger();
  await sotez.importKey('...');

  // A simple transfer operation
  const { hash } = await sotez.transfer({
    to: 'tz1RvhdZ5pcjD19vCCK9PgZpnmErTba3dsBs',
    amount: '1000000',
  });

  console.log(`Injected Operation Hash: ${hash}`);

  // Await confirmation of included operation
  const block = await sotez.awaitOperation(hash);
  console.log(`Operation found in block ${block}`);
};

sotez.query('/chains/main/blocks/head')
  .then(response => console.log(response));

crypto.generateMnemonic()
  .then(mnemonic => console.log(mnemonic));

Documentation

Documentation can be found HERE.

Development

npm install
npm run build

Compiled files will be located in the lib folder. Distribution files will be located in the dist/node and dist/web folders.

License

MIT

Credits

Credits to Stephen Andrews and EZTZ.