@@ -39,6 +39,9 @@ public struct TransactionResult
3939 public string id ;
4040 }
4141
42+ /// <summary>
43+ /// Interact with any <c>ERC721</c> compatible contract.
44+ /// </summary>
4245 public class ERC721
4346 {
4447 public string chain ;
@@ -48,20 +51,87 @@ public ERC721(string chain, string address)
4851 this . chain = chain ;
4952 this . address = address ;
5053 }
51- public async Task < NFT > GetNFT ( string tokenId )
54+
55+ /// READ FUNCTIONS
56+
57+
58+ public async Task < NFT > Get ( string tokenId )
5259 {
5360 return await Bridge . InvokeRoute < NFT > ( getRoute ( "get" ) , new string [ ] { tokenId } ) ;
5461 }
62+
63+ public async Task < NFT [ ] > GetAll ( )
64+ {
65+ return await Bridge . InvokeRoute < NFT [ ] > ( getRoute ( "getAll" ) , new string [ ] { } ) ;
66+ }
67+
68+ public async Task < NFT [ ] > GetOwned ( )
69+ {
70+ return await Bridge . InvokeRoute < NFT [ ] > ( getRoute ( "getOwned" ) , new string [ ] { } ) ;
71+ }
72+
73+ public async Task < NFT [ ] > GetOwned ( string address )
74+ {
75+ return await Bridge . InvokeRoute < NFT [ ] > ( getRoute ( "getOwned" ) , new string [ ] { address } ) ;
76+ }
77+
78+ public async Task < string > OwnerOf ( string tokenId )
79+ {
80+ return await Bridge . InvokeRoute < string > ( getRoute ( "ownerOf" ) , new string [ ] { tokenId } ) ;
81+ }
82+
83+ public async Task < string > Balance ( )
84+ {
85+ return await Bridge . InvokeRoute < string > ( getRoute ( "balance" ) , new string [ ] { } ) ;
86+ }
87+
88+ public async Task < string > BalancOf ( string address )
89+ {
90+ return await Bridge . InvokeRoute < string > ( getRoute ( "balanceOf" ) , new string [ ] { address } ) ;
91+ }
92+
93+ public async Task < string > IsApprovedForAll ( string address , string approvedContract )
94+ {
95+ return await Bridge . InvokeRoute < string > ( getRoute ( "isApproved" ) , new string [ ] { address , approvedContract } ) ;
96+ }
97+
98+ public async Task < int > TotalClaimedSupply ( )
99+ {
100+ return await Bridge . InvokeRoute < int > ( getRoute ( "totalClaimedSupply" ) , new string [ ] { } ) ;
101+ }
102+
103+ public async Task < int > TotalUnclaimedSupply ( )
104+ {
105+ return await Bridge . InvokeRoute < int > ( getRoute ( "totalUnclaimedSupply" ) , new string [ ] { } ) ;
106+ }
107+
108+ /// WRITE FUNCTIONS
109+
110+ public async Task < TransactionResult > SetApprovalForAll ( string contractToApprove , bool approved )
111+ {
112+ return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "isApproved" ) , new string [ ] { contractToApprove , approved . ToString ( ) } ) ;
113+ }
114+
55115 public async Task < TransactionResult > Transfer ( string to , string tokenId )
56116 {
57117 return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "transfer" ) , new string [ ] { to , tokenId } ) ;
58118 }
59119
120+ public async Task < TransactionResult > Burn ( string tokenId )
121+ {
122+ return await Bridge . InvokeRoute < TransactionResult > ( getRoute ( "burn" ) , new string [ ] { tokenId } ) ;
123+ }
124+
60125 public async Task < TransactionResult [ ] > Claim ( int quantity )
61126 {
62127 return await Bridge . InvokeRoute < TransactionResult [ ] > ( getRoute ( "claim" ) , new string [ ] { quantity . ToString ( ) } ) ;
63128 }
64129
130+ public async Task < TransactionResult [ ] > ClaimTo ( string address , int quantity )
131+ {
132+ return await Bridge . InvokeRoute < TransactionResult [ ] > ( getRoute ( "claimTo" ) , new string [ ] { address , quantity . ToString ( ) } ) ;
133+ }
134+
65135 private string getRoute ( string functionPath ) {
66136 return this . address + ".erc721." + functionPath ;
67137 }
0 commit comments