mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* Show NFT image for token transfers Fixes #2547 * rewrite logic of loading NFT media * make amends to NftEntity * show original media size only in the modal * immutable envs * tests * fix fallback condition * fixes * fix one more test * Removing blockscout-ci-cd from helm repo --------- Co-authored-by: Nick Zenchik <[email protected]>
17 lines
431 B
TypeScript
17 lines
431 B
TypeScript
import { verifiedFetch } from '@helia/verified-fetch';
|
|
import React from 'react';
|
|
|
|
export default function useLoadImageViaIpfs() {
|
|
return React.useCallback(async(url: string) => {
|
|
const response = await verifiedFetch(url);
|
|
|
|
if (response.status !== 200) {
|
|
throw new Error('Failed to load image');
|
|
}
|
|
|
|
const blob = await response.blob();
|
|
const src = URL.createObjectURL(blob);
|
|
return src;
|
|
}, [ ]);
|
|
}
|