Skip to content

Commit

Permalink
fix(warp, teleport) (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakorzhovnik authored May 13, 2024
1 parent e03c627 commit e4210dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
21 changes: 4 additions & 17 deletions src/containers/portal/components/avataIpfs/AvataImgIpfs.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
import { useQuery } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import styles from './styles.module.scss';
import useQueueIpfsContent from 'src/hooks/useQueueIpfsContent';
import cx from 'classnames';
import styles from './styles.module.scss';

const getRoboHashImage = (addressCyber: string) =>
`https://robohash.org/${addressCyber}`;

function AvataImgIpfs({ img = '', cidAvatar, addressCyber, ...props }) {
const { fetchWithDetails } = useQueueIpfsContent();

const [avatar, setAvatar] = useState<string | null>(null);
const { data } = useQuery(
const { data: avatar } = useQuery(
['getAvatar', cidAvatar],
async () => {
const response = await fetchWithDetails!(cidAvatar, 'image');
return response?.content || '';
const details = await fetchWithDetails!(cidAvatar, 'image');
return details?.content;
},

{
enabled: Boolean(fetchWithDetails && cidAvatar),
staleTime: 10 * (60 * 1000), // 10 mins
cacheTime: 15 * (60 * 1000), // 15 mins
retry: 0,
}
);

useEffect(() => {
if (!data) {
setAvatar(null);
} else {
setAvatar(data);
}
}, [data]);

const avatarImage =
avatar ||
(addressCyber && getRoboHashImage(addressCyber)) ||
Expand Down
8 changes: 4 additions & 4 deletions src/containers/warp/Warp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ function Warp() {
}, [setAdviser, tab]);

useEffect(() => {
const [{ coinDecimals }] = traseDenom(tokenA);
const [{ coinDecimals }] = tracesDenom(tokenA);
setTokenACoinDecimals(coinDecimals);
}, [traseDenom, tokenA]);
}, [tracesDenom, tokenA]);

useEffect(() => {
const [{ coinDecimals }] = traseDenom(tokenB);
const [{ coinDecimals }] = tracesDenom(tokenB);
setTokenBCoinDecimals(coinDecimals);
}, [traseDenom, tokenB]);
}, [tracesDenom, tokenB]);

useEffect(() => {
if (firstEffectOccured.current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const defaultData = [
},
{
token:
'ibc/B6CAD3F7469F3FAD18ED2230A6C7B15E654AB2E1B66E1C70879C04FEF874A863',
networkFrom: 'gravity-bridge-3',
'ibc/13B2C536BB057AC79D5616B8EA1B9540EC1F2170718CAFF6F0083C966FFFED0B',
networkFrom: 'osmosis-1',
networkTo: 'bostrom',
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const reverse = (value: boolean) => ({
const defaultPairPoolId: DefaultPairPoolIdObj = {
12: reverse(true),

19: reverse(true),
7: reverse(true),

5: reverse(false),

Expand Down

0 comments on commit e4210dd

Please sign in to comment.