@medialane/sdk 0.1.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.
@@ -0,0 +1,922 @@
1
+ import { z } from 'zod';
2
+ import { AccountInterface, constants, TypedData } from 'starknet';
3
+
4
+ declare const MARKETPLACE_CONTRACT_MAINNET = "0x059deafbbafbf7051c315cf75a94b03c5547892bc0c6dfa36d7ac7290d4cc33a";
5
+ declare const COLLECTION_CONTRACT_MAINNET = "0x05e73b7be06d82beeb390a0e0d655f2c9e7cf519658e04f05d9c690ccc41da03";
6
+ declare const SUPPORTED_TOKENS: readonly [{
7
+ readonly symbol: "USDC";
8
+ readonly address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb";
9
+ readonly decimals: 6;
10
+ }, {
11
+ readonly symbol: "USDT";
12
+ readonly address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8";
13
+ readonly decimals: 6;
14
+ }, {
15
+ readonly symbol: "ETH";
16
+ readonly address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";
17
+ readonly decimals: 18;
18
+ }, {
19
+ readonly symbol: "STRK";
20
+ readonly address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d";
21
+ readonly decimals: 18;
22
+ }];
23
+ type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number]["symbol"];
24
+ declare const SUPPORTED_NETWORKS: readonly ["mainnet", "sepolia"];
25
+ type Network = (typeof SUPPORTED_NETWORKS)[number];
26
+ declare const DEFAULT_RPC_URLS: Record<Network, string>;
27
+
28
+ declare const MedialaneConfigSchema: z.ZodObject<{
29
+ network: z.ZodDefault<z.ZodEnum<["mainnet", "sepolia"]>>;
30
+ rpcUrl: z.ZodOptional<z.ZodString>;
31
+ backendUrl: z.ZodOptional<z.ZodString>;
32
+ /** API key for authenticated /v1/* backend endpoints */
33
+ apiKey: z.ZodOptional<z.ZodString>;
34
+ marketplaceContract: z.ZodOptional<z.ZodString>;
35
+ collectionContract: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ network: "mainnet" | "sepolia";
38
+ rpcUrl?: string | undefined;
39
+ backendUrl?: string | undefined;
40
+ apiKey?: string | undefined;
41
+ marketplaceContract?: string | undefined;
42
+ collectionContract?: string | undefined;
43
+ }, {
44
+ network?: "mainnet" | "sepolia" | undefined;
45
+ rpcUrl?: string | undefined;
46
+ backendUrl?: string | undefined;
47
+ apiKey?: string | undefined;
48
+ marketplaceContract?: string | undefined;
49
+ collectionContract?: string | undefined;
50
+ }>;
51
+ type MedialaneConfig = z.input<typeof MedialaneConfigSchema>;
52
+ interface ResolvedConfig {
53
+ network: Network;
54
+ rpcUrl: string;
55
+ backendUrl: string | undefined;
56
+ apiKey: string | undefined;
57
+ marketplaceContract: string;
58
+ collectionContract: string;
59
+ }
60
+ declare function resolveConfig(raw: MedialaneConfig): ResolvedConfig;
61
+
62
+ interface OfferItem {
63
+ item_type: string;
64
+ token: string;
65
+ identifier_or_criteria: string;
66
+ start_amount: string;
67
+ end_amount: string;
68
+ }
69
+ interface ConsiderationItem extends OfferItem {
70
+ recipient: string;
71
+ }
72
+ interface OrderParameters {
73
+ offerer: string;
74
+ offer: OfferItem;
75
+ consideration: ConsiderationItem;
76
+ start_time: string;
77
+ end_time: string;
78
+ salt: string;
79
+ nonce: string;
80
+ }
81
+ interface Order {
82
+ parameters: OrderParameters;
83
+ signature: string[];
84
+ }
85
+ interface Fulfillment {
86
+ order_hash: string;
87
+ fulfiller: string;
88
+ nonce: string;
89
+ }
90
+ interface Cancelation {
91
+ order_hash: string;
92
+ offerer: string;
93
+ nonce: string;
94
+ }
95
+ interface CreateListingParams {
96
+ nftContract: string;
97
+ tokenId: string;
98
+ price: string;
99
+ /** Currency symbol or token address. Defaults to "USDC" (native). */
100
+ currency?: string;
101
+ durationSeconds: number;
102
+ }
103
+ interface MakeOfferParams {
104
+ nftContract: string;
105
+ tokenId: string;
106
+ price: string;
107
+ /** Currency symbol or token address. Defaults to "USDC" (native). */
108
+ currency?: string;
109
+ durationSeconds: number;
110
+ }
111
+ interface FulfillOrderParams {
112
+ orderHash: string;
113
+ }
114
+ interface CancelOrderParams {
115
+ orderHash: string;
116
+ }
117
+ interface CartItem {
118
+ orderHash: string;
119
+ /** ERC20 token address of the consideration */
120
+ considerationToken: string;
121
+ /** Raw consideration amount (string, e.g. "1000000") */
122
+ considerationAmount: string;
123
+ /** Human-readable identifier for the NFT (for logging) */
124
+ offerIdentifier?: string;
125
+ }
126
+ interface MintParams {
127
+ collectionId: string;
128
+ recipient: string;
129
+ tokenUri: string;
130
+ /** Optional: override the collection contract from config */
131
+ collectionContract?: string;
132
+ }
133
+ interface CreateCollectionParams {
134
+ name: string;
135
+ symbol: string;
136
+ baseUri: string;
137
+ /** Optional: override the collection contract from config */
138
+ collectionContract?: string;
139
+ }
140
+ interface TxResult {
141
+ txHash: string;
142
+ }
143
+
144
+ declare class MedialaneError extends Error {
145
+ readonly cause?: unknown | undefined;
146
+ constructor(message: string, cause?: unknown | undefined);
147
+ }
148
+
149
+ declare class MarketplaceModule {
150
+ private readonly config;
151
+ constructor(config: ResolvedConfig);
152
+ createListing(account: AccountInterface, params: CreateListingParams): Promise<TxResult>;
153
+ makeOffer(account: AccountInterface, params: MakeOfferParams): Promise<TxResult>;
154
+ fulfillOrder(account: AccountInterface, params: FulfillOrderParams): Promise<TxResult>;
155
+ cancelOrder(account: AccountInterface, params: CancelOrderParams): Promise<TxResult>;
156
+ checkoutCart(account: AccountInterface, items: CartItem[]): Promise<TxResult>;
157
+ mint(account: AccountInterface, params: MintParams): Promise<TxResult>;
158
+ createCollection(account: AccountInterface, params: CreateCollectionParams): Promise<TxResult>;
159
+ buildListingTypedData(params: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
160
+ buildFulfillmentTypedData(params: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
161
+ buildCancellationTypedData(params: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
162
+ }
163
+
164
+ type OrderStatus = "ACTIVE" | "FULFILLED" | "CANCELLED" | "EXPIRED";
165
+ type SortOrder = "price_asc" | "price_desc" | "recent";
166
+ type ActivityType = "transfer" | "sale" | "listing" | "offer" | "cancelled";
167
+ type IntentType = "CREATE_LISTING" | "MAKE_OFFER" | "FULFILL_ORDER" | "CANCEL_ORDER" | "MINT" | "CREATE_COLLECTION";
168
+ type IntentStatus = "PENDING" | "SIGNED" | "SUBMITTED" | "CONFIRMED" | "FAILED" | "EXPIRED";
169
+ type WebhookEventType = "ORDER_CREATED" | "ORDER_FULFILLED" | "ORDER_CANCELLED" | "TRANSFER";
170
+ type WebhookStatus = "ACTIVE" | "DISABLED";
171
+ type ApiKeyStatus = "ACTIVE" | "REVOKED";
172
+ type TenantPlan = "FREE" | "PREMIUM";
173
+ interface ApiMeta {
174
+ page: number;
175
+ limit: number;
176
+ total?: number;
177
+ }
178
+ interface ApiResponse<T> {
179
+ data: T;
180
+ meta?: ApiMeta;
181
+ }
182
+ interface ApiOrdersQuery {
183
+ status?: OrderStatus;
184
+ collection?: string;
185
+ currency?: string;
186
+ sort?: SortOrder;
187
+ page?: number;
188
+ limit?: number;
189
+ offerer?: string;
190
+ }
191
+ interface ApiOrderOffer {
192
+ itemType: string;
193
+ token: string;
194
+ identifier: string;
195
+ startAmount: string;
196
+ endAmount: string;
197
+ }
198
+ interface ApiOrderConsideration extends ApiOrderOffer {
199
+ recipient: string;
200
+ }
201
+ interface ApiOrderPrice {
202
+ raw: string | null;
203
+ formatted: string | null;
204
+ currency: string | null;
205
+ }
206
+ interface ApiOrderTxHash {
207
+ created: string | null;
208
+ fulfilled: string | null;
209
+ cancelled: string | null;
210
+ }
211
+ interface ApiOrder {
212
+ id: string;
213
+ chain: string;
214
+ orderHash: string;
215
+ offerer: string;
216
+ offer: ApiOrderOffer;
217
+ consideration: ApiOrderConsideration;
218
+ startTime: string;
219
+ endTime: string;
220
+ status: OrderStatus;
221
+ fulfiller: string | null;
222
+ nftContract: string | null;
223
+ nftTokenId: string | null;
224
+ price: ApiOrderPrice;
225
+ txHash: ApiOrderTxHash;
226
+ createdBlockNumber: string;
227
+ createdAt: string;
228
+ updatedAt: string;
229
+ }
230
+ interface ApiTokenMetadata {
231
+ name: string | null;
232
+ description: string | null;
233
+ image: string | null;
234
+ attributes: unknown | null;
235
+ ipType: string | null;
236
+ licenseType: string | null;
237
+ commercialUse: boolean | null;
238
+ author: string | null;
239
+ }
240
+ interface ApiToken {
241
+ id: string;
242
+ chain: string;
243
+ contractAddress: string;
244
+ tokenId: string;
245
+ owner: string;
246
+ tokenUri: string | null;
247
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
248
+ metadata: ApiTokenMetadata;
249
+ activeOrders: ApiOrder[];
250
+ createdAt: string;
251
+ updatedAt: string;
252
+ }
253
+ interface ApiCollection {
254
+ id: string;
255
+ chain: string;
256
+ contractAddress: string;
257
+ name: string | null;
258
+ startBlock: string;
259
+ isKnown: boolean;
260
+ floorPrice: string | null;
261
+ totalVolume: string | null;
262
+ holderCount: number | null;
263
+ totalSupply: number | null;
264
+ createdAt: string;
265
+ updatedAt: string;
266
+ }
267
+ interface ApiActivityPrice {
268
+ raw: string | null;
269
+ formatted: string | null;
270
+ currency: string | null;
271
+ }
272
+ interface ApiActivity {
273
+ type: ActivityType;
274
+ contractAddress?: string;
275
+ tokenId?: string;
276
+ from?: string;
277
+ to?: string;
278
+ blockNumber?: string;
279
+ orderHash?: string;
280
+ nftContract?: string;
281
+ nftTokenId?: string;
282
+ offerer?: string;
283
+ fulfiller?: string | null;
284
+ price?: ApiActivityPrice;
285
+ txHash: string | null;
286
+ timestamp: string;
287
+ }
288
+ interface ApiActivitiesQuery {
289
+ type?: ActivityType;
290
+ page?: number;
291
+ limit?: number;
292
+ }
293
+ interface ApiSearchTokenResult {
294
+ contractAddress: string;
295
+ tokenId: string;
296
+ name: string | null;
297
+ image: string | null;
298
+ owner: string;
299
+ metadataStatus: string;
300
+ }
301
+ interface ApiSearchCollectionResult {
302
+ contractAddress: string;
303
+ name: string | null;
304
+ totalSupply: number | null;
305
+ floorPrice: string | null;
306
+ holderCount: number | null;
307
+ }
308
+ interface ApiSearchResult {
309
+ tokens: ApiSearchTokenResult[];
310
+ collections: ApiSearchCollectionResult[];
311
+ }
312
+ interface ApiIntent {
313
+ id: string;
314
+ chain: string;
315
+ type: IntentType;
316
+ status: IntentStatus;
317
+ requester: string;
318
+ typedData: unknown;
319
+ calls: unknown;
320
+ signature: string[];
321
+ txHash: string | null;
322
+ orderHash: string | null;
323
+ expiresAt: string;
324
+ createdAt: string;
325
+ updatedAt: string;
326
+ }
327
+ interface ApiIntentCreated {
328
+ id: string;
329
+ typedData: unknown;
330
+ calls: unknown;
331
+ expiresAt: string;
332
+ }
333
+ interface CreateListingIntentParams {
334
+ offerer: string;
335
+ nftContract: string;
336
+ tokenId: string;
337
+ currency: string;
338
+ price: string;
339
+ endTime: number;
340
+ salt?: string;
341
+ }
342
+ interface MakeOfferIntentParams {
343
+ offerer: string;
344
+ nftContract: string;
345
+ tokenId: string;
346
+ currency: string;
347
+ price: string;
348
+ endTime: number;
349
+ salt?: string;
350
+ }
351
+ interface FulfillOrderIntentParams {
352
+ fulfiller: string;
353
+ orderHash: string;
354
+ }
355
+ interface CancelOrderIntentParams {
356
+ offerer: string;
357
+ orderHash: string;
358
+ }
359
+ interface CreateMintIntentParams {
360
+ /** Collection owner wallet address — must be the collection owner on-chain */
361
+ owner: string;
362
+ collectionId: string;
363
+ recipient: string;
364
+ tokenUri: string;
365
+ /** Optional: override the default collection contract address */
366
+ collectionContract?: string;
367
+ }
368
+ interface CreateCollectionIntentParams {
369
+ owner: string;
370
+ name: string;
371
+ symbol: string;
372
+ baseUri: string;
373
+ /** Optional: override the default collection contract address */
374
+ collectionContract?: string;
375
+ }
376
+ interface ApiMetadataSignedUrl {
377
+ url: string;
378
+ }
379
+ interface ApiMetadataUpload {
380
+ cid: string;
381
+ url: string;
382
+ }
383
+ interface ApiPortalMe {
384
+ id: string;
385
+ name: string;
386
+ email: string;
387
+ plan: TenantPlan;
388
+ status: string;
389
+ }
390
+ interface ApiPortalKey {
391
+ id: string;
392
+ prefix: string;
393
+ label: string;
394
+ status: ApiKeyStatus;
395
+ lastUsedAt: string | null;
396
+ createdAt: string;
397
+ }
398
+ interface ApiPortalKeyCreated {
399
+ id: string;
400
+ prefix: string;
401
+ label: string | null;
402
+ /** Plaintext key — shown ONCE at creation */
403
+ plaintext: string;
404
+ }
405
+ interface ApiUsageDay {
406
+ day: string;
407
+ requests: number;
408
+ }
409
+ interface ApiWebhookEndpoint {
410
+ id: string;
411
+ url: string;
412
+ events: WebhookEventType[];
413
+ status: WebhookStatus;
414
+ createdAt: string;
415
+ }
416
+ interface ApiWebhookCreated extends ApiWebhookEndpoint {
417
+ /** Signing secret — shown ONCE at creation, not stored in plaintext */
418
+ secret: string;
419
+ }
420
+ interface CreateWebhookParams {
421
+ url: string;
422
+ events: WebhookEventType[];
423
+ label?: string;
424
+ }
425
+
426
+ declare class MedialaneApiError extends Error {
427
+ readonly status: number;
428
+ constructor(status: number, message: string);
429
+ }
430
+ declare class ApiClient {
431
+ private readonly baseUrl;
432
+ private readonly baseHeaders;
433
+ constructor(baseUrl: string, apiKey?: string);
434
+ private request;
435
+ private get;
436
+ private post;
437
+ private patch;
438
+ private del;
439
+ getOrders(query?: ApiOrdersQuery): Promise<ApiResponse<ApiOrder[]>>;
440
+ getOrder(orderHash: string): Promise<ApiResponse<ApiOrder>>;
441
+ getActiveOrdersForToken(contract: string, tokenId: string): Promise<ApiResponse<ApiOrder[]>>;
442
+ getOrdersByUser(address: string, page?: number, limit?: number): Promise<ApiResponse<ApiOrder[]>>;
443
+ getToken(contract: string, tokenId: string, wait?: boolean): Promise<ApiResponse<ApiToken>>;
444
+ getTokensByOwner(address: string, page?: number, limit?: number): Promise<ApiResponse<ApiToken[]>>;
445
+ getTokenHistory(contract: string, tokenId: string, page?: number, limit?: number): Promise<ApiResponse<ApiActivity[]>>;
446
+ getCollections(page?: number, limit?: number): Promise<ApiResponse<ApiCollection[]>>;
447
+ getCollection(contract: string): Promise<ApiResponse<ApiCollection>>;
448
+ getCollectionTokens(contract: string, page?: number, limit?: number): Promise<ApiResponse<ApiToken[]>>;
449
+ getActivities(query?: ApiActivitiesQuery): Promise<ApiResponse<ApiActivity[]>>;
450
+ getActivitiesByAddress(address: string, page?: number, limit?: number): Promise<ApiResponse<ApiActivity[]>>;
451
+ search(q: string, limit?: number): Promise<ApiResponse<ApiSearchResult> & {
452
+ query: string;
453
+ }>;
454
+ createListingIntent(params: CreateListingIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
455
+ createOfferIntent(params: MakeOfferIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
456
+ createFulfillIntent(params: FulfillOrderIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
457
+ createCancelIntent(params: CancelOrderIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
458
+ getIntent(id: string): Promise<ApiResponse<ApiIntent>>;
459
+ submitIntentSignature(id: string, signature: string[]): Promise<ApiResponse<ApiIntent>>;
460
+ createMintIntent(params: CreateMintIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
461
+ createCollectionIntent(params: CreateCollectionIntentParams): Promise<ApiResponse<ApiIntentCreated>>;
462
+ getMetadataSignedUrl(): Promise<ApiResponse<ApiMetadataSignedUrl>>;
463
+ uploadMetadata(metadata: Record<string, unknown>): Promise<ApiResponse<ApiMetadataUpload>>;
464
+ resolveMetadata(uri: string): Promise<ApiResponse<unknown>>;
465
+ uploadFile(file: File): Promise<ApiResponse<ApiMetadataUpload>>;
466
+ getMe(): Promise<ApiResponse<ApiPortalMe>>;
467
+ getApiKeys(): Promise<ApiResponse<ApiPortalKey[]>>;
468
+ createApiKey(label?: string): Promise<ApiResponse<ApiPortalKeyCreated>>;
469
+ deleteApiKey(id: string): Promise<ApiResponse<{
470
+ id: string;
471
+ status: string;
472
+ }>>;
473
+ getUsage(): Promise<ApiResponse<ApiUsageDay[]>>;
474
+ getWebhooks(): Promise<ApiResponse<ApiWebhookEndpoint[]>>;
475
+ createWebhook(params: CreateWebhookParams): Promise<ApiResponse<ApiWebhookCreated>>;
476
+ deleteWebhook(id: string): Promise<ApiResponse<{
477
+ id: string;
478
+ status: string;
479
+ }>>;
480
+ }
481
+
482
+ declare class MedialaneClient {
483
+ /** On-chain marketplace interactions (create listing, fulfill order, etc.) */
484
+ readonly marketplace: MarketplaceModule;
485
+ /**
486
+ * Off-chain API client — covers all /v1/* backend endpoints.
487
+ * Requires `backendUrl` in config; pass `apiKey` for authenticated routes.
488
+ */
489
+ readonly api: ApiClient;
490
+ private readonly config;
491
+ constructor(rawConfig?: MedialaneConfig);
492
+ get network(): "mainnet" | "sepolia";
493
+ get rpcUrl(): string;
494
+ get marketplaceContract(): string;
495
+ }
496
+
497
+ declare const IPMarketplaceABI: readonly [{
498
+ readonly type: "impl";
499
+ readonly name: "UpgradeableImpl";
500
+ readonly interface_name: "openzeppelin_upgrades::interface::IUpgradeable";
501
+ }, {
502
+ readonly type: "interface";
503
+ readonly name: "openzeppelin_upgrades::interface::IUpgradeable";
504
+ readonly items: readonly [{
505
+ readonly type: "function";
506
+ readonly name: "upgrade";
507
+ readonly inputs: readonly [{
508
+ readonly name: "new_class_hash";
509
+ readonly type: "core::starknet::class_hash::ClassHash";
510
+ }];
511
+ readonly outputs: readonly [];
512
+ readonly state_mutability: "external";
513
+ }];
514
+ }, {
515
+ readonly type: "impl";
516
+ readonly name: "MedialaneImpl";
517
+ readonly interface_name: "mediolano_core::core::interface::IMedialane";
518
+ }, {
519
+ readonly type: "struct";
520
+ readonly name: "mediolano_core::core::types::OfferItem";
521
+ readonly members: readonly [{
522
+ readonly name: "item_type";
523
+ readonly type: "core::felt252";
524
+ }, {
525
+ readonly name: "token";
526
+ readonly type: "core::starknet::contract_address::ContractAddress";
527
+ }, {
528
+ readonly name: "identifier_or_criteria";
529
+ readonly type: "core::felt252";
530
+ }, {
531
+ readonly name: "start_amount";
532
+ readonly type: "core::felt252";
533
+ }, {
534
+ readonly name: "end_amount";
535
+ readonly type: "core::felt252";
536
+ }];
537
+ }, {
538
+ readonly type: "struct";
539
+ readonly name: "mediolano_core::core::types::ConsiderationItem";
540
+ readonly members: readonly [{
541
+ readonly name: "item_type";
542
+ readonly type: "core::felt252";
543
+ }, {
544
+ readonly name: "token";
545
+ readonly type: "core::starknet::contract_address::ContractAddress";
546
+ }, {
547
+ readonly name: "identifier_or_criteria";
548
+ readonly type: "core::felt252";
549
+ }, {
550
+ readonly name: "start_amount";
551
+ readonly type: "core::felt252";
552
+ }, {
553
+ readonly name: "end_amount";
554
+ readonly type: "core::felt252";
555
+ }, {
556
+ readonly name: "recipient";
557
+ readonly type: "core::starknet::contract_address::ContractAddress";
558
+ }];
559
+ }, {
560
+ readonly type: "struct";
561
+ readonly name: "mediolano_core::core::types::OrderParameters";
562
+ readonly members: readonly [{
563
+ readonly name: "offerer";
564
+ readonly type: "core::starknet::contract_address::ContractAddress";
565
+ }, {
566
+ readonly name: "offer";
567
+ readonly type: "mediolano_core::core::types::OfferItem";
568
+ }, {
569
+ readonly name: "consideration";
570
+ readonly type: "mediolano_core::core::types::ConsiderationItem";
571
+ }, {
572
+ readonly name: "start_time";
573
+ readonly type: "core::felt252";
574
+ }, {
575
+ readonly name: "end_time";
576
+ readonly type: "core::felt252";
577
+ }, {
578
+ readonly name: "salt";
579
+ readonly type: "core::felt252";
580
+ }, {
581
+ readonly name: "nonce";
582
+ readonly type: "core::felt252";
583
+ }];
584
+ }, {
585
+ readonly type: "struct";
586
+ readonly name: "mediolano_core::core::types::Order";
587
+ readonly members: readonly [{
588
+ readonly name: "parameters";
589
+ readonly type: "mediolano_core::core::types::OrderParameters";
590
+ }, {
591
+ readonly name: "signature";
592
+ readonly type: "core::array::Array::<core::felt252>";
593
+ }];
594
+ }, {
595
+ readonly type: "struct";
596
+ readonly name: "mediolano_core::core::types::OrderFulfillment";
597
+ readonly members: readonly [{
598
+ readonly name: "order_hash";
599
+ readonly type: "core::felt252";
600
+ }, {
601
+ readonly name: "fulfiller";
602
+ readonly type: "core::starknet::contract_address::ContractAddress";
603
+ }, {
604
+ readonly name: "nonce";
605
+ readonly type: "core::felt252";
606
+ }];
607
+ }, {
608
+ readonly type: "struct";
609
+ readonly name: "mediolano_core::core::types::FulfillmentRequest";
610
+ readonly members: readonly [{
611
+ readonly name: "fulfillment";
612
+ readonly type: "mediolano_core::core::types::OrderFulfillment";
613
+ }, {
614
+ readonly name: "signature";
615
+ readonly type: "core::array::Array::<core::felt252>";
616
+ }];
617
+ }, {
618
+ readonly type: "struct";
619
+ readonly name: "mediolano_core::core::types::OrderCancellation";
620
+ readonly members: readonly [{
621
+ readonly name: "order_hash";
622
+ readonly type: "core::felt252";
623
+ }, {
624
+ readonly name: "offerer";
625
+ readonly type: "core::starknet::contract_address::ContractAddress";
626
+ }, {
627
+ readonly name: "nonce";
628
+ readonly type: "core::felt252";
629
+ }];
630
+ }, {
631
+ readonly type: "struct";
632
+ readonly name: "mediolano_core::core::types::CancelRequest";
633
+ readonly members: readonly [{
634
+ readonly name: "cancelation";
635
+ readonly type: "mediolano_core::core::types::OrderCancellation";
636
+ }, {
637
+ readonly name: "signature";
638
+ readonly type: "core::array::Array::<core::felt252>";
639
+ }];
640
+ }, {
641
+ readonly type: "enum";
642
+ readonly name: "mediolano_core::core::types::OrderStatus";
643
+ readonly variants: readonly [{
644
+ readonly name: "None";
645
+ readonly type: "()";
646
+ }, {
647
+ readonly name: "Created";
648
+ readonly type: "()";
649
+ }, {
650
+ readonly name: "Filled";
651
+ readonly type: "()";
652
+ }, {
653
+ readonly name: "Cancelled";
654
+ readonly type: "()";
655
+ }];
656
+ }, {
657
+ readonly type: "enum";
658
+ readonly name: "core::option::Option::<core::starknet::contract_address::ContractAddress>";
659
+ readonly variants: readonly [{
660
+ readonly name: "Some";
661
+ readonly type: "core::starknet::contract_address::ContractAddress";
662
+ }, {
663
+ readonly name: "None";
664
+ readonly type: "()";
665
+ }];
666
+ }, {
667
+ readonly type: "struct";
668
+ readonly name: "mediolano_core::core::types::OrderDetails";
669
+ readonly members: readonly [{
670
+ readonly name: "offerer";
671
+ readonly type: "core::starknet::contract_address::ContractAddress";
672
+ }, {
673
+ readonly name: "offer";
674
+ readonly type: "mediolano_core::core::types::OfferItem";
675
+ }, {
676
+ readonly name: "consideration";
677
+ readonly type: "mediolano_core::core::types::ConsiderationItem";
678
+ }, {
679
+ readonly name: "start_time";
680
+ readonly type: "core::integer::u64";
681
+ }, {
682
+ readonly name: "end_time";
683
+ readonly type: "core::integer::u64";
684
+ }, {
685
+ readonly name: "order_status";
686
+ readonly type: "mediolano_core::core::types::OrderStatus";
687
+ }, {
688
+ readonly name: "fulfiller";
689
+ readonly type: "core::option::Option::<core::starknet::contract_address::ContractAddress>";
690
+ }];
691
+ }, {
692
+ readonly type: "interface";
693
+ readonly name: "mediolano_core::core::interface::IMedialane";
694
+ readonly items: readonly [{
695
+ readonly type: "function";
696
+ readonly name: "register_order";
697
+ readonly inputs: readonly [{
698
+ readonly name: "order";
699
+ readonly type: "mediolano_core::core::types::Order";
700
+ }];
701
+ readonly outputs: readonly [];
702
+ readonly state_mutability: "external";
703
+ }, {
704
+ readonly type: "function";
705
+ readonly name: "fulfill_order";
706
+ readonly inputs: readonly [{
707
+ readonly name: "fulfillment_request";
708
+ readonly type: "mediolano_core::core::types::FulfillmentRequest";
709
+ }];
710
+ readonly outputs: readonly [];
711
+ readonly state_mutability: "external";
712
+ }, {
713
+ readonly type: "function";
714
+ readonly name: "cancel_order";
715
+ readonly inputs: readonly [{
716
+ readonly name: "cancel_request";
717
+ readonly type: "mediolano_core::core::types::CancelRequest";
718
+ }];
719
+ readonly outputs: readonly [];
720
+ readonly state_mutability: "external";
721
+ }, {
722
+ readonly type: "function";
723
+ readonly name: "get_order_details";
724
+ readonly inputs: readonly [{
725
+ readonly name: "order_hash";
726
+ readonly type: "core::felt252";
727
+ }];
728
+ readonly outputs: readonly [{
729
+ readonly type: "mediolano_core::core::types::OrderDetails";
730
+ }];
731
+ readonly state_mutability: "view";
732
+ }, {
733
+ readonly type: "function";
734
+ readonly name: "get_order_hash";
735
+ readonly inputs: readonly [{
736
+ readonly name: "parameters";
737
+ readonly type: "mediolano_core::core::types::OrderParameters";
738
+ }, {
739
+ readonly name: "signer";
740
+ readonly type: "core::starknet::contract_address::ContractAddress";
741
+ }];
742
+ readonly outputs: readonly [{
743
+ readonly type: "core::felt252";
744
+ }];
745
+ readonly state_mutability: "view";
746
+ }];
747
+ }, {
748
+ readonly type: "impl";
749
+ readonly name: "NoncesImpl";
750
+ readonly interface_name: "openzeppelin_utils::cryptography::interface::INonces";
751
+ }, {
752
+ readonly type: "interface";
753
+ readonly name: "openzeppelin_utils::cryptography::interface::INonces";
754
+ readonly items: readonly [{
755
+ readonly type: "function";
756
+ readonly name: "nonces";
757
+ readonly inputs: readonly [{
758
+ readonly name: "owner";
759
+ readonly type: "core::starknet::contract_address::ContractAddress";
760
+ }];
761
+ readonly outputs: readonly [{
762
+ readonly type: "core::felt252";
763
+ }];
764
+ readonly state_mutability: "view";
765
+ }];
766
+ }, {
767
+ readonly type: "impl";
768
+ readonly name: "SRC5Impl";
769
+ readonly interface_name: "openzeppelin_introspection::interface::ISRC5";
770
+ }, {
771
+ readonly type: "enum";
772
+ readonly name: "core::bool";
773
+ readonly variants: readonly [{
774
+ readonly name: "False";
775
+ readonly type: "()";
776
+ }, {
777
+ readonly name: "True";
778
+ readonly type: "()";
779
+ }];
780
+ }, {
781
+ readonly type: "interface";
782
+ readonly name: "openzeppelin_introspection::interface::ISRC5";
783
+ readonly items: readonly [{
784
+ readonly type: "function";
785
+ readonly name: "supports_interface";
786
+ readonly inputs: readonly [{
787
+ readonly name: "interface_id";
788
+ readonly type: "core::felt252";
789
+ }];
790
+ readonly outputs: readonly [{
791
+ readonly type: "core::bool";
792
+ }];
793
+ readonly state_mutability: "view";
794
+ }];
795
+ }, {
796
+ readonly type: "constructor";
797
+ readonly name: "constructor";
798
+ readonly inputs: readonly [{
799
+ readonly name: "manager";
800
+ readonly type: "core::starknet::contract_address::ContractAddress";
801
+ }, {
802
+ readonly name: "native_token_address";
803
+ readonly type: "core::starknet::contract_address::ContractAddress";
804
+ }];
805
+ }, {
806
+ readonly type: "event";
807
+ readonly name: "mediolano_core::core::events::OrderCreated";
808
+ readonly kind: "struct";
809
+ readonly members: readonly [{
810
+ readonly name: "order_hash";
811
+ readonly type: "core::felt252";
812
+ readonly kind: "key";
813
+ }, {
814
+ readonly name: "offerer";
815
+ readonly type: "core::starknet::contract_address::ContractAddress";
816
+ readonly kind: "key";
817
+ }];
818
+ }, {
819
+ readonly type: "event";
820
+ readonly name: "mediolano_core::core::events::OrderFulfilled";
821
+ readonly kind: "struct";
822
+ readonly members: readonly [{
823
+ readonly name: "order_hash";
824
+ readonly type: "core::felt252";
825
+ readonly kind: "key";
826
+ }, {
827
+ readonly name: "offerer";
828
+ readonly type: "core::starknet::contract_address::ContractAddress";
829
+ readonly kind: "key";
830
+ }, {
831
+ readonly name: "fulfiller";
832
+ readonly type: "core::starknet::contract_address::ContractAddress";
833
+ readonly kind: "key";
834
+ }];
835
+ }, {
836
+ readonly type: "event";
837
+ readonly name: "mediolano_core::core::events::OrderCancelled";
838
+ readonly kind: "struct";
839
+ readonly members: readonly [{
840
+ readonly name: "order_hash";
841
+ readonly type: "core::felt252";
842
+ readonly kind: "key";
843
+ }, {
844
+ readonly name: "offerer";
845
+ readonly type: "core::starknet::contract_address::ContractAddress";
846
+ readonly kind: "key";
847
+ }];
848
+ }, {
849
+ readonly type: "event";
850
+ readonly name: "mediolano_core::core::medialane::Medialane::Event";
851
+ readonly kind: "enum";
852
+ readonly variants: readonly [{
853
+ readonly name: "OrderCreated";
854
+ readonly type: "mediolano_core::core::events::OrderCreated";
855
+ readonly kind: "nested";
856
+ }, {
857
+ readonly name: "OrderFulfilled";
858
+ readonly type: "mediolano_core::core::events::OrderFulfilled";
859
+ readonly kind: "nested";
860
+ }, {
861
+ readonly name: "OrderCancelled";
862
+ readonly type: "mediolano_core::core::events::OrderCancelled";
863
+ readonly kind: "nested";
864
+ }];
865
+ }];
866
+
867
+ /**
868
+ * Normalize a Starknet address to a 0x-prefixed 64-character hex string.
869
+ */
870
+ declare function normalizeAddress(address: string): string;
871
+ /**
872
+ * Shorten an address to "0x1234...abcd" format.
873
+ */
874
+ declare function shortenAddress(address: string, chars?: number): string;
875
+
876
+ type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
877
+ /**
878
+ * Parse a human-readable amount (e.g. "1.5") to its raw integer string
879
+ * representation given the token's decimal places.
880
+ * Uses pure BigInt arithmetic to avoid floating point precision loss.
881
+ */
882
+ declare function parseAmount(human: string, decimals: number): string;
883
+ /**
884
+ * Format a raw integer string (e.g. "1500000") to a human-readable decimal
885
+ * string given the token's decimal places.
886
+ */
887
+ declare function formatAmount(raw: string, decimals: number): string;
888
+ /**
889
+ * Find a supported token by its contract address (case-insensitive).
890
+ */
891
+ declare function getTokenByAddress(address: string): SupportedToken | undefined;
892
+ /**
893
+ * Find a supported token by its symbol (case-insensitive).
894
+ */
895
+ declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
896
+
897
+ /**
898
+ * Recursively convert all BigInt values to their decimal string representations.
899
+ * Required before JSON serialisation and before passing objects to starknet.js
900
+ * functions that expect string felts.
901
+ */
902
+ declare function stringifyBigInts(obj: unknown): unknown;
903
+ /**
904
+ * Convert a u256 represented as { low: string; high: string } to a single BigInt.
905
+ */
906
+ declare function u256ToBigInt(low: string, high: string): bigint;
907
+
908
+ /**
909
+ * Build SNIP-12 typed data for signing an OrderParameters struct.
910
+ * Uses TypedDataRevision.ACTIVE and ContractAddress / shortstring SNIP-12 types.
911
+ */
912
+ declare function buildOrderTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
913
+ /**
914
+ * Build SNIP-12 typed data for signing an OrderFulfillment struct.
915
+ */
916
+ declare function buildFulfillmentTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
917
+ /**
918
+ * Build SNIP-12 typed data for signing an OrderCancellation struct.
919
+ */
920
+ declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
921
+
922
+ export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, ApiClient, type ApiCollection, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenMetadata, type ApiUsageDay, type ApiWebhookCreated, type ApiWebhookEndpoint, COLLECTION_CONTRACT_MAINNET, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreateWebhookParams, DEFAULT_RPC_URLS, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, IPMarketplaceABI, type IntentStatus, type IntentType, MARKETPLACE_CONTRACT_MAINNET, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MintParams, type Network, type OfferItem, type Order, type OrderParameters, type OrderStatus, type ResolvedConfig, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type SortOrder, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };