-
Notifications
You must be signed in to change notification settings - Fork 0
/
proposalcreateoperation.go
73 lines (58 loc) · 2.03 KB
/
proposalcreateoperation.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package operations
//go:generate ffjson $GOFILE
import (
"github.com/CybexDex/cybex-go/types"
"github.com/CybexDex/cybex-go/util"
"github.com/juju/errors"
)
func init() {
types.OperationMap[types.OperationTypeProposalCreate] = func() types.Operation {
op := &ProposalCreateOperation{}
return op
}
}
type ProposalCreateOperation struct {
types.OperationFee
ExpirationTime types.Time `json:"expiration_time"`
Extensions types.Extensions `json:"extensions"`
FeePayingAccount types.GrapheneID `json:"fee_paying_account"`
ReviewPeriodSeconds *types.UInt32 `json:"review_period_seconds,omitempty"`
ProposedOps types.OperationEnvelopeHolders `json:"proposed_ops"`
}
func (p ProposalCreateOperation) Type() types.OperationType {
return types.OperationTypeProposalCreate
}
func (p ProposalCreateOperation) Marshal(enc *util.TypeEncoder) error {
if err := enc.Encode(int8(p.Type())); err != nil {
return errors.Annotate(err, "encode OperationType")
}
if err := enc.Encode(p.Fee); err != nil {
return errors.Annotate(err, "encode Fee")
}
if err := enc.Encode(p.FeePayingAccount); err != nil {
return errors.Annotate(err, "encode FeePayingAccount")
}
if err := enc.Encode(p.ExpirationTime); err != nil {
return errors.Annotate(err, "encode ExpirationTime")
}
if err := enc.Encode(p.ProposedOps); err != nil {
return errors.Annotate(err, "encode ProposedOps")
}
if err := enc.Encode(p.ReviewPeriodSeconds != nil); err != nil {
return errors.Annotate(err, "encode have ReviewPeriodSeconds")
}
if err := enc.Encode(p.ReviewPeriodSeconds); err != nil {
return errors.Annotate(err, "encode ReviewPeriodSeconds")
}
if err := enc.Encode(p.Extensions); err != nil {
return errors.Annotate(err, "encode Extensions")
}
return nil
}
//NewProposalCreateOperation creates a new ProposalCreateOperation
func NewProposalCreateOperation() *ProposalCreateOperation {
tx := ProposalCreateOperation{
Extensions: types.Extensions{},
}
return &tx
}