Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import { CHAIN } from "@hey/data/constants";
2import { ERRORS } from "@hey/data/errors";
3import { immutable } from "@lens-chain/storage-client";
4import { storageClient } from "./storageClient";
5
6interface MetadataPayload {
7 [key: string]: unknown;
8}
9
10const uploadMetadata = async (
11 data: MetadataPayload | null
12): Promise<string> => {
13 try {
14 const { uri } = await storageClient.uploadAsJson(data, {
15 acl: immutable(CHAIN.id)
16 });
17
18 return uri;
19 } catch {
20 throw new Error(ERRORS.SomethingWentWrong);
21 }
22};
23
24export default uploadMetadata;