From f22995637ba78450ba059433c3eb5274ad377bdb Mon Sep 17 00:00:00 2001 From: plubber <51789398+ericHgorski@users.noreply.github.com> Date: Mon, 3 Apr 2023 17:59:33 -0400 Subject: [PATCH 01/12] St 353 display chain selection on inactive chain click in OtherChainButtons (#329) * WIP: chains display prefs open * feat: open preferences on click * cleanup * cleanup --- src/app/sections/DisplayChainsSetting.tsx | 1 + src/app/sections/Preferences.tsx | 14 +++++++- src/components/feedback/Modal.tsx | 19 ++++++++-- src/components/layout/OtherChainsButton.tsx | 14 ++++++-- .../layout/SettingsSelectorToggle.tsx | 5 ++- .../layout/SimpleChainList.module.scss | 3 +- src/components/layout/SimpleChainList.tsx | 36 ++++++++----------- src/utils/chain.ts | 4 +++ 8 files changed, 67 insertions(+), 29 deletions(-) diff --git a/src/app/sections/DisplayChainsSetting.tsx b/src/app/sections/DisplayChainsSetting.tsx index 46c1d7b91..a7e2aeb58 100644 --- a/src/app/sections/DisplayChainsSetting.tsx +++ b/src/app/sections/DisplayChainsSetting.tsx @@ -13,6 +13,7 @@ const DisplayChainsSetting = () => { const network = useNetwork() const onChange = (value: string) => { + if (isTerraChain(value)) return const newDisplayChains = displayChains.includes(value) ? displayChains.filter((chainID) => chainID !== value) : [...displayChains, value] diff --git a/src/app/sections/Preferences.tsx b/src/app/sections/Preferences.tsx index 616b571aa..f596860ac 100644 --- a/src/app/sections/Preferences.tsx +++ b/src/app/sections/Preferences.tsx @@ -15,7 +15,7 @@ import { useNetwork, useNetworkName } from "data/wallet" import { useCurrency } from "data/settings/Currency" import { Languages } from "config/lang" import { capitalize } from "@mui/material" -import { ReactNode, useState } from "react" +import { ReactNode, useState, useEffect } from "react" import styles from "./Preferences.module.scss" import SelectTheme from "./SelectTheme" import LCDSetting from "./LCDSetting" @@ -23,6 +23,7 @@ import { useTheme } from "data/settings/Theme" import { useDisplayChains } from "utils/localStorage" import { getDisplayChainsSettingLabel } from "data/queries/chains" import AdvancedSettings from "./AdvancedSettings" +import { atom, useRecoilState } from "recoil" type Routes = | "network" @@ -42,6 +43,11 @@ interface SettingsPage { className?: string } +export const displayChainPrefsOpen = atom({ + key: "displayChainPrefsOpen", + default: false, +}) + const Preferences = () => { const { t } = useTranslation() const connectedWallet = useWallet() @@ -53,6 +59,11 @@ const Preferences = () => { const network = useNetwork() const { name } = useTheme() const { displayChains } = useDisplayChains() + const [isOpen] = useRecoilState(displayChainPrefsOpen) + + useEffect(() => { + if (isOpen) setPage("displayChains") + }, [isOpen]) const routes: Record = { network: { @@ -149,6 +160,7 @@ const Preferences = () => { return ( diff --git a/src/components/feedback/Modal.tsx b/src/components/feedback/Modal.tsx index 53153da83..d4e0492af 100644 --- a/src/components/feedback/Modal.tsx +++ b/src/components/feedback/Modal.tsx @@ -7,6 +7,8 @@ import { RenderButton } from "types/components" import createContext from "utils/createContext" import { getMaxHeightStyle } from "utils/style" import styles from "./Modal.module.scss" +import { useSetRecoilState } from "recoil" +import { displayChainPrefsOpen } from "app/sections/Preferences" const cx = classNames.bind(styles) @@ -76,24 +78,37 @@ interface ModalButtonProps extends ModalProps { renderButton: RenderButton modalKey?: string minimal?: boolean + isOpen?: boolean } export const ModalButton = (props: PropsWithChildren) => { const { pathname } = useLocation() - const { renderButton, modalKey = pathname, ...rest } = props + const { renderButton, modalKey = pathname, isOpen, ...rest } = props const [isModalOpen, setIsModalOpen] = useState(false) const open = () => setIsModalOpen(true) const close = () => setIsModalOpen(false) + const setIsOpen = useSetRecoilState(displayChainPrefsOpen) useEffect(() => { close() }, [modalKey]) + useEffect(() => { + if (isOpen) open() + }, [isOpen]) + return ( {renderButton(open)} - + { + close() + setIsOpen(false) + }} + /> ) } diff --git a/src/components/layout/OtherChainsButton.tsx b/src/components/layout/OtherChainsButton.tsx index e3657511f..995fbe9ee 100644 --- a/src/components/layout/OtherChainsButton.tsx +++ b/src/components/layout/OtherChainsButton.tsx @@ -3,6 +3,9 @@ import { SimpleChainList } from "components/layout" import { Popover } from "components/display" import styles from "./OtherChainsButton.module.scss" import { useSelectedDisplayChain } from "utils/localStorage" +import { displayChainPrefsOpen } from "app/sections/Preferences" +import { useSetRecoilState } from "recoil" +import { useDisplayChains } from "utils/localStorage" type Props = { list: InterchainNetwork[] @@ -11,12 +14,19 @@ type Props = { const OtherChainsButton = ({ list, handleSetChain }: Props) => { const [key, setKey] = useState(0) + const setIsOpen = useSetRecoilState(displayChainPrefsOpen) const { changeSelectedDisplayChain } = useSelectedDisplayChain() + const { displayChains } = useDisplayChains() + const closePopover = () => setKey((key) => key + 1) const onClick = (chainID: string) => { - changeSelectedDisplayChain(chainID) - handleSetChain(chainID) + if (displayChains.includes(chainID)) { + changeSelectedDisplayChain(chainID) + handleSetChain(chainID) + } else { + setIsOpen(true) + } closePopover() } diff --git a/src/components/layout/SettingsSelectorToggle.tsx b/src/components/layout/SettingsSelectorToggle.tsx index 5a2420119..beb415874 100644 --- a/src/components/layout/SettingsSelectorToggle.tsx +++ b/src/components/layout/SettingsSelectorToggle.tsx @@ -1,5 +1,6 @@ import styles from "components/layout/SettingsSelector.module.scss" import { Toggle } from "components/form" +import { isTerraChain } from "utils/chain" interface Props { onChange: any @@ -19,7 +20,9 @@ const SettingsSelectorToggle = ({ options, onChange, extra }: Props) => { {label} {extra} - onChange(value)} /> + {!isTerraChain(value) && ( + onChange(value)} /> + )} ))} diff --git a/src/components/layout/SimpleChainList.module.scss b/src/components/layout/SimpleChainList.module.scss index dddfaa475..7f8d51856 100644 --- a/src/components/layout/SimpleChainList.module.scss +++ b/src/components/layout/SimpleChainList.module.scss @@ -15,12 +15,11 @@ width: 100%; border-radius: none !important; color: var(--text-muted); - cursor: default; opacity: 0.75; + cursor: pointer; &.active { color: var(--text); - cursor: pointer; opacity: 1; &:hover { diff --git a/src/components/layout/SimpleChainList.tsx b/src/components/layout/SimpleChainList.tsx index 68eaefaf6..7b6b5b9fd 100644 --- a/src/components/layout/SimpleChainList.tsx +++ b/src/components/layout/SimpleChainList.tsx @@ -1,7 +1,7 @@ import styles from "./SimpleChainList.module.scss" import classNames from "classnames" +import { isTerraChain } from "utils/chain" import { useDisplayChains } from "utils/localStorage" -import { Tooltip } from "components/display" interface Props { list: InterchainNetwork[] @@ -21,26 +21,20 @@ const SimpleChainList = ({ list, onClick }: Props) => { ) return ( - -
- {sortedList.map(({ chainID, name, icon }) => ( - - ))} -
-
+
+ {sortedList.map(({ chainID, name, icon }) => ( + + ))} +
) } diff --git a/src/utils/chain.ts b/src/utils/chain.ts index b48dce065..764495fe3 100644 --- a/src/utils/chain.ts +++ b/src/utils/chain.ts @@ -2,6 +2,7 @@ import { useBankBalance } from "data/queries/bank" import { useNativeDenoms } from "data/token" import { useExchangeRates } from "data/queries/coingecko" import { useDisplayChains } from "./localStorage/hooks" +import { useNetworkName } from "data/wallet" type ChainId = string type ChainPrefix = string @@ -51,3 +52,6 @@ export const useSortedDisplayChains = () => { ) return sorted.map((c) => c.chain) } + +export const useTerraChainName = () => + useNetworkName() === "mainnet" ? "phoenix-1" : "pisco-1" From 3d6d35981ff82a81c4ac5273efb7281d422660fc Mon Sep 17 00:00:00 2001 From: Mike <17463738+mwmerz@users.noreply.github.com> Date: Tue, 4 Apr 2023 10:30:48 -0400 Subject: [PATCH 02/12] feat: swap terra.kitchen/utils for @terra-money/terra-utils (#321) --- package-lock.json | 116 +++++++++--------- package.json | 2 +- src/app/containers/TxMessage.tsx | 2 +- src/app/sections/Connected.tsx | 2 +- src/app/sections/LastHeight.tsx | 2 +- src/app/sections/SelectTheme.tsx | 2 +- src/auth/modules/create/SelectAddress.tsx | 2 +- src/auth/modules/select/SwitchWallet.tsx | 2 +- src/components/form/AddressBox.tsx | 2 +- src/components/general/FinderLink.tsx | 2 +- src/components/token/Read.tsx | 4 +- src/components/token/TokenCard.tsx | 2 +- src/components/token/TokenIcon.tsx | 2 +- src/data/queries/ibc.ts | 2 +- src/data/queries/staking.ts | 2 +- src/data/queries/treasury.ts | 2 +- src/data/token.tsx | 4 +- src/pages/charts/LunaPriceChart.tsx | 2 +- src/pages/charts/StakingReturn.tsx | 2 +- src/pages/charts/TxVolume.tsx | 6 +- src/pages/charts/Wallets.tsx | 2 +- src/pages/custom/TokenItem.tsx | 2 +- .../dashboard/components/SelectDenom.tsx | 2 +- src/pages/gov/ProposalDeposits.tsx | 2 +- src/pages/gov/ProposalParams.tsx | 2 +- src/pages/gov/ProposalVotes.tsx | 2 +- src/pages/gov/ProposalVotesByValidator.tsx | 2 +- src/pages/gov/components/Orb.tsx | 2 +- src/pages/nft/NFTAssetItem.tsx | 2 +- src/pages/stake/ValidatorCommission.tsx | 2 +- src/pages/stake/ValidatorSummary.tsx | 2 +- src/pages/stake/ValidatorVotes.tsx | 2 +- src/pages/stake/ValidatorsList.tsx | 2 +- src/pages/stake/components/Uptime.tsx | 2 +- src/pages/wallet/AssetActions.tsx | 2 +- src/pages/wallet/SendPage.tsx | 2 +- src/pages/wallet/TransferPage.tsx | 2 +- src/styles/themes/themes.tsx | 2 +- src/txs/AddressBook/AddAddressBookItem.tsx | 2 +- src/txs/AddressBook/AddressBookList.tsx | 2 +- src/txs/Tx.tsx | 2 +- src/txs/gov/DepositForm.tsx | 2 +- src/txs/gov/SubmitProposalForm.tsx | 4 +- src/txs/stake/QuickStakeForm.tsx | 2 +- src/txs/stake/StakeForm.tsx | 2 +- src/txs/swap/SingleSwapContext.tsx | 2 +- src/txs/swap/TFMSwapContext.tsx | 2 +- src/txs/swap/TFMSwapForm.tsx | 4 +- src/txs/swap/useSwapUtils.ts | 4 +- src/txs/utils.ts | 2 +- src/txs/wasm/TransferCW721Form.tsx | 2 +- src/utils/coin.ts | 2 +- 52 files changed, 118 insertions(+), 114 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0093bd97f..46f9e8134 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,11 +14,11 @@ "@terra-money/feather.js": "^1.0.0-beta.11", "@terra-money/ledger-station-js": "^1.3.7", "@terra-money/log-finder-ruleset": "^3.0.0", + "@terra-money/terra-utils": "^1.0.9", "@terra-money/terra.js": "^3.1.7", "@terra-money/terra.proto": "^2.0.0", "@terra-money/use-wallet": "^4.0.0-beta.3", "@terra-money/wallet-provider": "^4.0.0-beta.3", - "@terra.kitchen/utils": "^1.0.7", "@tippyjs/react": "^4.2.6", "axios": "^0.27.2", "bech32": "^2.0.0", @@ -4039,6 +4039,35 @@ "@terra-money/terra.js": "^3" } }, + "node_modules/@terra-money/terra-utils": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@terra-money/terra-utils/-/terra-utils-1.0.9.tgz", + "integrity": "sha512-4xzu/N6ClQ49VB1ghXyofbit3GG+jd1IeGC73r7e9l91fKuiHR1p7r5ybtOqsrqQSJnfNEMuDHrwM64c4M56DA==", + "dependencies": { + "@types/numeral": "^2.0.2", + "@types/ramda": "^0.27.57", + "bignumber.js": "^9.0.1", + "numeral": "^2.0.6", + "ramda": "^0.27.1", + "tiny-warning": "^1.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@terra-money/terra-utils/node_modules/@types/ramda": { + "version": "0.27.66", + "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.27.66.tgz", + "integrity": "sha512-i2YW+E2U6NfMt3dp0RxNcejox+bxJUNDjB7BpYuRuoHIzv5juPHkJkNgcUOu+YSQEmaWu8cnAo/8r63C0NnuVA==", + "dependencies": { + "ts-toolbelt": "^6.15.1" + } + }, + "node_modules/@terra-money/terra-utils/node_modules/ramda": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz", + "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==" + }, "node_modules/@terra-money/terra.js": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.7.tgz", @@ -4169,35 +4198,6 @@ "tslib": "^2.1.0" } }, - "node_modules/@terra.kitchen/utils": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@terra.kitchen/utils/-/utils-1.0.7.tgz", - "integrity": "sha512-oHteW1TRdFAQU0n3vtw3OF/8G7jqAyUwihf9sIUycslmt/DX3P2MdDSqHnVHdPiKO+Jtl4aZG2oZbQzZ9XsAAA==", - "dependencies": { - "@types/numeral": "^2.0.2", - "@types/ramda": "^0.27.57", - "bignumber.js": "^9.0.1", - "numeral": "^2.0.6", - "ramda": "^0.27.1", - "tiny-warning": "^1.0.3" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@terra.kitchen/utils/node_modules/@types/ramda": { - "version": "0.27.66", - "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.27.66.tgz", - "integrity": "sha512-i2YW+E2U6NfMt3dp0RxNcejox+bxJUNDjB7BpYuRuoHIzv5juPHkJkNgcUOu+YSQEmaWu8cnAo/8r63C0NnuVA==", - "dependencies": { - "ts-toolbelt": "^6.15.1" - } - }, - "node_modules/@terra.kitchen/utils/node_modules/ramda": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz", - "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==" - }, "node_modules/@tippyjs/react": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/@tippyjs/react/-/react-4.2.6.tgz", @@ -30263,6 +30263,34 @@ "@terra-money/log-finder": "^1.1.6" } }, + "@terra-money/terra-utils": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@terra-money/terra-utils/-/terra-utils-1.0.9.tgz", + "integrity": "sha512-4xzu/N6ClQ49VB1ghXyofbit3GG+jd1IeGC73r7e9l91fKuiHR1p7r5ybtOqsrqQSJnfNEMuDHrwM64c4M56DA==", + "requires": { + "@types/numeral": "^2.0.2", + "@types/ramda": "^0.27.57", + "bignumber.js": "^9.0.1", + "numeral": "^2.0.6", + "ramda": "^0.27.1", + "tiny-warning": "^1.0.3" + }, + "dependencies": { + "@types/ramda": { + "version": "0.27.66", + "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.27.66.tgz", + "integrity": "sha512-i2YW+E2U6NfMt3dp0RxNcejox+bxJUNDjB7BpYuRuoHIzv5juPHkJkNgcUOu+YSQEmaWu8cnAo/8r63C0NnuVA==", + "requires": { + "ts-toolbelt": "^6.15.1" + } + }, + "ramda": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz", + "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==" + } + } + }, "@terra-money/terra.js": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.7.tgz", @@ -30373,34 +30401,6 @@ } } }, - "@terra.kitchen/utils": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@terra.kitchen/utils/-/utils-1.0.7.tgz", - "integrity": "sha512-oHteW1TRdFAQU0n3vtw3OF/8G7jqAyUwihf9sIUycslmt/DX3P2MdDSqHnVHdPiKO+Jtl4aZG2oZbQzZ9XsAAA==", - "requires": { - "@types/numeral": "^2.0.2", - "@types/ramda": "^0.27.57", - "bignumber.js": "^9.0.1", - "numeral": "^2.0.6", - "ramda": "^0.27.1", - "tiny-warning": "^1.0.3" - }, - "dependencies": { - "@types/ramda": { - "version": "0.27.66", - "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.27.66.tgz", - "integrity": "sha512-i2YW+E2U6NfMt3dp0RxNcejox+bxJUNDjB7BpYuRuoHIzv5juPHkJkNgcUOu+YSQEmaWu8cnAo/8r63C0NnuVA==", - "requires": { - "ts-toolbelt": "^6.15.1" - } - }, - "ramda": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.2.tgz", - "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==" - } - } - }, "@tippyjs/react": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/@tippyjs/react/-/react-4.2.6.tgz", diff --git a/package.json b/package.json index ca10f2db8..6cdefcd0f 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,11 @@ "@terra-money/feather.js": "^1.0.0-beta.11", "@terra-money/ledger-station-js": "^1.3.7", "@terra-money/log-finder-ruleset": "^3.0.0", + "@terra-money/terra-utils": "^1.0.9", "@terra-money/terra.js": "^3.1.7", "@terra-money/terra.proto": "^2.0.0", "@terra-money/use-wallet": "^4.0.0-beta.3", "@terra-money/wallet-provider": "^4.0.0-beta.3", - "@terra.kitchen/utils": "^1.0.7", "@tippyjs/react": "^4.2.6", "axios": "^0.27.2", "bech32": "^2.0.0", diff --git a/src/app/containers/TxMessage.tsx b/src/app/containers/TxMessage.tsx index 3f93ec5ef..42df342b7 100644 --- a/src/app/containers/TxMessage.tsx +++ b/src/app/containers/TxMessage.tsx @@ -1,6 +1,6 @@ import { ReactNode, useMemo } from "react" import { capitalize } from "@mui/material" -import { isDenom, truncate } from "@terra.kitchen/utils" +import { isDenom, truncate } from "@terra-money/terra-utils" import { AccAddress, Coin, Coins, ValAddress } from "@terra-money/feather.js" import { useAddress, useNetwork } from "data/wallet" import { useValidators } from "data/queries/staking" diff --git a/src/app/sections/Connected.tsx b/src/app/sections/Connected.tsx index 27ea3110b..923b6cedb 100644 --- a/src/app/sections/Connected.tsx +++ b/src/app/sections/Connected.tsx @@ -4,7 +4,7 @@ import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet" import GroupsIcon from "@mui/icons-material/Groups" import UsbIcon from "@mui/icons-material/Usb" import BluetoothIcon from "@mui/icons-material/Bluetooth" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { useAddress } from "data/wallet" import { useTnsName } from "data/external/tns" import { Button } from "components/general" diff --git a/src/app/sections/LastHeight.tsx b/src/app/sections/LastHeight.tsx index 26844ff84..b616ce883 100644 --- a/src/app/sections/LastHeight.tsx +++ b/src/app/sections/LastHeight.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next" import classNames from "classnames" -import { formatNumber } from "@terra.kitchen/utils" +import { formatNumber } from "@terra-money/terra-utils" import { useTerraObserver } from "data/Terra/TerraObserver" import { FinderLink } from "components/general" import { Flex } from "components/layout" diff --git a/src/app/sections/SelectTheme.tsx b/src/app/sections/SelectTheme.tsx index 5d413c582..ca6a677ce 100644 --- a/src/app/sections/SelectTheme.tsx +++ b/src/app/sections/SelectTheme.tsx @@ -3,7 +3,7 @@ import classNames from "classnames/bind" import LockIcon from "@mui/icons-material/Lock" import InfoIcon from "@mui/icons-material/Info" import { capitalize } from "@mui/material" -import { readAmount } from "@terra.kitchen/utils" +import { readAmount } from "@terra-money/terra-utils" import { themes } from "styles/themes/themes" import { useAddress } from "data/wallet" import { useThemeState, useValidateTheme } from "data/settings/Theme" diff --git a/src/auth/modules/create/SelectAddress.tsx b/src/auth/modules/create/SelectAddress.tsx index 5ed969f67..a9a2914d3 100644 --- a/src/auth/modules/create/SelectAddress.tsx +++ b/src/auth/modules/create/SelectAddress.tsx @@ -1,7 +1,7 @@ import { useTranslation } from "react-i18next" import { useQuery } from "react-query" import { useForm } from "react-hook-form" -import { readAmount } from "@terra.kitchen/utils" +import { readAmount } from "@terra-money/terra-utils" import { MnemonicKey, AccAddress } from "@terra-money/feather.js" import { Coins, Delegation, UnbondingDelegation } from "@terra-money/feather.js" import { sortCoins } from "utils/coin" diff --git a/src/auth/modules/select/SwitchWallet.tsx b/src/auth/modules/select/SwitchWallet.tsx index de09e62cc..5c1f0a890 100644 --- a/src/auth/modules/select/SwitchWallet.tsx +++ b/src/auth/modules/select/SwitchWallet.tsx @@ -1,5 +1,5 @@ import LockOutlinedIcon from "@mui/icons-material/LockOutlined" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { Flex } from "components/layout" import { useAddress } from "data/wallet" import { addressFromWords } from "utils/bech32" diff --git a/src/components/form/AddressBox.tsx b/src/components/form/AddressBox.tsx index ba47a3ac3..3bf493591 100644 --- a/src/components/form/AddressBox.tsx +++ b/src/components/form/AddressBox.tsx @@ -1,7 +1,7 @@ import styles from "./AddressBox.module.scss" import { CopyIcon, WalletQR } from "components/general" import QrCodeIcon from "@mui/icons-material/QrCode" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" const AddressBox = ({ address, diff --git a/src/components/general/FinderLink.tsx b/src/components/general/FinderLink.tsx index e090c95ef..ca9a094ba 100644 --- a/src/components/general/FinderLink.tsx +++ b/src/components/general/FinderLink.tsx @@ -1,7 +1,7 @@ import { ForwardedRef, HTMLAttributes, PropsWithChildren } from "react" import { forwardRef } from "react" import classNames from "classnames" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { useNetwork } from "data/wallet" import { ExternalLink } from "./External" import { getChainIDFromAddress } from "utils/bech32" diff --git a/src/components/token/Read.tsx b/src/components/token/Read.tsx index 706ae1189..239ada95f 100644 --- a/src/components/token/Read.tsx +++ b/src/components/token/Read.tsx @@ -1,7 +1,7 @@ import { ForwardedRef, forwardRef, Fragment } from "react" import classNames from "classnames/bind" -import { FormatConfig } from "@terra.kitchen/utils" -import { formatPercent, readAmount, truncate } from "@terra.kitchen/utils" +import { FormatConfig } from "@terra-money/terra-utils" +import { formatPercent, readAmount, truncate } from "@terra-money/terra-utils" import { WithTokenItem } from "data/token" import styles from "./Read.module.scss" diff --git a/src/components/token/TokenCard.tsx b/src/components/token/TokenCard.tsx index 4659fd89c..ce3a9f968 100644 --- a/src/components/token/TokenCard.tsx +++ b/src/components/token/TokenCard.tsx @@ -1,7 +1,7 @@ import { PropsWithChildren } from "react" import classNames from "classnames/bind" import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet" -import { FormatConfig } from "@terra.kitchen/utils" +import { FormatConfig } from "@terra-money/terra-utils" import { getMaxHeightStyle } from "utils/style" import { Flex } from "../layout" import TokenIcon from "./TokenIcon" diff --git a/src/components/token/TokenIcon.tsx b/src/components/token/TokenIcon.tsx index 714493898..c05f74d9c 100644 --- a/src/components/token/TokenIcon.tsx +++ b/src/components/token/TokenIcon.tsx @@ -1,7 +1,7 @@ import { HTMLAttributes, useState } from "react" import classNames from "classnames/bind" import { AccAddress } from "@terra-money/feather.js" -import { isDenomIBC } from "@terra.kitchen/utils" +import { isDenomIBC } from "@terra-money/terra-utils" import { getIcon } from "data/token" import styles from "./TokenIcon.module.scss" diff --git a/src/data/queries/ibc.ts b/src/data/queries/ibc.ts index f11112598..8e1b01184 100644 --- a/src/data/queries/ibc.ts +++ b/src/data/queries/ibc.ts @@ -1,5 +1,5 @@ import { useQuery } from "react-query" -import { isDenomIBC } from "@terra.kitchen/utils" +import { isDenomIBC } from "@terra-money/terra-utils" import { queryKey, RefetchOptions } from "../query" import { useInterchainLCDClient } from "./lcdClient" diff --git a/src/data/queries/staking.ts b/src/data/queries/staking.ts index 99fe7ed2d..1be0f64b5 100644 --- a/src/data/queries/staking.ts +++ b/src/data/queries/staking.ts @@ -16,7 +16,7 @@ import { StakeAction } from "txs/stake/StakeForm" import { queryKey, Pagination, RefetchOptions } from "../query" import { useInterchainLCDClient } from "./lcdClient" import { useInterchainAddresses } from "auth/hooks/useAddress" -import { readAmount, toAmount } from "@terra.kitchen/utils" +import { readAmount, toAmount } from "@terra-money/terra-utils" import { useExchangeRates } from "data/queries/coingecko" import { useNativeDenoms } from "data/token" import shuffle from "utils/shuffle" diff --git a/src/data/queries/treasury.ts b/src/data/queries/treasury.ts index 12a8c9521..9a77959d9 100644 --- a/src/data/queries/treasury.ts +++ b/src/data/queries/treasury.ts @@ -1,5 +1,5 @@ import { useQueries, useQuery } from "react-query" -import { isDenom, isDenomLuna, isDenomTerra } from "@terra.kitchen/utils" +import { isDenom, isDenomLuna, isDenomTerra } from "@terra-money/terra-utils" import { queryKey, RefetchOptions } from "../query" import { useLCDClient } from "./lcdClient" diff --git a/src/data/token.tsx b/src/data/token.tsx index 823f1a119..bc5de33ac 100644 --- a/src/data/token.tsx +++ b/src/data/token.tsx @@ -1,6 +1,6 @@ import { ReactNode } from "react" -import { isDenomIBC } from "@terra.kitchen/utils" -import { readDenom, truncate } from "@terra.kitchen/utils" +import { isDenomIBC } from "@terra-money/terra-utils" +import { readDenom, truncate } from "@terra-money/terra-utils" import { AccAddress } from "@terra-money/feather.js" import { ASSETS } from "config/constants" import { useTokenInfoCW20 } from "./queries/wasm" diff --git a/src/pages/charts/LunaPriceChart.tsx b/src/pages/charts/LunaPriceChart.tsx index aee3a366f..006b2c10d 100644 --- a/src/pages/charts/LunaPriceChart.tsx +++ b/src/pages/charts/LunaPriceChart.tsx @@ -1,5 +1,5 @@ import { useState } from "react" -import { formatNumber } from "@terra.kitchen/utils" +import { formatNumber } from "@terra-money/terra-utils" import { useCurrency } from "data/settings/Currency" import { useThemeAnimation } from "data/settings/Theme" import { ChartInterval, useLunaPriceChart } from "data/Terra/TerraAPI" diff --git a/src/pages/charts/StakingReturn.tsx b/src/pages/charts/StakingReturn.tsx index b693b15f5..cb7cb0aa1 100644 --- a/src/pages/charts/StakingReturn.tsx +++ b/src/pages/charts/StakingReturn.tsx @@ -2,7 +2,7 @@ import { useState } from "react" import { useTranslation } from "react-i18next" import { last } from "ramda" import { capitalize } from "@mui/material" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { AggregateStakingReturn } from "data/Terra/TerraAPI" import { useStakingReturn } from "data/Terra/TerraAPI" import { Select } from "components/form" diff --git a/src/pages/charts/TxVolume.tsx b/src/pages/charts/TxVolume.tsx index a8bd8fb23..7d013501d 100644 --- a/src/pages/charts/TxVolume.tsx +++ b/src/pages/charts/TxVolume.tsx @@ -3,7 +3,11 @@ import { useTranslation } from "react-i18next" import BigNumber from "bignumber.js" import { head, last } from "ramda" import { capitalize } from "@mui/material" -import { isDenomTerraNative, readAmount, readDenom } from "@terra.kitchen/utils" +import { + isDenomTerraNative, + readAmount, + readDenom, +} from "@terra-money/terra-utils" import { sortDenoms } from "utils/coin" import { useCurrency } from "data/settings/Currency" import { Aggregate, useTxVolume } from "data/Terra/TerraAPI" diff --git a/src/pages/charts/Wallets.tsx b/src/pages/charts/Wallets.tsx index baf2bfb4b..30ad975a8 100644 --- a/src/pages/charts/Wallets.tsx +++ b/src/pages/charts/Wallets.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next" import { last } from "ramda" import BigNumber from "bignumber.js" import { capitalize } from "@mui/material" -import { formatNumber } from "@terra.kitchen/utils" +import { formatNumber } from "@terra-money/terra-utils" import { combineState } from "data/query" import { AggregateWallets, useSumActiveWallets } from "data/Terra/TerraAPI" import { useWallets } from "data/Terra/TerraAPI" diff --git a/src/pages/custom/TokenItem.tsx b/src/pages/custom/TokenItem.tsx index ddf277b0e..e0532d195 100644 --- a/src/pages/custom/TokenItem.tsx +++ b/src/pages/custom/TokenItem.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next" import classNames from "classnames/bind" import AddIcon from "@mui/icons-material/Add" import CheckIcon from "@mui/icons-material/Check" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { FinderLink } from "components/general" import { Token } from "components/token" import styles from "./TokenItem.module.scss" diff --git a/src/pages/dashboard/components/SelectDenom.tsx b/src/pages/dashboard/components/SelectDenom.tsx index cd17a2ef5..0f8473bb7 100644 --- a/src/pages/dashboard/components/SelectDenom.tsx +++ b/src/pages/dashboard/components/SelectDenom.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next" -import { isDenomTerraNative } from "@terra.kitchen/utils" +import { isDenomTerraNative } from "@terra-money/terra-utils" import { WithTokenItem } from "data/token" import { ModalButton } from "components/feedback" import { TokenCard, TokenCardGrid } from "components/token" diff --git a/src/pages/gov/ProposalDeposits.tsx b/src/pages/gov/ProposalDeposits.tsx index ea19e0f6c..94cced7bc 100644 --- a/src/pages/gov/ProposalDeposits.tsx +++ b/src/pages/gov/ProposalDeposits.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next" import BigNumber from "bignumber.js" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { getAmount } from "utils/coin" import { combineState } from "data/query" import { useProposal } from "data/queries/gov" diff --git a/src/pages/gov/ProposalParams.tsx b/src/pages/gov/ProposalParams.tsx index b3b958402..97270697c 100644 --- a/src/pages/gov/ProposalParams.tsx +++ b/src/pages/gov/ProposalParams.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { useTallyParams } from "data/queries/gov" import { Card } from "components/layout" import DataList from "./components/DataList" diff --git a/src/pages/gov/ProposalVotes.tsx b/src/pages/gov/ProposalVotes.tsx index 909e401db..0535c08b8 100644 --- a/src/pages/gov/ProposalVotes.tsx +++ b/src/pages/gov/ProposalVotes.tsx @@ -2,7 +2,7 @@ import { useTranslation } from "react-i18next" import classNames from "classnames/bind" import BigNumber from "bignumber.js" import { StakingPool, Tally, TallyParams, Vote } from "@terra-money/feather.js" -import { readAmount, readPercent } from "@terra.kitchen/utils" +import { readAmount, readPercent } from "@terra-money/terra-utils" import { has } from "utils/num" import { combineState } from "data/query" import { useGetVoteOptionItem } from "data/queries/gov" diff --git a/src/pages/gov/ProposalVotesByValidator.tsx b/src/pages/gov/ProposalVotesByValidator.tsx index c6cb2869f..002f57e3c 100644 --- a/src/pages/gov/ProposalVotesByValidator.tsx +++ b/src/pages/gov/ProposalVotesByValidator.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next" import { Link } from "react-router-dom" import classNames from "classnames/bind" import EmailOutlinedIcon from "@mui/icons-material/EmailOutlined" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { ValAddress, Vote } from "@terra-money/feather.js" import { combineState } from "data/query" import { useDelegations, useValidators } from "data/queries/staking" diff --git a/src/pages/gov/components/Orb.tsx b/src/pages/gov/components/Orb.tsx index 089e5cec0..a9e4d404e 100644 --- a/src/pages/gov/components/Orb.tsx +++ b/src/pages/gov/components/Orb.tsx @@ -1,6 +1,6 @@ import classNames from "classnames/bind" import BigNumber from "bignumber.js" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { ReactComponent as Tilde } from "./Tilde.svg" import styles from "./Orb.module.scss" diff --git a/src/pages/nft/NFTAssetItem.tsx b/src/pages/nft/NFTAssetItem.tsx index 4d852cb9f..b31bf1d34 100644 --- a/src/pages/nft/NFTAssetItem.tsx +++ b/src/pages/nft/NFTAssetItem.tsx @@ -3,7 +3,7 @@ import classNames from "classnames/bind" import qs from "qs" import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined" import ShortcutOutlinedIcon from "@mui/icons-material/ShortcutOutlined" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { getIpfsGateway, useTokenInfoCW721 } from "data/queries/wasm" import { InternalButton, InternalLink } from "components/general" import { Grid } from "components/layout" diff --git a/src/pages/stake/ValidatorCommission.tsx b/src/pages/stake/ValidatorCommission.tsx index 147fe982e..39019a008 100644 --- a/src/pages/stake/ValidatorCommission.tsx +++ b/src/pages/stake/ValidatorCommission.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { Card } from "components/layout" import { ToNow } from "components/display" import ValidatorNumbers from "./components/ValidatorNumbers" diff --git a/src/pages/stake/ValidatorSummary.tsx b/src/pages/stake/ValidatorSummary.tsx index 3fdd2e059..38ea1ec88 100644 --- a/src/pages/stake/ValidatorSummary.tsx +++ b/src/pages/stake/ValidatorSummary.tsx @@ -1,6 +1,6 @@ import { useMemo } from "react" import { useTranslation } from "react-i18next" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { TerraValidator } from "types/validator" import { calcSelfDelegation } from "data/Terra/TerraAPI" import { Card } from "components/layout" diff --git a/src/pages/stake/ValidatorVotes.tsx b/src/pages/stake/ValidatorVotes.tsx index 5ab3d4472..874f14e01 100644 --- a/src/pages/stake/ValidatorVotes.tsx +++ b/src/pages/stake/ValidatorVotes.tsx @@ -2,7 +2,7 @@ import { useMemo } from "react" import { useTranslation } from "react-i18next" import { Link } from "react-router-dom" import { reverse } from "ramda" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { TerraValidator } from "types/validator" import { useGetVoteOptionItem } from "data/queries/gov" import { useVotingPowerRate } from "data/Terra/TerraAPI" diff --git a/src/pages/stake/ValidatorsList.tsx b/src/pages/stake/ValidatorsList.tsx index 79a147696..47aaa1d03 100644 --- a/src/pages/stake/ValidatorsList.tsx +++ b/src/pages/stake/ValidatorsList.tsx @@ -1,7 +1,7 @@ import { useMemo, useState } from "react" import { useTranslation } from "react-i18next" import { Link } from "react-router-dom" -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" import { Validator } from "@terra-money/feather.js" /* FIXME(terra.js): Import from terra.js */ import { BondStatus } from "@terra-money/terra.proto/cosmos/staking/v1beta1/staking" diff --git a/src/pages/stake/components/Uptime.tsx b/src/pages/stake/components/Uptime.tsx index 7a09d1df8..02633bacf 100644 --- a/src/pages/stake/components/Uptime.tsx +++ b/src/pages/stake/components/Uptime.tsx @@ -1,4 +1,4 @@ -import { readPercent } from "@terra.kitchen/utils" +import { readPercent } from "@terra-money/terra-utils" const Uptime = ({ children: value }: { children: number }) => { return {readPercent(value, { fixed: 2 })} diff --git a/src/pages/wallet/AssetActions.tsx b/src/pages/wallet/AssetActions.tsx index 269159284..750f00f22 100644 --- a/src/pages/wallet/AssetActions.tsx +++ b/src/pages/wallet/AssetActions.tsx @@ -4,7 +4,7 @@ import MonetizationOnOutlinedIcon from "@mui/icons-material/MonetizationOnOutlin import ShortcutOutlinedIcon from "@mui/icons-material/ShortcutOutlined" import RestartAltIcon from "@mui/icons-material/RestartAlt" import OpenInNewIcon from "@mui/icons-material/OpenInNew" -import { isDenomTerraNative } from "@terra.kitchen/utils" +import { isDenomTerraNative } from "@terra-money/terra-utils" import { has } from "utils/num" import { useNetworkName } from "data/wallet" import { useIsWalletEmpty } from "data/queries/bank" diff --git a/src/pages/wallet/SendPage.tsx b/src/pages/wallet/SendPage.tsx index 82db7c890..ffbda9f7f 100644 --- a/src/pages/wallet/SendPage.tsx +++ b/src/pages/wallet/SendPage.tsx @@ -5,7 +5,7 @@ import { MsgSend, MsgTransfer, } from "@terra-money/feather.js" -import { isDenom, toAmount } from "@terra.kitchen/utils" +import { isDenom, toAmount } from "@terra-money/terra-utils" import { useInterchainAddresses } from "auth/hooks/useAddress" import { Form, FormItem, FormWarning, Input, Select } from "components/form" import ChainSelector from "components/form/ChainSelector" diff --git a/src/pages/wallet/TransferPage.tsx b/src/pages/wallet/TransferPage.tsx index 6722af049..a597d6702 100644 --- a/src/pages/wallet/TransferPage.tsx +++ b/src/pages/wallet/TransferPage.tsx @@ -5,7 +5,7 @@ import { MsgSend, MsgTransfer, } from "@terra-money/feather.js" -import { isDenom, toAmount } from "@terra.kitchen/utils" +import { isDenom, toAmount } from "@terra-money/terra-utils" import { useInterchainAddresses } from "auth/hooks/useAddress" import { Form, FormItem, Input, Select } from "components/form" import ChainSelector from "components/form/ChainSelector" diff --git a/src/styles/themes/themes.tsx b/src/styles/themes/themes.tsx index af1f2cf3a..290b2b190 100644 --- a/src/styles/themes/themes.tsx +++ b/src/styles/themes/themes.tsx @@ -1,5 +1,5 @@ import { ReactNode } from "react" -import { toAmount } from "@terra.kitchen/utils" +import { toAmount } from "@terra-money/terra-utils" /* animation */ import AnimationLight from "./Light/Broadcasting.png" diff --git a/src/txs/AddressBook/AddAddressBookItem.tsx b/src/txs/AddressBook/AddAddressBookItem.tsx index 89e0e0884..33123c98f 100644 --- a/src/txs/AddressBook/AddAddressBookItem.tsx +++ b/src/txs/AddressBook/AddAddressBookItem.tsx @@ -2,7 +2,7 @@ import { useEffect } from "react" import { useTranslation } from "react-i18next" import { useForm } from "react-hook-form" import PersonIcon from "@mui/icons-material/Person" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { useAddressBook } from "data/settings/AddressBook" import { useTnsAddress } from "data/external/tns" import { InlineFlex } from "components/layout" diff --git a/src/txs/AddressBook/AddressBookList.tsx b/src/txs/AddressBook/AddressBookList.tsx index 03bbc098a..b49414fe5 100644 --- a/src/txs/AddressBook/AddressBookList.tsx +++ b/src/txs/AddressBook/AddressBookList.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next" import PersonAddOutlinedIcon from "@mui/icons-material/PersonAddOutlined" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { useAddressBook } from "data/settings/AddressBook" import { Button } from "components/general" import { Grid } from "components/layout" diff --git a/src/txs/Tx.tsx b/src/txs/Tx.tsx index 79a4a65aa..ba0e26af8 100644 --- a/src/txs/Tx.tsx +++ b/src/txs/Tx.tsx @@ -10,7 +10,7 @@ import { isNil } from "ramda" import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet" import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline" -import { isDenom } from "@terra.kitchen/utils" +import { isDenom } from "@terra-money/terra-utils" import { Coin, Coins, CreateTxOptions } from "@terra-money/feather.js" import { Fee } from "@terra-money/feather.js" import { ConnectType, UserDenied } from "@terra-money/wallet-types" diff --git a/src/txs/gov/DepositForm.tsx b/src/txs/gov/DepositForm.tsx index d8c54682c..33e22fd74 100644 --- a/src/txs/gov/DepositForm.tsx +++ b/src/txs/gov/DepositForm.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo } from "react" import { useTranslation } from "react-i18next" import { useForm } from "react-hook-form" import { MsgDeposit } from "@terra-money/feather.js" -import { toAmount } from "@terra.kitchen/utils" +import { toAmount } from "@terra-money/terra-utils" import { queryKey } from "data/query" import { useBankBalance } from "data/queries/bank" import { Form, FormItem, Input } from "components/form" diff --git a/src/txs/gov/SubmitProposalForm.tsx b/src/txs/gov/SubmitProposalForm.tsx index f5b82542e..7376103ad 100644 --- a/src/txs/gov/SubmitProposalForm.tsx +++ b/src/txs/gov/SubmitProposalForm.tsx @@ -10,8 +10,8 @@ import { } from "@terra-money/feather.js" import { ParameterChangeProposal, ParamChange } from "@terra-money/feather.js" import { ExecuteContractProposal } from "@terra-money/feather.js/dist/core/wasm/proposals" -import { isDenomTerraNative } from "@terra.kitchen/utils" -import { readAmount, toAmount } from "@terra.kitchen/utils" +import { isDenomTerraNative } from "@terra-money/terra-utils" +import { readAmount, toAmount } from "@terra-money/terra-utils" import { SAMPLE_ADDRESS } from "config/constants" import { getAmount } from "utils/coin" import { has } from "utils/num" diff --git a/src/txs/stake/QuickStakeForm.tsx b/src/txs/stake/QuickStakeForm.tsx index cbabb2032..f48742c9b 100644 --- a/src/txs/stake/QuickStakeForm.tsx +++ b/src/txs/stake/QuickStakeForm.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo } from "react" import { useTranslation } from "react-i18next" import { useForm } from "react-hook-form" import { Coin } from "@terra-money/feather.js" -import { toAmount } from "@terra.kitchen/utils" +import { toAmount } from "@terra-money/terra-utils" import { getAmount } from "utils/coin" import { combineState, queryKey } from "data/query" import { useNetwork } from "data/wallet" diff --git a/src/txs/stake/StakeForm.tsx b/src/txs/stake/StakeForm.tsx index ad984c10d..31cd98c34 100644 --- a/src/txs/stake/StakeForm.tsx +++ b/src/txs/stake/StakeForm.tsx @@ -5,7 +5,7 @@ import { AccAddress, Coin, ValAddress } from "@terra-money/feather.js" import { Delegation, Validator } from "@terra-money/feather.js" import { MsgDelegate, MsgUndelegate } from "@terra-money/feather.js" import { MsgBeginRedelegate } from "@terra-money/feather.js" -import { toAmount } from "@terra.kitchen/utils" +import { toAmount } from "@terra-money/terra-utils" import { getAmount } from "utils/coin" import { queryKey } from "data/query" import { useNetwork } from "data/wallet" diff --git a/src/txs/swap/SingleSwapContext.tsx b/src/txs/swap/SingleSwapContext.tsx index 067846692..3f38027bc 100644 --- a/src/txs/swap/SingleSwapContext.tsx +++ b/src/txs/swap/SingleSwapContext.tsx @@ -1,7 +1,7 @@ import { PropsWithChildren, useMemo } from "react" import { flatten, uniq, zipObj } from "ramda" import BigNumber from "bignumber.js" -import { isDenomIBC, toAmount } from "@terra.kitchen/utils" +import { isDenomIBC, toAmount } from "@terra-money/terra-utils" import { AccAddress } from "@terra-money/feather.js" import { getAmount, sortDenoms } from "utils/coin" import { toPrice } from "utils/num" diff --git a/src/txs/swap/TFMSwapContext.tsx b/src/txs/swap/TFMSwapContext.tsx index 0fca96940..b1288c0e7 100644 --- a/src/txs/swap/TFMSwapContext.tsx +++ b/src/txs/swap/TFMSwapContext.tsx @@ -1,6 +1,6 @@ import { PropsWithChildren, useMemo } from "react" import { zipObj } from "ramda" -import { isDenomIBC } from "@terra.kitchen/utils" +import { isDenomIBC } from "@terra-money/terra-utils" import { AccAddress } from "@terra-money/feather.js" import { getAmount } from "utils/coin" import createContext from "utils/createContext" diff --git a/src/txs/swap/TFMSwapForm.tsx b/src/txs/swap/TFMSwapForm.tsx index 9d137f38c..0c3d72f88 100644 --- a/src/txs/swap/TFMSwapForm.tsx +++ b/src/txs/swap/TFMSwapForm.tsx @@ -7,8 +7,8 @@ import update from "immutability-helper" import BigNumber from "bignumber.js" import { AccAddress, Coin, Coins } from "@terra-money/feather.js" import { MsgExecuteContract } from "@terra-money/feather.js" -import { isDenomTerra } from "@terra.kitchen/utils" -import { toAmount } from "@terra.kitchen/utils" +import { isDenomTerra } from "@terra-money/terra-utils" +import { toAmount } from "@terra-money/terra-utils" /* helpers */ import { has } from "utils/num" diff --git a/src/txs/swap/useSwapUtils.ts b/src/txs/swap/useSwapUtils.ts index 45d5c3faf..2925f1256 100644 --- a/src/txs/swap/useSwapUtils.ts +++ b/src/txs/swap/useSwapUtils.ts @@ -2,8 +2,8 @@ import { useCallback } from "react" import BigNumber from "bignumber.js" import { fromPairs, zipObj } from "ramda" import { Coin, Coins, MsgExecuteContract } from "@terra-money/feather.js" -import { isDenom, isDenomLuna } from "@terra.kitchen/utils" -import { isDenomTerra } from "@terra.kitchen/utils" +import { isDenom, isDenomLuna } from "@terra-money/terra-utils" +import { isDenomTerra } from "@terra-money/terra-utils" import { TERRASWAP_COMMISSION_RATE } from "config/constants" import { has, toPrice } from "utils/num" import { toAsset, toAssetInfo, toTokenItem } from "utils/coin" diff --git a/src/txs/utils.ts b/src/txs/utils.ts index 23d36474f..13c16d35e 100644 --- a/src/txs/utils.ts +++ b/src/txs/utils.ts @@ -1,5 +1,5 @@ import BigNumber from "bignumber.js" -import { readAmount, toAmount } from "@terra.kitchen/utils" +import { readAmount, toAmount } from "@terra-money/terra-utils" import { Coin, Coins } from "@terra-money/feather.js" import { has } from "utils/num" import { FindDecimals } from "./IBCHelperContext" diff --git a/src/txs/wasm/TransferCW721Form.tsx b/src/txs/wasm/TransferCW721Form.tsx index 6ce13746a..1242b7311 100644 --- a/src/txs/wasm/TransferCW721Form.tsx +++ b/src/txs/wasm/TransferCW721Form.tsx @@ -4,7 +4,7 @@ import { useForm } from "react-hook-form" import PersonIcon from "@mui/icons-material/Person" import { AccAddress } from "@terra-money/feather.js" import { MsgExecuteContract } from "@terra-money/feather.js" -import { truncate } from "@terra.kitchen/utils" +import { truncate } from "@terra-money/terra-utils" import { SAMPLE_ADDRESS } from "config/constants" import { queryKey } from "data/query" import { useNetwork } from "data/wallet" diff --git a/src/utils/coin.ts b/src/utils/coin.ts index aec009593..7f88ede78 100644 --- a/src/utils/coin.ts +++ b/src/utils/coin.ts @@ -1,5 +1,5 @@ import { AccAddress, Coins } from "@terra-money/feather.js" -import { isDenom, isDenomIBC } from "@terra.kitchen/utils" +import { isDenom, isDenomIBC } from "@terra-money/terra-utils" /* coin */ export const getAmount = ( From c699eef4eed050d8e440e92dbef081e120f593eb Mon Sep 17 00:00:00 2001 From: Mike <17463738+mwmerz@users.noreply.github.com> Date: Tue, 4 Apr 2023 10:37:30 -0400 Subject: [PATCH 03/12] feat: guard against empty networks, chaindID, or lcd (#327) --- src/pages/history/HistoryList.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/history/HistoryList.tsx b/src/pages/history/HistoryList.tsx index 9e9a50ec7..7b1fea2a2 100644 --- a/src/pages/history/HistoryList.tsx +++ b/src/pages/history/HistoryList.tsx @@ -34,9 +34,13 @@ const HistoryList = ({ chainID }: Props) => { const result: any[] = [] const txhases: string[] = [] + if (!networks || !networks[chainID] || !networks[chainID].lcd) { + return result + } + const requests = await Promise.all( - EVENTS.map((event) => - axios.get(`/cosmos/tx/v1beta1/txs`, { + EVENTS.map((event) => { + return axios.get(`/cosmos/tx/v1beta1/txs`, { baseURL: networks[chainID].lcd, params: { events: `${event}='${address}'`, @@ -46,7 +50,7 @@ const HistoryList = ({ chainID }: Props) => { "pagination.limit": LIMIT, }, }) - ) + }) ) for (const { data } of requests) { From 8c99b55704218d05d8ebe57a95f8e83b3b5fe540 Mon Sep 17 00:00:00 2001 From: plubber <51789398+ericHgorski@users.noreply.github.com> Date: Mon, 10 Apr 2023 13:06:34 -0400 Subject: [PATCH 04/12] feat: kado integration and updated wallet buttons (#320) * feat: kado integration and updated wallet buttons --- src/pages/wallet/AssetList.module.scss | 16 +---- src/pages/wallet/FiatRampModal.module.scss | 22 +++++++ src/pages/wallet/FiatRampModal.tsx | 52 +++++++++++----- src/pages/wallet/NetWorth.module.scss | 43 ++++++++++--- src/pages/wallet/NetWorth.tsx | 71 +++++++++++++++------- 5 files changed, 142 insertions(+), 62 deletions(-) create mode 100644 src/pages/wallet/FiatRampModal.module.scss diff --git a/src/pages/wallet/AssetList.module.scss b/src/pages/wallet/AssetList.module.scss index bda9098eb..d60306174 100644 --- a/src/pages/wallet/AssetList.module.scss +++ b/src/pages/wallet/AssetList.module.scss @@ -4,6 +4,7 @@ background-color: var(--card-bg-muted); padding-inline: 10px; grid-area: list; + display: grid; grid-template-areas: "title" "list"; grid-template-rows: min-content auto; @@ -22,18 +23,3 @@ grid-area: list; padding-bottom: 1.6rem; } - -.btn__container { - @include flex(center); - box-shadow: var(--box-shadow-btn); - background-color: var(--card-bg); - border-top: var(--border-width) solid var(--card-border); - align-self: flex-end; - margin: 0 -10px; - width: calc(100% + 20px); -} - -.btn { - margin: 16px 0px; - width: calc(100% - 40px); -} diff --git a/src/pages/wallet/FiatRampModal.module.scss b/src/pages/wallet/FiatRampModal.module.scss new file mode 100644 index 000000000..8bb7f515e --- /dev/null +++ b/src/pages/wallet/FiatRampModal.module.scss @@ -0,0 +1,22 @@ +@import "mixins"; + +.container { + position: relative; + @include flex; + height: 700px; + width: 450px; +} + +.loading { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 1; +} + +.iframe { + border: none; + width: 100%; + height: 100%; +} diff --git a/src/pages/wallet/FiatRampModal.tsx b/src/pages/wallet/FiatRampModal.tsx index 0c6e1c800..c8728b36e 100644 --- a/src/pages/wallet/FiatRampModal.tsx +++ b/src/pages/wallet/FiatRampModal.tsx @@ -1,33 +1,53 @@ import { FIAT_RAMP, KADO_API_KEY } from "config/constants" -import { useAddress } from "data/wallet" +import { useNetwork } from "data/wallet" import { useState } from "react" import { LoadingCircular } from "components/feedback" +import styles from "./FiatRampModal.module.scss" +import { useTheme } from "data/settings/Theme" +import qs from "qs" +import { useInterchainAddresses } from "auth/hooks/useAddress" const FiatRampModal = () => { - const address = useAddress() + const addresses = useInterchainAddresses() + const network = useNetwork() const [isLoading, setIsLoading] = useState(true) + const { name: theme } = useTheme() + + if (!addresses) return null + + const onToAddressMulti = Object.keys(addresses) + .map((key) => `${network[key]?.name}:${addresses[key]}`) + .join(",") const rampParams = { network: "Terra", - onToAddress: address || "", apiKey: KADO_API_KEY, + product: "BUY", + onRevCurrency: "USDC", + networkList: ["TERRA", "OSMOSIS", "KUJIRA", "JUNO"].join(","), + productList: ["BUY", "SELL"].join(","), + theme, + onToAddressMulti, + cryptoList: ["USDC"].join(","), } - const kadoUrlParams = new URLSearchParams(rampParams).toString() + const kadoUrlParams = qs.stringify(rampParams) + const src = `${FIAT_RAMP}?${kadoUrlParams}` return ( - <> - {isLoading && } - { -