@citizenwallet/sdk
Version:
An sdk to easily work with citizen wallet.
18 lines (14 loc) • 340 B
text/typescript
import dotenv from "dotenv";
dotenv.config();
export const downloadJsonFromIpfs = async <T>(
ipfsDomain: string,
uri: string
): Promise<T> => {
let url = uri;
if (!url.startsWith("http")) {
url = `https://${ipfsDomain}/${url}`;
}
const response = await fetch(url);
const json = await response.json();
return json;
};