执行创建账户
const name = 'bcskillsuroy'
const pubkey = 'EOS68mvUMCz73a5Xj2wnJxdTW1aPjmiKCeSAjVdXjTd3D3g9A38EE'
eos.transaction(tr => {
tr.newaccount({
creator: 'dapp.exec',
name,
owner: pubkey,
active: pubkey
})
tr.buyrambytes({
payer: 'dapp.exec',
receiver: name,
bytes: 8192
})
tr.delegatebw({
from: 'dapp.exec',
receiver: name,
stake_net_quantity: '10.0000 EOS',
stake_cpu_quantity: '10.0000 EOS',
transfer: 0
})
}).then(console.log)
.catch(e => {
console.error(e);
})
返回错误
eos.js:3010 {"code":500,"message":"Internal Service Error","error":{"code":3050003,"name":"eosio_assert_message_exception","what":"eosio_assert_message assertion failure","details":[{"message":"assertion failure with message: no balance object found","file":"wasm_interface.cpp","line_number":930,"method":"eosio_assert"},{"message":"","file":"apply_context.cpp","line_number":62,"method":"exec_one"}]}}
原因:由于buyrambytes,创建主账户没有足够可用的余额(EOS此时返回的错误提示也有待改进)