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