Skip to content

Commit

Permalink
Extension - address feedback (#1016)
Browse files Browse the repository at this point in the history
* fix: remove extension chain query, only use indexer chain ID

* fix: lengthen keys in ViewKeys component
  • Loading branch information
jurevans authored Aug 21, 2024
1 parent 12eb4c4 commit d7d0a78
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
1 change: 1 addition & 0 deletions apps/extension/src/App/Accounts/ViewAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const ViewAccount = (): JSX.Element => {
publicKeyAddress={parentAccount.publicKey ?? ""}
transparentAccountAddress={transparentAddress}
shieldedAccountAddress={shieldedAddress}
trimCharacters={21}
/>
</Stack>
<ActionButton size="md" onClick={() => navigate(-1)}>
Expand Down
1 change: 1 addition & 0 deletions apps/extension/src/Setup/Common/Completion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const Completion: React.FC<Props> = (props) => {
publicKeyAddress={publicKeyAddress}
transparentAccountAddress={transparentAccountAddress}
shieldedAccountAddress={shieldedAccountAddress}
trimCharacters={35}
footer={
<ActionButton
size="lg"
Expand Down
17 changes: 2 additions & 15 deletions apps/namadillo/src/atoms/chain/atoms.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import namada from "@namada/chains/chains/namada";
import { integrations } from "@namada/integrations";
import { indexerApiAtom } from "atoms/api";
import {
defaultServerConfigAtom,
indexerUrlAtom,
namadaExtensionConnectedAtom,
rpcUrlAtom,
} from "atoms/settings";
import { queryDependentFn } from "atoms/utils";
Expand All @@ -18,31 +16,20 @@ export const chainAtom = atomWithQuery<ChainSettings>((get) => {
const rpcUrl = get(rpcUrlAtom);
const indexerUrl = get(indexerUrlAtom);
const tomlConfig = get(defaultServerConfigAtom);
const extensionConnected = get(namadaExtensionConnectedAtom);

return {
queryKey: [
"chain",
rpcUrl,
chainParameters,
indexerRpcUrl,
extensionConnected,
],
queryKey: ["chain", rpcUrl, chainParameters, indexerRpcUrl],
staleTime: Infinity,
retry: false,
...queryDependentFn(async () => {
const rpcUrl = get(rpcUrlAtom);
const extensionChainId =
extensionConnected ?
(await integrations.namada.getChain())?.chainId
: "";

return {
id: namada.id,
extensionId: namada.extension.id,
bench32Prefix: namada.bech32Prefix,
rpcUrl,
chainId: extensionChainId || chainParameters.data!.chainId,
chainId: chainParameters.data!.chainId,
unbondingPeriodInEpochs:
chainParameters.data!.epochInfo.unbondingPeriodInEpochs,
nativeTokenAddress: chainParameters.data!.nativeTokenAddress,
Expand Down
14 changes: 11 additions & 3 deletions packages/components/src/ViewKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type ViewKeysProps = {
shieldedAccountAddress?: string;
viewingKeys?: string;
footer?: React.ReactNode;
trimCharacters?: number;
};

export const ViewKeys = ({
Expand All @@ -17,6 +18,7 @@ export const ViewKeys = ({
shieldedAccountAddress,
viewingKeys,
footer,
trimCharacters = 16,
}: ViewKeysProps): JSX.Element => {
return (
<Stack
Expand All @@ -29,7 +31,10 @@ export const ViewKeys = ({
<Input
label="Your Transparent Address"
variant="ReadOnlyCopy"
valueToDisplay={shortenAddress(transparentAccountAddress, 16)}
valueToDisplay={shortenAddress(
transparentAccountAddress,
trimCharacters
)}
value={transparentAccountAddress}
theme={"primary"}
/>
Expand All @@ -38,7 +43,7 @@ export const ViewKeys = ({
<Input
label="Public Key"
variant="ReadOnlyCopy"
valueToDisplay={shortenAddress(publicKeyAddress, 16)}
valueToDisplay={shortenAddress(publicKeyAddress, trimCharacters)}
value={publicKeyAddress}
theme={"primary"}
/>
Expand All @@ -48,7 +53,10 @@ export const ViewKeys = ({
label="Your Shielded Address"
variant="ReadOnlyCopy"
readOnly={true}
valueToDisplay={shortenAddress(shieldedAccountAddress, 16)}
valueToDisplay={shortenAddress(
shieldedAccountAddress,
trimCharacters
)}
value={shieldedAccountAddress}
theme={"secondary"}
/>
Expand Down

0 comments on commit d7d0a78

Please sign in to comment.