estaminet
Version:
A set of WebComponents building on top of Statemint family of Polkadot parachains
16 lines (15 loc) • 466 B
text/typescript
export function url(data: string): string | undefined {
// https://gateway.pinata.cloud/ipfs/
// https://ipfs.pixura.io/ipfs/
const hash = extractHash(data);
if (hash) {
return `https://gateway.pinata.cloud/ipfs/${hash}`;
}
}
/**
* @param uri
* @returns a IPFS hash from a data chunk (IPFS URI (e.g. ipfs://ipfs/Qm..), hash code)
*/
export function extractHash(data: string): string | undefined {
return data.split("/").at(-1);
}