@chillwhales/lsp3
v0.1.3
Published
LSP3 Universal Profile Metadata — schemas, types, and utilities for profile metadata on LUKSO
Readme
@chillwhales/lsp3
LSP3 Universal Profile Metadata — schemas, types, and utilities for reading and validating profile metadata on LUKSO.
Install
pnpm add @chillwhales/lsp3Usage
import {
lsp3ProfileSchema,
getProfileDisplayName,
getProfileImageUrl,
} from "@chillwhales/lsp3";
// Validate raw profile metadata fetched from IPFS / on-chain
const raw = {
name: "Alice",
description: "Builder on LUKSO",
tags: ["developer"],
links: [{ title: "Website", url: "https://alice.dev" }],
avatar: [],
profileImage: [{ url: "ipfs://QmImg...", width: 256, height: 256 }],
backgroundImage: [],
};
const profile = lsp3ProfileSchema.parse(raw);
// Extract display-ready values
const name = getProfileDisplayName(profile); // "Alice"
const imageUrl = getProfileImageUrl(profile, (url) =>
url.replace("ipfs://", "https://api.universalprofile.cloud/ipfs/"),
);API
Types are exported and available in your editor via TypeScript IntelliSense.
