Skip to content

Commit

Permalink
profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
kevtechi committed Oct 26, 2024
1 parent 650b28e commit 86aadeb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./config/index.ts";
export * from "./constants/networks.ts";
export * from "./profiles/index.ts";
31 changes: 31 additions & 0 deletions src/profiles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface Profile {
account: string;
description: string;
image: string;
image_medium: string;
image_small: string;
name: string;
username: string;
}

export const formatProfileImageLinks = (ipfsUrl: string, profile: Profile) => {
if (profile.image_small.startsWith("ipfs://")) {
profile.image_small = `${ipfsUrl}/${profile.image_small.replace(
"ipfs://",
""
)}`;
}

if (profile.image_medium.startsWith("ipfs://")) {
profile.image_medium = `${ipfsUrl}/${profile.image_medium.replace(
"ipfs://",
""
)}`;
}

if (profile.image.startsWith("ipfs://")) {
profile.image = `${ipfsUrl}/${profile.image.replace("ipfs://", "")}`;
}

return profile;
};

0 comments on commit 86aadeb

Please sign in to comment.