forked from eoscanada/eos-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buyrambytes.go
30 lines (27 loc) · 803 Bytes
/
buyrambytes.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
package system
import (
eos "github.com/eoscanada/eos-go"
)
// NewBuyRAMBytes will buy at current market price a given number of
// bytes of RAM, and grant them to the `receiver` account.
func NewBuyRAMBytes(payer, receiver eos.AccountName, bytes uint32) *eos.Action {
a := &eos.Action{
Account: AN("eosio"),
Name: ActN("buyrambytes"),
Authorization: []eos.PermissionLevel{
{Actor: payer, Permission: eos.PermissionName("active")},
},
ActionData: eos.NewActionData(BuyRAMBytes{
Payer: payer,
Receiver: receiver,
Bytes: bytes,
}),
}
return a
}
// BuyRAMBytes represents the `eosio.system::buyrambytes` action.
type BuyRAMBytes struct {
Payer eos.AccountName `json:"payer"`
Receiver eos.AccountName `json:"receiver"`
Bytes uint32 `json:"bytes"`
}