@medialane/sdk 0.85.4 → 0.85.6
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/evm/index.cjs +0 -7
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1 -23
- package/dist/evm/index.d.ts +1 -23
- package/dist/evm/index.js +0 -7
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +2 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -146
- package/dist/index.d.ts +4 -146
- package/dist/index.js +2 -140
- package/dist/index.js.map +1 -1
- package/dist/{services-CovenF1m.d.ts → services-CQKFABiG.d.cts} +4 -327
- package/dist/{services-D8saJqJw.d.cts → services-okgZ2AMD.d.ts} +4 -327
- package/dist/solana/index.cjs +0 -5
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1 -14
- package/dist/solana/index.d.ts +1 -14
- package/dist/solana/index.js +0 -5
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +2 -220
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -334
- package/dist/starknet/index.d.ts +2 -334
- package/dist/starknet/index.js +2 -220
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +0 -5
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.d.cts +1 -9
- package/dist/stellar/index.d.ts +1 -9
- package/dist/stellar/index.js +0 -5
- package/dist/stellar/index.js.map +1 -1
- package/dist/{types-sIc3OCpo.d.cts → types-nPIXtCF5.d.cts} +0 -45
- package/dist/{types-sIc3OCpo.d.ts → types-nPIXtCF5.d.ts} +0 -45
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServiceDefinition, a as ServiceCapability } from './services-
|
|
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 ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinsQuery, o as ApiCollection, p as ApiCollectionClaim, q as ApiCollectionProfile, r as ApiCollectionSlugClaim, s as ApiCollectionsQuery, t as ApiComment, u as ApiCounterOffersQuery, v as ApiCreatorListResult, w as ApiCreatorProfile, x as ApiIntent, y as ApiIntentCreated, z as ApiKeyStatus, B as ApiMeta, C as ApiMetadataSignedUrl, D as ApiMetadataUpload, E as ApiOrder, F as ApiOrderConsideration, G as ApiOrderOffer, H as ApiOrderPrice, I as ApiOrderTokenMeta, J as ApiOrderTxHash, K as ApiOrdersQuery, L as ApiPointEvent, M as ApiPortalKey, N as ApiPortalKeyCreated, O as ApiPortalMe, P as ApiPublicRemix, Q as ApiRemixOffer, R as ApiRemixOfferPrice, T as ApiRemixOffersQuery, U as ApiResponse, V as ApiRewardsBadge, W as ApiRewardsBatchEntry, X as ApiRewardsConfig, Y as ApiRewardsLeaderboardEntry, Z as ApiRewardsLevel, _ as ApiSearchCollectionResult, $ as ApiSearchCreatorResult, a0 as ApiSearchResult, a1 as ApiSearchTokenResult, a2 as ApiToken, a3 as ApiTokenBalance, a4 as ApiTokenMetadata, a5 as ApiUsageDay, a6 as ApiUserRewards, a7 as ApiUserWallet, a8 as ApiWalletActivity, a9 as ApiWebhookCreated, aa as ApiWebhookEndpoint, ab as AutoRemixOfferParams, ac as CancelOrderIntentParams, ad as ChainFilter, ae as ClaimConditions, af as CollectionServiceId, ag as CollectionSort, ah as CollectionTokensSort, ai as ConfirmRemixOfferParams, aj as ConfirmSelfRemixParams, ak as ConsiderationItem, al as CreateCheckoutIntentParams, am as CreateCoinIntentParams, an as CreateCollectionIntentParams, ao as CreateCounterOfferIntentParams, ap as CreateDropParams, aq as CreateListingIntentParams, ar as CreateMembershipParams, as as CreateMintIntentParams, at as CreatePopCollectionParams, au as CreateRemixOfferParams, av as CreateSponsorshipOfferIntentParams, aw as CreateSponsorshipOfferParams, ax as CreateSponsorshipProposalIntentParams, ay as CreateTicketParams, az as CreateTierIntentParams, aA as CreateWebhookParams, aB as DropMintStatus, aC as EnforcementDeclaration, aD as FactoryFamilyServiceId, aE as FeeConfig, aF as FeeConfigSchema, aG as FulfillOrderIntentParams, aH as IPType, aI as IntentCall, aJ as IntentStatus, aK as IntentType, aL as IpAttribute, aM as IpNftMetadata, aN as LaunchCoinIntentParams, aO as MakeOfferIntentParams, aP as MedialaneApiError, aQ as MedialaneConfig, aR as MedialaneErrorCode, aS as MintMembershipsParams, aT as MintTicketsParams, aU as OPEN_LICENSES, aV as OfferItem, aW as OpenLicense, aX as Order, aY as OrderDetails, aZ as OrderParameters, a_ as OrderStatus, a$ as PlaceSponsorshipBidIntentParams, b0 as PopBatchEligibilityItem, b1 as PopClaimStatus, b2 as PopEventType, b3 as ProposeSponsorshipParams, b4 as RejectSponsorshipProposalIntentParams, b5 as RemixOfferStatus, b6 as ResolvedConfig, b7 as ResolvedFeeConfig, b8 as RetractSponsorshipBidIntentParams, b9 as RetryOptions, ba as ServiceEventDeclaration, bb as SetSponsorshipOfferOpenIntentParams, bc as SortOrder, bd as TenantPlan, be as TierServiceId, bf as TxResult, bg as WebhookEventType, bh as WebhookStatus, bi as WithdrawSponsorshipProposalIntentParams, bj as resolveConfig, bk as resolveFeeConfig } from './services-
|
|
3
|
-
import { C as Chain } from './types-
|
|
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-
|
|
1
|
+
import { S as ServiceDefinition, a as ServiceCapability } from './services-CQKFABiG.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 ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinsQuery, o as ApiCollection, p as ApiCollectionClaim, q as ApiCollectionProfile, r as ApiCollectionSlugClaim, s as ApiCollectionsQuery, t as ApiComment, u as ApiCounterOffersQuery, v as ApiCreatorListResult, w as ApiCreatorProfile, x as ApiIntent, y as ApiIntentCreated, z as ApiKeyStatus, B as ApiMeta, C as ApiMetadataSignedUrl, D as ApiMetadataUpload, E as ApiOrder, F as ApiOrderConsideration, G as ApiOrderOffer, H as ApiOrderPrice, I as ApiOrderTokenMeta, J as ApiOrderTxHash, K as ApiOrdersQuery, L as ApiPointEvent, M as ApiPortalKey, N as ApiPortalKeyCreated, O as ApiPortalMe, P as ApiPublicRemix, Q as ApiRemixOffer, R as ApiRemixOfferPrice, T as ApiRemixOffersQuery, U as ApiResponse, V as ApiRewardsBadge, W as ApiRewardsBatchEntry, X as ApiRewardsConfig, Y as ApiRewardsLeaderboardEntry, Z as ApiRewardsLevel, _ as ApiSearchCollectionResult, $ as ApiSearchCreatorResult, a0 as ApiSearchResult, a1 as ApiSearchTokenResult, a2 as ApiToken, a3 as ApiTokenBalance, a4 as ApiTokenMetadata, a5 as ApiUsageDay, a6 as ApiUserRewards, a7 as ApiUserWallet, a8 as ApiWalletActivity, a9 as ApiWebhookCreated, aa as ApiWebhookEndpoint, ab as AutoRemixOfferParams, ac as CancelOrderIntentParams, ad as ChainFilter, ae as ClaimConditions, af as CollectionServiceId, ag as CollectionSort, ah as CollectionTokensSort, ai as ConfirmRemixOfferParams, aj as ConfirmSelfRemixParams, ak as ConsiderationItem, al as CreateCheckoutIntentParams, am as CreateCoinIntentParams, an as CreateCollectionIntentParams, ao as CreateCounterOfferIntentParams, ap as CreateDropParams, aq as CreateListingIntentParams, ar as CreateMembershipParams, as as CreateMintIntentParams, at as CreatePopCollectionParams, au as CreateRemixOfferParams, av as CreateSponsorshipOfferIntentParams, aw as CreateSponsorshipOfferParams, ax as CreateSponsorshipProposalIntentParams, ay as CreateTicketParams, az as CreateTierIntentParams, aA as CreateWebhookParams, aB as DropMintStatus, aC as EnforcementDeclaration, aD as FactoryFamilyServiceId, aE as FeeConfig, aF as FeeConfigSchema, aG as FulfillOrderIntentParams, aH as IPType, aI as IntentCall, aJ as IntentStatus, aK as IntentType, aL as IpAttribute, aM as IpNftMetadata, aN as LaunchCoinIntentParams, aO as MakeOfferIntentParams, aP as MedialaneApiError, aQ as MedialaneConfig, aR as MedialaneErrorCode, aS as MintMembershipsParams, aT as MintTicketsParams, aU as OPEN_LICENSES, aV as OfferItem, aW as OpenLicense, aX as Order, aY as OrderDetails, aZ as OrderParameters, a_ as OrderStatus, a$ as PlaceSponsorshipBidIntentParams, b0 as PopBatchEligibilityItem, b1 as PopClaimStatus, b2 as PopEventType, b3 as ProposeSponsorshipParams, b4 as RejectSponsorshipProposalIntentParams, b5 as RemixOfferStatus, b6 as ResolvedConfig, b7 as ResolvedFeeConfig, b8 as RetractSponsorshipBidIntentParams, b9 as RetryOptions, ba as ServiceEventDeclaration, bb as SetSponsorshipOfferOpenIntentParams, bc as SortOrder, bd as TenantPlan, be as TierServiceId, bf as TxResult, bg as WebhookEventType, bh as WebhookStatus, bi as WithdrawSponsorshipProposalIntentParams, bj as resolveConfig, bk as resolveFeeConfig } from './services-CQKFABiG.cjs';
|
|
3
|
+
import { C as Chain } from './types-nPIXtCF5.cjs';
|
|
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-nPIXtCF5.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
7
7
|
declare const STARKNET_MARKETPLACE_721_CONTRACT: `0x${string}`;
|
|
@@ -62,35 +62,16 @@ declare const SUPPORTED_TOKENS: readonly [{
|
|
|
62
62
|
readonly listable: true;
|
|
63
63
|
}];
|
|
64
64
|
type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number]["symbol"];
|
|
65
|
-
/** Default currency for listings and offers — Circle-native USDC on Starknet. */
|
|
66
65
|
declare const DEFAULT_CURRENCY: SupportedTokenSymbol;
|
|
67
66
|
|
|
68
|
-
/** Chains that resolve in a URL today. Extend when a second chain is displayable. */
|
|
69
67
|
declare const SUPPORTED_URL_CHAINS: readonly ["STARKNET"];
|
|
70
|
-
/** Chain enum → lowercase URL slug. The ONLY place the slug literal is produced. */
|
|
71
68
|
declare function chainSlug(chain: Chain): string;
|
|
72
|
-
/** URL slug → Chain enum, or null for an unknown/unsupported slug (caller 404s). */
|
|
73
69
|
declare function chainFromSlug(slug: string): Chain | null;
|
|
74
|
-
/** Nullish contract/token/address values coerce to "" — an absent id was never
|
|
75
|
-
* a valid link anyway, and this keeps callers free of artificial null guards. */
|
|
76
70
|
type Idish = string | number | null | undefined;
|
|
77
71
|
declare function assetHref(chain: Chain, contract: Idish, tokenId: Idish): string;
|
|
78
72
|
declare function collectionHref(chain: Chain, contract: Idish): string;
|
|
79
73
|
declare function coinHref(chain: Chain, address: Idish): string;
|
|
80
74
|
|
|
81
|
-
/**
|
|
82
|
-
* The Medialane service registry (05-service-model §II, §VI).
|
|
83
|
-
* Canonical long-form IDs (01-core-model §III). SDK-resident in v1;
|
|
84
|
-
* on-chain registry later (08-dao-governance §IV).
|
|
85
|
-
*
|
|
86
|
-
* `onchain` is keyed per chain (spec 2026-06-13 §3.1, Decision A): the SDK
|
|
87
|
-
* registry is the single source of a service's coordinates on each chain.
|
|
88
|
-
* Only STARKNET is populated today; adding a chain adds a key here.
|
|
89
|
-
*
|
|
90
|
-
* Phase 2B.2 of the service-model refactor. `ip-erc721` has no dedicated
|
|
91
|
-
* on-chain constant in src/constants.ts, so its `onchain` is omitted rather
|
|
92
|
-
* than invented (the genesis contract address ships with that service).
|
|
93
|
-
*/
|
|
94
75
|
declare const SERVICES: {
|
|
95
76
|
readonly "mip-erc721": {
|
|
96
77
|
readonly id: "mip-erc721";
|
|
@@ -383,164 +364,43 @@ declare const SERVICES: {
|
|
|
383
364
|
readonly capabilities: ["list", "buy", "make_offer", "cancel", "transfer"];
|
|
384
365
|
};
|
|
385
366
|
};
|
|
386
|
-
/**
|
|
387
|
-
* Literal-union of every registered service ID. Use this as the type for
|
|
388
|
-
* `Collection.service` write sites in consumers — typos like "pop_protocol"
|
|
389
|
-
* (underscore instead of hyphen) become compile errors.
|
|
390
|
-
*
|
|
391
|
-
* `getService()` still accepts loose `string` for read-side lookups where the
|
|
392
|
-
* value came from the DB and is trusted to already be valid.
|
|
393
|
-
*/
|
|
394
367
|
type ServiceId = keyof typeof SERVICES;
|
|
395
|
-
/** Type guard: narrows a string to ServiceId if it's registered. */
|
|
396
368
|
declare function isServiceId(id: string | null | undefined): id is ServiceId;
|
|
397
|
-
/** Lookup. Returns undefined for unregistered service IDs — callers should
|
|
398
|
-
* treat that as a data error, since every Collection.service value is
|
|
399
|
-
* expected to map to a registered ServiceDefinition. */
|
|
400
369
|
declare function getService(id: string | null | undefined): ServiceDefinition | undefined;
|
|
401
|
-
/** All registered services (e.g. the launchpad grid). */
|
|
402
370
|
declare function listServices(): ServiceDefinition[];
|
|
403
|
-
/** Services that declare a capability (e.g. "where can users mint"). */
|
|
404
371
|
declare function getServicesByCapability(cap: ServiceCapability): ServiceDefinition[];
|
|
405
|
-
/** Whether a service declares a given capability — e.g. whether an asset
|
|
406
|
-
* type is transferable. Returns false for an unregistered/missing id rather
|
|
407
|
-
* than throwing, since callers use this for UI copy, not authority checks. */
|
|
408
372
|
declare function hasCapability(id: string | null | undefined, cap: ServiceCapability): boolean;
|
|
409
373
|
|
|
410
|
-
/**
|
|
411
|
-
* Normalize an address to its chain's canonical form. The single source of
|
|
412
|
-
* address normalization across Medialane (07-identity §I; spec 2026-06-13 §3.2).
|
|
413
|
-
* `medialane-backend` re-exports this; do not maintain a parallel copy.
|
|
414
|
-
*
|
|
415
|
-
* - STARKNET: 0x-prefixed 64-char lowercase hex (felt, zero-padded).
|
|
416
|
-
* - ETHEREUM / BASE: EIP-55 mixed-case checksum.
|
|
417
|
-
* - SOLANA: base58, validated as a 32-byte public key, returned verbatim.
|
|
418
|
-
* - STELLAR: strkey (G… account / C… contract), CRC16-XModem-verified,
|
|
419
|
-
* canonical uppercase.
|
|
420
|
-
* - BITCOIN: not implemented — a non-foreclosed seam, gated on a future
|
|
421
|
-
* Bitcoin fork (chain-sovereignty §2); never a built path today.
|
|
422
|
-
*/
|
|
423
374
|
declare function normalizeAddress(chain: Chain, address: string): string;
|
|
424
|
-
/**
|
|
425
|
-
* Normalize a felt/hash (tx hash, order hash) to 0x-prefixed 64-char lowercase
|
|
426
|
-
* hex. Starknet-shaped; chain-scoped at call sites that handle other chains'
|
|
427
|
-
* hashes.
|
|
428
|
-
*/
|
|
429
375
|
declare function normalizeHash(hash: string): string;
|
|
430
|
-
/** Shorten an address to "0x1234...abcd" form, normalized for its chain. */
|
|
431
376
|
declare function shortenAddress(chain: Chain, address: string, chars?: number): string;
|
|
432
377
|
|
|
433
378
|
type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
|
|
434
|
-
/**
|
|
435
|
-
* Parse a human-readable amount (e.g. "1.5") to its raw integer string
|
|
436
|
-
* representation given the token's decimal places.
|
|
437
|
-
* Uses pure BigInt arithmetic to avoid floating point precision loss.
|
|
438
|
-
*/
|
|
439
379
|
declare function parseAmount(human: string, decimals: number): string;
|
|
440
|
-
/**
|
|
441
|
-
* Format a raw integer string (e.g. "1500000") to a human-readable decimal
|
|
442
|
-
* string given the token's decimal places.
|
|
443
|
-
*/
|
|
444
380
|
declare function formatAmount(raw: string, decimals: number): string;
|
|
445
|
-
/**
|
|
446
|
-
* Find a supported token by its contract address.
|
|
447
|
-
*
|
|
448
|
-
* Compares by numeric felt value so a caller-supplied address that isn't
|
|
449
|
-
* zero-padded to 64 hex chars (`0x33068f6…`) still matches the stored padded
|
|
450
|
-
* form (`0x033068f6…`) — a bare `.toLowerCase()` string compare would miss it,
|
|
451
|
-
* the exact padding trap the address invariant warns against. Non-hex inputs
|
|
452
|
-
* fall back to a case-insensitive string compare.
|
|
453
|
-
*/
|
|
454
381
|
declare function getTokenByAddress(address: string): SupportedToken | undefined;
|
|
455
|
-
/**
|
|
456
|
-
* Find a supported token by its symbol (case-insensitive).
|
|
457
|
-
*/
|
|
458
382
|
declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
|
|
459
|
-
/**
|
|
460
|
-
* Return all tokens available for use in listing and offer dialogs.
|
|
461
|
-
* Tokens with listable: false appear only as marketplace filter chips.
|
|
462
|
-
*/
|
|
463
383
|
declare function getListableTokens(): ReadonlyArray<SupportedToken>;
|
|
464
384
|
|
|
465
|
-
/**
|
|
466
|
-
* Recursively convert all BigInt values to their decimal string representations.
|
|
467
|
-
* Required before JSON serialisation and before passing objects to starknet.js
|
|
468
|
-
* functions that expect string felts.
|
|
469
|
-
*/
|
|
470
385
|
declare function stringifyBigInts(obj: unknown): unknown;
|
|
471
|
-
/**
|
|
472
|
-
* Convert a u256 represented as { low: string; high: string } to a single BigInt.
|
|
473
|
-
*/
|
|
474
386
|
declare function u256ToBigInt(low: string, high: string): bigint;
|
|
475
|
-
/** Split a bigint into low/high felt252 halves for a Cairo u256 (inverse of `u256ToBigInt`). */
|
|
476
387
|
declare function encodeU256(n: bigint): [string, string];
|
|
477
388
|
|
|
478
|
-
/**
|
|
479
|
-
* Resilient Starknet RPC helpers — the single source of truth for "what counts
|
|
480
|
-
* as a transient RPC failure" and the public fallback endpoint list, shared by
|
|
481
|
-
* every Medialane app:
|
|
482
|
-
* - dapp / io `starknetProvider` singletons (RpcProvider.baseFetch)
|
|
483
|
-
* - io `/api/rpc` server-side proxy (upstream rotation)
|
|
484
|
-
* - backend circuit breaker + receipt-rotation paths
|
|
485
|
-
*
|
|
486
|
-
* Motivation (2026-06-03): Alchemy's Starknet mainnet endpoint intermittently
|
|
487
|
-
* returns HTTP 503 with the JSON-RPC envelope `-32001 "Unable to complete
|
|
488
|
-
* request at this time."` (~1 in 6 calls, while its status page reads green).
|
|
489
|
-
* A single blip inside a `waitForTransaction` poll loop stalls mints/listings.
|
|
490
|
-
* Failing over to a public endpoint recovers silently.
|
|
491
|
-
*/
|
|
492
|
-
/**
|
|
493
|
-
* Ordered public Starknet **mainnet** RPC endpoints (no API key required),
|
|
494
|
-
* used as fallback after an app's configured primary (e.g. Alchemy) returns a
|
|
495
|
-
* transient error. lava.build — RPC spec 0.8.1, permissive CORS — so it is
|
|
496
|
-
* safe for browser `baseFetch` use as well as server-side rotation.
|
|
497
|
-
*
|
|
498
|
-
* blastapi.io and free-rpc.nethermind.io were removed (2026-07-04) — long
|
|
499
|
-
* confirmed dead/unreliable in production; do not re-add them.
|
|
500
|
-
*/
|
|
501
389
|
declare const PUBLIC_RPC_FALLBACKS: readonly string[];
|
|
502
|
-
/**
|
|
503
|
-
* Is this RPC response worth retrying against another endpoint?
|
|
504
|
-
*
|
|
505
|
-
* Accepts either an HTTP status + raw text body (client `baseFetch` path) or a
|
|
506
|
-
* parsed JSON-RPC envelope (server proxy path). For parsed envelopes the
|
|
507
|
-
* server-defined error-code range (`-32099..-32000`) is treated as transient;
|
|
508
|
-
* for raw text only the explicit `-32001`/`-32603` codes + message hints match,
|
|
509
|
-
* so a `-32000` "Unauthorized" text body is never mistaken for transient.
|
|
510
|
-
*/
|
|
511
390
|
declare function isTransientRpcError(input: {
|
|
512
391
|
status?: number;
|
|
513
392
|
body?: unknown;
|
|
514
393
|
}): boolean;
|
|
515
394
|
interface FailoverFetchOptions {
|
|
516
|
-
/** Underlying fetch to wrap (e.g. one that adds a timeout). Defaults to the global `fetch`. */
|
|
517
395
|
baseFetch?: typeof fetch;
|
|
518
|
-
/** Invoked each time an endpoint is abandoned for the next one. */
|
|
519
396
|
onFailover?: (info: {
|
|
520
397
|
url: string;
|
|
521
398
|
status?: number;
|
|
522
399
|
error?: unknown;
|
|
523
400
|
}) => void;
|
|
524
401
|
}
|
|
525
|
-
/**
|
|
526
|
-
* Build a `fetch` suitable for `RpcProvider.baseFetch` that tries each URL in
|
|
527
|
-
* `urls` in order, advancing to the next only on a transient failure (network
|
|
528
|
-
* error, 5xx/429, or a transient JSON-RPC envelope). The provider's own
|
|
529
|
-
* `nodeUrl` argument is ignored — routing is controlled entirely by `urls` —
|
|
530
|
-
* so callers should set `nodeUrl: urls[0]` (used only for spec negotiation).
|
|
531
|
-
*
|
|
532
|
-
* @example
|
|
533
|
-
* const urls = [primaryAlchemyUrl, ...PUBLIC_RPC_FALLBACKS];
|
|
534
|
-
* new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
535
|
-
*/
|
|
536
402
|
declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
|
|
537
403
|
|
|
538
|
-
/**
|
|
539
|
-
* Shared OpenSea-ERC721 + Berne-Convention metadata builder.
|
|
540
|
-
*
|
|
541
|
-
* Single source of truth for how a Medialane asset's metadata JSON is shaped.
|
|
542
|
-
* Pure function — no network calls, no FormData. Server-safe and chain-neutral.
|
|
543
|
-
*/
|
|
544
404
|
type AssetAttribute = {
|
|
545
405
|
trait_type: string;
|
|
546
406
|
value: string;
|
|
@@ -567,12 +427,10 @@ interface BuildAssetMetadataInput {
|
|
|
567
427
|
aiPolicy?: string | null;
|
|
568
428
|
royalty?: string | null;
|
|
569
429
|
edition?: string | null;
|
|
570
|
-
/** Already-extracted `tmpl_*` template/custom traits (reserved names are filtered here). */
|
|
571
430
|
templateTraits?: {
|
|
572
431
|
traitType: string;
|
|
573
432
|
value: string;
|
|
574
433
|
}[];
|
|
575
|
-
/** ISO date (YYYY-MM-DD) stamped as the Berne registration trait. Defaults to today. */
|
|
576
434
|
registrationDate?: string;
|
|
577
435
|
}
|
|
578
436
|
declare const RESERVED_TRAITS: Set<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServiceDefinition, a as ServiceCapability } from './services-
|
|
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 ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinsQuery, o as ApiCollection, p as ApiCollectionClaim, q as ApiCollectionProfile, r as ApiCollectionSlugClaim, s as ApiCollectionsQuery, t as ApiComment, u as ApiCounterOffersQuery, v as ApiCreatorListResult, w as ApiCreatorProfile, x as ApiIntent, y as ApiIntentCreated, z as ApiKeyStatus, B as ApiMeta, C as ApiMetadataSignedUrl, D as ApiMetadataUpload, E as ApiOrder, F as ApiOrderConsideration, G as ApiOrderOffer, H as ApiOrderPrice, I as ApiOrderTokenMeta, J as ApiOrderTxHash, K as ApiOrdersQuery, L as ApiPointEvent, M as ApiPortalKey, N as ApiPortalKeyCreated, O as ApiPortalMe, P as ApiPublicRemix, Q as ApiRemixOffer, R as ApiRemixOfferPrice, T as ApiRemixOffersQuery, U as ApiResponse, V as ApiRewardsBadge, W as ApiRewardsBatchEntry, X as ApiRewardsConfig, Y as ApiRewardsLeaderboardEntry, Z as ApiRewardsLevel, _ as ApiSearchCollectionResult, $ as ApiSearchCreatorResult, a0 as ApiSearchResult, a1 as ApiSearchTokenResult, a2 as ApiToken, a3 as ApiTokenBalance, a4 as ApiTokenMetadata, a5 as ApiUsageDay, a6 as ApiUserRewards, a7 as ApiUserWallet, a8 as ApiWalletActivity, a9 as ApiWebhookCreated, aa as ApiWebhookEndpoint, ab as AutoRemixOfferParams, ac as CancelOrderIntentParams, ad as ChainFilter, ae as ClaimConditions, af as CollectionServiceId, ag as CollectionSort, ah as CollectionTokensSort, ai as ConfirmRemixOfferParams, aj as ConfirmSelfRemixParams, ak as ConsiderationItem, al as CreateCheckoutIntentParams, am as CreateCoinIntentParams, an as CreateCollectionIntentParams, ao as CreateCounterOfferIntentParams, ap as CreateDropParams, aq as CreateListingIntentParams, ar as CreateMembershipParams, as as CreateMintIntentParams, at as CreatePopCollectionParams, au as CreateRemixOfferParams, av as CreateSponsorshipOfferIntentParams, aw as CreateSponsorshipOfferParams, ax as CreateSponsorshipProposalIntentParams, ay as CreateTicketParams, az as CreateTierIntentParams, aA as CreateWebhookParams, aB as DropMintStatus, aC as EnforcementDeclaration, aD as FactoryFamilyServiceId, aE as FeeConfig, aF as FeeConfigSchema, aG as FulfillOrderIntentParams, aH as IPType, aI as IntentCall, aJ as IntentStatus, aK as IntentType, aL as IpAttribute, aM as IpNftMetadata, aN as LaunchCoinIntentParams, aO as MakeOfferIntentParams, aP as MedialaneApiError, aQ as MedialaneConfig, aR as MedialaneErrorCode, aS as MintMembershipsParams, aT as MintTicketsParams, aU as OPEN_LICENSES, aV as OfferItem, aW as OpenLicense, aX as Order, aY as OrderDetails, aZ as OrderParameters, a_ as OrderStatus, a$ as PlaceSponsorshipBidIntentParams, b0 as PopBatchEligibilityItem, b1 as PopClaimStatus, b2 as PopEventType, b3 as ProposeSponsorshipParams, b4 as RejectSponsorshipProposalIntentParams, b5 as RemixOfferStatus, b6 as ResolvedConfig, b7 as ResolvedFeeConfig, b8 as RetractSponsorshipBidIntentParams, b9 as RetryOptions, ba as ServiceEventDeclaration, bb as SetSponsorshipOfferOpenIntentParams, bc as SortOrder, bd as TenantPlan, be as TierServiceId, bf as TxResult, bg as WebhookEventType, bh as WebhookStatus, bi as WithdrawSponsorshipProposalIntentParams, bj as resolveConfig, bk as resolveFeeConfig } from './services-
|
|
3
|
-
import { C as Chain } from './types-
|
|
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-
|
|
1
|
+
import { S as ServiceDefinition, a as ServiceCapability } from './services-okgZ2AMD.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 ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinsQuery, o as ApiCollection, p as ApiCollectionClaim, q as ApiCollectionProfile, r as ApiCollectionSlugClaim, s as ApiCollectionsQuery, t as ApiComment, u as ApiCounterOffersQuery, v as ApiCreatorListResult, w as ApiCreatorProfile, x as ApiIntent, y as ApiIntentCreated, z as ApiKeyStatus, B as ApiMeta, C as ApiMetadataSignedUrl, D as ApiMetadataUpload, E as ApiOrder, F as ApiOrderConsideration, G as ApiOrderOffer, H as ApiOrderPrice, I as ApiOrderTokenMeta, J as ApiOrderTxHash, K as ApiOrdersQuery, L as ApiPointEvent, M as ApiPortalKey, N as ApiPortalKeyCreated, O as ApiPortalMe, P as ApiPublicRemix, Q as ApiRemixOffer, R as ApiRemixOfferPrice, T as ApiRemixOffersQuery, U as ApiResponse, V as ApiRewardsBadge, W as ApiRewardsBatchEntry, X as ApiRewardsConfig, Y as ApiRewardsLeaderboardEntry, Z as ApiRewardsLevel, _ as ApiSearchCollectionResult, $ as ApiSearchCreatorResult, a0 as ApiSearchResult, a1 as ApiSearchTokenResult, a2 as ApiToken, a3 as ApiTokenBalance, a4 as ApiTokenMetadata, a5 as ApiUsageDay, a6 as ApiUserRewards, a7 as ApiUserWallet, a8 as ApiWalletActivity, a9 as ApiWebhookCreated, aa as ApiWebhookEndpoint, ab as AutoRemixOfferParams, ac as CancelOrderIntentParams, ad as ChainFilter, ae as ClaimConditions, af as CollectionServiceId, ag as CollectionSort, ah as CollectionTokensSort, ai as ConfirmRemixOfferParams, aj as ConfirmSelfRemixParams, ak as ConsiderationItem, al as CreateCheckoutIntentParams, am as CreateCoinIntentParams, an as CreateCollectionIntentParams, ao as CreateCounterOfferIntentParams, ap as CreateDropParams, aq as CreateListingIntentParams, ar as CreateMembershipParams, as as CreateMintIntentParams, at as CreatePopCollectionParams, au as CreateRemixOfferParams, av as CreateSponsorshipOfferIntentParams, aw as CreateSponsorshipOfferParams, ax as CreateSponsorshipProposalIntentParams, ay as CreateTicketParams, az as CreateTierIntentParams, aA as CreateWebhookParams, aB as DropMintStatus, aC as EnforcementDeclaration, aD as FactoryFamilyServiceId, aE as FeeConfig, aF as FeeConfigSchema, aG as FulfillOrderIntentParams, aH as IPType, aI as IntentCall, aJ as IntentStatus, aK as IntentType, aL as IpAttribute, aM as IpNftMetadata, aN as LaunchCoinIntentParams, aO as MakeOfferIntentParams, aP as MedialaneApiError, aQ as MedialaneConfig, aR as MedialaneErrorCode, aS as MintMembershipsParams, aT as MintTicketsParams, aU as OPEN_LICENSES, aV as OfferItem, aW as OpenLicense, aX as Order, aY as OrderDetails, aZ as OrderParameters, a_ as OrderStatus, a$ as PlaceSponsorshipBidIntentParams, b0 as PopBatchEligibilityItem, b1 as PopClaimStatus, b2 as PopEventType, b3 as ProposeSponsorshipParams, b4 as RejectSponsorshipProposalIntentParams, b5 as RemixOfferStatus, b6 as ResolvedConfig, b7 as ResolvedFeeConfig, b8 as RetractSponsorshipBidIntentParams, b9 as RetryOptions, ba as ServiceEventDeclaration, bb as SetSponsorshipOfferOpenIntentParams, bc as SortOrder, bd as TenantPlan, be as TierServiceId, bf as TxResult, bg as WebhookEventType, bh as WebhookStatus, bi as WithdrawSponsorshipProposalIntentParams, bj as resolveConfig, bk as resolveFeeConfig } from './services-okgZ2AMD.js';
|
|
3
|
+
import { C as Chain } from './types-nPIXtCF5.js';
|
|
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-nPIXtCF5.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
7
7
|
declare const STARKNET_MARKETPLACE_721_CONTRACT: `0x${string}`;
|
|
@@ -62,35 +62,16 @@ declare const SUPPORTED_TOKENS: readonly [{
|
|
|
62
62
|
readonly listable: true;
|
|
63
63
|
}];
|
|
64
64
|
type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number]["symbol"];
|
|
65
|
-
/** Default currency for listings and offers — Circle-native USDC on Starknet. */
|
|
66
65
|
declare const DEFAULT_CURRENCY: SupportedTokenSymbol;
|
|
67
66
|
|
|
68
|
-
/** Chains that resolve in a URL today. Extend when a second chain is displayable. */
|
|
69
67
|
declare const SUPPORTED_URL_CHAINS: readonly ["STARKNET"];
|
|
70
|
-
/** Chain enum → lowercase URL slug. The ONLY place the slug literal is produced. */
|
|
71
68
|
declare function chainSlug(chain: Chain): string;
|
|
72
|
-
/** URL slug → Chain enum, or null for an unknown/unsupported slug (caller 404s). */
|
|
73
69
|
declare function chainFromSlug(slug: string): Chain | null;
|
|
74
|
-
/** Nullish contract/token/address values coerce to "" — an absent id was never
|
|
75
|
-
* a valid link anyway, and this keeps callers free of artificial null guards. */
|
|
76
70
|
type Idish = string | number | null | undefined;
|
|
77
71
|
declare function assetHref(chain: Chain, contract: Idish, tokenId: Idish): string;
|
|
78
72
|
declare function collectionHref(chain: Chain, contract: Idish): string;
|
|
79
73
|
declare function coinHref(chain: Chain, address: Idish): string;
|
|
80
74
|
|
|
81
|
-
/**
|
|
82
|
-
* The Medialane service registry (05-service-model §II, §VI).
|
|
83
|
-
* Canonical long-form IDs (01-core-model §III). SDK-resident in v1;
|
|
84
|
-
* on-chain registry later (08-dao-governance §IV).
|
|
85
|
-
*
|
|
86
|
-
* `onchain` is keyed per chain (spec 2026-06-13 §3.1, Decision A): the SDK
|
|
87
|
-
* registry is the single source of a service's coordinates on each chain.
|
|
88
|
-
* Only STARKNET is populated today; adding a chain adds a key here.
|
|
89
|
-
*
|
|
90
|
-
* Phase 2B.2 of the service-model refactor. `ip-erc721` has no dedicated
|
|
91
|
-
* on-chain constant in src/constants.ts, so its `onchain` is omitted rather
|
|
92
|
-
* than invented (the genesis contract address ships with that service).
|
|
93
|
-
*/
|
|
94
75
|
declare const SERVICES: {
|
|
95
76
|
readonly "mip-erc721": {
|
|
96
77
|
readonly id: "mip-erc721";
|
|
@@ -383,164 +364,43 @@ declare const SERVICES: {
|
|
|
383
364
|
readonly capabilities: ["list", "buy", "make_offer", "cancel", "transfer"];
|
|
384
365
|
};
|
|
385
366
|
};
|
|
386
|
-
/**
|
|
387
|
-
* Literal-union of every registered service ID. Use this as the type for
|
|
388
|
-
* `Collection.service` write sites in consumers — typos like "pop_protocol"
|
|
389
|
-
* (underscore instead of hyphen) become compile errors.
|
|
390
|
-
*
|
|
391
|
-
* `getService()` still accepts loose `string` for read-side lookups where the
|
|
392
|
-
* value came from the DB and is trusted to already be valid.
|
|
393
|
-
*/
|
|
394
367
|
type ServiceId = keyof typeof SERVICES;
|
|
395
|
-
/** Type guard: narrows a string to ServiceId if it's registered. */
|
|
396
368
|
declare function isServiceId(id: string | null | undefined): id is ServiceId;
|
|
397
|
-
/** Lookup. Returns undefined for unregistered service IDs — callers should
|
|
398
|
-
* treat that as a data error, since every Collection.service value is
|
|
399
|
-
* expected to map to a registered ServiceDefinition. */
|
|
400
369
|
declare function getService(id: string | null | undefined): ServiceDefinition | undefined;
|
|
401
|
-
/** All registered services (e.g. the launchpad grid). */
|
|
402
370
|
declare function listServices(): ServiceDefinition[];
|
|
403
|
-
/** Services that declare a capability (e.g. "where can users mint"). */
|
|
404
371
|
declare function getServicesByCapability(cap: ServiceCapability): ServiceDefinition[];
|
|
405
|
-
/** Whether a service declares a given capability — e.g. whether an asset
|
|
406
|
-
* type is transferable. Returns false for an unregistered/missing id rather
|
|
407
|
-
* than throwing, since callers use this for UI copy, not authority checks. */
|
|
408
372
|
declare function hasCapability(id: string | null | undefined, cap: ServiceCapability): boolean;
|
|
409
373
|
|
|
410
|
-
/**
|
|
411
|
-
* Normalize an address to its chain's canonical form. The single source of
|
|
412
|
-
* address normalization across Medialane (07-identity §I; spec 2026-06-13 §3.2).
|
|
413
|
-
* `medialane-backend` re-exports this; do not maintain a parallel copy.
|
|
414
|
-
*
|
|
415
|
-
* - STARKNET: 0x-prefixed 64-char lowercase hex (felt, zero-padded).
|
|
416
|
-
* - ETHEREUM / BASE: EIP-55 mixed-case checksum.
|
|
417
|
-
* - SOLANA: base58, validated as a 32-byte public key, returned verbatim.
|
|
418
|
-
* - STELLAR: strkey (G… account / C… contract), CRC16-XModem-verified,
|
|
419
|
-
* canonical uppercase.
|
|
420
|
-
* - BITCOIN: not implemented — a non-foreclosed seam, gated on a future
|
|
421
|
-
* Bitcoin fork (chain-sovereignty §2); never a built path today.
|
|
422
|
-
*/
|
|
423
374
|
declare function normalizeAddress(chain: Chain, address: string): string;
|
|
424
|
-
/**
|
|
425
|
-
* Normalize a felt/hash (tx hash, order hash) to 0x-prefixed 64-char lowercase
|
|
426
|
-
* hex. Starknet-shaped; chain-scoped at call sites that handle other chains'
|
|
427
|
-
* hashes.
|
|
428
|
-
*/
|
|
429
375
|
declare function normalizeHash(hash: string): string;
|
|
430
|
-
/** Shorten an address to "0x1234...abcd" form, normalized for its chain. */
|
|
431
376
|
declare function shortenAddress(chain: Chain, address: string, chars?: number): string;
|
|
432
377
|
|
|
433
378
|
type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
|
|
434
|
-
/**
|
|
435
|
-
* Parse a human-readable amount (e.g. "1.5") to its raw integer string
|
|
436
|
-
* representation given the token's decimal places.
|
|
437
|
-
* Uses pure BigInt arithmetic to avoid floating point precision loss.
|
|
438
|
-
*/
|
|
439
379
|
declare function parseAmount(human: string, decimals: number): string;
|
|
440
|
-
/**
|
|
441
|
-
* Format a raw integer string (e.g. "1500000") to a human-readable decimal
|
|
442
|
-
* string given the token's decimal places.
|
|
443
|
-
*/
|
|
444
380
|
declare function formatAmount(raw: string, decimals: number): string;
|
|
445
|
-
/**
|
|
446
|
-
* Find a supported token by its contract address.
|
|
447
|
-
*
|
|
448
|
-
* Compares by numeric felt value so a caller-supplied address that isn't
|
|
449
|
-
* zero-padded to 64 hex chars (`0x33068f6…`) still matches the stored padded
|
|
450
|
-
* form (`0x033068f6…`) — a bare `.toLowerCase()` string compare would miss it,
|
|
451
|
-
* the exact padding trap the address invariant warns against. Non-hex inputs
|
|
452
|
-
* fall back to a case-insensitive string compare.
|
|
453
|
-
*/
|
|
454
381
|
declare function getTokenByAddress(address: string): SupportedToken | undefined;
|
|
455
|
-
/**
|
|
456
|
-
* Find a supported token by its symbol (case-insensitive).
|
|
457
|
-
*/
|
|
458
382
|
declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
|
|
459
|
-
/**
|
|
460
|
-
* Return all tokens available for use in listing and offer dialogs.
|
|
461
|
-
* Tokens with listable: false appear only as marketplace filter chips.
|
|
462
|
-
*/
|
|
463
383
|
declare function getListableTokens(): ReadonlyArray<SupportedToken>;
|
|
464
384
|
|
|
465
|
-
/**
|
|
466
|
-
* Recursively convert all BigInt values to their decimal string representations.
|
|
467
|
-
* Required before JSON serialisation and before passing objects to starknet.js
|
|
468
|
-
* functions that expect string felts.
|
|
469
|
-
*/
|
|
470
385
|
declare function stringifyBigInts(obj: unknown): unknown;
|
|
471
|
-
/**
|
|
472
|
-
* Convert a u256 represented as { low: string; high: string } to a single BigInt.
|
|
473
|
-
*/
|
|
474
386
|
declare function u256ToBigInt(low: string, high: string): bigint;
|
|
475
|
-
/** Split a bigint into low/high felt252 halves for a Cairo u256 (inverse of `u256ToBigInt`). */
|
|
476
387
|
declare function encodeU256(n: bigint): [string, string];
|
|
477
388
|
|
|
478
|
-
/**
|
|
479
|
-
* Resilient Starknet RPC helpers — the single source of truth for "what counts
|
|
480
|
-
* as a transient RPC failure" and the public fallback endpoint list, shared by
|
|
481
|
-
* every Medialane app:
|
|
482
|
-
* - dapp / io `starknetProvider` singletons (RpcProvider.baseFetch)
|
|
483
|
-
* - io `/api/rpc` server-side proxy (upstream rotation)
|
|
484
|
-
* - backend circuit breaker + receipt-rotation paths
|
|
485
|
-
*
|
|
486
|
-
* Motivation (2026-06-03): Alchemy's Starknet mainnet endpoint intermittently
|
|
487
|
-
* returns HTTP 503 with the JSON-RPC envelope `-32001 "Unable to complete
|
|
488
|
-
* request at this time."` (~1 in 6 calls, while its status page reads green).
|
|
489
|
-
* A single blip inside a `waitForTransaction` poll loop stalls mints/listings.
|
|
490
|
-
* Failing over to a public endpoint recovers silently.
|
|
491
|
-
*/
|
|
492
|
-
/**
|
|
493
|
-
* Ordered public Starknet **mainnet** RPC endpoints (no API key required),
|
|
494
|
-
* used as fallback after an app's configured primary (e.g. Alchemy) returns a
|
|
495
|
-
* transient error. lava.build — RPC spec 0.8.1, permissive CORS — so it is
|
|
496
|
-
* safe for browser `baseFetch` use as well as server-side rotation.
|
|
497
|
-
*
|
|
498
|
-
* blastapi.io and free-rpc.nethermind.io were removed (2026-07-04) — long
|
|
499
|
-
* confirmed dead/unreliable in production; do not re-add them.
|
|
500
|
-
*/
|
|
501
389
|
declare const PUBLIC_RPC_FALLBACKS: readonly string[];
|
|
502
|
-
/**
|
|
503
|
-
* Is this RPC response worth retrying against another endpoint?
|
|
504
|
-
*
|
|
505
|
-
* Accepts either an HTTP status + raw text body (client `baseFetch` path) or a
|
|
506
|
-
* parsed JSON-RPC envelope (server proxy path). For parsed envelopes the
|
|
507
|
-
* server-defined error-code range (`-32099..-32000`) is treated as transient;
|
|
508
|
-
* for raw text only the explicit `-32001`/`-32603` codes + message hints match,
|
|
509
|
-
* so a `-32000` "Unauthorized" text body is never mistaken for transient.
|
|
510
|
-
*/
|
|
511
390
|
declare function isTransientRpcError(input: {
|
|
512
391
|
status?: number;
|
|
513
392
|
body?: unknown;
|
|
514
393
|
}): boolean;
|
|
515
394
|
interface FailoverFetchOptions {
|
|
516
|
-
/** Underlying fetch to wrap (e.g. one that adds a timeout). Defaults to the global `fetch`. */
|
|
517
395
|
baseFetch?: typeof fetch;
|
|
518
|
-
/** Invoked each time an endpoint is abandoned for the next one. */
|
|
519
396
|
onFailover?: (info: {
|
|
520
397
|
url: string;
|
|
521
398
|
status?: number;
|
|
522
399
|
error?: unknown;
|
|
523
400
|
}) => void;
|
|
524
401
|
}
|
|
525
|
-
/**
|
|
526
|
-
* Build a `fetch` suitable for `RpcProvider.baseFetch` that tries each URL in
|
|
527
|
-
* `urls` in order, advancing to the next only on a transient failure (network
|
|
528
|
-
* error, 5xx/429, or a transient JSON-RPC envelope). The provider's own
|
|
529
|
-
* `nodeUrl` argument is ignored — routing is controlled entirely by `urls` —
|
|
530
|
-
* so callers should set `nodeUrl: urls[0]` (used only for spec negotiation).
|
|
531
|
-
*
|
|
532
|
-
* @example
|
|
533
|
-
* const urls = [primaryAlchemyUrl, ...PUBLIC_RPC_FALLBACKS];
|
|
534
|
-
* new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
535
|
-
*/
|
|
536
402
|
declare function createFailoverFetch(urls: string[], options?: FailoverFetchOptions): typeof fetch;
|
|
537
403
|
|
|
538
|
-
/**
|
|
539
|
-
* Shared OpenSea-ERC721 + Berne-Convention metadata builder.
|
|
540
|
-
*
|
|
541
|
-
* Single source of truth for how a Medialane asset's metadata JSON is shaped.
|
|
542
|
-
* Pure function — no network calls, no FormData. Server-safe and chain-neutral.
|
|
543
|
-
*/
|
|
544
404
|
type AssetAttribute = {
|
|
545
405
|
trait_type: string;
|
|
546
406
|
value: string;
|
|
@@ -567,12 +427,10 @@ interface BuildAssetMetadataInput {
|
|
|
567
427
|
aiPolicy?: string | null;
|
|
568
428
|
royalty?: string | null;
|
|
569
429
|
edition?: string | null;
|
|
570
|
-
/** Already-extracted `tmpl_*` template/custom traits (reserved names are filtered here). */
|
|
571
430
|
templateTraits?: {
|
|
572
431
|
traitType: string;
|
|
573
432
|
value: string;
|
|
574
433
|
}[];
|
|
575
|
-
/** ISO date (YYYY-MM-DD) stamped as the Berne registration trait. Defaults to today. */
|
|
576
434
|
registrationDate?: string;
|
|
577
435
|
}
|
|
578
436
|
declare const RESERVED_TRAITS: Set<string>;
|