-
Notifications
You must be signed in to change notification settings - Fork 0
/
fury1155.go
213 lines (177 loc) · 5.4 KB
/
fury1155.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package fury1155
import (
"bytes"
"encoding/json"
"time"
)
type InstantiateMsg struct {
/// The minter is the only one who can create new tokens.
Minter string `json:"minter"`
}
// Must be [Token_id, Amount, Uri]
type Batch []string
type Expiration struct {
AtHeight string
AtTime time.Time
Never interface{}
}
type WasmSendFrom struct {
SendFrom SendFrom `json:"send_from"`
}
// SendFrom / SendFrom is a base message to move tokens
// / if `env.sender` is the owner or has sufficient pre-approval.
type SendFrom struct {
From string `json:"from"`
/// If `to` is not contract `msg` should be `None`
To string `json:"to"`
Token_id string `json:"token_id"`
Value string `json:"value"`
/// `None` means don't call the receiver interface
Msg []byte `json:"msg"`
}
type WasmBatchSendFrom struct {
BatchSendFrom BatchSendFrom `json:"batch_send_from"`
}
// BatchSendFrom / BatchSendFrom is a base message to move multiple types of tokens in batch
// / if `env.sender` is the owner or has sufficient pre-approval.
type BatchSendFrom struct {
From string `json:"from"`
/// if `to` is not contract `msg` should be `None`
To string `json:"to"`
Batch []Batch `json:"batch"`
/// `None` means don't call the receiver interface
Msg []byte `json:"msg"`
}
type WasmMsgMint struct {
Mint Mint `json:"mint"`
}
// Mint / Mint is a base message to mint tokens.
type Mint struct {
/// If `to` is not contract `msg` should be `None`
To string `json:"to"`
TokenId string `json:"token_id"`
Value string `json:"value"`
Uri string `json:"uri"`
/// `None` means don't call the receiver interface
Msg []byte `json:"msg,omitempty"`
}
type WasmMsgBatchMint struct {
BatchMint BatchMint `json:"batch_mint"`
}
// BatchMint / BatchMint is a base message to mint multiple types of tokens in batch.
type BatchMint struct {
/// If `to` is not contract `msg` should be `None`
To string `json:"to"`
Batch []Batch `json:"batch"`
/// `None` means don't call the receiver interface
Msg []byte `json:"msg"`
}
type WasmMsgBurn struct {
Burn Burn `json:"burn"`
}
// Burn / Burn is a base message to burn tokens.
type Burn struct {
From string `json:"from"`
Token_id string `json:"token_id"`
Value string `json:"value"`
}
type WasmMsgBatchBurn struct {
BatchBurn BatchBurn `json:"batch_burn"`
}
// BatchBurn / BatchBurn is a base message to burn multiple types of tokens in batch.
type BatchBurn struct {
From string `json:"from"`
Batch []Batch `json:"batch"`
}
type WasmMsgApproveAll struct {
ApproveAll ApproveAll `json:"approve_all"`
}
// ApproveAll / Allows operator to transfer / send any token from the owner's account.
// / If expiration is set then this allowance has a time/height limit
type ApproveAll struct {
Operator string `json:"operator"`
Expires Expiration `json:"expires"`
}
type WasmMsgRevokeAll struct {
RevokeAll RevokeAll `json:"revoke_all"`
}
// RevokeAll / Remove previously granted ApproveAll permission
type RevokeAll struct {
Operator string `json:"operator"`
}
//queries
type WasmMsgBalance struct {
Balance Balance `json:"balance"`
}
// Balance #[returns(BalanceResponse)]
type Balance struct {
Owner string `json:"owner"`
Token_id string `json:"token_id"`
}
type WasmMsgBatchBalance struct {
BatchBalance BatchBalance `json:"batch_balance"`
}
// BatchBalance BatchBalance / Returns the current balance of the given address for a batch of tokens 0 if unset.
// #[returns(BatchBalanceResponse)]
type BatchBalance struct {
Owner string `json:"owner"`
Token_ids []string `json:"token_ids"`
}
type WasmMsgApprovedForAll struct {
ApprovedForAll ApprovedForAll `json:"approved_for_all"`
}
// ApprovedForAll / List all operators that can access all of the owner's tokens.
// #[returns(ApprovedForAllResponse)]
type ApprovedForAll struct {
Owner string `json:"owner"`
/// unset or false will filter out expired approvals you must set to true to see them
Include_expired bool `json:"include_expired"`
Start_after string `json:"start_after"`
Limit string `json:"limit"`
}
type WasmMsgIsApprovedForAll struct {
IsApprovedForAll IsApprovedForAll `json:"is_approved_for_all"`
}
// IsApprovedForAll / Query approved status `owner` granted to `operator`.
// #[returns(IsApprovedForAllResponse)]
type IsApprovedForAll struct {
Owner string `json:"owner"`
Operator string `json:"operator"`
}
type WasmMsgTokenInfo struct {
TokenInfo TokenInfo `json:"token_info"`
}
// TokenInfo / With MetaData Extension.
// / Query metadata of token
// #[returns(TokenInfoResponse)]
type TokenInfo struct {
Token_id string `json:"token_id"`
}
type WasmMsgTokens struct {
Tokens Tokens `json:"tokens"`
}
// Tokens / With Enumerable extension.
// / Returns all tokens owned by the given address [] if unset.
// #[returns(TokensResponse)]
type Tokens struct {
Owner string `json:"owner"`
Start_after string `json:"start_after"`
Limit string `json:"limit"`
}
type WasmMsgAllTokens struct {
AllTokens AllTokens `json:"all_tokens"`
}
// AllTokens / With Enumerable extension.
// / Requires pagination. Lists all token_ids controlled by the contract.
// #[returns(TokensResponse)]
type AllTokens struct {
Start_after string `json:"start_after"`
Limit string `json:"limit"`
}
func Marshal(value interface{}) ([]byte, error) {
jsonBuffer := new(bytes.Buffer)
if err := json.NewEncoder(jsonBuffer).Encode(value); err != nil {
return nil, err
}
return jsonBuffer.Bytes(), nil
}