-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathThirdwebExtensions.Types.cs
More file actions
637 lines (543 loc) · 17 KB
/
ThirdwebExtensions.Types.cs
File metadata and controls
637 lines (543 loc) · 17 KB
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
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
using System.Numerics;
using Nethereum.ABI.FunctionEncoding.Attributes;
using Newtonsoft.Json;
namespace Thirdweb;
#region Common
/// <summary>
/// Represents the result of a verification operation.
/// </summary>
[FunctionOutput]
public class VerifyResult
{
/// <summary>
/// Gets or sets a value indicating whether the verification is valid.
/// </summary>
[Parameter("bool", "", 1)]
[JsonProperty("isValid")]
public bool IsValid { get; set; }
/// <summary>
/// Gets or sets the address of the signer.
/// </summary>
[Parameter("address", "", 2)]
[JsonProperty("signer")]
public string Signer { get; set; }
}
/// <summary>
/// Represents the royalty information result.
/// </summary>
[FunctionOutput]
public class RoyaltyInfoResult
{
/// <summary>
/// Gets or sets the recipient address.
/// </summary>
[Parameter("address", "", 1)]
[JsonProperty("recipient")]
public string Recipient { get; set; }
/// <summary>
/// Gets or sets the basis points (bps) for royalty.
/// </summary>
[Parameter("uint256", "", 2)]
[JsonProperty("bps")]
public BigInteger Bps { get; set; }
}
/// <summary>
/// Represents the metadata of a contract.
/// </summary>
public class ContractMetadata
{
/// <summary>
/// Gets or sets the name of the contract.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the symbol of the contract.
/// </summary>
[JsonProperty("symbol")]
public string Symbol { get; set; }
/// <summary>
/// Gets or sets the description of the contract.
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// Gets or sets the image URL of the contract.
/// </summary>
[JsonProperty("image")]
public string Image { get; set; }
/// <summary>
/// Gets or sets the merkle tree mappings for claim conditions.
/// Key: Merkle root hash, Value: IPFS URI to tree info
/// </summary>
[JsonProperty("merkle")]
public Dictionary<string, string> Merkle { get; set; }
}
#endregion
#region Merkle
/// <summary>
/// Represents information about a sharded Merkle tree stored on IPFS.
/// </summary>
public class MerkleTreeInfo
{
/// <summary>
/// Gets or sets the Merkle root hash.
/// </summary>
[JsonProperty("merkleRoot")]
public string MerkleRoot { get; set; }
/// <summary>
/// Gets or sets the base IPFS URI for shard files.
/// </summary>
[JsonProperty("baseUri")]
public string BaseUri { get; set; }
/// <summary>
/// Gets or sets the original entries IPFS URI.
/// </summary>
[JsonProperty("originalEntriesUri")]
public string OriginalEntriesUri { get; set; }
/// <summary>
/// Gets or sets the number of hex characters used for shard keys.
/// </summary>
[JsonProperty("shardNybbles")]
public int ShardNybbles { get; set; } = 2;
/// <summary>
/// Gets or sets the token decimals for price calculations.
/// </summary>
[JsonProperty("tokenDecimals")]
public int TokenDecimals { get; set; } = 0;
}
/// <summary>
/// Represents a shard file containing whitelist entries and proofs.
/// </summary>
public class ShardData
{
/// <summary>
/// Gets or sets the shard proofs (path from shard root to main root).
/// </summary>
[JsonProperty("proofs")]
public List<string> Proofs { get; set; }
/// <summary>
/// Gets or sets the whitelist entries in this shard.
/// </summary>
[JsonProperty("entries")]
public List<WhitelistEntry> Entries { get; set; }
}
/// <summary>
/// Represents a whitelist entry for a claim condition.
/// </summary>
public class WhitelistEntry
{
/// <summary>
/// Gets or sets the wallet address.
/// </summary>
[JsonProperty("address")]
public string Address { get; set; }
/// <summary>
/// Gets or sets the maximum claimable amount ("unlimited" or a number).
/// </summary>
[JsonProperty("maxClaimable")]
public string MaxClaimable { get; set; }
/// <summary>
/// Gets or sets the price override ("unlimited" or a number in wei).
/// </summary>
[JsonProperty("price")]
public string Price { get; set; }
/// <summary>
/// Gets or sets the currency address for price override.
/// </summary>
[JsonProperty("currencyAddress")]
public string CurrencyAddress { get; set; }
}
/// <summary>
/// Represents an allowlist proof for claiming tokens.
/// </summary>
[FunctionOutput]
public class AllowlistProof
{
/// <summary>
/// Gets or sets the Merkle proof (array of bytes32 hashes).
/// </summary>
[Parameter("bytes32[]", "proof", 1)]
public List<byte[]> Proof { get; set; }
/// <summary>
/// Gets or sets the maximum quantity this address can claim.
/// </summary>
[Parameter("uint256", "quantityLimitPerWallet", 2)]
public BigInteger QuantityLimitPerWallet { get; set; }
/// <summary>
/// Gets or sets the price per token override.
/// </summary>
[Parameter("uint256", "pricePerToken", 3)]
public BigInteger PricePerToken { get; set; }
/// <summary>
/// Gets or sets the currency address for the price override.
/// </summary>
[Parameter("address", "currency", 4)]
public string Currency { get; set; }
}
#endregion
#region NFT
/// <summary>
/// Represents the type of an NFT.
/// </summary>
[Serializable]
public enum NFTType
{
ERC721,
ERC1155,
}
/// <summary>
/// Represents an NFT with metadata, owner, type, and supply information.
/// </summary>
[Serializable]
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public struct NFT
{
/// <summary>
/// Gets or sets the metadata of the NFT.
/// </summary>
public NFTMetadata Metadata { get; set; }
/// <summary>
/// Gets or sets the owner address of the NFT. This is only applicable for ERC721 tokens.
/// </summary>
public string Owner { get; set; }
/// <summary>
/// Gets or sets the type of the NFT.
/// </summary>
public NFTType Type { get; set; }
/// <summary>
/// Gets or sets the supply of the NFT.
/// </summary>
public BigInteger? Supply { get; set; }
/// <summary>
/// Gets or sets the quantity owned by the user. This is only applicable for ERC1155 tokens.
/// </summary>
public BigInteger? QuantityOwned { get; set; }
}
/// <summary>
/// Represents the metadata of an NFT.
/// </summary>
[Serializable]
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public struct NFTMetadata
{
/// <summary>
/// Gets or sets the ID of the NFT.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }
/// <summary>
/// Gets or sets the URI of the NFT.
/// </summary>
[JsonProperty("uri")]
public string Uri { get; set; }
/// <summary>
/// Gets or sets the description of the NFT.
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// Gets or sets the image URL of the NFT.
/// </summary>
[JsonProperty("image")]
public string Image { get; set; }
/// <summary>
/// Gets or sets the name of the NFT.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the video URL of the NFT.
/// </summary>
[JsonProperty("video_url")]
public string VideoUrl { get; set; }
/// <summary>
/// Gets or sets the animation URL of the NFT.
/// </summary>
[JsonProperty("animation_url")]
public string AnimationUrl { get; set; }
/// <summary>
/// Gets or sets the external URL of the NFT.
/// </summary>
[JsonProperty("external_url")]
public string ExternalUrl { get; set; }
/// <summary>
/// Gets or sets the background color of the NFT.
/// </summary>
[JsonProperty("background_color")]
public string BackgroundColor { get; set; }
/// <summary>
/// Gets or sets the attributes of the NFT.
/// </summary>
[JsonProperty("attributes")]
public object Attributes { get; set; }
/// <summary>
/// Gets or sets the properties of the NFT.
/// </summary>
[JsonProperty("properties")]
public object Properties { get; set; }
}
#endregion
#region Drop
/// <summary>
/// Represents a claim condition for a drop.
/// </summary>
public class Drop_ClaimCondition
{
/// <summary>
/// Gets or sets the start timestamp of the claim condition.
/// </summary>
[Parameter("uint256", "startTimestamp", 1)]
[JsonProperty("startTimestamp")]
public BigInteger StartTimestamp { get; set; }
/// <summary>
/// Gets or sets the maximum claimable supply.
/// </summary>
[Parameter("uint256", "maxClaimableSupply", 2)]
[JsonProperty("maxClaimableSupply")]
public BigInteger MaxClaimableSupply { get; set; }
/// <summary>
/// Gets or sets the supply claimed so far.
/// </summary>
[Parameter("uint256", "supplyClaimed", 3)]
[JsonProperty("supplyClaimed")]
public BigInteger SupplyClaimed { get; set; }
/// <summary>
/// Gets or sets the quantity limit per wallet.
/// </summary>
[Parameter("uint256", "quantityLimitPerWallet", 4)]
[JsonProperty("quantityLimitPerWallet")]
public BigInteger QuantityLimitPerWallet { get; set; }
/// <summary>
/// Gets or sets the Merkle root for the claim condition.
/// </summary>
[Parameter("bytes32", "merkleRoot", 5)]
[JsonProperty("merkleRoot")]
public byte[] MerkleRoot { get; set; }
/// <summary>
/// Gets or sets the price per token for the claim condition.
/// </summary>
[Parameter("uint256", "pricePerToken", 6)]
[JsonProperty("pricePerToken")]
public BigInteger PricePerToken { get; set; }
/// <summary>
/// Gets or sets the currency address for the claim condition.
/// </summary>
[Parameter("address", "currency", 7)]
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Gets or sets the metadata for the claim condition.
/// </summary>
[Parameter("string", "metadata", 8)]
[JsonProperty("metadata")]
public string Metadata { get; set; }
}
#endregion
#region TokenERC20
/// <summary>
/// Represents a mint request for an ERC20 token.
/// </summary>
[Struct("MintRequest")]
public class TokenERC20_MintRequest
{
/// <summary>
/// Gets or sets the address to mint the tokens to.
/// </summary>
[Parameter("address", "to", 1)]
[JsonProperty("to")]
public string To { get; set; }
/// <summary>
/// Gets or sets the primary sale recipient address.
/// </summary>
[Parameter("address", "primarySaleRecipient", 2)]
[JsonProperty("primarySaleRecipient")]
public string PrimarySaleRecipient { get; set; }
/// <summary>
/// Gets or sets the quantity of tokens to mint.
/// </summary>
[Parameter("uint256", "quantity", 3)]
[JsonProperty("quantity")]
public BigInteger Quantity { get; set; }
/// <summary>
/// Gets or sets the price of the tokens.
/// </summary>
[Parameter("uint256", "price", 4)]
[JsonProperty("price")]
public BigInteger Price { get; set; }
/// <summary>
/// Gets or sets the currency address.
/// </summary>
[Parameter("address", "currency", 5)]
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Gets or sets the validity start timestamp.
/// </summary>
[Parameter("uint128", "validityStartTimestamp", 6)]
[JsonProperty("validityStartTimestamp")]
public BigInteger ValidityStartTimestamp { get; set; }
/// <summary>
/// Gets or sets the validity end timestamp.
/// </summary>
[Parameter("uint128", "validityEndTimestamp", 7)]
[JsonProperty("validityEndTimestamp")]
public BigInteger ValidityEndTimestamp { get; set; }
/// <summary>
/// Gets or sets the unique identifier for the mint request.
/// </summary>
[Parameter("bytes32", "uid", 8)]
[JsonProperty("uid")]
public byte[] Uid { get; set; }
}
#endregion
#region TokenERC721
/// <summary>
/// Represents a mint request for an ERC721 token.
/// </summary>
[Struct("MintRequest")]
public class TokenERC721_MintRequest
{
/// <summary>
/// Gets or sets the address to mint the token to.
/// </summary>
[Parameter("address", "to", 1)]
[JsonProperty("to")]
public string To { get; set; }
/// <summary>
/// Gets or sets the royalty recipient address.
/// </summary>
[Parameter("address", "royaltyRecipient", 2)]
[JsonProperty("royaltyRecipient")]
public string RoyaltyRecipient { get; set; }
/// <summary>
/// Gets or sets the royalty basis points.
/// </summary>
[Parameter("uint256", "royaltyBps", 3)]
[JsonProperty("royaltyBps")]
public BigInteger RoyaltyBps { get; set; }
/// <summary>
/// Gets or sets the primary sale recipient address.
/// </summary>
[Parameter("address", "primarySaleRecipient", 4)]
[JsonProperty("primarySaleRecipient")]
public string PrimarySaleRecipient { get; set; }
/// <summary>
/// Gets or sets the URI of the token.
/// </summary>
[Parameter("string", "uri", 5)]
[JsonProperty("uri")]
public string Uri { get; set; }
/// <summary>
/// Gets or sets the price of the token.
/// </summary>
[Parameter("uint256", "price", 6)]
[JsonProperty("price")]
public BigInteger Price { get; set; }
/// <summary>
/// Gets or sets the currency address.
/// </summary>
[Parameter("address", "currency", 7)]
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Gets or sets the validity start timestamp.
/// </summary>
[Parameter("uint128", "validityStartTimestamp", 8)]
[JsonProperty("validityStartTimestamp")]
public BigInteger ValidityStartTimestamp { get; set; }
/// <summary>
/// Gets or sets the validity end timestamp.
/// </summary>
[Parameter("uint128", "validityEndTimestamp", 9)]
[JsonProperty("validityEndTimestamp")]
public BigInteger ValidityEndTimestamp { get; set; }
/// <summary>
/// Gets or sets the unique identifier for the mint request.
/// </summary>
[Parameter("bytes32", "uid", 10)]
[JsonProperty("uid")]
public byte[] Uid { get; set; }
}
#endregion
#region TokenERC1155
/// <summary>
/// Represents a mint request for an ERC1155 token.
/// </summary>
[Struct("MintRequest")]
public class TokenERC1155_MintRequest
{
/// <summary>
/// Gets or sets the address to mint the token to.
/// </summary>
[Parameter("address", "to", 1)]
[JsonProperty("to")]
public string To { get; set; }
/// <summary>
/// Gets or sets the royalty recipient address.
/// </summary>
[Parameter("address", "royaltyRecipient", 2)]
[JsonProperty("royaltyRecipient")]
public string RoyaltyRecipient { get; set; }
/// <summary>
/// Gets or sets the royalty basis points.
/// </summary>
[Parameter("uint256", "royaltyBps", 3)]
[JsonProperty("royaltyBps")]
public BigInteger RoyaltyBps { get; set; }
/// <summary>
/// Gets or sets the primary sale recipient address.
/// </summary>
[Parameter("address", "primarySaleRecipient", 4)]
[JsonProperty("primarySaleRecipient")]
public string PrimarySaleRecipient { get; set; }
/// <summary>
/// Gets or sets the token ID.
/// </summary>
[Parameter("uint256", "tokenId", 5)]
[JsonProperty("tokenId")]
public BigInteger? TokenId { get; set; }
/// <summary>
/// Gets or sets the URI of the token.
/// </summary>
[Parameter("string", "uri", 6)]
[JsonProperty("uri")]
public string Uri { get; set; }
/// <summary>
/// Gets or sets the quantity of tokens to mint.
/// </summary>
[Parameter("uint256", "quantity", 7)]
[JsonProperty("quantity")]
public BigInteger Quantity { get; set; }
/// <summary>
/// Gets or sets the price per token.
/// </summary>
[Parameter("uint256", "pricePerToken", 8)]
[JsonProperty("pricePerToken")]
public BigInteger PricePerToken { get; set; }
/// <summary>
/// Gets or sets the currency address.
/// </summary>
[Parameter("address", "currency", 9)]
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Gets or sets the validity start timestamp.
/// </summary>
[Parameter("uint128", "validityStartTimestamp", 10)]
[JsonProperty("validityStartTimestamp")]
public BigInteger ValidityStartTimestamp { get; set; }
/// <summary>
/// Gets or sets the validity end timestamp.
/// </summary>
[Parameter("uint128", "validityEndTimestamp", 11)]
[JsonProperty("validityEndTimestamp")]
public BigInteger ValidityEndTimestamp { get; set; }
/// <summary>
/// Gets or sets the unique identifier for the mint request.
/// </summary>
[Parameter("bytes32", "uid", 12)]
[JsonProperty("uid")]
public byte[] Uid { get; set; }
}
#endregion