@medialane/sdk 0.61.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.
@@ -4651,26 +4651,8 @@ var CreatorCoinFactoryABI = [{ "type": "impl", "name": "FactoryImpl", "interface
4651
4651
  var IPTicketCollectionABI = [
4652
4652
  {
4653
4653
  "type": "impl",
4654
- "name": "ERC721MetadataImpl",
4655
- "interface_name": "openzeppelin_token::erc721::interface::IERC721Metadata"
4656
- },
4657
- {
4658
- "type": "struct",
4659
- "name": "core::byte_array::ByteArray",
4660
- "members": [
4661
- {
4662
- "name": "data",
4663
- "type": "core::array::Array::<core::bytes_31::bytes31>"
4664
- },
4665
- {
4666
- "name": "pending_word",
4667
- "type": "core::felt252"
4668
- },
4669
- {
4670
- "name": "pending_word_len",
4671
- "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
4672
- }
4673
- ]
4654
+ "name": "ERC1155MetadataURIImpl",
4655
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155MetadataURI"
4674
4656
  },
4675
4657
  {
4676
4658
  "type": "struct",
@@ -4687,64 +4669,33 @@ var IPTicketCollectionABI = [
4687
4669
  ]
4688
4670
  },
4689
4671
  {
4690
- "type": "interface",
4691
- "name": "openzeppelin_token::erc721::interface::IERC721Metadata",
4692
- "items": [
4672
+ "type": "struct",
4673
+ "name": "core::byte_array::ByteArray",
4674
+ "members": [
4693
4675
  {
4694
- "type": "function",
4695
- "name": "name",
4696
- "inputs": [],
4697
- "outputs": [
4698
- {
4699
- "type": "core::byte_array::ByteArray"
4700
- }
4701
- ],
4702
- "state_mutability": "view"
4676
+ "name": "data",
4677
+ "type": "core::array::Array::<core::bytes_31::bytes31>"
4703
4678
  },
4704
4679
  {
4705
- "type": "function",
4706
- "name": "symbol",
4707
- "inputs": [],
4708
- "outputs": [
4709
- {
4710
- "type": "core::byte_array::ByteArray"
4711
- }
4712
- ],
4713
- "state_mutability": "view"
4680
+ "name": "pending_word",
4681
+ "type": "core::felt252"
4714
4682
  },
4715
4683
  {
4716
- "type": "function",
4717
- "name": "token_uri",
4718
- "inputs": [
4719
- {
4720
- "name": "token_id",
4721
- "type": "core::integer::u256"
4722
- }
4723
- ],
4724
- "outputs": [
4725
- {
4726
- "type": "core::byte_array::ByteArray"
4727
- }
4728
- ],
4729
- "state_mutability": "view"
4684
+ "name": "pending_word_len",
4685
+ "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
4730
4686
  }
4731
4687
  ]
4732
4688
  },
4733
- {
4734
- "type": "impl",
4735
- "name": "ERC721MetadataCamelOnlyImpl",
4736
- "interface_name": "openzeppelin_token::erc721::interface::IERC721MetadataCamelOnly"
4737
- },
4738
4689
  {
4739
4690
  "type": "interface",
4740
- "name": "openzeppelin_token::erc721::interface::IERC721MetadataCamelOnly",
4691
+ "name": "openzeppelin_token::erc1155::interface::IERC1155MetadataURI",
4741
4692
  "items": [
4742
4693
  {
4743
4694
  "type": "function",
4744
- "name": "tokenURI",
4695
+ "name": "uri",
4745
4696
  "inputs": [
4746
4697
  {
4747
- "name": "tokenId",
4698
+ "name": "token_id",
4748
4699
  "type": "core::integer::u256"
4749
4700
  }
4750
4701
  ],
@@ -4759,16 +4710,16 @@ var IPTicketCollectionABI = [
4759
4710
  },
4760
4711
  {
4761
4712
  "type": "impl",
4762
- "name": "IPTicketImpl",
4713
+ "name": "IPTicketCollectionImpl",
4763
4714
  "interface_name": "ip_ticket::interface::IIPTicketCollection"
4764
4715
  },
4765
4716
  {
4766
4717
  "type": "enum",
4767
- "name": "core::option::Option::<core::starknet::contract_address::ContractAddress>",
4718
+ "name": "core::option::Option::<core::integer::u64>",
4768
4719
  "variants": [
4769
4720
  {
4770
4721
  "name": "Some",
4771
- "type": "core::starknet::contract_address::ContractAddress"
4722
+ "type": "core::integer::u64"
4772
4723
  },
4773
4724
  {
4774
4725
  "name": "None",
@@ -4792,16 +4743,12 @@ var IPTicketCollectionABI = [
4792
4743
  },
4793
4744
  {
4794
4745
  "type": "struct",
4795
- "name": "ip_ticket::types::TicketCollection",
4746
+ "name": "ip_ticket::types::EventRecord",
4796
4747
  "members": [
4797
4748
  {
4798
4749
  "name": "creator",
4799
4750
  "type": "core::starknet::contract_address::ContractAddress"
4800
4751
  },
4801
- {
4802
- "name": "price",
4803
- "type": "core::integer::u256"
4804
- },
4805
4752
  {
4806
4753
  "name": "max_supply",
4807
4754
  "type": "core::integer::u256"
@@ -4811,16 +4758,16 @@ var IPTicketCollectionABI = [
4811
4758
  "type": "core::integer::u256"
4812
4759
  },
4813
4760
  {
4814
- "name": "expiration",
4815
- "type": "core::integer::u64"
4761
+ "name": "start_time",
4762
+ "type": "core::option::Option::<core::integer::u64>"
4816
4763
  },
4817
4764
  {
4818
- "name": "royalty_bps",
4819
- "type": "core::integer::u256"
4765
+ "name": "end_time",
4766
+ "type": "core::option::Option::<core::integer::u64>"
4820
4767
  },
4821
4768
  {
4822
- "name": "payment_token",
4823
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>"
4769
+ "name": "royalty_bps",
4770
+ "type": "core::integer::u16"
4824
4771
  },
4825
4772
  {
4826
4773
  "name": "metadata_uri",
@@ -4832,71 +4779,29 @@ var IPTicketCollectionABI = [
4832
4779
  }
4833
4780
  ]
4834
4781
  },
4835
- {
4836
- "type": "struct",
4837
- "name": "ip_ticket::types::TicketData",
4838
- "members": [
4839
- {
4840
- "name": "token_id",
4841
- "type": "core::integer::u256"
4842
- },
4843
- {
4844
- "name": "owner",
4845
- "type": "core::starknet::contract_address::ContractAddress"
4846
- },
4847
- {
4848
- "name": "collection_id",
4849
- "type": "core::integer::u256"
4850
- },
4851
- {
4852
- "name": "creator",
4853
- "type": "core::starknet::contract_address::ContractAddress"
4854
- },
4855
- {
4856
- "name": "metadata_uri",
4857
- "type": "core::byte_array::ByteArray"
4858
- },
4859
- {
4860
- "name": "expiration",
4861
- "type": "core::integer::u64"
4862
- },
4863
- {
4864
- "name": "redeemed",
4865
- "type": "core::bool"
4866
- },
4867
- {
4868
- "name": "valid",
4869
- "type": "core::bool"
4870
- }
4871
- ]
4872
- },
4873
4782
  {
4874
4783
  "type": "interface",
4875
4784
  "name": "ip_ticket::interface::IIPTicketCollection",
4876
4785
  "items": [
4877
4786
  {
4878
4787
  "type": "function",
4879
- "name": "create_ticket_collection",
4788
+ "name": "create_event",
4880
4789
  "inputs": [
4881
- {
4882
- "name": "price",
4883
- "type": "core::integer::u256"
4884
- },
4885
4790
  {
4886
4791
  "name": "max_supply",
4887
4792
  "type": "core::integer::u256"
4888
4793
  },
4889
4794
  {
4890
- "name": "expiration",
4891
- "type": "core::integer::u64"
4795
+ "name": "start_time",
4796
+ "type": "core::option::Option::<core::integer::u64>"
4892
4797
  },
4893
4798
  {
4894
- "name": "royalty_bps",
4895
- "type": "core::integer::u256"
4799
+ "name": "end_time",
4800
+ "type": "core::option::Option::<core::integer::u64>"
4896
4801
  },
4897
4802
  {
4898
- "name": "payment_token",
4899
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>"
4803
+ "name": "royalty_bps",
4804
+ "type": "core::integer::u16"
4900
4805
  },
4901
4806
  {
4902
4807
  "name": "metadata_uri",
@@ -4912,43 +4817,35 @@ var IPTicketCollectionABI = [
4912
4817
  },
4913
4818
  {
4914
4819
  "type": "function",
4915
- "name": "set_collection_active",
4820
+ "name": "mint",
4916
4821
  "inputs": [
4917
4822
  {
4918
- "name": "collection_id",
4919
- "type": "core::integer::u256"
4823
+ "name": "to",
4824
+ "type": "core::starknet::contract_address::ContractAddress"
4920
4825
  },
4921
4826
  {
4922
- "name": "active",
4923
- "type": "core::bool"
4924
- }
4925
- ],
4926
- "outputs": [],
4927
- "state_mutability": "external"
4928
- },
4929
- {
4930
- "type": "function",
4931
- "name": "mint_ticket",
4932
- "inputs": [
4933
- {
4934
- "name": "collection_id",
4827
+ "name": "token_id",
4935
4828
  "type": "core::integer::u256"
4936
- }
4937
- ],
4938
- "outputs": [
4829
+ },
4939
4830
  {
4831
+ "name": "amount",
4940
4832
  "type": "core::integer::u256"
4941
4833
  }
4942
4834
  ],
4835
+ "outputs": [],
4943
4836
  "state_mutability": "external"
4944
4837
  },
4945
4838
  {
4946
4839
  "type": "function",
4947
- "name": "redeem_ticket",
4840
+ "name": "pause_event",
4948
4841
  "inputs": [
4949
4842
  {
4950
4843
  "name": "token_id",
4951
4844
  "type": "core::integer::u256"
4845
+ },
4846
+ {
4847
+ "name": "active",
4848
+ "type": "core::bool"
4952
4849
  }
4953
4850
  ],
4954
4851
  "outputs": [],
@@ -4956,15 +4853,15 @@ var IPTicketCollectionABI = [
4956
4853
  },
4957
4854
  {
4958
4855
  "type": "function",
4959
- "name": "has_valid_ticket",
4856
+ "name": "is_valid",
4960
4857
  "inputs": [
4961
4858
  {
4962
- "name": "user",
4963
- "type": "core::starknet::contract_address::ContractAddress"
4859
+ "name": "token_id",
4860
+ "type": "core::integer::u256"
4964
4861
  },
4965
4862
  {
4966
- "name": "collection_id",
4967
- "type": "core::integer::u256"
4863
+ "name": "holder",
4864
+ "type": "core::starknet::contract_address::ContractAddress"
4968
4865
  }
4969
4866
  ],
4970
4867
  "outputs": [
@@ -4976,23 +4873,7 @@ var IPTicketCollectionABI = [
4976
4873
  },
4977
4874
  {
4978
4875
  "type": "function",
4979
- "name": "get_ticket_collection",
4980
- "inputs": [
4981
- {
4982
- "name": "collection_id",
4983
- "type": "core::integer::u256"
4984
- }
4985
- ],
4986
- "outputs": [
4987
- {
4988
- "type": "ip_ticket::types::TicketCollection"
4989
- }
4990
- ],
4991
- "state_mutability": "view"
4992
- },
4993
- {
4994
- "type": "function",
4995
- "name": "get_ticket_data",
4876
+ "name": "get_event",
4996
4877
  "inputs": [
4997
4878
  {
4998
4879
  "name": "token_id",
@@ -5001,72 +4882,34 @@ var IPTicketCollectionABI = [
5001
4882
  ],
5002
4883
  "outputs": [
5003
4884
  {
5004
- "type": "ip_ticket::types::TicketData"
4885
+ "type": "ip_ticket::types::EventRecord"
5005
4886
  }
5006
4887
  ],
5007
4888
  "state_mutability": "view"
5008
4889
  },
5009
4890
  {
5010
4891
  "type": "function",
5011
- "name": "get_ticket_collection_id",
4892
+ "name": "royalty_info",
5012
4893
  "inputs": [
5013
4894
  {
5014
4895
  "name": "token_id",
5015
4896
  "type": "core::integer::u256"
5016
- }
5017
- ],
5018
- "outputs": [
5019
- {
5020
- "type": "core::integer::u256"
5021
- }
5022
- ],
5023
- "state_mutability": "view"
5024
- },
5025
- {
5026
- "type": "function",
5027
- "name": "get_active_ticket_balance",
5028
- "inputs": [
5029
- {
5030
- "name": "user",
5031
- "type": "core::starknet::contract_address::ContractAddress"
5032
4897
  },
5033
4898
  {
5034
- "name": "collection_id",
5035
- "type": "core::integer::u256"
5036
- }
5037
- ],
5038
- "outputs": [
5039
- {
5040
- "type": "core::integer::u256"
5041
- }
5042
- ],
5043
- "state_mutability": "view"
5044
- },
5045
- {
5046
- "type": "function",
5047
- "name": "get_last_collection_id",
5048
- "inputs": [],
5049
- "outputs": [
5050
- {
4899
+ "name": "sale_price",
5051
4900
  "type": "core::integer::u256"
5052
4901
  }
5053
4902
  ],
5054
- "state_mutability": "view"
5055
- },
5056
- {
5057
- "type": "function",
5058
- "name": "total_supply",
5059
- "inputs": [],
5060
4903
  "outputs": [
5061
4904
  {
5062
- "type": "core::integer::u256"
4905
+ "type": "(core::starknet::contract_address::ContractAddress, core::integer::u256)"
5063
4906
  }
5064
4907
  ],
5065
4908
  "state_mutability": "view"
5066
4909
  },
5067
4910
  {
5068
4911
  "type": "function",
5069
- "name": "royalty_info",
4912
+ "name": "royaltyInfo",
5070
4913
  "inputs": [
5071
4914
  {
5072
4915
  "name": "token_id",
@@ -5086,20 +4929,11 @@ var IPTicketCollectionABI = [
5086
4929
  },
5087
4930
  {
5088
4931
  "type": "function",
5089
- "name": "royaltyInfo",
5090
- "inputs": [
5091
- {
5092
- "name": "token_id",
5093
- "type": "core::integer::u256"
5094
- },
5095
- {
5096
- "name": "sale_price",
5097
- "type": "core::integer::u256"
5098
- }
5099
- ],
4932
+ "name": "version",
4933
+ "inputs": [],
5100
4934
  "outputs": [
5101
4935
  {
5102
- "type": "(core::starknet::contract_address::ContractAddress, core::integer::u256)"
4936
+ "type": "core::byte_array::ByteArray"
5103
4937
  }
5104
4938
  ],
5105
4939
  "state_mutability": "view"
@@ -5108,8 +4942,28 @@ var IPTicketCollectionABI = [
5108
4942
  },
5109
4943
  {
5110
4944
  "type": "impl",
5111
- "name": "ERC721Impl",
5112
- "interface_name": "openzeppelin_token::erc721::interface::IERC721"
4945
+ "name": "ERC1155Impl",
4946
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155"
4947
+ },
4948
+ {
4949
+ "type": "struct",
4950
+ "name": "core::array::Span::<core::starknet::contract_address::ContractAddress>",
4951
+ "members": [
4952
+ {
4953
+ "name": "snapshot",
4954
+ "type": "@core::array::Array::<core::starknet::contract_address::ContractAddress>"
4955
+ }
4956
+ ]
4957
+ },
4958
+ {
4959
+ "type": "struct",
4960
+ "name": "core::array::Span::<core::integer::u256>",
4961
+ "members": [
4962
+ {
4963
+ "name": "snapshot",
4964
+ "type": "@core::array::Array::<core::integer::u256>"
4965
+ }
4966
+ ]
5113
4967
  },
5114
4968
  {
5115
4969
  "type": "struct",
@@ -5123,7 +4977,7 @@ var IPTicketCollectionABI = [
5123
4977
  },
5124
4978
  {
5125
4979
  "type": "interface",
5126
- "name": "openzeppelin_token::erc721::interface::IERC721",
4980
+ "name": "openzeppelin_token::erc1155::interface::IERC1155",
5127
4981
  "items": [
5128
4982
  {
5129
4983
  "type": "function",
@@ -5132,6 +4986,10 @@ var IPTicketCollectionABI = [
5132
4986
  {
5133
4987
  "name": "account",
5134
4988
  "type": "core::starknet::contract_address::ContractAddress"
4989
+ },
4990
+ {
4991
+ "name": "token_id",
4992
+ "type": "core::integer::u256"
5135
4993
  }
5136
4994
  ],
5137
4995
  "outputs": [
@@ -5143,16 +5001,20 @@ var IPTicketCollectionABI = [
5143
5001
  },
5144
5002
  {
5145
5003
  "type": "function",
5146
- "name": "owner_of",
5004
+ "name": "balance_of_batch",
5147
5005
  "inputs": [
5148
5006
  {
5149
- "name": "token_id",
5150
- "type": "core::integer::u256"
5007
+ "name": "accounts",
5008
+ "type": "core::array::Span::<core::starknet::contract_address::ContractAddress>"
5009
+ },
5010
+ {
5011
+ "name": "token_ids",
5012
+ "type": "core::array::Span::<core::integer::u256>"
5151
5013
  }
5152
5014
  ],
5153
5015
  "outputs": [
5154
5016
  {
5155
- "type": "core::starknet::contract_address::ContractAddress"
5017
+ "type": "core::array::Span::<core::integer::u256>"
5156
5018
  }
5157
5019
  ],
5158
5020
  "state_mutability": "view"
@@ -5173,6 +5035,10 @@ var IPTicketCollectionABI = [
5173
5035
  "name": "token_id",
5174
5036
  "type": "core::integer::u256"
5175
5037
  },
5038
+ {
5039
+ "name": "value",
5040
+ "type": "core::integer::u256"
5041
+ },
5176
5042
  {
5177
5043
  "name": "data",
5178
5044
  "type": "core::array::Span::<core::felt252>"
@@ -5183,7 +5049,7 @@ var IPTicketCollectionABI = [
5183
5049
  },
5184
5050
  {
5185
5051
  "type": "function",
5186
- "name": "transfer_from",
5052
+ "name": "safe_batch_transfer_from",
5187
5053
  "inputs": [
5188
5054
  {
5189
5055
  "name": "from",
@@ -5194,24 +5060,16 @@ var IPTicketCollectionABI = [
5194
5060
  "type": "core::starknet::contract_address::ContractAddress"
5195
5061
  },
5196
5062
  {
5197
- "name": "token_id",
5198
- "type": "core::integer::u256"
5199
- }
5200
- ],
5201
- "outputs": [],
5202
- "state_mutability": "external"
5203
- },
5204
- {
5205
- "type": "function",
5206
- "name": "approve",
5207
- "inputs": [
5063
+ "name": "token_ids",
5064
+ "type": "core::array::Span::<core::integer::u256>"
5065
+ },
5208
5066
  {
5209
- "name": "to",
5210
- "type": "core::starknet::contract_address::ContractAddress"
5067
+ "name": "values",
5068
+ "type": "core::array::Span::<core::integer::u256>"
5211
5069
  },
5212
5070
  {
5213
- "name": "token_id",
5214
- "type": "core::integer::u256"
5071
+ "name": "data",
5072
+ "type": "core::array::Span::<core::felt252>"
5215
5073
  }
5216
5074
  ],
5217
5075
  "outputs": [],
@@ -5219,66 +5077,50 @@ var IPTicketCollectionABI = [
5219
5077
  },
5220
5078
  {
5221
5079
  "type": "function",
5222
- "name": "set_approval_for_all",
5080
+ "name": "is_approved_for_all",
5223
5081
  "inputs": [
5224
5082
  {
5225
- "name": "operator",
5083
+ "name": "owner",
5226
5084
  "type": "core::starknet::contract_address::ContractAddress"
5227
5085
  },
5228
5086
  {
5229
- "name": "approved",
5230
- "type": "core::bool"
5231
- }
5232
- ],
5233
- "outputs": [],
5234
- "state_mutability": "external"
5235
- },
5236
- {
5237
- "type": "function",
5238
- "name": "get_approved",
5239
- "inputs": [
5240
- {
5241
- "name": "token_id",
5242
- "type": "core::integer::u256"
5087
+ "name": "operator",
5088
+ "type": "core::starknet::contract_address::ContractAddress"
5243
5089
  }
5244
5090
  ],
5245
5091
  "outputs": [
5246
5092
  {
5247
- "type": "core::starknet::contract_address::ContractAddress"
5093
+ "type": "core::bool"
5248
5094
  }
5249
5095
  ],
5250
5096
  "state_mutability": "view"
5251
5097
  },
5252
5098
  {
5253
5099
  "type": "function",
5254
- "name": "is_approved_for_all",
5100
+ "name": "set_approval_for_all",
5255
5101
  "inputs": [
5256
- {
5257
- "name": "owner",
5258
- "type": "core::starknet::contract_address::ContractAddress"
5259
- },
5260
5102
  {
5261
5103
  "name": "operator",
5262
5104
  "type": "core::starknet::contract_address::ContractAddress"
5263
- }
5264
- ],
5265
- "outputs": [
5105
+ },
5266
5106
  {
5107
+ "name": "approved",
5267
5108
  "type": "core::bool"
5268
5109
  }
5269
5110
  ],
5270
- "state_mutability": "view"
5111
+ "outputs": [],
5112
+ "state_mutability": "external"
5271
5113
  }
5272
5114
  ]
5273
5115
  },
5274
5116
  {
5275
5117
  "type": "impl",
5276
- "name": "ERC721CamelOnly",
5277
- "interface_name": "openzeppelin_token::erc721::interface::IERC721CamelOnly"
5118
+ "name": "ERC1155CamelImpl",
5119
+ "interface_name": "openzeppelin_token::erc1155::interface::IERC1155Camel"
5278
5120
  },
5279
5121
  {
5280
5122
  "type": "interface",
5281
- "name": "openzeppelin_token::erc721::interface::IERC721CamelOnly",
5123
+ "name": "openzeppelin_token::erc1155::interface::IERC1155Camel",
5282
5124
  "items": [
5283
5125
  {
5284
5126
  "type": "function",
@@ -5287,6 +5129,10 @@ var IPTicketCollectionABI = [
5287
5129
  {
5288
5130
  "name": "account",
5289
5131
  "type": "core::starknet::contract_address::ContractAddress"
5132
+ },
5133
+ {
5134
+ "name": "tokenId",
5135
+ "type": "core::integer::u256"
5290
5136
  }
5291
5137
  ],
5292
5138
  "outputs": [
@@ -5298,16 +5144,20 @@ var IPTicketCollectionABI = [
5298
5144
  },
5299
5145
  {
5300
5146
  "type": "function",
5301
- "name": "ownerOf",
5147
+ "name": "balanceOfBatch",
5302
5148
  "inputs": [
5303
5149
  {
5304
- "name": "tokenId",
5305
- "type": "core::integer::u256"
5150
+ "name": "accounts",
5151
+ "type": "core::array::Span::<core::starknet::contract_address::ContractAddress>"
5152
+ },
5153
+ {
5154
+ "name": "tokenIds",
5155
+ "type": "core::array::Span::<core::integer::u256>"
5306
5156
  }
5307
5157
  ],
5308
5158
  "outputs": [
5309
5159
  {
5310
- "type": "core::starknet::contract_address::ContractAddress"
5160
+ "type": "core::array::Span::<core::integer::u256>"
5311
5161
  }
5312
5162
  ],
5313
5163
  "state_mutability": "view"
@@ -5328,6 +5178,10 @@ var IPTicketCollectionABI = [
5328
5178
  "name": "tokenId",
5329
5179
  "type": "core::integer::u256"
5330
5180
  },
5181
+ {
5182
+ "name": "value",
5183
+ "type": "core::integer::u256"
5184
+ },
5331
5185
  {
5332
5186
  "name": "data",
5333
5187
  "type": "core::array::Span::<core::felt252>"
@@ -5338,7 +5192,7 @@ var IPTicketCollectionABI = [
5338
5192
  },
5339
5193
  {
5340
5194
  "type": "function",
5341
- "name": "transferFrom",
5195
+ "name": "safeBatchTransferFrom",
5342
5196
  "inputs": [
5343
5197
  {
5344
5198
  "name": "from",
@@ -5349,24 +5203,16 @@ var IPTicketCollectionABI = [
5349
5203
  "type": "core::starknet::contract_address::ContractAddress"
5350
5204
  },
5351
5205
  {
5352
- "name": "tokenId",
5353
- "type": "core::integer::u256"
5354
- }
5355
- ],
5356
- "outputs": [],
5357
- "state_mutability": "external"
5358
- },
5359
- {
5360
- "type": "function",
5361
- "name": "setApprovalForAll",
5362
- "inputs": [
5206
+ "name": "tokenIds",
5207
+ "type": "core::array::Span::<core::integer::u256>"
5208
+ },
5363
5209
  {
5364
- "name": "operator",
5365
- "type": "core::starknet::contract_address::ContractAddress"
5210
+ "name": "values",
5211
+ "type": "core::array::Span::<core::integer::u256>"
5366
5212
  },
5367
5213
  {
5368
- "name": "approved",
5369
- "type": "core::bool"
5214
+ "name": "data",
5215
+ "type": "core::array::Span::<core::felt252>"
5370
5216
  }
5371
5217
  ],
5372
5218
  "outputs": [],
@@ -5374,39 +5220,39 @@ var IPTicketCollectionABI = [
5374
5220
  },
5375
5221
  {
5376
5222
  "type": "function",
5377
- "name": "getApproved",
5223
+ "name": "isApprovedForAll",
5378
5224
  "inputs": [
5379
5225
  {
5380
- "name": "tokenId",
5381
- "type": "core::integer::u256"
5226
+ "name": "owner",
5227
+ "type": "core::starknet::contract_address::ContractAddress"
5228
+ },
5229
+ {
5230
+ "name": "operator",
5231
+ "type": "core::starknet::contract_address::ContractAddress"
5382
5232
  }
5383
5233
  ],
5384
5234
  "outputs": [
5385
5235
  {
5386
- "type": "core::starknet::contract_address::ContractAddress"
5236
+ "type": "core::bool"
5387
5237
  }
5388
5238
  ],
5389
5239
  "state_mutability": "view"
5390
5240
  },
5391
5241
  {
5392
5242
  "type": "function",
5393
- "name": "isApprovedForAll",
5243
+ "name": "setApprovalForAll",
5394
5244
  "inputs": [
5395
- {
5396
- "name": "owner",
5397
- "type": "core::starknet::contract_address::ContractAddress"
5398
- },
5399
5245
  {
5400
5246
  "name": "operator",
5401
5247
  "type": "core::starknet::contract_address::ContractAddress"
5402
- }
5403
- ],
5404
- "outputs": [
5248
+ },
5405
5249
  {
5250
+ "name": "approved",
5406
5251
  "type": "core::bool"
5407
5252
  }
5408
5253
  ],
5409
- "state_mutability": "view"
5254
+ "outputs": [],
5255
+ "state_mutability": "external"
5410
5256
  }
5411
5257
  ]
5412
5258
  },
@@ -5517,9 +5363,14 @@ var IPTicketCollectionABI = [
5517
5363
  },
5518
5364
  {
5519
5365
  "type": "event",
5520
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
5366
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferSingle",
5521
5367
  "kind": "struct",
5522
5368
  "members": [
5369
+ {
5370
+ "name": "operator",
5371
+ "type": "core::starknet::contract_address::ContractAddress",
5372
+ "kind": "key"
5373
+ },
5523
5374
  {
5524
5375
  "name": "from",
5525
5376
  "type": "core::starknet::contract_address::ContractAddress",
@@ -5531,15 +5382,52 @@ var IPTicketCollectionABI = [
5531
5382
  "kind": "key"
5532
5383
  },
5533
5384
  {
5534
- "name": "token_id",
5385
+ "name": "id",
5386
+ "type": "core::integer::u256",
5387
+ "kind": "data"
5388
+ },
5389
+ {
5390
+ "name": "value",
5535
5391
  "type": "core::integer::u256",
5392
+ "kind": "data"
5393
+ }
5394
+ ]
5395
+ },
5396
+ {
5397
+ "type": "event",
5398
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferBatch",
5399
+ "kind": "struct",
5400
+ "members": [
5401
+ {
5402
+ "name": "operator",
5403
+ "type": "core::starknet::contract_address::ContractAddress",
5404
+ "kind": "key"
5405
+ },
5406
+ {
5407
+ "name": "from",
5408
+ "type": "core::starknet::contract_address::ContractAddress",
5409
+ "kind": "key"
5410
+ },
5411
+ {
5412
+ "name": "to",
5413
+ "type": "core::starknet::contract_address::ContractAddress",
5536
5414
  "kind": "key"
5415
+ },
5416
+ {
5417
+ "name": "ids",
5418
+ "type": "core::array::Span::<core::integer::u256>",
5419
+ "kind": "data"
5420
+ },
5421
+ {
5422
+ "name": "values",
5423
+ "type": "core::array::Span::<core::integer::u256>",
5424
+ "kind": "data"
5537
5425
  }
5538
5426
  ]
5539
5427
  },
5540
5428
  {
5541
5429
  "type": "event",
5542
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
5430
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::ApprovalForAll",
5543
5431
  "kind": "struct",
5544
5432
  "members": [
5545
5433
  {
@@ -5548,57 +5436,57 @@ var IPTicketCollectionABI = [
5548
5436
  "kind": "key"
5549
5437
  },
5550
5438
  {
5551
- "name": "approved",
5439
+ "name": "operator",
5552
5440
  "type": "core::starknet::contract_address::ContractAddress",
5553
5441
  "kind": "key"
5554
5442
  },
5555
5443
  {
5556
- "name": "token_id",
5557
- "type": "core::integer::u256",
5558
- "kind": "key"
5444
+ "name": "approved",
5445
+ "type": "core::bool",
5446
+ "kind": "data"
5559
5447
  }
5560
5448
  ]
5561
5449
  },
5562
5450
  {
5563
5451
  "type": "event",
5564
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
5452
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::URI",
5565
5453
  "kind": "struct",
5566
5454
  "members": [
5567
5455
  {
5568
- "name": "owner",
5569
- "type": "core::starknet::contract_address::ContractAddress",
5570
- "kind": "key"
5456
+ "name": "value",
5457
+ "type": "core::byte_array::ByteArray",
5458
+ "kind": "data"
5571
5459
  },
5572
5460
  {
5573
- "name": "operator",
5574
- "type": "core::starknet::contract_address::ContractAddress",
5461
+ "name": "id",
5462
+ "type": "core::integer::u256",
5575
5463
  "kind": "key"
5576
- },
5577
- {
5578
- "name": "approved",
5579
- "type": "core::bool",
5580
- "kind": "data"
5581
5464
  }
5582
5465
  ]
5583
5466
  },
5584
5467
  {
5585
5468
  "type": "event",
5586
- "name": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
5469
+ "name": "openzeppelin_token::erc1155::erc1155::ERC1155Component::Event",
5587
5470
  "kind": "enum",
5588
5471
  "variants": [
5589
5472
  {
5590
- "name": "Transfer",
5591
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
5473
+ "name": "TransferSingle",
5474
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferSingle",
5592
5475
  "kind": "nested"
5593
5476
  },
5594
5477
  {
5595
- "name": "Approval",
5596
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
5478
+ "name": "TransferBatch",
5479
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::TransferBatch",
5597
5480
  "kind": "nested"
5598
5481
  },
5599
5482
  {
5600
5483
  "name": "ApprovalForAll",
5601
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
5484
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::ApprovalForAll",
5485
+ "kind": "nested"
5486
+ },
5487
+ {
5488
+ "name": "URI",
5489
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::URI",
5602
5490
  "kind": "nested"
5603
5491
  }
5604
5492
  ]
@@ -5662,42 +5550,27 @@ var IPTicketCollectionABI = [
5662
5550
  },
5663
5551
  {
5664
5552
  "type": "event",
5665
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCollectionCreated",
5553
+ "name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventCreated",
5666
5554
  "kind": "struct",
5667
5555
  "members": [
5668
5556
  {
5669
- "name": "collection_id",
5557
+ "name": "token_id",
5670
5558
  "type": "core::integer::u256",
5671
5559
  "kind": "key"
5672
5560
  },
5673
- {
5674
- "name": "creator",
5675
- "type": "core::starknet::contract_address::ContractAddress",
5676
- "kind": "key"
5677
- },
5678
- {
5679
- "name": "price",
5680
- "type": "core::integer::u256",
5681
- "kind": "data"
5682
- },
5683
5561
  {
5684
5562
  "name": "max_supply",
5685
5563
  "type": "core::integer::u256",
5686
5564
  "kind": "data"
5687
5565
  },
5688
5566
  {
5689
- "name": "expiration",
5690
- "type": "core::integer::u64",
5691
- "kind": "data"
5692
- },
5693
- {
5694
- "name": "royalty_bps",
5695
- "type": "core::integer::u256",
5567
+ "name": "start_time",
5568
+ "type": "core::option::Option::<core::integer::u64>",
5696
5569
  "kind": "data"
5697
5570
  },
5698
5571
  {
5699
- "name": "payment_token",
5700
- "type": "core::option::Option::<core::starknet::contract_address::ContractAddress>",
5572
+ "name": "end_time",
5573
+ "type": "core::option::Option::<core::integer::u64>",
5701
5574
  "kind": "data"
5702
5575
  },
5703
5576
  {
@@ -5714,11 +5587,11 @@ var IPTicketCollectionABI = [
5714
5587
  },
5715
5588
  {
5716
5589
  "type": "event",
5717
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::CollectionStatusUpdated",
5590
+ "name": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
5718
5591
  "kind": "struct",
5719
5592
  "members": [
5720
5593
  {
5721
- "name": "collection_id",
5594
+ "name": "token_id",
5722
5595
  "type": "core::integer::u256",
5723
5596
  "kind": "key"
5724
5597
  },
@@ -5726,65 +5599,6 @@ var IPTicketCollectionABI = [
5726
5599
  "name": "active",
5727
5600
  "type": "core::bool",
5728
5601
  "kind": "data"
5729
- },
5730
- {
5731
- "name": "updated_at",
5732
- "type": "core::integer::u64",
5733
- "kind": "data"
5734
- }
5735
- ]
5736
- },
5737
- {
5738
- "type": "event",
5739
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketMinted",
5740
- "kind": "struct",
5741
- "members": [
5742
- {
5743
- "name": "token_id",
5744
- "type": "core::integer::u256",
5745
- "kind": "key"
5746
- },
5747
- {
5748
- "name": "collection_id",
5749
- "type": "core::integer::u256",
5750
- "kind": "key"
5751
- },
5752
- {
5753
- "name": "owner",
5754
- "type": "core::starknet::contract_address::ContractAddress",
5755
- "kind": "key"
5756
- },
5757
- {
5758
- "name": "minted_at",
5759
- "type": "core::integer::u64",
5760
- "kind": "data"
5761
- }
5762
- ]
5763
- },
5764
- {
5765
- "type": "event",
5766
- "name": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketRedeemed",
5767
- "kind": "struct",
5768
- "members": [
5769
- {
5770
- "name": "token_id",
5771
- "type": "core::integer::u256",
5772
- "kind": "key"
5773
- },
5774
- {
5775
- "name": "collection_id",
5776
- "type": "core::integer::u256",
5777
- "kind": "key"
5778
- },
5779
- {
5780
- "name": "owner",
5781
- "type": "core::starknet::contract_address::ContractAddress",
5782
- "kind": "key"
5783
- },
5784
- {
5785
- "name": "redeemed_at",
5786
- "type": "core::integer::u64",
5787
- "kind": "data"
5788
5602
  }
5789
5603
  ]
5790
5604
  },
@@ -5794,8 +5608,8 @@ var IPTicketCollectionABI = [
5794
5608
  "kind": "enum",
5795
5609
  "variants": [
5796
5610
  {
5797
- "name": "ERC721Event",
5798
- "type": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
5611
+ "name": "ERC1155Event",
5612
+ "type": "openzeppelin_token::erc1155::erc1155::ERC1155Component::Event",
5799
5613
  "kind": "flat"
5800
5614
  },
5801
5615
  {
@@ -5809,23 +5623,13 @@ var IPTicketCollectionABI = [
5809
5623
  "kind": "flat"
5810
5624
  },
5811
5625
  {
5812
- "name": "TicketCollectionCreated",
5813
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketCollectionCreated",
5814
- "kind": "nested"
5815
- },
5816
- {
5817
- "name": "CollectionStatusUpdated",
5818
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::CollectionStatusUpdated",
5819
- "kind": "nested"
5820
- },
5821
- {
5822
- "name": "TicketMinted",
5823
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketMinted",
5626
+ "name": "EventCreated",
5627
+ "type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventCreated",
5824
5628
  "kind": "nested"
5825
5629
  },
5826
5630
  {
5827
- "name": "TicketRedeemed",
5828
- "type": "ip_ticket::IPTicketCollection::IPTicketCollection::TicketRedeemed",
5631
+ "name": "EventPaused",
5632
+ "type": "ip_ticket::IPTicketCollection::IPTicketCollection::EventPaused",
5829
5633
  "kind": "nested"
5830
5634
  }
5831
5635
  ]
@@ -5885,7 +5689,7 @@ var IPTicketCollectionFactoryABI = [
5885
5689
  },
5886
5690
  {
5887
5691
  "type": "function",
5888
- "name": "deploy_ticket_collection",
5692
+ "name": "deploy_collection",
5889
5693
  "inputs": [
5890
5694
  {
5891
5695
  "name": "name",
@@ -5905,6 +5709,47 @@ var IPTicketCollectionFactoryABI = [
5905
5709
  }
5906
5710
  ]
5907
5711
  },
5712
+ {
5713
+ "type": "impl",
5714
+ "name": "SRC5Impl",
5715
+ "interface_name": "openzeppelin_introspection::interface::ISRC5"
5716
+ },
5717
+ {
5718
+ "type": "enum",
5719
+ "name": "core::bool",
5720
+ "variants": [
5721
+ {
5722
+ "name": "False",
5723
+ "type": "()"
5724
+ },
5725
+ {
5726
+ "name": "True",
5727
+ "type": "()"
5728
+ }
5729
+ ]
5730
+ },
5731
+ {
5732
+ "type": "interface",
5733
+ "name": "openzeppelin_introspection::interface::ISRC5",
5734
+ "items": [
5735
+ {
5736
+ "type": "function",
5737
+ "name": "supports_interface",
5738
+ "inputs": [
5739
+ {
5740
+ "name": "interface_id",
5741
+ "type": "core::felt252"
5742
+ }
5743
+ ],
5744
+ "outputs": [
5745
+ {
5746
+ "type": "core::bool"
5747
+ }
5748
+ ],
5749
+ "state_mutability": "view"
5750
+ }
5751
+ ]
5752
+ },
5908
5753
  {
5909
5754
  "type": "constructor",
5910
5755
  "name": "constructor",
@@ -5915,6 +5760,12 @@ var IPTicketCollectionFactoryABI = [
5915
5760
  }
5916
5761
  ]
5917
5762
  },
5763
+ {
5764
+ "type": "event",
5765
+ "name": "openzeppelin_introspection::src5::SRC5Component::Event",
5766
+ "kind": "enum",
5767
+ "variants": []
5768
+ },
5918
5769
  {
5919
5770
  "type": "event",
5920
5771
  "name": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::CollectionDeployed",
@@ -5947,6 +5798,11 @@ var IPTicketCollectionFactoryABI = [
5947
5798
  "name": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::Event",
5948
5799
  "kind": "enum",
5949
5800
  "variants": [
5801
+ {
5802
+ "name": "SRC5Event",
5803
+ "type": "openzeppelin_introspection::src5::SRC5Component::Event",
5804
+ "kind": "flat"
5805
+ },
5950
5806
  {
5951
5807
  "name": "CollectionDeployed",
5952
5808
  "type": "ip_ticket::IPTicketCollectionFactory::IPTicketCollectionFactory::CollectionDeployed",
@@ -10488,12 +10344,39 @@ var SUPPORTED_TOKENS = [
10488
10344
  ];
10489
10345
  var DEFAULT_CURRENCY = "USDC";
10490
10346
 
10347
+ // src/utils/bigint.ts
10348
+ function stringifyBigInts(obj) {
10349
+ if (typeof obj === "bigint") {
10350
+ return obj.toString();
10351
+ }
10352
+ if (Array.isArray(obj)) {
10353
+ return obj.map(stringifyBigInts);
10354
+ }
10355
+ if (obj !== null && typeof obj === "object") {
10356
+ return Object.fromEntries(
10357
+ Object.entries(obj).map(([key, value]) => [
10358
+ key,
10359
+ stringifyBigInts(value)
10360
+ ])
10361
+ );
10362
+ }
10363
+ return obj;
10364
+ }
10365
+
10491
10366
  // src/utils/token.ts
10492
10367
  function parseAmount(human, decimals) {
10493
10368
  const [whole, frac = ""] = human.split(".");
10494
10369
  const fracPadded = frac.padEnd(decimals, "0").slice(0, decimals);
10495
10370
  return (BigInt(whole) * BigInt(10) ** BigInt(decimals) + BigInt(fracPadded)).toString();
10496
10371
  }
10372
+ function formatAmount(raw, decimals) {
10373
+ const value = BigInt(raw);
10374
+ const factor = BigInt(Math.pow(10, decimals));
10375
+ const whole = value / factor;
10376
+ const remainder = value % factor;
10377
+ const fractional = remainder.toString().padStart(decimals, "0");
10378
+ return `${whole}.${fractional}`;
10379
+ }
10497
10380
  function getTokenByAddress(address) {
10498
10381
  const lower = address.toLowerCase();
10499
10382
  return SUPPORTED_TOKENS.find((t) => t.address.toLowerCase() === lower);
@@ -10522,25 +10405,6 @@ function buildFeeCall(p, cfg) {
10522
10405
  };
10523
10406
  }
10524
10407
 
10525
- // src/utils/bigint.ts
10526
- function stringifyBigInts(obj) {
10527
- if (typeof obj === "bigint") {
10528
- return obj.toString();
10529
- }
10530
- if (Array.isArray(obj)) {
10531
- return obj.map(stringifyBigInts);
10532
- }
10533
- if (obj !== null && typeof obj === "object") {
10534
- return Object.fromEntries(
10535
- Object.entries(obj).map(([key, value]) => [
10536
- key,
10537
- stringifyBigInts(value)
10538
- ])
10539
- );
10540
- }
10541
- return obj;
10542
- }
10543
-
10544
10408
  // src/utils/rpc.ts
10545
10409
  var PUBLIC_RPC_FALLBACKS = [
10546
10410
  "https://rpc.starknet.lava.build"
@@ -10621,14 +10485,6 @@ function toSignatureArray(sig) {
10621
10485
  const s = sig;
10622
10486
  return [s.r.toString(), s.s.toString()];
10623
10487
  }
10624
- function newContract(abi, address, providerOrAccount) {
10625
- const C = starknet.Contract;
10626
- return C.length === 1 ? new starknet.Contract({ abi, address, providerOrAccount }) : new starknet.Contract(
10627
- abi,
10628
- address,
10629
- providerOrAccount
10630
- );
10631
- }
10632
10488
  function getChainId(config) {
10633
10489
  if (config.chain !== "STARKNET") {
10634
10490
  throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
@@ -10644,101 +10500,13 @@ function resolveToken(currency) {
10644
10500
  }
10645
10501
  var _providerCache = /* @__PURE__ */ new WeakMap();
10646
10502
  function getProvider(config) {
10647
- let p = _providerCache.get(config);
10648
- if (!p) {
10649
- const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
10650
- p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
10651
- _providerCache.set(config, p);
10652
- }
10653
- return p;
10654
- }
10655
-
10656
- // src/starknet/marketplace/build.ts
10657
- function contractFor(cfg) {
10658
- return newContract(IPMarketplaceABI, cfg.marketplaceContract, getProvider(cfg));
10659
- }
10660
- function buildListingOrder(i, cfg) {
10661
- const orderParams = {
10662
- offerer: i.offerer,
10663
- marketplace: cfg.marketplaceContract,
10664
- offer: { item_type: "ERC721", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: "1" },
10665
- consideration: {
10666
- item_type: "ERC20",
10667
- token: i.paymentTokenAddress,
10668
- identifier_or_criteria: "0",
10669
- amount: i.priceWei,
10670
- recipient: i.offerer
10671
- },
10672
- royalty_max_bps: i.royaltyMaxBps,
10673
- start_time: String(i.startTime),
10674
- end_time: String(i.endTime),
10675
- salt: i.salt,
10676
- counter: i.counter
10677
- };
10678
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
10679
- return { orderParams, typedData };
10680
- }
10681
- function buildOfferOrder(i, cfg) {
10682
- const orderParams = {
10683
- offerer: i.offerer,
10684
- marketplace: cfg.marketplaceContract,
10685
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWei },
10686
- consideration: {
10687
- item_type: "ERC721",
10688
- token: i.nftContract,
10689
- identifier_or_criteria: i.tokenId,
10690
- amount: "1",
10691
- recipient: i.offerer
10692
- },
10693
- royalty_max_bps: i.royaltyMaxBps,
10694
- start_time: String(i.startTime),
10695
- end_time: String(i.endTime),
10696
- salt: i.salt,
10697
- counter: i.counter
10698
- };
10699
- const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
10700
- return { orderParams, typedData };
10701
- }
10702
- function registerPayload(orderParams, signature) {
10703
- return stringifyBigInts({
10704
- parameters: {
10705
- ...orderParams,
10706
- offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
10707
- consideration: {
10708
- ...orderParams.consideration,
10709
- item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
10710
- }
10711
- },
10712
- signature
10713
- });
10714
- }
10715
- function buildRegisterCalls(a, cfg) {
10716
- const registerCall = contractFor(cfg).populate("register_order", [registerPayload(a.orderParams, a.signature)]);
10717
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
10718
- }
10719
- function buildFulfillCalls(a, cfg) {
10720
- const u = starknet.cairo.uint256(a.totalPrice);
10721
- const approve = {
10722
- contractAddress: a.paymentToken,
10723
- entrypoint: "approve",
10724
- calldata: [cfg.marketplaceContract, u.low.toString(), u.high.toString()]
10725
- };
10726
- const fulfill = contractFor(cfg).populate("fulfill_order", [a.orderHash]);
10727
- const fee = buildFeeCall(
10728
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
10729
- cfg.feeConfig
10730
- );
10731
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
10732
- }
10733
- function buildCancelCalls(a, cfg) {
10734
- const cancelRequest = stringifyBigInts({
10735
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
10736
- signature: a.signature
10737
- });
10738
- return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
10739
- }
10740
- function buildCancelTypedData(orderHash, offerer, cfg) {
10741
- return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
10503
+ let p = _providerCache.get(config);
10504
+ if (!p) {
10505
+ const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
10506
+ p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
10507
+ _providerCache.set(config, p);
10508
+ }
10509
+ return p;
10742
10510
  }
10743
10511
 
10744
10512
  // src/starknet/marketplace/orders.ts
@@ -10747,7 +10515,11 @@ function makeContract(config) {
10747
10515
  const cached = _contractCache.get(config);
10748
10516
  const provider = getProvider(config);
10749
10517
  if (cached) return { ...cached, provider };
10750
- const contract = newContract(IPMarketplaceABI, config.marketplaceContract, provider);
10518
+ const contract = new starknet.Contract(
10519
+ IPMarketplaceABI,
10520
+ config.marketplaceContract,
10521
+ provider
10522
+ );
10751
10523
  _contractCache.set(config, { contract });
10752
10524
  return { contract, provider };
10753
10525
  }
@@ -10761,22 +10533,46 @@ async function createListing(account, params, config) {
10761
10533
  const endTime = now + durationSeconds;
10762
10534
  const counter = (await contract.get_counter(account.address)).toString();
10763
10535
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
10764
- const { orderParams, typedData } = buildListingOrder(
10765
- {
10766
- offerer: account.address,
10767
- nftContract,
10768
- tokenId,
10769
- priceWei,
10770
- paymentTokenAddress: token.address,
10771
- royaltyMaxBps,
10772
- startTime,
10773
- endTime,
10774
- salt: generateSalt(),
10775
- counter
10536
+ const orderParams = {
10537
+ offerer: account.address,
10538
+ marketplace: config.marketplaceContract,
10539
+ offer: {
10540
+ item_type: "ERC721",
10541
+ token: nftContract,
10542
+ identifier_or_criteria: tokenId,
10543
+ amount: "1"
10776
10544
  },
10777
- config
10778
- );
10779
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
10545
+ consideration: {
10546
+ item_type: "ERC20",
10547
+ token: token.address,
10548
+ identifier_or_criteria: "0",
10549
+ amount: priceWei,
10550
+ recipient: account.address
10551
+ },
10552
+ royalty_max_bps: royaltyMaxBps,
10553
+ start_time: startTime.toString(),
10554
+ end_time: endTime.toString(),
10555
+ salt: generateSalt(),
10556
+ counter
10557
+ };
10558
+ const chainId = getChainId(config);
10559
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
10560
+ const signature = await account.signMessage(typedData);
10561
+ const signatureArray = toSignatureArray(signature);
10562
+ const registerPayload = stringifyBigInts({
10563
+ parameters: {
10564
+ ...orderParams,
10565
+ offer: {
10566
+ ...orderParams.offer,
10567
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
10568
+ },
10569
+ consideration: {
10570
+ ...orderParams.consideration,
10571
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
10572
+ }
10573
+ },
10574
+ signature: signatureArray
10575
+ });
10780
10576
  const tokenIdUint256 = starknet.cairo.uint256(tokenId);
10781
10577
  let isAlreadyApproved = false;
10782
10578
  try {
@@ -10788,19 +10584,19 @@ async function createListing(account, params, config) {
10788
10584
  isAlreadyApproved = BigInt(result[0]).toString() === BigInt(config.marketplaceContract).toString();
10789
10585
  } catch {
10790
10586
  }
10791
- const approve = {
10792
- contractAddress: nftContract,
10793
- entrypoint: "approve",
10794
- calldata: [
10795
- config.marketplaceContract,
10796
- tokenIdUint256.low.toString(),
10797
- tokenIdUint256.high.toString()
10798
- ]
10799
- };
10800
- const calls = buildRegisterCalls(
10801
- { orderParams, signature: signatureArray, approvalNeeded: !isAlreadyApproved, approve },
10802
- config
10803
- );
10587
+ const registerCall = contract.populate("register_order", [registerPayload]);
10588
+ const calls = isAlreadyApproved ? [registerCall] : [
10589
+ {
10590
+ contractAddress: nftContract,
10591
+ entrypoint: "approve",
10592
+ calldata: [
10593
+ config.marketplaceContract,
10594
+ tokenIdUint256.low.toString(),
10595
+ tokenIdUint256.high.toString()
10596
+ ]
10597
+ },
10598
+ registerCall
10599
+ ];
10804
10600
  try {
10805
10601
  const tx = await account.execute(calls);
10806
10602
  await provider.waitForTransaction(tx.transaction_hash);
@@ -10819,22 +10615,46 @@ async function makeOffer(account, params, config) {
10819
10615
  const endTime = now + durationSeconds;
10820
10616
  const counter = (await contract.get_counter(account.address)).toString();
10821
10617
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
10822
- const { orderParams, typedData } = buildOfferOrder(
10823
- {
10824
- offerer: account.address,
10825
- nftContract,
10826
- tokenId,
10827
- priceWei,
10828
- paymentTokenAddress: token.address,
10829
- royaltyMaxBps,
10830
- startTime,
10831
- endTime,
10832
- salt: generateSalt(),
10833
- counter
10618
+ const orderParams = {
10619
+ offerer: account.address,
10620
+ marketplace: config.marketplaceContract,
10621
+ offer: {
10622
+ item_type: "ERC20",
10623
+ token: token.address,
10624
+ identifier_or_criteria: "0",
10625
+ amount: priceWei
10834
10626
  },
10835
- config
10836
- );
10837
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
10627
+ consideration: {
10628
+ item_type: "ERC721",
10629
+ token: nftContract,
10630
+ identifier_or_criteria: tokenId,
10631
+ amount: "1",
10632
+ recipient: account.address
10633
+ },
10634
+ royalty_max_bps: royaltyMaxBps,
10635
+ start_time: startTime.toString(),
10636
+ end_time: endTime.toString(),
10637
+ salt: generateSalt(),
10638
+ counter
10639
+ };
10640
+ const chainId = getChainId(config);
10641
+ const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
10642
+ const signature = await account.signMessage(typedData);
10643
+ const signatureArray = toSignatureArray(signature);
10644
+ const registerPayload = stringifyBigInts({
10645
+ parameters: {
10646
+ ...orderParams,
10647
+ offer: {
10648
+ ...orderParams.offer,
10649
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
10650
+ },
10651
+ consideration: {
10652
+ ...orderParams.consideration,
10653
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
10654
+ }
10655
+ },
10656
+ signature: signatureArray
10657
+ });
10838
10658
  const amountUint256 = starknet.cairo.uint256(priceWei);
10839
10659
  const approveCall = {
10840
10660
  contractAddress: token.address,
@@ -10845,12 +10665,9 @@ async function makeOffer(account, params, config) {
10845
10665
  amountUint256.high.toString()
10846
10666
  ]
10847
10667
  };
10848
- const calls = buildRegisterCalls(
10849
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
10850
- config
10851
- );
10668
+ const registerCall = contract.populate("register_order", [registerPayload]);
10852
10669
  try {
10853
- const tx = await account.execute(calls);
10670
+ const tx = await account.execute([approveCall, registerCall]);
10854
10671
  await provider.waitForTransaction(tx.transaction_hash);
10855
10672
  return { txHash: tx.transaction_hash };
10856
10673
  } catch (err) {
@@ -10859,8 +10676,23 @@ async function makeOffer(account, params, config) {
10859
10676
  }
10860
10677
  async function fulfillOrder(account, params, config) {
10861
10678
  const { orderHash, paymentToken, totalPrice } = params;
10862
- const { provider } = makeContract(config);
10863
- const calls = buildFulfillCalls({ orderHash, paymentToken, totalPrice }, config);
10679
+ const { contract, provider } = makeContract(config);
10680
+ const totalPriceU256 = starknet.cairo.uint256(totalPrice);
10681
+ const approveCall = {
10682
+ contractAddress: paymentToken,
10683
+ entrypoint: "approve",
10684
+ calldata: [
10685
+ config.marketplaceContract,
10686
+ totalPriceU256.low.toString(),
10687
+ totalPriceU256.high.toString()
10688
+ ]
10689
+ };
10690
+ const fulfillCall = contract.populate("fulfill_order", [orderHash]);
10691
+ const feeCall = buildFeeCall(
10692
+ { surface: "marketplace", token: paymentToken, grossAmount: BigInt(totalPrice) },
10693
+ config.feeConfig
10694
+ );
10695
+ const calls = feeCall ? [approveCall, fulfillCall, feeCall] : [approveCall, fulfillCall];
10864
10696
  try {
10865
10697
  const tx = await account.execute(calls);
10866
10698
  await provider.waitForTransaction(tx.transaction_hash);
@@ -10871,12 +10703,24 @@ async function fulfillOrder(account, params, config) {
10871
10703
  }
10872
10704
  async function cancelOrder(account, params, config) {
10873
10705
  const { orderHash } = params;
10874
- const { provider } = makeContract(config);
10875
- const typedData = buildCancelTypedData(orderHash, account.address, config);
10876
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
10877
- const calls = buildCancelCalls({ orderHash, offerer: account.address, signature: signatureArray }, config);
10706
+ const { contract, provider } = makeContract(config);
10707
+ const chainId = getChainId(config);
10708
+ const cancelParams = {
10709
+ order_hash: orderHash,
10710
+ offerer: account.address
10711
+ };
10712
+ const typedData = stringifyBigInts(
10713
+ buildCancellationTypedData(cancelParams, chainId)
10714
+ );
10715
+ const signature = await account.signMessage(typedData);
10716
+ const signatureArray = toSignatureArray(signature);
10717
+ const cancelRequest = stringifyBigInts({
10718
+ cancelation: cancelParams,
10719
+ signature: signatureArray
10720
+ });
10721
+ const call = contract.populate("cancel_order", [cancelRequest]);
10878
10722
  try {
10879
- const tx = await account.execute(calls);
10723
+ const tx = await account.execute(call);
10880
10724
  await provider.waitForTransaction(tx.transaction_hash);
10881
10725
  return { txHash: tx.transaction_hash };
10882
10726
  } catch (err) {
@@ -11023,106 +10867,16 @@ var MarketplaceModule = class {
11023
10867
  return buildCancellationTypedData(params, chainId);
11024
10868
  }
11025
10869
  };
11026
- function contractFor2(cfg) {
11027
- return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
11028
- }
11029
- function buildListing1155Order(i, cfg) {
11030
- const orderParams = {
11031
- offerer: i.offerer,
11032
- marketplace: cfg.marketplace1155Contract,
11033
- offer: { item_type: "ERC1155", token: i.nftContract, identifier_or_criteria: i.tokenId, amount: i.quantity },
11034
- consideration: {
11035
- item_type: "ERC20",
11036
- token: i.paymentTokenAddress,
11037
- identifier_or_criteria: "0",
11038
- amount: i.priceWeiPerUnit,
11039
- recipient: i.offerer
11040
- },
11041
- royalty_max_bps: i.royaltyMaxBps,
11042
- start_time: String(i.startTime),
11043
- end_time: String(i.endTime),
11044
- salt: i.salt,
11045
- counter: i.counter
11046
- };
11047
- const typedData = stringifyBigInts(
11048
- build1155OrderTypedData(orderParams, getChainId(cfg))
11049
- );
11050
- return { orderParams, typedData };
11051
- }
11052
- function buildOffer1155Order(i, cfg) {
11053
- const orderParams = {
11054
- offerer: i.offerer,
11055
- marketplace: cfg.marketplace1155Contract,
11056
- offer: { item_type: "ERC20", token: i.paymentTokenAddress, identifier_or_criteria: "0", amount: i.priceWeiPerUnit },
11057
- consideration: {
11058
- item_type: "ERC1155",
11059
- token: i.nftContract,
11060
- identifier_or_criteria: i.tokenId,
11061
- amount: i.quantity,
11062
- recipient: i.offerer
11063
- },
11064
- royalty_max_bps: i.royaltyMaxBps,
11065
- start_time: String(i.startTime),
11066
- end_time: String(i.endTime),
11067
- salt: i.salt,
11068
- counter: i.counter
11069
- };
11070
- const typedData = stringifyBigInts(
11071
- build1155OrderTypedData(orderParams, getChainId(cfg))
11072
- );
11073
- return { orderParams, typedData };
11074
- }
11075
- function registerPayload2(orderParams, signature) {
11076
- return stringifyBigInts({
11077
- parameters: {
11078
- ...orderParams,
11079
- offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
11080
- consideration: {
11081
- ...orderParams.consideration,
11082
- item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11083
- }
11084
- },
11085
- signature
11086
- });
11087
- }
11088
- function buildRegister1155Calls(a, cfg) {
11089
- const registerCall = contractFor2(cfg).populate("register_order", [registerPayload2(a.orderParams, a.signature)]);
11090
- return a.approvalNeeded ? [a.approve, registerCall] : [registerCall];
11091
- }
11092
- function buildFulfill1155Calls(a, cfg) {
11093
- const u = starknet.cairo.uint256(a.totalPrice);
11094
- const approve = {
11095
- contractAddress: a.paymentToken,
11096
- entrypoint: "approve",
11097
- calldata: [cfg.marketplace1155Contract, u.low.toString(), u.high.toString()]
11098
- };
11099
- const fulfill = contractFor2(cfg).populate("fulfill_order", [a.orderHash, a.quantity]);
11100
- const fee = buildFeeCall(
11101
- { surface: "marketplace", token: a.paymentToken, grossAmount: BigInt(a.totalPrice) },
11102
- cfg.feeConfig
11103
- );
11104
- return fee ? [approve, fulfill, fee] : [approve, fulfill];
11105
- }
11106
- function buildCancel1155Calls(a, cfg) {
11107
- const cancelPayload = stringifyBigInts({
11108
- cancelation: { order_hash: a.orderHash, offerer: a.offerer },
11109
- signature: a.signature
11110
- });
11111
- return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
11112
- }
11113
- function buildCancel1155TypedData(orderHash, offerer, cfg) {
11114
- return stringifyBigInts(
11115
- build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
11116
- );
11117
- }
11118
-
11119
- // src/starknet/marketplace1155/orders.ts
11120
10870
  var _contractCache2 = /* @__PURE__ */ new WeakMap();
11121
10871
  function getContract(config) {
11122
10872
  let c = _contractCache2.get(config);
11123
10873
  if (!c) {
11124
10874
  const provider = getProvider(config);
11125
- c = newContract(Medialane1155ABI, config.marketplace1155Contract, provider);
10875
+ c = new starknet.Contract(
10876
+ Medialane1155ABI,
10877
+ config.marketplace1155Contract,
10878
+ provider
10879
+ );
11126
10880
  _contractCache2.set(config, c);
11127
10881
  }
11128
10882
  return c;
@@ -11141,27 +10895,53 @@ async function createListing1155(account, params, config) {
11141
10895
  const token = resolveToken(currency);
11142
10896
  const priceWei = parseAmount(pricePerUnit, token.decimals);
11143
10897
  const now = Math.floor(Date.now() / 1e3);
11144
- const startTime = now + START_TIME_BUFFER_SECS;
11145
10898
  const endTime = now + durationSeconds;
10899
+ const chainId = getChainId(config);
11146
10900
  const counter = (await contract.get_counter(account.address)).toString();
11147
10901
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11148
- const { orderParams, typedData } = buildListing1155Order(
11149
- {
11150
- offerer: account.address,
11151
- nftContract,
11152
- tokenId,
11153
- quantity: amount,
11154
- priceWeiPerUnit: priceWei,
11155
- paymentTokenAddress: token.address,
11156
- royaltyMaxBps,
11157
- startTime,
11158
- endTime,
11159
- salt: generateSalt(),
11160
- counter
10902
+ const orderParams = {
10903
+ offerer: account.address,
10904
+ marketplace: config.marketplace1155Contract,
10905
+ offer: {
10906
+ item_type: "ERC1155",
10907
+ token: nftContract,
10908
+ identifier_or_criteria: tokenId,
10909
+ amount
10910
+ // ERC-1155 leg amount = unit quantity
11161
10911
  },
11162
- config
10912
+ consideration: {
10913
+ item_type: "ERC20",
10914
+ token: token.address,
10915
+ identifier_or_criteria: "0",
10916
+ amount: priceWei,
10917
+ // payment leg amount = price PER UNIT
10918
+ recipient: account.address
10919
+ },
10920
+ royalty_max_bps: royaltyMaxBps,
10921
+ start_time: (now + START_TIME_BUFFER_SECS).toString(),
10922
+ end_time: endTime.toString(),
10923
+ salt: generateSalt(),
10924
+ counter
10925
+ };
10926
+ const typedData = stringifyBigInts(
10927
+ build1155OrderTypedData(orderParams, chainId)
11163
10928
  );
11164
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
10929
+ const signature = await account.signMessage(typedData);
10930
+ const signatureArray = toSignatureArray(signature);
10931
+ const orderPayload = stringifyBigInts({
10932
+ parameters: {
10933
+ ...orderParams,
10934
+ offer: {
10935
+ ...orderParams.offer,
10936
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
10937
+ },
10938
+ consideration: {
10939
+ ...orderParams.consideration,
10940
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
10941
+ }
10942
+ },
10943
+ signature: signatureArray
10944
+ });
11165
10945
  let isApproved = false;
11166
10946
  try {
11167
10947
  const result = await provider.callContract({
@@ -11172,15 +10952,15 @@ async function createListing1155(account, params, config) {
11172
10952
  isApproved = BigInt(result[0]) === 1n;
11173
10953
  } catch {
11174
10954
  }
11175
- const approve = {
11176
- contractAddress: nftContract,
11177
- entrypoint: "set_approval_for_all",
11178
- calldata: [config.marketplace1155Contract, "1"]
11179
- };
11180
- const calls = buildRegister1155Calls(
11181
- { orderParams, signature: signatureArray, approvalNeeded: !isApproved, approve },
11182
- config
11183
- );
10955
+ const registerCall = contract.populate("register_order", [orderPayload]);
10956
+ const calls = isApproved ? [registerCall] : [
10957
+ {
10958
+ contractAddress: nftContract,
10959
+ entrypoint: "set_approval_for_all",
10960
+ calldata: [config.marketplace1155Contract, "1"]
10961
+ },
10962
+ registerCall
10963
+ ];
11184
10964
  try {
11185
10965
  const tx = await account.execute(calls);
11186
10966
  await provider.waitForTransaction(tx.transaction_hash);
@@ -11191,10 +10971,21 @@ async function createListing1155(account, params, config) {
11191
10971
  }
11192
10972
  async function fulfillOrder1155(account, params, config) {
11193
10973
  const { orderHash, paymentToken, totalPrice, quantity = "1" } = params;
10974
+ const contract = getContract(config);
11194
10975
  const provider = getProvider(config);
11195
- const calls = buildFulfill1155Calls({ orderHash, paymentToken, totalPrice, quantity }, config);
10976
+ const totalPriceU256 = starknet.cairo.uint256(totalPrice);
10977
+ const approveCall = {
10978
+ contractAddress: paymentToken,
10979
+ entrypoint: "approve",
10980
+ calldata: [
10981
+ config.marketplace1155Contract,
10982
+ totalPriceU256.low.toString(),
10983
+ totalPriceU256.high.toString()
10984
+ ]
10985
+ };
10986
+ const fulfillCall = contract.populate("fulfill_order", [orderHash, quantity]);
11196
10987
  try {
11197
- const tx = await account.execute(calls);
10988
+ const tx = await account.execute([approveCall, fulfillCall]);
11198
10989
  await provider.waitForTransaction(tx.transaction_hash);
11199
10990
  return { txHash: tx.transaction_hash };
11200
10991
  } catch (err) {
@@ -11203,12 +10994,25 @@ async function fulfillOrder1155(account, params, config) {
11203
10994
  }
11204
10995
  async function cancelOrder1155(account, params, config) {
11205
10996
  const { orderHash } = params;
10997
+ const contract = getContract(config);
11206
10998
  const provider = getProvider(config);
11207
- const typedData = buildCancel1155TypedData(orderHash, account.address, config);
11208
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11209
- const calls = buildCancel1155Calls({ orderHash, offerer: account.address, signature: signatureArray }, config);
10999
+ const chainId = getChainId(config);
11000
+ const cancelParams = {
11001
+ order_hash: orderHash,
11002
+ offerer: account.address
11003
+ };
11004
+ const typedData = stringifyBigInts(
11005
+ build1155CancellationTypedData(cancelParams, chainId)
11006
+ );
11007
+ const signature = await account.signMessage(typedData);
11008
+ const signatureArray = toSignatureArray(signature);
11009
+ const cancelPayload = stringifyBigInts({
11010
+ cancelation: cancelParams,
11011
+ signature: signatureArray
11012
+ });
11013
+ const cancelCall = contract.populate("cancel_order", [cancelPayload]);
11210
11014
  try {
11211
- const tx = await account.execute(calls);
11015
+ const tx = await account.execute(cancelCall);
11212
11016
  await provider.waitForTransaction(tx.transaction_hash);
11213
11017
  return { txHash: tx.transaction_hash };
11214
11018
  } catch (err) {
@@ -11226,30 +11030,56 @@ async function makeOffer1155(account, params, config) {
11226
11030
  } = params;
11227
11031
  const contract = getContract(config);
11228
11032
  const provider = getProvider(config);
11033
+ const chainId = getChainId(config);
11229
11034
  const token = resolveToken(currency);
11230
11035
  const priceWei = parseAmount(price, token.decimals);
11231
11036
  const now = Math.floor(Date.now() / 1e3);
11232
- const startTime = now + START_TIME_BUFFER_SECS;
11233
11037
  const endTime = now + durationSeconds;
11234
11038
  const counter = (await contract.get_counter(account.address)).toString();
11235
11039
  const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
11236
- const { orderParams, typedData } = buildOffer1155Order(
11237
- {
11238
- offerer: account.address,
11239
- nftContract,
11240
- tokenId,
11241
- quantity: amount,
11242
- priceWeiPerUnit: priceWei,
11243
- paymentTokenAddress: token.address,
11244
- royaltyMaxBps,
11245
- startTime,
11246
- endTime,
11247
- salt: generateSalt(),
11248
- counter
11040
+ const orderParams = {
11041
+ offerer: account.address,
11042
+ marketplace: config.marketplace1155Contract,
11043
+ offer: {
11044
+ item_type: "ERC20",
11045
+ token: token.address,
11046
+ identifier_or_criteria: "0",
11047
+ amount: priceWei
11048
+ // price PER UNIT
11249
11049
  },
11250
- config
11050
+ consideration: {
11051
+ item_type: "ERC1155",
11052
+ token: nftContract,
11053
+ identifier_or_criteria: tokenId,
11054
+ amount,
11055
+ // unit quantity
11056
+ recipient: account.address
11057
+ },
11058
+ royalty_max_bps: royaltyMaxBps,
11059
+ start_time: (now + START_TIME_BUFFER_SECS).toString(),
11060
+ end_time: endTime.toString(),
11061
+ salt: generateSalt(),
11062
+ counter
11063
+ };
11064
+ const typedData = stringifyBigInts(
11065
+ build1155OrderTypedData(orderParams, chainId)
11251
11066
  );
11252
- const signatureArray = toSignatureArray(await account.signMessage(typedData));
11067
+ const signature = await account.signMessage(typedData);
11068
+ const signatureArray = toSignatureArray(signature);
11069
+ const registerPayload = stringifyBigInts({
11070
+ parameters: {
11071
+ ...orderParams,
11072
+ offer: {
11073
+ ...orderParams.offer,
11074
+ item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type)
11075
+ },
11076
+ consideration: {
11077
+ ...orderParams.consideration,
11078
+ item_type: starknet.shortString.encodeShortString(orderParams.consideration.item_type)
11079
+ }
11080
+ },
11081
+ signature: signatureArray
11082
+ });
11253
11083
  const totalWei = BigInt(priceWei) * BigInt(amount);
11254
11084
  const amountU256 = starknet.cairo.uint256(totalWei.toString());
11255
11085
  const approveCall = {
@@ -11261,12 +11091,9 @@ async function makeOffer1155(account, params, config) {
11261
11091
  amountU256.high.toString()
11262
11092
  ]
11263
11093
  };
11264
- const calls = buildRegister1155Calls(
11265
- { orderParams, signature: signatureArray, approvalNeeded: true, approve: approveCall },
11266
- config
11267
- );
11094
+ const registerCall = contract.populate("register_order", [registerPayload]);
11268
11095
  try {
11269
- const tx = await account.execute(calls);
11096
+ const tx = await account.execute([approveCall, registerCall]);
11270
11097
  await provider.waitForTransaction(tx.transaction_hash);
11271
11098
  return { txHash: tx.transaction_hash };
11272
11099
  } catch (err) {
@@ -12526,66 +12353,84 @@ var CreatorCoinService = class {
12526
12353
  };
12527
12354
  var TicketService = class {
12528
12355
  constructor(config) {
12356
+ this.config = config;
12529
12357
  this.factoryAddress = getStarknetCoordinates(config.chain).ipTicketsFactory;
12530
12358
  }
12359
+ _factory(account, factoryAddress) {
12360
+ const address = factoryAddress ?? this.factoryAddress;
12361
+ if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
12362
+ return new starknet.Contract(IPTicketCollectionFactoryABI, normalizeAddress("STARKNET", address), account);
12363
+ }
12531
12364
  _collection(address, account) {
12532
12365
  return new starknet.Contract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
12533
12366
  }
12534
- /** Deploys a new IPTicketCollection via the factory. Caller becomes its owner. */
12535
- async deployTicketCollection(account, params) {
12536
- const factoryAddress = params.factoryAddress ?? this.factoryAddress;
12537
- if (!factoryAddress) {
12538
- throw new Error("IP-Tickets factory address not configured for this chain");
12539
- }
12540
- const factory = new starknet.Contract(IPTicketCollectionFactoryABI, factoryAddress, account);
12541
- const call = factory.populate("deploy_ticket_collection", [params.name, params.symbol]);
12367
+ _collectionRead(address) {
12368
+ const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
12369
+ return new starknet.Contract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
12370
+ }
12371
+ /** Deploys a new IPTicketCollection via the factory. Caller becomes owner. */
12372
+ async deployCollection(account, params) {
12373
+ const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [params.name, params.symbol]);
12542
12374
  const res = await account.execute([call]);
12543
12375
  return { txHash: res.transaction_hash };
12544
12376
  }
12545
- /** Owner-only. Creates a new ticket collection (event/tier) inside the caller's deployed IPTicketCollection. */
12546
- async createTicketCollection(account, params) {
12547
- const paymentToken = params.paymentToken ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.paymentToken) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12548
- const call = this._collection(params.collection, account).populate("create_ticket_collection", [
12549
- starknet.cairo.uint256(params.price),
12377
+ /** Owner-only. Creates a new event inside the caller's deployed collection. */
12378
+ async createEvent(account, params) {
12379
+ const startTime = params.startTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.startTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12380
+ const endTime = params.endTime != null ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.endTime) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
12381
+ const call = this._collection(params.collection, account).populate("create_event", [
12550
12382
  starknet.cairo.uint256(params.maxSupply),
12551
- params.expiration,
12383
+ startTime,
12384
+ endTime,
12552
12385
  params.royaltyBps,
12553
- paymentToken,
12554
12386
  params.metadataUri
12555
12387
  ]);
12556
12388
  const res = await account.execute([call]);
12557
12389
  return { txHash: res.transaction_hash };
12558
12390
  }
12559
- /** Owner-only. Gates minting only existing tickets keep access/transfer/redeem. */
12560
- async setCollectionActive(account, params) {
12561
- const call = this._collection(params.collection, account).populate("set_collection_active", [
12562
- starknet.cairo.uint256(params.collectionId),
12563
- params.active
12391
+ /** Owner-only. Mints `amount` of `tokenId` to `to`. */
12392
+ async mint(account, params) {
12393
+ const call = this._collection(params.collection, account).populate("mint", [
12394
+ params.to,
12395
+ starknet.cairo.uint256(params.tokenId),
12396
+ starknet.cairo.uint256(params.amount)
12564
12397
  ]);
12565
12398
  const res = await account.execute([call]);
12566
12399
  return { txHash: res.transaction_hash };
12567
12400
  }
12568
- /** Mints a ticket. Prepends an ERC-20 approve when the collection is paid. */
12569
- async mintTicket(account, params) {
12570
- const calls = [];
12571
- if (params.paymentToken && params.price && BigInt(params.price) > 0n) {
12572
- const amount = starknet.cairo.uint256(params.price);
12573
- calls.push({
12574
- contractAddress: params.paymentToken,
12575
- entrypoint: "approve",
12576
- calldata: [normalizeAddress("STARKNET", params.collection), amount.low.toString(), amount.high.toString()]
12577
- });
12578
- }
12579
- calls.push(this._collection(params.collection, account).populate("mint_ticket", [starknet.cairo.uint256(params.collectionId)]));
12580
- const res = await account.execute(calls);
12581
- return { txHash: res.transaction_hash };
12582
- }
12583
- /** Only the current token owner may redeem. */
12584
- async redeemTicket(account, params) {
12585
- const call = this._collection(params.collection, account).populate("redeem_ticket", [starknet.cairo.uint256(params.tokenId)]);
12401
+ /** Owner-only. Pauses or resumes minting for one event. */
12402
+ async pauseEvent(account, params) {
12403
+ const call = this._collection(params.collection, account).populate("pause_event", [
12404
+ starknet.cairo.uint256(params.tokenId),
12405
+ params.active
12406
+ ]);
12586
12407
  const res = await account.execute([call]);
12587
12408
  return { txHash: res.transaction_hash };
12588
12409
  }
12410
+ /** Read — true if holder has balance > 0 and current time is within the event window. */
12411
+ async isValid(params) {
12412
+ const result = await this._collectionRead(params.collection).call("is_valid", [
12413
+ starknet.cairo.uint256(params.tokenId),
12414
+ params.holder
12415
+ ]);
12416
+ return Boolean(result);
12417
+ }
12418
+ /** Read — returns the EventRecord for a token ID. */
12419
+ async getEvent(params) {
12420
+ const ev = await this._collectionRead(params.collection).call("get_event", [
12421
+ starknet.cairo.uint256(params.tokenId)
12422
+ ]);
12423
+ return {
12424
+ creator: ev.creator,
12425
+ maxSupply: BigInt(ev.max_supply),
12426
+ minted: BigInt(ev.minted),
12427
+ startTime: ev.start_time?.variant === "Some" ? Number(ev.start_time.values[0] ?? ev.start_time.value) : null,
12428
+ endTime: ev.end_time?.variant === "Some" ? Number(ev.end_time.values[0] ?? ev.end_time.value) : null,
12429
+ royaltyBps: Number(ev.royalty_bps),
12430
+ metadataUri: ev.metadata_uri,
12431
+ active: Boolean(ev.active)
12432
+ };
12433
+ }
12589
12434
  };
12590
12435
  var ClubService = class {
12591
12436
  constructor(config) {
@@ -12866,147 +12711,94 @@ var StarknetVenue = class {
12866
12711
  constructor(deps) {
12867
12712
  this.deps = deps;
12868
12713
  this.chain = "STARKNET";
12714
+ this.m721 = new MarketplaceModule(deps.config);
12715
+ this.m1155 = new Medialane1155Module(deps.config);
12869
12716
  }
12870
- async incrementCounter(signer) {
12871
- return signer.execute([
12872
- { contractAddress: this.deps.config.marketplaceContract, entrypoint: "increment_counter", calldata: [] }
12873
- ]);
12717
+ incrementCounter(signer) {
12718
+ return this.m721.incrementCounter(signer);
12874
12719
  }
12875
12720
  getOrderDetails(orderRef) {
12876
- return getOrderDetails(orderRef, this.deps.config);
12721
+ return this.m721.getOrderDetails(orderRef);
12877
12722
  }
12878
- async getCounter(address) {
12879
- return this.readCounter(this.deps.config.marketplaceContract, address);
12723
+ getCounter(address) {
12724
+ return this.m721.getCounter(address);
12880
12725
  }
12881
12726
  async fulfillOrder(signer, orderRef, opts) {
12882
12727
  const o = await this.deps.resolveOrder(orderRef);
12883
12728
  const quantity = opts?.quantity ?? "1";
12884
12729
  const totalPrice = (BigInt(o.unitPrice) * BigInt(quantity)).toString();
12885
- 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);
12886
- return signer.execute(calls);
12730
+ if (o.standard === "ERC1155") {
12731
+ return this.m1155.fulfillOrder(signer, {
12732
+ orderHash: orderRef,
12733
+ paymentToken: o.paymentToken,
12734
+ totalPrice,
12735
+ quantity
12736
+ });
12737
+ }
12738
+ return this.m721.fulfillOrder(signer, {
12739
+ orderHash: orderRef,
12740
+ paymentToken: o.paymentToken,
12741
+ totalPrice
12742
+ });
12887
12743
  }
12888
12744
  async cancelOrder(signer, orderRef) {
12889
12745
  const o = await this.deps.resolveOrder(orderRef);
12890
- const typedData = o.standard === "ERC1155" ? buildCancel1155TypedData(orderRef, signer.address, this.deps.config) : buildCancelTypedData(orderRef, signer.address, this.deps.config);
12891
- const signature = await signer.signTypedData(typedData);
12892
- 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);
12893
- return signer.execute(calls);
12746
+ if (o.standard === "ERC1155") {
12747
+ return this.m1155.cancelOrder(signer, { orderHash: orderRef });
12748
+ }
12749
+ return this.m721.cancelOrder(signer, { orderHash: orderRef });
12894
12750
  }
12895
12751
  async registerOrder(signer, p) {
12896
12752
  const standard = await this.deps.resolveStandard(p.asset.contract);
12897
- const paymentTokenAddress = resolveToken(p.paymentToken).address;
12753
+ const token = resolveToken(p.paymentToken);
12754
+ const humanPrice = formatAmount(p.amount, token.decimals);
12755
+ const durationSeconds = this.durationSeconds(p.endTime);
12898
12756
  const royaltyMaxBps = String(p.royaltyMaxBps);
12899
- const startTime = Math.floor(Date.now() / 1e3) + START_TIME_BUFFER_SECS;
12900
- const endTime = p.endTime && p.endTime > 0 ? p.endTime : startTime + NO_EXPIRY_SECONDS;
12901
12757
  const quantity = p.quantity ?? "1";
12902
- const marketplace = standard === "ERC1155" ? this.deps.config.marketplace1155Contract : this.deps.config.marketplaceContract;
12903
- const counter = String(await this.readCounter(marketplace, signer.address));
12904
- let typedData;
12905
- let buildCalls;
12758
+ let txHash;
12906
12759
  if (standard === "ERC1155") {
12907
- const built = (p.side === "listing" ? buildListing1155Order : buildOffer1155Order)(
12908
- {
12909
- offerer: signer.address,
12760
+ if (p.side === "listing") {
12761
+ const res = await this.m1155.createListing(signer, {
12910
12762
  nftContract: p.asset.contract,
12911
12763
  tokenId: p.asset.tokenId,
12912
- quantity,
12913
- priceWeiPerUnit: p.amount,
12914
- paymentTokenAddress,
12915
- royaltyMaxBps,
12916
- startTime,
12917
- endTime,
12918
- salt: p.salt,
12919
- counter
12920
- },
12921
- this.deps.config
12922
- );
12923
- typedData = built.typedData;
12924
- const approval = p.side === "listing" ? await this.approval1155ForListing(signer.address, p.asset.contract) : this.approvalForErc20(paymentTokenAddress, (BigInt(p.amount) * BigInt(quantity)).toString(), marketplace);
12925
- buildCalls = (sig) => buildRegister1155Calls({ orderParams: built.orderParams, signature: sig, ...approval }, this.deps.config);
12926
- } else {
12927
- const built = (p.side === "listing" ? buildListingOrder : buildOfferOrder)(
12928
- {
12929
- offerer: signer.address,
12764
+ amount: quantity,
12765
+ pricePerUnit: humanPrice,
12766
+ currency: p.paymentToken,
12767
+ durationSeconds,
12768
+ royaltyMaxBps
12769
+ });
12770
+ txHash = res.txHash;
12771
+ } else {
12772
+ const totalHuman = formatAmount((BigInt(p.amount) * BigInt(quantity)).toString(), token.decimals);
12773
+ const res = await this.m1155.makeOffer(signer, {
12930
12774
  nftContract: p.asset.contract,
12931
12775
  tokenId: p.asset.tokenId,
12932
- priceWei: p.amount,
12933
- paymentTokenAddress,
12934
- royaltyMaxBps,
12935
- startTime,
12936
- endTime,
12937
- salt: p.salt,
12938
- counter
12939
- },
12940
- this.deps.config
12941
- );
12942
- typedData = built.typedData;
12943
- const approval = p.side === "listing" ? await this.approval721ForListing(signer.address, p.asset.contract, p.asset.tokenId) : this.approvalForErc20(paymentTokenAddress, p.amount, marketplace);
12944
- buildCalls = (sig) => buildRegisterCalls({ orderParams: built.orderParams, signature: sig, ...approval }, this.deps.config);
12776
+ amount: quantity,
12777
+ price: totalHuman,
12778
+ currency: p.paymentToken,
12779
+ durationSeconds,
12780
+ royaltyMaxBps
12781
+ });
12782
+ txHash = res.txHash;
12783
+ }
12784
+ } else {
12785
+ const params = {
12786
+ nftContract: p.asset.contract,
12787
+ tokenId: p.asset.tokenId,
12788
+ price: humanPrice,
12789
+ currency: p.paymentToken,
12790
+ durationSeconds,
12791
+ royaltyMaxBps
12792
+ };
12793
+ const res = p.side === "listing" ? await this.m721.createListing(signer, params) : await this.m721.makeOffer(signer, params);
12794
+ txHash = res.txHash;
12945
12795
  }
12946
- const signature = await signer.signTypedData(typedData);
12947
- const { txHash } = await signer.execute(buildCalls(signature));
12948
12796
  const orderRef = await this.orderRefFromReceipt(txHash);
12949
12797
  return { txHash, orderRef };
12950
12798
  }
12951
- // ─── reads (all on deps.provider) ─────────────────────────────────────────
12952
- async readCounter(marketplace, address) {
12953
- const res = await this.deps.provider.callContract({
12954
- contractAddress: marketplace,
12955
- entrypoint: "get_counter",
12956
- calldata: [address]
12957
- });
12958
- return BigInt(res[0] ?? "0");
12959
- }
12960
- /** 721 listing approval: `get_approved(tokenId) == marketplace` ⇒ no approve. */
12961
- async approval721ForListing(_owner, nftContract, tokenId) {
12962
- const id = starknet.cairo.uint256(tokenId);
12963
- const approve = {
12964
- contractAddress: nftContract,
12965
- entrypoint: "approve",
12966
- calldata: [this.deps.config.marketplaceContract, id.low.toString(), id.high.toString()]
12967
- };
12968
- let approved = false;
12969
- try {
12970
- const res = await this.deps.provider.callContract({
12971
- contractAddress: nftContract,
12972
- entrypoint: "get_approved",
12973
- calldata: [id.low.toString(), id.high.toString()]
12974
- });
12975
- approved = BigInt(res[0]).toString() === BigInt(this.deps.config.marketplaceContract).toString();
12976
- } catch {
12977
- }
12978
- return { approvalNeeded: !approved, approve };
12979
- }
12980
- /** 1155 listing approval: `is_approved_for_all(owner, marketplace)`. */
12981
- async approval1155ForListing(owner, nftContract) {
12982
- const approve = {
12983
- contractAddress: nftContract,
12984
- entrypoint: "set_approval_for_all",
12985
- calldata: [this.deps.config.marketplace1155Contract, "1"]
12986
- };
12987
- let approved = false;
12988
- try {
12989
- const res = await this.deps.provider.callContract({
12990
- contractAddress: nftContract,
12991
- entrypoint: "is_approved_for_all",
12992
- calldata: [owner, this.deps.config.marketplace1155Contract]
12993
- });
12994
- approved = BigInt(res[0]) === 1n;
12995
- } catch {
12996
- }
12997
- return { approvalNeeded: !approved, approve };
12998
- }
12999
- /** Offers always approve the ERC-20 spend (no read). */
13000
- approvalForErc20(token, amountWei, marketplace) {
13001
- const u = starknet.cairo.uint256(amountWei);
13002
- return {
13003
- approvalNeeded: true,
13004
- approve: {
13005
- contractAddress: token,
13006
- entrypoint: "approve",
13007
- calldata: [marketplace, u.low.toString(), u.high.toString()]
13008
- }
13009
- };
12799
+ durationSeconds(endTime) {
12800
+ if (!endTime) return NO_EXPIRY_SECONDS;
12801
+ return Math.max(1, endTime - Math.floor(Date.now() / 1e3));
13010
12802
  }
13011
12803
  /** The canonical Starknet order id = the contract-emitted `OrderCreated`
13012
12804
  * hash (`keys[1]`), which is exactly what the indexer stores. */