-
Notifications
You must be signed in to change notification settings - Fork 0
/
collectible.go
64 lines (47 loc) · 1.69 KB
/
collectible.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
package metadata
import (
"github.com/rss3-network/protocol-go/schema"
"github.com/rss3-network/protocol-go/schema/typex"
)
var _ Metadata = (*CollectibleTransfer)(nil)
type CollectibleTransfer Token
func (c CollectibleTransfer) Type() schema.Type {
return typex.CollectibleTransfer
}
//go:generate go run --mod=mod github.com/dmarkham/enumer --values --type=CollectibleApprovalAction --transform=snake --trimprefix=ActionCollectibleApproval --output collectible_approval.go --json --sql
type CollectibleApprovalAction uint64
//goland:noinspection GoMixedReceiverTypes
func (t CollectibleApprovalAction) Type() schema.Type {
return typex.CollectibleApproval
}
const (
ActionCollectibleApprovalApprove CollectibleApprovalAction = iota + 1
ActionCollectibleApprovalRevoke
)
var _ Metadata = (*CollectibleApproval)(nil)
type CollectibleApproval struct {
Action CollectibleApprovalAction `json:"action"`
Token
}
func (c CollectibleApproval) Type() schema.Type {
return typex.CollectibleApproval
}
//go:generate go run --mod=mod github.com/dmarkham/enumer --values --type=CollectibleTradeAction --transform=snake --trimprefix=ActionCollectibleTrade --output collectible_trade.go --json --sql
type CollectibleTradeAction uint64
//goland:noinspection GoMixedReceiverTypes
func (r CollectibleTradeAction) Type() schema.Type {
return typex.CollectibleTrade
}
const (
ActionCollectibleTradeBuy CollectibleTradeAction = iota + 1
ActionCollectibleTradeSell
)
var _ Metadata = (*CollectibleTradeAction)(nil)
type CollectibleTrade struct {
Action CollectibleTradeAction `json:"action"`
Token
Cost *Token `json:"cost,omitempty"`
}
func (r CollectibleTrade) Type() schema.Type {
return typex.CollectibleTrade
}