@veejs/vee-api

VEE Javascript library for node and browser

Usage no npm install needed!

<script type="module">
  import veejsVeeApi from 'https://cdn.skypack.dev/@veejs/vee-api';
</script>

README

VEE API

VEE Wallet library for both Node.js and browser.

Usage

Create a wallet

const { Wallet, Network } = require('vee-api');
const seed = Wallet.generateSeed(); // create a new random seed
const wallet = new Wallet({
    seed: seed, // default Wallet.generateSeed()
    nonce: 0, // default 0
    network: Network.MAIN_NET // default Network.MAIN_NET
});

// generate two accounts
wallet.generateAccounts(2);
const account = wallet.accounts[0];

console.log(account.address);
console.log(account.privateKey);
console.log(account.publicKey);

Create a transaction

const { PaymentTransaction, LeaseTransaction, CancelLeaseTransaction } = require('vee-api');

// PaymentTransaction
const paymentTx = new PaymentTransaction({
  amount: 2000000000, // 20 VVV
  attachment: '8Qp', // string
  fee: 10000000, // 0.1 VVV
  feeScale: 100,
  recipient: 'AUAHdqvnFDbxRZ8rkyqm4wT9A7qQ8CZRGLM', // address or alias
  timestamp: 1541988503768000000 // Date.now() * 1e6
});
const signature = paymentTx.getSignature(account.privateKey);
console.log(signature);

// LeaseTransaction
const leaseTx = new LeaseTransaction({
  amount: 2000000000, // 20 VVV
  fee: 10000000, // 0.1 VVV
  feeScale: 100,
  recipient: 'AUAHdqvnFDbxRZ8rkyqm4wT9A7qQ8CZRGLM', // address or alias
  timestamp: 1541988503768000000 // Date.now() * 1e6
});

// CancelLeaseTransaction
const cancelLeaseTx = new CancelLeaseTransaction({
  fee: 10000000, // 0.1 VVV
  feeScale: 100,
  txId: 'EPH2QpZoBBzfbjkubCPPtEfrXm2iLcc2YMgq2yejqseT', // transaction id
  timestamp: 1541988503768000000 // Date.now() * 1e6
});