-
Notifications
You must be signed in to change notification settings - Fork 216
/
delegatebw.go
33 lines (30 loc) · 935 Bytes
/
delegatebw.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package system
import (
eos "github.com/eoscanada/eos-go"
)
// NewDelegateBW returns a `delegatebw` action that lives on the
// `eosio.system` contract.
func NewDelegateBW(from, receiver eos.AccountName, stakeCPU, stakeNet eos.Asset, transfer bool) *eos.Action {
return &eos.Action{
Account: AN("eosio"),
Name: ActN("delegatebw"),
Authorization: []eos.PermissionLevel{
{Actor: from, Permission: PN("active")},
},
ActionData: eos.NewActionData(DelegateBW{
From: from,
Receiver: receiver,
StakeNet: stakeNet,
StakeCPU: stakeCPU,
Transfer: eos.Bool(transfer),
}),
}
}
// DelegateBW represents the `eosio.system::delegatebw` action.
type DelegateBW struct {
From eos.AccountName `json:"from"`
Receiver eos.AccountName `json:"receiver"`
StakeNet eos.Asset `json:"stake_net_quantity"`
StakeCPU eos.Asset `json:"stake_cpu_quantity"`
Transfer eos.Bool `json:"transfer"`
}