📜  eosio 名称到 int js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:45.803000             🧑  作者: Mango

代码示例1
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"));