How To Unstake

To unstake resources, submit a transaction to the undelegatebw action of the eosio account.

In the example shown below useraaaaaaaa unstakes 1.0000 SYS of NET and CPU from the account mynewaccount.

(async () => {
  await api.transact({
    actions: [{
      account: 'eosio',
      name: 'undelegatebw',
      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,
  });
})();