@medialane/sdk 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +62 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +60 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -807,12 +807,35 @@ interface ApiIntent {
|
|
|
807
807
|
createdAt: string;
|
|
808
808
|
updatedAt: string;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
/** A single Starknet call as returned in intent calldata. */
|
|
811
|
+
interface IntentCall {
|
|
812
|
+
contractAddress: string;
|
|
813
|
+
entrypoint: string;
|
|
814
|
+
calldata: string[];
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Response from any `createXIntent` call. Discriminated on `requiresSignature`:
|
|
818
|
+
* • true — SNIP-12 intent (listing / offer / cancel / counter-offer). Sign
|
|
819
|
+
* `typedData`, then call `submitIntentSignature(id, sig)` to obtain
|
|
820
|
+
* the executable calls.
|
|
821
|
+
* • false — prebuilt intent (fulfill / mint / create-collection). `calls` are
|
|
822
|
+
* ready to execute directly; there is no signature step.
|
|
823
|
+
*
|
|
824
|
+
* The discriminant makes the wrong access a compile error: `typedData` does not
|
|
825
|
+
* exist on the `false` variant, nor `calls` on the `true` variant. Consumers
|
|
826
|
+
* MUST narrow on `requiresSignature` before reading either.
|
|
827
|
+
*/
|
|
828
|
+
type ApiIntentCreated = {
|
|
811
829
|
id: string;
|
|
830
|
+
expiresAt: string;
|
|
831
|
+
requiresSignature: true;
|
|
812
832
|
typedData: unknown;
|
|
813
|
-
|
|
833
|
+
} | {
|
|
834
|
+
id: string;
|
|
814
835
|
expiresAt: string;
|
|
815
|
-
|
|
836
|
+
requiresSignature: false;
|
|
837
|
+
calls: IntentCall[];
|
|
838
|
+
};
|
|
816
839
|
interface CreateListingIntentParams {
|
|
817
840
|
offerer: string;
|
|
818
841
|
nftContract: string;
|
|
@@ -5325,6 +5348,63 @@ declare function u256ToBigInt(low: string, high: string): bigint;
|
|
|
5325
5348
|
*/
|
|
5326
5349
|
declare function encodeByteArray(str: string): string[];
|
|
5327
5350
|
|
|
5351
|
+
/**
|
|
5352
|
+
* Resilient Starknet RPC helpers — the single source of truth for "what counts
|
|
5353
|
+
* as a transient RPC failure" and the public fallback endpoint list, shared by
|
|
5354
|
+
* every Medialane app:
|
|
5355
|
+
* - dapp / io `starknetProvider` singletons (RpcProvider.baseFetch)
|
|
5356
|
+
* - io `/api/rpc` server-side proxy (upstream rotation)
|
|
5357
|
+
* - backend circuit breaker + receipt-rotation paths
|
|
5358
|
+
*
|
|
5359
|
+
* Motivation (2026-06-03): Alchemy's Starknet mainnet endpoint intermittently
|
|
5360
|
+
* returns HTTP 503 with the JSON-RPC envelope `-32001 "Unable to complete
|
|
5361
|
+
* request at this time."` (~1 in 6 calls, while its status page reads green).
|
|
5362
|
+
* A single blip inside a `waitForTransaction` poll loop stalls mints/listings.
|
|
5363
|
+
* Failing over to a public endpoint recovers silently.
|
|
5364
|
+
*/
|
|
5365
|
+
/**
|
|
5366
|
+
* Ordered public Starknet **mainnet** RPC endpoints (no API key required),
|
|
5367
|
+
* used as fallbacks after an app's configured primary (e.g. Alchemy) returns a
|
|
5368
|
+
* transient error. lava.build first — RPC spec 0.8.1, permissive CORS — so it
|
|
5369
|
+
* is safe for browser `baseFetch` use as well as server-side rotation.
|
|
5370
|
+
*/
|
|
5371
|
+
declare const PUBLIC_RPC_FALLBACKS: readonly string[];
|
|
5372
|
+
/**
|
|
5373
|
+
* Is this RPC response worth retrying against another endpoint?
|
|
5374
|
+
*
|
|
5375
|
+
* Accepts either an HTTP status + raw text body (client `baseFetch` path) or a
|
|
5376
|
+
* parsed JSON-RPC envelope (server proxy path). For parsed envelopes the
|
|
5377
|
+
* server-defined error-code range (`-32099..-32000`) is treated as transient;
|
|
5378
|
+
* for raw text only the explicit `-32001`/`-32603` codes + message hints match,
|
|
5379
|
+
* so a `-32000` "Unauthorized" text body is never mistaken for transient.
|
|
5380
|
+
*/
|
|
5381
|
+
declare function isTransientRpcError(input: {
|
|
5382
|
+
status?: number;
|
|
5383
|
+
body?: unknown;
|
|
5384
|
+
}): boolean;
|
|
5385
|
+
interface FailoverFetchOptions {
|
|
5386
|
+
/** Underlying fetch to wrap (e.g. one that adds a timeout). Defaults to the global `fetch`. */
|
|
5387
|
+
baseFetch?: typeof fetch;
|
|
5388
|
+
/** Invoked each time an endpoint is abandoned for the next one. */
|
|
5389
|
+
onFailover?: (info: {
|
|
5390
|
+
url: string;
|
|
5391
|
+
status?: number;
|
|
5392
|
+
error?: unknown;
|
|
5393
|
+
}) => void;
|
|
5394
|
+
}
|
|
5395
|
+
/**
|
|
5396
|
+
* Build a `fetch` suitable for `RpcProvider.baseFetch` that tries each URL in
|
|
5397
|
+
* `urls` in order, advancing to the next only on a transient failure (network
|
|
5398
|
+
* error, 5xx/429, or a transient JSON-RPC envelope). The provider's own
|
|
5399
|
+
* `nodeUrl` argument is ignored — routing is controlled entirely by `urls` —
|
|
5400
|
+
* so callers should set `nodeUrl: urls[0]` (used only for spec negotiation).
|
|
5401
|
+
*
|
|
5402
|
+
* @example
|
|
5403
|
+
* const urls = [primaryAlchemyUrl, ...PUBLIC_RPC_FALLBACKS];
|
|
5404
|
+
* new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
5405
|
+
*/
|
|
5406
|
+
declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
|
|
5407
|
+
|
|
5328
5408
|
/**
|
|
5329
5409
|
* Build SNIP-12 typed data for signing an OrderParameters struct.
|
|
5330
5410
|
* The shape is identical across ERC-721 and ERC-1155 (nested OfferItem +
|
|
@@ -5336,4 +5416,4 @@ declare function build1155OrderTypedData(message: Record<string, unknown>, chain
|
|
|
5336
5416
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId | string): TypedData;
|
|
5337
5417
|
declare function build1155CancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId | string): TypedData;
|
|
5338
5418
|
|
|
5339
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, type ApiAppSource, type ApiChain, 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 ApiWalletType, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_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, type EnforcementDeclaration, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, 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, 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 ServiceEventDeclaration, type ServiceId, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
5419
|
+
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, type ApiAppSource, type ApiChain, 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 ApiWalletType, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_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, type EnforcementDeclaration, type FailoverFetchOptions, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, type IPType, type IntentCall, 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, 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, PUBLIC_RPC_FALLBACKS, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type ResolvedFeeConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type ServiceEventDeclaration, type ServiceId, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
package/dist/index.d.ts
CHANGED
|
@@ -807,12 +807,35 @@ interface ApiIntent {
|
|
|
807
807
|
createdAt: string;
|
|
808
808
|
updatedAt: string;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
/** A single Starknet call as returned in intent calldata. */
|
|
811
|
+
interface IntentCall {
|
|
812
|
+
contractAddress: string;
|
|
813
|
+
entrypoint: string;
|
|
814
|
+
calldata: string[];
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Response from any `createXIntent` call. Discriminated on `requiresSignature`:
|
|
818
|
+
* • true — SNIP-12 intent (listing / offer / cancel / counter-offer). Sign
|
|
819
|
+
* `typedData`, then call `submitIntentSignature(id, sig)` to obtain
|
|
820
|
+
* the executable calls.
|
|
821
|
+
* • false — prebuilt intent (fulfill / mint / create-collection). `calls` are
|
|
822
|
+
* ready to execute directly; there is no signature step.
|
|
823
|
+
*
|
|
824
|
+
* The discriminant makes the wrong access a compile error: `typedData` does not
|
|
825
|
+
* exist on the `false` variant, nor `calls` on the `true` variant. Consumers
|
|
826
|
+
* MUST narrow on `requiresSignature` before reading either.
|
|
827
|
+
*/
|
|
828
|
+
type ApiIntentCreated = {
|
|
811
829
|
id: string;
|
|
830
|
+
expiresAt: string;
|
|
831
|
+
requiresSignature: true;
|
|
812
832
|
typedData: unknown;
|
|
813
|
-
|
|
833
|
+
} | {
|
|
834
|
+
id: string;
|
|
814
835
|
expiresAt: string;
|
|
815
|
-
|
|
836
|
+
requiresSignature: false;
|
|
837
|
+
calls: IntentCall[];
|
|
838
|
+
};
|
|
816
839
|
interface CreateListingIntentParams {
|
|
817
840
|
offerer: string;
|
|
818
841
|
nftContract: string;
|
|
@@ -5325,6 +5348,63 @@ declare function u256ToBigInt(low: string, high: string): bigint;
|
|
|
5325
5348
|
*/
|
|
5326
5349
|
declare function encodeByteArray(str: string): string[];
|
|
5327
5350
|
|
|
5351
|
+
/**
|
|
5352
|
+
* Resilient Starknet RPC helpers — the single source of truth for "what counts
|
|
5353
|
+
* as a transient RPC failure" and the public fallback endpoint list, shared by
|
|
5354
|
+
* every Medialane app:
|
|
5355
|
+
* - dapp / io `starknetProvider` singletons (RpcProvider.baseFetch)
|
|
5356
|
+
* - io `/api/rpc` server-side proxy (upstream rotation)
|
|
5357
|
+
* - backend circuit breaker + receipt-rotation paths
|
|
5358
|
+
*
|
|
5359
|
+
* Motivation (2026-06-03): Alchemy's Starknet mainnet endpoint intermittently
|
|
5360
|
+
* returns HTTP 503 with the JSON-RPC envelope `-32001 "Unable to complete
|
|
5361
|
+
* request at this time."` (~1 in 6 calls, while its status page reads green).
|
|
5362
|
+
* A single blip inside a `waitForTransaction` poll loop stalls mints/listings.
|
|
5363
|
+
* Failing over to a public endpoint recovers silently.
|
|
5364
|
+
*/
|
|
5365
|
+
/**
|
|
5366
|
+
* Ordered public Starknet **mainnet** RPC endpoints (no API key required),
|
|
5367
|
+
* used as fallbacks after an app's configured primary (e.g. Alchemy) returns a
|
|
5368
|
+
* transient error. lava.build first — RPC spec 0.8.1, permissive CORS — so it
|
|
5369
|
+
* is safe for browser `baseFetch` use as well as server-side rotation.
|
|
5370
|
+
*/
|
|
5371
|
+
declare const PUBLIC_RPC_FALLBACKS: readonly string[];
|
|
5372
|
+
/**
|
|
5373
|
+
* Is this RPC response worth retrying against another endpoint?
|
|
5374
|
+
*
|
|
5375
|
+
* Accepts either an HTTP status + raw text body (client `baseFetch` path) or a
|
|
5376
|
+
* parsed JSON-RPC envelope (server proxy path). For parsed envelopes the
|
|
5377
|
+
* server-defined error-code range (`-32099..-32000`) is treated as transient;
|
|
5378
|
+
* for raw text only the explicit `-32001`/`-32603` codes + message hints match,
|
|
5379
|
+
* so a `-32000` "Unauthorized" text body is never mistaken for transient.
|
|
5380
|
+
*/
|
|
5381
|
+
declare function isTransientRpcError(input: {
|
|
5382
|
+
status?: number;
|
|
5383
|
+
body?: unknown;
|
|
5384
|
+
}): boolean;
|
|
5385
|
+
interface FailoverFetchOptions {
|
|
5386
|
+
/** Underlying fetch to wrap (e.g. one that adds a timeout). Defaults to the global `fetch`. */
|
|
5387
|
+
baseFetch?: typeof fetch;
|
|
5388
|
+
/** Invoked each time an endpoint is abandoned for the next one. */
|
|
5389
|
+
onFailover?: (info: {
|
|
5390
|
+
url: string;
|
|
5391
|
+
status?: number;
|
|
5392
|
+
error?: unknown;
|
|
5393
|
+
}) => void;
|
|
5394
|
+
}
|
|
5395
|
+
/**
|
|
5396
|
+
* Build a `fetch` suitable for `RpcProvider.baseFetch` that tries each URL in
|
|
5397
|
+
* `urls` in order, advancing to the next only on a transient failure (network
|
|
5398
|
+
* error, 5xx/429, or a transient JSON-RPC envelope). The provider's own
|
|
5399
|
+
* `nodeUrl` argument is ignored — routing is controlled entirely by `urls` —
|
|
5400
|
+
* so callers should set `nodeUrl: urls[0]` (used only for spec negotiation).
|
|
5401
|
+
*
|
|
5402
|
+
* @example
|
|
5403
|
+
* const urls = [primaryAlchemyUrl, ...PUBLIC_RPC_FALLBACKS];
|
|
5404
|
+
* new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
5405
|
+
*/
|
|
5406
|
+
declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
|
|
5407
|
+
|
|
5328
5408
|
/**
|
|
5329
5409
|
* Build SNIP-12 typed data for signing an OrderParameters struct.
|
|
5330
5410
|
* The shape is identical across ERC-721 and ERC-1155 (nested OfferItem +
|
|
@@ -5336,4 +5416,4 @@ declare function build1155OrderTypedData(message: Record<string, unknown>, chain
|
|
|
5336
5416
|
declare function buildCancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId | string): TypedData;
|
|
5337
5417
|
declare function build1155CancellationTypedData(message: Record<string, unknown>, chainId: constants.StarknetChainId | string): TypedData;
|
|
5338
5418
|
|
|
5339
|
-
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, type ApiAppSource, type ApiChain, 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 ApiWalletType, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_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, type EnforcementDeclaration, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, 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, 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 ServiceEventDeclaration, type ServiceId, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
5419
|
+
export { type ActivityType, type ApiActivitiesQuery, type ApiActivity, type ApiActivityPrice, type ApiAdminCollectionClaim, type ApiAppSource, type ApiChain, 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 ApiWalletType, type ApiWebhookCreated, type ApiWebhookEndpoint, type AutoRemixOfferParams, type BatchMintItemParams, type BuildFeeCallParams, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_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, type EnforcementDeclaration, type FailoverFetchOptions, type FeeConfig, FeeConfigSchema, type FeeSurface, type FulfillOrder1155Params, type FulfillOrderIntentParams, type FulfillOrderParams, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, type IPType, type IntentCall, 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, 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, PUBLIC_RPC_FALLBACKS, type PopBatchEligibilityItem, type PopClaimStatus, type PopEventType, PopService, type RemixOfferStatus, type ResolvedConfig, type ResolvedFeeConfig, type RetryOptions, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, type ServiceCapability, type ServiceDefinition, type ServiceEventDeclaration, type ServiceId, type SortOrder, type SupportedToken, type SupportedTokenSymbol, type TenantPlan, type TxResult, type WebhookEventType, type WebhookStatus, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
package/dist/index.js
CHANGED
|
@@ -4684,6 +4684,63 @@ var MedialaneError = class extends Error {
|
|
|
4684
4684
|
this.name = "MedialaneError";
|
|
4685
4685
|
}
|
|
4686
4686
|
};
|
|
4687
|
+
|
|
4688
|
+
// src/utils/rpc.ts
|
|
4689
|
+
var PUBLIC_RPC_FALLBACKS = [
|
|
4690
|
+
"https://rpc.starknet.lava.build",
|
|
4691
|
+
"https://starknet-mainnet.public.blastapi.io/rpc/v0_7",
|
|
4692
|
+
"https://free-rpc.nethermind.io/mainnet-juno/v0_7"
|
|
4693
|
+
];
|
|
4694
|
+
var TRANSIENT_BODY_RE = /"code"\s*:\s*-32001|"code"\s*:\s*-32603|unable to complete|rate.?limit|too many|throttl|exceed.*quota|temporarily unavailable|service unavailable|overload|gateway.*time|upstream.*time|backend.*error/i;
|
|
4695
|
+
function isTransientRpcError(input) {
|
|
4696
|
+
const { status, body } = input;
|
|
4697
|
+
if (typeof status === "number" && (status === 429 || status >= 500)) return true;
|
|
4698
|
+
if (body == null) return false;
|
|
4699
|
+
if (typeof body === "object") {
|
|
4700
|
+
const err = body.error;
|
|
4701
|
+
if (!err || typeof err !== "object") return false;
|
|
4702
|
+
const code = err.code;
|
|
4703
|
+
if (typeof code === "number") {
|
|
4704
|
+
if (code === 429) return true;
|
|
4705
|
+
if (code >= -32099 && code <= -32e3) return true;
|
|
4706
|
+
if (code === -32603) return true;
|
|
4707
|
+
}
|
|
4708
|
+
const message = err.message;
|
|
4709
|
+
return typeof message === "string" ? TRANSIENT_BODY_RE.test(message) : false;
|
|
4710
|
+
}
|
|
4711
|
+
return TRANSIENT_BODY_RE.test(String(body));
|
|
4712
|
+
}
|
|
4713
|
+
function createFailoverFetch(urls, options = {}) {
|
|
4714
|
+
const endpoints = urls.filter((u) => Boolean(u));
|
|
4715
|
+
if (endpoints.length === 0) {
|
|
4716
|
+
throw new Error("createFailoverFetch: at least one RPC URL is required");
|
|
4717
|
+
}
|
|
4718
|
+
const doFetch = options.baseFetch ?? fetch;
|
|
4719
|
+
const failover = async (_input, init) => {
|
|
4720
|
+
let lastError;
|
|
4721
|
+
for (let i = 0; i < endpoints.length; i++) {
|
|
4722
|
+
const url = endpoints[i];
|
|
4723
|
+
const isLast = i === endpoints.length - 1;
|
|
4724
|
+
try {
|
|
4725
|
+
const res = await doFetch(url, init);
|
|
4726
|
+
const text = await res.text();
|
|
4727
|
+
const rebuilt = () => new Response(text, { status: res.status, statusText: res.statusText, headers: res.headers });
|
|
4728
|
+
if (isLast || !isTransientRpcError({ status: res.status, body: text })) {
|
|
4729
|
+
return rebuilt();
|
|
4730
|
+
}
|
|
4731
|
+
options.onFailover?.({ url, status: res.status });
|
|
4732
|
+
} catch (err) {
|
|
4733
|
+
lastError = err;
|
|
4734
|
+
if (isLast) throw err;
|
|
4735
|
+
options.onFailover?.({ url, error: err });
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
throw lastError ?? new Error("createFailoverFetch: all endpoints failed");
|
|
4739
|
+
};
|
|
4740
|
+
return failover;
|
|
4741
|
+
}
|
|
4742
|
+
|
|
4743
|
+
// src/marketplace/utils.ts
|
|
4687
4744
|
var START_TIME_BUFFER_SECS = 30;
|
|
4688
4745
|
function generateSalt() {
|
|
4689
4746
|
const bytes = new Uint8Array(31);
|
|
@@ -4724,7 +4781,8 @@ var _providerCache = /* @__PURE__ */ new WeakMap();
|
|
|
4724
4781
|
function getProvider(config) {
|
|
4725
4782
|
let p = _providerCache.get(config);
|
|
4726
4783
|
if (!p) {
|
|
4727
|
-
|
|
4784
|
+
const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
|
|
4785
|
+
p = new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
4728
4786
|
_providerCache.set(config, p);
|
|
4729
4787
|
}
|
|
4730
4788
|
return p;
|
|
@@ -6520,6 +6578,6 @@ function getServicesByCapability(cap) {
|
|
|
6520
6578
|
);
|
|
6521
6579
|
}
|
|
6522
6580
|
|
|
6523
|
-
export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, 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, 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, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
6581
|
+
export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, 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, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PUBLIC_RPC_FALLBACKS, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
|
|
6524
6582
|
//# sourceMappingURL=index.js.map
|
|
6525
6583
|
//# sourceMappingURL=index.js.map
|