Skip to content

Instantly share code, notes, and snippets.

@clar
Created March 26, 2019 07:04
Show Gist options
  • Save clar/7f4499fcc1f2419a9a0aa44cf0ed3cc2 to your computer and use it in GitHub Desktop.
Save clar/7f4499fcc1f2419a9a0aa44cf0ed3cc2 to your computer and use it in GitHub Desktop.
let Eos = require('eosjs');
let httpEndpoint = "https://eos.greymass.com";
let eos = Eos({httpEndpoint});
// curl https://eos.greymass.com/v1/chain/abi_json_to_bin -X POST -d '{"code":"eosdotaprod1", "action":"sign", "args":{"account":"atlantisland","timestamp":1553514689676000,"nonce":351544}}'
// curl https://eos.greymass.com/v1/chain/abi_json_to_bin -X POST -d '{"code":"eosdotaprod1", "action":"sign", "args":{"account":"atlantisland","timestamp":"2019-03-25T12:25:39.492","nonce":351544}}'
(async() => {
const acc = "eosdotaprod1"
const act = "sign"
let abi = (await eos.contract(acc)).fc
const typeName = abi.abi.actions.find(x => x.name === act).type;
let dataobj = {
"account":"atlantisland",
"timestamp":1553514689676000,
"nonce":351544
}
let buf = abi.toBuffer(typeName, dataobj)
console.log(buf.toString('hex'));
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment