0

I'm migrating from @scatterjs/eosjs eosjs@16.0.9 to @scatterjs/eosjs2 eosjs@20.0.0.

using eosjs I had the following solution:

Eos.modules.format.encodeName(name, false)

using eosjs2 I found the following but doesn't really work:

const buffer: Serialize.SerialBuffer = new Serialize.SerialBuffer();
buffer.pushName(name);
var number = buffer.getUint64AsNumber();

In the source code says: "Get a uint64 as a number. Caution: number only has 53 bits of precision; some values will change. numeric.binaryToDecimal(serialBuffer.getUint8Array(8)) recommended instead"

But I really don't know how to use it!
where can I get this "numeric" reference from?
How to import it?
what is the whole code to encode a name and get its uint64 value representation?

Thnaks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.