forked from eoscanada/eos-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec.go
31 lines (28 loc) · 825 Bytes
/
exec.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
package sudo
import (
eos "github.com/eoscanada/eos-go"
)
// NewExec creates an `exec` action, found in the `eosio.wrap`
// contract.
//
// Given an `eos.Transaction`, call `eos.MarshalBinary` on it first,
// pass the resulting bytes as `eos.HexBytes` here.
func NewExec(executer eos.AccountName, transaction eos.Transaction) *eos.Action {
a := &eos.Action{
Account: eos.AccountName("eosio.wrap"),
Name: eos.ActionName("exec"),
Authorization: []eos.PermissionLevel{
{Actor: executer, Permission: eos.PermissionName("active")},
},
ActionData: eos.NewActionData(Exec{
Executer: executer,
Transaction: transaction,
}),
}
return a
}
// Exec represents the `eosio.system::exec` action.
type Exec struct {
Executer eos.AccountName `json:"executer"`
Transaction eos.Transaction `json:"trx"`
}