@medialane/sdk 0.192.0 → 0.194.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/{chunk-V4UXHC53.cjs → chunk-BLEFV7GP.cjs} +2 -2
- package/dist/{chunk-V4UXHC53.cjs.map → chunk-BLEFV7GP.cjs.map} +1 -1
- package/dist/{chunk-2B4PVFOS.js → chunk-MOIM2AAQ.js} +2 -2
- package/dist/{chunk-2B4PVFOS.js.map → chunk-MOIM2AAQ.js.map} +1 -1
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/contract/index.cjs +509 -0
- package/dist/contract/index.cjs.map +1 -0
- package/dist/contract/index.d.cts +104 -0
- package/dist/contract/index.d.ts +104 -0
- package/dist/contract/index.js +493 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/{errors-CrBviXC8.d.cts → errors-C39AqEX6.d.cts} +46 -309
- package/dist/{errors-kCrcWfrz.d.ts → errors-Cc9W7FFi.d.ts} +46 -309
- package/dist/evm/index.cjs +1 -0
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +1 -0
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +78 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/provisioning-BUYiU8Tr.d.cts +1720 -0
- package/dist/provisioning-BUYiU8Tr.d.ts +1720 -0
- package/dist/solana/index.cjs +1 -0
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.js +1 -0
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +68 -67
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -2
- package/dist/starknet/index.d.ts +3 -2
- package/dist/starknet/index.js +3 -2
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +1 -0
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.js +1 -0
- package/dist/stellar/index.js.map +1 -1
- package/package.json +6 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { C as Chain } from './types-DC4jNPAF.js';
|
|
2
|
-
import { AccountInterface, Call, ProviderInterface, TypedData } from 'starknet';
|
|
3
2
|
import { z } from 'zod';
|
|
3
|
+
import { s as sponsorshipBidAcceptSchema, a as sponsorshipProposalAcceptSchema, o as ordersListQuery, b as orderSchema, l as listingSchema, c as offerSchema, f as fulfillSchema, d as cancelSchema, e as checkoutBodySchema, m as mintSchema, t as transferTokenSchema, g as transferNftSchema, h as transferCollectionOwnershipSchema, i as commentSchema, j as genesisMintSchema, p as popClaimSchema, k as popBurnSchema, n as dropClaimSchema, w as walletManageSchema, q as swapIntentSchema, r as fundingTransferSchema, u as dropManageSchema, v as popManageSchema, x as createCollectionSchema, y as createTierSchema, z as emissionSchema, A as createCoinSchema, B as launchCoinSchema, C as sponsorshipOfferSchema, D as sponsorshipOfferOpenSchema, E as sponsorshipBidSchema, F as sponsorshipBidRetractSchema, G as sponsorshipProposalSchema, H as sponsorshipProposalWithdrawSchema, I as sponsorshipProposalRejectSchema, J as counterOfferSchema, K as collectionProfileSchema, L as COLLECTION_SERVICE_IDS, M as FACTORY_FAMILY_SERVICE_IDS, T as TIER_SERVICE_IDS, N as provisioningRegisterSchema } from './provisioning-BUYiU8Tr.js';
|
|
4
|
+
import { AccountInterface, Call, ProviderInterface, TypedData } from 'starknet';
|
|
4
5
|
|
|
5
6
|
interface RetryOptions {
|
|
6
7
|
maxAttempts?: number;
|
|
@@ -81,13 +82,13 @@ declare const MedialaneConfigSchema: z.ZodObject<{
|
|
|
81
82
|
}>>;
|
|
82
83
|
}, "strip", z.ZodTypeAny, {
|
|
83
84
|
chain: "STARKNET" | "ETHEREUM" | "SOLANA" | "BASE" | "STELLAR" | "BITCOIN";
|
|
85
|
+
collectionContract?: string | undefined;
|
|
84
86
|
backendUrl?: string | undefined;
|
|
85
87
|
apiKey?: string | undefined;
|
|
86
88
|
marketplace721Contract?: string | undefined;
|
|
87
89
|
marketplaceContract?: string | undefined;
|
|
88
90
|
marketplace1155Contract?: string | undefined;
|
|
89
91
|
collection721Contract?: string | undefined;
|
|
90
|
-
collectionContract?: string | undefined;
|
|
91
92
|
collection1155Contract?: string | undefined;
|
|
92
93
|
retryOptions?: {
|
|
93
94
|
maxAttempts?: number | undefined;
|
|
@@ -102,6 +103,7 @@ declare const MedialaneConfigSchema: z.ZodObject<{
|
|
|
102
103
|
fundAddress?: string | undefined;
|
|
103
104
|
} | undefined;
|
|
104
105
|
}, {
|
|
106
|
+
collectionContract?: string | undefined;
|
|
105
107
|
chain?: "STARKNET" | "ETHEREUM" | "SOLANA" | "BASE" | "STELLAR" | "BITCOIN" | undefined;
|
|
106
108
|
backendUrl?: string | undefined;
|
|
107
109
|
apiKey?: string | undefined;
|
|
@@ -109,7 +111,6 @@ declare const MedialaneConfigSchema: z.ZodObject<{
|
|
|
109
111
|
marketplaceContract?: string | undefined;
|
|
110
112
|
marketplace1155Contract?: string | undefined;
|
|
111
113
|
collection721Contract?: string | undefined;
|
|
112
|
-
collectionContract?: string | undefined;
|
|
113
114
|
collection1155Contract?: string | undefined;
|
|
114
115
|
retryOptions?: {
|
|
115
116
|
maxAttempts?: number | undefined;
|
|
@@ -199,18 +200,9 @@ interface ApiResponse<T> {
|
|
|
199
200
|
meta?: ApiMeta;
|
|
200
201
|
}
|
|
201
202
|
type ChainFilter = Chain | "all";
|
|
202
|
-
|
|
203
|
+
type ApiOrdersQuery = z.input<typeof ordersListQuery> & {
|
|
203
204
|
chain?: ChainFilter;
|
|
204
|
-
|
|
205
|
-
collection?: string;
|
|
206
|
-
currency?: string;
|
|
207
|
-
sort?: SortOrder;
|
|
208
|
-
page?: number;
|
|
209
|
-
limit?: number;
|
|
210
|
-
offerer?: string;
|
|
211
|
-
minPrice?: string;
|
|
212
|
-
maxPrice?: string;
|
|
213
|
-
}
|
|
205
|
+
};
|
|
214
206
|
interface ApiOrderOffer {
|
|
215
207
|
itemType: string;
|
|
216
208
|
token: string;
|
|
@@ -238,30 +230,7 @@ interface ApiOrderTokenMeta {
|
|
|
238
230
|
description: string | null;
|
|
239
231
|
animationUrl: string | null;
|
|
240
232
|
}
|
|
241
|
-
|
|
242
|
-
id: string;
|
|
243
|
-
chain: string;
|
|
244
|
-
orderHash: string;
|
|
245
|
-
offerer: string;
|
|
246
|
-
offer: ApiOrderOffer;
|
|
247
|
-
consideration: ApiOrderConsideration;
|
|
248
|
-
startTime: string;
|
|
249
|
-
endTime: string;
|
|
250
|
-
status: OrderStatus;
|
|
251
|
-
fulfiller: string | null;
|
|
252
|
-
nftContract: string | null;
|
|
253
|
-
nftTokenId: string | null;
|
|
254
|
-
price: ApiOrderPrice;
|
|
255
|
-
txHash: ApiOrderTxHash;
|
|
256
|
-
createdBlockNumber: string;
|
|
257
|
-
remainingAmount: string | null;
|
|
258
|
-
createdAt: string;
|
|
259
|
-
updatedAt: string;
|
|
260
|
-
token: ApiOrderTokenMeta | null;
|
|
261
|
-
parentOrderHash?: string | null;
|
|
262
|
-
counterOfferMessage?: string | null;
|
|
263
|
-
hasActiveCounterOffer?: boolean;
|
|
264
|
-
}
|
|
233
|
+
type ApiOrder = z.output<typeof orderSchema>;
|
|
265
234
|
interface IpAttribute {
|
|
266
235
|
trait_type: string;
|
|
267
236
|
value: string;
|
|
@@ -497,52 +466,14 @@ interface ApiTxSyncResult {
|
|
|
497
466
|
contracts?: string[];
|
|
498
467
|
pending: boolean;
|
|
499
468
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
amount?: string;
|
|
509
|
-
}
|
|
510
|
-
interface MakeOfferIntentParams {
|
|
511
|
-
offerer: string;
|
|
512
|
-
nftContract: string;
|
|
513
|
-
tokenId: string;
|
|
514
|
-
currency: string;
|
|
515
|
-
price: string;
|
|
516
|
-
endTime: number;
|
|
517
|
-
salt?: string;
|
|
518
|
-
tokenStandard?: string;
|
|
519
|
-
quantity?: string;
|
|
520
|
-
}
|
|
521
|
-
interface FulfillOrderIntentParams {
|
|
522
|
-
fulfiller: string;
|
|
523
|
-
orderHash: string;
|
|
524
|
-
tokenStandard?: string;
|
|
525
|
-
quantity?: string;
|
|
526
|
-
}
|
|
527
|
-
interface CancelOrderIntentParams {
|
|
528
|
-
offerer: string;
|
|
529
|
-
orderHash: string;
|
|
530
|
-
tokenStandard?: string;
|
|
531
|
-
}
|
|
532
|
-
type FactoryFamilyServiceId = "mip-erc1155" | "ip-tickets" | "ip-ticketing" | "ip-club";
|
|
533
|
-
type TierServiceId = "ip-tickets" | "ip-ticketing" | "ip-club";
|
|
534
|
-
type CollectionServiceId = FactoryFamilyServiceId | "pop-protocol" | "drop-collection" | "data-tokenization-erc721";
|
|
535
|
-
interface CreateMintIntentParams {
|
|
536
|
-
owner: string;
|
|
537
|
-
recipient: string;
|
|
538
|
-
collectionId?: string;
|
|
539
|
-
tokenUri?: string;
|
|
540
|
-
royaltyBps?: number;
|
|
541
|
-
tokenId?: string;
|
|
542
|
-
amount?: string;
|
|
543
|
-
value?: string;
|
|
544
|
-
collectionContract?: string;
|
|
545
|
-
}
|
|
469
|
+
type CreateListingIntentParams = z.input<typeof listingSchema>;
|
|
470
|
+
type MakeOfferIntentParams = z.input<typeof offerSchema>;
|
|
471
|
+
type FulfillOrderIntentParams = z.input<typeof fulfillSchema>;
|
|
472
|
+
type CancelOrderIntentParams = z.input<typeof cancelSchema>;
|
|
473
|
+
type FactoryFamilyServiceId = (typeof FACTORY_FAMILY_SERVICE_IDS)[number];
|
|
474
|
+
type TierServiceId = (typeof TIER_SERVICE_IDS)[number];
|
|
475
|
+
type CollectionServiceId = (typeof COLLECTION_SERVICE_IDS)[number];
|
|
476
|
+
type CreateMintIntentParams = z.input<typeof mintSchema>;
|
|
546
477
|
/** Drop sale terms on the wire: amounts as decimal strings in the token's smallest unit. */
|
|
547
478
|
interface DropTermsBody {
|
|
548
479
|
/** Unix seconds; 0 = open from creation. */
|
|
@@ -591,31 +522,12 @@ interface ApiDropMint {
|
|
|
591
522
|
blockNumber: string;
|
|
592
523
|
createdAt: string;
|
|
593
524
|
}
|
|
594
|
-
|
|
595
|
-
owner: string;
|
|
596
|
-
name: string;
|
|
597
|
-
symbol: string;
|
|
598
|
-
description?: string;
|
|
599
|
-
image?: string;
|
|
600
|
-
baseUri?: string;
|
|
601
|
-
collectionContract?: string;
|
|
602
|
-
service?: CollectionServiceId;
|
|
603
|
-
claimEndTimestamp?: number;
|
|
604
|
-
maxSupply?: string;
|
|
605
|
-
/** drop-collection */
|
|
606
|
-
terms?: DropTermsBody;
|
|
607
|
-
/** drop-collection — Merkle root of the allowlist; omitted = open to everyone */
|
|
608
|
-
allowlistRoot?: string;
|
|
609
|
-
}
|
|
525
|
+
type CreateCollectionIntentParams = z.input<typeof createCollectionSchema>;
|
|
610
526
|
interface CheckoutIntentItem {
|
|
611
527
|
orderHash: string;
|
|
612
528
|
quantity?: string;
|
|
613
529
|
}
|
|
614
|
-
|
|
615
|
-
fulfiller: string;
|
|
616
|
-
items?: CheckoutIntentItem[];
|
|
617
|
-
orderHashes?: string[];
|
|
618
|
-
}
|
|
530
|
+
type CreateCheckoutIntentParams = z.input<typeof checkoutBodySchema>;
|
|
619
531
|
interface ApiCheckoutIntentResult {
|
|
620
532
|
id?: string;
|
|
621
533
|
orderHash: string;
|
|
@@ -624,28 +536,8 @@ interface ApiCheckoutIntentResult {
|
|
|
624
536
|
expiresAt?: string;
|
|
625
537
|
error?: string;
|
|
626
538
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
collection: string;
|
|
630
|
-
service: TierServiceId;
|
|
631
|
-
maxSupply: string;
|
|
632
|
-
startTime?: number;
|
|
633
|
-
endTime?: number;
|
|
634
|
-
royaltyBps: number;
|
|
635
|
-
metadataUri: string;
|
|
636
|
-
}
|
|
637
|
-
interface EmissionParams {
|
|
638
|
-
chain?: "STARKNET";
|
|
639
|
-
service: string;
|
|
640
|
-
owner: string;
|
|
641
|
-
recipients: string[];
|
|
642
|
-
tokenUri?: string;
|
|
643
|
-
collectionId?: string;
|
|
644
|
-
collectionContract?: string;
|
|
645
|
-
tokenId?: string;
|
|
646
|
-
amount?: string;
|
|
647
|
-
batchSize?: number;
|
|
648
|
-
}
|
|
539
|
+
type CreateTierIntentParams = z.output<typeof createTierSchema>;
|
|
540
|
+
type EmissionParams = z.input<typeof emissionSchema>;
|
|
649
541
|
interface ApiEmissionCall {
|
|
650
542
|
contractAddress: string;
|
|
651
543
|
entrypoint: string;
|
|
@@ -657,87 +549,18 @@ interface ApiEmissionResult {
|
|
|
657
549
|
callCount: number;
|
|
658
550
|
batches: ApiEmissionCall[][];
|
|
659
551
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
initialHolders: string[];
|
|
673
|
-
initialHoldersAmounts: string[];
|
|
674
|
-
transferRestrictionDelay?: number;
|
|
675
|
-
maxPercentageBuyLaunch?: number;
|
|
676
|
-
quoteFundAmount?: string;
|
|
677
|
-
}
|
|
678
|
-
interface CreateSponsorshipOfferIntentParams {
|
|
679
|
-
author: string;
|
|
680
|
-
nftContract: string;
|
|
681
|
-
tokenId: string;
|
|
682
|
-
minAmount: string;
|
|
683
|
-
duration: number;
|
|
684
|
-
paymentToken: string;
|
|
685
|
-
licenseTermsUri: string;
|
|
686
|
-
transferable: boolean;
|
|
687
|
-
royaltyBps: number;
|
|
688
|
-
specificSponsor?: string;
|
|
689
|
-
}
|
|
690
|
-
interface SetSponsorshipOfferOpenIntentParams {
|
|
691
|
-
author: string;
|
|
692
|
-
offerId: string;
|
|
693
|
-
open: boolean;
|
|
694
|
-
}
|
|
695
|
-
interface PlaceSponsorshipBidIntentParams {
|
|
696
|
-
sponsor: string;
|
|
697
|
-
offerId: string;
|
|
698
|
-
amount: string;
|
|
699
|
-
paymentToken: string;
|
|
700
|
-
}
|
|
701
|
-
interface RetractSponsorshipBidIntentParams {
|
|
702
|
-
sponsor: string;
|
|
703
|
-
offerId: string;
|
|
704
|
-
}
|
|
705
|
-
interface AcceptSponsorshipBidIntentParams {
|
|
706
|
-
author: string;
|
|
707
|
-
offerId: string;
|
|
708
|
-
sponsor: string;
|
|
709
|
-
}
|
|
710
|
-
interface CreateSponsorshipProposalIntentParams {
|
|
711
|
-
proposer: string;
|
|
712
|
-
nftContract: string;
|
|
713
|
-
tokenId: string;
|
|
714
|
-
amount: string;
|
|
715
|
-
duration: number;
|
|
716
|
-
validUntil?: number;
|
|
717
|
-
paymentToken: string;
|
|
718
|
-
licenseTermsUri: string;
|
|
719
|
-
transferable: boolean;
|
|
720
|
-
royaltyBps: number;
|
|
721
|
-
}
|
|
722
|
-
interface WithdrawSponsorshipProposalIntentParams {
|
|
723
|
-
proposer: string;
|
|
724
|
-
proposalId: string;
|
|
725
|
-
}
|
|
726
|
-
interface AcceptSponsorshipProposalIntentParams {
|
|
727
|
-
owner: string;
|
|
728
|
-
proposalId: string;
|
|
729
|
-
}
|
|
730
|
-
interface RejectSponsorshipProposalIntentParams {
|
|
731
|
-
owner: string;
|
|
732
|
-
proposalId: string;
|
|
733
|
-
}
|
|
734
|
-
interface CreateCounterOfferIntentParams {
|
|
735
|
-
sellerAddress: string;
|
|
736
|
-
originalOrderHash: string;
|
|
737
|
-
priceRaw: string;
|
|
738
|
-
durationSeconds: number;
|
|
739
|
-
message?: string;
|
|
740
|
-
}
|
|
552
|
+
type CreateCoinIntentParams = z.input<typeof createCoinSchema>;
|
|
553
|
+
type LaunchCoinIntentParams = z.output<typeof launchCoinSchema>;
|
|
554
|
+
type CreateSponsorshipOfferIntentParams = z.output<typeof sponsorshipOfferSchema>;
|
|
555
|
+
type SetSponsorshipOfferOpenIntentParams = z.input<typeof sponsorshipOfferOpenSchema>;
|
|
556
|
+
type PlaceSponsorshipBidIntentParams = z.input<typeof sponsorshipBidSchema>;
|
|
557
|
+
type RetractSponsorshipBidIntentParams = z.input<typeof sponsorshipBidRetractSchema>;
|
|
558
|
+
type AcceptSponsorshipBidIntentParams = z.input<typeof sponsorshipBidAcceptSchema>;
|
|
559
|
+
type CreateSponsorshipProposalIntentParams = z.output<typeof sponsorshipProposalSchema>;
|
|
560
|
+
type WithdrawSponsorshipProposalIntentParams = z.input<typeof sponsorshipProposalWithdrawSchema>;
|
|
561
|
+
type AcceptSponsorshipProposalIntentParams = z.input<typeof sponsorshipProposalAcceptSchema>;
|
|
562
|
+
type RejectSponsorshipProposalIntentParams = z.input<typeof sponsorshipProposalRejectSchema>;
|
|
563
|
+
type CreateCounterOfferIntentParams = z.input<typeof counterOfferSchema>;
|
|
741
564
|
interface ApiCounterOffersQuery {
|
|
742
565
|
originalOrderHash?: string;
|
|
743
566
|
sellerAddress?: string;
|
|
@@ -917,19 +740,7 @@ interface ApiCollectionProfile {
|
|
|
917
740
|
updatedBy: string | null;
|
|
918
741
|
updatedAt: string;
|
|
919
742
|
}
|
|
920
|
-
|
|
921
|
-
displayName?: string | null;
|
|
922
|
-
description?: string | null;
|
|
923
|
-
image?: string | null;
|
|
924
|
-
bannerImage?: string | null;
|
|
925
|
-
websiteUrl?: string | null;
|
|
926
|
-
twitterUrl?: string | null;
|
|
927
|
-
discordUrl?: string | null;
|
|
928
|
-
telegramUrl?: string | null;
|
|
929
|
-
gatedContentTitle?: string | null;
|
|
930
|
-
gatedContentUrl?: string | null;
|
|
931
|
-
gatedContentType?: "VIDEO" | "STREAM" | "AUDIO" | "DOCUMENT" | "LINK" | null;
|
|
932
|
-
}
|
|
743
|
+
type UpdateCollectionProfileInput = z.output<typeof collectionProfileSchema>;
|
|
933
744
|
interface ApiCollectionSlugClaim {
|
|
934
745
|
id: string;
|
|
935
746
|
slug: string;
|
|
@@ -1258,93 +1069,22 @@ interface ApiPricing {
|
|
|
1258
1069
|
rules: ApiPricingRule[];
|
|
1259
1070
|
};
|
|
1260
1071
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
contractAddress: string;
|
|
1270
|
-
tokenId: string;
|
|
1271
|
-
recipient: string;
|
|
1272
|
-
tokenStandard: "ERC721" | "ERC1155";
|
|
1273
|
-
}
|
|
1274
|
-
interface CreateTransferCollectionOwnershipIntentParams {
|
|
1275
|
-
owner: string;
|
|
1276
|
-
collectionId: string;
|
|
1277
|
-
newOwner: string;
|
|
1278
|
-
}
|
|
1279
|
-
interface CreateCommentIntentParams {
|
|
1280
|
-
author: string;
|
|
1281
|
-
nftContract: string;
|
|
1282
|
-
tokenId: string;
|
|
1283
|
-
text: string;
|
|
1284
|
-
}
|
|
1285
|
-
interface CreateGenesisMintIntentParams {
|
|
1286
|
-
owner: string;
|
|
1287
|
-
recipient: string;
|
|
1288
|
-
}
|
|
1289
|
-
interface CreatePopClaimIntentParams {
|
|
1290
|
-
claimer: string;
|
|
1291
|
-
collection: string;
|
|
1292
|
-
proof: string[];
|
|
1293
|
-
}
|
|
1294
|
-
interface CreatePopBurnIntentParams {
|
|
1295
|
-
owner: string;
|
|
1296
|
-
collection: string;
|
|
1297
|
-
tokenId: string;
|
|
1298
|
-
}
|
|
1299
|
-
interface CreateDropClaimIntentParams {
|
|
1300
|
-
claimer: string;
|
|
1301
|
-
collection: string;
|
|
1302
|
-
/** Tokens to mint, decimal string. */
|
|
1303
|
-
quantity: string;
|
|
1304
|
-
/** Allowlist proof from the claim link; omitted for open drops. */
|
|
1305
|
-
proof?: string[];
|
|
1306
|
-
}
|
|
1072
|
+
type CreateTransferTokenIntentParams = z.input<typeof transferTokenSchema>;
|
|
1073
|
+
type CreateTransferNftIntentParams = z.input<typeof transferNftSchema>;
|
|
1074
|
+
type CreateTransferCollectionOwnershipIntentParams = z.input<typeof transferCollectionOwnershipSchema>;
|
|
1075
|
+
type CreateCommentIntentParams = z.input<typeof commentSchema>;
|
|
1076
|
+
type CreateGenesisMintIntentParams = z.input<typeof genesisMintSchema>;
|
|
1077
|
+
type CreatePopClaimIntentParams = z.input<typeof popClaimSchema>;
|
|
1078
|
+
type CreatePopBurnIntentParams = z.input<typeof popBurnSchema>;
|
|
1079
|
+
type CreateDropClaimIntentParams = z.input<typeof dropClaimSchema>;
|
|
1307
1080
|
type WalletManageAction = "add_owner" | "remove_owner" | "cancel_escape" | "set_first_guardian" | "trigger_escape" | "complete_escape";
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
pubkey?: string;
|
|
1312
|
-
ownerGuid?: string;
|
|
1313
|
-
newOwnerPubkey?: string;
|
|
1314
|
-
}
|
|
1315
|
-
interface CreateSwapIntentParams {
|
|
1316
|
-
taker: string;
|
|
1317
|
-
sellTokenAddress: string;
|
|
1318
|
-
buyTokenAddress: string;
|
|
1319
|
-
sellAmountRaw?: string;
|
|
1320
|
-
buyAmountRaw?: string;
|
|
1321
|
-
}
|
|
1322
|
-
interface CreateFundingTransferIntentParams {
|
|
1323
|
-
owner: string;
|
|
1324
|
-
asset: string;
|
|
1325
|
-
amountAtomic: string;
|
|
1326
|
-
}
|
|
1081
|
+
type CreateWalletManageIntentParams = z.input<typeof walletManageSchema>;
|
|
1082
|
+
type CreateSwapIntentParams = z.input<typeof swapIntentSchema>;
|
|
1083
|
+
type CreateFundingTransferIntentParams = z.input<typeof fundingTransferSchema>;
|
|
1327
1084
|
type DropManageAction = "issue" | "set_allowlist_root";
|
|
1328
|
-
|
|
1329
|
-
owner: string;
|
|
1330
|
-
collection: string;
|
|
1331
|
-
action: DropManageAction;
|
|
1332
|
-
/** issue */
|
|
1333
|
-
recipient?: string;
|
|
1334
|
-
/** issue — decimal string */
|
|
1335
|
-
quantity?: string;
|
|
1336
|
-
/** set_allowlist_root — 0x0 opens the drop to everyone */
|
|
1337
|
-
root?: string;
|
|
1338
|
-
}
|
|
1085
|
+
type CreateDropManageIntentParams = z.input<typeof dropManageSchema>;
|
|
1339
1086
|
type PopManageAction = "issue" | "set_allowlist_root";
|
|
1340
|
-
|
|
1341
|
-
owner: string;
|
|
1342
|
-
collection: string;
|
|
1343
|
-
action: PopManageAction;
|
|
1344
|
-
recipient?: string;
|
|
1345
|
-
tokenUri?: string;
|
|
1346
|
-
root?: string;
|
|
1347
|
-
}
|
|
1087
|
+
type CreatePopManageIntentParams = z.input<typeof popManageSchema>;
|
|
1348
1088
|
|
|
1349
1089
|
type MedialaneErrorCode = "TOKEN_NOT_FOUND" | "COLLECTION_NOT_FOUND" | "ORDER_NOT_FOUND" | "INTENT_NOT_FOUND" | "INTENT_EXPIRED" | "RATE_LIMITED" | "NETWORK_NOT_SUPPORTED" | "APPROVAL_FAILED" | "TRANSACTION_FAILED" | "INVALID_PARAMS" | "UNAUTHORIZED" | "UNKNOWN";
|
|
1350
1090
|
|
|
@@ -1697,10 +1437,7 @@ declare class ApiClient {
|
|
|
1697
1437
|
}): Promise<{
|
|
1698
1438
|
claim: ApiCollectionClaim;
|
|
1699
1439
|
}>;
|
|
1700
|
-
registerBusinessProvisioning(params: {
|
|
1701
|
-
chain?: "STARKNET";
|
|
1702
|
-
email: string;
|
|
1703
|
-
}): Promise<ApiResponse<ApiBusinessProvisioning> & {
|
|
1440
|
+
registerBusinessProvisioning(params: z.input<typeof provisioningRegisterSchema>): Promise<ApiResponse<ApiBusinessProvisioning> & {
|
|
1704
1441
|
reusedExistingWallet?: boolean;
|
|
1705
1442
|
}>;
|
|
1706
1443
|
getCollectionProfile(contractAddress: string): Promise<ApiCollectionProfile | null>;
|
package/dist/evm/index.cjs
CHANGED
package/dist/evm/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/typedData.ts","../../src/evm/abis.ts","../../src/evm/venue.ts","../../src/evm/issuance.ts"],"names":["hashTypedData","parseAbi","getCoordinates","maybeCoords","parseEventLogs"],"mappings":";;;;;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,SAAA,EAAW;AAAA,IACT,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,OAAA,EAAQ;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,EAAU;AAAA,IACtC,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,SAAA;AAAU,GACpC;AAAA,EACA,iBAAA,EAAmB;AAAA,IACjB,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,OAAA,EAAQ;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,EAAU;AAAA,IACtC,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,SAAA,EAAU;AAAA,IAClC,EAAE,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,SAAA;AAAU,GACvC;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,SAAA,EAAU;AAAA,IACnC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,WAAA,EAAY;AAAA,IACnC,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,mBAAA,EAAoB;AAAA,IACnD,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,SAAA,EAAU;AAAA,IACzC,EAAE,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,SAAA,EAAU;AAAA,IACrC,EAAE,IAAA,EAAM,SAAA,EAAW,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KAC1D,CAAA;AACD,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,0BAA0B,EAAE,IAAA,EAAM,QAAQ,CAAA;AAClF,IAAA,MAAM,CAAC,MAAM,CAAA,GAAIA,mBAAA,CAAe;AAAA,MAC9B,GAAA,EAAK,mBAAA;AAAA,MACL,SAAA,EAAW,aAAA;AAAA,MACX,MAAM,OAAA,CAAQ;AAAA,KACf,CAAA;AACD,IAAA,OAAO,EAAE,QAAQ,OAAA,EAAA,CAAU,MAAA,EAAQ,KAAK,OAAA,IAAW,EAAA,EAAI,UAAS,EAAE;AAAA,EACpE;AAAA,EAEA,MAAM,SAAA,CACJ,MAAA,EACA,MAAA,EAC0B;AAC1B,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC3D,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,aAAA,CAAc;AAAA,MACxC,OAAA;AAAA,MACA,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,UAAA;AAAA,MAChB,GAAA,EAAK,mBAAA;AAAA,MACL,YAAA,EAAc,WAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,UAAA,EAA+B,OAAO,SAAS;AAAA,KAC9D,CAAA;AACD,IAAA,OAAO,EAAE,MAAA,EAAO;AAAA,EAClB;AACF;AAEA,SAASD,aAAY,KAAA,EAA6C;AAChE,EAAA,IAAI;AACF,IAAA,OAAOD,iCAAe,KAAK,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.cjs","sourcesContent":["import { hashTypedData, type TypedDataDomain } from \"viem\";\n\nexport const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","import { parseAbi } from \"viem\";\n\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n\n variant: \"721\" | \"1155\";\n\n contract?: `0x${string}`;\n}\n\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n\n registry?: `0x${string}`;\n}\n\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/evm/typedData.ts","../../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AU,MAAM,IAAA,CAAK,YAAA,CAAa,0BAA0B,EAAE,IAAA,EAAM,QAAQ,CAAA;AAClF,IAAA,MAAM,CAAC,MAAM,CAAA,GAAIA,mBAAA,CAAe;AAAA,MAC9B,GAAA,EAAK,mBAAA;AAAA,MACL,SAAA,EAAW,aAAA;AAAA,MACX,MAAM,OAAA,CAAQ;AAAA,KACf,CAAA;AACD,IAAA,OAAO,EAAE,QAAQ,OAAA,EAAA,CAAU,MAAA,EAAQ,KAAK,OAAA,IAAW,EAAA,EAAI,UAAS,EAAE;AAAA,EACpE;AAAA,EAEA,MAAM,SAAA,CACJ,MAAA,EACA,MAAA,EAC0B;AAC1B,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC3D,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,aAAA,CAAc;AAAA,MACxC,OAAA;AAAA,MACA,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,UAAA;AAAA,MAChB,GAAA,EAAK,mBAAA;AAAA,MACL,YAAA,EAAc,WAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,UAAA,EAA+B,OAAO,SAAS;AAAA,KAC9D,CAAA;AACD,IAAA,OAAO,EAAE,MAAA,EAAO;AAAA,EAClB;AACF;AAEA,SAASD,aAAY,KAAA,EAA6C;AAChE,EAAA,IAAI;AACF,IAAA,OAAOD,iCAAe,KAAK,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.cjs","sourcesContent":["import { hashTypedData, type TypedDataDomain } from \"viem\";\n\nexport const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","import { parseAbi } from \"viem\";\n\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n\n variant: \"721\" | \"1155\";\n\n contract?: `0x${string}`;\n}\n\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n\n registry?: `0x${string}`;\n}\n\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|