Eoslime
Search…
Utils
1
eoslime.utils
Copied!

toName(encodedName)

Useful when your account name is represented as uint64_t and you want to convert it to a readable string
1
const eoslime = require('eoslime').init();
2
3
const DONATION_ABI_PATH = './contracts/example/donation.abi';
4
5
const donationContract = eoslime.Contract.at('donation.acc');
6
7
// First donator name is 'donater.name'
8
// In the contract it is encoded as 5559250271203861664
9
const donaters = await donationContract.getDonaters();
10
11
// donaters[0].account => 5559250271203861664
12
const donaterName = eoslime.utils.toName(donaters[0].account);
13
// donaterName => 'donater.name'
Copied!

randomName()

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

nameFromPrivateKey()

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.
1
const eoslime = require('eoslime');
2
const name = eoslime.utils.nameFromPrivateKey('private key');
3
// name => 'l33fe2bf215c'
Copied!

randomPrivateKey()

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

generateKeys()

Generates a public/private key pair
1
const eoslime = require('eoslime');
2
const keyPair = eoslime.utils.generateKeys();
3
/*
4
keyPair =>
5
{
6
privateKey: '5KRMNhyxuyymrZ3dEy2Tsy2a794DBmNBZWoPjR9BzT15QSLomLr',
7
publicKey: 'EOS54gGNru7KbXWcbpQAFbRP7ftWE3dNY5C2igrnYsTRXvvewsNni'
8
}
9
*/
Copied!
Last modified 1yr ago