/
type.go
502 lines (422 loc) · 14.2 KB
/
type.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
package sdk
import "io"
type Asset struct {
AssetId uint32 `json:"asset_id"`
Balance string `json:"balance"`
LpAmount string `json:"lp_amount"`
OfferCanceledOrFinalized string `json:"offer_canceled_or_finalized"`
}
type AccountInfo struct {
Index uint32 `json:"account_index"`
Name string `json:"account_name"`
Nonce int64 `json:"nonce"`
AccountPk string `json:"account_pk"`
Assets []*Asset `json:"assets"`
}
type RespGetAssetsList struct {
Assets []*AssetInfo `json:"assets"`
}
type AssetInfo struct {
AssetId uint32 `json:"asset_id"`
AssetName string `json:"asset_name"`
AssetDecimals uint32 `json:"asset_decimals"`
AssetSymbol string `json:"asset_symbol"`
AssetAddress string `json:"asset_address"`
IsGasAsset uint32 `json:"is_gas_asset"`
}
type TxDetail struct {
TxId int64 `json:"tx_id"`
AssetId int64 `json:"asset_id"`
AssetType int64 `json:"asset_type"`
AccountIndex int64 `json:"account_index"`
AccountName string `json:"account_name"`
Balance string `json:"balance"`
BalanceDelta string `json:"balance_delta"`
Order int64 `json:"order"`
AccountOrder int64 `json:"account_order"`
Nonce int64 `json:"nonce"`
CollectionNonce int64 `json:"collection_nonce"`
}
type Tx struct {
TxId int64 `json:"tx_id"`
TxHash string `json:"tx_hash"`
TxType int64 `json:"tx_type"`
GasFee string `json:"gas_fee"`
GasFeeAssetId int64 `json:"gas_fee_asset_id"`
TxStatus int64 `json:"tx_status"`
BlockHeight int64 `json:"block_height"`
BlockId int64 `json:"block_id"`
StateRoot string `json:"state_root"`
NftIndex int64 `json:"nft_index"`
PairIndex int64 `json:"pair_index"`
AssetId int64 `json:"asset_id"`
TxAmount string `json:"tx_amount"`
NativeAddress string `json:"native_address"`
TxInfo string `json:"tx_info"`
TxDetails []*TxDetail `json:"tx_details"`
ExtraInfo string `json:"extra_info"`
Memo string `json:"memo"`
AccountIndex int64 `json:"account_index"`
Nonce int64 `json:"nonce"`
ExpiredAt int64 `json:"expired_at"`
}
type Categorie struct {
Id int64 `json:"id"`
Name string `json:"name"`
}
type Collection struct {
Id int64 `json:"id"`
L2CollectionId int64 `json:"l2_collection_id"`
AccountName string `json:"account_name"`
Name string `json:"name"`
ShortName string `json:"short_name"`
Description string `json:"description"`
CategoryId int64 `json:"category_id"`
CollectionUrl string `json:"collection_url"`
ExternalLink string `json:"external_link"`
TwitterLink string `json:"twitter_link"`
InstagramLink string `json:"instagram_link"`
TelegramLink string `json:"telegram_link"`
DiscordLink string `json:"discord_link"`
LogoImage string `json:"logo_image"`
LogoThumb string `json:"logo_thumb"`
FeaturedImage string `json:"featured_image"`
FeaturedThumb string `json:"featured_Thumb"`
BannerImage string `json:"banner_image"`
BannerThumb string `json:"banner_thumb"`
CreatorEarningRate int64 `json:"creator_earning_rate"`
Status string `json:"status"`
ExpiredAt int64 `json:"expired_at"`
CreatedAt int64 `json:"created_at"`
ItemCount int64 `json:"item_count"`
BrowseCount int64 `json:"browse_count"`
FloorPrice int64 `json:"floor_price"`
OneDayTradeVolume int64 `json:"one_day_trade_volume"`
TotalTradeVolume int64 `json:"total_trade_volume"`
}
type RespCreateCollection struct {
Collection Collection `json:"collection"`
}
type RespUpdateCollection struct {
Collection Collection `json:"collection"`
}
type ReqGetAllCollectionByCategoryId struct {
CategoryId int64 `form:"category_id"`
}
type RespGetAllCollectionByCategoryId struct {
Total int64 `json:"total"`
Collections []Collection `json:"collections"`
}
type RespCategoryById struct {
Category Categorie `json:"categorie"`
}
type RespSearchCollection struct {
Total int64 `json:"total"`
Collections []Collection `json:"collections"`
}
type RespGetContentHash struct {
ContentHash string `json:"content_hash"`
}
type Propertie struct {
Name string `json:"name"`
Value string `json:"value"`
}
type Level struct {
Name string `json:"name"`
Value int64 `json:"value"`
MaxValue int64 `json:"maxValue"`
}
type Stat struct {
Name string `json:"name"`
Value int64 `json:"value"`
MaxValue int64 `json:"maxValue"`
}
type NftInfo struct {
Id int64 `json:"id"`
AccountName string `json:"account_name"`
NftIndex int64 `json:"nft_index"`
CollectionId int64 `json:"collection_id"`
CreatorEarningRate int64 `json:"creator_earning_rate"`
Name string `json:"name"`
Description string `json:"description"`
Media string `json:"media"`
ImageThumb string `json:"image_thumb"`
VideoThumb string `json:"video_thumb"`
AudioThumb string `json:"audio_thumb"`
Status string `json:"status"`
ContentHash string `json:"content_hash"`
NftUrl string `json:"nft_url"`
ExpiredAt int64 `json:"expired_at"`
CreatedAt int64 `json:"created_at"`
Properties []Propertie `json:"properties"`
Levels []Level `json:"levels"`
Stats []Stat `json:"stats"`
}
type RespCreateAsset struct {
Asset NftInfo `json:"asset"`
}
type RespSearchAsset struct {
Total int64 `json:"total"`
Assets []*Asset `json:"assets"`
}
type RespGetAllAssetByCollectionId struct {
Total int64 `json:"total"`
Assets []*Asset `json:"assets"`
}
type RespMediaUpload struct {
PublicId string `json:"public_id"`
Url string `json:"url,omitempty"`
}
type RespGetCollectionOwnerNum struct {
OwnerNum int64 `json:"owner_num"`
}
type RespSendTransferNft struct {
Success bool `json:"success"`
}
type RespSendWithdrawNft struct {
Success bool `json:"success"`
}
type RespSendWithdrawTx struct {
TxId string `json:"tx_id"`
}
type RespGetNextOfferId struct {
Id int64 `json:"id"`
}
type Offer struct {
Id int64 `json:"id"`
L2OfferId int64 `json:"l2_offer_id"`
AccountName string `json:"account_name"`
Direction string `json:"direction"`
AssetId int64 `json:"asset_id"`
PaymentAssetId int64 `json:"payment_asset_id"`
PaymentAssetAmount string `json:"payment_asset_amount"`
Status string `json:"status"`
Signature string `json:"signature"`
ExpiredAt int64 `json:"expired_at"`
CreatedAt int64 `json:"created_at"`
}
type ReqGetOfferByOfferId struct {
OfferId int64 `form:"offer_id"`
}
type RespGetOfferByOfferId struct {
Offer Offer `json:"offer"`
}
type RespGetOfferByAccountNameAndAssetId struct {
Offer Offer `json:"offer"`
}
type RespAcceptOffer struct {
Offer Offer `json:"offer"`
}
type RespCancelOffer struct {
Offer Offer `json:"offer"`
}
type RespSearchOffer struct {
Offer []Offer `json:"offers"`
}
type RespListOffer struct {
Offer Offer `json:"offer"`
}
type RespGetCollectionAction struct {
OpCode string `json:"opCode"`
Collection Collection `json:"collection"`
}
type RespGetOfferById struct {
OfferId Offer `json:"offer"`
}
type ReqGetPrepareCreateCollectionTxInfo struct {
AccountName string `form:"account_name"`
}
type ReqGetPrepareTransferNftTxInfo struct {
AccountName string `form:"account_name"`
ToAccountName string `form:"to_account_name"`
NftIndex int64 `form:"nft_index"`
}
type ReqGetPrepareWithdrawNftTxInfo struct {
AccountName string `form:"account_name"`
NftIndex int64 `form:"nft_index"`
}
type RespetPreparetxInfo struct {
TxType int64 `json:"tx_type"`
Transtion string `json:"transtion"`
}
type RespApplyRegisterHost struct {
Ok bool `json:"ok"`
}
type RespGetLayer2BasicInfo struct {
BlockCommitted int64 `json:"block_committed"`
BlockVerified int64 `json:"block_verified"`
TotalTransactions int64 `json:"total_transactions"`
TransactionsCountYesterday int64 `json:"transactions_count_yesterday"`
TransactionsCountToday int64 `json:"transactions_count_today"`
DauYesterday int64 `json:"dau_yesterday"`
DauToday int64 `json:"dau_today"`
ContractAddresses []string `json:"contract_addresses"`
NftOfferTreasuryRate int64 `json:"nft_offer_treasury_rate"`
}
type RespGetAccountByAccountName struct {
Account NftAccountInfo `json:"account"`
}
type RespGetNextNonce struct {
Nonce int64 `json:"nonce"`
}
type NftAccountInfo struct {
Id int64 `json:"id"`
AccountIndex int64 `json:"account_index"`
AccountPk string `json:"account_pk"`
AccountName string `json:"account_name"`
Bio string `json:"bio"`
Email string `json:"email"`
ExternalLink string `json:"external_link"`
TwitterLink string `json:"twitter_link"`
InstagramLink string `json:"instagram_link"`
ProfileImage string `json:"profile_image"`
ProfileThumb string `json:"profile_thumb"`
BannerImage string `json:"banner_image"`
BannerThumb string `json:"banner_thumb"`
CreatedAt int64 `json:"created_at"`
}
type ReqMediaUpload struct {
image io.Writer `form:"image"`
}
type RespGetCollectionCategories struct {
Categories []*Categorie `json:"categories"`
}
// ========================= hasura struct ============================
type MediaDetail struct {
Url string `json:"url"`
}
type HauaraNftInfo struct {
Id int64 `json:"id"`
NftIndex int64 `json:"nft_index"`
CollectionId int64 `json:"collection_id"`
CreatorEarningRate int64 `json:"creator_earning_rate"`
Name string `json:"name"`
Description string `json:"description"`
Media MediaDetail `json:"media_detail"`
ImageThumb string `json:"image_thumb"`
VideoThumb string `json:"video_thumb"`
AudioThumb string `json:"audio_thumb"`
Status int64 `json:"status"`
ContentHash string `json:"content_hash"`
NftUrl string `json:"nft_url"`
ExpiredAt int64 `json:"expired_at"`
CreatedAt int64 `json:"created_at"`
Properties Propertie `json:"properties"`
Levels Level `json:"levels"`
Stats Stat `json:"stats"`
}
type HasuraOffer struct {
Id int64 `json:"id"`
L2OfferId int64 `json:"l2_offer_id"`
Direction int `json:"direction"`
AssetId int64 `json:"asset_id"`
PaymentAssetId int64 `json:"payment_asset_id"`
PaymentAssetAmount float64 `json:"payment_asset_amount"`
Status int `json:"status"`
Signature string `json:"signature"`
ExpiredAt int64 `json:"expired_at"`
CreatedAt string `json:"created_at"`
Asset *HauaraNftInfo `json:"asset"`
}
type HasuraDataOffer struct {
Offers []*HasuraOffer `json:"offer"`
}
type RespGetListingOffers struct {
Data *HasuraDataOffer `json:"data"`
}
type RespGetNftBeingBuy struct {
Data *HasuraDataOffer `json:"data"`
}
// ======================= sdk ======================================
type ReqGetSdkCreateCollectionTxInfo struct {
AccountName string `form:"account_name"`
}
type ReqGetSdkMintNftTxInfo struct {
AccountName string `form:"account_name"`
CollectionId int64 `form:"collection_id"`
TreasuryRate int64 `form:"treasury_rate"`
Name string `form:"name"`
ContentHash string `form:"content_hash"`
}
type ReqGetSdkTransferNftTxInfo struct {
AccountName string `form:"account_name"`
ToAccountName string `form:"to_account_name"`
NftId int64 `form:"nft_id"`
}
type ReqGetSdkAtomicMatchWithTx struct {
AccountName string `form:"account_name"`
IsSell bool `form:"is_sell"`
OfferId int64 `form:"offer_id"`
MoneyId int64 `form:"money_id"`
MoneyAmount string `form:"money_amount"`
}
type ReqGetSdkWithdrawNftTxInfo struct {
AccountName string `form:"account_name"`
NftId int64 `form:"nft_id"`
}
type ReqGetSdkOfferTxInfo struct {
AccountName string `form:"account_name"`
NftId int64 `form:"nft_id"`
MoneyId int64 `form:"money_id"`
MoneyAmount string `form:"money_amount"`
IsSell bool `form:"is_sell"`
}
type ReqGetSdkCancelOfferTxInfo struct {
AccountName string `form:"account_name"`
OfferId int64 `form:"offer_id"`
}
type RespetSdktxInfo struct {
TxType int64 `json:"tx_type"`
Transtion string `json:"transtion"`
}
type ReqGetSdkAccountAssets struct {
AccountIndex int64 `json:"account_index"`
}
type RespGetSdkAccountAssets struct {
SdkAssets []*NftInfo `json:"sdkAssets"`
}
type ReqGetSdkAccountCollections struct {
AccountIndex int64 `json:"account_index"`
}
type RespGetSdkAccountCollections struct {
SdkCollections []*Collection `json:"sdkCollections"`
}
type ReqGetSdkCollection struct {
CollectionId int64 `json:"collection_id"`
}
type ReqGetSdkCollectionAssets struct {
CollectionId int64 `json:"collection_id"`
}
type ResqGetSdkCollectionAssets struct {
SdkAssets []*NftInfo `json:"sdkAssets"`
}
type ReqGetSdkAccountOffers struct {
AccountIndex int64 `json:"account_index"`
}
type RespGetSdkAccountOffers struct {
SdkOffers []*Offer `json:"sdkOffers"`
}
type ReqGetSdkAssetOffers struct {
AssetId int64 `json:"asset_id"`
}
type RespGetSdkAssetOffers struct {
SdkOffers []*Offer `json:"sdkOffers"`
}
type ReqGetSdkCollectionById struct {
CollectionId int64 `json:"collection_id"`
}
type RespGetSdkCollectionById struct {
Collection Collection `json:"collection"`
}
type ReqGetSdkAssetById struct {
AssetId int64 `json:"asset_id"`
}
type RespGetSdkAssetById struct {
Asset *NftInfo `json:"asset"`
}
type ReqGetSdkOffer struct {
OfferId int64 `json:"offer_id"`
}
type RespGetSdkOfferById struct {
OfferId Offer `json:"offer"`
}