@medialane/sdk 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -128,69 +128,104 @@ function resolveConfig(raw) {
128
128
  feeConfig: resolveFeeConfig(parsed.feeConfig)
129
129
  };
130
130
  }
131
+ var STARKNET_DOMAIN = [
132
+ { name: "name", type: "shortstring" },
133
+ { name: "version", type: "shortstring" },
134
+ { name: "chainId", type: "shortstring" },
135
+ { name: "revision", type: "shortstring" }
136
+ ];
137
+ var OFFER_ITEM = [
138
+ { name: "item_type", type: "shortstring" },
139
+ { name: "token", type: "ContractAddress" },
140
+ { name: "identifier_or_criteria", type: "felt" },
141
+ { name: "start_amount", type: "felt" },
142
+ { name: "end_amount", type: "felt" }
143
+ ];
144
+ var CONSIDERATION_ITEM = [
145
+ { name: "item_type", type: "shortstring" },
146
+ { name: "token", type: "ContractAddress" },
147
+ { name: "identifier_or_criteria", type: "felt" },
148
+ { name: "start_amount", type: "felt" },
149
+ { name: "end_amount", type: "felt" },
150
+ { name: "recipient", type: "ContractAddress" }
151
+ ];
152
+ var ORDER_PARAMETERS = [
153
+ { name: "offerer", type: "ContractAddress" },
154
+ { name: "offer", type: "OfferItem" },
155
+ { name: "consideration", type: "ConsiderationItem" },
156
+ { name: "start_time", type: "felt" },
157
+ { name: "end_time", type: "felt" },
158
+ { name: "salt", type: "felt" },
159
+ { name: "nonce", type: "felt" }
160
+ ];
161
+ var ORDER_CANCELLATION = [
162
+ { name: "order_hash", type: "felt" },
163
+ { name: "offerer", type: "ContractAddress" },
164
+ { name: "nonce", type: "felt" }
165
+ ];
166
+ var DOMAIN_VERSION = {
167
+ erc721: "1",
168
+ erc1155: "2"
169
+ };
170
+ function buildDomain(standard, chainId) {
171
+ return {
172
+ name: "Medialane",
173
+ version: DOMAIN_VERSION[standard],
174
+ chainId,
175
+ revision: starknet.TypedDataRevision.ACTIVE
176
+ };
177
+ }
131
178
  function buildOrderTypedData(message, chainId) {
132
179
  return {
133
- domain: {
134
- name: "Medialane",
135
- version: "1",
136
- chainId,
137
- revision: starknet.TypedDataRevision.ACTIVE
180
+ domain: buildDomain("erc721", chainId),
181
+ primaryType: "OrderParameters",
182
+ types: {
183
+ StarknetDomain: STARKNET_DOMAIN,
184
+ OrderParameters: ORDER_PARAMETERS,
185
+ OfferItem: OFFER_ITEM,
186
+ ConsiderationItem: CONSIDERATION_ITEM
138
187
  },
188
+ message
189
+ };
190
+ }
191
+ function build1155OrderTypedData(message, chainId) {
192
+ return {
193
+ domain: buildDomain("erc1155", chainId),
139
194
  primaryType: "OrderParameters",
140
195
  types: {
141
- StarknetDomain: [
142
- { name: "name", type: "shortstring" },
143
- { name: "version", type: "shortstring" },
144
- { name: "chainId", type: "shortstring" },
145
- { name: "revision", type: "shortstring" }
146
- ],
147
- OrderParameters: [
148
- { name: "offerer", type: "ContractAddress" },
149
- { name: "offer", type: "OfferItem" },
150
- { name: "consideration", type: "ConsiderationItem" },
151
- { name: "start_time", type: "felt" },
152
- { name: "end_time", type: "felt" },
153
- { name: "salt", type: "felt" },
154
- { name: "nonce", type: "felt" }
155
- ],
156
- OfferItem: [
157
- { name: "item_type", type: "shortstring" },
158
- { name: "token", type: "ContractAddress" },
159
- { name: "identifier_or_criteria", type: "felt" },
160
- { name: "start_amount", type: "felt" },
161
- { name: "end_amount", type: "felt" }
162
- ],
163
- ConsiderationItem: [
164
- { name: "item_type", type: "shortstring" },
165
- { name: "token", type: "ContractAddress" },
166
- { name: "identifier_or_criteria", type: "felt" },
167
- { name: "start_amount", type: "felt" },
168
- { name: "end_amount", type: "felt" },
169
- { name: "recipient", type: "ContractAddress" }
170
- ]
196
+ StarknetDomain: STARKNET_DOMAIN,
197
+ OrderParameters: ORDER_PARAMETERS,
198
+ OfferItem: OFFER_ITEM,
199
+ ConsiderationItem: CONSIDERATION_ITEM
171
200
  },
172
201
  message
173
202
  };
174
203
  }
175
204
  function buildFulfillmentTypedData(message, chainId) {
176
205
  return {
177
- domain: {
178
- name: "Medialane",
179
- version: "1",
180
- chainId,
181
- revision: starknet.TypedDataRevision.ACTIVE
206
+ domain: buildDomain("erc721", chainId),
207
+ primaryType: "OrderFulfillment",
208
+ types: {
209
+ StarknetDomain: STARKNET_DOMAIN,
210
+ OrderFulfillment: [
211
+ { name: "order_hash", type: "felt" },
212
+ { name: "fulfiller", type: "ContractAddress" },
213
+ { name: "nonce", type: "felt" }
214
+ ]
182
215
  },
216
+ message
217
+ };
218
+ }
219
+ function build1155FulfillmentTypedData(message, chainId) {
220
+ return {
221
+ domain: buildDomain("erc1155", chainId),
183
222
  primaryType: "OrderFulfillment",
184
223
  types: {
185
- StarknetDomain: [
186
- { name: "name", type: "shortstring" },
187
- { name: "version", type: "shortstring" },
188
- { name: "chainId", type: "shortstring" },
189
- { name: "revision", type: "shortstring" }
190
- ],
224
+ StarknetDomain: STARKNET_DOMAIN,
191
225
  OrderFulfillment: [
192
226
  { name: "order_hash", type: "felt" },
193
227
  { name: "fulfiller", type: "ContractAddress" },
228
+ { name: "quantity", type: "felt" },
194
229
  { name: "nonce", type: "felt" }
195
230
  ]
196
231
  },
@@ -199,25 +234,22 @@ function buildFulfillmentTypedData(message, chainId) {
199
234
  }
200
235
  function buildCancellationTypedData(message, chainId) {
201
236
  return {
202
- domain: {
203
- name: "Medialane",
204
- version: "1",
205
- chainId,
206
- revision: starknet.TypedDataRevision.ACTIVE
237
+ domain: buildDomain("erc721", chainId),
238
+ primaryType: "OrderCancellation",
239
+ types: {
240
+ StarknetDomain: STARKNET_DOMAIN,
241
+ OrderCancellation: ORDER_CANCELLATION
207
242
  },
243
+ message
244
+ };
245
+ }
246
+ function build1155CancellationTypedData(message, chainId) {
247
+ return {
248
+ domain: buildDomain("erc1155", chainId),
208
249
  primaryType: "OrderCancellation",
209
250
  types: {
210
- StarknetDomain: [
211
- { name: "name", type: "shortstring" },
212
- { name: "version", type: "shortstring" },
213
- { name: "chainId", type: "shortstring" },
214
- { name: "revision", type: "shortstring" }
215
- ],
216
- OrderCancellation: [
217
- { name: "order_hash", type: "felt" },
218
- { name: "offerer", type: "ContractAddress" },
219
- { name: "nonce", type: "felt" }
220
- ]
251
+ StarknetDomain: STARKNET_DOMAIN,
252
+ OrderCancellation: ORDER_CANCELLATION
221
253
  },
222
254
  message
223
255
  };
@@ -247,7 +279,7 @@ function encodeByteArray(str) {
247
279
  ];
248
280
  }
249
281
 
250
- // src/abis.ts
282
+ // src/abis/ipMarketplace.ts
251
283
  var IPMarketplaceABI = [
252
284
  {
253
285
  type: "impl",
@@ -554,6 +586,8 @@ var IPMarketplaceABI = [
554
586
  ]
555
587
  }
556
588
  ];
589
+
590
+ // src/abis/popCollection.ts
557
591
  var POPCollectionABI = [
558
592
  {
559
593
  type: "struct",
@@ -641,6 +675,8 @@ var POPCollectionABI = [
641
675
  state_mutability: "view"
642
676
  }
643
677
  ];
678
+
679
+ // src/abis/popFactory.ts
644
680
  var POPFactoryABI = [
645
681
  {
646
682
  type: "struct",
@@ -696,6 +732,8 @@ var POPFactoryABI = [
696
732
  state_mutability: "external"
697
733
  }
698
734
  ];
735
+
736
+ // src/abis/dropCollection.ts
699
737
  var DropCollectionABI = [
700
738
  {
701
739
  type: "struct",
@@ -865,6 +903,8 @@ var DropCollectionABI = [
865
903
  state_mutability: "view"
866
904
  }
867
905
  ];
906
+
907
+ // src/abis/dropFactory.ts
868
908
  var DropFactoryABI = [
869
909
  {
870
910
  type: "struct",
@@ -952,6 +992,8 @@ var DropFactoryABI = [
952
992
  state_mutability: "external"
953
993
  }
954
994
  ];
995
+
996
+ // src/abis/collectionRegistry.ts
955
997
  var CollectionRegistryABI = [
956
998
  {
957
999
  type: "struct",
@@ -988,6 +1030,8 @@ var CollectionRegistryABI = [
988
1030
  state_mutability: "view"
989
1031
  }
990
1032
  ];
1033
+
1034
+ // src/abis/medialane1155.ts
991
1035
  var Medialane1155ABI = [
992
1036
  {
993
1037
  "type": "impl",
@@ -1481,6 +1525,8 @@ var Medialane1155ABI = [
1481
1525
  ]
1482
1526
  }
1483
1527
  ];
1528
+
1529
+ // src/abis/ipCollection1155Factory.ts
1484
1530
  var IPCollection1155FactoryABI = [
1485
1531
  {
1486
1532
  "type": "impl",
@@ -1766,6 +1812,8 @@ var IPCollection1155FactoryABI = [
1766
1812
  ]
1767
1813
  }
1768
1814
  ];
1815
+
1816
+ // src/abis/ipCollection1155.ts
1769
1817
  var IPCollection1155ABI = [
1770
1818
  {
1771
1819
  "type": "impl",
@@ -2847,6 +2895,8 @@ var IPCollection1155ABI = [
2847
2895
  ]
2848
2896
  }
2849
2897
  ];
2898
+
2899
+ // src/abis/ipCollection.ts
2850
2900
  var IPCollectionABI = [
2851
2901
  {
2852
2902
  "type": "impl",
@@ -3610,6 +3660,8 @@ var IPCollectionABI = [
3610
3660
  ]
3611
3661
  }
3612
3662
  ];
3663
+
3664
+ // src/abis/ipNft.ts
3613
3665
  var IPNftABI = [
3614
3666
  {
3615
3667
  "type": "impl",
@@ -4923,85 +4975,6 @@ var MarketplaceModule = class {
4923
4975
  return buildCancellationTypedData(params, chainId);
4924
4976
  }
4925
4977
  };
4926
- var STARKNET_DOMAIN = [
4927
- { name: "name", type: "shortstring" },
4928
- { name: "version", type: "shortstring" },
4929
- { name: "chainId", type: "shortstring" },
4930
- { name: "revision", type: "shortstring" }
4931
- ];
4932
- function domain1155(chainId) {
4933
- return {
4934
- name: "Medialane",
4935
- version: "2",
4936
- chainId,
4937
- revision: starknet.TypedDataRevision.ACTIVE
4938
- };
4939
- }
4940
- function build1155OrderTypedData(message, chainId) {
4941
- return {
4942
- domain: domain1155(chainId),
4943
- primaryType: "OrderParameters",
4944
- types: {
4945
- StarknetDomain: STARKNET_DOMAIN,
4946
- OfferItem: [
4947
- { name: "item_type", type: "shortstring" },
4948
- { name: "token", type: "ContractAddress" },
4949
- { name: "identifier_or_criteria", type: "felt" },
4950
- { name: "start_amount", type: "felt" },
4951
- { name: "end_amount", type: "felt" }
4952
- ],
4953
- ConsiderationItem: [
4954
- { name: "item_type", type: "shortstring" },
4955
- { name: "token", type: "ContractAddress" },
4956
- { name: "identifier_or_criteria", type: "felt" },
4957
- { name: "start_amount", type: "felt" },
4958
- { name: "end_amount", type: "felt" },
4959
- { name: "recipient", type: "ContractAddress" }
4960
- ],
4961
- OrderParameters: [
4962
- { name: "offerer", type: "ContractAddress" },
4963
- { name: "offer", type: "OfferItem" },
4964
- { name: "consideration", type: "ConsiderationItem" },
4965
- { name: "start_time", type: "felt" },
4966
- { name: "end_time", type: "felt" },
4967
- { name: "salt", type: "felt" },
4968
- { name: "nonce", type: "felt" }
4969
- ]
4970
- },
4971
- message
4972
- };
4973
- }
4974
- function build1155FulfillmentTypedData(message, chainId) {
4975
- return {
4976
- domain: domain1155(chainId),
4977
- primaryType: "OrderFulfillment",
4978
- types: {
4979
- StarknetDomain: STARKNET_DOMAIN,
4980
- OrderFulfillment: [
4981
- { name: "order_hash", type: "felt" },
4982
- { name: "fulfiller", type: "ContractAddress" },
4983
- { name: "quantity", type: "felt" },
4984
- { name: "nonce", type: "felt" }
4985
- ]
4986
- },
4987
- message
4988
- };
4989
- }
4990
- function build1155CancellationTypedData(message, chainId) {
4991
- return {
4992
- domain: domain1155(chainId),
4993
- primaryType: "OrderCancellation",
4994
- types: {
4995
- StarknetDomain: STARKNET_DOMAIN,
4996
- OrderCancellation: [
4997
- { name: "order_hash", type: "felt" },
4998
- { name: "offerer", type: "ContractAddress" },
4999
- { name: "nonce", type: "felt" }
5000
- ]
5001
- },
5002
- message
5003
- };
5004
- }
5005
4978
  var _contractCache2 = /* @__PURE__ */ new WeakMap();
5006
4979
  function getContract(config) {
5007
4980
  let c = _contractCache2.get(config);