@medialane/sdk 0.16.0 → 0.18.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 +112 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -24
- package/dist/index.d.ts +11 -24
- package/dist/index.js +113 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
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
|
};
|
|
@@ -4923,85 +4955,6 @@ var MarketplaceModule = class {
|
|
|
4923
4955
|
return buildCancellationTypedData(params, chainId);
|
|
4924
4956
|
}
|
|
4925
4957
|
};
|
|
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
4958
|
var _contractCache2 = /* @__PURE__ */ new WeakMap();
|
|
5006
4959
|
function getContract(config) {
|
|
5007
4960
|
let c = _contractCache2.get(config);
|
|
@@ -6381,6 +6334,24 @@ var SERVICES = {
|
|
|
6381
6334
|
},
|
|
6382
6335
|
uiVariant: "edition",
|
|
6383
6336
|
capabilities: ["list", "buy", "make_offer", "cancel"]
|
|
6337
|
+
},
|
|
6338
|
+
"external-erc721": {
|
|
6339
|
+
id: "external-erc721",
|
|
6340
|
+
displayName: "External ERC-721",
|
|
6341
|
+
description: "ERC-721 contract not deployed via a Medialane service.",
|
|
6342
|
+
standard: "ERC721",
|
|
6343
|
+
provenance: "EXTERNAL",
|
|
6344
|
+
uiVariant: "standard",
|
|
6345
|
+
capabilities: ["list", "buy", "make_offer", "cancel", "transfer"]
|
|
6346
|
+
},
|
|
6347
|
+
"external-erc1155": {
|
|
6348
|
+
id: "external-erc1155",
|
|
6349
|
+
displayName: "External ERC-1155",
|
|
6350
|
+
description: "ERC-1155 contract not deployed via a Medialane service.",
|
|
6351
|
+
standard: "ERC1155",
|
|
6352
|
+
provenance: "EXTERNAL",
|
|
6353
|
+
uiVariant: "edition",
|
|
6354
|
+
capabilities: ["list", "buy", "make_offer", "cancel", "transfer"]
|
|
6384
6355
|
}
|
|
6385
6356
|
};
|
|
6386
6357
|
function getService(id) {
|