44namespace Thirdweb
55{
66 /// <summary>
7- /// Interact with any <c> ERC20</c> compatible contract.
7+ /// Interact with any ERC20 compatible contract.
88 /// </summary>
99 public class ERC20
1010 {
@@ -14,12 +14,20 @@ public class ERC20
1414 /// Handle signature minting functionality
1515 /// </summary>
1616 public ERC20Signature signature ;
17+ /// <summary>
18+ /// Fetch claim conditions for a given ERC20 drop contract
19+ /// </summary>
20+ public ERC20ClaimConditions claimConditions ;
1721
22+ /// <summary>
23+ /// Interact with any ERC20 compatible contract.
24+ /// </summary>
1825 public ERC20 ( string chain , string address )
1926 {
2027 this . chain = chain ;
2128 this . address = address ;
2229 this . signature = new ERC20Signature ( chain , address ) ;
30+ this . claimConditions = new ERC20ClaimConditions ( chain , address ) ;
2331 }
2432
2533 // READ FUNCTIONS
@@ -184,11 +192,70 @@ public struct ERC20SignedPayload
184192 public ERC20SignedPayloadOutput payload ;
185193 }
186194
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>
187251 public class ERC20Signature
188252 {
189253 public string chain ;
190254 public string address ;
191255
256+ /// <summary>
257+ /// Generate, verify and mint signed mintable payloads
258+ /// </summary>
192259 public ERC20Signature ( string chain , string address )
193260 {
194261 this . chain = chain ;
0 commit comments