Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ export const ChooseAsset = ({
/>
)}
</div>
<div className="ChooseAsset__button">
<Link to={ROUTES.searchAsset}>
<Button fullWidth variant={Button.variant.tertiary}>
{t("Add another asset")}
</Button>
</Link>
</div>
{!selectingAssetType && (
<div className="ChooseAsset__button">
<Link to={ROUTES.searchAsset}>
<Button fullWidth variant={Button.variant.tertiary}>
{t("Add another asset")}
</Button>
</Link>
</div>
)}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove the Add Another Asset btn if we're choosing an asset in a path payment

</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,27 @@ export const ManageAssetRows = ({
.build()
.toXDR();

const trackChangeTrustline = () => {
emitMetric(
addTrustline
? METRIC_NAMES.manageAssetAddAsset
: METRIC_NAMES.manageAssetRemoveAsset,
{ assetCode, assetIssuer },
);
};

if (isHardwareWallet) {
await dispatch(startHwSign({ transactionXDR }));
trackChangeTrustline();
} else {
await signAndSubmit(transactionXDR);
dispatch(resetSubmission());
navigateTo(ROUTES.account);
await signAndSubmit(transactionXDR, trackChangeTrustline);
}
emitMetric(
addTrustline
? METRIC_NAMES.manageAssetAddAsset
: METRIC_NAMES.manageAssetRemoveAsset,
{ assetCode, assetIssuer },
);
};

const signAndSubmit = async (transactionXDR: string) => {
const signAndSubmit = async (
transactionXDR: string,
trackChangeTrustline: () => void,
) => {
const res = await dispatch(
signFreighterTransaction({
transactionXDR,
Expand All @@ -138,6 +143,14 @@ export const ManageAssetRows = ({
networkDetails,
}),
);
trackChangeTrustline();
dispatch(resetSubmission());
navigateTo(ROUTES.account);
}

if (submitFreighterTransaction.rejected.match(submitResp)) {
setErrorAsset(assetSubmitting);
navigateTo(ROUTES.trustlineError);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Handling a trustline error fell off in this release. Restoring it and refactor a bit to track properly

}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,10 @@ export const SendAmount = ({
<div className="SendAmount__btn-continue">
<Button
disabled={
loadingRate || formik.values.amount === "0" || !formik.isValid
loadingRate ||
formik.values.amount === "0" ||
!formik.isValid ||
!destinationAmount

@piyalbasu piyalbasu Jul 12, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just noticed this bug: in a path payment, if there's no path available (for ex: using SRT in testnet), it still allows you to continue. Let's disable that bc the it will fail when you try to submit anyway

}
fullWidth
variant={Button.variant.tertiary}
Expand Down
2 changes: 1 addition & 1 deletion extension/src/popup/views/PinExtension/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const PinExtension = () => {
<img src={ExtensionsMenu} alt="Extensions Menu" />
</div>
<div className="PinExtension__caption">
2. {t("Click on Freighter’s pin button to have it always visibile")}
2. {t("Click on Freighter’s pin button to have it always visible")}
</div>
<div className="PinExtension__img">
<img src={ExtensionsPin} alt="Extensions Pin" />
Expand Down
24 changes: 17 additions & 7 deletions extension/src/popup/views/RecoverAccount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { useTranslation } from "react-i18next";

import { Button } from "popup/basics/buttons/Button";
import { Onboarding } from "popup/components/Onboarding";
import { FormError, FormRows, SubmitButtonWrapper } from "popup/basics/Forms";
import { FullscreenStyle } from "popup/components/FullscreenStyle";
import { Header } from "popup/components/Header";
import { PasswordRequirements } from "popup/components/PasswordRequirements";

import { ROUTES } from "popup/constants/routes";
import { navigateTo } from "popup/helpers/navigate";
import {
Expand All @@ -19,10 +24,6 @@ import {
publicKeySelector,
recoverAccount,
} from "popup/ducks/accountServices";
import { FormRows, SubmitButtonWrapper } from "popup/basics/Forms";
import { FullscreenStyle } from "popup/components/FullscreenStyle";
import { Header } from "popup/components/Header";
import { PasswordRequirements } from "popup/components/PasswordRequirements";

import "./styles.scss";

Expand Down Expand Up @@ -65,6 +66,9 @@ const PhraseInput = ({
);
};

const buildMnemonicPhrase = (mnemonicPhraseArr: string[]) =>
mnemonicPhraseArr.join(" ").trim();

export const RecoverAccount = () => {
interface FormValues {
password: string;
Expand Down Expand Up @@ -99,7 +103,7 @@ export const RecoverAccount = () => {
await dispatch(
recoverAccount({
password,
mnemonicPhrase: mnemonicPhraseArr.join(" ").trim(),
mnemonicPhrase: buildMnemonicPhrase(mnemonicPhraseArr),
}),
);
};
Expand Down Expand Up @@ -157,7 +161,7 @@ export const RecoverAccount = () => {
/>
))}
</div>
<div>{authError}</div>
<FormError>{authError}</FormError>
</div>
<div className="RecoverAccount__half-screen">
<FormRows>
Expand Down Expand Up @@ -218,7 +222,13 @@ export const RecoverAccount = () => {
<Button
fullWidth
isLoading={isSubmitting}
disabled={!(dirty && isValid)}
disabled={
!(
dirty &&
isValid &&
buildMnemonicPhrase(mnemonicPhraseArr).length

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When Recovering using a mnemonic phrase, we need to manually check that the user has entered a phrase bc these are custom fields now, not Formik

)
}
>
{t("IMPORT")}
</Button>
Expand Down