diff --git a/cashtab/src/components/Alias/Alias.js b/cashtab/src/components/Alias/Alias.js
--- a/cashtab/src/components/Alias/Alias.js
+++ b/cashtab/src/components/Alias/Alias.js
@@ -3,7 +3,10 @@
import { WalletContext } from 'utils/context';
import PropTypes from 'prop-types';
import { SidePaddingCtn, AlertMsg } from 'components/Common/Atoms';
-import { PendingAliasWarningIcon } from 'components/Common/CustomIcons';
+import {
+ PendingAliasWarningIcon,
+ ThemedUserProfileIcon,
+} from 'components/Common/CustomIcons';
import {
AntdFormWrapper,
AliasInput,
@@ -11,15 +14,11 @@
CashtabCheckbox,
} from 'components/Common/EnhancedInputs';
import { AliasRegisterIcon } from 'components/Common/CustomIcons';
-import { Form, Modal } from 'antd';
+import { Form, Modal, notification } from 'antd';
import { SmartButton } from 'components/Common/PrimaryButton';
import { Row, Col } from 'antd';
import { getWalletState } from 'utils/cashMethods';
import { toXec } from 'wallet';
-import {
- errorNotification,
- registerAliasNotification,
-} from 'components/Common/Notifications';
import { meetsAliasSpec } from 'validation';
import { queryAliasServer } from 'utils/aliasUtils';
import cashaddr from 'ecashaddrjs';
@@ -117,7 +116,18 @@
// Refresh alias prices if none exist yet
if (aliasPrices === null) {
- setAliasPrices(await queryAliasServer('prices'));
+ try {
+ setAliasPrices(await queryAliasServer('prices'));
+ } catch (err) {
+ const errorMsg = `Error retrieving alias pricing`;
+ notification.error({
+ message: 'Error',
+ description: errorMsg + ` - ${err}`,
+ });
+ setAliasServerError(errorMsg);
+ passLoadingStatus(false);
+ return;
+ }
}
// Track when the user stops typing into the aliasName input field for at least
@@ -143,7 +153,10 @@
}
} catch (err) {
const errorMsg = 'Error retrieving alias status';
- errorNotification(null, errorMsg);
+ notification.error({
+ message: 'Error',
+ description: errorMsg,
+ });
setIsValidAliasInput(false);
setAliasServerError(errorMsg);
passLoadingStatus(false);
@@ -217,7 +230,10 @@
} catch (err) {
const errorMsg = 'Error retrieving alias details';
console.log(`preparePreviewModal(): ${errorMsg}`, err);
- errorNotification(null, errorMsg);
+ notification.error({
+ message: 'Error',
+ description: errorMsg,
+ });
setIsValidAliasInput(false);
setAliasServerError(errorMsg);
passLoadingStatus(false);
@@ -235,19 +251,22 @@
setIsModalVisible(true);
} else if (aliasDetailsResp && aliasDetailsResp.address) {
// If alias is registered
- errorNotification(
- null,
- 'This alias [' +
+ notification.error({
+ message: 'Error',
+ description:
+ 'This alias [' +
formData.aliasName +
`] is already owned by ${aliasDetailsResp.address}, please try another alias`,
- 'Alias availability check',
- );
+ });
setAliasDetails(false);
} else {
const errorMsg =
'Unable to retrieve alias info, please try again later';
setAliasServerError(errorMsg);
- errorNotification(null, errorMsg);
+ notification.error({
+ message: 'Error',
+ description: errorMsg,
+ });
setAliasDetails(false);
}
passLoadingStatus(false);
@@ -300,10 +319,20 @@
appConfig.defaultFee,
);
clearInputForms();
- registerAliasNotification(
- `${explorer.blockExplorerUrl}/tx/${txObj.response.txid}`,
- aliasInput,
- );
+ notification.success({
+ message: 'Success',
+ description: (
+
+ Alias `{aliasInput}` registration pending 1
+ confirmation.
+
+ ),
+ icon: ,
+ });
// Append the newly broadcasted alias registration to pending list to
// ensure the alias refresh interval is running in useWallet.js
setAliases(previousAliases => ({
@@ -317,18 +346,21 @@
],
}));
} catch (err) {
- errorNotification(err, err.message, 'Registering Alias');
+ notification.error({
+ message: 'Error',
+ description: err.message,
+ });
}
setIsValidAliasInput(true);
} else {
// error notification on alias being unavailable
- errorNotification(
- null,
- 'This alias [' +
+ notification.error({
+ message: 'Error',
+ description:
+ 'This alias [' +
aliasInput +
'] has already been taken, please try another alias',
- 'Alias availability check',
- );
+ });
}
passLoadingStatus(false);
};
@@ -520,7 +552,8 @@
);
if (
aliasLength > 0 &&
- isValidAliasInput
+ isValidAliasInput &&
+ aliasPrices !== null
) {
// Disable alias registration if the array is not exactly one entry
if (
diff --git a/cashtab/src/components/Common/Notifications.js b/cashtab/src/components/Common/Notifications.js
--- a/cashtab/src/components/Common/Notifications.js
+++ b/cashtab/src/components/Common/Notifications.js
@@ -2,25 +2,11 @@
import { notification } from 'antd';
import {
CashReceivedNotificationIcon,
- ThemedUserProfileIcon,
TokenNotificationIcon,
} from 'components/Common/CustomIcons';
import { supportedFiatCurrencies } from 'config/cashtabSettings';
import appConfig from 'config/app';
-const registerAliasNotification = (link, alias) => {
- notification.success({
- message: 'Success',
- description: (
-
- Alias `{alias}` registration pending 1 confirmation.
-
- ),
- duration: appConfig.notificationDurationShort,
- icon: ,
- });
-};
-
const xecReceivedNotification = (
balances,
previousBalances,
@@ -114,7 +100,6 @@
};
export {
- registerAliasNotification,
xecReceivedNotification,
xecReceivedNotificationWebsocket,
eTokenReceivedNotification,