@medialane/sdk 0.171.0 → 0.173.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,9 +1,9 @@
1
- import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './errors-DvSfHOZu.cjs';
2
- export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiBusinessProvisioning, i as ApiChain, j as ApiCheckoutIntentResult, k as ApiClient, l as ApiCoin, m as ApiCoinClaimResult, n as ApiCoinPrice, o as ApiCoinPrices, p as ApiCoinsQuery, q as ApiCollection, r as ApiCollectionClaim, s as ApiCollectionProfile, t as ApiCollectionSlugClaim, u as ApiCollectionsListQuery, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiCreditPayment, C as ApiDrop, D as ApiDropFee, E as ApiDropListStatus, F as ApiDropMint, G as ApiEmissionCall, H as ApiEmissionResult, I as ApiFundingInstructions, J as ApiFundingIntent, K as ApiFundingMethod, L as ApiFundingStatus, M as ApiFundingSubmit, N as ApiIntent, O as ApiIntentCreated, P as ApiIpNftTokenData, Q as ApiMeta, T as ApiMetadataSignedUrl, U as ApiMetadataUpload, V as ApiOrder, W as ApiOrderConsideration, X as ApiOrderOffer, Y as ApiOrderPrice, Z as ApiOrderTokenMeta, _ as ApiOrderTxHash, $ as ApiOrdersQuery, a0 as ApiPlatformStats, a1 as ApiPointEvent, a2 as ApiPortalKey, a3 as ApiPortalKeyCreated, a4 as ApiPortalMe, a5 as ApiPortalSpend, a6 as ApiPricing, a7 as ApiPricingRule, a8 as ApiPublicRemix, a9 as ApiRemixOffer, aa as ApiRemixOfferPrice, ab as ApiRemixOffersQuery, ac as ApiReportTargetType, ad as ApiResponse, ae as ApiRewardsBadge, af as ApiRewardsBatchEntry, ag as ApiRewardsConfig, ah as ApiRewardsLeaderboardEntry, ai as ApiRewardsLevel, aj as ApiSearchCollectionResult, ak as ApiSearchCreatorResult, al as ApiSearchResult, am as ApiSearchTokenResult, an as ApiSession, ao as ApiSpendByAction, ap as ApiSponsorshipBid, aq as ApiSponsorshipLicense, ar as ApiSponsorshipLicensesQuery, as as ApiSponsorshipOffer, at as ApiSponsorshipOffersQuery, au as ApiSponsorshipProposal, av as ApiSponsorshipProposalsQuery, aw as ApiSubmitReport, ax as ApiTierOnchain, ay as ApiToken, az as ApiTokenBalance, aA as ApiTokenMetadata, aB as ApiTokensQuery, aC as ApiTxSyncResult, aD as ApiUserRewards, aE as ApiUserWallet, aF as ApiUsernameClaim, aG as ApiWalletActivity, aH as AutoRemixOfferParams, aI as CancelOrderIntentParams, aJ as ChainFilter, aK as CheckoutIntentItem, aL as CollectionServiceId, aM as CollectionSort, aN as CollectionTokensSort, aO as ConfirmRemixOfferParams, aP as ConfirmSelfRemixParams, aQ as ConsiderationItem, aR as CreateCheckoutIntentParams, aS as CreateCoinIntentParams, aT as CreateCollectionIntentParams, aU as CreateCommentIntentParams, aV as CreateCounterOfferIntentParams, aW as CreateDropClaimIntentParams, aX as CreateDropManageIntentParams, aY as CreateDropParams, aZ as CreateFundingTransferIntentParams, a_ as CreateGenesisMintIntentParams, a$ as CreateListingIntentParams, b0 as CreateMembershipParams, b1 as CreateMintIntentParams, b2 as CreatePopBurnIntentParams, b3 as CreatePopClaimIntentParams, b4 as CreatePopCollectionParams, b5 as CreatePopManageIntentParams, b6 as CreateRemixOfferParams, b7 as CreateSponsorshipOfferIntentParams, b8 as CreateSponsorshipOfferParams, b9 as CreateSponsorshipProposalIntentParams, ba as CreateSwapIntentParams, bb as CreateTicketParams, bc as CreateTierIntentParams, bd as CreateTransferCollectionOwnershipIntentParams, be as CreateTransferNftIntentParams, bf as CreateTransferTokenIntentParams, bg as CreateWalletManageIntentParams, bh as DropManageAction, bi as DropTerms, bj as DropTermsBody, bk as EmissionParams, bl as EnforcementDeclaration, bm as FactoryFamilyServiceId, bn as FeeConfig, bo as FeeConfigSchema, bp as FulfillOrderIntentParams, bq as IPType, br as IntentCall, bs as IntentStatus, bt as IntentType, bu as IpAttribute, bv as IpNftMetadata, bw as LaunchCoinIntentParams, bx as MakeOfferIntentParams, by as MedialaneApiError, bz as MedialaneConfig, bA as MedialaneErrorCode, bB as MintMembershipsParams, bC as MintTicketsParams, bD as OPEN_LICENSES, bE as OfferItem, bF as OpenLicense, bG as Order, bH as OrderDetails, bI as OrderParameters, bJ as OrderStatus, bK as PasskeyCancelledError, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, bN as PlaceSponsorshipBidIntentParams, bO as PopManageAction, bP as ProposeSponsorshipParams, bQ as RejectSponsorshipProposalIntentParams, bR as RemixOfferStatus, bS as ResolvedConfig, bT as RetractSponsorshipBidIntentParams, bU as RetryOptions, bV as ServiceEventDeclaration, bW as SetSponsorshipOfferOpenIntentParams, bX as SortOrder, bY as TierServiceId, bZ as TxResult, b_ as UpdateCollectionProfileInput, b$ as UserFacingError, c0 as WalletManageAction, c1 as WithdrawSponsorshipProposalIntentParams, c2 as resolveConfig, c3 as resolveFeeConfig } from './errors-DvSfHOZu.cjs';
1
+ import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './errors-BFqApRV3.cjs';
2
+ export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiBusinessProvisioning, i as ApiChain, j as ApiCheckoutIntentResult, k as ApiClient, l as ApiCoin, m as ApiCoinClaimResult, n as ApiCoinPrice, o as ApiCoinPrices, p as ApiCoinsQuery, q as ApiCollection, r as ApiCollectionClaim, s as ApiCollectionProfile, t as ApiCollectionSlugClaim, u as ApiCollectionsListQuery, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiCreditPayment, C as ApiDrop, D as ApiDropFee, E as ApiDropListStatus, F as ApiDropMint, G as ApiEmissionCall, H as ApiEmissionResult, I as ApiFundingInstructions, J as ApiFundingIntent, K as ApiFundingMethod, L as ApiFundingStatus, M as ApiFundingSubmit, N as ApiIntent, O as ApiIntentCreated, P as ApiIpNftTokenData, Q as ApiMeta, T as ApiMetadataSignedUrl, U as ApiMetadataUpload, V as ApiOrder, W as ApiOrderConsideration, X as ApiOrderOffer, Y as ApiOrderPrice, Z as ApiOrderTokenMeta, _ as ApiOrderTxHash, $ as ApiOrdersQuery, a0 as ApiPlatformStats, a1 as ApiPointEvent, a2 as ApiPortalKey, a3 as ApiPortalKeyCreated, a4 as ApiPortalMe, a5 as ApiPortalSpend, a6 as ApiPricing, a7 as ApiPricingRule, a8 as ApiPublicRemix, a9 as ApiRemixOffer, aa as ApiRemixOfferPrice, ab as ApiRemixOffersQuery, ac as ApiReportTargetType, ad as ApiResponse, ae as ApiRewardsBadge, af as ApiRewardsBatchEntry, ag as ApiRewardsConfig, ah as ApiRewardsLeaderboardEntry, ai as ApiRewardsLevel, aj as ApiSearchCollectionResult, ak as ApiSearchCreatorResult, al as ApiSearchResult, am as ApiSearchTokenResult, an as ApiSession, ao as ApiSpendByAction, ap as ApiSponsorshipBid, aq as ApiSponsorshipLicense, ar as ApiSponsorshipLicensesQuery, as as ApiSponsorshipOffer, at as ApiSponsorshipOffersQuery, au as ApiSponsorshipProposal, av as ApiSponsorshipProposalsQuery, aw as ApiSubmitReport, ax as ApiSwapQuote, ay as ApiSwapQuoteRequest, az as ApiTierOnchain, aA as ApiToken, aB as ApiTokenBalance, aC as ApiTokenMetadata, aD as ApiTokensQuery, aE as ApiTxSyncResult, aF as ApiUserRewards, aG as ApiUserWallet, aH as ApiUsernameClaim, aI as ApiWalletActivity, aJ as AutoRemixOfferParams, aK as CancelOrderIntentParams, aL as ChainFilter, aM as CheckoutIntentItem, aN as CollectionServiceId, aO as CollectionSort, aP as CollectionTokensSort, aQ as ConfirmRemixOfferParams, aR as ConfirmSelfRemixParams, aS as ConsiderationItem, aT as CreateCheckoutIntentParams, aU as CreateCoinIntentParams, aV as CreateCollectionIntentParams, aW as CreateCommentIntentParams, aX as CreateCounterOfferIntentParams, aY as CreateDropClaimIntentParams, aZ as CreateDropManageIntentParams, a_ as CreateDropParams, a$ as CreateFundingTransferIntentParams, b0 as CreateGenesisMintIntentParams, b1 as CreateListingIntentParams, b2 as CreateMembershipParams, b3 as CreateMintIntentParams, b4 as CreatePopBurnIntentParams, b5 as CreatePopClaimIntentParams, b6 as CreatePopCollectionParams, b7 as CreatePopManageIntentParams, b8 as CreateRemixOfferParams, b9 as CreateSponsorshipOfferIntentParams, ba as CreateSponsorshipOfferParams, bb as CreateSponsorshipProposalIntentParams, bc as CreateSwapIntentParams, bd as CreateTicketParams, be as CreateTierIntentParams, bf as CreateTransferCollectionOwnershipIntentParams, bg as CreateTransferNftIntentParams, bh as CreateTransferTokenIntentParams, bi as CreateWalletManageIntentParams, bj as DropManageAction, bk as DropTerms, bl as DropTermsBody, bm as EmissionParams, bn as EnforcementDeclaration, bo as FactoryFamilyServiceId, bp as FeeConfig, bq as FeeConfigSchema, br as FulfillOrderIntentParams, bs as IPType, bt as IntentCall, bu as IntentStatus, bv as IntentType, bw as IpAttribute, bx as IpNftMetadata, by as LaunchCoinIntentParams, bz as MakeOfferIntentParams, bA as MedialaneApiError, bB as MedialaneConfig, bC as MedialaneErrorCode, bD as MintMembershipsParams, bE as MintTicketsParams, bF as OPEN_LICENSES, bG as OfferItem, bH as OpenLicense, bI as Order, bJ as OrderDetails, bK as OrderParameters, bL as OrderStatus, bM as PasskeyCancelledError, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, bP as PlaceSponsorshipBidIntentParams, bQ as PopManageAction, bR as ProposeSponsorshipParams, bS as RejectSponsorshipProposalIntentParams, bT as RemixOfferStatus, bU as ResolvedConfig, bV as RetractSponsorshipBidIntentParams, bW as RetryOptions, bX as ServiceEventDeclaration, bY as SetSponsorshipOfferOpenIntentParams, bZ as SortOrder, b_ as TierServiceId, b$ as TxResult, c0 as UpdateCollectionProfileInput, c1 as UserFacingError, c2 as WalletManageAction, c3 as WithdrawSponsorshipProposalIntentParams, c4 as resolveConfig, c5 as resolveFeeConfig } from './errors-BFqApRV3.cjs';
3
3
  import { C as Chain } from './types-BTNjkUst.cjs';
4
4
  export { A as AdapterTxResult, a as AssetRef, b as CHAINS, c as ChainCoordinates, d as CoordinatesByChain, e as CreateCollectionInput, D as DEFAULT_CHAIN, E as EvmCoordinates, I as IssuanceAdapter, M as MintInput, O as OrderRef, R as RegisterOrderParams, S as SolanaCoordinates, f as StarknetCoordinates, g as StellarCoordinates, V as VenueAdapter, h as getCoordinates, i as getStarknetCoordinates } from './types-BTNjkUst.cjs';
5
- import 'zod';
6
5
  import 'starknet';
6
+ import 'zod';
7
7
 
8
8
  interface FeeEnv {
9
9
  NEXT_PUBLIC_FEE_ENABLED?: string;
@@ -691,25 +691,28 @@ interface FailoverFetchOptions {
691
691
  }
692
692
  declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
693
693
 
694
- interface RpcProxyConfig {
694
+ declare const ACCOUNT_SESSION_COOKIE = "ml_account_session";
695
+ interface AppGatewayConfig {
696
+ appId: string;
695
697
  backendUrl: string;
696
698
  apiKey: string | undefined;
699
+ allow: Record<string, RegExp[]>;
700
+ cacheableGets?: RegExp[];
701
+ timeoutMs?: number;
697
702
  fetchImpl?: typeof fetch;
698
703
  }
699
- declare function createRpcProxyHandler(config: RpcProxyConfig): (req: Request) => Promise<Response>;
704
+ declare function createAppGateway(config: AppGatewayConfig): (req: Request, path: string[]) => Promise<Response>;
700
705
 
701
- interface BackendProxyConfig {
702
- path: string;
706
+ interface AppSessionConfig {
707
+ appId: string;
703
708
  backendUrl: string;
704
709
  apiKey: string | undefined;
705
710
  fetchImpl?: typeof fetch;
706
- forwardCookie?: {
707
- name: string;
708
- header: string;
709
- };
710
- forwardAuthorization?: boolean;
711
711
  }
712
- declare function createBackendProxyHandler(config: BackendProxyConfig): (req: Request) => Promise<Response>;
712
+ declare function createAppSessionHandler(config: AppSessionConfig): {
713
+ GET(req: Request): Promise<Response>;
714
+ DELETE(req: Request): Promise<Response>;
715
+ };
713
716
 
714
717
  declare const ALLOWED_IMAGE_CONTENT_TYPES: Set<string>;
715
718
  declare const MAX_IMAGE_REDIRECTS = 5;
@@ -761,6 +764,8 @@ declare function getBackendSignedUrl(config: BackendMetadataConfig, kind?: "imag
761
764
 
762
765
  declare function isSameOrigin(req: Request): boolean;
763
766
 
767
+ declare function isPublicAppRoute(method: string, path: string): boolean;
768
+
764
769
  declare const IDENTITY_TTL_SECONDS = 86400;
765
770
  declare const ACCOUNT_SESSION_TTL_SECONDS: number;
766
771
  interface SiwsIdentity {
@@ -828,4 +833,4 @@ declare const IPFS_SAFE_CONTENT_TYPE_PREFIXES: readonly ["image/jpeg", "image/pn
828
833
  declare function resolveSafeImageContentType(contentType: string): string;
829
834
  declare const MAX_IPFS_GATEWAY_RESPONSE_BYTES: number;
830
835
 
831
- export { ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendProxyConfig, type BackendUploadResult, type BuildAssetMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FailoverFetchOptions, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, type NextStep, POLICY_REFUSAL_CODES, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RpcProxyConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, type TokenSource, type WalletRequest, assetHref, buildAssetMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createBackendProxyHandler, createFailoverFetch, createImageProxyHandler, createLaunchpadRunsClient, createRpcProxyHandler, dropHref, encodeU256, formatAmount, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPolicyRefusal, isPrivateHost, isPrivateOrInsecureUrl, isSameOrigin, isServiceId, isTicketingRun, isTransientRpcError, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
836
+ export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FailoverFetchOptions, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, type NextStep, POLICY_REFUSAL_CODES, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, type TokenSource, type WalletRequest, assetHref, buildAssetMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createFailoverFetch, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPolicyRefusal, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isTransientRpcError, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './errors-5C3YHsDE.js';
2
- export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiBusinessProvisioning, i as ApiChain, j as ApiCheckoutIntentResult, k as ApiClient, l as ApiCoin, m as ApiCoinClaimResult, n as ApiCoinPrice, o as ApiCoinPrices, p as ApiCoinsQuery, q as ApiCollection, r as ApiCollectionClaim, s as ApiCollectionProfile, t as ApiCollectionSlugClaim, u as ApiCollectionsListQuery, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiCreditPayment, C as ApiDrop, D as ApiDropFee, E as ApiDropListStatus, F as ApiDropMint, G as ApiEmissionCall, H as ApiEmissionResult, I as ApiFundingInstructions, J as ApiFundingIntent, K as ApiFundingMethod, L as ApiFundingStatus, M as ApiFundingSubmit, N as ApiIntent, O as ApiIntentCreated, P as ApiIpNftTokenData, Q as ApiMeta, T as ApiMetadataSignedUrl, U as ApiMetadataUpload, V as ApiOrder, W as ApiOrderConsideration, X as ApiOrderOffer, Y as ApiOrderPrice, Z as ApiOrderTokenMeta, _ as ApiOrderTxHash, $ as ApiOrdersQuery, a0 as ApiPlatformStats, a1 as ApiPointEvent, a2 as ApiPortalKey, a3 as ApiPortalKeyCreated, a4 as ApiPortalMe, a5 as ApiPortalSpend, a6 as ApiPricing, a7 as ApiPricingRule, a8 as ApiPublicRemix, a9 as ApiRemixOffer, aa as ApiRemixOfferPrice, ab as ApiRemixOffersQuery, ac as ApiReportTargetType, ad as ApiResponse, ae as ApiRewardsBadge, af as ApiRewardsBatchEntry, ag as ApiRewardsConfig, ah as ApiRewardsLeaderboardEntry, ai as ApiRewardsLevel, aj as ApiSearchCollectionResult, ak as ApiSearchCreatorResult, al as ApiSearchResult, am as ApiSearchTokenResult, an as ApiSession, ao as ApiSpendByAction, ap as ApiSponsorshipBid, aq as ApiSponsorshipLicense, ar as ApiSponsorshipLicensesQuery, as as ApiSponsorshipOffer, at as ApiSponsorshipOffersQuery, au as ApiSponsorshipProposal, av as ApiSponsorshipProposalsQuery, aw as ApiSubmitReport, ax as ApiTierOnchain, ay as ApiToken, az as ApiTokenBalance, aA as ApiTokenMetadata, aB as ApiTokensQuery, aC as ApiTxSyncResult, aD as ApiUserRewards, aE as ApiUserWallet, aF as ApiUsernameClaim, aG as ApiWalletActivity, aH as AutoRemixOfferParams, aI as CancelOrderIntentParams, aJ as ChainFilter, aK as CheckoutIntentItem, aL as CollectionServiceId, aM as CollectionSort, aN as CollectionTokensSort, aO as ConfirmRemixOfferParams, aP as ConfirmSelfRemixParams, aQ as ConsiderationItem, aR as CreateCheckoutIntentParams, aS as CreateCoinIntentParams, aT as CreateCollectionIntentParams, aU as CreateCommentIntentParams, aV as CreateCounterOfferIntentParams, aW as CreateDropClaimIntentParams, aX as CreateDropManageIntentParams, aY as CreateDropParams, aZ as CreateFundingTransferIntentParams, a_ as CreateGenesisMintIntentParams, a$ as CreateListingIntentParams, b0 as CreateMembershipParams, b1 as CreateMintIntentParams, b2 as CreatePopBurnIntentParams, b3 as CreatePopClaimIntentParams, b4 as CreatePopCollectionParams, b5 as CreatePopManageIntentParams, b6 as CreateRemixOfferParams, b7 as CreateSponsorshipOfferIntentParams, b8 as CreateSponsorshipOfferParams, b9 as CreateSponsorshipProposalIntentParams, ba as CreateSwapIntentParams, bb as CreateTicketParams, bc as CreateTierIntentParams, bd as CreateTransferCollectionOwnershipIntentParams, be as CreateTransferNftIntentParams, bf as CreateTransferTokenIntentParams, bg as CreateWalletManageIntentParams, bh as DropManageAction, bi as DropTerms, bj as DropTermsBody, bk as EmissionParams, bl as EnforcementDeclaration, bm as FactoryFamilyServiceId, bn as FeeConfig, bo as FeeConfigSchema, bp as FulfillOrderIntentParams, bq as IPType, br as IntentCall, bs as IntentStatus, bt as IntentType, bu as IpAttribute, bv as IpNftMetadata, bw as LaunchCoinIntentParams, bx as MakeOfferIntentParams, by as MedialaneApiError, bz as MedialaneConfig, bA as MedialaneErrorCode, bB as MintMembershipsParams, bC as MintTicketsParams, bD as OPEN_LICENSES, bE as OfferItem, bF as OpenLicense, bG as Order, bH as OrderDetails, bI as OrderParameters, bJ as OrderStatus, bK as PasskeyCancelledError, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, bN as PlaceSponsorshipBidIntentParams, bO as PopManageAction, bP as ProposeSponsorshipParams, bQ as RejectSponsorshipProposalIntentParams, bR as RemixOfferStatus, bS as ResolvedConfig, bT as RetractSponsorshipBidIntentParams, bU as RetryOptions, bV as ServiceEventDeclaration, bW as SetSponsorshipOfferOpenIntentParams, bX as SortOrder, bY as TierServiceId, bZ as TxResult, b_ as UpdateCollectionProfileInput, b$ as UserFacingError, c0 as WalletManageAction, c1 as WithdrawSponsorshipProposalIntentParams, c2 as resolveConfig, c3 as resolveFeeConfig } from './errors-5C3YHsDE.js';
1
+ import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './errors-J0nFhE6E.js';
2
+ export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiBusinessProvisioning, i as ApiChain, j as ApiCheckoutIntentResult, k as ApiClient, l as ApiCoin, m as ApiCoinClaimResult, n as ApiCoinPrice, o as ApiCoinPrices, p as ApiCoinsQuery, q as ApiCollection, r as ApiCollectionClaim, s as ApiCollectionProfile, t as ApiCollectionSlugClaim, u as ApiCollectionsListQuery, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiCreditPayment, C as ApiDrop, D as ApiDropFee, E as ApiDropListStatus, F as ApiDropMint, G as ApiEmissionCall, H as ApiEmissionResult, I as ApiFundingInstructions, J as ApiFundingIntent, K as ApiFundingMethod, L as ApiFundingStatus, M as ApiFundingSubmit, N as ApiIntent, O as ApiIntentCreated, P as ApiIpNftTokenData, Q as ApiMeta, T as ApiMetadataSignedUrl, U as ApiMetadataUpload, V as ApiOrder, W as ApiOrderConsideration, X as ApiOrderOffer, Y as ApiOrderPrice, Z as ApiOrderTokenMeta, _ as ApiOrderTxHash, $ as ApiOrdersQuery, a0 as ApiPlatformStats, a1 as ApiPointEvent, a2 as ApiPortalKey, a3 as ApiPortalKeyCreated, a4 as ApiPortalMe, a5 as ApiPortalSpend, a6 as ApiPricing, a7 as ApiPricingRule, a8 as ApiPublicRemix, a9 as ApiRemixOffer, aa as ApiRemixOfferPrice, ab as ApiRemixOffersQuery, ac as ApiReportTargetType, ad as ApiResponse, ae as ApiRewardsBadge, af as ApiRewardsBatchEntry, ag as ApiRewardsConfig, ah as ApiRewardsLeaderboardEntry, ai as ApiRewardsLevel, aj as ApiSearchCollectionResult, ak as ApiSearchCreatorResult, al as ApiSearchResult, am as ApiSearchTokenResult, an as ApiSession, ao as ApiSpendByAction, ap as ApiSponsorshipBid, aq as ApiSponsorshipLicense, ar as ApiSponsorshipLicensesQuery, as as ApiSponsorshipOffer, at as ApiSponsorshipOffersQuery, au as ApiSponsorshipProposal, av as ApiSponsorshipProposalsQuery, aw as ApiSubmitReport, ax as ApiSwapQuote, ay as ApiSwapQuoteRequest, az as ApiTierOnchain, aA as ApiToken, aB as ApiTokenBalance, aC as ApiTokenMetadata, aD as ApiTokensQuery, aE as ApiTxSyncResult, aF as ApiUserRewards, aG as ApiUserWallet, aH as ApiUsernameClaim, aI as ApiWalletActivity, aJ as AutoRemixOfferParams, aK as CancelOrderIntentParams, aL as ChainFilter, aM as CheckoutIntentItem, aN as CollectionServiceId, aO as CollectionSort, aP as CollectionTokensSort, aQ as ConfirmRemixOfferParams, aR as ConfirmSelfRemixParams, aS as ConsiderationItem, aT as CreateCheckoutIntentParams, aU as CreateCoinIntentParams, aV as CreateCollectionIntentParams, aW as CreateCommentIntentParams, aX as CreateCounterOfferIntentParams, aY as CreateDropClaimIntentParams, aZ as CreateDropManageIntentParams, a_ as CreateDropParams, a$ as CreateFundingTransferIntentParams, b0 as CreateGenesisMintIntentParams, b1 as CreateListingIntentParams, b2 as CreateMembershipParams, b3 as CreateMintIntentParams, b4 as CreatePopBurnIntentParams, b5 as CreatePopClaimIntentParams, b6 as CreatePopCollectionParams, b7 as CreatePopManageIntentParams, b8 as CreateRemixOfferParams, b9 as CreateSponsorshipOfferIntentParams, ba as CreateSponsorshipOfferParams, bb as CreateSponsorshipProposalIntentParams, bc as CreateSwapIntentParams, bd as CreateTicketParams, be as CreateTierIntentParams, bf as CreateTransferCollectionOwnershipIntentParams, bg as CreateTransferNftIntentParams, bh as CreateTransferTokenIntentParams, bi as CreateWalletManageIntentParams, bj as DropManageAction, bk as DropTerms, bl as DropTermsBody, bm as EmissionParams, bn as EnforcementDeclaration, bo as FactoryFamilyServiceId, bp as FeeConfig, bq as FeeConfigSchema, br as FulfillOrderIntentParams, bs as IPType, bt as IntentCall, bu as IntentStatus, bv as IntentType, bw as IpAttribute, bx as IpNftMetadata, by as LaunchCoinIntentParams, bz as MakeOfferIntentParams, bA as MedialaneApiError, bB as MedialaneConfig, bC as MedialaneErrorCode, bD as MintMembershipsParams, bE as MintTicketsParams, bF as OPEN_LICENSES, bG as OfferItem, bH as OpenLicense, bI as Order, bJ as OrderDetails, bK as OrderParameters, bL as OrderStatus, bM as PasskeyCancelledError, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, bP as PlaceSponsorshipBidIntentParams, bQ as PopManageAction, bR as ProposeSponsorshipParams, bS as RejectSponsorshipProposalIntentParams, bT as RemixOfferStatus, bU as ResolvedConfig, bV as RetractSponsorshipBidIntentParams, bW as RetryOptions, bX as ServiceEventDeclaration, bY as SetSponsorshipOfferOpenIntentParams, bZ as SortOrder, b_ as TierServiceId, b$ as TxResult, c0 as UpdateCollectionProfileInput, c1 as UserFacingError, c2 as WalletManageAction, c3 as WithdrawSponsorshipProposalIntentParams, c4 as resolveConfig, c5 as resolveFeeConfig } from './errors-J0nFhE6E.js';
3
3
  import { C as Chain } from './types-BTNjkUst.js';
4
4
  export { A as AdapterTxResult, a as AssetRef, b as CHAINS, c as ChainCoordinates, d as CoordinatesByChain, e as CreateCollectionInput, D as DEFAULT_CHAIN, E as EvmCoordinates, I as IssuanceAdapter, M as MintInput, O as OrderRef, R as RegisterOrderParams, S as SolanaCoordinates, f as StarknetCoordinates, g as StellarCoordinates, V as VenueAdapter, h as getCoordinates, i as getStarknetCoordinates } from './types-BTNjkUst.js';
5
- import 'zod';
6
5
  import 'starknet';
6
+ import 'zod';
7
7
 
8
8
  interface FeeEnv {
9
9
  NEXT_PUBLIC_FEE_ENABLED?: string;
@@ -691,25 +691,28 @@ interface FailoverFetchOptions {
691
691
  }
692
692
  declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
693
693
 
694
- interface RpcProxyConfig {
694
+ declare const ACCOUNT_SESSION_COOKIE = "ml_account_session";
695
+ interface AppGatewayConfig {
696
+ appId: string;
695
697
  backendUrl: string;
696
698
  apiKey: string | undefined;
699
+ allow: Record<string, RegExp[]>;
700
+ cacheableGets?: RegExp[];
701
+ timeoutMs?: number;
697
702
  fetchImpl?: typeof fetch;
698
703
  }
699
- declare function createRpcProxyHandler(config: RpcProxyConfig): (req: Request) => Promise<Response>;
704
+ declare function createAppGateway(config: AppGatewayConfig): (req: Request, path: string[]) => Promise<Response>;
700
705
 
701
- interface BackendProxyConfig {
702
- path: string;
706
+ interface AppSessionConfig {
707
+ appId: string;
703
708
  backendUrl: string;
704
709
  apiKey: string | undefined;
705
710
  fetchImpl?: typeof fetch;
706
- forwardCookie?: {
707
- name: string;
708
- header: string;
709
- };
710
- forwardAuthorization?: boolean;
711
711
  }
712
- declare function createBackendProxyHandler(config: BackendProxyConfig): (req: Request) => Promise<Response>;
712
+ declare function createAppSessionHandler(config: AppSessionConfig): {
713
+ GET(req: Request): Promise<Response>;
714
+ DELETE(req: Request): Promise<Response>;
715
+ };
713
716
 
714
717
  declare const ALLOWED_IMAGE_CONTENT_TYPES: Set<string>;
715
718
  declare const MAX_IMAGE_REDIRECTS = 5;
@@ -761,6 +764,8 @@ declare function getBackendSignedUrl(config: BackendMetadataConfig, kind?: "imag
761
764
 
762
765
  declare function isSameOrigin(req: Request): boolean;
763
766
 
767
+ declare function isPublicAppRoute(method: string, path: string): boolean;
768
+
764
769
  declare const IDENTITY_TTL_SECONDS = 86400;
765
770
  declare const ACCOUNT_SESSION_TTL_SECONDS: number;
766
771
  interface SiwsIdentity {
@@ -828,4 +833,4 @@ declare const IPFS_SAFE_CONTENT_TYPE_PREFIXES: readonly ["image/jpeg", "image/pn
828
833
  declare function resolveSafeImageContentType(contentType: string): string;
829
834
  declare const MAX_IPFS_GATEWAY_RESPONSE_BYTES: number;
830
835
 
831
- export { ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendProxyConfig, type BackendUploadResult, type BuildAssetMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FailoverFetchOptions, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, type NextStep, POLICY_REFUSAL_CODES, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RpcProxyConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, type TokenSource, type WalletRequest, assetHref, buildAssetMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createBackendProxyHandler, createFailoverFetch, createImageProxyHandler, createLaunchpadRunsClient, createRpcProxyHandler, dropHref, encodeU256, formatAmount, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPolicyRefusal, isPrivateHost, isPrivateOrInsecureUrl, isSameOrigin, isServiceId, isTicketingRun, isTransientRpcError, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
836
+ export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, type AppGatewayConfig, type AppSessionConfig, type AssetAttribute, type AssetMetadata, type BackendMetadataConfig, type BackendUploadResult, type BuildAssetMetadataInput, type CanonicalHash, type CappedBody, type CertificateEmissionNextStep, type CertificateEmissionRun, Chain, type ConfirmResult, DEFAULT_CURRENCY, type DataTokenizationRun, type FailoverFetchOptions, type FeeEnv, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, type ImageProxyConfig, type LaunchpadRun, type LaunchpadRunsClient, type LaunchpadRunsClientOptions, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, type NextStep, POLICY_REFUSAL_CODES, RESERVED_TRAITS, type RemixPolicy, type RemixPolicyInput, ResolvedFeeConfig, type RunQuote, type RunQuoteLine, RunRequestError, type RunStatus, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, ServiceCapability, ServiceDefinition, type ServiceId, type SiwsIdentity, type SupportedToken, type SupportedTokenSymbol, type TicketingNextStep, type TicketingRun, type TokenSource, type WalletRequest, assetHref, buildAssetMetadata, chainFromSlug, chainSlug, coinHref, collectionHref, createAppGateway, createAppSessionHandler, createFailoverFetch, createImageProxyHandler, createLaunchpadRunsClient, dropHref, encodeU256, formatAmount, getBackendSignedUrl, getDerivativesTerm, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isCertificateEmissionRun, isDataTokenizationRun, isPolicyRefusal, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isServiceId, isTicketingRun, isTransientRpcError, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, listServices, normalizeAddress, normalizeHash, parseAmount, readBodyWithCap, resolveAppFeeConfig, resolveRemixPolicy, resolveSafeImageContentType, shortenAddress, stringifyBigInts, u256ToBigInt, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ApiClient, DEFAULT_CURRENCY, FeeConfigSchema, MedialaneApiError, POLICY_REFUSAL_CODES, PasskeyCancelledError, PasskeyUnsupportedError, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, UserFacingError, assetHref, chainFromSlug, chainSlug, coinHref, collectionHref, createFailoverFetch, dropHref, encodeU256, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isPolicyRefusal, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveAppFeeConfig, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt } from './chunk-DDZJFN65.js';
1
+ export { ApiClient, DEFAULT_CURRENCY, FeeConfigSchema, MedialaneApiError, POLICY_REFUSAL_CODES, PasskeyCancelledError, PasskeyUnsupportedError, STARKNET_COLLECTION_1155_CLASS_HASH, STARKNET_COLLECTION_1155_CONTRACT, STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH, STARKNET_COLLECTION_1155_START_BLOCK, STARKNET_COLLECTION_721_CONTRACT, STARKNET_COLLECTION_721_START_BLOCK, STARKNET_CREATOR_COIN_CLASS_HASH, STARKNET_CREATOR_COIN_EKUBO_LAUNCHER, STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH, STARKNET_CREATOR_COIN_FACTORY_CONTRACT, STARKNET_CREATOR_COIN_START_BLOCK, STARKNET_DATA_TOKENIZATION_721_CONTRACT, STARKNET_DROP_COLLECTION_CLASS_HASH, STARKNET_DROP_FACTORY_CONTRACT, STARKNET_DROP_FACTORY_START_BLOCK, STARKNET_EKUBO_CORE, STARKNET_GENESIS_MINT_CONTRACT, STARKNET_GENESIS_NFT_URI, STARKNET_IPCOLLECTION_CLASS_HASH, STARKNET_IPNFT_CLASS_HASH, STARKNET_IP_CLUB_COLLECTION_CLASS_HASH, STARKNET_IP_CLUB_FACTORY_CONTRACT, STARKNET_IP_SPONSORSHIP_CLASS_HASH, STARKNET_IP_SPONSORSHIP_CONTRACT, STARKNET_IP_TICKETS_FACTORY_CONTRACT, STARKNET_IP_TICKET_COLLECTION_CLASS_HASH, STARKNET_MARKETPLACE_1155_CLASS_HASH, STARKNET_MARKETPLACE_1155_CONTRACT, STARKNET_MARKETPLACE_1155_START_BLOCK, STARKNET_MARKETPLACE_721_CLASS_HASH, STARKNET_MARKETPLACE_721_CONTRACT, STARKNET_MARKETPLACE_721_START_BLOCK, STARKNET_NFTCOMMENTS_CONTRACT, STARKNET_POP_COLLECTION_CLASS_HASH, STARKNET_POP_FACTORY_CONTRACT, STARKNET_POP_FACTORY_START_BLOCK, SUPPORTED_TOKENS, SUPPORTED_URL_CHAINS, UserFacingError, assetHref, chainFromSlug, chainSlug, coinHref, collectionHref, createFailoverFetch, dropHref, encodeU256, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, hasCapability, isPolicyRefusal, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveAppFeeConfig, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt } from './chunk-HB2OWSZB.js';
2
2
  export { CHAINS, DEFAULT_CHAIN, getCoordinates, getStarknetCoordinates } from './chunk-WYKCGQPN.js';
3
3
  import { hmac } from '@noble/hashes/hmac.js';
4
4
  import { sha256 } from '@noble/hashes/sha2.js';
@@ -110,65 +110,144 @@ function isSameOrigin(req) {
110
110
  }
111
111
  }
112
112
 
113
- // src/server/backend-proxy.ts
114
- function proxyError(code, message, status) {
115
- return Response.json({ jsonrpc: "2.0", error: { code, message }, id: null }, { status });
116
- }
113
+ // src/server/app-gateway.ts
114
+ var ACCOUNT_SESSION_COOKIE = "ml_account_session";
115
+ var SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
116
+ var SIGN_IN_PATHS = /* @__PURE__ */ new Set(["auth/email/register-account", "auth/email/verify-code", "auth/siws/verify"]);
117
+ var EDGE_CACHE_CONTROL = "public, s-maxage=30, stale-while-revalidate=120";
118
+ var DROPPED_REQUEST_HEADERS = /* @__PURE__ */ new Set([
119
+ "connection",
120
+ "keep-alive",
121
+ "proxy-authenticate",
122
+ "proxy-authorization",
123
+ "te",
124
+ "trailers",
125
+ "transfer-encoding",
126
+ "upgrade",
127
+ "host",
128
+ "content-length",
129
+ "accept-encoding",
130
+ "cookie",
131
+ "x-api-key",
132
+ "x-app-id",
133
+ "x-account-session",
134
+ "authorization"
135
+ ]);
136
+ var DROPPED_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
137
+ "connection",
138
+ "keep-alive",
139
+ "transfer-encoding",
140
+ "content-length",
141
+ "content-encoding",
142
+ "set-cookie"
143
+ ]);
117
144
  function readCookie(req, name) {
118
145
  const raw = req.headers.get("cookie");
119
146
  if (!raw) return null;
120
147
  for (const part of raw.split(";")) {
121
148
  const eq = part.indexOf("=");
122
- if (eq === -1) continue;
123
- if (part.slice(0, eq).trim() === name) return part.slice(eq + 1).trim();
149
+ if (eq !== -1 && part.slice(0, eq).trim() === name) return part.slice(eq + 1).trim() || null;
124
150
  }
125
151
  return null;
126
152
  }
127
- function createBackendProxyHandler(config) {
153
+ function sessionCookie(value, maxAge = SESSION_MAX_AGE_SECONDS) {
154
+ const secure = process.env.NODE_ENV === "production" ? "; Secure" : "";
155
+ return `${ACCOUNT_SESSION_COOKIE}=${value}; Path=/; HttpOnly; SameSite=Lax; Max-Age=${maxAge}${secure}`;
156
+ }
157
+ function json(body, status) {
158
+ return Response.json(body, { status });
159
+ }
160
+ function createAppGateway(config) {
128
161
  const doFetch = config.fetchImpl ?? fetch;
129
- const endpoint2 = `${config.backendUrl.replace(/\/$/, "")}/${config.path.replace(/^\//, "")}`;
130
- return async function handleBackendProxy(req) {
131
- if (!isSameOrigin(req)) {
132
- return proxyError(-32600, "Cross-origin requests are not allowed", 403);
133
- }
134
- if (!config.apiKey) {
135
- return proxyError(-32003, "No API key configured \u2014 request not forwarded", 402);
136
- }
137
- let body;
138
- try {
139
- body = await req.json();
140
- } catch {
141
- return proxyError(-32700, "Parse error", 400);
142
- }
143
- const headers2 = { "Content-Type": "application/json", "x-api-key": config.apiKey };
144
- if (config.forwardCookie) {
145
- const value = readCookie(req, config.forwardCookie.name);
146
- if (value) headers2[config.forwardCookie.header] = value;
147
- }
148
- if (config.forwardAuthorization) {
149
- const authorization = req.headers.get("authorization");
150
- if (authorization) headers2.authorization = authorization;
162
+ const base = config.backendUrl.replace(/\/$/, "");
163
+ return async function appGateway(req, path) {
164
+ if (!isSameOrigin(req)) return json({ error: "Cross-origin requests are not allowed" }, 403);
165
+ if (!config.apiKey) return json({ error: "Service unavailable" }, 500);
166
+ if (path.some((s) => s === "." || s === ".." || s === "")) return json({ error: "Invalid path" }, 400);
167
+ const joined = path.join("/");
168
+ const method = req.method.toUpperCase();
169
+ if (!(config.allow[method] ?? []).some((re) => re.test(joined))) {
170
+ return json({ error: `Path not allowed: ${method} /v1/${joined}` }, 403);
151
171
  }
172
+ const headers2 = new Headers();
173
+ req.headers.forEach((v, k) => {
174
+ if (!DROPPED_REQUEST_HEADERS.has(k.toLowerCase())) headers2.set(k, v);
175
+ });
176
+ headers2.set("x-api-key", config.apiKey);
177
+ headers2.set("x-app-id", config.appId);
178
+ const session = readCookie(req, ACCOUNT_SESSION_COOKIE);
179
+ if (session) headers2.set("x-account-session", session);
180
+ const search = new URL(req.url).search;
181
+ const target = `${base}/v1/${path.map(encodeURIComponent).join("/")}${search}`;
182
+ const hasBody = method !== "GET" && method !== "HEAD";
183
+ let res;
152
184
  try {
153
- const upstream = await doFetch(endpoint2, {
154
- method: "POST",
185
+ res = await doFetch(target, {
186
+ method,
155
187
  headers: headers2,
156
- body: JSON.stringify(body)
188
+ body: hasBody ? await req.arrayBuffer() : void 0,
189
+ cache: "no-store",
190
+ redirect: "manual",
191
+ signal: AbortSignal.timeout(config.timeoutMs ?? 55e3)
157
192
  });
158
- const text = await upstream.text();
159
- return new Response(text, {
160
- status: upstream.status,
161
- headers: { "Content-Type": "application/json" }
162
- });
163
- } catch {
164
- return proxyError(-32603, "Backend unreachable", 502);
193
+ } catch (e) {
194
+ if (e instanceof DOMException && e.name === "TimeoutError") {
195
+ return json({ error: "The service took too long to respond" }, 504);
196
+ }
197
+ return json({ error: "Service unavailable" }, 502);
165
198
  }
199
+ const out = new Headers();
200
+ res.headers.forEach((v, k) => {
201
+ if (!DROPPED_RESPONSE_HEADERS.has(k.toLowerCase())) out.set(k, v);
202
+ });
203
+ if (method === "POST" && res.ok && SIGN_IN_PATHS.has(joined)) {
204
+ const text = await res.text();
205
+ let body = null;
206
+ try {
207
+ body = JSON.parse(text);
208
+ } catch {
209
+ body = null;
210
+ }
211
+ if (!body) return new Response(text, { status: res.status, headers: out });
212
+ const token = typeof body.accountToken === "string" ? body.accountToken : null;
213
+ delete body.accountToken;
214
+ delete body.token;
215
+ out.set("content-type", "application/json");
216
+ if (token) out.append("set-cookie", sessionCookie(token));
217
+ return new Response(JSON.stringify(body), { status: res.status, headers: out });
218
+ }
219
+ if (method === "GET" && res.ok && !session && (config.cacheableGets ?? []).some((re) => re.test(joined))) {
220
+ out.set("cache-control", EDGE_CACHE_CONTROL);
221
+ }
222
+ return new Response(res.body, { status: res.status, headers: out });
166
223
  };
167
224
  }
168
225
 
169
- // src/server/rpc-proxy.ts
170
- function createRpcProxyHandler(config) {
171
- return createBackendProxyHandler({ ...config, path: "/v1/rpc" });
226
+ // src/server/app-session.ts
227
+ function signedOut() {
228
+ const res = Response.json(null);
229
+ res.headers.append("set-cookie", sessionCookie("", 0));
230
+ return res;
231
+ }
232
+ function createAppSessionHandler(config) {
233
+ const doFetch = config.fetchImpl ?? fetch;
234
+ const base = config.backendUrl.replace(/\/$/, "");
235
+ return {
236
+ async GET(req) {
237
+ const session = readCookie(req, ACCOUNT_SESSION_COOKIE);
238
+ if (!session) return Response.json(null);
239
+ const res = await doFetch(`${base}/v1/users/me`, {
240
+ headers: { "x-api-key": config.apiKey ?? "", "x-app-id": config.appId, "x-account-session": session },
241
+ cache: "no-store"
242
+ });
243
+ if (res.status === 401 || res.status === 403) return signedOut();
244
+ if (!res.ok) return Response.json({ error: "Session check failed" }, { status: 502 });
245
+ return Response.json(await res.json());
246
+ },
247
+ async DELETE() {
248
+ return signedOut();
249
+ }
250
+ };
172
251
  }
173
252
 
174
253
  // src/server/ssrf-guard.ts
@@ -439,11 +518,11 @@ function endpoint(config, path) {
439
518
  function headers(config, extra) {
440
519
  return { "x-api-key": config.apiKey, ...extra };
441
520
  }
442
- async function uploadJsonToBackend(config, json) {
521
+ async function uploadJsonToBackend(config, json2) {
443
522
  const res = await (config.fetchImpl ?? fetch)(endpoint(config, "upload"), {
444
523
  method: "POST",
445
524
  headers: headers(config, { "Content-Type": "application/json" }),
446
- body: JSON.stringify(json)
525
+ body: JSON.stringify(json2)
447
526
  });
448
527
  const data = await res.json().catch(() => ({}));
449
528
  if (!res.ok || !data.data) throw new Error(data.error ?? "Metadata upload failed");
@@ -480,6 +559,73 @@ async function getBackendSignedUrl(config, kind = "image") {
480
559
  if (!res.ok || !data.data) throw new Error(data.error ?? "Failed to create upload URL");
481
560
  return data.data.url;
482
561
  }
562
+
563
+ // src/server/app-routes.ts
564
+ var SEG = "[^/]+";
565
+ var PUBLIC_ROUTES = {
566
+ GET: [
567
+ "orders",
568
+ `orders/${SEG}`,
569
+ `orders/token/${SEG}/${SEG}`,
570
+ `orders/user/${SEG}`,
571
+ `orders/received/${SEG}`,
572
+ "orders/counter-offers",
573
+ "tokens",
574
+ `tokens/owned/${SEG}`,
575
+ `tokens/${SEG}/${SEG}`,
576
+ `tokens/${SEG}/${SEG}/(history|comments|remixes)`,
577
+ "collections",
578
+ `collections/${SEG}`,
579
+ `collections/${SEG}/tokens`,
580
+ `collections/${SEG}/profile`,
581
+ "activities",
582
+ `activities/${SEG}`,
583
+ "search",
584
+ "metadata/resolve",
585
+ "creators",
586
+ `creators/${SEG}/profile`,
587
+ `creators/by-username/${SEG}`,
588
+ `creators/${SEG}/hidden`,
589
+ "coins",
590
+ "coins/prices",
591
+ "coins/claims",
592
+ `coins/${SEG}`,
593
+ `coins/${SEG}/guarantees`,
594
+ `pop/${SEG}/claim-info`,
595
+ "drops",
596
+ `drops/${SEG}`,
597
+ `drops/${SEG}/mints`,
598
+ "rewards",
599
+ "rewards/config",
600
+ "rewards/batch",
601
+ `rewards/${SEG}`,
602
+ `rewards/${SEG}/events`,
603
+ `club/${SEG}/${SEG}`,
604
+ `club/${SEG}/${SEG}/member/${SEG}`,
605
+ `tickets/${SEG}/${SEG}`,
606
+ `tickets/${SEG}/count`,
607
+ `ipnft/${SEG}/${SEG}`,
608
+ "stats",
609
+ "prices",
610
+ `remix-offers/${SEG}`,
611
+ "sponsorship/offers",
612
+ `sponsorship/offers/${SEG}`,
613
+ `sponsorship/offers/${SEG}/bids`,
614
+ "sponsorship/proposals",
615
+ `sponsorship/proposals/${SEG}`,
616
+ "sponsorship/licenses",
617
+ `sponsorship/licenses/${SEG}`,
618
+ "auth/email/exists"
619
+ ].map((p) => new RegExp(`^${p}$`)),
620
+ POST: [
621
+ "auth/email/(request-code|verify-code|register-account|confirm)",
622
+ "auth/siws/(nonce|verify)"
623
+ ].map((p) => new RegExp(`^${p}$`))
624
+ };
625
+ function isPublicAppRoute(method, path) {
626
+ if (path.split("/").some((s) => s === "." || s === ".." || s === "")) return false;
627
+ return (PUBLIC_ROUTES[method.toUpperCase()] ?? []).some((re) => re.test(path));
628
+ }
483
629
  var IDENTITY_PREFIX = "siws_";
484
630
  var ACCOUNT_SESSION_PREFIX = "account_session_";
485
631
  var IDENTITY_DOMAIN = "siws-identity-v1";
@@ -648,6 +794,6 @@ function resolveSafeImageContentType(contentType) {
648
794
  }
649
795
  var MAX_IPFS_GATEWAY_RESPONSE_BYTES = 25 * 1024 * 1024;
650
796
 
651
- export { ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, OPEN_LICENSES, RESERVED_TRAITS, RunRequestError, buildAssetMetadata, createBackendProxyHandler, createImageProxyHandler, createLaunchpadRunsClient, createRpcProxyHandler, getBackendSignedUrl, getDerivativesTerm, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isSameOrigin, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, readBodyWithCap, resolveRemixPolicy, resolveSafeImageContentType, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
797
+ export { ACCOUNT_SESSION_COOKIE, ACCOUNT_SESSION_TTL_SECONDS, ALLOWED_IMAGE_CONTENT_TYPES, IDENTITY_TTL_SECONDS, IPFS_SAFE_CONTENT_TYPE_PREFIXES, MAX_IMAGE_PROXY_BYTES, MAX_IMAGE_REDIRECTS, MAX_IPFS_GATEWAY_RESPONSE_BYTES, OPEN_LICENSES, RESERVED_TRAITS, RunRequestError, buildAssetMetadata, createAppGateway, createAppSessionHandler, createImageProxyHandler, createLaunchpadRunsClient, getBackendSignedUrl, getDerivativesTerm, isCertificateEmissionRun, isDataTokenizationRun, isPrivateHost, isPrivateOrInsecureUrl, isPublicAppRoute, isSameOrigin, isTicketingRun, isValidIpfsCidPath, issueAccountSessionToken, issueSiwsToken, readBodyWithCap, resolveRemixPolicy, resolveSafeImageContentType, uploadDirectoryToBackend, uploadFileToBackend, uploadJsonToBackend, validateUrl, verifyAccountSessionToken, verifySiwsToken };
652
798
  //# sourceMappingURL=index.js.map
653
799
  //# sourceMappingURL=index.js.map