@@ -120,9 +120,42 @@ private string getRoute(string functionPath) {
120120 }
121121 }
122122
123+ // TODO switch to another JSON serializer that supports polymorphism
123124 [ System . Serializable ]
124125 #nullable enable
125126 public class ERC1155MintPayload
127+ {
128+ public string to ;
129+ public string price ;
130+ public string currencyAddress ;
131+ public string primarySaleRecipient ;
132+ public string royaltyRecipient ;
133+ public int royaltyBps ;
134+ public int quantity ;
135+ public NFTMetadata metadata ;
136+ public string uid ;
137+ // TODO implement these, needs JS bridging support
138+ // public long mintStartTime;
139+ // public long mintEndTime;
140+
141+ public ERC1155MintPayload ( string receiverAddress , NFTMetadata metadata ) {
142+ this . metadata = metadata ;
143+ this . to = receiverAddress ;
144+ this . price = "0" ;
145+ this . currencyAddress = Utils . AddressZero ;
146+ this . primarySaleRecipient = Utils . AddressZero ;
147+ this . royaltyRecipient = Utils . AddressZero ;
148+ this . royaltyBps = 0 ;
149+ this . quantity = 1 ;
150+ this . uid = Utils . ToBytes32HexString ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
151+ // TODO temporary solution
152+ // this.mintStartTime = Utils.UnixTimeNowMs() * 1000L;
153+ // this.mintEndTime = this.mintStartTime + 1000L * 60L * 60L * 24L * 365L;
154+ }
155+ }
156+
157+ [ System . Serializable ]
158+ public class ERC1155MintAdditionalPayload
126159 {
127160 public string tokenId ;
128161 public string to ;
@@ -132,34 +165,49 @@ public class ERC1155MintPayload
132165 public string royaltyRecipient ;
133166 public int royaltyBps ;
134167 public int quantity ;
135- public NFTMetadata ? metadata ;
136168 public string uid ;
137169 // TODO implement these, needs JS bridging support
138- public long mintStartTime ;
139- public long mintEndTime ;
170+ // public long mintStartTime;
171+ // public long mintEndTime;
140172
141- public ERC1155MintPayload ( ) {
142- this . tokenId = "" ; // TODO max uint256 by default
143- this . to = Utils . AddressZero ;
173+ public ERC1155MintAdditionalPayload ( string receiverAddress , string tokenId ) {
174+ this . tokenId = tokenId ;
175+ this . to = receiverAddress ;
144176 this . price = "0" ;
145177 this . currencyAddress = Utils . AddressZero ;
146178 this . primarySaleRecipient = Utils . AddressZero ;
147179 this . royaltyRecipient = Utils . AddressZero ;
148180 this . royaltyBps = 0 ;
149181 this . quantity = 1 ;
150- this . metadata = null ;
151182 this . uid = Utils . ToBytes32HexString ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
152183 // TODO temporary solution
153- this . mintStartTime = Utils . UnixTimeNowMs ( ) * 1000L ;
154- this . mintEndTime = this . mintStartTime + 1000L * 60L * 60L * 24L * 365L ;
184+ // this.mintStartTime = Utils.UnixTimeNowMs() * 1000L;
185+ // this.mintEndTime = this.mintStartTime + 1000L * 60L * 60L * 24L * 365L;
155186 }
156187 }
157188
189+ [ System . Serializable ]
190+ public struct ERC1155SignedPayloadOutput
191+ {
192+ public string to ;
193+ public string tokenId ;
194+ public string price ;
195+ public string currencyAddress ;
196+ public string primarySaleRecipient ;
197+ public string royaltyRecipient ;
198+ public int royaltyBps ;
199+ public int quantity ;
200+ public string uri ;
201+ public string uid ;
202+ public long mintStartTime ;
203+ public long mintEndTime ;
204+ }
205+
158206 [ System . Serializable ]
159207 public struct ERC1155SignedPayload
160208 {
161209 public string signature ;
162- public ERC1155MintPayload payload ;
210+ public ERC1155SignedPayloadOutput payload ;
163211 }
164212
165213 public class ERC1155Signature
@@ -178,6 +226,11 @@ public async Task<ERC1155SignedPayload> Generate(ERC1155MintPayload payloadToSig
178226 return await Bridge . InvokeRoute < ERC1155SignedPayload > ( getRoute ( "generate" ) , Utils . ToJsonStringArray ( payloadToSign ) ) ;
179227 }
180228
229+ public async Task < ERC1155SignedPayload > GenerateFromTokenId ( ERC1155MintAdditionalPayload payloadToSign )
230+ {
231+ return await Bridge . InvokeRoute < ERC1155SignedPayload > ( getRoute ( "generateFromTokenId" ) , Utils . ToJsonStringArray ( payloadToSign ) ) ;
232+ }
233+
181234 public async Task < bool > Verify ( ERC1155SignedPayload signedPayload )
182235 {
183236 return await Bridge . InvokeRoute < bool > ( getRoute ( "verify" ) , Utils . ToJsonStringArray ( signedPayload ) ) ;
0 commit comments