MarketplaceBundle¶
Namespace Nfty.Core.Publish in assembly Nfty.Core.
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)¶
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)¶
Reads a bundle.
Parameters
path(string) - A bundle folder, or a packed.setwithoutset.json.
Returns. The bundle; the caller disposes it.
Exceptions
CorruptSetException-pathis not an upload bundle.
ResolveImage(string, string)¶
Finds the picture an item's image field names, inside the bundle.
Parameters
root(string) - The bundle folder.imageField(string) - The metadata'simagevalue.
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)¶
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'sanimation_urlvalue.
Returns. The full path of a file that exists inside root, or null.