Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: total value and assets #988

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#988](https://github.com/alleslabs/celatone-frontend/pull/988) Fix total asset value and assets in json
- [#984](https://github.com/alleslabs/celatone-frontend/pull/984) Exclude non block number from searching block in lite
- [#974](https://github.com/alleslabs/celatone-frontend/pull/974) Fix tx by account addr lcd to support new cosmos sdk
- [#976](https://github.com/alleslabs/celatone-frontend/pull/976) Support save accounts in lite version
Expand Down
19 changes: 15 additions & 4 deletions src/lib/hooks/useOpenTab.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { useCallback } from "react";

import { useBaseApiRoute, useCelatoneApp } from "lib/app-provider";
import {
useBaseApiRoute,
useCelatoneApp,
useLcdEndpoint,
useTierConfig,
} from "lib/app-provider";
import type { Option } from "lib/types";
import { openNewTab } from "lib/utils";

Expand All @@ -18,13 +23,19 @@ export const useOpenTxTab = (type: "lcd" | "tx-page") => {
};

export const useOpenAssetTab = () => {
const endpoint = useBaseApiRoute("accounts");
const isFullTier = useTierConfig() === "full";
const apiEndpoint = useBaseApiRoute("accounts");
const lcdEndpoint = useLcdEndpoint();

return useCallback(
(walletAddr: string) => {
openNewTab(`${endpoint}/${walletAddr}/balances`);
openNewTab(
isFullTier
? `${apiEndpoint}/${walletAddr}/balances`
: `${lcdEndpoint}/cosmos/bank/v1beta1/balances/${walletAddr}?pagination.limit=1000`
);
},
[endpoint]
[apiEndpoint, isFullTier, lcdEndpoint]
);
};

Expand Down
5 changes: 2 additions & 3 deletions src/lib/services/distribution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ export const useCommissionsByValidatorAddressLcd = (
valAddr,
],
() => {
if (isUndefined(valAddr))
throw new Error("Validator address is undefined");
if (isUndefined(valAddr)) return { commission: [] };
return getCommissionsByValidatorAddressLcd(endpoint, valAddr);
},
{
enabled: enabled && gov.enabled && !isUndefined(valAddr),
enabled: enabled && gov.enabled,
refetchOnWindowFocus: false,
}
);
Expand Down
Loading