Skip to content

Commit

Permalink
Merge pull request #571 from alleslabs/fix/only-native-funds-for-main
Browse files Browse the repository at this point in the history
Use native funds in select funds(to main branch)
  • Loading branch information
evilpeach committed Oct 16, 2023
2 parents 689d426 + b8a7e5e commit 8838302
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#570](https://github.com/alleslabs/celatone-frontend/pull/570) Use native tokens in attached funds
- [#567](https://github.com/alleslabs/celatone-frontend/pull/567) Fix attached funds in code snippet
- [#539](https://github.com/alleslabs/celatone-frontend/pull/539) Fix JSON schema upload text
- [#527](https://github.com/alleslabs/celatone-frontend/pull/527) Fix ellipsis explorer link
Expand Down
3 changes: 0 additions & 3 deletions src/lib/app-provider/hooks/useBaseApiRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const useBaseApiRoute = (
| "rest"
| "icns_names"
| "icns_address"
| "native_tokens"
| "cosmwasm"
): string => {
const {
Expand Down Expand Up @@ -49,8 +48,6 @@ export const useBaseApiRoute = (
return `${api}/icns/names`;
case "icns_address":
return `${api}/icns/address`;
case "native_tokens":
return `${api}/native-assets/${chain}/${currentChainId}`;
case "cosmwasm":
return `${api}/cosmwasm/${chain}/${currentChainId}`;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/fund/selectFund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const SelectFund = ({
assetsSelect,
labelBgColor,
}: SelectFundProps) => {
const { data: assetInfos = [] } = useAssetInfoList();
const { data: assetInfos = [] } = useAssetInfoList({ assetType: "native" });
const { fields, append, remove } = useFieldArray({
control,
name: ASSETS_SELECT,
Expand Down
24 changes: 11 additions & 13 deletions src/lib/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@ export const useAssetInfos = ({
};
};

export const useAssetInfoList = () => {
const assetsApiRoute = useBaseApiRoute("assets");
return useQuery(
[CELATONE_QUERY_KEYS.ASSET_INFO_LIST, assetsApiRoute],
async () => getAssetInfosWithoutPricesPath(assetsApiRoute),
{ enabled: Boolean(assetsApiRoute), retry: 1, refetchOnWindowFocus: false }
export const useAssetInfoList = ({
assetType,
}: {
assetType: "all" | "native" | "cw20";
}) => {
const assetsApiRoute = useBaseApiRoute("assets").concat(
assetType !== "all" ? `/type/${assetType}` : ""
);
};

export const useNativeTokensInfo = () => {
const nativeTokensApiRoute = useBaseApiRoute("native_tokens");

return useQuery(
[CELATONE_QUERY_KEYS.NATIVE_TOKENS_INFO, nativeTokensApiRoute],
async () => getAssetInfosWithoutPricesPath(nativeTokensApiRoute),
[CELATONE_QUERY_KEYS.ASSET_INFO_LIST, assetsApiRoute],
async () => getAssetInfosWithoutPricesPath(assetsApiRoute),
{
enabled: Boolean(nativeTokensApiRoute),
enabled: Boolean(assetsApiRoute),
retry: 1,
refetchOnWindowFocus: false,
}
);
Expand Down

4 comments on commit 8838302

@vercel
Copy link

@vercel vercel bot commented on 8838302 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8838302 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8838302 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8838302 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.