0.6.3 • Published 2 years ago

cuprumtezlibrary v0.6.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

cuprumtezlibrary - A JS Library for Cuprumcoin

npm Build Status

Getting Started

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

// Or using require
const Sotez = require('cuprumtezlibrary').default;
const { utility, forge, crypto, ledger } = require('cuprumtezlibrary');
const sotez = new Sotez('RPCURL');

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: 'CC1bcr8qTeNnKLjnA67CKi8XPUzydGZQbCWf',
    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));

sotez.getBalance("CC1bcr8qTeNnKLjnA67CKi8XPUzydGZQbCWf")
  .then(balance => {
    console.log(`Account balance : ${balance}`)
  });

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