@medialane/sdk 0.60.0 → 0.62.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 CHANGED
@@ -5821,26 +5821,8 @@ var CreatorCoinFactoryABI = [{ "type": "impl", "name": "FactoryImpl", "interface
5821
5821
  var IPTicketCollectionABI = [
5822
5822
  {
5823
5823
  "type": "impl",
5824
- "name": "ERC721MetadataImpl",
5825
- "interface_name": "openzeppelin_token::erc721::interface::IERC721Metadata"
5826
- },
5827
- {
5828
- "type": "struct",
5829
- "name": "core::byte_array::ByteArray",
5830
- "members": [
5831
- {
5832
- "name": "data",
5833
- "type": "core::array::Array::<core::bytes_31::bytes31>"
5834
- },
5835
- {
5836
- "name": "pending_word",
5837
- "type": "core::felt252"
5838
- },
5839
- {
5840
- "name": "pending_word_len",
5841
- "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
5842
- }
5843
- ]
5824
+ "name": "ERC1155MetadataURIImpl",
5825
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155MetadataURI"
5844
5826
  },
5845
5827
  {
5846
5828
  "type": "struct",
@@ -5857,64 +5839,33 @@ var IPTicketCollectionABI = [
5857
5839
  ]
5858
5840
  },
5859
5841
  {
5860
- "type": "interface",
5861
- "name": "openzeppelin_token::erc721::interface::IERC721Metadata",
5862
- "items": [
5842
+ "type": "struct",
5843
+ "name": "core::byte_array::ByteArray",
5844
+ "members": [
5863
5845
  {
5864
- "type": "function",
5865
- "name": "name",
5866
- "inputs": [],
5867
- "outputs": [
5868
- {
5869
- "type": "core::byte_array::ByteArray"
5870
- }
5871
- ],
5872
- "state_mutability": "view"
5846
+ "name": "data",
5847
+ "type": "core::array::Array::<core::bytes_31::bytes31>"
5873
5848
  },
5874
5849
  {
5875
- "type": "function",
5876
- "name": "symbol",
5877
- "inputs": [],
5878
- "outputs": [
5879
- {
5880
- "type": "core::byte_array::ByteArray"
5881
- }
5882
- ],
5883
- "state_mutability": "view"
5850
+ "name": "pending_word",
5851
+ "type": "core::felt252"
5884
5852
  },
5885
5853
  {
5886
- "type": "function",
5887
- "name": "token_uri",
5888
- "inputs": [
5889
- {
5890
- "name": "token_id",
5891
- "type": "core::integer::u256"
5892
- }
5893
- ],
5894
- "outputs": [
5895
- {
5896
- "type": "core::byte_array::ByteArray"
5897
- }
5898
- ],
5899
- "state_mutability": "view"
5854
+ "name": "pending_word_len",
5855
+ "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
5900
5856
  }
5901
5857
  ]
5902
5858
  },
5903
- {
5904
- "type": "impl",
5905
- "name": "ERC721MetadataCamelOnlyImpl",
5906
- "interface_name": "openzeppelin_token::erc721::interface::IERC721MetadataCamelOnly"
5907
- },
5908
5859
  {
5909
5860
  "type": "interface",
5910
- "name": "openzeppelin_token::erc721::interface::IERC721MetadataCamelOnly",
5861
+ "name": "openzeppelin_token::erc1155::interface::IERC1155MetadataURI",
5911
5862
  "items": [
5912
5863
  {
5913
5864
  "type": "function",
5914
- "name": "tokenURI",
5865
+ "name": "uri",
5915
5866
  "inputs": [
5916
5867
  {
5917
- "name": "tokenId",
5868
+ "name": "token_id",
5918
5869
  "type": "core::integer::u256"
5919
5870
  }
5920
5871
  ],
@@ -5929,16 +5880,16 @@ var IPTicketCollectionABI = [
5929
5880
  },
5930
5881
  {
5931
5882
  "type": "impl",
5932
- "name": "IPTicketImpl",
5883
+ "name": "IPTicketCollectionImpl",
5933
5884
  "interface_name": "ip_ticket::interface::IIPTicketCollection"
5934
5885
  },
5935
5886
  {
5936
5887
  "type": "enum",
5937
- "name": "core::option::Option::<core::starknet::contract_address::ContractAddress>",
5888
+ "name": "core::option::Option::<core::integer::u64>",
5938
5889
  "variants": [
5939
5890
  {
5940
5891
  "name": "Some",
5941
- "type": "core::starknet::contract_address::ContractAddress"
5892
+ "type": "core::integer::u64"
5942
5893
  },
5943
5894
  {
5944
5895
  "name": "None",
@@ -5962,16 +5913,12 @@ var IPTicketCollectionABI = [
5962
5913
  },
5963
5914
  {
5964
5915
  "type": "struct",
5965
- "name": "ip_ticket::types::TicketCollection",
5916
+ "name": "ip_ticket::types::EventRecord",
5966
5917
  "members": [
5967
5918
  {
5968
5919
  "name": "creator",
5969
5920
  "type": "core::starknet::contract_address::ContractAddress"
5970
5921
  },
5971
- {
5972
- "name": "price",
5973
- "type": "core::integer::u256"
5974
- },
5975
5922
  {
5976
5923
  "name": "max_supply",
5977
5924
  "type": "core::integer::u256"
@@ -5981,16 +5928,16 @@ var IPTicketCollectionABI = [
5981
5928
  "type": "core::integer::u256"
5982
5929
  },
5983
5930
  {
5984
- "name": "expiration",
5985
- "type": "core::integer::u64"
5931
+ "name": "start_time",
5932
+ "type": "core::option::Option::<core::integer::u64>"
5986
5933
  },
5987
5934
  {
5988
- "name": "royalty_bps",
5989
- "type": "core::integer::u256"
5935
+ "name": "end_time",
5936
+ "type": "core::option::Option::<core::integer::u64>"
5990
5937
  },
5991
5938
  {
5992
- "name": "payment_token",
5993
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>"
5939
+ "name": "royalty_bps",
5940
+ "type": "core::integer::u16"
5994
5941
  },
5995
5942
  {
5996
5943
  "name": "metadata_uri",
@@ -6002,71 +5949,29 @@ var IPTicketCollectionABI = [
6002
5949
  }
6003
5950
  ]
6004
5951
  },
6005
- {
6006
- "type": "struct",
6007
- "name": "ip_ticket::types::TicketData",
6008
- "members": [
6009
- {
6010
- "name": "token_id",
6011
- "type": "core::integer::u256"
6012
- },
6013
- {
6014
- "name": "owner",
6015
- "type": "core::starknet::contract_address::ContractAddress"
6016
- },
6017
- {
6018
- "name": "collection_id",
6019
- "type": "core::integer::u256"
6020
- },
6021
- {
6022
- "name": "creator",
6023
- "type": "core::starknet::contract_address::ContractAddress"
6024
- },
6025
- {
6026
- "name": "metadata_uri",
6027
- "type": "core::byte_array::ByteArray"
6028
- },
6029
- {
6030
- "name": "expiration",
6031
- "type": "core::integer::u64"
6032
- },
6033
- {
6034
- "name": "redeemed",
6035
- "type": "core::bool"
6036
- },
6037
- {
6038
- "name": "valid",
6039
- "type": "core::bool"
6040
- }
6041
- ]
6042
- },
6043
5952
  {
6044
5953
  "type": "interface",
6045
5954
  "name": "ip_ticket::interface::IIPTicketCollection",
6046
5955
  "items": [
6047
5956
  {
6048
5957
  "type": "function",
6049
- "name": "create_ticket_collection",
5958
+ "name": "create_event",
6050
5959
  "inputs": [
6051
- {
6052
- "name": "price",
6053
- "type": "core::integer::u256"
6054
- },
6055
5960
  {
6056
5961
  "name": "max_supply",
6057
5962
  "type": "core::integer::u256"
6058
5963
  },
6059
5964
  {
6060
- "name": "expiration",
6061
- "type": "core::integer::u64"
5965
+ "name": "start_time",
5966
+ "type": "core::option::Option::<core::integer::u64>"
6062
5967
  },
6063
5968
  {
6064
- "name": "royalty_bps",
6065
- "type": "core::integer::u256"
5969
+ "name": "end_time",
5970
+ "type": "core::option::Option::<core::integer::u64>"
6066
5971
  },
6067
5972
  {
6068
- "name": "payment_token",
6069
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>"
5973
+ "name": "royalty_bps",
5974
+ "type": "core::integer::u16"
6070
5975
  },
6071
5976
  {
6072
5977
  "name": "metadata_uri",
@@ -6082,43 +5987,35 @@ var IPTicketCollectionABI = [
6082
5987
  },
6083
5988
  {
6084
5989
  "type": "function",
6085
- "name": "set_collection_active",
5990
+ "name": "mint",
6086
5991
  "inputs": [
6087
5992
  {
6088
- "name": "collection_id",
6089
- "type": "core::integer::u256"
5993
+ "name": "to",
5994
+ "type": "core::starknet::contract_address::ContractAddress"
6090
5995
  },
6091
5996
  {
6092
- "name": "active",
6093
- "type": "core::bool"
6094
- }
6095
- ],
6096
- "outputs": [],
6097
- "state_mutability": "external"
6098
- },
6099
- {
6100
- "type": "function",
6101
- "name": "mint_ticket",
6102
- "inputs": [
6103
- {
6104
- "name": "collection_id",
5997
+ "name": "token_id",
6105
5998
  "type": "core::integer::u256"
6106
- }
6107
- ],
6108
- "outputs": [
5999
+ },
6109
6000
  {
6001
+ "name": "amount",
6110
6002
  "type": "core::integer::u256"
6111
6003
  }
6112
6004
  ],
6005
+ "outputs": [],
6113
6006
  "state_mutability": "external"
6114
6007
  },
6115
6008
  {
6116
6009
  "type": "function",
6117
- "name": "redeem_ticket",
6010
+ "name": "pause_event",
6118
6011
  "inputs": [
6119
6012
  {
6120
6013
  "name": "token_id",
6121
6014
  "type": "core::integer::u256"
6015
+ },
6016
+ {
6017
+ "name": "active",
6018
+ "type": "core::bool"
6122
6019
  }
6123
6020
  ],
6124
6021
  "outputs": [],
@@ -6126,15 +6023,15 @@ var IPTicketCollectionABI = [
6126
6023
  },
6127
6024
  {
6128
6025
  "type": "function",
6129
- "name": "has_valid_ticket",
6026
+ "name": "is_valid",
6130
6027
  "inputs": [
6131
6028
  {
6132
- "name": "user",
6133
- "type": "core::starknet::contract_address::ContractAddress"
6029
+ "name": "token_id",
6030
+ "type": "core::integer::u256"
6134
6031
  },
6135
6032
  {
6136
- "name": "collection_id",
6137
- "type": "core::integer::u256"
6033
+ "name": "holder",
6034
+ "type": "core::starknet::contract_address::ContractAddress"
6138
6035
  }
6139
6036
  ],
6140
6037
  "outputs": [
@@ -6146,23 +6043,7 @@ var IPTicketCollectionABI = [
6146
6043
  },
6147
6044
  {
6148
6045
  "type": "function",
6149
- "name": "get_ticket_collection",
6150
- "inputs": [
6151
- {
6152
- "name": "collection_id",
6153
- "type": "core::integer::u256"
6154
- }
6155
- ],
6156
- "outputs": [
6157
- {
6158
- "type": "ip_ticket::types::TicketCollection"
6159
- }
6160
- ],
6161
- "state_mutability": "view"
6162
- },
6163
- {
6164
- "type": "function",
6165
- "name": "get_ticket_data",
6046
+ "name": "get_event",
6166
6047
  "inputs": [
6167
6048
  {
6168
6049
  "name": "token_id",
@@ -6171,72 +6052,34 @@ var IPTicketCollectionABI = [
6171
6052
  ],
6172
6053
  "outputs": [
6173
6054
  {
6174
- "type": "ip_ticket::types::TicketData"
6055
+ "type": "ip_ticket::types::EventRecord"
6175
6056
  }
6176
6057
  ],
6177
6058
  "state_mutability": "view"
6178
6059
  },
6179
6060
  {
6180
6061
  "type": "function",
6181
- "name": "get_ticket_collection_id",
6062
+ "name": "royalty_info",
6182
6063
  "inputs": [
6183
6064
  {
6184
6065
  "name": "token_id",
6185
6066
  "type": "core::integer::u256"
6186
- }
6187
- ],
6188
- "outputs": [
6189
- {
6190
- "type": "core::integer::u256"
6191
- }
6192
- ],
6193
- "state_mutability": "view"
6194
- },
6195
- {
6196
- "type": "function",
6197
- "name": "get_active_ticket_balance",
6198
- "inputs": [
6199
- {
6200
- "name": "user",
6201
- "type": "core::starknet::contract_address::ContractAddress"
6202
6067
  },
6203
6068
  {
6204
- "name": "collection_id",
6205
- "type": "core::integer::u256"
6206
- }
6207
- ],
6208
- "outputs": [
6209
- {
6210
- "type": "core::integer::u256"
6211
- }
6212
- ],
6213
- "state_mutability": "view"
6214
- },
6215
- {
6216
- "type": "function",
6217
- "name": "get_last_collection_id",
6218
- "inputs": [],
6219
- "outputs": [
6220
- {
6069
+ "name": "sale_price",
6221
6070
  "type": "core::integer::u256"
6222
6071
  }
6223
6072
  ],
6224
- "state_mutability": "view"
6225
- },
6226
- {
6227
- "type": "function",
6228
- "name": "total_supply",
6229
- "inputs": [],
6230
6073
  "outputs": [
6231
6074
  {
6232
- "type": "core::integer::u256"
6075
+ "type": "(core::starknet::contract_address::ContractAddress, core::integer::u256)"
6233
6076
  }
6234
6077
  ],
6235
6078
  "state_mutability": "view"
6236
6079
  },
6237
6080
  {
6238
6081
  "type": "function",
6239
- "name": "royalty_info",
6082
+ "name": "royaltyInfo",
6240
6083
  "inputs": [
6241
6084
  {
6242
6085
  "name": "token_id",
@@ -6256,20 +6099,11 @@ var IPTicketCollectionABI = [
6256
6099
  },
6257
6100
  {
6258
6101
  "type": "function",
6259
- "name": "royaltyInfo",
6260
- "inputs": [
6261
- {
6262
- "name": "token_id",
6263
- "type": "core::integer::u256"
6264
- },
6265
- {
6266
- "name": "sale_price",
6267
- "type": "core::integer::u256"
6268
- }
6269
- ],
6102
+ "name": "version",
6103
+ "inputs": [],
6270
6104
  "outputs": [
6271
6105
  {
6272
- "type": "(core::starknet::contract_address::ContractAddress, core::integer::u256)"
6106
+ "type": "core::byte_array::ByteArray"
6273
6107
  }
6274
6108
  ],
6275
6109
  "state_mutability": "view"
@@ -6278,8 +6112,28 @@ var IPTicketCollectionABI = [
6278
6112
  },
6279
6113
  {
6280
6114
  "type": "impl",
6281
- "name": "ERC721Impl",
6282
- "interface_name": "openzeppelin_token::erc721::interface::IERC721"
6115
+ "name": "ERC1155Impl",
6116
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155"
6117
+ },
6118
+ {
6119
+ "type": "struct",
6120
+ "name": "core::array::Span::<core::starknet::contract_address::ContractAddress>",
6121
+ "members": [
6122
+ {
6123
+ "name": "snapshot",
6124
+ "type": "@core::array::Array::<core::starknet::contract_address::ContractAddress>"
6125
+ }
6126
+ ]
6127
+ },
6128
+ {
6129
+ "type": "struct",
6130
+ "name": "core::array::Span::<core::integer::u256>",
6131
+ "members": [
6132
+ {
6133
+ "name": "snapshot",
6134
+ "type": "@core::array::Array::<core::integer::u256>"
6135
+ }
6136
+ ]
6283
6137
  },
6284
6138
  {
6285
6139
  "type": "struct",
@@ -6293,7 +6147,7 @@ var IPTicketCollectionABI = [
6293
6147
  },
6294
6148
  {
6295
6149
  "type": "interface",
6296
- "name": "openzeppelin_token::erc721::interface::IERC721",
6150
+ "name": "openzeppelin_token::erc1155::interface::IERC1155",
6297
6151
  "items": [
6298
6152
  {
6299
6153
  "type": "function",
@@ -6302,6 +6156,10 @@ var IPTicketCollectionABI = [
6302
6156
  {
6303
6157
  "name": "account",
6304
6158
  "type": "core::starknet::contract_address::ContractAddress"
6159
+ },
6160
+ {
6161
+ "name": "token_id",
6162
+ "type": "core::integer::u256"
6305
6163
  }
6306
6164
  ],
6307
6165
  "outputs": [
@@ -6313,16 +6171,20 @@ var IPTicketCollectionABI = [
6313
6171
  },
6314
6172
  {
6315
6173
  "type": "function",
6316
- "name": "owner_of",
6174
+ "name": "balance_of_batch",
6317
6175
  "inputs": [
6318
6176
  {
6319
- "name": "token_id",
6320
- "type": "core::integer::u256"
6177
+ "name": "accounts",
6178
+ "type": "core::array::Span::<core::starknet::contract_address::ContractAddress>"
6179
+ },
6180
+ {
6181
+ "name": "token_ids",
6182
+ "type": "core::array::Span::<core::integer::u256>"
6321
6183
  }
6322
6184
  ],
6323
6185
  "outputs": [
6324
6186
  {
6325
- "type": "core::starknet::contract_address::ContractAddress"
6187
+ "type": "core::array::Span::<core::integer::u256>"
6326
6188
  }
6327
6189
  ],
6328
6190
  "state_mutability": "view"
@@ -6343,6 +6205,10 @@ var IPTicketCollectionABI = [
6343
6205
  "name": "token_id",
6344
6206
  "type": "core::integer::u256"
6345
6207
  },
6208
+ {
6209
+ "name": "value",
6210
+ "type": "core::integer::u256"
6211
+ },
6346
6212
  {
6347
6213
  "name": "data",
6348
6214
  "type": "core::array::Span::<core::felt252>"
@@ -6353,7 +6219,7 @@ var IPTicketCollectionABI = [
6353
6219
  },
6354
6220
  {
6355
6221
  "type": "function",
6356
- "name": "transfer_from",
6222
+ "name": "safe_batch_transfer_from",
6357
6223
  "inputs": [
6358
6224
  {
6359
6225
  "name": "from",
@@ -6364,24 +6230,16 @@ var IPTicketCollectionABI = [
6364
6230
  "type": "core::starknet::contract_address::ContractAddress"
6365
6231
  },
6366
6232
  {
6367
- "name": "token_id",
6368
- "type": "core::integer::u256"
6369
- }
6370
- ],
6371
- "outputs": [],
6372
- "state_mutability": "external"
6373
- },
6374
- {
6375
- "type": "function",
6376
- "name": "approve",
6377
- "inputs": [
6233
+ "name": "token_ids",
6234
+ "type": "core::array::Span::<core::integer::u256>"
6235
+ },
6378
6236
  {
6379
- "name": "to",
6380
- "type": "core::starknet::contract_address::ContractAddress"
6237
+ "name": "values",
6238
+ "type": "core::array::Span::<core::integer::u256>"
6381
6239
  },
6382
6240
  {
6383
- "name": "token_id",
6384
- "type": "core::integer::u256"
6241
+ "name": "data",
6242
+ "type": "core::array::Span::<core::felt252>"
6385
6243
  }
6386
6244
  ],
6387
6245
  "outputs": [],
@@ -6389,66 +6247,50 @@ var IPTicketCollectionABI = [
6389
6247
  },
6390
6248
  {
6391
6249
  "type": "function",
6392
- "name": "set_approval_for_all",
6250
+ "name": "is_approved_for_all",
6393
6251
  "inputs": [
6394
6252
  {
6395
- "name": "operator",
6253
+ "name": "owner",
6396
6254
  "type": "core::starknet::contract_address::ContractAddress"
6397
6255
  },
6398
6256
  {
6399
- "name": "approved",
6400
- "type": "core::bool"
6401
- }
6402
- ],
6403
- "outputs": [],
6404
- "state_mutability": "external"
6405
- },
6406
- {
6407
- "type": "function",
6408
- "name": "get_approved",
6409
- "inputs": [
6410
- {
6411
- "name": "token_id",
6412
- "type": "core::integer::u256"
6257
+ "name": "operator",
6258
+ "type": "core::starknet::contract_address::ContractAddress"
6413
6259
  }
6414
6260
  ],
6415
6261
  "outputs": [
6416
6262
  {
6417
- "type": "core::starknet::contract_address::ContractAddress"
6263
+ "type": "core::bool"
6418
6264
  }
6419
6265
  ],
6420
6266
  "state_mutability": "view"
6421
6267
  },
6422
6268
  {
6423
6269
  "type": "function",
6424
- "name": "is_approved_for_all",
6270
+ "name": "set_approval_for_all",
6425
6271
  "inputs": [
6426
- {
6427
- "name": "owner",
6428
- "type": "core::starknet::contract_address::ContractAddress"
6429
- },
6430
6272
  {
6431
6273
  "name": "operator",
6432
6274
  "type": "core::starknet::contract_address::ContractAddress"
6433
- }
6434
- ],
6435
- "outputs": [
6275
+ },
6436
6276
  {
6277
+ "name": "approved",
6437
6278
  "type": "core::bool"
6438
6279
  }
6439
6280
  ],
6440
- "state_mutability": "view"
6281
+ "outputs": [],
6282
+ "state_mutability": "external"
6441
6283
  }
6442
6284
  ]
6443
6285
  },
6444
6286
  {
6445
6287
  "type": "impl",
6446
- "name": "ERC721CamelOnly",
6447
- "interface_name": "openzeppelin_token::erc721::interface::IERC721CamelOnly"
6288
+ "name": "ERC1155CamelImpl",
6289
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155Camel"
6448
6290
  },
6449
6291
  {
6450
6292
  "type": "interface",
6451
- "name": "openzeppelin_token::erc721::interface::IERC721CamelOnly",
6293
+ "name": "openzeppelin_token::erc1155::interface::IERC1155Camel",
6452
6294
  "items": [
6453
6295
  {
6454
6296
  "type": "function",
@@ -6457,6 +6299,10 @@ var IPTicketCollectionABI = [
6457
6299
  {
6458
6300
  "name": "account",
6459
6301
  "type": "core::starknet::contract_address::ContractAddress"
6302
+ },
6303
+ {
6304
+ "name": "tokenId",
6305
+ "type": "core::integer::u256"
6460
6306
  }
6461
6307
  ],
6462
6308
  "outputs": [
@@ -6468,16 +6314,20 @@ var IPTicketCollectionABI = [
6468
6314
  },
6469
6315
  {
6470
6316
  "type": "function",
6471
- "name": "ownerOf",
6317
+ "name": "balanceOfBatch",
6472
6318
  "inputs": [
6473
6319
  {
6474
- "name": "tokenId",
6475
- "type": "core::integer::u256"
6320
+ "name": "accounts",
6321
+ "type": "core::array::Span::<core::starknet::contract_address::ContractAddress>"
6322
+ },
6323
+ {
6324
+ "name": "tokenIds",
6325
+ "type": "core::array::Span::<core::integer::u256>"
6476
6326
  }
6477
6327
  ],
6478
6328
  "outputs": [
6479
6329
  {
6480
- "type": "core::starknet::contract_address::ContractAddress"
6330
+ "type": "core::array::Span::<core::integer::u256>"
6481
6331
  }
6482
6332
  ],
6483
6333
  "state_mutability": "view"
@@ -6498,6 +6348,10 @@ var IPTicketCollectionABI = [
6498
6348
  "name": "tokenId",
6499
6349
  "type": "core::integer::u256"
6500
6350
  },
6351
+ {
6352
+ "name": "value",
6353
+ "type": "core::integer::u256"
6354
+ },
6501
6355
  {
6502
6356
  "name": "data",
6503
6357
  "type": "core::array::Span::<core::felt252>"
@@ -6508,7 +6362,7 @@ var IPTicketCollectionABI = [
6508
6362
  },
6509
6363
  {
6510
6364
  "type": "function",
6511
- "name": "transferFrom",
6365
+ "name": "safeBatchTransferFrom",
6512
6366
  "inputs": [
6513
6367
  {
6514
6368
  "name": "from",
@@ -6519,24 +6373,16 @@ var IPTicketCollectionABI = [
6519
6373
  "type": "core::starknet::contract_address::ContractAddress"
6520
6374
  },
6521
6375
  {
6522
- "name": "tokenId",
6523
- "type": "core::integer::u256"
6524
- }
6525
- ],
6526
- "outputs": [],
6527
- "state_mutability": "external"
6528
- },
6529
- {
6530
- "type": "function",
6531
- "name": "setApprovalForAll",
6532
- "inputs": [
6376
+ "name": "tokenIds",
6377
+ "type": "core::array::Span::<core::integer::u256>"
6378
+ },
6533
6379
  {
6534
- "name": "operator",
6535
- "type": "core::starknet::contract_address::ContractAddress"
6380
+ "name": "values",
6381
+ "type": "core::array::Span::<core::integer::u256>"
6536
6382
  },
6537
6383
  {
6538
- "name": "approved",
6539
- "type": "core::bool"
6384
+ "name": "data",
6385
+ "type": "core::array::Span::<core::felt252>"
6540
6386
  }
6541
6387
  ],
6542
6388
  "outputs": [],
@@ -6544,39 +6390,39 @@ var IPTicketCollectionABI = [
6544
6390
  },
6545
6391
  {
6546
6392
  "type": "function",
6547
- "name": "getApproved",
6393
+ "name": "isApprovedForAll",
6548
6394
  "inputs": [
6549
6395
  {
6550
- "name": "tokenId",
6551
- "type": "core::integer::u256"
6396
+ "name": "owner",
6397
+ "type": "core::starknet::contract_address::ContractAddress"
6398
+ },
6399
+ {
6400
+ "name": "operator",
6401
+ "type": "core::starknet::contract_address::ContractAddress"
6552
6402
  }
6553
6403
  ],
6554
6404
  "outputs": [
6555
6405
  {
6556
- "type": "core::starknet::contract_address::ContractAddress"
6406
+ "type": "core::bool"
6557
6407
  }
6558
6408
  ],
6559
6409
  "state_mutability": "view"
6560
6410
  },
6561
6411
  {
6562
6412
  "type": "function",
6563
- "name": "isApprovedForAll",
6413
+ "name": "setApprovalForAll",
6564
6414
  "inputs": [
6565
- {
6566
- "name": "owner",
6567
- "type": "core::starknet::contract_address::ContractAddress"
6568
- },
6569
6415
  {
6570
6416
  "name": "operator",
6571
6417
  "type": "core::starknet::contract_address::ContractAddress"
6572
- }
6573
- ],
6574
- "outputs": [
6418
+ },
6575
6419
  {
6420
+ "name": "approved",
6576
6421
  "type": "core::bool"
6577
6422
  }
6578
6423
  ],
6579
- "state_mutability": "view"
6424
+ "outputs": [],
6425
+ "state_mutability": "external"
6580
6426
  }
6581
6427
  ]
6582
6428
  },
@@ -6687,9 +6533,14 @@ var IPTicketCollectionABI = [
6687
6533
  },
6688
6534
  {
6689
6535
  "type": "event",
6690
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
6536
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferSingle",
6691
6537
  "kind": "struct",
6692
6538
  "members": [
6539
+ {
6540
+ "name": "operator",
6541
+ "type": "core::starknet::contract_address::ContractAddress",
6542
+ "kind": "key"
6543
+ },
6693
6544
  {
6694
6545
  "name": "from",
6695
6546
  "type": "core::starknet::contract_address::ContractAddress",
@@ -6701,37 +6552,52 @@ var IPTicketCollectionABI = [
6701
6552
  "kind": "key"
6702
6553
  },
6703
6554
  {
6704
- "name": "token_id",
6555
+ "name": "id",
6705
6556
  "type": "core::integer::u256",
6706
- "kind": "key"
6557
+ "kind": "data"
6558
+ },
6559
+ {
6560
+ "name": "value",
6561
+ "type": "core::integer::u256",
6562
+ "kind": "data"
6707
6563
  }
6708
6564
  ]
6709
6565
  },
6710
6566
  {
6711
6567
  "type": "event",
6712
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
6568
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferBatch",
6713
6569
  "kind": "struct",
6714
6570
  "members": [
6715
6571
  {
6716
- "name": "owner",
6572
+ "name": "operator",
6717
6573
  "type": "core::starknet::contract_address::ContractAddress",
6718
6574
  "kind": "key"
6719
6575
  },
6720
6576
  {
6721
- "name": "approved",
6577
+ "name": "from",
6722
6578
  "type": "core::starknet::contract_address::ContractAddress",
6723
6579
  "kind": "key"
6724
6580
  },
6725
6581
  {
6726
- "name": "token_id",
6727
- "type": "core::integer::u256",
6582
+ "name": "to",
6583
+ "type": "core::starknet::contract_address::ContractAddress",
6728
6584
  "kind": "key"
6585
+ },
6586
+ {
6587
+ "name": "ids",
6588
+ "type": "core::array::Span::<core::integer::u256>",
6589
+ "kind": "data"
6590
+ },
6591
+ {
6592
+ "name": "values",
6593
+ "type": "core::array::Span::<core::integer::u256>",
6594
+ "kind": "data"
6729
6595
  }
6730
6596
  ]
6731
6597
  },
6732
6598
  {
6733
6599
  "type": "event",
6734
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
6600
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::ApprovalForAll",
6735
6601
  "kind": "struct",
6736
6602
  "members": [
6737
6603
  {
@@ -6753,22 +6619,44 @@ var IPTicketCollectionABI = [
6753
6619
  },
6754
6620
  {
6755
6621
  "type": "event",
6756
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
6622
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::URI",
6623
+ "kind": "struct",
6624
+ "members": [
6625
+ {
6626
+ "name": "value",
6627
+ "type": "core::byte_array::ByteArray",
6628
+ "kind": "data"
6629
+ },
6630
+ {
6631
+ "name": "id",
6632
+ "type": "core::integer::u256",
6633
+ "kind": "key"
6634
+ }
6635
+ ]
6636
+ },
6637
+ {
6638
+ "type": "event",
6639
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::Event",
6757
6640
  "kind": "enum",
6758
6641
  "variants": [
6759
6642
  {
6760
- "name": "Transfer",
6761
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
6643
+ "name": "TransferSingle",
6644
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferSingle",
6762
6645
  "kind": "nested"
6763
6646
  },
6764
6647
  {
6765
- "name": "Approval",
6766
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
6648
+ "name": "TransferBatch",
6649
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferBatch",
6767
6650
  "kind": "nested"
6768
6651
  },
6769
6652
  {
6770
6653
  "name": "ApprovalForAll",
6771
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
6654
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::ApprovalForAll",
6655
+ "kind": "nested"
6656
+ },
6657
+ {
6658
+ "name": "URI",
6659
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::URI",
6772
6660
  "kind": "nested"
6773
6661
  }
6774
6662
  ]
@@ -6832,42 +6720,27 @@ var IPTicketCollectionABI = [
6832
6720
  },
6833
6721
  {
6834
6722
  "type": "event",
6835
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCollectionCreated",
6723
+ "name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventCreated",
6836
6724
  "kind": "struct",
6837
6725
  "members": [
6838
6726
  {
6839
- "name": "collection_id",
6727
+ "name": "token_id",
6840
6728
  "type": "core::integer::u256",
6841
6729
  "kind": "key"
6842
6730
  },
6843
- {
6844
- "name": "creator",
6845
- "type": "core::starknet::contract_address::ContractAddress",
6846
- "kind": "key"
6847
- },
6848
- {
6849
- "name": "price",
6850
- "type": "core::integer::u256",
6851
- "kind": "data"
6852
- },
6853
6731
  {
6854
6732
  "name": "max_supply",
6855
6733
  "type": "core::integer::u256",
6856
6734
  "kind": "data"
6857
6735
  },
6858
6736
  {
6859
- "name": "expiration",
6860
- "type": "core::integer::u64",
6861
- "kind": "data"
6862
- },
6863
- {
6864
- "name": "royalty_bps",
6865
- "type": "core::integer::u256",
6737
+ "name": "start_time",
6738
+ "type": "core::option::Option::<core::integer::u64>",
6866
6739
  "kind": "data"
6867
6740
  },
6868
6741
  {
6869
- "name": "payment_token",
6870
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>",
6742
+ "name": "end_time",
6743
+ "type": "core::option::Option::<core::integer::u64>",
6871
6744
  "kind": "data"
6872
6745
  },
6873
6746
  {
@@ -6884,11 +6757,11 @@ var IPTicketCollectionABI = [
6884
6757
  },
6885
6758
  {
6886
6759
  "type": "event",
6887
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::CollectionStatusUpdated",
6760
+ "name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
6888
6761
  "kind": "struct",
6889
6762
  "members": [
6890
6763
  {
6891
- "name": "collection_id",
6764
+ "name": "token_id",
6892
6765
  "type": "core::integer::u256",
6893
6766
  "kind": "key"
6894
6767
  },
@@ -6896,65 +6769,6 @@ var IPTicketCollectionABI = [
6896
6769
  "name": "active",
6897
6770
  "type": "core::bool",
6898
6771
  "kind": "data"
6899
- },
6900
- {
6901
- "name": "updated_at",
6902
- "type": "core::integer::u64",
6903
- "kind": "data"
6904
- }
6905
- ]
6906
- },
6907
- {
6908
- "type": "event",
6909
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketMinted",
6910
- "kind": "struct",
6911
- "members": [
6912
- {
6913
- "name": "token_id",
6914
- "type": "core::integer::u256",
6915
- "kind": "key"
6916
- },
6917
- {
6918
- "name": "collection_id",
6919
- "type": "core::integer::u256",
6920
- "kind": "key"
6921
- },
6922
- {
6923
- "name": "owner",
6924
- "type": "core::starknet::contract_address::ContractAddress",
6925
- "kind": "key"
6926
- },
6927
- {
6928
- "name": "minted_at",
6929
- "type": "core::integer::u64",
6930
- "kind": "data"
6931
- }
6932
- ]
6933
- },
6934
- {
6935
- "type": "event",
6936
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketRedeemed",
6937
- "kind": "struct",
6938
- "members": [
6939
- {
6940
- "name": "token_id",
6941
- "type": "core::integer::u256",
6942
- "kind": "key"
6943
- },
6944
- {
6945
- "name": "collection_id",
6946
- "type": "core::integer::u256",
6947
- "kind": "key"
6948
- },
6949
- {
6950
- "name": "owner",
6951
- "type": "core::starknet::contract_address::ContractAddress",
6952
- "kind": "key"
6953
- },
6954
- {
6955
- "name": "redeemed_at",
6956
- "type": "core::integer::u64",
6957
- "kind": "data"
6958
6772
  }
6959
6773
  ]
6960
6774
  },
@@ -6964,8 +6778,8 @@ var IPTicketCollectionABI = [
6964
6778
  "kind": "enum",
6965
6779
  "variants": [
6966
6780
  {
6967
- "name": "ERC721Event",
6968
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
6781
+ "name": "ERC1155Event",
6782
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::Event",
6969
6783
  "kind": "flat"
6970
6784
  },
6971
6785
  {
@@ -6979,23 +6793,13 @@ var IPTicketCollectionABI = [
6979
6793
  "kind": "flat"
6980
6794
  },
6981
6795
  {
6982
- "name": "TicketCollectionCreated",
6983
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCollectionCreated",
6984
- "kind": "nested"
6985
- },
6986
- {
6987
- "name": "CollectionStatusUpdated",
6988
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::CollectionStatusUpdated",
6796
+ "name": "EventCreated",
6797
+ "type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventCreated",
6989
6798
  "kind": "nested"
6990
6799
  },
6991
6800
  {
6992
- "name": "TicketMinted",
6993
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketMinted",
6994
- "kind": "nested"
6995
- },
6996
- {
6997
- "name": "TicketRedeemed",
6998
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketRedeemed",
6801
+ "name": "EventPaused",
6802
+ "type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
6999
6803
  "kind": "nested"
7000
6804
  }
7001
6805
  ]
@@ -7055,7 +6859,7 @@ var IPTicketCollectionFactoryABI = [
7055
6859
  },
7056
6860
  {
7057
6861
  "type": "function",
7058
- "name": "deploy_ticket_collection",
6862
+ "name": "deploy_collection",
7059
6863
  "inputs": [
7060
6864
  {
7061
6865
  "name": "name",
@@ -7075,6 +6879,47 @@ var IPTicketCollectionFactoryABI = [
7075
6879
  }
7076
6880
  ]
7077
6881
  },
6882
+ {
6883
+ "type": "impl",
6884
+ "name": "SRC5Impl",
6885
+ "interface_name": "openzeppelin_introspection::interface::ISRC5"
6886
+ },
6887
+ {
6888
+ "type": "enum",
6889
+ "name": "core::bool",
6890
+ "variants": [
6891
+ {
6892
+ "name": "False",
6893
+ "type": "()"
6894
+ },
6895
+ {
6896
+ "name": "True",
6897
+ "type": "()"
6898
+ }
6899
+ ]
6900
+ },
6901
+ {
6902
+ "type": "interface",
6903
+ "name": "openzeppelin_introspection::interface::ISRC5",
6904
+ "items": [
6905
+ {
6906
+ "type": "function",
6907
+ "name": "supports_interface",
6908
+ "inputs": [
6909
+ {
6910
+ "name": "interface_id",
6911
+ "type": "core::felt252"
6912
+ }
6913
+ ],
6914
+ "outputs": [
6915
+ {
6916
+ "type": "core::bool"
6917
+ }
6918
+ ],
6919
+ "state_mutability": "view"
6920
+ }
6921
+ ]
6922
+ },
7078
6923
  {
7079
6924
  "type": "constructor",
7080
6925
  "name": "constructor",
@@ -7085,6 +6930,12 @@ var IPTicketCollectionFactoryABI = [
7085
6930
  }
7086
6931
  ]
7087
6932
  },
6933
+ {
6934
+ "type": "event",
6935
+ "name": "openzeppelin_introspection::src5::SRC5Component::Event",
6936
+ "kind": "enum",
6937
+ "variants": []
6938
+ },
7088
6939
  {
7089
6940
  "type": "event",
7090
6941
  "name": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::CollectionDeployed",
@@ -7117,6 +6968,11 @@ var IPTicketCollectionFactoryABI = [
7117
6968
  "name": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::Event",
7118
6969
  "kind": "enum",
7119
6970
  "variants": [
6971
+ {
6972
+ "name": "SRC5Event",
6973
+ "type": "openzeppelin_introspection::src5::SRC5Component::Event",
6974
+ "kind": "flat"
6975
+ },
7120
6976
  {
7121
6977
  "name": "CollectionDeployed",
7122
6978
  "type": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::CollectionDeployed",
@@ -11647,105 +11503,17 @@ function resolveToken(currency) {
11647
11503
  (t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
11648
11504
  );
11649
11505
  if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
11650
- return token;
11651
- }
11652
- var _providerCache = /* @__PURE__ */ new WeakMap();
11653
- function getProvider(config) {
11654
- let p = _providerCache.get(config);
11655
- if (!p) {
11656
- const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
11657
- p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
11658
- _providerCache.set(config, p);
11659
- }
11660
- return p;
11661
- }
11662
-
11663
- // src/starknet/marketplace/build.ts
11664
- function contractFor(cfg) {
11665
- return new starknet.Contract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
11666
- }
11667
- function buildListingOrder(i, cfg) {
11668
- const orderParams = {
11669
- offerer: i.offerer,
11670
- marketplace: cfg.marketplaceContract,
11671
- offer: { item_type: "ERC721", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: "1" },
11672
- consideration: {
11673
- item_type: "ERC20",
11674
- token: i.paymentTokenAddress,
11675
- identifier_or_criteria: "0",
11676
- amount: i.priceWei,
11677
- recipient: i.offerer
11678
- },
11679
- royalty_max_bps: i.royaltyMaxBps,
11680
- start_time: String(i.startTime),
11681
- end_time: String(i.endTime),
11682
- salt: i.salt,
11683
- counter: i.counter
11684
- };
11685
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
11686
- return { orderParams, typedData };
11687
- }
11688
- function buildOfferOrder(i, cfg) {
11689
- const orderParams = {
11690
- offerer: i.offerer,
11691
- marketplace: cfg.marketplaceContract,
11692
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWei },
11693
- consideration: {
11694
- item_type: "ERC721",
11695
- token: i.nftContract,
11696
- identifier_or_criteria: i.tokenId,
11697
- amount: "1",
11698
- recipient: i.offerer
11699
- },
11700
- royalty_max_bps: i.royaltyMaxBps,
11701
- start_time: String(i.startTime),
11702
- end_time: String(i.endTime),
11703
- salt: i.salt,
11704
- counter: i.counter
11705
- };
11706
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
11707
- return { orderParams, typedData };
11708
- }
11709
- function registerPayload(orderParams, signature) {
11710
- return stringifyBigInts({
11711
- parameters: {
11712
- ...orderParams,
11713
- offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
11714
- consideration: {
11715
- ...orderParams.consideration,
11716
- item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11717
- }
11718
- },
11719
- signature
11720
- });
11721
- }
11722
- function buildRegisterCalls(a, cfg) {
11723
- const registerCall = contractFor(cfg).populate("register_order", [registerPayload(a.orderParams, a.signature)]);
11724
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
11725
- }
11726
- function buildFulfillCalls(a, cfg) {
11727
- const u = starknet.cairo.uint256(a.totalPrice);
11728
- const approve = {
11729
- contractAddress: a.paymentToken,
11730
- entrypoint: "approve",
11731
- calldata: [cfg.marketplaceContract, u.low.toString(), u.high.toString()]
11732
- };
11733
- const fulfill = contractFor(cfg).populate("fulfill_order", [a.orderHash]);
11734
- const fee = buildFeeCall(
11735
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
11736
- cfg.feeConfig
11737
- );
11738
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
11739
- }
11740
- function buildCancelCalls(a, cfg) {
11741
- const cancelRequest = stringifyBigInts({
11742
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
11743
- signature: a.signature
11744
- });
11745
- return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
11506
+ return token;
11746
11507
  }
11747
- function buildCancelTypedData(orderHash, offerer, cfg) {
11748
- return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
11508
+ var _providerCache = /* @__PURE__ */ new WeakMap();
11509
+ function getProvider(config) {
11510
+ let p = _providerCache.get(config);
11511
+ if (!p) {
11512
+ const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
11513
+ p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
11514
+ _providerCache.set(config, p);
11515
+ }
11516
+ return p;
11749
11517
  }
11750
11518
 
11751
11519
  // src/starknet/marketplace/orders.ts
@@ -11772,22 +11540,46 @@ async function createListing(account, params, config) {
11772
11540
  const endTime = now + durationSeconds;
11773
11541
  const counter = (await contract.get_counter(account.address)).toString();
11774
11542
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11775
- const { orderParams, typedData } = buildListingOrder(
11776
- {
11777
- offerer: account.address,
11778
- nftContract,
11779
- tokenId,
11780
- priceWei,
11781
- paymentTokenAddress: token.address,
11782
- royaltyMaxBps,
11783
- startTime,
11784
- endTime,
11785
- salt: generateSalt(),
11786
- counter
11543
+ const orderParams = {
11544
+ offerer: account.address,
11545
+ marketplace: config.marketplaceContract,
11546
+ offer: {
11547
+ item_type: "ERC721",
11548
+ token: nftContract,
11549
+ identifier_or_criteria: tokenId,
11550
+ amount: "1"
11787
11551
  },
11788
- config
11789
- );
11790
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11552
+ consideration: {
11553
+ item_type: "ERC20",
11554
+ token: token.address,
11555
+ identifier_or_criteria: "0",
11556
+ amount: priceWei,
11557
+ recipient: account.address
11558
+ },
11559
+ royalty_max_bps: royaltyMaxBps,
11560
+ start_time: startTime.toString(),
11561
+ end_time: endTime.toString(),
11562
+ salt: generateSalt(),
11563
+ counter
11564
+ };
11565
+ const chainId = getChainId(config);
11566
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
11567
+ const signature = await account.signMessage(typedData);
11568
+ const signatureArray = toSignatureArray(signature);
11569
+ const registerPayload = stringifyBigInts({
11570
+ parameters: {
11571
+ ...orderParams,
11572
+ offer: {
11573
+ ...orderParams.offer,
11574
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
11575
+ },
11576
+ consideration: {
11577
+ ...orderParams.consideration,
11578
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11579
+ }
11580
+ },
11581
+ signature: signatureArray
11582
+ });
11791
11583
  const tokenIdUint256 = starknet.cairo.uint256(tokenId);
11792
11584
  let isAlreadyApproved = false;
11793
11585
  try {
@@ -11799,19 +11591,19 @@ async function createListing(account, params, config) {
11799
11591
  isAlreadyApproved = BigInt(result[0]).toString() === BigInt(config.marketplaceContract).toString();
11800
11592
  } catch {
11801
11593
  }
11802
- const approve = {
11803
- contractAddress: nftContract,
11804
- entrypoint: "approve",
11805
- calldata: [
11806
- config.marketplaceContract,
11807
- tokenIdUint256.low.toString(),
11808
- tokenIdUint256.high.toString()
11809
- ]
11810
- };
11811
- const calls = buildRegisterCalls(
11812
- { orderParams, signature: signatureArray, approvalNeeded: !isAlreadyApproved, approve },
11813
- config
11814
- );
11594
+ const registerCall = contract.populate("register_order", [registerPayload]);
11595
+ const calls = isAlreadyApproved ? [registerCall] : [
11596
+ {
11597
+ contractAddress: nftContract,
11598
+ entrypoint: "approve",
11599
+ calldata: [
11600
+ config.marketplaceContract,
11601
+ tokenIdUint256.low.toString(),
11602
+ tokenIdUint256.high.toString()
11603
+ ]
11604
+ },
11605
+ registerCall
11606
+ ];
11815
11607
  try {
11816
11608
  const tx = await account.execute(calls);
11817
11609
  await provider.waitForTransaction(tx.transaction_hash);
@@ -11830,22 +11622,46 @@ async function makeOffer(account, params, config) {
11830
11622
  const endTime = now + durationSeconds;
11831
11623
  const counter = (await contract.get_counter(account.address)).toString();
11832
11624
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11833
- const { orderParams, typedData } = buildOfferOrder(
11834
- {
11835
- offerer: account.address,
11836
- nftContract,
11837
- tokenId,
11838
- priceWei,
11839
- paymentTokenAddress: token.address,
11840
- royaltyMaxBps,
11841
- startTime,
11842
- endTime,
11843
- salt: generateSalt(),
11844
- counter
11625
+ const orderParams = {
11626
+ offerer: account.address,
11627
+ marketplace: config.marketplaceContract,
11628
+ offer: {
11629
+ item_type: "ERC20",
11630
+ token: token.address,
11631
+ identifier_or_criteria: "0",
11632
+ amount: priceWei
11845
11633
  },
11846
- config
11847
- );
11848
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11634
+ consideration: {
11635
+ item_type: "ERC721",
11636
+ token: nftContract,
11637
+ identifier_or_criteria: tokenId,
11638
+ amount: "1",
11639
+ recipient: account.address
11640
+ },
11641
+ royalty_max_bps: royaltyMaxBps,
11642
+ start_time: startTime.toString(),
11643
+ end_time: endTime.toString(),
11644
+ salt: generateSalt(),
11645
+ counter
11646
+ };
11647
+ const chainId = getChainId(config);
11648
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
11649
+ const signature = await account.signMessage(typedData);
11650
+ const signatureArray = toSignatureArray(signature);
11651
+ const registerPayload = stringifyBigInts({
11652
+ parameters: {
11653
+ ...orderParams,
11654
+ offer: {
11655
+ ...orderParams.offer,
11656
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
11657
+ },
11658
+ consideration: {
11659
+ ...orderParams.consideration,
11660
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11661
+ }
11662
+ },
11663
+ signature: signatureArray
11664
+ });
11849
11665
  const amountUint256 = starknet.cairo.uint256(priceWei);
11850
11666
  const approveCall = {
11851
11667
  contractAddress: token.address,
@@ -11856,12 +11672,9 @@ async function makeOffer(account, params, config) {
11856
11672
  amountUint256.high.toString()
11857
11673
  ]
11858
11674
  };
11859
- const calls = buildRegisterCalls(
11860
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
11861
- config
11862
- );
11675
+ const registerCall = contract.populate("register_order", [registerPayload]);
11863
11676
  try {
11864
- const tx = await account.execute(calls);
11677
+ const tx = await account.execute([approveCall, registerCall]);
11865
11678
  await provider.waitForTransaction(tx.transaction_hash);
11866
11679
  return { txHash: tx.transaction_hash };
11867
11680
  } catch (err) {
@@ -11870,8 +11683,23 @@ async function makeOffer(account, params, config) {
11870
11683
  }
11871
11684
  async function fulfillOrder(account, params, config) {
11872
11685
  const { orderHash, paymentToken, totalPrice } = params;
11873
- const { provider } = makeContract(config);
11874
- const calls = buildFulfillCalls({ orderHash, paymentToken, totalPrice }, config);
11686
+ const { contract, provider } = makeContract(config);
11687
+ const totalPriceU256 = starknet.cairo.uint256(totalPrice);
11688
+ const approveCall = {
11689
+ contractAddress: paymentToken,
11690
+ entrypoint: "approve",
11691
+ calldata: [
11692
+ config.marketplaceContract,
11693
+ totalPriceU256.low.toString(),
11694
+ totalPriceU256.high.toString()
11695
+ ]
11696
+ };
11697
+ const fulfillCall = contract.populate("fulfill_order", [orderHash]);
11698
+ const feeCall = buildFeeCall(
11699
+ { surface: "marketplace", token: paymentToken, grossAmount: BigInt(totalPrice) },
11700
+ config.feeConfig
11701
+ );
11702
+ const calls = feeCall ? [approveCall, fulfillCall, feeCall] : [approveCall, fulfillCall];
11875
11703
  try {
11876
11704
  const tx = await account.execute(calls);
11877
11705
  await provider.waitForTransaction(tx.transaction_hash);
@@ -11882,12 +11710,24 @@ async function fulfillOrder(account, params, config) {
11882
11710
  }
11883
11711
  async function cancelOrder(account, params, config) {
11884
11712
  const { orderHash } = params;
11885
- const { provider } = makeContract(config);
11886
- const typedData = buildCancelTypedData(orderHash, account.address, config);
11887
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11888
- const calls = buildCancelCalls({ orderHash, offerer: account.address, signature: signatureArray }, config);
11713
+ const { contract, provider } = makeContract(config);
11714
+ const chainId = getChainId(config);
11715
+ const cancelParams = {
11716
+ order_hash: orderHash,
11717
+ offerer: account.address
11718
+ };
11719
+ const typedData = stringifyBigInts(
11720
+ buildCancellationTypedData(cancelParams, chainId)
11721
+ );
11722
+ const signature = await account.signMessage(typedData);
11723
+ const signatureArray = toSignatureArray(signature);
11724
+ const cancelRequest = stringifyBigInts({
11725
+ cancelation: cancelParams,
11726
+ signature: signatureArray
11727
+ });
11728
+ const call = contract.populate("cancel_order", [cancelRequest]);
11889
11729
  try {
11890
- const tx = await account.execute(calls);
11730
+ const tx = await account.execute(call);
11891
11731
  await provider.waitForTransaction(tx.transaction_hash);
11892
11732
  return { txHash: tx.transaction_hash };
11893
11733
  } catch (err) {
@@ -12034,100 +11874,6 @@ var MarketplaceModule = class {
12034
11874
  return buildCancellationTypedData(params, chainId);
12035
11875
  }
12036
11876
  };
12037
- function contractFor2(cfg) {
12038
- return new starknet.Contract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
12039
- }
12040
- function buildListing1155Order(i, cfg) {
12041
- const orderParams = {
12042
- offerer: i.offerer,
12043
- marketplace: cfg.marketplace1155Contract,
12044
- offer: { item_type: "ERC1155", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: i.quantity },
12045
- consideration: {
12046
- item_type: "ERC20",
12047
- token: i.paymentTokenAddress,
12048
- identifier_or_criteria: "0",
12049
- amount: i.priceWeiPerUnit,
12050
- recipient: i.offerer
12051
- },
12052
- royalty_max_bps: i.royaltyMaxBps,
12053
- start_time: String(i.startTime),
12054
- end_time: String(i.endTime),
12055
- salt: i.salt,
12056
- counter: i.counter
12057
- };
12058
- const typedData = stringifyBigInts(
12059
- build1155OrderTypedData(orderParams, getChainId(cfg))
12060
- );
12061
- return { orderParams, typedData };
12062
- }
12063
- function buildOffer1155Order(i, cfg) {
12064
- const orderParams = {
12065
- offerer: i.offerer,
12066
- marketplace: cfg.marketplace1155Contract,
12067
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWeiPerUnit },
12068
- consideration: {
12069
- item_type: "ERC1155",
12070
- token: i.nftContract,
12071
- identifier_or_criteria: i.tokenId,
12072
- amount: i.quantity,
12073
- recipient: i.offerer
12074
- },
12075
- royalty_max_bps: i.royaltyMaxBps,
12076
- start_time: String(i.startTime),
12077
- end_time: String(i.endTime),
12078
- salt: i.salt,
12079
- counter: i.counter
12080
- };
12081
- const typedData = stringifyBigInts(
12082
- build1155OrderTypedData(orderParams, getChainId(cfg))
12083
- );
12084
- return { orderParams, typedData };
12085
- }
12086
- function registerPayload2(orderParams, signature) {
12087
- return stringifyBigInts({
12088
- parameters: {
12089
- ...orderParams,
12090
- offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
12091
- consideration: {
12092
- ...orderParams.consideration,
12093
- item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
12094
- }
12095
- },
12096
- signature
12097
- });
12098
- }
12099
- function buildRegister1155Calls(a, cfg) {
12100
- const registerCall = contractFor2(cfg).populate("register_order", [registerPayload2(a.orderParams, a.signature)]);
12101
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
12102
- }
12103
- function buildFulfill1155Calls(a, cfg) {
12104
- const u = starknet.cairo.uint256(a.totalPrice);
12105
- const approve = {
12106
- contractAddress: a.paymentToken,
12107
- entrypoint: "approve",
12108
- calldata: [cfg.marketplace1155Contract, u.low.toString(), u.high.toString()]
12109
- };
12110
- const fulfill = contractFor2(cfg).populate("fulfill_order", [a.orderHash, a.quantity]);
12111
- const fee = buildFeeCall(
12112
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
12113
- cfg.feeConfig
12114
- );
12115
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
12116
- }
12117
- function buildCancel1155Calls(a, cfg) {
12118
- const cancelPayload = stringifyBigInts({
12119
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
12120
- signature: a.signature
12121
- });
12122
- return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
12123
- }
12124
- function buildCancel1155TypedData(orderHash, offerer, cfg) {
12125
- return stringifyBigInts(
12126
- build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
12127
- );
12128
- }
12129
-
12130
- // src/starknet/marketplace1155/orders.ts
12131
11877
  var _contractCache2 = /* @__PURE__ */ new WeakMap();
12132
11878
  function getContract(config) {
12133
11879
  let c = _contractCache2.get(config);
@@ -12156,27 +11902,53 @@ async function createListing1155(account, params, config) {
12156
11902
  const token = resolveToken(currency);
12157
11903
  const priceWei = parseAmount(pricePerUnit, token.decimals);
12158
11904
  const now = Math.floor(Date.now() / 1e3);
12159
- const startTime = now + START_TIME_BUFFER_SECS;
12160
11905
  const endTime = now + durationSeconds;
11906
+ const chainId = getChainId(config);
12161
11907
  const counter = (await contract.get_counter(account.address)).toString();
12162
11908
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
12163
- const { orderParams, typedData } = buildListing1155Order(
12164
- {
12165
- offerer: account.address,
12166
- nftContract,
12167
- tokenId,
12168
- quantity: amount,
12169
- priceWeiPerUnit: priceWei,
12170
- paymentTokenAddress: token.address,
12171
- royaltyMaxBps,
12172
- startTime,
12173
- endTime,
12174
- salt: generateSalt(),
12175
- counter
11909
+ const orderParams = {
11910
+ offerer: account.address,
11911
+ marketplace: config.marketplace1155Contract,
11912
+ offer: {
11913
+ item_type: "ERC1155",
11914
+ token: nftContract,
11915
+ identifier_or_criteria: tokenId,
11916
+ amount
11917
+ // ERC-1155 leg amount = unit quantity
12176
11918
  },
12177
- config
11919
+ consideration: {
11920
+ item_type: "ERC20",
11921
+ token: token.address,
11922
+ identifier_or_criteria: "0",
11923
+ amount: priceWei,
11924
+ // payment leg amount = price PER UNIT
11925
+ recipient: account.address
11926
+ },
11927
+ royalty_max_bps: royaltyMaxBps,
11928
+ start_time: (now + START_TIME_BUFFER_SECS).toString(),
11929
+ end_time: endTime.toString(),
11930
+ salt: generateSalt(),
11931
+ counter
11932
+ };
11933
+ const typedData = stringifyBigInts(
11934
+ build1155OrderTypedData(orderParams, chainId)
12178
11935
  );
12179
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11936
+ const signature = await account.signMessage(typedData);
11937
+ const signatureArray = toSignatureArray(signature);
11938
+ const orderPayload = stringifyBigInts({
11939
+ parameters: {
11940
+ ...orderParams,
11941
+ offer: {
11942
+ ...orderParams.offer,
11943
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
11944
+ },
11945
+ consideration: {
11946
+ ...orderParams.consideration,
11947
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11948
+ }
11949
+ },
11950
+ signature: signatureArray
11951
+ });
12180
11952
  let isApproved = false;
12181
11953
  try {
12182
11954
  const result = await provider.callContract({
@@ -12187,15 +11959,15 @@ async function createListing1155(account, params, config) {
12187
11959
  isApproved = BigInt(result[0]) === 1n;
12188
11960
  } catch {
12189
11961
  }
12190
- const approve = {
12191
- contractAddress: nftContract,
12192
- entrypoint: "set_approval_for_all",
12193
- calldata: [config.marketplace1155Contract, "1"]
12194
- };
12195
- const calls = buildRegister1155Calls(
12196
- { orderParams, signature: signatureArray, approvalNeeded: !isApproved, approve },
12197
- config
12198
- );
11962
+ const registerCall = contract.populate("register_order", [orderPayload]);
11963
+ const calls = isApproved ? [registerCall] : [
11964
+ {
11965
+ contractAddress: nftContract,
11966
+ entrypoint: "set_approval_for_all",
11967
+ calldata: [config.marketplace1155Contract, "1"]
11968
+ },
11969
+ registerCall
11970
+ ];
12199
11971
  try {
12200
11972
  const tx = await account.execute(calls);
12201
11973
  await provider.waitForTransaction(tx.transaction_hash);
@@ -12206,10 +11978,21 @@ async function createListing1155(account, params, config) {
12206
11978
  }
12207
11979
  async function fulfillOrder1155(account, params, config) {
12208
11980
  const { orderHash, paymentToken, totalPrice, quantity = "1" } = params;
11981
+ const contract = getContract(config);
12209
11982
  const provider = getProvider(config);
12210
- const calls = buildFulfill1155Calls({ orderHash, paymentToken, totalPrice, quantity }, config);
11983
+ const totalPriceU256 = starknet.cairo.uint256(totalPrice);
11984
+ const approveCall = {
11985
+ contractAddress: paymentToken,
11986
+ entrypoint: "approve",
11987
+ calldata: [
11988
+ config.marketplace1155Contract,
11989
+ totalPriceU256.low.toString(),
11990
+ totalPriceU256.high.toString()
11991
+ ]
11992
+ };
11993
+ const fulfillCall = contract.populate("fulfill_order", [orderHash, quantity]);
12211
11994
  try {
12212
- const tx = await account.execute(calls);
11995
+ const tx = await account.execute([approveCall, fulfillCall]);
12213
11996
  await provider.waitForTransaction(tx.transaction_hash);
12214
11997
  return { txHash: tx.transaction_hash };
12215
11998
  } catch (err) {
@@ -12218,12 +12001,25 @@ async function fulfillOrder1155(account, params, config) {
12218
12001
  }
12219
12002
  async function cancelOrder1155(account, params, config) {
12220
12003
  const { orderHash } = params;
12004
+ const contract = getContract(config);
12221
12005
  const provider = getProvider(config);
12222
- const typedData = buildCancel1155TypedData(orderHash, account.address, config);
12223
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
12224
- const calls = buildCancel1155Calls({ orderHash, offerer: account.address, signature: signatureArray }, config);
12006
+ const chainId = getChainId(config);
12007
+ const cancelParams = {
12008
+ order_hash: orderHash,
12009
+ offerer: account.address
12010
+ };
12011
+ const typedData = stringifyBigInts(
12012
+ build1155CancellationTypedData(cancelParams, chainId)
12013
+ );
12014
+ const signature = await account.signMessage(typedData);
12015
+ const signatureArray = toSignatureArray(signature);
12016
+ const cancelPayload = stringifyBigInts({
12017
+ cancelation: cancelParams,
12018
+ signature: signatureArray
12019
+ });
12020
+ const cancelCall = contract.populate("cancel_order", [cancelPayload]);
12225
12021
  try {
12226
- const tx = await account.execute(calls);
12022
+ const tx = await account.execute(cancelCall);
12227
12023
  await provider.waitForTransaction(tx.transaction_hash);
12228
12024
  return { txHash: tx.transaction_hash };
12229
12025
  } catch (err) {
@@ -12241,30 +12037,56 @@ async function makeOffer1155(account, params, config) {
12241
12037
  } = params;
12242
12038
  const contract = getContract(config);
12243
12039
  const provider = getProvider(config);
12040
+ const chainId = getChainId(config);
12244
12041
  const token = resolveToken(currency);
12245
12042
  const priceWei = parseAmount(price, token.decimals);
12246
12043
  const now = Math.floor(Date.now() / 1e3);
12247
- const startTime = now + START_TIME_BUFFER_SECS;
12248
12044
  const endTime = now + durationSeconds;
12249
12045
  const counter = (await contract.get_counter(account.address)).toString();
12250
12046
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
12251
- const { orderParams, typedData } = buildOffer1155Order(
12252
- {
12253
- offerer: account.address,
12254
- nftContract,
12255
- tokenId,
12256
- quantity: amount,
12257
- priceWeiPerUnit: priceWei,
12258
- paymentTokenAddress: token.address,
12259
- royaltyMaxBps,
12260
- startTime,
12261
- endTime,
12262
- salt: generateSalt(),
12263
- counter
12047
+ const orderParams = {
12048
+ offerer: account.address,
12049
+ marketplace: config.marketplace1155Contract,
12050
+ offer: {
12051
+ item_type: "ERC20",
12052
+ token: token.address,
12053
+ identifier_or_criteria: "0",
12054
+ amount: priceWei
12055
+ // price PER UNIT
12264
12056
  },
12265
- config
12057
+ consideration: {
12058
+ item_type: "ERC1155",
12059
+ token: nftContract,
12060
+ identifier_or_criteria: tokenId,
12061
+ amount,
12062
+ // unit quantity
12063
+ recipient: account.address
12064
+ },
12065
+ royalty_max_bps: royaltyMaxBps,
12066
+ start_time: (now + START_TIME_BUFFER_SECS).toString(),
12067
+ end_time: endTime.toString(),
12068
+ salt: generateSalt(),
12069
+ counter
12070
+ };
12071
+ const typedData = stringifyBigInts(
12072
+ build1155OrderTypedData(orderParams, chainId)
12266
12073
  );
12267
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
12074
+ const signature = await account.signMessage(typedData);
12075
+ const signatureArray = toSignatureArray(signature);
12076
+ const registerPayload = stringifyBigInts({
12077
+ parameters: {
12078
+ ...orderParams,
12079
+ offer: {
12080
+ ...orderParams.offer,
12081
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
12082
+ },
12083
+ consideration: {
12084
+ ...orderParams.consideration,
12085
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
12086
+ }
12087
+ },
12088
+ signature: signatureArray
12089
+ });
12268
12090
  const totalWei = BigInt(priceWei) * BigInt(amount);
12269
12091
  const amountU256 = starknet.cairo.uint256(totalWei.toString());
12270
12092
  const approveCall = {
@@ -12276,12 +12098,9 @@ async function makeOffer1155(account, params, config) {
12276
12098
  amountU256.high.toString()
12277
12099
  ]
12278
12100
  };
12279
- const calls = buildRegister1155Calls(
12280
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
12281
- config
12282
- );
12101
+ const registerCall = contract.populate("register_order", [registerPayload]);
12283
12102
  try {
12284
- const tx = await account.execute(calls);
12103
+ const tx = await account.execute([approveCall, registerCall]);
12285
12104
  await provider.waitForTransaction(tx.transaction_hash);
12286
12105
  return { txHash: tx.transaction_hash };
12287
12106
  } catch (err) {
@@ -12813,66 +12632,84 @@ var CreatorCoinService = class {
12813
12632
  };
12814
12633
  var TicketService = class {
12815
12634
  constructor(config) {
12635
+ this.config = config;
12816
12636
  this.factoryAddress = getStarknetCoordinates(config.chain).ipTicketsFactory;
12817
12637
  }
12638
+ _factory(account, factoryAddress) {
12639
+ const address = factoryAddress ?? this.factoryAddress;
12640
+ if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
12641
+ return new starknet.Contract(IPTicketCollectionFactoryABI, normalizeAddress("STARKNET", address), account);
12642
+ }
12818
12643
  _collection(address, account) {
12819
12644
  return new starknet.Contract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
12820
12645
  }
12821
- /** Deploys a new IPTicketCollection via the factory. Caller becomes its owner. */
12822
- async deployTicketCollection(account, params) {
12823
- const factoryAddress = params.factoryAddress ?? this.factoryAddress;
12824
- if (!factoryAddress) {
12825
- throw new Error("IP-Tickets factory address not configured for this chain");
12826
- }
12827
- const factory = new starknet.Contract(IPTicketCollectionFactoryABI, factoryAddress, account);
12828
- const call = factory.populate("deploy_ticket_collection", [params.name, params.symbol]);
12646
+ _collectionRead(address) {
12647
+ const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
12648
+ return new starknet.Contract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
12649
+ }
12650
+ /** Deploys a new IPTicketCollection via the factory. Caller becomes owner. */
12651
+ async deployCollection(account, params) {
12652
+ const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [params.name, params.symbol]);
12829
12653
  const res = await account.execute([call]);
12830
12654
  return { txHash: res.transaction_hash };
12831
12655
  }
12832
- /** Owner-only. Creates a new ticket collection (event/tier) inside the caller's deployed IPTicketCollection. */
12833
- async createTicketCollection(account, params) {
12834
- const paymentToken = params.paymentToken ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.paymentToken) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12835
- const call = this._collection(params.collection, account).populate("create_ticket_collection", [
12836
- starknet.cairo.uint256(params.price),
12656
+ /** Owner-only. Creates a new event inside the caller's deployed collection. */
12657
+ async createEvent(account, params) {
12658
+ const startTime = params.startTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.startTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12659
+ const endTime = params.endTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.endTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12660
+ const call = this._collection(params.collection, account).populate("create_event", [
12837
12661
  starknet.cairo.uint256(params.maxSupply),
12838
- params.expiration,
12662
+ startTime,
12663
+ endTime,
12839
12664
  params.royaltyBps,
12840
- paymentToken,
12841
12665
  params.metadataUri
12842
12666
  ]);
12843
12667
  const res = await account.execute([call]);
12844
12668
  return { txHash: res.transaction_hash };
12845
12669
  }
12846
- /** Owner-only. Gates minting only existing tickets keep access/transfer/redeem. */
12847
- async setCollectionActive(account, params) {
12848
- const call = this._collection(params.collection, account).populate("set_collection_active", [
12849
- starknet.cairo.uint256(params.collectionId),
12850
- params.active
12670
+ /** Owner-only. Mints `amount` of `tokenId` to `to`. */
12671
+ async mint(account, params) {
12672
+ const call = this._collection(params.collection, account).populate("mint", [
12673
+ params.to,
12674
+ starknet.cairo.uint256(params.tokenId),
12675
+ starknet.cairo.uint256(params.amount)
12851
12676
  ]);
12852
12677
  const res = await account.execute([call]);
12853
12678
  return { txHash: res.transaction_hash };
12854
12679
  }
12855
- /** Mints a ticket. Prepends an ERC-20 approve when the collection is paid. */
12856
- async mintTicket(account, params) {
12857
- const calls = [];
12858
- if (params.paymentToken && params.price && BigInt(params.price) > 0n) {
12859
- const amount = starknet.cairo.uint256(params.price);
12860
- calls.push({
12861
- contractAddress: params.paymentToken,
12862
- entrypoint: "approve",
12863
- calldata: [normalizeAddress("STARKNET", params.collection), amount.low.toString(), amount.high.toString()]
12864
- });
12865
- }
12866
- calls.push(this._collection(params.collection, account).populate("mint_ticket", [starknet.cairo.uint256(params.collectionId)]));
12867
- const res = await account.execute(calls);
12868
- return { txHash: res.transaction_hash };
12869
- }
12870
- /** Only the current token owner may redeem. */
12871
- async redeemTicket(account, params) {
12872
- const call = this._collection(params.collection, account).populate("redeem_ticket", [starknet.cairo.uint256(params.tokenId)]);
12680
+ /** Owner-only. Pauses or resumes minting for one event. */
12681
+ async pauseEvent(account, params) {
12682
+ const call = this._collection(params.collection, account).populate("pause_event", [
12683
+ starknet.cairo.uint256(params.tokenId),
12684
+ params.active
12685
+ ]);
12873
12686
  const res = await account.execute([call]);
12874
12687
  return { txHash: res.transaction_hash };
12875
12688
  }
12689
+ /** Read — true if holder has balance > 0 and current time is within the event window. */
12690
+ async isValid(params) {
12691
+ const result = await this._collectionRead(params.collection).call("is_valid", [
12692
+ starknet.cairo.uint256(params.tokenId),
12693
+ params.holder
12694
+ ]);
12695
+ return Boolean(result);
12696
+ }
12697
+ /** Read — returns the EventRecord for a token ID. */
12698
+ async getEvent(params) {
12699
+ const ev = await this._collectionRead(params.collection).call("get_event", [
12700
+ starknet.cairo.uint256(params.tokenId)
12701
+ ]);
12702
+ return {
12703
+ creator: ev.creator,
12704
+ maxSupply: BigInt(ev.max_supply),
12705
+ minted: BigInt(ev.minted),
12706
+ startTime: ev.start_time?.variant === "Some" ? Number(ev.start_time.values[0] ?? ev.start_time.value) : null,
12707
+ endTime: ev.end_time?.variant === "Some" ? Number(ev.end_time.values[0] ?? ev.end_time.value) : null,
12708
+ royaltyBps: Number(ev.royalty_bps),
12709
+ metadataUri: ev.metadata_uri,
12710
+ active: Boolean(ev.active)
12711
+ };
12712
+ }
12876
12713
  };
12877
12714
  var ClubService = class {
12878
12715
  constructor(config) {
@@ -13153,147 +12990,94 @@ var StarknetVenue = class {
13153
12990
  constructor(deps) {
13154
12991
  this.deps = deps;
13155
12992
  this.chain = "STARKNET";
12993
+ this.m721 = new MarketplaceModule(deps.config);
12994
+ this.m1155 = new Medialane1155Module(deps.config);
13156
12995
  }
13157
- async incrementCounter(signer) {
13158
- return signer.execute([
13159
- { contractAddress: this.deps.config.marketplaceContract, entrypoint: "increment_counter", calldata: [] }
13160
- ]);
12996
+ incrementCounter(signer) {
12997
+ return this.m721.incrementCounter(signer);
13161
12998
  }
13162
12999
  getOrderDetails(orderRef) {
13163
- return getOrderDetails(orderRef, this.deps.config);
13000
+ return this.m721.getOrderDetails(orderRef);
13164
13001
  }
13165
- async getCounter(address) {
13166
- return this.readCounter(this.deps.config.marketplaceContract, address);
13002
+ getCounter(address) {
13003
+ return this.m721.getCounter(address);
13167
13004
  }
13168
13005
  async fulfillOrder(signer, orderRef, opts) {
13169
13006
  const o = await this.deps.resolveOrder(orderRef);
13170
13007
  const quantity = opts?.quantity ?? "1";
13171
13008
  const totalPrice = (BigInt(o.unitPrice) * BigInt(quantity)).toString();
13172
- const calls = o.standard === "ERC1155" ? buildFulfill1155Calls({ orderHash: orderRef, paymentToken: o.paymentToken, totalPrice, quantity }, this.deps.config) : buildFulfillCalls({ orderHash: orderRef, paymentToken: o.paymentToken, totalPrice }, this.deps.config);
13173
- return signer.execute(calls);
13009
+ if (o.standard === "ERC1155") {
13010
+ return this.m1155.fulfillOrder(signer, {
13011
+ orderHash: orderRef,
13012
+ paymentToken: o.paymentToken,
13013
+ totalPrice,
13014
+ quantity
13015
+ });
13016
+ }
13017
+ return this.m721.fulfillOrder(signer, {
13018
+ orderHash: orderRef,
13019
+ paymentToken: o.paymentToken,
13020
+ totalPrice
13021
+ });
13174
13022
  }
13175
13023
  async cancelOrder(signer, orderRef) {
13176
13024
  const o = await this.deps.resolveOrder(orderRef);
13177
- const typedData = o.standard === "ERC1155" ? buildCancel1155TypedData(orderRef, signer.address, this.deps.config) : buildCancelTypedData(orderRef, signer.address, this.deps.config);
13178
- const signature = await signer.signTypedData(typedData);
13179
- const calls = o.standard === "ERC1155" ? buildCancel1155Calls({ orderHash: orderRef, offerer: signer.address, signature }, this.deps.config) : buildCancelCalls({ orderHash: orderRef, offerer: signer.address, signature }, this.deps.config);
13180
- return signer.execute(calls);
13025
+ if (o.standard === "ERC1155") {
13026
+ return this.m1155.cancelOrder(signer, { orderHash: orderRef });
13027
+ }
13028
+ return this.m721.cancelOrder(signer, { orderHash: orderRef });
13181
13029
  }
13182
13030
  async registerOrder(signer, p) {
13183
13031
  const standard = await this.deps.resolveStandard(p.asset.contract);
13184
- const paymentTokenAddress = resolveToken(p.paymentToken).address;
13032
+ const token = resolveToken(p.paymentToken);
13033
+ const humanPrice = formatAmount(p.amount, token.decimals);
13034
+ const durationSeconds = this.durationSeconds(p.endTime);
13185
13035
  const royaltyMaxBps = String(p.royaltyMaxBps);
13186
- const startTime = Math.floor(Date.now() / 1e3) + START_TIME_BUFFER_SECS;
13187
- const endTime = p.endTime && p.endTime > 0 ? p.endTime : startTime + NO_EXPIRY_SECONDS;
13188
13036
  const quantity = p.quantity ?? "1";
13189
- const marketplace = standard === "ERC1155" ? this.deps.config.marketplace1155Contract : this.deps.config.marketplaceContract;
13190
- const counter = String(await this.readCounter(marketplace, signer.address));
13191
- let typedData;
13192
- let buildCalls;
13037
+ let txHash;
13193
13038
  if (standard === "ERC1155") {
13194
- const built = (p.side === "listing" ? buildListing1155Order : buildOffer1155Order)(
13195
- {
13196
- offerer: signer.address,
13039
+ if (p.side === "listing") {
13040
+ const res = await this.m1155.createListing(signer, {
13197
13041
  nftContract: p.asset.contract,
13198
13042
  tokenId: p.asset.tokenId,
13199
- quantity,
13200
- priceWeiPerUnit: p.amount,
13201
- paymentTokenAddress,
13202
- royaltyMaxBps,
13203
- startTime,
13204
- endTime,
13205
- salt: p.salt,
13206
- counter
13207
- },
13208
- this.deps.config
13209
- );
13210
- typedData = built.typedData;
13211
- const approval = p.side === "listing" ? await this.approval1155ForListing(signer.address, p.asset.contract) : this.approvalForErc20(paymentTokenAddress, (BigInt(p.amount) * BigInt(quantity)).toString(), marketplace);
13212
- buildCalls = (sig) => buildRegister1155Calls({ orderParams: built.orderParams, signature: sig, ...approval }, this.deps.config);
13213
- } else {
13214
- const built = (p.side === "listing" ? buildListingOrder : buildOfferOrder)(
13215
- {
13216
- offerer: signer.address,
13043
+ amount: quantity,
13044
+ pricePerUnit: humanPrice,
13045
+ currency: p.paymentToken,
13046
+ durationSeconds,
13047
+ royaltyMaxBps
13048
+ });
13049
+ txHash = res.txHash;
13050
+ } else {
13051
+ const totalHuman = formatAmount((BigInt(p.amount) * BigInt(quantity)).toString(), token.decimals);
13052
+ const res = await this.m1155.makeOffer(signer, {
13217
13053
  nftContract: p.asset.contract,
13218
13054
  tokenId: p.asset.tokenId,
13219
- priceWei: p.amount,
13220
- paymentTokenAddress,
13221
- royaltyMaxBps,
13222
- startTime,
13223
- endTime,
13224
- salt: p.salt,
13225
- counter
13226
- },
13227
- this.deps.config
13228
- );
13229
- typedData = built.typedData;
13230
- const approval = p.side === "listing" ? await this.approval721ForListing(signer.address, p.asset.contract, p.asset.tokenId) : this.approvalForErc20(paymentTokenAddress, p.amount, marketplace);
13231
- buildCalls = (sig) => buildRegisterCalls({ orderParams: built.orderParams, signature: sig, ...approval }, this.deps.config);
13055
+ amount: quantity,
13056
+ price: totalHuman,
13057
+ currency: p.paymentToken,
13058
+ durationSeconds,
13059
+ royaltyMaxBps
13060
+ });
13061
+ txHash = res.txHash;
13062
+ }
13063
+ } else {
13064
+ const params = {
13065
+ nftContract: p.asset.contract,
13066
+ tokenId: p.asset.tokenId,
13067
+ price: humanPrice,
13068
+ currency: p.paymentToken,
13069
+ durationSeconds,
13070
+ royaltyMaxBps
13071
+ };
13072
+ const res = p.side === "listing" ? await this.m721.createListing(signer, params) : await this.m721.makeOffer(signer, params);
13073
+ txHash = res.txHash;
13232
13074
  }
13233
- const signature = await signer.signTypedData(typedData);
13234
- const { txHash } = await signer.execute(buildCalls(signature));
13235
13075
  const orderRef = await this.orderRefFromReceipt(txHash);
13236
13076
  return { txHash, orderRef };
13237
13077
  }
13238
- // ─── reads (all on deps.provider) ─────────────────────────────────────────
13239
- async readCounter(marketplace, address) {
13240
- const res = await this.deps.provider.callContract({
13241
- contractAddress: marketplace,
13242
- entrypoint: "get_counter",
13243
- calldata: [address]
13244
- });
13245
- return BigInt(res[0] ?? "0");
13246
- }
13247
- /** 721 listing approval: `get_approved(tokenId) == marketplace` ⇒ no approve. */
13248
- async approval721ForListing(_owner, nftContract, tokenId) {
13249
- const id = starknet.cairo.uint256(tokenId);
13250
- const approve = {
13251
- contractAddress: nftContract,
13252
- entrypoint: "approve",
13253
- calldata: [this.deps.config.marketplaceContract, id.low.toString(), id.high.toString()]
13254
- };
13255
- let approved = false;
13256
- try {
13257
- const res = await this.deps.provider.callContract({
13258
- contractAddress: nftContract,
13259
- entrypoint: "get_approved",
13260
- calldata: [id.low.toString(), id.high.toString()]
13261
- });
13262
- approved = BigInt(res[0]).toString() === BigInt(this.deps.config.marketplaceContract).toString();
13263
- } catch {
13264
- }
13265
- return { approvalNeeded: !approved, approve };
13266
- }
13267
- /** 1155 listing approval: `is_approved_for_all(owner, marketplace)`. */
13268
- async approval1155ForListing(owner, nftContract) {
13269
- const approve = {
13270
- contractAddress: nftContract,
13271
- entrypoint: "set_approval_for_all",
13272
- calldata: [this.deps.config.marketplace1155Contract, "1"]
13273
- };
13274
- let approved = false;
13275
- try {
13276
- const res = await this.deps.provider.callContract({
13277
- contractAddress: nftContract,
13278
- entrypoint: "is_approved_for_all",
13279
- calldata: [owner, this.deps.config.marketplace1155Contract]
13280
- });
13281
- approved = BigInt(res[0]) === 1n;
13282
- } catch {
13283
- }
13284
- return { approvalNeeded: !approved, approve };
13285
- }
13286
- /** Offers always approve the ERC-20 spend (no read). */
13287
- approvalForErc20(token, amountWei, marketplace) {
13288
- const u = starknet.cairo.uint256(amountWei);
13289
- return {
13290
- approvalNeeded: true,
13291
- approve: {
13292
- contractAddress: token,
13293
- entrypoint: "approve",
13294
- calldata: [marketplace, u.low.toString(), u.high.toString()]
13295
- }
13296
- };
13078
+ durationSeconds(endTime) {
13079
+ if (!endTime) return NO_EXPIRY_SECONDS;
13080
+ return Math.max(1, endTime - Math.floor(Date.now() / 1e3));
13297
13081
  }
13298
13082
  /** The canonical Starknet order id = the contract-emitted `OrderCreated`
13299
13083
  * hash (`keys[1]`), which is exactly what the indexer stores. */