eosio name to int js code example
Example: eosio name to int js
import { createInitialTypes, SerialBuffer } from 'eosjs/dist/eosjs-serialize';
convertName(name){
const builtinTypes = createInitialTypes()
const typeUint64 = builtinTypes.get("uint64")
const typeName = builtinTypes.get("name")
var buffer = new SerialBuffer({ textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
typeName.serialize(buffer, name)
return typeUint64.deserialize(buffer)
}
console.log(convertName("hossainiiiir"));