-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
612 lines (529 loc) · 20.2 KB
/
types.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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
package egiftcard
import (
"math/big"
"net/http"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/egiftcard/go-sdk/v2/abi"
)
type SDKOptions struct {
SecretKey string
PrivateKey string
GatewayUrl string
HttpClient *http.Client
}
type Metadata struct {
MetadataUri string
MetadataObject interface{}
}
type NFTMetadata struct {
Id *big.Int `json:"id"`
Uri string `json:"uri"`
Name string `json:"name"`
Description string `json:"description"`
Image interface{} `json:"image"`
ExternalUrl string `json:"external_url"`
AnimationUrl string `json:"animation_url"`
BackgroundColor string `json:"background_color"`
Properties interface{} `json:"properties,omitempty"`
Attributes interface{} `json:"attributes,omitempty"`
}
type NFTMetadataInput struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description,omitempty" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalUrl string `mapstructure:"external_url,omitempty" json:"external_url"`
AnimationUrl string `mapstructure:"animation_url,omitempty" json:"animation_url"`
BackgroundColor string `mapstructure:"background_color,omitempty" json:"background_color"`
Properties interface{} `mapstructure:"properties,omitempty" json:"properties,omitempty"`
Attributes interface{} `mapstructure:"attributes,omitempty" json:"attributes,omitempty"`
}
type NFTMetadataOwner struct {
Metadata *NFTMetadata
Owner string
}
type EditionMetadata struct {
Metadata *NFTMetadata
Supply int
}
type EditionMetadataOwner struct {
Metadata *NFTMetadata
Supply int
Owner string
QuantityOwned int
}
type EditionMetadataInput struct {
Metadata *NFTMetadataInput
Supply int
}
type PreparedClaimTo struct {
Receiver common.Address
Quantity *big.Int
Currency common.Address
PricePerToken *big.Int
AllowlistProof abi.IDropAllowlistProof
Data []byte
Value *big.Int
}
type ClaimVerification struct {
Value *big.Int
Proofs [][32]byte
MaxClaimable *big.Int
Price *big.Int
CurrencyAddress string
PriceInProof *big.Int
CurrencyAddressInProof string
}
type ClaimConditionOutput struct {
StartTime time.Time
MaxClaimableSupply *big.Int
MaxClaimablePerWallet *big.Int
CurrentMintSupply *big.Int
AvailableSupply *big.Int
WaitInSeconds *big.Int
Price *big.Int
CurrencyAddress string
CurrencyMetadata *CurrencyValue
MerkleRootHash [32]byte
}
type Currency struct {
Name string
Symbol string
Decimals int
}
type CurrencyValue struct {
Name string
Symbol string
Decimals int
Value *big.Int
DisplayValue float64
}
type TokenAmount struct {
ToAddress string
Amount float64
}
type WrappedToken struct {
address string
name string
symbol string
}
type NativeToken struct {
name string
symbol string
decimals int
wrapper *WrappedToken
}
type Signature721PayloadInput struct {
To string
Price float64
CurrencyAddress string
MintStartTime int
MintEndTime int
PrimarySaleRecipient string
Metadata *NFTMetadataInput
RoyaltyRecipient string
RoyaltyBps int
}
type Signature721PayloadInputWithUri struct {
To string
Price float64
CurrencyAddress string
MintStartTime int
MintEndTime int
PrimarySaleRecipient string
MetadataUri string
RoyaltyRecipient string
RoyaltyBps int
}
type Signature721PayloadOutput struct {
To string `json:"to"`
Price string `json:"price"`
CurrencyAddress string `json:"currencyAddress"`
MintStartTime int `json:"mintStartTime"`
MintEndTime int `json:"mintEndTime"`
PrimarySaleRecipient string `json:"primarySaleRecipient"`
RoyaltyRecipient string `json:"royaltyRecipient"`
RoyaltyBps int `json:"royaltyBps"`
Uri string `json:"uri"`
Uid [32]byte `json:"uid"`
}
type SignedPayload721 struct {
Payload *Signature721PayloadOutput `json:"payload"`
Signature string `json:"signature"`
}
type Signature1155PayloadInput struct {
To string
Price float64
CurrencyAddress string
MintStartTime int
MintEndTime int
PrimarySaleRecipient string
Metadata *NFTMetadataInput
RoyaltyRecipient string
RoyaltyBps int
Quantity int
}
type Signature1155PayloadInputWithTokenId struct {
To string
Price float64
CurrencyAddress string
MintStartTime int
MintEndTime int
PrimarySaleRecipient string
Metadata *NFTMetadataInput
TokenId int
RoyaltyRecipient string
RoyaltyBps int
Quantity int
}
type Signature1155PayloadOutput struct {
To string `json:"to"`
Price string `json:"price"`
CurrencyAddress string `json:"currencyAddress"`
MintStartTime int `json:"mintStartTime"`
MintEndTime int `json:"mintEndTime"`
PrimarySaleRecipient string `json:"primarySaleRecipient"`
Metadata *NFTMetadataInput `json:"metadata"`
RoyaltyRecipient string `json:"royaltyRecipient"`
RoyaltyBps int `json:"royaltyBps"`
TokenId int `json:"tokenId"`
Quantity int `json:"quantity"`
Uri string `json:"uri"`
Uid [32]byte `json:"uid"`
}
type SignedPayload1155 struct {
Payload *Signature1155PayloadOutput `json:"payload"`
Signature string `json:"signature"`
}
type MultiwrapERC20 struct {
ContractAddress string
Quantity float64
}
type MultiwrapERC721 struct {
ContractAddress string
TokenId int
}
type MultiwrapERC1155 struct {
ContractAddress string
TokenId int
Quantity int
}
type MultiwrapBundle struct {
ERC20Tokens []*MultiwrapERC20
ERC721Tokens []*MultiwrapERC721
ERC1155Tokens []*MultiwrapERC1155
}
// Wallet Authenticator
type WalletLoginOptions struct {
Nonce string
ExpirationTime time.Time
ChainId int
}
type WalletLoginPayloadData struct {
Domain string `json:"domain"`
Address string `json:"address"`
Nonce string `json:"nonce"`
ExpirationTime time.Time `json:"expiration_time"`
ChainId int `json:"chain_id"`
}
type WalletLoginPayload struct {
Payload *WalletLoginPayloadData `json:"payload"`
Signature string `json:"signature"`
}
type WalletVerifyOptions struct {
ChainId int
}
type WalletAuthenticationOptions struct {
InvalidBefore time.Time
ExpirationTime time.Time
}
type WalletAuthenticationPayloadData struct {
Iss string `json:"iss"`
Sub string `json:"sub"`
Aud string `json:"aud"`
Exp int64 `json:"exp"`
Nbf int64 `json:"nbf"`
Iat int64 `json:"iat"`
Jti string `json:"jti"`
}
// Contract Metadata
type DeployNFTCollectionMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"`
FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"`
Symbol string `mapstructure:"symbol" json:"symbol"`
PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployNFTCollectionMetadata) fillDefaults() {
if metadata.FeeRecipient == "" {
metadata.FeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PrimarySaleRecipient == "" {
metadata.PrimarySaleRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployEditionMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"`
FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"`
Symbol string `mapstructure:"symbol" json:"symbol"`
PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployEditionMetadata) fillDefaults() {
if metadata.FeeRecipient == "" {
metadata.FeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PrimarySaleRecipient == "" {
metadata.PrimarySaleRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployTokenMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
Symbol string `mapstructure:"symbol" json:"symbol"`
PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployTokenMetadata) fillDefaults() {
if metadata.PrimarySaleRecipient == "" {
metadata.PrimarySaleRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployNFTDropMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"`
FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"`
Merkle interface{} `mapstructure:"merkle" json:"merkle"`
Symbol string `mapstructure:"symbol" json:"symbol"`
PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployNFTDropMetadata) fillDefaults() {
if metadata.FeeRecipient == "" {
metadata.FeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PrimarySaleRecipient == "" {
metadata.PrimarySaleRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployEditionDropMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"`
FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"`
Merkle interface{} `mapstructure:"merkle" json:"merkle"`
Symbol string `mapstructure:"symbol" json:"symbol"`
PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployEditionDropMetadata) fillDefaults() {
if metadata.FeeRecipient == "" {
metadata.FeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PrimarySaleRecipient == "" {
metadata.PrimarySaleRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployMultiwrapMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"`
FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"`
Symbol string `mapstructure:"symbol" json:"symbol"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployMultiwrapMetadata) fillDefaults() {
if metadata.FeeRecipient == "" {
metadata.FeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DeployMarketplaceMetadata struct {
Name string `mapstructure:"name" json:"name"`
Description string `mapstructure:"description" json:"description"`
Image interface{} `mapstructure:"image,omitempty" json:"image"`
ExternalLink string `mapstructure:"external_link,omitempty" json:"external_link"`
PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"`
PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"`
TrustedForwarders []string `mapstructure:"trusted_forwarders" json:"trusted_forwarders"`
}
func (metadata *DeployMarketplaceMetadata) fillDefaults() {
if metadata.PlatformFeeRecipient == "" {
metadata.PlatformFeeRecipient = "0x0000000000000000000000000000000000000000"
}
if metadata.TrustedForwarders == nil {
metadata.TrustedForwarders = []string{}
}
}
type DirectListing struct {
Id string
AssetContractAddress string
TokenId int
Asset *NFTMetadata
StartTimeInEpochSeconds int
EndTimeInEpochSeconds int
Quantity int
CurrencyContractAddress string
BuyoutCurrencyValuePerToken *CurrencyValue
BuyoutPrice string
SellerAddress string
}
type NewDirectListing struct {
AssetContractAddress string
TokenId int
StartTimeInEpochSeconds int
ListingDurationInSeconds int
Quantity int
CurrencyContractAddress string
BuyoutPricePerToken float64
}
func (listing *NewDirectListing) fillDefaults() {
if listing.CurrencyContractAddress == "" {
listing.CurrencyContractAddress = "0x0000000000000000000000000000000000000000"
}
if listing.StartTimeInEpochSeconds == 0 {
listing.StartTimeInEpochSeconds = int(time.Now().Unix())
}
if listing.ListingDurationInSeconds == 0 {
listing.ListingDurationInSeconds = int(time.Now().Unix() + 3600)
}
}
type AuctionListing struct {
Id string
AssetContractAddress string
TokenId int
Asset *NFTMetadata
StartTimeInEpochSeconds int
EndTimeInEpochSeconds int
Quantity int
CurrencyContractAddress string
ReservePrice string
BuyoutPrice string
BuyoutCurrencyValuePerToken *CurrencyValue
ReservePriceCurrencyValuePerToken *CurrencyValue
SellerAddress string
}
type MarketplaceFilter struct {
Start int
Count int
Seller string
TokenContract string
}
// CLAIM CONDITIONS
type ClaimArguments struct {
TxValue *big.Int
Receiver common.Address
Quantity *big.Int
Currency common.Address
PricePerToken *big.Int
AllowlistProof abi.IDropAllowlistProof
Data []byte
}
type ClaimInfo struct {
PricePerToken *big.Int
CurrencyAddress common.Address
RemainingClaimable *big.Int
}
type ClaimConditionInput struct {
StartTime *time.Time
CurrencyAddress string
Price float64
MaxQuantity int
QuantityLimitPerTransaction int
WaitInSeconds int
MerkleRootHash string
Snapshot []*SnapshotInput
}
func (condition *ClaimConditionInput) fillDefaults() {
if condition.CurrencyAddress == "" {
condition.CurrencyAddress = "0x0000000000000000000000000000000000000000"
}
}
type SnapshotEntryWithProof struct {
Address string
MaxClaimable string
Price string
CurrencyAddress string
Proof [][32]byte
}
func (entry *SnapshotEntryWithProof) fillDefaults() {
if entry.CurrencyAddress == "" {
entry.CurrencyAddress = zeroAddress
}
}
type ShardedMerkleTreeInfo struct {
MerkleRoot string `json:"merkleRoot"`
BaseUri string `json:"baseUri"`
OriginalEntriesUri string `json:"originalEntriesUri"`
ShardNybbles int `json:"shardNybbles"`
TokenDecimals int `json:"tokenDecimals"`
}
type SnapshotEntry struct {
Address string `json:"address"`
MaxClaimable string `json:"maxClaimable"`
Price string `json:"price"`
CurrencyAddress string `json:"currencyAddress"`
}
type ShardData struct {
Proofs []string `json:"proofs"`
Entries []SnapshotEntry `json:"entries"`
}