API Reference / loadMintedBody · function
Function: loadMintedBody()
function loadMintedBody(
engine,
certificateFile,
fetchFile): Promise<MintCertificate>;
Fetch a certificate and the pack it names, verify, and register the body.
fetchFile is called twice: with the certificate's file name and with the
pack's, which must be a plain file name beside it.
Parameters
| Parameter | Type | Description |
|---|---|---|
engine | Engine | The engine to register on. |
certificateFile | string | The certificate's file name, such as "eros.cert.json". |
fetchFile | MintFetch | Returns the contents of a file in the directory the certificate is published in. |
Returns
Promise<MintCertificate>
The certificate.
Example
const base = "https://example.org/minted/";
const cert = await loadMintedBody(engine, "eros.cert.json",
async (file) => (await fetch(base + file)).arrayBuffer());