To stake resources, submit a transaction to the delegatebw
action of the eosio
account.
In the example shown below useraaaaaaaa
stakes 1.0000 SYS of NET and CPU to the account mynewaccount
.
(async () => {
await api.transact({
actions: [{
account: 'eosio',
name: 'delegatebw',
authorization: [{
actor: 'useraaaaaaaa',
permission: 'active',
}],
data: {
from: 'useraaaaaaaa',
receiver: 'mynewaccount',
stake_net_quantity: '1.0000 SYS',
stake_cpu_quantity: '1.0000 SYS',
transfer: false,
}
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
});
})();