@medialane/sdk 0.13.0 → 0.14.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AccountInterface, constants, TypedData } from 'starknet';
2
+ import { Call, AccountInterface, constants, TypedData } from 'starknet';
3
3
 
4
4
  /** Medialane Protocol ERC-721 marketplace — immutable, no admin key. */
5
5
  declare const MARKETPLACE_721_CONTRACT_MAINNET = "0x00f8ccaae0bc811c79605974cc1dab769b9cea8877f033f8e3c17f30457caba6";
@@ -75,6 +75,48 @@ interface RetryOptions {
75
75
  maxDelayMs?: number;
76
76
  }
77
77
 
78
+ declare const FeeConfigSchema: z.ZodObject<{
79
+ enabled: z.ZodDefault<z.ZodBoolean>;
80
+ fundAddress: z.ZodOptional<z.ZodString>;
81
+ marketplaceBps: z.ZodDefault<z.ZodNumber>;
82
+ launchpadBps: z.ZodDefault<z.ZodNumber>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ enabled: boolean;
85
+ marketplaceBps: number;
86
+ launchpadBps: number;
87
+ fundAddress?: string | undefined;
88
+ }, {
89
+ enabled?: boolean | undefined;
90
+ fundAddress?: string | undefined;
91
+ marketplaceBps?: number | undefined;
92
+ launchpadBps?: number | undefined;
93
+ }>;
94
+ type FeeConfig = z.input<typeof FeeConfigSchema>;
95
+ interface ResolvedFeeConfig {
96
+ enabled: boolean;
97
+ fundAddress: string | undefined;
98
+ marketplaceBps: number;
99
+ launchpadBps: number;
100
+ }
101
+ declare function resolveFeeConfig(raw: FeeConfig | undefined): ResolvedFeeConfig;
102
+
103
+ type FeeSurface = "marketplace" | "launchpad";
104
+ interface BuildFeeCallParams {
105
+ surface: FeeSurface;
106
+ /** ERC-20 address the gross amount is denominated in. */
107
+ token: string;
108
+ /** Gross amount in raw token units (e.g. price in wei, or price * quantity). */
109
+ grossAmount: bigint;
110
+ }
111
+ /**
112
+ * The single source of truth for the platform fee. Returns one ERC-20
113
+ * `transfer(fundAddress, feeAmount)` Call to bundle into the settlement
114
+ * multicall, or `null` when no fee should be charged.
115
+ *
116
+ * Fail-safe: returns null if disabled, no fund address, or the fee floors to 0.
117
+ */
118
+ declare function buildFeeCall(p: BuildFeeCallParams, cfg: ResolvedFeeConfig): Call | null;
119
+
78
120
  declare const MedialaneConfigSchema: z.ZodObject<{
79
121
  network: z.ZodDefault<z.ZodEnum<["mainnet"]>>;
80
122
  rpcUrl: z.ZodOptional<z.ZodString>;
@@ -99,6 +141,22 @@ declare const MedialaneConfigSchema: z.ZodObject<{
99
141
  baseDelayMs?: number | undefined;
100
142
  maxDelayMs?: number | undefined;
101
143
  }>>;
144
+ feeConfig: z.ZodOptional<z.ZodObject<{
145
+ enabled: z.ZodDefault<z.ZodBoolean>;
146
+ fundAddress: z.ZodOptional<z.ZodString>;
147
+ marketplaceBps: z.ZodDefault<z.ZodNumber>;
148
+ launchpadBps: z.ZodDefault<z.ZodNumber>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ enabled: boolean;
151
+ marketplaceBps: number;
152
+ launchpadBps: number;
153
+ fundAddress?: string | undefined;
154
+ }, {
155
+ enabled?: boolean | undefined;
156
+ fundAddress?: string | undefined;
157
+ marketplaceBps?: number | undefined;
158
+ launchpadBps?: number | undefined;
159
+ }>>;
102
160
  }, "strip", z.ZodTypeAny, {
103
161
  network: "mainnet";
104
162
  rpcUrl?: string | undefined;
@@ -115,6 +173,12 @@ declare const MedialaneConfigSchema: z.ZodObject<{
115
173
  baseDelayMs?: number | undefined;
116
174
  maxDelayMs?: number | undefined;
117
175
  } | undefined;
176
+ feeConfig?: {
177
+ enabled: boolean;
178
+ marketplaceBps: number;
179
+ launchpadBps: number;
180
+ fundAddress?: string | undefined;
181
+ } | undefined;
118
182
  }, {
119
183
  network?: "mainnet" | undefined;
120
184
  rpcUrl?: string | undefined;
@@ -131,6 +195,12 @@ declare const MedialaneConfigSchema: z.ZodObject<{
131
195
  baseDelayMs?: number | undefined;
132
196
  maxDelayMs?: number | undefined;
133
197
  } | undefined;
198
+ feeConfig?: {
199
+ enabled?: boolean | undefined;
200
+ fundAddress?: string | undefined;
201
+ marketplaceBps?: number | undefined;
202
+ launchpadBps?: number | undefined;
203
+ } | undefined;
134
204
  }>;
135
205
  type MedialaneConfig = z.input<typeof MedialaneConfigSchema>;
136
206
  interface ResolvedConfig {
@@ -145,6 +215,7 @@ interface ResolvedConfig {
145
215
  collectionContract: string;
146
216
  collection1155Contract: string;
147
217
  retryOptions?: RetryOptions;
218
+ feeConfig: ResolvedFeeConfig;
148
219
  }
149
220
  declare function resolveConfig(raw: MedialaneConfig): ResolvedConfig;
150
221
 
@@ -1238,7 +1309,8 @@ declare class PopService {
1238
1309
 
1239
1310
  declare class DropService {
1240
1311
  private readonly factoryAddress;
1241
- constructor(_config: ResolvedConfig);
1312
+ private readonly config;
1313
+ constructor(config: ResolvedConfig);
1242
1314
  private _collection;
1243
1315
  claim(account: AccountInterface, collectionAddress: string, quantity?: bigint | string | number): Promise<TxResult>;
1244
1316
  adminMint(account: AccountInterface, params: {
@@ -4238,4 +4310,4 @@ declare function build1155FulfillmentTypedData(message: Record<string, unknown>,
4238
4310
  */
4239
4311
  declare function build1155CancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
4240
4312
 
4241
- export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionSlugClaim, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenBalance, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, type CancelOrder1155Params, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type ClaimConditions, CollectionRegistryABI, type CollectionSort, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateDropParams, type CreateListing1155Params, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreatePopCollectionParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, type DropMintStatus, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, type EnforcementDeclaration, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, type MakeOffer1155Params, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintItemParams, type MintParams, NFTCOMMENTS_CONTRACT_MAINNET, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderDetails, type OrderParameters, type OrderStatus, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
4313
+ export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionSlugClaim, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenBalance, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, type CancelOrder1155Params, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type ClaimConditions, CollectionRegistryABI, type CollectionSort, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateDropParams, type CreateListing1155Params, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreatePopCollectionParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, type DropMintStatus, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, type EnforcementDeclaration, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, type MakeOffer1155Params, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintItemParams, type MintParams, NFTCOMMENTS_CONTRACT_MAINNET, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderDetails, type OrderParameters, type OrderStatus, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type ResolvedFeeConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AccountInterface, constants, TypedData } from 'starknet';
2
+ import { Call, AccountInterface, constants, TypedData } from 'starknet';
3
3
 
4
4
  /** Medialane Protocol ERC-721 marketplace — immutable, no admin key. */
5
5
  declare const MARKETPLACE_721_CONTRACT_MAINNET = "0x00f8ccaae0bc811c79605974cc1dab769b9cea8877f033f8e3c17f30457caba6";
@@ -75,6 +75,48 @@ interface RetryOptions {
75
75
  maxDelayMs?: number;
76
76
  }
77
77
 
78
+ declare const FeeConfigSchema: z.ZodObject<{
79
+ enabled: z.ZodDefault<z.ZodBoolean>;
80
+ fundAddress: z.ZodOptional<z.ZodString>;
81
+ marketplaceBps: z.ZodDefault<z.ZodNumber>;
82
+ launchpadBps: z.ZodDefault<z.ZodNumber>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ enabled: boolean;
85
+ marketplaceBps: number;
86
+ launchpadBps: number;
87
+ fundAddress?: string | undefined;
88
+ }, {
89
+ enabled?: boolean | undefined;
90
+ fundAddress?: string | undefined;
91
+ marketplaceBps?: number | undefined;
92
+ launchpadBps?: number | undefined;
93
+ }>;
94
+ type FeeConfig = z.input<typeof FeeConfigSchema>;
95
+ interface ResolvedFeeConfig {
96
+ enabled: boolean;
97
+ fundAddress: string | undefined;
98
+ marketplaceBps: number;
99
+ launchpadBps: number;
100
+ }
101
+ declare function resolveFeeConfig(raw: FeeConfig | undefined): ResolvedFeeConfig;
102
+
103
+ type FeeSurface = "marketplace" | "launchpad";
104
+ interface BuildFeeCallParams {
105
+ surface: FeeSurface;
106
+ /** ERC-20 address the gross amount is denominated in. */
107
+ token: string;
108
+ /** Gross amount in raw token units (e.g. price in wei, or price * quantity). */
109
+ grossAmount: bigint;
110
+ }
111
+ /**
112
+ * The single source of truth for the platform fee. Returns one ERC-20
113
+ * `transfer(fundAddress, feeAmount)` Call to bundle into the settlement
114
+ * multicall, or `null` when no fee should be charged.
115
+ *
116
+ * Fail-safe: returns null if disabled, no fund address, or the fee floors to 0.
117
+ */
118
+ declare function buildFeeCall(p: BuildFeeCallParams, cfg: ResolvedFeeConfig): Call | null;
119
+
78
120
  declare const MedialaneConfigSchema: z.ZodObject<{
79
121
  network: z.ZodDefault<z.ZodEnum<["mainnet"]>>;
80
122
  rpcUrl: z.ZodOptional<z.ZodString>;
@@ -99,6 +141,22 @@ declare const MedialaneConfigSchema: z.ZodObject<{
99
141
  baseDelayMs?: number | undefined;
100
142
  maxDelayMs?: number | undefined;
101
143
  }>>;
144
+ feeConfig: z.ZodOptional<z.ZodObject<{
145
+ enabled: z.ZodDefault<z.ZodBoolean>;
146
+ fundAddress: z.ZodOptional<z.ZodString>;
147
+ marketplaceBps: z.ZodDefault<z.ZodNumber>;
148
+ launchpadBps: z.ZodDefault<z.ZodNumber>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ enabled: boolean;
151
+ marketplaceBps: number;
152
+ launchpadBps: number;
153
+ fundAddress?: string | undefined;
154
+ }, {
155
+ enabled?: boolean | undefined;
156
+ fundAddress?: string | undefined;
157
+ marketplaceBps?: number | undefined;
158
+ launchpadBps?: number | undefined;
159
+ }>>;
102
160
  }, "strip", z.ZodTypeAny, {
103
161
  network: "mainnet";
104
162
  rpcUrl?: string | undefined;
@@ -115,6 +173,12 @@ declare const MedialaneConfigSchema: z.ZodObject<{
115
173
  baseDelayMs?: number | undefined;
116
174
  maxDelayMs?: number | undefined;
117
175
  } | undefined;
176
+ feeConfig?: {
177
+ enabled: boolean;
178
+ marketplaceBps: number;
179
+ launchpadBps: number;
180
+ fundAddress?: string | undefined;
181
+ } | undefined;
118
182
  }, {
119
183
  network?: "mainnet" | undefined;
120
184
  rpcUrl?: string | undefined;
@@ -131,6 +195,12 @@ declare const MedialaneConfigSchema: z.ZodObject<{
131
195
  baseDelayMs?: number | undefined;
132
196
  maxDelayMs?: number | undefined;
133
197
  } | undefined;
198
+ feeConfig?: {
199
+ enabled?: boolean | undefined;
200
+ fundAddress?: string | undefined;
201
+ marketplaceBps?: number | undefined;
202
+ launchpadBps?: number | undefined;
203
+ } | undefined;
134
204
  }>;
135
205
  type MedialaneConfig = z.input<typeof MedialaneConfigSchema>;
136
206
  interface ResolvedConfig {
@@ -145,6 +215,7 @@ interface ResolvedConfig {
145
215
  collectionContract: string;
146
216
  collection1155Contract: string;
147
217
  retryOptions?: RetryOptions;
218
+ feeConfig: ResolvedFeeConfig;
148
219
  }
149
220
  declare function resolveConfig(raw: MedialaneConfig): ResolvedConfig;
150
221
 
@@ -1238,7 +1309,8 @@ declare class PopService {
1238
1309
 
1239
1310
  declare class DropService {
1240
1311
  private readonly factoryAddress;
1241
- constructor(_config: ResolvedConfig);
1312
+ private readonly config;
1313
+ constructor(config: ResolvedConfig);
1242
1314
  private _collection;
1243
1315
  claim(account: AccountInterface, collectionAddress: string, quantity?: bigint | string | number): Promise<TxResult>;
1244
1316
  adminMint(account: AccountInterface, params: {
@@ -4238,4 +4310,4 @@ declare function build1155FulfillmentTypedData(message: Record<string, unknown>,
4238
4310
  */
4239
4311
  declare function build1155CancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId): TypedData;
4240
4312
 
4241
- export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionSlugClaim, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenBalance, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, type CancelOrder1155Params, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type ClaimConditions, CollectionRegistryABI, type CollectionSort, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateDropParams, type CreateListing1155Params, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreatePopCollectionParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, type DropMintStatus, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, type EnforcementDeclaration, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, type MakeOffer1155Params, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintItemParams, type MintParams, NFTCOMMENTS_CONTRACT_MAINNET, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderDetails, type OrderParameters, type OrderStatus, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
4313
+ export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, ApiClient, type ApiCollection, type ApiCollectionClaim, type ApiCollectionProfile, type ApiCollectionSlugClaim, type ApiCollectionsQuery, type ApiComment, type ApiCounterOffersQuery, type ApiCreatorListResult, type ApiCreatorProfile, type ApiIntent, type ApiIntentCreated, type ApiKeyStatus, type ApiMeta, type ApiMetadataSignedUrl, type ApiMetadataUpload, type ApiOrder, type ApiOrderConsideration, type ApiOrderOffer, type ApiOrderPrice, type ApiOrderTokenMeta, type ApiOrderTxHash, type ApiOrdersQuery, type ApiPortalKey, type ApiPortalKeyCreated, type ApiPortalMe, type ApiPublicRemix, type ApiRemixOffer, type ApiRemixOfferPrice, type ApiRemixOffersQuery, type ApiResponse, type ApiSearchCollectionResult, type ApiSearchCreatorResult, type ApiSearchResult, type ApiSearchTokenResult, type ApiToken, type ApiTokenBalance, type ApiTokenMetadata, type ApiUsageDay, type ApiUserWallet, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, type CancelOrder1155Params, type CancelOrderIntentParams, type CancelOrderParams, type Cancelation, type CartItem, type ClaimConditions, CollectionRegistryABI, type CollectionSort, type ConfirmRemixOfferParams, type ConfirmSelfRemixParams, type ConsiderationItem, type CreateCollectionIntentParams, type CreateCollectionParams, type CreateCounterOfferIntentParams, type CreateDropParams, type CreateListing1155Params, type CreateListingIntentParams, type CreateListingParams, type CreateMintIntentParams, type CreatePopCollectionParams, type CreateRemixOfferParams, type CreateWebhookParams, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, type DropMintStatus, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, type EnforcementDeclaration, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, type Fulfillment, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, type IPType, type IntentStatus, type IntentType, type IpAttribute, type IpNftMetadata, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, type MakeOffer1155Params, type MakeOfferIntentParams, type MakeOfferParams, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, type MedialaneConfig, MedialaneError, type MedialaneErrorCode, type MintItemParams, type MintParams, NFTCOMMENTS_CONTRACT_MAINNET, type Network, OPEN_LICENSES, type OfferItem, type OpenLicense, type Order, type OrderDetails, type OrderParameters, type OrderStatus, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type ResolvedFeeConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TypedDataRevision, num, Contract, shortString, cairo, constants, RpcProvider } from 'starknet';
2
+ import { cairo, TypedDataRevision, num, Contract, shortString, constants, RpcProvider } from 'starknet';
3
3
 
4
4
  // src/config.ts
5
5
 
@@ -61,6 +61,34 @@ var COLLECTION_1155_CONTRACT_MAINNET = "0x006b2dc7ca7c4f466bb4575ba043d934310f05
61
61
  var ERC1155_FACTORY_CONTRACT_MAINNET = COLLECTION_1155_CONTRACT_MAINNET;
62
62
  var COLLECTION_1155_CLASS_HASH_MAINNET = "0x39a85126c6627db263617e5bce2bb72e49d2bb1f20961efc8b8954665bcfd25";
63
63
  var ERC1155_COLLECTION_CLASS_HASH_MAINNET = COLLECTION_1155_CLASS_HASH_MAINNET;
64
+ var FeeConfigSchema = z.object({
65
+ enabled: z.boolean().default(true),
66
+ fundAddress: z.string().min(1).optional(),
67
+ marketplaceBps: z.number().int().min(0).max(1e4).default(100),
68
+ launchpadBps: z.number().int().min(0).max(1e4).default(100)
69
+ });
70
+ function resolveFeeConfig(raw) {
71
+ const p = FeeConfigSchema.parse(raw ?? {});
72
+ return {
73
+ enabled: p.enabled,
74
+ fundAddress: p.fundAddress,
75
+ marketplaceBps: p.marketplaceBps,
76
+ launchpadBps: p.launchpadBps
77
+ };
78
+ }
79
+ function buildFeeCall(p, cfg) {
80
+ if (!cfg.enabled || !cfg.fundAddress) return null;
81
+ const bps = p.surface === "marketplace" ? cfg.marketplaceBps : cfg.launchpadBps;
82
+ if (bps <= 0) return null;
83
+ const fee = p.grossAmount * BigInt(bps) / 10000n;
84
+ if (fee <= 0n) return null;
85
+ const u = cairo.uint256(fee.toString());
86
+ return {
87
+ contractAddress: p.token,
88
+ entrypoint: "transfer",
89
+ calldata: [cfg.fundAddress, u.low.toString(), u.high.toString()]
90
+ };
91
+ }
64
92
 
65
93
  // src/config.ts
66
94
  var MedialaneConfigSchema = z.object({
@@ -78,7 +106,8 @@ var MedialaneConfigSchema = z.object({
78
106
  maxAttempts: z.number().int().min(1).max(10).optional(),
79
107
  baseDelayMs: z.number().int().min(0).optional(),
80
108
  maxDelayMs: z.number().int().min(0).optional()
81
- }).optional()
109
+ }).optional(),
110
+ feeConfig: FeeConfigSchema.optional()
82
111
  });
83
112
  function resolveConfig(raw) {
84
113
  const parsed = MedialaneConfigSchema.parse(raw);
@@ -95,7 +124,8 @@ function resolveConfig(raw) {
95
124
  collection721Contract,
96
125
  collectionContract: collection721Contract,
97
126
  collection1155Contract: parsed.collection1155Contract ?? COLLECTION_1155_CONTRACT_MAINNET,
98
- retryOptions: parsed.retryOptions
127
+ retryOptions: parsed.retryOptions,
128
+ feeConfig: resolveFeeConfig(parsed.feeConfig)
99
129
  };
100
130
  }
101
131
  function buildOrderTypedData(message, chainId) {
@@ -3540,8 +3570,13 @@ async function fulfillOrder(account, params, config) {
3540
3570
  ]
3541
3571
  };
3542
3572
  const fulfillCall = contract.populate("fulfill_order", [fulfillPayload]);
3573
+ const feeCall = buildFeeCall(
3574
+ { surface: "marketplace", token: paymentToken, grossAmount: BigInt(totalPrice) },
3575
+ config.feeConfig
3576
+ );
3577
+ const calls = feeCall ? [approveCall, fulfillCall, feeCall] : [approveCall, fulfillCall];
3543
3578
  try {
3544
- const tx = await account.execute([approveCall, fulfillCall]);
3579
+ const tx = await account.execute(calls);
3545
3580
  await provider.waitForTransaction(tx.transaction_hash);
3546
3581
  return { txHash: tx.transaction_hash };
3547
3582
  } catch (err) {
@@ -3650,8 +3685,14 @@ async function checkoutCart(account, items, config) {
3650
3685
  });
3651
3686
  fulfillCalls.push(contract.populate("fulfill_order", [fulfillPayload]));
3652
3687
  }
3688
+ const feeCalls = Array.from(tokenTotals.entries()).map(
3689
+ ([tokenAddr, totalWei]) => buildFeeCall(
3690
+ { surface: "marketplace", token: tokenAddr, grossAmount: totalWei },
3691
+ config.feeConfig
3692
+ )
3693
+ ).filter((c) => c !== null);
3653
3694
  try {
3654
- const tx = await account.execute([...approveCalls, ...fulfillCalls]);
3695
+ const tx = await account.execute([...approveCalls, ...fulfillCalls, ...feeCalls]);
3655
3696
  await provider.waitForTransaction(tx.transaction_hash);
3656
3697
  return { txHash: tx.transaction_hash };
3657
3698
  } catch (err) {
@@ -4834,15 +4875,26 @@ function toContractConditions(c) {
4834
4875
  };
4835
4876
  }
4836
4877
  var DropService = class {
4837
- constructor(_config) {
4878
+ constructor(config) {
4838
4879
  this.factoryAddress = DROP_FACTORY_CONTRACT_MAINNET;
4880
+ this.config = config;
4839
4881
  }
4840
4882
  _collection(address, account) {
4841
4883
  return new Contract(DropCollectionABI, normalizeAddress(address), account);
4842
4884
  }
4843
4885
  async claim(account, collectionAddress, quantity = 1) {
4844
- const call = this._collection(collectionAddress, account).populate("claim", [BigInt(quantity)]);
4845
- const res = await account.execute([call]);
4886
+ const collection = this._collection(collectionAddress, account);
4887
+ const qty = BigInt(quantity);
4888
+ const claimCall = collection.populate("claim", [qty]);
4889
+ const conditions = await collection.get_claim_conditions();
4890
+ const price = BigInt(conditions.price);
4891
+ const paymentToken = typeof conditions.payment_token === "bigint" ? "0x" + conditions.payment_token.toString(16) : conditions.payment_token;
4892
+ const feeCall = price > 0n ? buildFeeCall(
4893
+ { surface: "launchpad", token: paymentToken, grossAmount: price * qty },
4894
+ this.config.feeConfig
4895
+ ) : null;
4896
+ const calls = feeCall ? [claimCall, feeCall] : [claimCall];
4897
+ const res = await account.execute(calls);
4846
4898
  return { txHash: res.transaction_hash };
4847
4899
  }
4848
4900
  async adminMint(account, params) {
@@ -5159,6 +5211,6 @@ function getServicesByCapability(cap) {
5159
5211
  return Object.values(SERVICES).filter((s) => s.capabilities.includes(cap));
5160
5212
  }
5161
5213
 
5162
- export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
5214
+ export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_CONTRACT_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, ERC1155_COLLECTION_CLASS_HASH_MAINNET, ERC1155_FACTORY_CONTRACT_MAINNET, FeeConfigSchema, INDEXER_START_BLOCK_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MARKETPLACE_CLASS_HASH_MAINNET, MARKETPLACE_CONTRACT_MAINNET, MARKETPLACE_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
5163
5215
  //# sourceMappingURL=index.js.map
5164
5216
  //# sourceMappingURL=index.js.map