2

In the browser via eosjs, I have made the below function adapted from the docs but how do I calculate the minimum RAM in bytes, stake_net_quantity and the stake_cpu_quantity?

I understand these values will change overtime? If so then I need to calculate them every-time just before making the transaction.

_makeAccount(eos, ownerPublicKey, activePublicKey, creatorAccountName, newAccountName){

// eos = the eos object initialised with the creatorPublicKey
// ownerPublicKey = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'
// activePublicKey = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'
// creatorAccountName "helloeosblox"
// newAccountName = "mynewaccount"

eos.transaction(tr => {
  tr.newaccount({
    creator: creatorAccountName,
    name: newAccountName,
    owner: ownerPublicKey,
    active: activePublicKey
  })

  tr.buyrambytes({
    payer: creatorAccountName,
    receiver: newAccountName,
    bytes: 8192
  })

  tr.delegatebw({
    from: creatorAccountName,
    receiver: newAccountName,
    stake_net_quantity: '10.0000 EOS',
    stake_cpu_quantity: '10.0000 EOS',
    transfer: 0
  })
})

}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.