4
4
namespace Thirdweb
5
5
{
6
6
/// <summary>
7
- /// Interact with any <c> ERC20</c> compatible contract.
7
+ /// Interact with any ERC20 compatible contract.
8
8
/// </summary>
9
9
public class ERC20
10
10
{
@@ -14,12 +14,20 @@ public class ERC20
14
14
/// Handle signature minting functionality
15
15
/// </summary>
16
16
public ERC20Signature signature ;
17
+ /// <summary>
18
+ /// Fetch claim conditions for a given ERC20 drop contract
19
+ /// </summary>
20
+ public ERC20ClaimConditions claimConditions ;
17
21
22
+ /// <summary>
23
+ /// Interact with any ERC20 compatible contract.
24
+ /// </summary>
18
25
public ERC20 ( string chain , string address )
19
26
{
20
27
this . chain = chain ;
21
28
this . address = address ;
22
29
this . signature = new ERC20Signature ( chain , address ) ;
30
+ this . claimConditions = new ERC20ClaimConditions ( chain , address ) ;
23
31
}
24
32
25
33
// READ FUNCTIONS
@@ -184,11 +192,70 @@ public struct ERC20SignedPayload
184
192
public ERC20SignedPayloadOutput payload ;
185
193
}
186
194
195
+ /// <summary>
196
+ /// Fetch claim conditions for a given ERC20 drop contract
197
+ /// </summary>
198
+ public class ERC20ClaimConditions
199
+ {
200
+ public string chain ;
201
+ public string address ;
202
+
203
+ public ERC20ClaimConditions ( string chain , string address )
204
+ {
205
+ this . chain = chain ;
206
+ this . address = address ;
207
+ }
208
+
209
+
210
+ /// <summary>
211
+ /// Get the active claim condition
212
+ /// </summary>
213
+ public async Task < ClaimConditions > GetActive ( )
214
+ {
215
+ return await Bridge . InvokeRoute < ClaimConditions > ( getRoute ( "getActive" ) , new string [ ] { } ) ;
216
+ }
217
+
218
+ /// <summary>
219
+ /// Check whether the connected wallet is eligible to claim
220
+ /// </summary>
221
+ public async Task < bool > CanClaim ( string quantity , string ? addressToCheck = null )
222
+ {
223
+ return await Bridge . InvokeRoute < bool > ( getRoute ( "canClaim" ) , Utils . ToJsonStringArray ( quantity , addressToCheck ) ) ;
224
+ }
225
+
226
+ /// <summary>
227
+ /// Get the reasons why the connected wallet is not eligible to claim
228
+ /// </summary>
229
+ public async Task < string [ ] > GetIneligibilityReasons ( string quantity , string ? addressToCheck = null )
230
+ {
231
+ return await Bridge . InvokeRoute < string [ ] > ( getRoute ( "getClaimIneligibilityReasons" ) , Utils . ToJsonStringArray ( quantity , addressToCheck ) ) ;
232
+ }
233
+
234
+ /// <summary>
235
+ /// Get the special values set in the allowlist for the given wallet
236
+ /// </summary>
237
+ public async Task < bool > GetClaimerProofs ( string claimerAddress )
238
+ {
239
+ return await Bridge . InvokeRoute < bool > ( getRoute ( "getClaimerProofs" ) , Utils . ToJsonStringArray ( claimerAddress ) ) ;
240
+ }
241
+
242
+ private string getRoute ( string functionPath ) {
243
+ return this . address + ".erc20.claimConditions." + functionPath ;
244
+ }
245
+ }
246
+
247
+
248
+ /// <summary>
249
+ /// Generate, verify and mint signed mintable payloads
250
+ /// </summary>
187
251
public class ERC20Signature
188
252
{
189
253
public string chain ;
190
254
public string address ;
191
255
256
+ /// <summary>
257
+ /// Generate, verify and mint signed mintable payloads
258
+ /// </summary>
192
259
public ERC20Signature ( string chain , string address )
193
260
{
194
261
this . chain = chain ;
0 commit comments