Skip to content

MarketplaceBundle

Namespace Nfty.Core.Publish in assembly Nfty.Core.

public static class MarketplaceBundle

Recognizes and reads a marketplace upload bundle: images/ and metadata/ (and optionally collection.json) with no set.json. It is NOT a Set - it records no seed, no rarity and no DNA - so it is opened read-only, to check what is about to be uploaded.

Remarks

The test is exact, not a guess at arbitrary folders. A folder or .set archive is a bundle when it has NO set.json, has a metadata/ folder, and the first file in that folder (ordinal order) is a JSON object with a string name, a string image and an attributes array - OpenSea's item shape. Anything else is not claimed.

Images resolve inside the bundle, never over the network. A relative image is a path in the bundle; an absolute link (ipfs://, https://) is mapped by its trailing FILE NAME (ipfs://CID/1.png, what an export with an image base URI writes) - or by a trailing images/<file> - onto the bundle's own images/ folder, which is where the bundle will be uploaded from.

Methods

IsBundle(string)

public static bool IsBundle(string path);

Whether path is an upload bundle: a folder, or a packed .set.

Parameters

  • path (string) - The path to test.

Returns. True under the rule in the type's remarks.

Read(string)

public static LoadedBundle Read(string path);

Reads a bundle.

Parameters

  • path (string) - A bundle folder, or a packed .set without set.json.

Returns. The bundle; the caller disposes it.

Exceptions

ResolveImage(string, string)

public static string? ResolveImage(string root, string imageField);

Finds the picture an item's image field names, inside the bundle.

Parameters

  • root (string) - The bundle folder.
  • imageField (string) - The metadata's image value.

Returns. The full path of a file that exists inside root, or null. Nothing is fetched: a link with a scheme (ipfs://, https://) is mapped by its trailing file name (or images/<file>) onto the bundle's own images/ folder.

ResolveModel(string, string)

public static string? ResolveModel(string root, string animationUrl);

Finds the model an item's animation_url names, inside the bundle: the same rule as MarketplaceBundle.ResolveImage(), onto the bundle's own models/ folder.

Parameters

  • root (string) - The bundle folder.
  • animationUrl (string) - The metadata's animation_url value.

Returns. The full path of a file that exists inside root, or null.