@medialane/sdk 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +606 -526
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +257 -266
- package/dist/index.d.ts +257 -266
- package/dist/index.js +607 -525
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,12 +6,12 @@ var starknet = require('starknet');
|
|
|
6
6
|
// src/config.ts
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
|
-
var MARKETPLACE_721_CONTRACT_MAINNET = "
|
|
10
|
-
var MARKETPLACE_721_CLASS_HASH_MAINNET = "
|
|
11
|
-
var MARKETPLACE_721_START_BLOCK_MAINNET =
|
|
12
|
-
var MARKETPLACE_1155_CONTRACT_MAINNET = "
|
|
13
|
-
var MARKETPLACE_1155_CLASS_HASH_MAINNET = "
|
|
14
|
-
var MARKETPLACE_1155_START_BLOCK_MAINNET =
|
|
9
|
+
var MARKETPLACE_721_CONTRACT_MAINNET = "0x069cf5391077e3ebdd9cb6aebf90ed530d29f0d6aa34a43f5afae938c0fb565e";
|
|
10
|
+
var MARKETPLACE_721_CLASS_HASH_MAINNET = "0x04c6f952d747ad7ead1b3dad4c1d587837d38f8ec29d6c095a4afa5b5ece5957";
|
|
11
|
+
var MARKETPLACE_721_START_BLOCK_MAINNET = 10350340;
|
|
12
|
+
var MARKETPLACE_1155_CONTRACT_MAINNET = "0x040cd7b3e73bb3c892166e34bdc01d1797f97ecbc356c23f1cf38033cacf0077";
|
|
13
|
+
var MARKETPLACE_1155_CLASS_HASH_MAINNET = "0x02600bb720908f119afe482309d36c39d087587f0df9576454acfb6363e78cd8";
|
|
14
|
+
var MARKETPLACE_1155_START_BLOCK_MAINNET = 10350855;
|
|
15
15
|
var COLLECTION_721_CONTRACT_MAINNET = "0x0322cb7119955e01ac778d40976eb3ba50540bb0899f812d612f9c7e63e49fd2";
|
|
16
16
|
var IPNFT_CLASS_HASH_MAINNET = "0x27ee4ded786d51bced1e94afec3034d6ffce71c032c45ee1ff283ccfa9db12e";
|
|
17
17
|
var IPCOLLECTION_CLASS_HASH_MAINNET = "0x287ccdff8b6655a2248cfe170d82eae3a35303cd00ef3e751b25ddca26d9095";
|
|
@@ -138,34 +138,33 @@ var OFFER_ITEM = [
|
|
|
138
138
|
{ name: "item_type", type: "shortstring" },
|
|
139
139
|
{ name: "token", type: "ContractAddress" },
|
|
140
140
|
{ name: "identifier_or_criteria", type: "felt" },
|
|
141
|
-
{ name: "
|
|
142
|
-
{ name: "end_amount", type: "felt" }
|
|
141
|
+
{ name: "amount", type: "felt" }
|
|
143
142
|
];
|
|
144
143
|
var CONSIDERATION_ITEM = [
|
|
145
144
|
{ name: "item_type", type: "shortstring" },
|
|
146
145
|
{ name: "token", type: "ContractAddress" },
|
|
147
146
|
{ name: "identifier_or_criteria", type: "felt" },
|
|
148
|
-
{ name: "
|
|
149
|
-
{ name: "end_amount", type: "felt" },
|
|
147
|
+
{ name: "amount", type: "felt" },
|
|
150
148
|
{ name: "recipient", type: "ContractAddress" }
|
|
151
149
|
];
|
|
152
150
|
var ORDER_PARAMETERS = [
|
|
153
151
|
{ name: "offerer", type: "ContractAddress" },
|
|
152
|
+
{ name: "marketplace", type: "ContractAddress" },
|
|
154
153
|
{ name: "offer", type: "OfferItem" },
|
|
155
154
|
{ name: "consideration", type: "ConsiderationItem" },
|
|
155
|
+
{ name: "royalty_max_bps", type: "felt" },
|
|
156
156
|
{ name: "start_time", type: "felt" },
|
|
157
157
|
{ name: "end_time", type: "felt" },
|
|
158
158
|
{ name: "salt", type: "felt" },
|
|
159
|
-
{ name: "
|
|
159
|
+
{ name: "counter", type: "felt" }
|
|
160
160
|
];
|
|
161
161
|
var ORDER_CANCELLATION = [
|
|
162
162
|
{ name: "order_hash", type: "felt" },
|
|
163
|
-
{ name: "offerer", type: "ContractAddress" }
|
|
164
|
-
{ name: "nonce", type: "felt" }
|
|
163
|
+
{ name: "offerer", type: "ContractAddress" }
|
|
165
164
|
];
|
|
166
165
|
var DOMAIN_VERSION = {
|
|
167
|
-
erc721: "
|
|
168
|
-
erc1155: "
|
|
166
|
+
erc721: "4",
|
|
167
|
+
erc1155: "3"
|
|
169
168
|
};
|
|
170
169
|
function buildDomain(standard, chainId) {
|
|
171
170
|
return {
|
|
@@ -201,37 +200,6 @@ function build1155OrderTypedData(message, chainId) {
|
|
|
201
200
|
message
|
|
202
201
|
};
|
|
203
202
|
}
|
|
204
|
-
function buildFulfillmentTypedData(message, chainId) {
|
|
205
|
-
return {
|
|
206
|
-
domain: buildDomain("erc721", chainId),
|
|
207
|
-
primaryType: "OrderFulfillment",
|
|
208
|
-
types: {
|
|
209
|
-
StarknetDomain: STARKNET_DOMAIN,
|
|
210
|
-
OrderFulfillment: [
|
|
211
|
-
{ name: "order_hash", type: "felt" },
|
|
212
|
-
{ name: "fulfiller", type: "ContractAddress" },
|
|
213
|
-
{ name: "nonce", type: "felt" }
|
|
214
|
-
]
|
|
215
|
-
},
|
|
216
|
-
message
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
function build1155FulfillmentTypedData(message, chainId) {
|
|
220
|
-
return {
|
|
221
|
-
domain: buildDomain("erc1155", chainId),
|
|
222
|
-
primaryType: "OrderFulfillment",
|
|
223
|
-
types: {
|
|
224
|
-
StarknetDomain: STARKNET_DOMAIN,
|
|
225
|
-
OrderFulfillment: [
|
|
226
|
-
{ name: "order_hash", type: "felt" },
|
|
227
|
-
{ name: "fulfiller", type: "ContractAddress" },
|
|
228
|
-
{ name: "quantity", type: "felt" },
|
|
229
|
-
{ name: "nonce", type: "felt" }
|
|
230
|
-
]
|
|
231
|
-
},
|
|
232
|
-
message
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
203
|
function buildCancellationTypedData(message, chainId) {
|
|
236
204
|
return {
|
|
237
205
|
domain: buildDomain("erc721", chainId),
|
|
@@ -282,306 +250,466 @@ function encodeByteArray(str) {
|
|
|
282
250
|
// src/abis/ipMarketplace.ts
|
|
283
251
|
var IPMarketplaceABI = [
|
|
284
252
|
{
|
|
285
|
-
type: "impl",
|
|
286
|
-
name: "
|
|
287
|
-
interface_name: "
|
|
253
|
+
"type": "impl",
|
|
254
|
+
"name": "Medialane721Impl",
|
|
255
|
+
"interface_name": "medialane_marketplace_erc721::core::interface::IMedialane"
|
|
288
256
|
},
|
|
289
257
|
{
|
|
290
|
-
type: "
|
|
291
|
-
name: "
|
|
292
|
-
|
|
258
|
+
"type": "struct",
|
|
259
|
+
"name": "medialane_marketplace_erc721::core::types::OfferItem",
|
|
260
|
+
"members": [
|
|
261
|
+
{
|
|
262
|
+
"name": "item_type",
|
|
263
|
+
"type": "core::felt252"
|
|
264
|
+
},
|
|
293
265
|
{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
266
|
+
"name": "token",
|
|
267
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"name": "identifier_or_criteria",
|
|
271
|
+
"type": "core::felt252"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"name": "amount",
|
|
275
|
+
"type": "core::felt252"
|
|
299
276
|
}
|
|
300
277
|
]
|
|
301
278
|
},
|
|
302
279
|
{
|
|
303
|
-
type: "
|
|
304
|
-
name: "
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
{
|
|
315
|
-
|
|
280
|
+
"type": "struct",
|
|
281
|
+
"name": "medialane_marketplace_erc721::core::types::ConsiderationItem",
|
|
282
|
+
"members": [
|
|
283
|
+
{
|
|
284
|
+
"name": "item_type",
|
|
285
|
+
"type": "core::felt252"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "token",
|
|
289
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "identifier_or_criteria",
|
|
293
|
+
"type": "core::felt252"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "amount",
|
|
297
|
+
"type": "core::felt252"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "recipient",
|
|
301
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
302
|
+
}
|
|
316
303
|
]
|
|
317
304
|
},
|
|
318
305
|
{
|
|
319
|
-
type: "struct",
|
|
320
|
-
name: "
|
|
321
|
-
members: [
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
{
|
|
327
|
-
|
|
306
|
+
"type": "struct",
|
|
307
|
+
"name": "medialane_marketplace_erc721::core::types::OrderParameters",
|
|
308
|
+
"members": [
|
|
309
|
+
{
|
|
310
|
+
"name": "offerer",
|
|
311
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "marketplace",
|
|
315
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "offer",
|
|
319
|
+
"type": "medialane_marketplace_erc721::core::types::OfferItem"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"name": "consideration",
|
|
323
|
+
"type": "medialane_marketplace_erc721::core::types::ConsiderationItem"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"name": "royalty_max_bps",
|
|
327
|
+
"type": "core::felt252"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "start_time",
|
|
331
|
+
"type": "core::felt252"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"name": "end_time",
|
|
335
|
+
"type": "core::felt252"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "salt",
|
|
339
|
+
"type": "core::felt252"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"name": "counter",
|
|
343
|
+
"type": "core::felt252"
|
|
344
|
+
}
|
|
328
345
|
]
|
|
329
346
|
},
|
|
330
347
|
{
|
|
331
|
-
type: "struct",
|
|
332
|
-
name: "
|
|
333
|
-
members: [
|
|
334
|
-
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
{
|
|
339
|
-
|
|
340
|
-
|
|
348
|
+
"type": "struct",
|
|
349
|
+
"name": "medialane_marketplace_erc721::core::types::Order",
|
|
350
|
+
"members": [
|
|
351
|
+
{
|
|
352
|
+
"name": "parameters",
|
|
353
|
+
"type": "medialane_marketplace_erc721::core::types::OrderParameters"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "signature",
|
|
357
|
+
"type": "core::array::Array::<core::felt252>"
|
|
358
|
+
}
|
|
341
359
|
]
|
|
342
360
|
},
|
|
343
361
|
{
|
|
344
|
-
type: "struct",
|
|
345
|
-
name: "
|
|
346
|
-
members: [
|
|
347
|
-
{
|
|
348
|
-
|
|
362
|
+
"type": "struct",
|
|
363
|
+
"name": "medialane_marketplace_erc721::core::types::OrderCancellation",
|
|
364
|
+
"members": [
|
|
365
|
+
{
|
|
366
|
+
"name": "order_hash",
|
|
367
|
+
"type": "core::felt252"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"name": "offerer",
|
|
371
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
372
|
+
}
|
|
349
373
|
]
|
|
350
374
|
},
|
|
351
375
|
{
|
|
352
|
-
type: "struct",
|
|
353
|
-
name: "
|
|
354
|
-
members: [
|
|
355
|
-
{
|
|
356
|
-
|
|
357
|
-
|
|
376
|
+
"type": "struct",
|
|
377
|
+
"name": "medialane_marketplace_erc721::core::types::CancelRequest",
|
|
378
|
+
"members": [
|
|
379
|
+
{
|
|
380
|
+
"name": "cancelation",
|
|
381
|
+
"type": "medialane_marketplace_erc721::core::types::OrderCancellation"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "signature",
|
|
385
|
+
"type": "core::array::Array::<core::felt252>"
|
|
386
|
+
}
|
|
358
387
|
]
|
|
359
388
|
},
|
|
360
389
|
{
|
|
361
|
-
type: "
|
|
362
|
-
name: "
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
|
|
390
|
+
"type": "enum",
|
|
391
|
+
"name": "medialane_marketplace_erc721::core::types::OrderStatus",
|
|
392
|
+
"variants": [
|
|
393
|
+
{
|
|
394
|
+
"name": "None",
|
|
395
|
+
"type": "()"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": "Created",
|
|
399
|
+
"type": "()"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "Filled",
|
|
403
|
+
"type": "()"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"name": "Cancelled",
|
|
407
|
+
"type": "()"
|
|
408
|
+
}
|
|
366
409
|
]
|
|
367
410
|
},
|
|
368
411
|
{
|
|
369
|
-
type: "struct",
|
|
370
|
-
name: "
|
|
371
|
-
members: [
|
|
372
|
-
{
|
|
373
|
-
|
|
374
|
-
|
|
412
|
+
"type": "struct",
|
|
413
|
+
"name": "medialane_marketplace_erc721::core::types::OrderDetails",
|
|
414
|
+
"members": [
|
|
415
|
+
{
|
|
416
|
+
"name": "offerer",
|
|
417
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"name": "offer",
|
|
421
|
+
"type": "medialane_marketplace_erc721::core::types::OfferItem"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"name": "consideration",
|
|
425
|
+
"type": "medialane_marketplace_erc721::core::types::ConsiderationItem"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"name": "royalty_max_bps",
|
|
429
|
+
"type": "core::felt252"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"name": "start_time",
|
|
433
|
+
"type": "core::integer::u64"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "end_time",
|
|
437
|
+
"type": "core::integer::u64"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "order_status",
|
|
441
|
+
"type": "medialane_marketplace_erc721::core::types::OrderStatus"
|
|
442
|
+
}
|
|
375
443
|
]
|
|
376
444
|
},
|
|
377
445
|
{
|
|
378
|
-
type: "
|
|
379
|
-
name: "
|
|
380
|
-
|
|
381
|
-
{
|
|
382
|
-
|
|
446
|
+
"type": "interface",
|
|
447
|
+
"name": "medialane_marketplace_erc721::core::interface::IMedialane",
|
|
448
|
+
"items": [
|
|
449
|
+
{
|
|
450
|
+
"type": "function",
|
|
451
|
+
"name": "register_order",
|
|
452
|
+
"inputs": [
|
|
453
|
+
{
|
|
454
|
+
"name": "order",
|
|
455
|
+
"type": "medialane_marketplace_erc721::core::types::Order"
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
"outputs": [],
|
|
459
|
+
"state_mutability": "external"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"type": "function",
|
|
463
|
+
"name": "fulfill_order",
|
|
464
|
+
"inputs": [
|
|
465
|
+
{
|
|
466
|
+
"name": "order_hash",
|
|
467
|
+
"type": "core::felt252"
|
|
468
|
+
}
|
|
469
|
+
],
|
|
470
|
+
"outputs": [],
|
|
471
|
+
"state_mutability": "external"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"type": "function",
|
|
475
|
+
"name": "cancel_order",
|
|
476
|
+
"inputs": [
|
|
477
|
+
{
|
|
478
|
+
"name": "cancel_request",
|
|
479
|
+
"type": "medialane_marketplace_erc721::core::types::CancelRequest"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
"outputs": [],
|
|
483
|
+
"state_mutability": "external"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"type": "function",
|
|
487
|
+
"name": "increment_counter",
|
|
488
|
+
"inputs": [],
|
|
489
|
+
"outputs": [],
|
|
490
|
+
"state_mutability": "external"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"type": "function",
|
|
494
|
+
"name": "get_order_details",
|
|
495
|
+
"inputs": [
|
|
496
|
+
{
|
|
497
|
+
"name": "order_hash",
|
|
498
|
+
"type": "core::felt252"
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
"outputs": [
|
|
502
|
+
{
|
|
503
|
+
"type": "medialane_marketplace_erc721::core::types::OrderDetails"
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
"state_mutability": "view"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"type": "function",
|
|
510
|
+
"name": "get_order_hash",
|
|
511
|
+
"inputs": [
|
|
512
|
+
{
|
|
513
|
+
"name": "parameters",
|
|
514
|
+
"type": "medialane_marketplace_erc721::core::types::OrderParameters"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
"name": "signer",
|
|
518
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
519
|
+
}
|
|
520
|
+
],
|
|
521
|
+
"outputs": [
|
|
522
|
+
{
|
|
523
|
+
"type": "core::felt252"
|
|
524
|
+
}
|
|
525
|
+
],
|
|
526
|
+
"state_mutability": "view"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"type": "function",
|
|
530
|
+
"name": "get_cancellation_hash",
|
|
531
|
+
"inputs": [
|
|
532
|
+
{
|
|
533
|
+
"name": "cancellation",
|
|
534
|
+
"type": "medialane_marketplace_erc721::core::types::OrderCancellation"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"name": "signer",
|
|
538
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
539
|
+
}
|
|
540
|
+
],
|
|
541
|
+
"outputs": [
|
|
542
|
+
{
|
|
543
|
+
"type": "core::felt252"
|
|
544
|
+
}
|
|
545
|
+
],
|
|
546
|
+
"state_mutability": "view"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"type": "function",
|
|
550
|
+
"name": "get_counter",
|
|
551
|
+
"inputs": [
|
|
552
|
+
{
|
|
553
|
+
"name": "offerer",
|
|
554
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
555
|
+
}
|
|
556
|
+
],
|
|
557
|
+
"outputs": [
|
|
558
|
+
{
|
|
559
|
+
"type": "core::felt252"
|
|
560
|
+
}
|
|
561
|
+
],
|
|
562
|
+
"state_mutability": "view"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"type": "function",
|
|
566
|
+
"name": "get_native_token_address",
|
|
567
|
+
"inputs": [],
|
|
568
|
+
"outputs": [
|
|
569
|
+
{
|
|
570
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
"state_mutability": "view"
|
|
574
|
+
}
|
|
383
575
|
]
|
|
384
576
|
},
|
|
385
577
|
{
|
|
386
|
-
type: "
|
|
387
|
-
name: "
|
|
388
|
-
|
|
389
|
-
{
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
578
|
+
"type": "constructor",
|
|
579
|
+
"name": "constructor",
|
|
580
|
+
"inputs": [
|
|
581
|
+
{
|
|
582
|
+
"name": "native_token_address",
|
|
583
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
584
|
+
}
|
|
393
585
|
]
|
|
394
586
|
},
|
|
395
587
|
{
|
|
396
|
-
type: "
|
|
397
|
-
name: "
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
{
|
|
588
|
+
"type": "event",
|
|
589
|
+
"name": "medialane_marketplace_erc721::core::events::OrderCreated",
|
|
590
|
+
"kind": "struct",
|
|
591
|
+
"members": [
|
|
592
|
+
{
|
|
593
|
+
"name": "order_hash",
|
|
594
|
+
"type": "core::felt252",
|
|
595
|
+
"kind": "key"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"name": "offerer",
|
|
599
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
600
|
+
"kind": "key"
|
|
601
|
+
}
|
|
401
602
|
]
|
|
402
603
|
},
|
|
403
604
|
{
|
|
404
|
-
type: "struct",
|
|
405
|
-
name: "
|
|
406
|
-
members: [
|
|
407
|
-
{
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
{ name: "end_time", type: "core::integer::u64" },
|
|
412
|
-
{ name: "order_status", type: "mediolano_core::core::types::OrderStatus" },
|
|
605
|
+
"type": "struct",
|
|
606
|
+
"name": "core::integer::u256",
|
|
607
|
+
"members": [
|
|
608
|
+
{
|
|
609
|
+
"name": "low",
|
|
610
|
+
"type": "core::integer::u128"
|
|
611
|
+
},
|
|
413
612
|
{
|
|
414
|
-
name: "
|
|
415
|
-
type: "core::
|
|
613
|
+
"name": "high",
|
|
614
|
+
"type": "core::integer::u128"
|
|
416
615
|
}
|
|
417
616
|
]
|
|
418
617
|
},
|
|
419
618
|
{
|
|
420
|
-
type: "
|
|
421
|
-
name: "
|
|
422
|
-
|
|
619
|
+
"type": "event",
|
|
620
|
+
"name": "medialane_marketplace_erc721::core::events::OrderFulfilled",
|
|
621
|
+
"kind": "struct",
|
|
622
|
+
"members": [
|
|
423
623
|
{
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
outputs: [],
|
|
428
|
-
state_mutability: "external"
|
|
624
|
+
"name": "order_hash",
|
|
625
|
+
"type": "core::felt252",
|
|
626
|
+
"kind": "key"
|
|
429
627
|
},
|
|
430
628
|
{
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
{
|
|
435
|
-
name: "fulfillment_request",
|
|
436
|
-
type: "mediolano_core::core::types::FulfillmentRequest"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
outputs: [],
|
|
440
|
-
state_mutability: "external"
|
|
629
|
+
"name": "offerer",
|
|
630
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
631
|
+
"kind": "key"
|
|
441
632
|
},
|
|
442
633
|
{
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
outputs: [],
|
|
447
|
-
state_mutability: "external"
|
|
634
|
+
"name": "fulfiller",
|
|
635
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
636
|
+
"kind": "key"
|
|
448
637
|
},
|
|
449
638
|
{
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
outputs: [{ type: "mediolano_core::core::types::OrderDetails" }],
|
|
454
|
-
state_mutability: "view"
|
|
639
|
+
"name": "sale_amount",
|
|
640
|
+
"type": "core::integer::u256",
|
|
641
|
+
"kind": "data"
|
|
455
642
|
},
|
|
456
643
|
{
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
{ name: "signer", type: "core::starknet::contract_address::ContractAddress" }
|
|
462
|
-
],
|
|
463
|
-
outputs: [{ type: "core::felt252" }],
|
|
464
|
-
state_mutability: "view"
|
|
465
|
-
}
|
|
466
|
-
]
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
type: "impl",
|
|
470
|
-
name: "NoncesImpl",
|
|
471
|
-
interface_name: "openzeppelin_utils::cryptography::interface::INonces"
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
type: "interface",
|
|
475
|
-
name: "openzeppelin_utils::cryptography::interface::INonces",
|
|
476
|
-
items: [
|
|
644
|
+
"name": "royalty_receiver",
|
|
645
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
646
|
+
"kind": "data"
|
|
647
|
+
},
|
|
477
648
|
{
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
{ name: "owner", type: "core::starknet::contract_address::ContractAddress" }
|
|
482
|
-
],
|
|
483
|
-
outputs: [{ type: "core::felt252" }],
|
|
484
|
-
state_mutability: "view"
|
|
649
|
+
"name": "royalty_amount",
|
|
650
|
+
"type": "core::integer::u256",
|
|
651
|
+
"kind": "data"
|
|
485
652
|
}
|
|
486
653
|
]
|
|
487
654
|
},
|
|
488
655
|
{
|
|
489
|
-
type: "
|
|
490
|
-
name: "
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
{
|
|
494
|
-
type: "enum",
|
|
495
|
-
name: "core::bool",
|
|
496
|
-
variants: [
|
|
497
|
-
{ name: "False", type: "()" },
|
|
498
|
-
{ name: "True", type: "()" }
|
|
499
|
-
]
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
type: "interface",
|
|
503
|
-
name: "openzeppelin_introspection::interface::ISRC5",
|
|
504
|
-
items: [
|
|
656
|
+
"type": "event",
|
|
657
|
+
"name": "medialane_marketplace_erc721::core::events::OrderCancelled",
|
|
658
|
+
"kind": "struct",
|
|
659
|
+
"members": [
|
|
505
660
|
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
state_mutability: "view"
|
|
511
|
-
}
|
|
512
|
-
]
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
type: "constructor",
|
|
516
|
-
name: "constructor",
|
|
517
|
-
inputs: [
|
|
518
|
-
{ name: "manager", type: "core::starknet::contract_address::ContractAddress" },
|
|
519
|
-
{ name: "native_token_address", type: "core::starknet::contract_address::ContractAddress" }
|
|
520
|
-
]
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
type: "event",
|
|
524
|
-
name: "mediolano_core::core::events::OrderCreated",
|
|
525
|
-
kind: "struct",
|
|
526
|
-
members: [
|
|
527
|
-
{ name: "order_hash", type: "core::felt252", kind: "key" },
|
|
661
|
+
"name": "order_hash",
|
|
662
|
+
"type": "core::felt252",
|
|
663
|
+
"kind": "key"
|
|
664
|
+
},
|
|
528
665
|
{
|
|
529
|
-
name: "offerer",
|
|
530
|
-
type: "core::starknet::contract_address::ContractAddress",
|
|
531
|
-
kind: "key"
|
|
666
|
+
"name": "offerer",
|
|
667
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
668
|
+
"kind": "key"
|
|
532
669
|
}
|
|
533
670
|
]
|
|
534
671
|
},
|
|
535
672
|
{
|
|
536
|
-
type: "event",
|
|
537
|
-
name: "
|
|
538
|
-
kind: "struct",
|
|
539
|
-
members: [
|
|
540
|
-
{ name: "order_hash", type: "core::felt252", kind: "key" },
|
|
673
|
+
"type": "event",
|
|
674
|
+
"name": "medialane_marketplace_erc721::core::events::CounterIncremented",
|
|
675
|
+
"kind": "struct",
|
|
676
|
+
"members": [
|
|
541
677
|
{
|
|
542
|
-
name: "offerer",
|
|
543
|
-
type: "core::starknet::contract_address::ContractAddress",
|
|
544
|
-
kind: "key"
|
|
678
|
+
"name": "offerer",
|
|
679
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
680
|
+
"kind": "key"
|
|
545
681
|
},
|
|
546
682
|
{
|
|
547
|
-
name: "
|
|
548
|
-
type: "core::
|
|
549
|
-
kind: "
|
|
683
|
+
"name": "new_counter",
|
|
684
|
+
"type": "core::felt252",
|
|
685
|
+
"kind": "data"
|
|
550
686
|
}
|
|
551
687
|
]
|
|
552
688
|
},
|
|
553
689
|
{
|
|
554
|
-
type: "event",
|
|
555
|
-
name: "
|
|
556
|
-
kind: "
|
|
557
|
-
|
|
558
|
-
{ name: "order_hash", type: "core::felt252", kind: "key" },
|
|
690
|
+
"type": "event",
|
|
691
|
+
"name": "medialane_marketplace_erc721::core::medialane::Medialane721::Event",
|
|
692
|
+
"kind": "enum",
|
|
693
|
+
"variants": [
|
|
559
694
|
{
|
|
560
|
-
name: "
|
|
561
|
-
type: "core::
|
|
562
|
-
kind: "
|
|
563
|
-
}
|
|
564
|
-
]
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
type: "event",
|
|
568
|
-
name: "mediolano_core::core::medialane::Medialane::Event",
|
|
569
|
-
kind: "enum",
|
|
570
|
-
variants: [
|
|
695
|
+
"name": "OrderCreated",
|
|
696
|
+
"type": "medialane_marketplace_erc721::core::events::OrderCreated",
|
|
697
|
+
"kind": "nested"
|
|
698
|
+
},
|
|
571
699
|
{
|
|
572
|
-
name: "
|
|
573
|
-
type: "
|
|
574
|
-
kind: "nested"
|
|
700
|
+
"name": "OrderFulfilled",
|
|
701
|
+
"type": "medialane_marketplace_erc721::core::events::OrderFulfilled",
|
|
702
|
+
"kind": "nested"
|
|
575
703
|
},
|
|
576
704
|
{
|
|
577
|
-
name: "
|
|
578
|
-
type: "
|
|
579
|
-
kind: "nested"
|
|
705
|
+
"name": "OrderCancelled",
|
|
706
|
+
"type": "medialane_marketplace_erc721::core::events::OrderCancelled",
|
|
707
|
+
"kind": "nested"
|
|
580
708
|
},
|
|
581
709
|
{
|
|
582
|
-
name: "
|
|
583
|
-
type: "
|
|
584
|
-
kind: "nested"
|
|
710
|
+
"name": "CounterIncremented",
|
|
711
|
+
"type": "medialane_marketplace_erc721::core::events::CounterIncremented",
|
|
712
|
+
"kind": "nested"
|
|
585
713
|
}
|
|
586
714
|
]
|
|
587
715
|
}
|
|
@@ -1035,12 +1163,12 @@ var CollectionRegistryABI = [
|
|
|
1035
1163
|
var Medialane1155ABI = [
|
|
1036
1164
|
{
|
|
1037
1165
|
"type": "impl",
|
|
1038
|
-
"name": "
|
|
1039
|
-
"interface_name": "
|
|
1166
|
+
"name": "Medialane1155Impl",
|
|
1167
|
+
"interface_name": "medialane_marketplace_erc1155::core::interface::IMedialane1155"
|
|
1040
1168
|
},
|
|
1041
1169
|
{
|
|
1042
1170
|
"type": "struct",
|
|
1043
|
-
"name": "
|
|
1171
|
+
"name": "medialane_marketplace_erc1155::core::types::OfferItem",
|
|
1044
1172
|
"members": [
|
|
1045
1173
|
{
|
|
1046
1174
|
"name": "item_type",
|
|
@@ -1055,18 +1183,14 @@ var Medialane1155ABI = [
|
|
|
1055
1183
|
"type": "core::felt252"
|
|
1056
1184
|
},
|
|
1057
1185
|
{
|
|
1058
|
-
"name": "
|
|
1059
|
-
"type": "core::felt252"
|
|
1060
|
-
},
|
|
1061
|
-
{
|
|
1062
|
-
"name": "end_amount",
|
|
1186
|
+
"name": "amount",
|
|
1063
1187
|
"type": "core::felt252"
|
|
1064
1188
|
}
|
|
1065
1189
|
]
|
|
1066
1190
|
},
|
|
1067
1191
|
{
|
|
1068
1192
|
"type": "struct",
|
|
1069
|
-
"name": "
|
|
1193
|
+
"name": "medialane_marketplace_erc1155::core::types::ConsiderationItem",
|
|
1070
1194
|
"members": [
|
|
1071
1195
|
{
|
|
1072
1196
|
"name": "item_type",
|
|
@@ -1081,11 +1205,7 @@ var Medialane1155ABI = [
|
|
|
1081
1205
|
"type": "core::felt252"
|
|
1082
1206
|
},
|
|
1083
1207
|
{
|
|
1084
|
-
"name": "
|
|
1085
|
-
"type": "core::felt252"
|
|
1086
|
-
},
|
|
1087
|
-
{
|
|
1088
|
-
"name": "end_amount",
|
|
1208
|
+
"name": "amount",
|
|
1089
1209
|
"type": "core::felt252"
|
|
1090
1210
|
},
|
|
1091
1211
|
{
|
|
@@ -1096,19 +1216,27 @@ var Medialane1155ABI = [
|
|
|
1096
1216
|
},
|
|
1097
1217
|
{
|
|
1098
1218
|
"type": "struct",
|
|
1099
|
-
"name": "
|
|
1219
|
+
"name": "medialane_marketplace_erc1155::core::types::OrderParameters",
|
|
1100
1220
|
"members": [
|
|
1101
1221
|
{
|
|
1102
1222
|
"name": "offerer",
|
|
1103
1223
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
1104
1224
|
},
|
|
1225
|
+
{
|
|
1226
|
+
"name": "marketplace",
|
|
1227
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1228
|
+
},
|
|
1105
1229
|
{
|
|
1106
1230
|
"name": "offer",
|
|
1107
|
-
"type": "
|
|
1231
|
+
"type": "medialane_marketplace_erc1155::core::types::OfferItem"
|
|
1108
1232
|
},
|
|
1109
1233
|
{
|
|
1110
1234
|
"name": "consideration",
|
|
1111
|
-
"type": "
|
|
1235
|
+
"type": "medialane_marketplace_erc1155::core::types::ConsiderationItem"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"name": "royalty_max_bps",
|
|
1239
|
+
"type": "core::felt252"
|
|
1112
1240
|
},
|
|
1113
1241
|
{
|
|
1114
1242
|
"name": "start_time",
|
|
@@ -1123,18 +1251,18 @@ var Medialane1155ABI = [
|
|
|
1123
1251
|
"type": "core::felt252"
|
|
1124
1252
|
},
|
|
1125
1253
|
{
|
|
1126
|
-
"name": "
|
|
1254
|
+
"name": "counter",
|
|
1127
1255
|
"type": "core::felt252"
|
|
1128
1256
|
}
|
|
1129
1257
|
]
|
|
1130
1258
|
},
|
|
1131
1259
|
{
|
|
1132
1260
|
"type": "struct",
|
|
1133
|
-
"name": "
|
|
1261
|
+
"name": "medialane_marketplace_erc1155::core::types::Order",
|
|
1134
1262
|
"members": [
|
|
1135
1263
|
{
|
|
1136
1264
|
"name": "parameters",
|
|
1137
|
-
"type": "
|
|
1265
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderParameters"
|
|
1138
1266
|
},
|
|
1139
1267
|
{
|
|
1140
1268
|
"name": "signature",
|
|
@@ -1144,43 +1272,7 @@ var Medialane1155ABI = [
|
|
|
1144
1272
|
},
|
|
1145
1273
|
{
|
|
1146
1274
|
"type": "struct",
|
|
1147
|
-
"name": "
|
|
1148
|
-
"members": [
|
|
1149
|
-
{
|
|
1150
|
-
"name": "order_hash",
|
|
1151
|
-
"type": "core::felt252"
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
"name": "fulfiller",
|
|
1155
|
-
"type": "core::starknet::contract_address::ContractAddress"
|
|
1156
|
-
},
|
|
1157
|
-
{
|
|
1158
|
-
"name": "quantity",
|
|
1159
|
-
"type": "core::felt252"
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
"name": "nonce",
|
|
1163
|
-
"type": "core::felt252"
|
|
1164
|
-
}
|
|
1165
|
-
]
|
|
1166
|
-
},
|
|
1167
|
-
{
|
|
1168
|
-
"type": "struct",
|
|
1169
|
-
"name": "medialane_erc1155::core::types::FulfillmentRequest",
|
|
1170
|
-
"members": [
|
|
1171
|
-
{
|
|
1172
|
-
"name": "fulfillment",
|
|
1173
|
-
"type": "medialane_erc1155::core::types::OrderFulfillment"
|
|
1174
|
-
},
|
|
1175
|
-
{
|
|
1176
|
-
"name": "signature",
|
|
1177
|
-
"type": "core::array::Array::<core::felt252>"
|
|
1178
|
-
}
|
|
1179
|
-
]
|
|
1180
|
-
},
|
|
1181
|
-
{
|
|
1182
|
-
"type": "struct",
|
|
1183
|
-
"name": "medialane_erc1155::core::types::OrderCancellation",
|
|
1275
|
+
"name": "medialane_marketplace_erc1155::core::types::OrderCancellation",
|
|
1184
1276
|
"members": [
|
|
1185
1277
|
{
|
|
1186
1278
|
"name": "order_hash",
|
|
@@ -1189,20 +1281,16 @@ var Medialane1155ABI = [
|
|
|
1189
1281
|
{
|
|
1190
1282
|
"name": "offerer",
|
|
1191
1283
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
"name": "nonce",
|
|
1195
|
-
"type": "core::felt252"
|
|
1196
1284
|
}
|
|
1197
1285
|
]
|
|
1198
1286
|
},
|
|
1199
1287
|
{
|
|
1200
1288
|
"type": "struct",
|
|
1201
|
-
"name": "
|
|
1289
|
+
"name": "medialane_marketplace_erc1155::core::types::CancelRequest",
|
|
1202
1290
|
"members": [
|
|
1203
1291
|
{
|
|
1204
1292
|
"name": "cancelation",
|
|
1205
|
-
"type": "
|
|
1293
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderCancellation"
|
|
1206
1294
|
},
|
|
1207
1295
|
{
|
|
1208
1296
|
"name": "signature",
|
|
@@ -1212,7 +1300,7 @@ var Medialane1155ABI = [
|
|
|
1212
1300
|
},
|
|
1213
1301
|
{
|
|
1214
1302
|
"type": "enum",
|
|
1215
|
-
"name": "
|
|
1303
|
+
"name": "medialane_marketplace_erc1155::core::types::OrderStatus",
|
|
1216
1304
|
"variants": [
|
|
1217
1305
|
{
|
|
1218
1306
|
"name": "None",
|
|
@@ -1234,7 +1322,7 @@ var Medialane1155ABI = [
|
|
|
1234
1322
|
},
|
|
1235
1323
|
{
|
|
1236
1324
|
"type": "struct",
|
|
1237
|
-
"name": "
|
|
1325
|
+
"name": "medialane_marketplace_erc1155::core::types::OrderDetails",
|
|
1238
1326
|
"members": [
|
|
1239
1327
|
{
|
|
1240
1328
|
"name": "offerer",
|
|
@@ -1242,11 +1330,15 @@ var Medialane1155ABI = [
|
|
|
1242
1330
|
},
|
|
1243
1331
|
{
|
|
1244
1332
|
"name": "offer",
|
|
1245
|
-
"type": "
|
|
1333
|
+
"type": "medialane_marketplace_erc1155::core::types::OfferItem"
|
|
1246
1334
|
},
|
|
1247
1335
|
{
|
|
1248
1336
|
"name": "consideration",
|
|
1249
|
-
"type": "
|
|
1337
|
+
"type": "medialane_marketplace_erc1155::core::types::ConsiderationItem"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
"name": "royalty_max_bps",
|
|
1341
|
+
"type": "core::felt252"
|
|
1250
1342
|
},
|
|
1251
1343
|
{
|
|
1252
1344
|
"name": "start_time",
|
|
@@ -1258,11 +1350,7 @@ var Medialane1155ABI = [
|
|
|
1258
1350
|
},
|
|
1259
1351
|
{
|
|
1260
1352
|
"name": "order_status",
|
|
1261
|
-
"type": "
|
|
1262
|
-
},
|
|
1263
|
-
{
|
|
1264
|
-
"name": "total_amount",
|
|
1265
|
-
"type": "core::felt252"
|
|
1353
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderStatus"
|
|
1266
1354
|
},
|
|
1267
1355
|
{
|
|
1268
1356
|
"name": "remaining_amount",
|
|
@@ -1272,7 +1360,7 @@ var Medialane1155ABI = [
|
|
|
1272
1360
|
},
|
|
1273
1361
|
{
|
|
1274
1362
|
"type": "interface",
|
|
1275
|
-
"name": "
|
|
1363
|
+
"name": "medialane_marketplace_erc1155::core::interface::IMedialane1155",
|
|
1276
1364
|
"items": [
|
|
1277
1365
|
{
|
|
1278
1366
|
"type": "function",
|
|
@@ -1280,7 +1368,7 @@ var Medialane1155ABI = [
|
|
|
1280
1368
|
"inputs": [
|
|
1281
1369
|
{
|
|
1282
1370
|
"name": "order",
|
|
1283
|
-
"type": "
|
|
1371
|
+
"type": "medialane_marketplace_erc1155::core::types::Order"
|
|
1284
1372
|
}
|
|
1285
1373
|
],
|
|
1286
1374
|
"outputs": [],
|
|
@@ -1291,8 +1379,12 @@ var Medialane1155ABI = [
|
|
|
1291
1379
|
"name": "fulfill_order",
|
|
1292
1380
|
"inputs": [
|
|
1293
1381
|
{
|
|
1294
|
-
"name": "
|
|
1295
|
-
"type": "
|
|
1382
|
+
"name": "order_hash",
|
|
1383
|
+
"type": "core::felt252"
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
"name": "quantity",
|
|
1387
|
+
"type": "core::felt252"
|
|
1296
1388
|
}
|
|
1297
1389
|
],
|
|
1298
1390
|
"outputs": [],
|
|
@@ -1304,12 +1396,19 @@ var Medialane1155ABI = [
|
|
|
1304
1396
|
"inputs": [
|
|
1305
1397
|
{
|
|
1306
1398
|
"name": "cancel_request",
|
|
1307
|
-
"type": "
|
|
1399
|
+
"type": "medialane_marketplace_erc1155::core::types::CancelRequest"
|
|
1308
1400
|
}
|
|
1309
1401
|
],
|
|
1310
1402
|
"outputs": [],
|
|
1311
1403
|
"state_mutability": "external"
|
|
1312
1404
|
},
|
|
1405
|
+
{
|
|
1406
|
+
"type": "function",
|
|
1407
|
+
"name": "increment_counter",
|
|
1408
|
+
"inputs": [],
|
|
1409
|
+
"outputs": [],
|
|
1410
|
+
"state_mutability": "external"
|
|
1411
|
+
},
|
|
1313
1412
|
{
|
|
1314
1413
|
"type": "function",
|
|
1315
1414
|
"name": "get_order_details",
|
|
@@ -1321,7 +1420,7 @@ var Medialane1155ABI = [
|
|
|
1321
1420
|
],
|
|
1322
1421
|
"outputs": [
|
|
1323
1422
|
{
|
|
1324
|
-
"type": "
|
|
1423
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderDetails"
|
|
1325
1424
|
}
|
|
1326
1425
|
],
|
|
1327
1426
|
"state_mutability": "view"
|
|
@@ -1332,7 +1431,7 @@ var Medialane1155ABI = [
|
|
|
1332
1431
|
"inputs": [
|
|
1333
1432
|
{
|
|
1334
1433
|
"name": "parameters",
|
|
1335
|
-
"type": "
|
|
1434
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderParameters"
|
|
1336
1435
|
},
|
|
1337
1436
|
{
|
|
1338
1437
|
"name": "signer",
|
|
@@ -1348,32 +1447,30 @@ var Medialane1155ABI = [
|
|
|
1348
1447
|
},
|
|
1349
1448
|
{
|
|
1350
1449
|
"type": "function",
|
|
1351
|
-
"name": "
|
|
1352
|
-
"inputs": [
|
|
1353
|
-
|
|
1450
|
+
"name": "get_cancellation_hash",
|
|
1451
|
+
"inputs": [
|
|
1452
|
+
{
|
|
1453
|
+
"name": "cancellation",
|
|
1454
|
+
"type": "medialane_marketplace_erc1155::core::types::OrderCancellation"
|
|
1455
|
+
},
|
|
1354
1456
|
{
|
|
1457
|
+
"name": "signer",
|
|
1355
1458
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
1356
1459
|
}
|
|
1357
1460
|
],
|
|
1461
|
+
"outputs": [
|
|
1462
|
+
{
|
|
1463
|
+
"type": "core::felt252"
|
|
1464
|
+
}
|
|
1465
|
+
],
|
|
1358
1466
|
"state_mutability": "view"
|
|
1359
|
-
}
|
|
1360
|
-
]
|
|
1361
|
-
},
|
|
1362
|
-
{
|
|
1363
|
-
"type": "impl",
|
|
1364
|
-
"name": "NoncesImpl",
|
|
1365
|
-
"interface_name": "openzeppelin_utils::cryptography::interface::INonces"
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
"type": "interface",
|
|
1369
|
-
"name": "openzeppelin_utils::cryptography::interface::INonces",
|
|
1370
|
-
"items": [
|
|
1467
|
+
},
|
|
1371
1468
|
{
|
|
1372
1469
|
"type": "function",
|
|
1373
|
-
"name": "
|
|
1470
|
+
"name": "get_counter",
|
|
1374
1471
|
"inputs": [
|
|
1375
1472
|
{
|
|
1376
|
-
"name": "
|
|
1473
|
+
"name": "offerer",
|
|
1377
1474
|
"type": "core::starknet::contract_address::ContractAddress"
|
|
1378
1475
|
}
|
|
1379
1476
|
],
|
|
@@ -1383,6 +1480,17 @@ var Medialane1155ABI = [
|
|
|
1383
1480
|
}
|
|
1384
1481
|
],
|
|
1385
1482
|
"state_mutability": "view"
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
"type": "function",
|
|
1486
|
+
"name": "get_native_token_address",
|
|
1487
|
+
"inputs": [],
|
|
1488
|
+
"outputs": [
|
|
1489
|
+
{
|
|
1490
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1491
|
+
}
|
|
1492
|
+
],
|
|
1493
|
+
"state_mutability": "view"
|
|
1386
1494
|
}
|
|
1387
1495
|
]
|
|
1388
1496
|
},
|
|
@@ -1398,7 +1506,7 @@ var Medialane1155ABI = [
|
|
|
1398
1506
|
},
|
|
1399
1507
|
{
|
|
1400
1508
|
"type": "event",
|
|
1401
|
-
"name": "
|
|
1509
|
+
"name": "medialane_marketplace_erc1155::core::events::OrderCreated",
|
|
1402
1510
|
"kind": "struct",
|
|
1403
1511
|
"members": [
|
|
1404
1512
|
{
|
|
@@ -1429,7 +1537,7 @@ var Medialane1155ABI = [
|
|
|
1429
1537
|
},
|
|
1430
1538
|
{
|
|
1431
1539
|
"type": "event",
|
|
1432
|
-
"name": "
|
|
1540
|
+
"name": "medialane_marketplace_erc1155::core::events::OrderFulfilled",
|
|
1433
1541
|
"kind": "struct",
|
|
1434
1542
|
"members": [
|
|
1435
1543
|
{
|
|
@@ -1476,7 +1584,7 @@ var Medialane1155ABI = [
|
|
|
1476
1584
|
},
|
|
1477
1585
|
{
|
|
1478
1586
|
"type": "event",
|
|
1479
|
-
"name": "
|
|
1587
|
+
"name": "medialane_marketplace_erc1155::core::events::OrderCancelled",
|
|
1480
1588
|
"kind": "struct",
|
|
1481
1589
|
"members": [
|
|
1482
1590
|
{
|
|
@@ -1493,34 +1601,45 @@ var Medialane1155ABI = [
|
|
|
1493
1601
|
},
|
|
1494
1602
|
{
|
|
1495
1603
|
"type": "event",
|
|
1496
|
-
"name": "
|
|
1497
|
-
"kind": "
|
|
1498
|
-
"
|
|
1604
|
+
"name": "medialane_marketplace_erc1155::core::events::CounterIncremented",
|
|
1605
|
+
"kind": "struct",
|
|
1606
|
+
"members": [
|
|
1607
|
+
{
|
|
1608
|
+
"name": "offerer",
|
|
1609
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1610
|
+
"kind": "key"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
"name": "new_counter",
|
|
1614
|
+
"type": "core::felt252",
|
|
1615
|
+
"kind": "data"
|
|
1616
|
+
}
|
|
1617
|
+
]
|
|
1499
1618
|
},
|
|
1500
1619
|
{
|
|
1501
1620
|
"type": "event",
|
|
1502
|
-
"name": "
|
|
1621
|
+
"name": "medialane_marketplace_erc1155::core::medialane::Medialane1155::Event",
|
|
1503
1622
|
"kind": "enum",
|
|
1504
1623
|
"variants": [
|
|
1505
1624
|
{
|
|
1506
1625
|
"name": "OrderCreated",
|
|
1507
|
-
"type": "
|
|
1626
|
+
"type": "medialane_marketplace_erc1155::core::events::OrderCreated",
|
|
1508
1627
|
"kind": "nested"
|
|
1509
1628
|
},
|
|
1510
1629
|
{
|
|
1511
1630
|
"name": "OrderFulfilled",
|
|
1512
|
-
"type": "
|
|
1631
|
+
"type": "medialane_marketplace_erc1155::core::events::OrderFulfilled",
|
|
1513
1632
|
"kind": "nested"
|
|
1514
1633
|
},
|
|
1515
1634
|
{
|
|
1516
1635
|
"name": "OrderCancelled",
|
|
1517
|
-
"type": "
|
|
1636
|
+
"type": "medialane_marketplace_erc1155::core::events::OrderCancelled",
|
|
1518
1637
|
"kind": "nested"
|
|
1519
1638
|
},
|
|
1520
1639
|
{
|
|
1521
|
-
"name": "
|
|
1522
|
-
"type": "
|
|
1523
|
-
"kind": "
|
|
1640
|
+
"name": "CounterIncremented",
|
|
1641
|
+
"type": "medialane_marketplace_erc1155::core::events::CounterIncremented",
|
|
1642
|
+
"kind": "nested"
|
|
1524
1643
|
}
|
|
1525
1644
|
]
|
|
1526
1645
|
}
|
|
@@ -4568,6 +4687,26 @@ var MedialaneError = class extends Error {
|
|
|
4568
4687
|
}
|
|
4569
4688
|
};
|
|
4570
4689
|
var START_TIME_BUFFER_SECS = 30;
|
|
4690
|
+
function generateSalt() {
|
|
4691
|
+
const bytes = new Uint8Array(31);
|
|
4692
|
+
crypto.getRandomValues(bytes);
|
|
4693
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
4694
|
+
return starknet.num.toHex(BigInt("0x" + hex));
|
|
4695
|
+
}
|
|
4696
|
+
async function resolveRoyaltyMaxBps(provider, nft, tokenId, override) {
|
|
4697
|
+
if (override !== void 0) return override;
|
|
4698
|
+
try {
|
|
4699
|
+
const id = starknet.cairo.uint256(tokenId);
|
|
4700
|
+
const res = await provider.callContract({
|
|
4701
|
+
contractAddress: nft,
|
|
4702
|
+
entrypoint: "royalty_info",
|
|
4703
|
+
calldata: [id.low.toString(), id.high.toString(), "10000", "0"]
|
|
4704
|
+
});
|
|
4705
|
+
return BigInt(res[1] ?? "0").toString();
|
|
4706
|
+
} catch {
|
|
4707
|
+
return "0";
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4571
4710
|
function toSignatureArray(sig) {
|
|
4572
4711
|
if (Array.isArray(sig)) return sig;
|
|
4573
4712
|
const s = sig;
|
|
@@ -4615,31 +4754,29 @@ async function createListing(account, params, config) {
|
|
|
4615
4754
|
const now = Math.floor(Date.now() / 1e3);
|
|
4616
4755
|
const startTime = now + START_TIME_BUFFER_SECS;
|
|
4617
4756
|
const endTime = now + durationSeconds;
|
|
4618
|
-
const
|
|
4619
|
-
|
|
4620
|
-
const salt = new DataView(saltBytes.buffer).getUint32(0).toString();
|
|
4621
|
-
const currentNonce = await contract.nonces(account.address);
|
|
4757
|
+
const counter = (await contract.get_counter(account.address)).toString();
|
|
4758
|
+
const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
|
|
4622
4759
|
const orderParams = {
|
|
4623
4760
|
offerer: account.address,
|
|
4761
|
+
marketplace: config.marketplaceContract,
|
|
4624
4762
|
offer: {
|
|
4625
4763
|
item_type: "ERC721",
|
|
4626
4764
|
token: nftContract,
|
|
4627
4765
|
identifier_or_criteria: tokenId,
|
|
4628
|
-
|
|
4629
|
-
end_amount: "1"
|
|
4766
|
+
amount: "1"
|
|
4630
4767
|
},
|
|
4631
4768
|
consideration: {
|
|
4632
4769
|
item_type: "ERC20",
|
|
4633
4770
|
token: token.address,
|
|
4634
4771
|
identifier_or_criteria: "0",
|
|
4635
|
-
|
|
4636
|
-
end_amount: priceWei,
|
|
4772
|
+
amount: priceWei,
|
|
4637
4773
|
recipient: account.address
|
|
4638
4774
|
},
|
|
4775
|
+
royalty_max_bps: royaltyMaxBps,
|
|
4639
4776
|
start_time: startTime.toString(),
|
|
4640
4777
|
end_time: endTime.toString(),
|
|
4641
|
-
salt,
|
|
4642
|
-
|
|
4778
|
+
salt: generateSalt(),
|
|
4779
|
+
counter
|
|
4643
4780
|
};
|
|
4644
4781
|
const chainId = getChainId();
|
|
4645
4782
|
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
|
|
@@ -4699,31 +4836,29 @@ async function makeOffer(account, params, config) {
|
|
|
4699
4836
|
const now = Math.floor(Date.now() / 1e3);
|
|
4700
4837
|
const startTime = now + START_TIME_BUFFER_SECS;
|
|
4701
4838
|
const endTime = now + durationSeconds;
|
|
4702
|
-
const
|
|
4703
|
-
|
|
4704
|
-
const salt = new DataView(saltBytes.buffer).getUint32(0).toString();
|
|
4705
|
-
const currentNonce = await contract.nonces(account.address);
|
|
4839
|
+
const counter = (await contract.get_counter(account.address)).toString();
|
|
4840
|
+
const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
|
|
4706
4841
|
const orderParams = {
|
|
4707
4842
|
offerer: account.address,
|
|
4843
|
+
marketplace: config.marketplaceContract,
|
|
4708
4844
|
offer: {
|
|
4709
4845
|
item_type: "ERC20",
|
|
4710
4846
|
token: token.address,
|
|
4711
4847
|
identifier_or_criteria: "0",
|
|
4712
|
-
|
|
4713
|
-
end_amount: priceWei
|
|
4848
|
+
amount: priceWei
|
|
4714
4849
|
},
|
|
4715
4850
|
consideration: {
|
|
4716
4851
|
item_type: "ERC721",
|
|
4717
4852
|
token: nftContract,
|
|
4718
4853
|
identifier_or_criteria: tokenId,
|
|
4719
|
-
|
|
4720
|
-
end_amount: "1",
|
|
4854
|
+
amount: "1",
|
|
4721
4855
|
recipient: account.address
|
|
4722
4856
|
},
|
|
4857
|
+
royalty_max_bps: royaltyMaxBps,
|
|
4723
4858
|
start_time: startTime.toString(),
|
|
4724
4859
|
end_time: endTime.toString(),
|
|
4725
|
-
salt,
|
|
4726
|
-
|
|
4860
|
+
salt: generateSalt(),
|
|
4861
|
+
counter
|
|
4727
4862
|
};
|
|
4728
4863
|
const chainId = getChainId();
|
|
4729
4864
|
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
|
|
@@ -4765,22 +4900,6 @@ async function makeOffer(account, params, config) {
|
|
|
4765
4900
|
async function fulfillOrder(account, params, config) {
|
|
4766
4901
|
const { orderHash, paymentToken, totalPrice } = params;
|
|
4767
4902
|
const { contract, provider } = makeContract(config);
|
|
4768
|
-
const currentNonce = await contract.nonces(account.address);
|
|
4769
|
-
const chainId = getChainId();
|
|
4770
|
-
const fulfillmentParams = {
|
|
4771
|
-
order_hash: orderHash,
|
|
4772
|
-
fulfiller: account.address,
|
|
4773
|
-
nonce: currentNonce.toString()
|
|
4774
|
-
};
|
|
4775
|
-
const typedData = stringifyBigInts(
|
|
4776
|
-
buildFulfillmentTypedData(fulfillmentParams, chainId)
|
|
4777
|
-
);
|
|
4778
|
-
const signature = await account.signMessage(typedData);
|
|
4779
|
-
const signatureArray = toSignatureArray(signature);
|
|
4780
|
-
const fulfillPayload = stringifyBigInts({
|
|
4781
|
-
fulfillment: fulfillmentParams,
|
|
4782
|
-
signature: signatureArray
|
|
4783
|
-
});
|
|
4784
4903
|
const totalPriceU256 = starknet.cairo.uint256(totalPrice);
|
|
4785
4904
|
const approveCall = {
|
|
4786
4905
|
contractAddress: paymentToken,
|
|
@@ -4791,7 +4910,7 @@ async function fulfillOrder(account, params, config) {
|
|
|
4791
4910
|
totalPriceU256.high.toString()
|
|
4792
4911
|
]
|
|
4793
4912
|
};
|
|
4794
|
-
const fulfillCall = contract.populate("fulfill_order", [
|
|
4913
|
+
const fulfillCall = contract.populate("fulfill_order", [orderHash]);
|
|
4795
4914
|
const feeCall = buildFeeCall(
|
|
4796
4915
|
{ surface: "marketplace", token: paymentToken, grossAmount: BigInt(totalPrice) },
|
|
4797
4916
|
config.feeConfig
|
|
@@ -4808,12 +4927,10 @@ async function fulfillOrder(account, params, config) {
|
|
|
4808
4927
|
async function cancelOrder(account, params, config) {
|
|
4809
4928
|
const { orderHash } = params;
|
|
4810
4929
|
const { contract, provider } = makeContract(config);
|
|
4811
|
-
const currentNonce = await contract.nonces(account.address);
|
|
4812
4930
|
const chainId = getChainId();
|
|
4813
4931
|
const cancelParams = {
|
|
4814
4932
|
order_hash: orderHash,
|
|
4815
|
-
offerer: account.address
|
|
4816
|
-
nonce: currentNonce.toString()
|
|
4933
|
+
offerer: account.address
|
|
4817
4934
|
};
|
|
4818
4935
|
const typedData = stringifyBigInts(
|
|
4819
4936
|
buildCancellationTypedData(cancelParams, chainId)
|
|
@@ -4884,29 +5001,9 @@ async function checkoutCart(account, items, config) {
|
|
|
4884
5001
|
]
|
|
4885
5002
|
};
|
|
4886
5003
|
});
|
|
4887
|
-
const
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
const fulfillCalls = [];
|
|
4891
|
-
for (let i = 0; i < items.length; i++) {
|
|
4892
|
-
const item = items[i];
|
|
4893
|
-
const nonce = (baseNonce + BigInt(i)).toString();
|
|
4894
|
-
const fulfillmentParams = {
|
|
4895
|
-
order_hash: item.orderHash,
|
|
4896
|
-
fulfiller: account.address,
|
|
4897
|
-
nonce
|
|
4898
|
-
};
|
|
4899
|
-
const typedData = stringifyBigInts(
|
|
4900
|
-
buildFulfillmentTypedData(fulfillmentParams, chainId)
|
|
4901
|
-
);
|
|
4902
|
-
const signature = await account.signMessage(typedData);
|
|
4903
|
-
const signatureArray = toSignatureArray(signature);
|
|
4904
|
-
const fulfillPayload = stringifyBigInts({
|
|
4905
|
-
fulfillment: fulfillmentParams,
|
|
4906
|
-
signature: signatureArray
|
|
4907
|
-
});
|
|
4908
|
-
fulfillCalls.push(contract.populate("fulfill_order", [fulfillPayload]));
|
|
4909
|
-
}
|
|
5004
|
+
const fulfillCalls = items.map(
|
|
5005
|
+
(item) => contract.populate("fulfill_order", [item.orderHash])
|
|
5006
|
+
);
|
|
4910
5007
|
const feeCalls = Array.from(tokenTotals.entries()).map(
|
|
4911
5008
|
([tokenAddr, totalWei]) => buildFeeCall(
|
|
4912
5009
|
{ surface: "marketplace", token: tokenAddr, grossAmount: totalWei },
|
|
@@ -4925,9 +5022,20 @@ async function getOrderDetails(orderHash, config) {
|
|
|
4925
5022
|
const { contract } = makeContract(config);
|
|
4926
5023
|
return contract.get_order_details(orderHash);
|
|
4927
5024
|
}
|
|
4928
|
-
async function
|
|
5025
|
+
async function getCounter(address, config) {
|
|
4929
5026
|
const { contract } = makeContract(config);
|
|
4930
|
-
return BigInt((await contract.
|
|
5027
|
+
return BigInt((await contract.get_counter(address)).toString());
|
|
5028
|
+
}
|
|
5029
|
+
async function incrementCounter(account, config) {
|
|
5030
|
+
const { contract, provider } = makeContract(config);
|
|
5031
|
+
const call = contract.populate("increment_counter", []);
|
|
5032
|
+
try {
|
|
5033
|
+
const tx = await account.execute(call);
|
|
5034
|
+
await provider.waitForTransaction(tx.transaction_hash);
|
|
5035
|
+
return { txHash: tx.transaction_hash };
|
|
5036
|
+
} catch (err) {
|
|
5037
|
+
throw new MedialaneError("Failed to increment counter", "TRANSACTION_FAILED", err);
|
|
5038
|
+
}
|
|
4931
5039
|
}
|
|
4932
5040
|
|
|
4933
5041
|
// src/marketplace/index.ts
|
|
@@ -4957,20 +5065,21 @@ var MarketplaceModule = class {
|
|
|
4957
5065
|
createCollection(account, params) {
|
|
4958
5066
|
return createCollection(account, params, this.config);
|
|
4959
5067
|
}
|
|
5068
|
+
/** Bulk-cancel: bump the caller's counter, invalidating all their open orders. */
|
|
5069
|
+
incrementCounter(account) {
|
|
5070
|
+
return incrementCounter(account, this.config);
|
|
5071
|
+
}
|
|
4960
5072
|
// ─── View calls ───────────────────────────────────────────────────────────
|
|
4961
5073
|
getOrderDetails(orderHash) {
|
|
4962
5074
|
return getOrderDetails(orderHash, this.config);
|
|
4963
5075
|
}
|
|
4964
|
-
|
|
4965
|
-
return
|
|
5076
|
+
getCounter(address) {
|
|
5077
|
+
return getCounter(address, this.config);
|
|
4966
5078
|
}
|
|
4967
5079
|
// ─── Typed data builders (for ChipiPay / custom signing flows) ───────────
|
|
4968
5080
|
buildListingTypedData(params, chainId) {
|
|
4969
5081
|
return buildOrderTypedData(params, chainId);
|
|
4970
5082
|
}
|
|
4971
|
-
buildFulfillmentTypedData(params, chainId) {
|
|
4972
|
-
return buildFulfillmentTypedData(params, chainId);
|
|
4973
|
-
}
|
|
4974
5083
|
buildCancellationTypedData(params, chainId) {
|
|
4975
5084
|
return buildCancellationTypedData(params, chainId);
|
|
4976
5085
|
}
|
|
@@ -5004,32 +5113,32 @@ async function createListing1155(account, params, config) {
|
|
|
5004
5113
|
const priceWei = parseAmount(pricePerUnit, token.decimals);
|
|
5005
5114
|
const now = Math.floor(Date.now() / 1e3);
|
|
5006
5115
|
const endTime = now + durationSeconds;
|
|
5007
|
-
const saltBytes = new Uint8Array(4);
|
|
5008
|
-
crypto.getRandomValues(saltBytes);
|
|
5009
|
-
const salt = new DataView(saltBytes.buffer).getUint32(0).toString();
|
|
5010
|
-
const currentNonce = await contract.nonces(account.address);
|
|
5011
5116
|
const chainId = getChainId();
|
|
5117
|
+
const counter = (await contract.get_counter(account.address)).toString();
|
|
5118
|
+
const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
|
|
5012
5119
|
const orderParams = {
|
|
5013
5120
|
offerer: account.address,
|
|
5121
|
+
marketplace: config.marketplace1155Contract,
|
|
5014
5122
|
offer: {
|
|
5015
5123
|
item_type: "ERC1155",
|
|
5016
5124
|
token: nftContract,
|
|
5017
5125
|
identifier_or_criteria: tokenId,
|
|
5018
|
-
|
|
5019
|
-
|
|
5126
|
+
amount
|
|
5127
|
+
// ERC-1155 leg amount = unit quantity
|
|
5020
5128
|
},
|
|
5021
5129
|
consideration: {
|
|
5022
5130
|
item_type: "ERC20",
|
|
5023
5131
|
token: token.address,
|
|
5024
5132
|
identifier_or_criteria: "0",
|
|
5025
|
-
|
|
5026
|
-
|
|
5133
|
+
amount: priceWei,
|
|
5134
|
+
// payment leg amount = price PER UNIT
|
|
5027
5135
|
recipient: account.address
|
|
5028
5136
|
},
|
|
5137
|
+
royalty_max_bps: royaltyMaxBps,
|
|
5029
5138
|
start_time: (now + START_TIME_BUFFER_SECS).toString(),
|
|
5030
5139
|
end_time: endTime.toString(),
|
|
5031
|
-
salt,
|
|
5032
|
-
|
|
5140
|
+
salt: generateSalt(),
|
|
5141
|
+
counter
|
|
5033
5142
|
};
|
|
5034
5143
|
const typedData = stringifyBigInts(
|
|
5035
5144
|
build1155OrderTypedData(orderParams, chainId)
|
|
@@ -5081,23 +5190,6 @@ async function fulfillOrder1155(account, params, config) {
|
|
|
5081
5190
|
const { orderHash, paymentToken, totalPrice, quantity = "1" } = params;
|
|
5082
5191
|
const contract = getContract(config);
|
|
5083
5192
|
const provider = getProvider(config);
|
|
5084
|
-
const chainId = getChainId();
|
|
5085
|
-
const currentNonce = await contract.nonces(account.address);
|
|
5086
|
-
const fulfillmentParams = {
|
|
5087
|
-
order_hash: orderHash,
|
|
5088
|
-
fulfiller: account.address,
|
|
5089
|
-
quantity,
|
|
5090
|
-
nonce: currentNonce.toString()
|
|
5091
|
-
};
|
|
5092
|
-
const typedData = stringifyBigInts(
|
|
5093
|
-
build1155FulfillmentTypedData(fulfillmentParams, chainId)
|
|
5094
|
-
);
|
|
5095
|
-
const signature = await account.signMessage(typedData);
|
|
5096
|
-
const signatureArray = toSignatureArray(signature);
|
|
5097
|
-
const fulfillPayload = stringifyBigInts({
|
|
5098
|
-
fulfillment: fulfillmentParams,
|
|
5099
|
-
signature: signatureArray
|
|
5100
|
-
});
|
|
5101
5193
|
const totalPriceU256 = starknet.cairo.uint256(totalPrice);
|
|
5102
5194
|
const approveCall = {
|
|
5103
5195
|
contractAddress: paymentToken,
|
|
@@ -5108,7 +5200,7 @@ async function fulfillOrder1155(account, params, config) {
|
|
|
5108
5200
|
totalPriceU256.high.toString()
|
|
5109
5201
|
]
|
|
5110
5202
|
};
|
|
5111
|
-
const fulfillCall = contract.populate("fulfill_order", [
|
|
5203
|
+
const fulfillCall = contract.populate("fulfill_order", [orderHash, quantity]);
|
|
5112
5204
|
try {
|
|
5113
5205
|
const tx = await account.execute([approveCall, fulfillCall]);
|
|
5114
5206
|
await provider.waitForTransaction(tx.transaction_hash);
|
|
@@ -5122,11 +5214,9 @@ async function cancelOrder1155(account, params, config) {
|
|
|
5122
5214
|
const contract = getContract(config);
|
|
5123
5215
|
const provider = getProvider(config);
|
|
5124
5216
|
const chainId = getChainId();
|
|
5125
|
-
const currentNonce = await contract.nonces(account.address);
|
|
5126
5217
|
const cancelParams = {
|
|
5127
5218
|
order_hash: orderHash,
|
|
5128
|
-
offerer: account.address
|
|
5129
|
-
nonce: currentNonce.toString()
|
|
5219
|
+
offerer: account.address
|
|
5130
5220
|
};
|
|
5131
5221
|
const typedData = stringifyBigInts(
|
|
5132
5222
|
build1155CancellationTypedData(cancelParams, chainId)
|
|
@@ -5162,31 +5252,31 @@ async function makeOffer1155(account, params, config) {
|
|
|
5162
5252
|
const priceWei = parseAmount(price, token.decimals);
|
|
5163
5253
|
const now = Math.floor(Date.now() / 1e3);
|
|
5164
5254
|
const endTime = now + durationSeconds;
|
|
5165
|
-
const
|
|
5166
|
-
|
|
5167
|
-
const salt = new DataView(saltBytes.buffer).getUint32(0).toString();
|
|
5168
|
-
const currentNonce = await contract.nonces(account.address);
|
|
5255
|
+
const counter = (await contract.get_counter(account.address)).toString();
|
|
5256
|
+
const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
|
|
5169
5257
|
const orderParams = {
|
|
5170
5258
|
offerer: account.address,
|
|
5259
|
+
marketplace: config.marketplace1155Contract,
|
|
5171
5260
|
offer: {
|
|
5172
5261
|
item_type: "ERC20",
|
|
5173
5262
|
token: token.address,
|
|
5174
5263
|
identifier_or_criteria: "0",
|
|
5175
|
-
|
|
5176
|
-
|
|
5264
|
+
amount: priceWei
|
|
5265
|
+
// price PER UNIT
|
|
5177
5266
|
},
|
|
5178
5267
|
consideration: {
|
|
5179
5268
|
item_type: "ERC1155",
|
|
5180
5269
|
token: nftContract,
|
|
5181
5270
|
identifier_or_criteria: tokenId,
|
|
5182
|
-
|
|
5183
|
-
|
|
5271
|
+
amount,
|
|
5272
|
+
// unit quantity
|
|
5184
5273
|
recipient: account.address
|
|
5185
5274
|
},
|
|
5275
|
+
royalty_max_bps: royaltyMaxBps,
|
|
5186
5276
|
start_time: (now + START_TIME_BUFFER_SECS).toString(),
|
|
5187
5277
|
end_time: endTime.toString(),
|
|
5188
|
-
salt,
|
|
5189
|
-
|
|
5278
|
+
salt: generateSalt(),
|
|
5279
|
+
counter
|
|
5190
5280
|
};
|
|
5191
5281
|
const typedData = stringifyBigInts(
|
|
5192
5282
|
build1155OrderTypedData(orderParams, chainId)
|
|
@@ -5207,7 +5297,8 @@ async function makeOffer1155(account, params, config) {
|
|
|
5207
5297
|
},
|
|
5208
5298
|
signature: signatureArray
|
|
5209
5299
|
});
|
|
5210
|
-
const
|
|
5300
|
+
const totalWei = BigInt(priceWei) * BigInt(amount);
|
|
5301
|
+
const amountU256 = starknet.cairo.uint256(totalWei.toString());
|
|
5211
5302
|
const approveCall = {
|
|
5212
5303
|
contractAddress: token.address,
|
|
5213
5304
|
entrypoint: "approve",
|
|
@@ -5247,31 +5338,9 @@ async function checkoutCart1155(account, items, config) {
|
|
|
5247
5338
|
]
|
|
5248
5339
|
};
|
|
5249
5340
|
});
|
|
5250
|
-
const
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
const fulfillCalls = [];
|
|
5254
|
-
for (let i = 0; i < items.length; i++) {
|
|
5255
|
-
const item = items[i];
|
|
5256
|
-
const nonce = (baseNonce + BigInt(i)).toString();
|
|
5257
|
-
const quantity = item.quantity ?? "1";
|
|
5258
|
-
const fulfillmentParams = {
|
|
5259
|
-
order_hash: item.orderHash,
|
|
5260
|
-
fulfiller: account.address,
|
|
5261
|
-
quantity,
|
|
5262
|
-
nonce
|
|
5263
|
-
};
|
|
5264
|
-
const typedData = stringifyBigInts(
|
|
5265
|
-
build1155FulfillmentTypedData(fulfillmentParams, chainId)
|
|
5266
|
-
);
|
|
5267
|
-
const signature = await account.signMessage(typedData);
|
|
5268
|
-
const signatureArray = toSignatureArray(signature);
|
|
5269
|
-
const fulfillPayload = stringifyBigInts({
|
|
5270
|
-
fulfillment: fulfillmentParams,
|
|
5271
|
-
signature: signatureArray
|
|
5272
|
-
});
|
|
5273
|
-
fulfillCalls.push(contract.populate("fulfill_order", [fulfillPayload]));
|
|
5274
|
-
}
|
|
5341
|
+
const fulfillCalls = items.map(
|
|
5342
|
+
(item) => contract.populate("fulfill_order", [item.orderHash, item.quantity ?? "1"])
|
|
5343
|
+
);
|
|
5275
5344
|
try {
|
|
5276
5345
|
const tx = await account.execute([...approveCalls, ...fulfillCalls]);
|
|
5277
5346
|
await provider.waitForTransaction(tx.transaction_hash);
|
|
@@ -5284,9 +5353,21 @@ async function getOrderDetails1155(orderHash, config) {
|
|
|
5284
5353
|
const contract = getContract(config);
|
|
5285
5354
|
return contract.get_order_details(orderHash);
|
|
5286
5355
|
}
|
|
5287
|
-
async function
|
|
5356
|
+
async function getCounter1155(address, config) {
|
|
5357
|
+
const contract = getContract(config);
|
|
5358
|
+
return BigInt((await contract.get_counter(address)).toString());
|
|
5359
|
+
}
|
|
5360
|
+
async function incrementCounter1155(account, config) {
|
|
5288
5361
|
const contract = getContract(config);
|
|
5289
|
-
|
|
5362
|
+
const provider = getProvider(config);
|
|
5363
|
+
const call = contract.populate("increment_counter", []);
|
|
5364
|
+
try {
|
|
5365
|
+
const tx = await account.execute(call);
|
|
5366
|
+
await provider.waitForTransaction(tx.transaction_hash);
|
|
5367
|
+
return { txHash: tx.transaction_hash };
|
|
5368
|
+
} catch (err) {
|
|
5369
|
+
throw new MedialaneError("Failed to increment counter (1155)", "TRANSACTION_FAILED", err);
|
|
5370
|
+
}
|
|
5290
5371
|
}
|
|
5291
5372
|
|
|
5292
5373
|
// src/marketplace1155/index.ts
|
|
@@ -5329,20 +5410,21 @@ var Medialane1155Module = class {
|
|
|
5329
5410
|
checkoutCart(account, items) {
|
|
5330
5411
|
return checkoutCart1155(account, items, this.config);
|
|
5331
5412
|
}
|
|
5413
|
+
/** Bulk-cancel on the 1155 venue: bump the caller's counter. */
|
|
5414
|
+
incrementCounter(account) {
|
|
5415
|
+
return incrementCounter1155(account, this.config);
|
|
5416
|
+
}
|
|
5332
5417
|
// ─── View calls ───────────────────────────────────────────────────────────
|
|
5333
5418
|
getOrderDetails(orderHash) {
|
|
5334
5419
|
return getOrderDetails1155(orderHash, this.config);
|
|
5335
5420
|
}
|
|
5336
|
-
|
|
5337
|
-
return
|
|
5421
|
+
getCounter(address) {
|
|
5422
|
+
return getCounter1155(address, this.config);
|
|
5338
5423
|
}
|
|
5339
5424
|
// ─── Typed data builders (for ChipiPay / custom signing flows) ───────────
|
|
5340
5425
|
buildListingTypedData(params, chainId) {
|
|
5341
5426
|
return build1155OrderTypedData(params, chainId);
|
|
5342
5427
|
}
|
|
5343
|
-
buildFulfillmentTypedData(params, chainId) {
|
|
5344
|
-
return build1155FulfillmentTypedData(params, chainId);
|
|
5345
|
-
}
|
|
5346
5428
|
buildCancellationTypedData(params, chainId) {
|
|
5347
5429
|
return build1155CancellationTypedData(params, chainId);
|
|
5348
5430
|
}
|
|
@@ -6485,11 +6567,9 @@ exports.PopService = PopService;
|
|
|
6485
6567
|
exports.SUPPORTED_NETWORKS = SUPPORTED_NETWORKS;
|
|
6486
6568
|
exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
|
|
6487
6569
|
exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
6488
|
-
exports.build1155FulfillmentTypedData = build1155FulfillmentTypedData;
|
|
6489
6570
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|
|
6490
6571
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|
|
6491
6572
|
exports.buildFeeCall = buildFeeCall;
|
|
6492
|
-
exports.buildFulfillmentTypedData = buildFulfillmentTypedData;
|
|
6493
6573
|
exports.buildOrderTypedData = buildOrderTypedData;
|
|
6494
6574
|
exports.encodeByteArray = encodeByteArray;
|
|
6495
6575
|
exports.formatAmount = formatAmount;
|