-
- {hideChainDropdown ? null : (
-
-
- {chainStore.getChain(selectedChainId).chainName}
-
-
- {chainStore.chainInfos.map((chainInfo) => {
- return (
- {
- setSelectedChainId(chainInfo.chainId);
- }}
- >
- {chainInfo.chainName}
-
- );
- })}
-
-
- )}
-
-
-
{
- e.preventDefault();
- e.stopPropagation();
-
- setAddAddressModalOpen(true);
+ {loading ? (
+ Loading ....
+ ) : (
+
+
+ {hideChainDropdown ? null : (
+
+
+ {chainStore.getChain(selectedChainId).chainName}
+
+
+ {chainStore.chainInfos.map((chainInfo) => {
+ return (
+ {
+ setSelectedChainId(chainInfo.chainId);
+ }}
+ >
+ {chainInfo.chainName}
+
+ );
+ })}
+
+
+ )}
+
+
-
-
-
-
-
-
- {addressBookConfig.addressBookDatas.map((data, i) => {
- return (
-
{
e.preventDefault();
e.stopPropagation();
- addressBookConfig.selectAddressAt(i);
-
- if (onBackButton) {
- onBackButton();
- }
+ setAddAddressModalOpen(true);
}}
- style={{ cursor: selectHandler ? undefined : "auto" }}
- />
- );
- })}
+ >
+
+
+
+
+
+
+ {addressBookConfig.addressBookDatas.map((data, i) => {
+ return (
+
{
+ e.preventDefault();
+ e.stopPropagation();
+ addressBookConfig.selectAddressAt(i);
+
+ if (onBackButton) {
+ onBackButton();
+ }
+ }}
+ style={{ cursor: selectHandler ? undefined : "auto" }}
+ />
+ );
+ })}
+
-
+ )}
);
}
diff --git a/packages/extension/src/pages/setting/address-book/style.module.scss b/packages/extension/src/pages/setting/address-book/style.module.scss
index 66c4eeb56e..74e30ef89a 100644
--- a/packages/extension/src/pages/setting/address-book/style.module.scss
+++ b/packages/extension/src/pages/setting/address-book/style.module.scss
@@ -20,3 +20,9 @@
box-shadow: none;
}
}
+.loader {
+ text-align: center;
+ color: #808da0;
+ font-size: 18px;
+ padding-top: 15px;
+}
diff --git a/packages/extension/src/pages/setting/chat/block/index.tsx b/packages/extension/src/pages/setting/chat/block/index.tsx
new file mode 100644
index 0000000000..ead76012dd
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/block/index.tsx
@@ -0,0 +1,118 @@
+import { ExtensionKVStore } from "@keplr-wallet/common";
+import { useAddressBookConfig } from "@keplr-wallet/hooks";
+import { observer } from "mobx-react-lite";
+import React, { FunctionComponent, useState } from "react";
+import { useIntl } from "react-intl";
+import { useSelector } from "react-redux";
+import { useHistory } from "react-router";
+import { userBlockedAddresses } from "../../../../chatStore/messages-slice";
+import { HeaderLayout } from "../../../../layouts";
+import { useStore } from "../../../../stores";
+import { formatAddress } from "../../../../utils/format";
+import { NameAddress } from "../../../chat/users";
+import style from "./style.module.scss";
+import { UnblockUserPopup } from "./unblock-user-popup";
+
+export const BlockList: FunctionComponent = observer(() => {
+ // const language = useLanguage();
+ const blockedAddresses = useSelector(userBlockedAddresses);
+ const history = useHistory();
+ const intl = useIntl();
+ const { chainStore } = useStore();
+
+ const addressBookConfig = useAddressBookConfig(
+ new ExtensionKVStore("address-book"),
+ chainStore,
+ chainStore.current.chainId,
+ {
+ setRecipient: (): void => {
+ // noop
+ },
+ setMemo: (): void => {
+ // noop
+ },
+ }
+ );
+
+ const addresses = addressBookConfig.addressBookDatas.map(
+ (data: NameAddress) => {
+ return { name: data.name, address: data.address };
+ }
+ );
+ return (
+
{
+ history.goBack();
+ }}
+ >
+
+
+ );
+});
+
+const BlockAddresses: React.FC<{
+ addresses: NameAddress[];
+ blockedAddresses: { [key: string]: boolean };
+}> = ({ addresses, blockedAddresses }) => {
+ const [confirmAction, setConfirmAction] = useState
(false);
+ const [userName, setUserName] = useState("");
+
+ return (
+
+ {confirmAction && (
+
+ )}
+
+ {Object.keys(blockedAddresses).filter(
+ (contact) => blockedAddresses[contact]
+ ).length ? (
+ Object.keys(blockedAddresses)
+ .filter((contact) => blockedAddresses[contact])
+ .map((contact) => {
+ const contactName =
+ addresses.find((entry) => entry.address === contact)?.name ||
+ formatAddress(contact);
+ return (
+
+
+ {contactName.charAt(0).toUpperCase()}
+
+
+
+
{
+ setUserName(contact);
+ setConfirmAction(true);
+ }}
+ />
+
+
+ );
+ })
+ ) : (
+
+ )}
+
+
+ );
+};
diff --git a/packages/extension/src/pages/setting/chat/block/style.module.scss b/packages/extension/src/pages/setting/chat/block/style.module.scss
new file mode 100644
index 0000000000..98871d290f
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/block/style.module.scss
@@ -0,0 +1,146 @@
+@import "../../../../styles/var";
+
+.container {
+ margin: 0 calc(#{$layout-padding} * -1) calc(#{$layout-padding} * -1);
+
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 1;
+ height: 531px;
+ width: 100%;
+ background: black;
+ opacity: 0.5;
+}
+
+.chatContainer {
+ padding: 10px 0 20px 0;
+ background-color: #fff;
+ // border-radius: 5px;
+ margin-left: -10px;
+ margin-right: -10px;
+ border-top: #e9ecef solid 1px;
+
+ .messagesContainer {
+ // margin-top: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+
+ .messageContainer {
+ display: flex;
+ // justify-content: space-between;
+ align-items: center;
+ padding: 0 12px;
+ margin-top: 10px;
+ cursor: pointer;
+
+ .initials {
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ background-color: #d0def5;
+ color: #525f7f;
+ margin-right: 8px;
+ font-weight: 400;
+ font-size: 15px;
+ line-height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ }
+
+ .messageInner {
+ width: 80%;
+
+ .name {
+ font-weight: 400;
+ font-size: 15px;
+ color: #525f7f;
+ height: 20px;
+ }
+ }
+ }
+ }
+}
+
+.popup {
+ width: 310px;
+ position: absolute;
+ border: solid #dee2e6 1px;
+ background-color: #ffffff;
+ margin: 20px 15px;
+ border-radius: 15px;
+ padding-bottom: 10px;
+ cursor: pointer;
+ top: 30%;
+ z-index: 2;
+
+ // display: flex;
+ // flex-direction: column;
+ // padding: 0px 20px;
+ h4 {
+ // border-bottom: solid #DEE2E6 2px;
+ padding: 0 20px 10px 20px;
+ color: #525f7f;
+ margin: 10px 0 0 0;
+ font-size: 18px;
+ }
+
+ .textContainer {
+ text-align: left;
+ padding: 0 15px;
+ font-size: 14px;
+ color: #808da0;
+ width: 280px;
+
+ label {
+ margin-left: 10px;
+ }
+ }
+
+ .header {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ border-bottom: solid #dee2e6 2px;
+ align-items: center;
+
+ img {
+ width: 8px;
+ height: 8px;
+ margin-right: 20px;
+ cursor: pointer;
+ }
+ }
+}
+
+.buttonContainer {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+ padding: 10px;
+ border-top: solid #dee2e6 2px;
+
+ button {
+ margin-left: 8px;
+ padding: 5px 10px;
+ border: solid #3b82f6 1px;
+ border-radius: 5px;
+ color: #3b82f6;
+ background-color: #ffffff;
+ cursor: pointer;
+ }
+
+ .btn {
+ color: #ffffff;
+ background-color: #3b82f6;
+ }
+}
diff --git a/packages/extension/src/pages/setting/chat/block/unblock-user-popup.tsx b/packages/extension/src/pages/setting/chat/block/unblock-user-popup.tsx
new file mode 100644
index 0000000000..c58ffb49e0
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/block/unblock-user-popup.tsx
@@ -0,0 +1,57 @@
+import React, { useState } from "react";
+import { unblockUser } from "../../../../graphQL/messages-api";
+import style from "./style.module.scss";
+
+export const UnblockUserPopup = ({
+ userName,
+ setConfirmAction,
+}: {
+ userName: string;
+ setConfirmAction: React.Dispatch>;
+}) => {
+ const [processing, setProcessing] = useState(false);
+
+ const handleBlock = async () => {
+ setProcessing(true);
+ try {
+ await unblockUser(userName);
+ } catch (e) {
+ console.log(e);
+ } finally {
+ setProcessing(false);
+ setConfirmAction(false);
+ }
+ };
+
+ const handleCancel = () => {
+ setConfirmAction(false);
+ };
+
+ return (
+ <>
+
+
+
Unblock User
+
+
+ This contact will not be able to send you messages. The contact will
+ not be notified.
+
+
+
+
+ Cancel
+
+
+ Unblock
+
+
+
+ >
+ );
+};
diff --git a/packages/extension/src/pages/setting/chat/index.tsx b/packages/extension/src/pages/setting/chat/index.tsx
new file mode 100644
index 0000000000..ded377a953
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/index.tsx
@@ -0,0 +1,156 @@
+import { observer } from "mobx-react-lite";
+import React, { FunctionComponent, useEffect, useMemo, useState } from "react";
+import { useIntl } from "react-intl";
+import { HeaderLayout } from "../../../layouts";
+// import { useLanguage } from "../../../languages";
+import { PrivacySetting } from "@keplr-wallet/background/build/messaging/types";
+import { useSelector } from "react-redux";
+import { useHistory } from "react-router";
+import { store } from "../../../chatStore";
+import { userBlockedAddresses } from "../../../chatStore/messages-slice";
+import {
+ setAccessToken,
+ setMessagingPubKey,
+ userDetails,
+} from "../../../chatStore/user-slice";
+import { AUTH_SERVER } from "../../../config.ui.var";
+import { fetchBlockList } from "../../../graphQL/messages-api";
+import { useStore } from "../../../stores";
+import { getJWT } from "../../../utils/auth";
+import { fetchPublicKey } from "../../../utils/fetch-public-key";
+import { PageButton } from "../page-button";
+import style from "./style.module.scss";
+
+export const ChatSettings: FunctionComponent = observer(() => {
+ // const language = useLanguage();
+ const history = useHistory();
+ const intl = useIntl();
+ const userState = useSelector(userDetails);
+ const blockedUsers = useSelector(userBlockedAddresses);
+ const { chainStore, accountStore } = useStore();
+ const current = chainStore.current;
+ const walletAddress = accountStore.getAccount(chainStore.current.chainId)
+ .bech32Address;
+ const [loadingChatSettings, setLoadingChatSettings] = useState(false);
+ const [chatPubKeyExists, setChatPubKeyExists] = useState(true);
+ const [privacyParagraph, setPrivacyParagraph] = useState(
+ "setting.privacy.paragraph.everybody"
+ );
+
+ useEffect(() => {
+ const setJWTAndFetchMsgPubKey = async () => {
+ setLoadingChatSettings(true);
+ const res = await getJWT(current.chainId, AUTH_SERVER);
+ store.dispatch(setAccessToken(res));
+
+ const pubKey = await fetchPublicKey(res, current.chainId, walletAddress);
+ store.dispatch(setMessagingPubKey(pubKey));
+
+ if (pubKey?.privacySetting)
+ setPrivacyParagraph(
+ pubKey.privacySetting === PrivacySetting.Nobody
+ ? "setting.privacy.paragraph.nobody"
+ : pubKey.privacySetting === PrivacySetting.Contacts
+ ? "setting.privacy.paragraph.contact"
+ : "setting.privacy.paragraph.everybody"
+ );
+
+ if (
+ !pubKey?.publicKey ||
+ pubKey.privacySetting === PrivacySetting.Nobody
+ ) {
+ setChatPubKeyExists(false);
+ return setLoadingChatSettings(false);
+ }
+ fetchBlockList();
+ setLoadingChatSettings(false);
+ };
+ if (
+ (!userState.accessToken.length || !userState.messagingPubKey.length) &&
+ !loadingChatSettings
+ )
+ setJWTAndFetchMsgPubKey();
+ }, [
+ current.chainId,
+ loadingChatSettings,
+ userState.accessToken.length,
+ userState.messagingPubKey.length,
+ walletAddress,
+ ]);
+
+ return (
+ {
+ history.goBack();
+ }}
+ >
+
+
blockedUsers[user])
+ .length
+ } Addresses Blocked`
+ : "Please Activate Chat Functionality to Proceed"
+ }
+ onClick={() => {
+ if (chatPubKeyExists)
+ history.push({
+ pathname: "/setting/chat/block",
+ });
+ }}
+ icons={useMemo(
+ () =>
+ chatPubKeyExists
+ ? [ ]
+ : [],
+ [chatPubKeyExists]
+ )}
+ />
+ {
+ history.push({
+ pathname: "/setting/chat/privacy",
+ });
+ }}
+ icons={useMemo(
+ () => [ ],
+ []
+ )}
+ />
+ {/* {
+ // history.push({
+ // pathname: "/setting/block",
+ // });
+ // }}
+ icons={useMemo(
+ () => [ ],
+ []
+ )}
+ /> */}
+
+
+ );
+});
diff --git a/packages/extension/src/pages/setting/chat/privacy/index.tsx b/packages/extension/src/pages/setting/chat/privacy/index.tsx
new file mode 100644
index 0000000000..e6a13c3503
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/privacy/index.tsx
@@ -0,0 +1,146 @@
+import { RegisterPublicKey } from "@keplr-wallet/background/build/messaging";
+import { PrivacySetting } from "@keplr-wallet/background/build/messaging/types";
+import { BACKGROUND_PORT } from "@keplr-wallet/router";
+import { InExtensionMessageRequester } from "@keplr-wallet/router-extension";
+import { observer } from "mobx-react-lite";
+import React, { FunctionComponent, useMemo, useState } from "react";
+import { useIntl } from "react-intl";
+import { useSelector } from "react-redux";
+import { useHistory } from "react-router";
+import { store } from "../../../../chatStore";
+import {
+ setMessagingPubKey,
+ userDetails,
+} from "../../../../chatStore/user-slice";
+import { useLoadingIndicator } from "../../../../components/loading-indicator";
+import { HeaderLayout } from "../../../../layouts";
+import { useStore } from "../../../../stores";
+import { PageButton } from "../../page-button";
+import style from "./style.module.scss";
+
+export const Privacy: FunctionComponent = observer(() => {
+ // const language = useLanguage();
+ const history = useHistory();
+ const intl = useIntl();
+ const { chainStore, accountStore } = useStore();
+
+ const walletAddress = accountStore.getAccount(chainStore.current.chainId)
+ .bech32Address;
+
+ const userState = useSelector(userDetails);
+
+ const [
+ selectedPrivacySetting,
+ setSelectedPrivacySetting,
+ ] = useState(
+ userState?.messagingPubKey.privacySetting
+ ? userState?.messagingPubKey.privacySetting
+ : PrivacySetting.Everybody
+ );
+
+ const loadingIndicator = useLoadingIndicator();
+
+ const requester = new InExtensionMessageRequester();
+
+ const updatePrivacy = async (setting: PrivacySetting) => {
+ loadingIndicator.setIsLoading("privacy", true);
+ try {
+ const messagingPubKey = await requester.sendMessage(
+ BACKGROUND_PORT,
+ new RegisterPublicKey(
+ chainStore.current.chainId,
+ userState.accessToken,
+ walletAddress,
+ setting
+ )
+ );
+
+ store.dispatch(setMessagingPubKey(messagingPubKey));
+ setSelectedPrivacySetting(setting);
+ } catch (e) {
+ // Show error toaster
+ console.error("error", e);
+ } finally {
+ loadingIndicator.setIsLoading("privacy", false);
+ }
+ };
+
+ return (
+ {
+ history.goBack();
+ }}
+ >
+
+
+ );
+});
diff --git a/packages/extension/src/pages/setting/chat/privacy/style.module.scss b/packages/extension/src/pages/setting/chat/privacy/style.module.scss
new file mode 100644
index 0000000000..80bfd99133
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/privacy/style.module.scss
@@ -0,0 +1,134 @@
+@import "../../../../styles/var";
+
+.container {
+ margin: 0 calc(#{$layout-padding} * -1) calc(#{$layout-padding} * -1);
+
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.chatContainer {
+ padding: 10px 0 20px 0;
+ background-color: #fff;
+ // border-radius: 5px;
+ margin-left: -10px;
+ margin-right: -10px;
+ border-top: #e9ecef solid 1px;
+
+ .messagesContainer {
+ // margin-top: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+
+ .messageContainer {
+ display: flex;
+ // justify-content: space-between;
+ align-items: center;
+ padding: 0 12px;
+ margin-top: 10px;
+ cursor: pointer;
+
+ .initials {
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ background-color: #d0def5;
+ color: #525f7f;
+ margin-right: 8px;
+ font-weight: 400;
+ font-size: 15px;
+ line-height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ }
+
+ .messageInner {
+ width: 80%;
+
+ .name {
+ font-weight: 400;
+ font-size: 15px;
+ color: #525f7f;
+ height: 20px;
+ }
+ }
+ }
+ }
+}
+
+.popup {
+ width: 310px;
+ position: absolute;
+ border: solid #dee2e6 1px;
+ background-color: #ffffff;
+ margin: 20px 15px;
+ border-radius: 15px;
+ padding-bottom: 10px;
+ cursor: pointer;
+ top: 30%;
+
+ // display: flex;
+ // flex-direction: column;
+ // padding: 0px 20px;
+ h4 {
+ // border-bottom: solid #DEE2E6 2px;
+ padding: 0 20px 10px 20px;
+ color: #525f7f;
+ margin: 10px 0 0 0;
+ font-size: 18px;
+ }
+
+ .textContainer {
+ text-align: left;
+ padding: 0 15px;
+ font-size: 14px;
+ color: #808da0;
+ width: 280px;
+
+ label {
+ margin-left: 10px;
+ }
+ }
+
+ .header {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ border-bottom: solid #dee2e6 2px;
+ align-items: center;
+
+ img {
+ width: 8px;
+ height: 8px;
+ margin-right: 20px;
+ cursor: pointer;
+ }
+ }
+}
+
+.buttonContainer {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+ padding: 10px;
+ border-top: solid #dee2e6 2px;
+
+ button {
+ margin-left: 8px;
+ padding: 5px 10px;
+ border: solid #3b82f6 1px;
+ border-radius: 5px;
+ color: #3b82f6;
+ background-color: #ffffff;
+ cursor: pointer;
+ }
+
+ .btn {
+ color: #ffffff;
+ background-color: #3b82f6;
+ }
+}
diff --git a/packages/extension/src/pages/setting/chat/style.module.scss b/packages/extension/src/pages/setting/chat/style.module.scss
new file mode 100644
index 0000000000..4759514c57
--- /dev/null
+++ b/packages/extension/src/pages/setting/chat/style.module.scss
@@ -0,0 +1,9 @@
+@import "../../../styles/var";
+
+.container {
+ margin: 0 calc(#{$layout-padding} * -1) calc(#{$layout-padding} * -1);
+
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
diff --git a/packages/extension/src/pages/setting/index.tsx b/packages/extension/src/pages/setting/index.tsx
index d7eccbd870..25c03cd3c7 100644
--- a/packages/extension/src/pages/setting/index.tsx
+++ b/packages/extension/src/pages/setting/index.tsx
@@ -6,8 +6,11 @@ import style from "./style.module.scss";
import { useLanguage } from "../../languages";
import { useIntl } from "react-intl";
import { observer } from "mobx-react-lite";
+// import { useStore } from "../../stores";
export const SettingPage: FunctionComponent = observer(() => {
+ // const { uiConfigStore } = useStore();
+
const language = useLanguage();
const history = useHistory();
const intl = useIntl();
@@ -98,12 +101,10 @@ export const SettingPage: FunctionComponent = observer(() => {
)}
/>
{
history.push({
- pathname: "/setting/export-to-mobile",
+ pathname: "/setting/chat",
});
}}
icons={useMemo(
diff --git a/packages/extension/src/pages/setting/keyring/index.tsx b/packages/extension/src/pages/setting/keyring/index.tsx
index a017db81d5..f4ebb469b7 100644
--- a/packages/extension/src/pages/setting/keyring/index.tsx
+++ b/packages/extension/src/pages/setting/keyring/index.tsx
@@ -13,6 +13,9 @@ import { useLoadingIndicator } from "../../../components/loading-indicator";
import { PageButton } from "../page-button";
import { MultiKeyStoreInfoWithSelectedElem } from "@keplr-wallet/background";
import { FormattedMessage, useIntl } from "react-intl";
+import { store } from "../../../chatStore";
+import { resetUser } from "../../../chatStore/user-slice";
+import { addMessageList } from "../../../chatStore/messages-slice";
export const SetKeyRingPage: FunctionComponent = observer(() => {
const intl = useIntl();
@@ -107,6 +110,8 @@ export const SetKeyRingPage: FunctionComponent = observer(() => {
await keyRingStore.changeKeyRing(i);
analyticsStore.logEvent("Account changed");
loadingIndicator.setIsLoading("keyring", false);
+ store.dispatch(resetUser({}));
+ store.dispatch(addMessageList({}));
history.push("/");
} catch (e) {
console.log(`Failed to change keyring: ${e.message}`);
diff --git a/packages/extension/src/pages/setting/page-button.module.scss b/packages/extension/src/pages/setting/page-button.module.scss
index da6ba8aa81..ef549b72ff 100644
--- a/packages/extension/src/pages/setting/page-button.module.scss
+++ b/packages/extension/src/pages/setting/page-button.module.scss
@@ -44,7 +44,7 @@
}
p {
- font-size: 14px;
+ font-size: 13px;
color: #8898aa;
margin: 0;
diff --git a/packages/extension/src/pages/setting/page-button.tsx b/packages/extension/src/pages/setting/page-button.tsx
index c10c65a142..144fd82bee 100644
--- a/packages/extension/src/pages/setting/page-button.tsx
+++ b/packages/extension/src/pages/setting/page-button.tsx
@@ -3,6 +3,7 @@ import React, { FunctionComponent } from "react";
import classnames from "classnames";
import stylePageButton from "./page-button.module.scss";
+import { ToolTip } from "../../components/tooltip";
export const PageButton: FunctionComponent<
{
@@ -27,7 +28,16 @@ export const PageButton: FunctionComponent<
{...attributes}
>
-
{title}
+
+ {title}
+
{paragraph ?
{paragraph}
: null}
{subParagraph ?
{subParagraph}
: null}
diff --git a/packages/extension/src/pages/sign/messages.spec.ts b/packages/extension/src/pages/sign/decimals.spec.ts
similarity index 90%
rename from packages/extension/src/pages/sign/messages.spec.ts
rename to packages/extension/src/pages/sign/decimals.spec.ts
index 3a34a0105c..914ac8ea1f 100644
--- a/packages/extension/src/pages/sign/messages.spec.ts
+++ b/packages/extension/src/pages/sign/decimals.spec.ts
@@ -2,7 +2,7 @@
* @jest-environment jsdom
*/
-import { clearDecimals } from "./messages";
+import { clearDecimals } from "./decimals";
describe("Test methods in messages", () => {
test("Test clearDecimals", () => {
diff --git a/packages/extension/src/pages/sign/decimals.ts b/packages/extension/src/pages/sign/decimals.ts
new file mode 100644
index 0000000000..ee0f9aaa97
--- /dev/null
+++ b/packages/extension/src/pages/sign/decimals.ts
@@ -0,0 +1,18 @@
+export function clearDecimals(dec: string): string {
+ if (!dec.includes(".")) {
+ return dec;
+ }
+
+ for (let i = dec.length - 1; i >= 0; i--) {
+ if (dec[i] === "0") {
+ dec = dec.slice(0, dec.length - 1);
+ } else {
+ break;
+ }
+ }
+ if (dec.length > 0 && dec[dec.length - 1] === ".") {
+ dec = dec.slice(0, dec.length - 1);
+ }
+
+ return dec;
+}
diff --git a/packages/extension/src/pages/sign/messages.tsx b/packages/extension/src/pages/sign/messages.tsx
index f899d15be9..4e76b236ea 100644
--- a/packages/extension/src/pages/sign/messages.tsx
+++ b/packages/extension/src/pages/sign/messages.tsx
@@ -12,6 +12,7 @@ import yaml from "js-yaml";
import { Buffer } from "buffer/";
import { CoinPrimitive } from "@keplr-wallet/stores";
+import { clearDecimals } from "./decimals";
export interface MessageObj {
readonly type: string;
@@ -619,22 +620,3 @@ export const UnknownMsgView: FunctionComponent<{ msg: object }> = ({ msg }) => {
);
};
-
-export function clearDecimals(dec: string): string {
- if (!dec.includes(".")) {
- return dec;
- }
-
- for (let i = dec.length - 1; i >= 0; i--) {
- if (dec[i] === "0") {
- dec = dec.slice(0, dec.length - 1);
- } else {
- break;
- }
- }
- if (dec.length > 0 && dec[dec.length - 1] === ".") {
- dec = dec.slice(0, dec.length - 1);
- }
-
- return dec;
-}
diff --git a/packages/extension/src/public/assets/chat-loading.gif b/packages/extension/src/public/assets/chat-loading.gif
new file mode 100644
index 0000000000..46ff158c04
Binary files /dev/null and b/packages/extension/src/public/assets/chat-loading.gif differ
diff --git a/packages/extension/src/public/assets/hello.png b/packages/extension/src/public/assets/hello.png
new file mode 100644
index 0000000000..e6a7284fd7
Binary files /dev/null and b/packages/extension/src/public/assets/hello.png differ
diff --git a/packages/extension/src/public/assets/icon/chevron-left.png b/packages/extension/src/public/assets/icon/chevron-left.png
new file mode 100644
index 0000000000..21bacff606
Binary files /dev/null and b/packages/extension/src/public/assets/icon/chevron-left.png differ
diff --git a/packages/extension/src/public/assets/icon/delivered.png b/packages/extension/src/public/assets/icon/delivered.png
new file mode 100644
index 0000000000..78c6636dbf
Binary files /dev/null and b/packages/extension/src/public/assets/icon/delivered.png differ
diff --git a/packages/extension/src/public/assets/icon/new-chat.png b/packages/extension/src/public/assets/icon/new-chat.png
new file mode 100644
index 0000000000..e611445405
Binary files /dev/null and b/packages/extension/src/public/assets/icon/new-chat.png differ
diff --git a/packages/extension/src/public/assets/icon/paper-airplane.png b/packages/extension/src/public/assets/icon/paper-airplane.png
new file mode 100644
index 0000000000..2c2e34a7cc
Binary files /dev/null and b/packages/extension/src/public/assets/icon/paper-airplane.png differ
diff --git a/packages/extension/src/public/assets/icon/right-arrow.png b/packages/extension/src/public/assets/icon/right-arrow.png
new file mode 100644
index 0000000000..e2c719bf0a
Binary files /dev/null and b/packages/extension/src/public/assets/icon/right-arrow.png differ
diff --git a/packages/extension/src/public/assets/icon/search.png b/packages/extension/src/public/assets/icon/search.png
new file mode 100644
index 0000000000..96beec587d
Binary files /dev/null and b/packages/extension/src/public/assets/icon/search.png differ
diff --git a/packages/extension/src/public/assets/icon/send-blue.png b/packages/extension/src/public/assets/icon/send-blue.png
new file mode 100644
index 0000000000..32cb679a22
Binary files /dev/null and b/packages/extension/src/public/assets/icon/send-blue.png differ
diff --git a/packages/extension/src/public/assets/icon/stake-blue.png b/packages/extension/src/public/assets/icon/stake-blue.png
new file mode 100644
index 0000000000..8fcab5ce50
Binary files /dev/null and b/packages/extension/src/public/assets/icon/stake-blue.png differ
diff --git a/packages/extension/src/public/assets/icon/swap-blue.png b/packages/extension/src/public/assets/icon/swap-blue.png
new file mode 100644
index 0000000000..ea46072c6b
Binary files /dev/null and b/packages/extension/src/public/assets/icon/swap-blue.png differ
diff --git a/packages/extension/src/public/assets/svg/tick-icon.svg b/packages/extension/src/public/assets/svg/tick-icon.svg
new file mode 100644
index 0000000000..c9d8ad7fa7
--- /dev/null
+++ b/packages/extension/src/public/assets/svg/tick-icon.svg
@@ -0,0 +1,3 @@
+