Eoslime
Search…
Utils
eoslime.utils

Useful when your account name is represented as uint64_t and you want to convert it to a readable string
const eoslime = require('eoslime').init();
const DONATION_ABI_PATH = './contracts/example/donation.abi';
const donationContract = eoslime.Contract.at('donation.acc');
// First donator name is 'donater.name'
// In the contract it is encoded as 5559250271203861664
const donaters = await donationContract.getDonaters();
// donaters[0].account => 5559250271203861664
const donaterName = eoslime.utils.toName(donaters[0].account);
// donaterName => 'donater.name'

Generates a random account name for you
const eoslime = require('eoslime');
const randomName = eoslime.utils.randomName();
// randomName => 'l33fe2bf215c'

Construct an account name from a private key. The name is constructed in a custom way, it is not related to the private key in any manner.
const eoslime = require('eoslime');
const name = eoslime.utils.nameFromPrivateKey('private key');
// name => 'l33fe2bf215c'

Generates a random private key.
const eoslime = require('eoslime');
const privateKey = eoslime.utils.randomPrivateKey();

Generates a public/private key pair
const eoslime = require('eoslime');
const keyPair = eoslime.utils.generateKeys();
/*
keyPair =>
{
privateKey: '5KRMNhyxuyymrZ3dEy2Tsy2a794DBmNBZWoPjR9BzT15QSLomLr',
publicKey: 'EOS54gGNru7KbXWcbpQAFbRP7ftWE3dNY5C2igrnYsTRXvvewsNni'
}
*/
Copy link
On this page
toName(encodedName)
randomName()
nameFromPrivateKey()
randomPrivateKey()
generateKeys()