forked from eoscanada/eos-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buyram.go
32 lines (28 loc) · 818 Bytes
/
buyram.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
package system
import (
eos "github.com/eoscochain/eos-go"
)
func NewBuyRAMQuantity(payer, receiver eos.AccountName, eosQuantity uint64) *eos.Action {
return NewBuyRAM(payer, receiver, eos.NewEOSAsset(int64(eosQuantity)))
}
func NewBuyRAM(payer, receiver eos.AccountName, asset eos.Asset) *eos.Action {
a := &eos.Action{
Account: AN("eosio"),
Name: ActN("buyram"),
Authorization: []eos.PermissionLevel{
{Actor: payer, Permission: PN("active")},
},
ActionData: eos.NewActionData(BuyRAM{
Payer: payer,
Receiver: receiver,
Quantity: asset,
}),
}
return a
}
// BuyRAM represents the `eosio.system::buyram` action.
type BuyRAM struct {
Payer eos.AccountName `json:"payer"`
Receiver eos.AccountName `json:"receiver"`
Quantity eos.Asset `json:"quant"` // specified in EOS
}