From c79ea1cfa310d2117bb8168eda45f5722fc70620 Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Mon, 6 Jan 2025 12:55:39 +0545 Subject: [PATCH 1/6] refactor: remove warp related code & tokens --- assets/_locales/en/messages.json | 4 - assets/_locales/zh_CN/messages.json | 4 - package.json | 2 - .../modules/add_token/add_token.background.ts | 27 +- src/api/modules/dispatch/allowance.ts | 3 +- .../is_token_added.background.ts | 11 +- src/components/dashboard/Tokens.tsx | 96 +-- .../dashboard/list/TokenListItem.tsx | 56 +- .../dashboard/subsettings/TokenSettings.tsx | 199 +++--- src/components/popup/Token.tsx | 21 +- src/components/popup/asset/Interaction.tsx | 149 ----- src/components/popup/home/Tokens.tsx | 33 +- src/components/popup/list/TokenListItem.tsx | 43 +- src/lib/viewblock.ts | 11 - src/routes/auth/sign.tsx | 17 - src/routes/auth/token.tsx | 270 -------- src/routes/popup/index.tsx | 29 +- src/routes/popup/send/auth.tsx | 99 +-- src/routes/popup/send/confirm.tsx | 152 ++--- src/routes/popup/send/index.tsx | 111 +--- .../popup/settings/tokens/[id]/index.tsx | 41 +- src/routes/popup/settings/tokens/index.tsx | 52 +- src/routes/popup/token/[id].tsx | 577 ------------------ src/routes/popup/tokens.tsx | 28 +- src/settings/index.ts | 14 - src/tokens/currency.ts | 6 +- src/tokens/index.ts | 205 +------ src/tokens/token.ts | 319 +--------- src/utils/assertions.ts | 13 +- src/utils/notifications.ts | 37 +- src/utils/send.ts | 67 -- src/wallets/router/auth/auth.routes.ts | 5 - src/wallets/router/popup/popup.routes.ts | 5 - yarn.lock | 412 +------------ 34 files changed, 284 insertions(+), 2834 deletions(-) delete mode 100644 src/components/popup/asset/Interaction.tsx delete mode 100644 src/lib/viewblock.ts delete mode 100644 src/routes/auth/token.tsx delete mode 100644 src/utils/send.ts diff --git a/assets/_locales/en/messages.json b/assets/_locales/en/messages.json index 1652f180e..450e6081e 100644 --- a/assets/_locales/en/messages.json +++ b/assets/_locales/en/messages.json @@ -455,10 +455,6 @@ "message": "Currency", "description": "Select currency" }, - "setting_dre_node": { - "message": "Warp DRE node", - "description": "Warp DRE node setting title" - }, "setting_arverify": { "message": "ArVerify treshold", "description": "ArVerify settings title" diff --git a/assets/_locales/zh_CN/messages.json b/assets/_locales/zh_CN/messages.json index a8f454e09..b615f3116 100644 --- a/assets/_locales/zh_CN/messages.json +++ b/assets/_locales/zh_CN/messages.json @@ -451,10 +451,6 @@ "message": "货币", "description": "Select currency" }, - "setting_dre_node": { - "message": "Warp DRE 节点", - "description": "Warp DRE node setting title" - }, "setting_arverify": { "message": "ArVerify 阈值", "description": "ArVerify settings title" diff --git a/package.json b/package.json index b154fb585..ca3d6d499 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "dependencies": { "@arconnect/components": "^1.0.0", "@arconnect/keystone-sdk": "^0.0.5", - "@arconnect/warp-dre": "^0.0.1", "@arconnect/webext-bridge": "^5.0.6", "@iconicicons/react": "^1.5.0", "@keystonehq/arweave-keyring": "^0.1.1-alpha.0", @@ -89,7 +88,6 @@ "styled-components": "^5.3.6", "typed-assert": "^1.0.9", "uuid": "^9.0.0", - "warp-contracts": "^1.2.13", "webextension-polyfill": "^0.10.0", "wouter": "^3.3.5" }, diff --git a/src/api/modules/add_token/add_token.background.ts b/src/api/modules/add_token/add_token.background.ts index b9c06c704..59b4c2778 100644 --- a/src/api/modules/add_token/add_token.background.ts +++ b/src/api/modules/add_token/add_token.background.ts @@ -1,7 +1,4 @@ -import { isAddress, isTokenType, isValidURL } from "~utils/assertions"; import type { BackgroundModuleFunction } from "~api/background/background-modules"; -import { requestUserAuthorization } from "../../../utils/auth/auth.utils"; -import { getTokens } from "~tokens"; const background: BackgroundModuleFunction = async ( appData, @@ -9,29 +6,7 @@ const background: BackgroundModuleFunction = async ( type?: unknown, dre_node?: unknown ) => { - // validate input - isAddress(id); - - if (type) isTokenType(type); - if (dre_node) isValidURL(dre_node); - - // check if the token is added already - const tokens = await getTokens(); - - if (tokens.find((token) => token.id === id)) { - throw new Error("Token already added"); - } - - // request "add token" popup - await requestUserAuthorization( - { - type: "token", - tokenID: id, - tokenType: type, - dre: dre_node - }, - appData - ); + throw new Error("The addToken API is deprecated and removed."); }; export default background; diff --git a/src/api/modules/dispatch/allowance.ts b/src/api/modules/dispatch/allowance.ts index 29f3cb694..169584641 100644 --- a/src/api/modules/dispatch/allowance.ts +++ b/src/api/modules/dispatch/allowance.ts @@ -2,13 +2,12 @@ import { freeDecryptedWallet } from "~wallets/encryption"; import type { AllowanceBigNumber } from "~applications/allowance"; import type { ModuleAppData } from "~api/background/background-modules"; import { defaultGateway } from "~gateways/gateway"; -import type { JWKInterface } from "warp-contracts"; -import { allowanceAuth } from "../sign/allowance"; import { signAuth } from "../sign/sign_auth"; import Arweave from "arweave"; import type { DataItem } from "arbundles"; import type Transaction from "arweave/web/lib/transaction"; import type BigNumber from "bignumber.js"; +import type { JWKInterface } from "arweave/web/lib/wallet"; /** * Ensure allowance for dispatch diff --git a/src/api/modules/is_token_added/is_token_added.background.ts b/src/api/modules/is_token_added/is_token_added.background.ts index 6323082c3..dff4031c1 100644 --- a/src/api/modules/is_token_added/is_token_added.background.ts +++ b/src/api/modules/is_token_added/is_token_added.background.ts @@ -1,16 +1,7 @@ import type { BackgroundModuleFunction } from "~api/background/background-modules"; -import { isAddressFormat } from "~utils/format"; -import { getTokens } from "~tokens"; -import { isAddress } from "~utils/assertions"; const background: BackgroundModuleFunction = async (_, id: string) => { - // check id - isAddress(id); - - // check if the token is added - const tokens = await getTokens(); - - return !!tokens.find((token) => token.id === id); + throw new Error("The isTokenAdded API is deprecated and removed."); }; export default background; diff --git a/src/components/dashboard/Tokens.tsx b/src/components/dashboard/Tokens.tsx index beadaa937..d8463a18e 100644 --- a/src/components/dashboard/Tokens.tsx +++ b/src/components/dashboard/Tokens.tsx @@ -1,14 +1,13 @@ import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; import { useRoute } from "wouter"; -import { useEffect, useMemo, useState } from "react"; -import type { Token, TokenType } from "~tokens/token"; +import { useEffect, useMemo } from "react"; +import type { TokenType } from "~tokens/token"; import { Reorder } from "framer-motion"; import TokenListItem from "./list/TokenListItem"; import styled from "styled-components"; -import PermissionCheckbox from "~components/auth/PermissionCheckbox"; import browser from "webextension-polyfill"; -import { ButtonV2, Label, Spacer, Text } from "@arconnect/components"; +import { ButtonV2, Spacer } from "@arconnect/components"; import { type TokenInfoWithBalance } from "~tokens/aoTokens/ao"; import { useLocation } from "~wallets/router/router.utils"; @@ -18,14 +17,7 @@ export function TokensDashboardView() { const [matches, params] = useRoute<{ id?: string }>("/tokens/:id?"); // tokens - const [tokens, setTokens] = useStorage( - { - key: "tokens", - instance: ExtensionStorage - }, - [] - ); - const [aoTokens] = useStorage( + const [aoTokens, setAoTokens] = useStorage( { key: "ao_tokens", instance: ExtensionStorage @@ -44,23 +36,6 @@ export function TokensDashboardView() { })); }, [aoTokens]); - const [aoSettingsState, setaoSettingsState] = useState(true); - - useEffect(() => { - (async () => { - const currentSetting = await ExtensionStorage.get( - "setting_ao_support" - ); - setaoSettingsState(currentSetting); - })(); - }, []); - - const toggleaoSettings = async () => { - const newSetting = !aoSettingsState; - setaoSettingsState(newSetting); - await ExtensionStorage.set("setting_ao_support", newSetting); - }; - // active subsetting val const activeTokenSetting = useMemo( () => (params?.id ? params.id : undefined), @@ -72,22 +47,18 @@ export function TokensDashboardView() { return; } - const firstToken = tokens?.[0]; - - const allTokens = [...tokens, ...enhancedAoTokens]; - // return if there is a wallet present in params if ( activeTokenSetting && - allTokens.some((t) => t.id === activeTokenSetting) + enhancedAoTokens.some((t) => t.id === activeTokenSetting) ) { return; } - if (allTokens.length > 0) { - navigate(`/tokens/${allTokens[0].id}`); + if (enhancedAoTokens.length > 0) { + navigate(`/tokens/${enhancedAoTokens[0].id}`); } - }, [tokens, enhancedAoTokens, activeTokenSetting, matches]); + }, [enhancedAoTokens, activeTokenSetting, matches]); const addToken = () => { navigate("/tokens/new"); @@ -106,51 +77,22 @@ export function TokensDashboardView() { return ( -
- - {browser.i18n.getMessage(!!aoSettingsState ? "enabled" : "disabled")} -
- - {browser.i18n.getMessage("setting_ao_support_description")} - -
- +
- {enhancedAoTokens.length > 0 && aoSettingsState && ( - <> - - {enhancedAoTokens.map((token) => ( -
handleTokenClick(token)} key={token.id}> - -
- ))} - - )} - - - {tokens.map((token) => ( - + {enhancedAoTokens.map((token) => ( +
handleTokenClick(token)} key={token.id}> + +
))}
diff --git a/src/components/dashboard/list/TokenListItem.tsx b/src/components/dashboard/list/TokenListItem.tsx index 75abe6774..11a383c2d 100644 --- a/src/components/dashboard/list/TokenListItem.tsx +++ b/src/components/dashboard/list/TokenListItem.tsx @@ -1,12 +1,9 @@ -import { DREContract, DRENode, NODES } from "@arconnect/warp-dre"; -import { loadTokenLogo, type Token } from "~tokens/token"; +import { type Token } from "~tokens/token"; import { Reorder, useDragControls } from "framer-motion"; import { useEffect, useMemo, useState } from "react"; import { ListItem } from "@arconnect/components"; import { formatAddress } from "~utils/format"; -import { getDreForToken } from "~tokens"; import { useTheme } from "~utils/theme"; -import * as viewblock from "~lib/viewblock"; import styled from "styled-components"; import { FULL_HISTORY, useGateway } from "~gateways/wayfinder"; import { concatGatewayURL } from "~gateways/utils"; @@ -15,7 +12,7 @@ import arLogoDark from "url:/assets/ar/logo_dark.png"; import { getUserAvatar } from "~lib/avatar"; import { useLocation } from "~wallets/router/router.utils"; -export default function TokenListItem({ token, active, ao, onClick }: Props) { +export default function TokenListItem({ token, active, onClick }: Props) { const { navigate } = useLocation(); // format address @@ -31,7 +28,7 @@ export default function TokenListItem({ token, active, ao, onClick }: Props) { const theme = useTheme(); // token logo - const [image, setImage] = useState(viewblock.getTokenLogo(token.id)); + const [image, setImage] = useState(arLogoDark); // gateway const gateway = useGateway(FULL_HISTORY); @@ -41,32 +38,20 @@ export default function TokenListItem({ token, active, ao, onClick }: Props) { try { // if it is a collectible, we don't need to determinate the logo if (token.type === "collectible") { - return setImage( - `${concatGatewayURL(token.gateway || gateway)}/${token.id}` - ); + return setImage(`${concatGatewayURL(gateway)}/${token.id}`); } - if (ao) { - if (token.defaultLogo) { - const logo = await getUserAvatar(token.defaultLogo); - return setImage(logo); - } else { - return setImage(arLogoDark); - } - } - - // query community logo using Warp DRE - const node = new DRENode(await getDreForToken(token.id)); - const contract = new DREContract(token.id, node); - const result = await contract.query<[string]>( - "$.settings.[?(@[0] === 'communityLogo')][1]" - ); - setImage(await loadTokenLogo(token.id, result[0], theme)); + if (token.defaultLogo) { + const logo = await getUserAvatar(token.defaultLogo); + return setImage(logo); + } else { + return setImage(arLogoDark); + } } catch { - setImage(viewblock.getTokenLogo(token.id)); + setImage(arLogoDark); } })(); - }, [token, theme, gateway, ao]); + }, [token, theme, gateway]); const handleClick = () => { if (onClick) { @@ -90,12 +75,11 @@ export default function TokenListItem({ token, active, ao, onClick }: Props) { description={ {formattedAddress} - {ao && ao logo} - {!ao && {token.type}} + ao logo } active={active} - dragControls={!ao ? dragControls : null} + dragControls={null} > @@ -128,18 +112,6 @@ const TokenLogo = styled.img.attrs({ transform: translate(-50%, -50%); `; -const TokenType = styled.span` - padding: 0.08rem 0.2rem; - background-color: rgb(${(props) => props.theme.theme}); - color: #fff; - font-weight: 500; - font-size: 0.62rem; - text-transform: uppercase; - margin-left: 0.45rem; - width: max-content; - border-radius: 5px; -`; - interface Props { token: Token; ao?: boolean; diff --git a/src/components/dashboard/subsettings/TokenSettings.tsx b/src/components/dashboard/subsettings/TokenSettings.tsx index d6f9e4885..34f2b3b78 100644 --- a/src/components/dashboard/subsettings/TokenSettings.tsx +++ b/src/components/dashboard/subsettings/TokenSettings.tsx @@ -2,20 +2,17 @@ import { ButtonV2, Loading, SelectV2, - Spacer, Text, TooltipV2, useToasts } from "@arconnect/components"; -import type { Token, TokenType } from "~tokens/token"; +import type { TokenType } from "~tokens/token"; import { Token as aoToken } from "ao-tokens"; import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; -import { AnimatePresence } from "framer-motion"; import { TrashIcon } from "@iconicicons/react"; import { removeToken } from "~tokens"; import { useMemo, useState } from "react"; -import CustomGatewayWarning from "~components/auth/CustomGatewayWarning"; import { CopyButton } from "./WalletSettings"; import browser from "webextension-polyfill"; import styled from "styled-components"; @@ -25,7 +22,6 @@ import { formatAddress } from "~utils/format"; import { ResetButton } from "../Reset"; import { RefreshCcw01 } from "@untitled-ui/icons-react"; import { defaultAoTokens, type TokenInfo } from "~tokens/aoTokens/ao"; -import TokenLoading from "~components/popup/asset/Loading"; import type { CommonRouteProps } from "~wallets/router/router.types"; export interface TokenSettingsDashboardViewParams { @@ -38,15 +34,6 @@ export type TokenSettingsDashboardViewProps = export function TokenSettingsDashboardView({ params: { id } }: TokenSettingsDashboardViewProps) { - // tokens - const [tokens, setTokens] = useStorage( - { - key: "tokens", - instance: ExtensionStorage - }, - [] - ); - // ao tokens const [aoTokens, setAoTokens] = useStorage( { @@ -60,29 +47,20 @@ export function TokenSettingsDashboardView({ const [loading, setLoading] = useState(false); - const { token, isAoToken } = useMemo(() => { + const token = useMemo(() => { const aoToken = aoTokens.find((ao) => ao.processId === id); - if (aoToken) { - return { - token: { - ...aoToken, - id: aoToken.processId, - name: aoToken.Name, - ticker: aoToken.Ticker - }, - isAoToken: true - }; - } - const regularToken = tokens.find((t) => t.id === id); + return { - token: regularToken, - isAoToken: false + ...aoToken, + id: aoToken.processId, + name: aoToken.Name, + ticker: aoToken.Ticker }; - }, [tokens, aoTokens, id]); + }, [aoTokens, id]); // update token type function updateType(type: TokenType) { - setTokens((allTokens) => { + setAoTokens((allTokens) => { const tokenIndex = allTokens.findIndex((t) => t.id === id); if (tokenIndex !== -1) { allTokens[tokenIndex].type = type; @@ -128,88 +106,76 @@ export function TokenSettingsDashboardView({ return ( - {isAoToken ? ( - - - {token.name} - -
- Symbol: - - {token.ticker} - -
-
- Address: -
- - {formatAddress(token.id, 10)} - - - { - copy(token.id); - setToast({ - type: "info", - content: browser.i18n.getMessage("copied_address", [ - formatAddress(token.id, 8) - ]), - duration: 2200 - }); - }} - /> - -
-
-
- Denomination: + + + {token.name} + +
+ Symbol: + + {token.ticker} + +
+
+ Address: +
- {token?.Denomination} + {formatAddress(token.id, 10)} + + { + copy(token.id); + setToast({ + type: "info", + content: browser.i18n.getMessage("copied_address", [ + formatAddress(token.id, 8) + ]), + duration: 2200 + }); + }} + /> +
- - ) : ( +
- {token.name} - - { - // @ts-expect-error - updateType(e.target.value as TokenType); - }} - fullWidth - > - - - - - {token?.gateway && } - + Denomination: + + {token?.Denomination} +
- )} + { + // @ts-expect-error + updateType(e.target.value as TokenType); + }} + fullWidth + > + + + +
- {isAoToken && ( - { - await refreshToken(); - }} - > - {!loading ? ( - <> - - {browser.i18n.getMessage("refresh_token")} - - ) : ( - - )} - - )} + { + await refreshToken(); + }} + > + {!loading ? ( + <> + + {browser.i18n.getMessage("refresh_token")} + + ) : ( + + )} + removeToken(id)}> @@ -253,25 +219,6 @@ const TokenName = styled(Text).attrs({ font-weight: 600; `; -const TokenAddress = styled(Text).attrs({ - margin: true -})` - font-weight: 500; - margin-top: 8px; - font-size: 1rem; - display: flex; - align-items: center; - gap: 0.37rem; -`; - -const Symbol = styled(Text).attrs({ - margin: true -})` - font-weight: 500; - font-size: 1rem; - margin-top: 8px; -`; - const Title = styled(Text).attrs({ noMargin: true })` diff --git a/src/components/popup/Token.tsx b/src/components/popup/Token.tsx index 361ec5b68..1d176d1e2 100644 --- a/src/components/popup/Token.tsx +++ b/src/components/popup/Token.tsx @@ -7,7 +7,7 @@ import { useState } from "react"; import { hoverEffect, useTheme } from "~utils/theme"; -import { loadTokenLogo, type Token } from "~tokens/token"; +import { type Token } from "~tokens/token"; import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; import { ButtonV2, Text, TooltipV2 } from "@arconnect/components"; @@ -15,7 +15,6 @@ import { useArPrice } from "~lib/coingecko"; import { usePrice } from "~lib/redstone"; import arLogoLight from "url:/assets/ar/logo_light.png"; import arLogoDark from "url:/assets/ar/logo_dark.png"; -import * as viewblock from "~lib/viewblock"; import Squircle from "~components/Squircle"; import useSetting from "~settings/hook"; import styled from "styled-components"; @@ -96,22 +95,18 @@ export default function Token({ onClick, ...props }: Props) { useEffect(() => { (async () => { if (!props?.id || logo) return; - if (!props?.ao) { - setLogo(viewblock.getTokenLogo(props.id)); - setLogo(await loadTokenLogo(props.id, props.defaultLogo, theme)); + + if (props.defaultLogo) { + const logo = await getUserAvatar(props.defaultLogo); + setLogo(logo); } else { - if (props.defaultLogo) { - const logo = await getUserAvatar(props.defaultLogo); - setLogo(logo); - } else { - setLogo(arweaveLogo); - } + setLogo(arweaveLogo); } })(); }, [props, theme, logo, arweaveLogo]); useEffect(() => { - if (props?.ao && !props.defaultLogo) { + if (!props.defaultLogo) { setLogo(arweaveLogo); } }, [arweaveLogo]); @@ -154,7 +149,7 @@ export default function Token({ onClick, ...props }: Props) { {props.name || props.ticker || "???"} - {props?.ao && ao logo} + ao logo diff --git a/src/components/popup/asset/Interaction.tsx b/src/components/popup/asset/Interaction.tsx deleted file mode 100644 index cd7e21491..000000000 --- a/src/components/popup/asset/Interaction.tsx +++ /dev/null @@ -1,149 +0,0 @@ -import { type MouseEventHandler, useEffect, useState } from "react"; -import { type DisplayTheme, Text } from "@arconnect/components"; -import type { TokenInteraction } from "~tokens/token"; -import { hoverEffect, useTheme } from "~utils/theme"; -import { type AnsUser, getAnsProfile } from "~lib/ans"; -import { formatAddress } from "~utils/format"; -import { - ArrowDownLeftIcon, - ArrowUpRightIcon, - CodeIcon -} from "@iconicicons/react"; -import Squircle from "~components/Squircle"; -import styled from "styled-components"; - -export default function Interaction({ - id, - type, - qty, - otherAddress, - function: fn, - onClick -}: TokenInteraction & Props) { - // display theme - const displayTheme = useTheme(); - - // recipient - const [recipient, setRecipient] = useState(""); - - // fetch recipient label - useEffect(() => { - (async () => { - if (!otherAddress) { - return; - } - - setRecipient(formatAddress(otherAddress, 6)); - - const ans = (await getAnsProfile(otherAddress)) as AnsUser; - - if (!ans || !ans.currentLabel) { - return; - } - - setRecipient(ans.currentLabel + ".ar"); - })(); - }, [otherAddress]); - - return ( - - - - {type === "in" && } - {type === "out" && } - {type === "interaction" && } - -
- {formatAddress(id, 7)} - {qty} -
-
- {(type === "interaction" && `${fn}()`) || recipient} -
- ); -} - -const Wrapper = styled.div` - position: relative; - display: flex; - align-items: center; - justify-content: space-between; - cursor: pointer; - transition: transform 0.07s ease-in-out, opacity 0.23s ease-in-out; - - ${hoverEffect} - - &::after { - width: calc(100% + 15px); - height: calc(100% + 15px); - border-radius: 12px; - } - - &:active { - transform: scale(0.98); - } -`; - -const DataWrapper = styled.div` - display: flex; - align-items: center; - gap: 0.75rem; -`; - -const InteractionIconWrapper = styled(Squircle)<{ displayTheme: DisplayTheme }>` - position: relative; - color: rgb( - ${(props) => - props.displayTheme === "light" ? "0, 0, 0" : props.theme.cardBackground} - ); - width: 2.65rem; - height: 2.65rem; -`; - -const Icon = styled(ArrowUpRightIcon)` - position: absolute; - top: 50%; - left: 50%; - font-size: 1.7rem; - width: 1em; - height: 1em; - transform: translate(-50%, -50%); -`; - -const OutIcon = styled(Icon)` - color: #ff0000; -`; - -const InIcon = styled(Icon).attrs({ - as: ArrowDownLeftIcon -})` - color: #14d110; -`; - -const InteractionIcon = styled(Icon).attrs({ - as: CodeIcon -})` - color: rgb(${(props) => props.theme.theme}); -`; - -const InteractionID = styled(Text).attrs({ - noMargin: true -})` - font-size: 1rem; - color: rgb(${(props) => props.theme.primaryText}); -`; - -const Function = styled(InteractionID)` - font-size: 0.82rem; - text-align: right; -`; - -const Quantity = styled.span` - font-size: 0.75rem; - color: rgb(${(props) => props.theme.secondaryText}); - font-weight: 500; -`; - -interface Props { - onClick?: MouseEventHandler; -} diff --git a/src/components/popup/home/Tokens.tsx b/src/components/popup/home/Tokens.tsx index 8af454f21..3d98cb6db 100644 --- a/src/components/popup/home/Tokens.tsx +++ b/src/components/popup/home/Tokens.tsx @@ -1,7 +1,5 @@ import { Heading, TokenCount, ViewAll } from "../Title"; -import { Spacer, Text } from "@arconnect/components"; -import { useTokens } from "~tokens"; -import { useMemo } from "react"; +import { Spacer } from "@arconnect/components"; import browser from "webextension-polyfill"; import styled from "styled-components"; import Token from "../Token"; @@ -11,20 +9,11 @@ import { useLocation } from "~wallets/router/router.utils"; export default function Tokens() { const { navigate } = useLocation(); - // all tokens - const tokens = useTokens(); - // all tokens const [aoTokens, loading] = useAoTokens({ type: "asset" }); - // assets - const assets = useMemo( - () => tokens.filter((token) => token.type === "asset"), - [tokens] - ); - // handle aoClick - function handleTokenClick(tokenId) { + function handleTokenClick(tokenId: string) { navigate(`/send/transfer/${tokenId}`); } @@ -33,13 +22,10 @@ export default function Tokens() { navigate("/tokens")}> {browser.i18n.getMessage("view_all")} - ({assets.length + aoTokens.length}) + ({aoTokens.length}) - {assets.length === 0 && aoTokens.length === 0 && ( - {browser.i18n.getMessage("no_assets")} - )} {aoTokens.map((token) => ( handleTokenClick(token.id)} /> ))} - {assets.slice(0, 8).map((token, i) => ( - navigate(`/token/${token.id}`)} - key={i} - /> - ))} ); @@ -74,9 +53,3 @@ const TokensList = styled.div` flex-direction: column; gap: 0.82rem; `; - -const NoTokens = styled(Text).attrs({ - noMargin: true -})` - text-align: center; -`; diff --git a/src/components/popup/list/TokenListItem.tsx b/src/components/popup/list/TokenListItem.tsx index e3511928f..c59b3bf0d 100644 --- a/src/components/popup/list/TokenListItem.tsx +++ b/src/components/popup/list/TokenListItem.tsx @@ -1,10 +1,6 @@ import styled from "styled-components"; -import { DREContract, DRENode } from "@arconnect/warp-dre"; -import { loadTokenLogo } from "~tokens/token"; import { formatAddress } from "~utils/format"; -import { getDreForToken } from "~tokens"; import { useTheme } from "~utils/theme"; -import * as viewblock from "~lib/viewblock"; import { FULL_HISTORY, useGateway } from "~gateways/wayfinder"; import { concatGatewayURL } from "~gateways/utils"; import aoLogo from "url:/assets/ecosystem/ao-logo.svg"; @@ -16,12 +12,11 @@ import { useEffect, useMemo, useState } from "react"; export interface TokenListItemProps { token: Token; - ao?: boolean; active: boolean; onClick?: () => void; } -export function TokenListItem({ token, ao, onClick }: TokenListItemProps) { +export function TokenListItem({ token, onClick }: TokenListItemProps) { const { navigate } = useLocation(); // format address @@ -34,7 +29,7 @@ export function TokenListItem({ token, ao, onClick }: TokenListItemProps) { const theme = useTheme(); // token logo - const [image, setImage] = useState(viewblock.getTokenLogo(token.id)); + const [image, setImage] = useState(arLogoDark); // gateway const gateway = useGateway(FULL_HISTORY); @@ -44,32 +39,20 @@ export function TokenListItem({ token, ao, onClick }: TokenListItemProps) { try { // if it is a collectible, we don't need to determinate the logo if (token.type === "collectible") { - return setImage( - `${concatGatewayURL(token.gateway || gateway)}/${token.id}` - ); + return setImage(`${concatGatewayURL(gateway)}/${token.id}`); } - if (ao) { - if (token.defaultLogo) { - const logo = await getUserAvatar(token.defaultLogo); - return setImage(logo); - } else { - return setImage(arLogoDark); - } - } - - // query community logo using Warp DRE - const node = new DRENode(await getDreForToken(token.id)); - const contract = new DREContract(token.id, node); - const result = await contract.query<[string]>( - "$.settings.[?(@[0] === 'communityLogo')][1]" - ); - setImage(await loadTokenLogo(token.id, result[0], theme)); + if (token.defaultLogo) { + const logo = await getUserAvatar(token.defaultLogo); + return setImage(logo); + } else { + return setImage(arLogoDark); + } } catch { - setImage(viewblock.getTokenLogo(token.id)); + setImage(arLogoDark); } })(); - }, [token, theme, gateway, ao]); + }, [token, theme, gateway]); const handleClick = () => { if (onClick) { @@ -86,8 +69,8 @@ export function TokenListItem({ token, ao, onClick }: TokenListItemProps) { {token.name} {formattedAddress} - {ao && } - {!ao && {token.type}} + + {token.type}
diff --git a/src/lib/viewblock.ts b/src/lib/viewblock.ts deleted file mode 100644 index 44ee68f25..000000000 --- a/src/lib/viewblock.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { DisplayTheme } from "@arconnect/components"; - -/** - * Get logo for a token using Viewblock's API - * - * @param id Contract ID of the token - * @param theme UI theme to match the logo with - */ -export function getTokenLogo(id: string, theme: DisplayTheme = "light") { - return `https://meta.viewblock.io/arweave.${id}/logo?t=${theme}`; -} diff --git a/src/routes/auth/sign.tsx b/src/routes/auth/sign.tsx index a7eafd2ea..f3b568b70 100644 --- a/src/routes/auth/sign.tsx +++ b/src/routes/auth/sign.tsx @@ -144,23 +144,6 @@ export function SignAuthRequestView() { const recipient = useMemo(() => { if (tags.length === 0) return transaction?.target || ""; - // Warp Token - const isWarpTx = - tags.some( - (tag) => tag.name === "App-Name" && tag.value === "SmartWeaveAction" - ) && tags.some((tag) => tag.name === "Contract"); - if (isWarpTx) { - const inputTag = tags.find((tag) => tag.name === "Input"); - if (inputTag?.value) { - try { - const inputValue = JSON.parse(inputTag.value); - if (inputValue?.function === "transfer" && inputValue?.target) { - return inputValue.target; - } - } catch (error) {} - } - } - // AO Token const isAOTransferTx = tags.some((tag) => tag.name === "Data-Protocol" && tag.value === "ao") && diff --git a/src/routes/auth/token.tsx b/src/routes/auth/token.tsx deleted file mode 100644 index de5f6fc21..000000000 --- a/src/routes/auth/token.tsx +++ /dev/null @@ -1,270 +0,0 @@ -import { - getSettings, - loadTokenLogo, - tokenTypeRegistry, - type TokenState, - type TokenType -} from "~tokens/token"; -import { AnimatePresence, motion, type Variants } from "framer-motion"; -import { usePrice, usePriceHistory } from "~lib/redstone"; -import { useEffect, useMemo, useState } from "react"; -import { useTheme } from "~utils/theme"; -import { addToken, getDreForToken } from "~tokens"; -import { - ButtonV2, - Section, - Spacer, - Text, - useToasts -} from "@arconnect/components"; -import PeriodPicker from "~components/popup/asset/PeriodPicker"; -import PriceChart from "~components/popup/asset/PriceChart"; -import { DREContract, DRENode } from "@arconnect/warp-dre"; -import Thumbnail from "~components/popup/asset/Thumbnail"; -import Wrapper from "~components/auth/Wrapper"; -import * as viewblock from "~lib/viewblock"; -import browser from "webextension-polyfill"; -import Title from "~components/popup/Title"; -import Head from "~components/popup/Head"; -import styled from "styled-components"; -import { concatGatewayURL } from "~gateways/utils"; -import { findGateway, FULL_HISTORY, useGateway } from "~gateways/wayfinder"; -import { useCurrentAuthRequest } from "~utils/auth/auth.hooks"; -import { HeadAuth } from "~components/HeadAuth"; -import { AuthButtons } from "~components/auth/AuthButtons"; - -export function TokenAuthRequestView() { - const { authRequest, acceptRequest, rejectRequest } = - useCurrentAuthRequest("token"); - - const { - url, - tokenID, - dre: dreRequestParam, - tokenType: tokenTypeParam - } = authRequest; - - // price period - const [period, setPeriod] = useState("Day"); - - // load state - const [state, setState] = useState(); - - useEffect(() => { - (async () => { - if (!tokenID) return; - - let dre = dreRequestParam; - - if (!dre) dre = await getDreForToken(tokenID); - - const contract = new DREContract(tokenID, new DRENode(dre)); - const { state } = await contract.getState(); - - setState(state); - })(); - }, [tokenID, dreRequestParam]); - - // token settings - const settings = useMemo(() => getSettings(state), [state]); - - // toasts - const { setToast } = useToasts(); - - // loading - const [loading, setLoading] = useState(false); - - // load type - const [tokenType, setTokenType] = useState(); - - useEffect(() => { - (async () => { - if (!tokenID) return; - - const gw = await findGateway({ startBlock: 0 }); - - let type = tokenTypeParam; - - if (!type) { - if (tokenTypeRegistry[tokenID]) { - // manual override - type = tokenTypeRegistry[tokenID]; - } else { - // fetch data - const data = await fetch(`${concatGatewayURL(gw)}/${tokenID}`); - - type = data.headers.get("content-type").includes("application/json") - ? "asset" - : "collectible"; - } - } - - setTokenType(type); - })(); - }, [tokenID, tokenTypeParam]); - - // add the token - async function done() { - if (!tokenID || !tokenType || !state) { - return; - } - - setLoading(true); - - try { - // add the token - await addToken(tokenID, tokenType, dreRequestParam); - - acceptRequest(); - } catch (e) { - console.log("Failed to add token", e); - - setToast({ - type: "error", - content: browser.i18n.getMessage("token_add_failure"), - duration: 2200 - }); - } - - setLoading(false); - } - - // token price - const { price } = usePrice(state?.ticker); - - // token historical prices - const { prices: historicalPrices, loading: loadingHistoricalPrices } = - usePriceHistory(period, state?.ticker); - - // display theme - const theme = useTheme(); - - // token logo - const [logo, setLogo] = useState(); - - useEffect(() => { - (async () => { - if (!tokenID) return; - - setLogo(viewblock.getTokenLogo(tokenID)); - - if (!state) return; - - const settings = getSettings(state); - - setLogo( - await loadTokenLogo(tokenID, settings.get("communityLogo"), theme) - ); - })(); - }, [tokenID, state, theme]); - - // listen for enter to add - useEffect(() => { - const listener = async (e: KeyboardEvent) => { - if (e.key !== "Enter") return; - - await done(); - }; - - window.addEventListener("keydown", listener); - - return () => window.removeEventListener("keydown", listener); - }, [done]); - - const gateway = useGateway(FULL_HISTORY); - - return ( - -
- - -
- - {browser.i18n.getMessage("addTokenParagraph", url)} - -
- - {state && tokenType && ( - - {(tokenType === "asset" && ( - - setPeriod(p)} - /> - - )) || ( - <> - -
- - {state.name || state.ticker}{" "} - {state.name && ( - ({state.ticker.toUpperCase()}) - )} - - - - {(settings && settings.get("communityDescription")) || - state.description || - browser.i18n.getMessage("no_description")} - -
- - )} -
- )} -
-
-
- rejectRequest() - }} - /> -
-
- ); -} - -const chartAnimation: Variants = { - hidden: { opacity: 0 }, - shown: { opacity: 1 } -}; - -const TokenName = styled(Title)` - display: flex; - gap: 0.3rem; -`; - -const Ticker = styled.span` - color: rgb(${(props) => props.theme.secondaryText}); -`; - -const Description = styled(Text).attrs({ - noMargin: true -})` - font-size: 0.98rem; - text-align: justify; -`; diff --git a/src/routes/popup/index.tsx b/src/routes/popup/index.tsx index 538e76f84..e450a0c46 100644 --- a/src/routes/popup/index.tsx +++ b/src/routes/popup/index.tsx @@ -1,6 +1,6 @@ import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useState } from "react"; import WalletHeader from "~components/popup/WalletHeader"; import NoBalance from "~components/popup/home/NoBalance"; import Balance from "~components/popup/home/Balance"; @@ -14,7 +14,6 @@ import { checkWalletBits } from "~utils/analytics"; import styled from "styled-components"; -import { useTokens } from "~tokens"; import { useAoTokens } from "~tokens/aoTokens/ao"; import { useActiveWallet, useBalance } from "~wallets/hooks"; import BuyButton from "~components/popup/home/BuyButton"; @@ -47,30 +46,19 @@ export function HomeView() { const balance = useBalance(); - // all tokens - const tokens = useTokens(); - // ao Tokens const [aoTokens, aoTokensLoading] = useAoTokens(); // checking to see if it's a hardware wallet const wallet = useActiveWallet(); - // assets - const assets = useMemo( - () => tokens.filter((token) => token.type === "asset"), - [tokens] - ); - useEffect(() => { if (!activeAddress) return; - const findBalances = async (assets, aoTokens) => { + const findBalances = async (aoTokens) => { const hasTokensWithBalance = aoTokensLoading || - [...assets, ...aoTokens].some((token) => - BigNumber(token.balance || "0").gt(0) - ); + aoTokens.some((token) => BigNumber(token.balance || "0").gt(0)); if ( hasTokensWithBalance || @@ -84,18 +72,11 @@ export function HomeView() { }; try { - findBalances(assets, aoTokens); + findBalances(aoTokens); } catch (error) { console.log(error); } - }, [ - activeAddress, - assets, - aoTokens, - balance, - historicalBalance, - aoTokensLoading - ]); + }, [activeAddress, aoTokens, balance, historicalBalance, aoTokensLoading]); useEffect(() => { const trackEventAndPage = async () => { diff --git a/src/routes/popup/send/auth.tsx b/src/routes/popup/send/auth.tsx index 8da45b045..4535394aa 100644 --- a/src/routes/popup/send/auth.tsx +++ b/src/routes/popup/send/auth.tsx @@ -39,12 +39,6 @@ import { fallbackGateway, type Gateway } from "~gateways/gateway"; -import { - getWarpGatewayUrl, - isUrlOnline, - isUToken, - sendRequest -} from "~utils/send"; import { EventType, trackEvent } from "~utils/analytics"; import BigNumber from "bignumber.js"; import type { CommonRouteProps } from "~wallets/router/router.types"; @@ -100,8 +94,6 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { }; } - const uToken = isUToken(tokenID); - /** * Submit transaction to the network * @@ -152,34 +144,15 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { }, 10000); }); - if (uToken) { - try { - const isOnline = await isUrlOnline(getWarpGatewayUrl("gw")); - const config = { - url: getWarpGatewayUrl(isOnline ? "gw" : "gateway", "sequencer"), - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json" - }, - body: JSON.stringify(transaction) - }; - await sendRequest(config); - } catch (err) { - console.log("err", err); - throw new Error("Unknown error occurred"); - } - } else { - try { - await Promise.race([ - arweave.transactions.post(transaction), - timeoutPromise - ]); - } catch (err) { - // SEGMENT - await trackEvent(EventType.TRANSACTION_INCOMPLETE, {}); - throw new Error("Error with posting to Arweave"); - } + try { + await Promise.race([ + arweave.transactions.post(transaction), + timeoutPromise + ]); + } catch (err) { + // SEGMENT + await trackEvent(EventType.TRANSACTION_INCOMPLETE, {}); + throw new Error("Error with posting to Arweave"); } } @@ -242,14 +215,12 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { // Post the transaction await submitTx(transaction, arweave, type); } catch (e) { - if (!uToken) { - // FALLBACK IF ISP BLOCKS ARWEAVE.NET OR IF WAYFINDER FAILS - gateway = fallbackGateway; - const fallbackArweave = new Arweave(gateway); - await fallbackArweave.transactions.sign(transaction, keyfile); - await submitTx(transaction, fallbackArweave, type); - await trackEvent(EventType.FALLBACK, {}); - } + // FALLBACK IF ISP BLOCKS ARWEAVE.NET OR IF WAYFINDER FAILS + gateway = fallbackGateway; + const fallbackArweave = new Arweave(gateway); + await fallbackArweave.transactions.sign(transaction, keyfile); + await submitTx(transaction, fallbackArweave, type); + await trackEvent(EventType.FALLBACK, {}); } // Success toast @@ -260,11 +231,9 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { }); // Redirect - uToken - ? navigate("/") - : navigate( - `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` - ); + navigate( + `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` + ); // remove wallet from memory freeDecryptedWallet(keyfile); @@ -311,14 +280,12 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { // post tx await submitTx(transaction, arweave, type); } catch (e) { - if (!uToken) { - // FALLBACK IF ISP BLOCKS ARWEAVE.NET OR IF WAYFINDER FAILS - gateway = fallbackGateway; - const fallbackArweave = new Arweave(gateway); - await fallbackArweave.transactions.sign(transaction, keyfile); - await submitTx(transaction, fallbackArweave, type); - await trackEvent(EventType.FALLBACK, {}); - } + // FALLBACK IF ISP BLOCKS ARWEAVE.NET OR IF WAYFINDER FAILS + gateway = fallbackGateway; + const fallbackArweave = new Arweave(gateway); + await fallbackArweave.transactions.sign(transaction, keyfile); + await submitTx(transaction, fallbackArweave, type); + await trackEvent(EventType.FALLBACK, {}); } setToast({ @@ -326,11 +293,10 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { content: browser.i18n.getMessage("sent_tx"), duration: 2000 }); - uToken - ? navigate("/") - : navigate( - `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` - ); + + navigate( + `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` + ); // remove wallet from memory freeDecryptedWallet(keyfile); @@ -429,11 +395,10 @@ export function SendAuthView({ params: { tokenID } }: SendAuthViewProps) { content: browser.i18n.getMessage("sent_tx"), duration: 2000 }); - uToken - ? navigate("/") - : navigate( - `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` - ); + + navigate( + `/transaction/${transaction.id}?back=${encodeURIComponent("/")}` + ); } catch (e) { console.log(e); setToast({ diff --git a/src/routes/popup/send/confirm.tsx b/src/routes/popup/send/confirm.tsx index 77fc34ffe..243a34c4a 100644 --- a/src/routes/popup/send/confirm.tsx +++ b/src/routes/popup/send/confirm.tsx @@ -28,12 +28,6 @@ import AnimatedQRPlayer from "~components/hardware/AnimatedQRPlayer"; import { getActiveKeyfile, getActiveWallet, type StoredWallet } from "~wallets"; import { isLocalWallet } from "~utils/assertions"; import { decryptWallet, freeDecryptedWallet } from "~wallets/encryption"; -import { - getWarpGatewayUrl, - isUrlOnline, - isUToken, - sendRequest -} from "~utils/send"; import { EventType, PageType, trackEvent, trackPage } from "~utils/analytics"; import { concatGatewayURL } from "~gateways/utils"; import type { JWKInterface } from "arbundles"; @@ -107,7 +101,6 @@ export function ConfirmView({ const [needsSign, setNeedsSign] = useState(true); const { setToast } = useToasts(); const [isLoading, setIsLoading] = useState(false); - const uToken = isUToken(tokenID); const ao = useAo(); @@ -207,40 +200,16 @@ export function ConfirmView({ gateway: gateway }; - if (tokenID !== "AR") { - // create interaction - const tx = await arweave.createTransaction({ - target, - quantity: "0" - }); - - const qty = +fractionedToBalance(amount, token, "WARP"); - - tx.addTag("App-Name", "SmartWeaveAction"); - tx.addTag("App-Version", "0.3.0"); - tx.addTag("Contract", tokenID); - tx.addTag( - "Input", - JSON.stringify({ - function: "transfer", - target: target, - qty: uToken ? Math.floor(qty) : qty - }) - ); - addTransferTags(tx); + const tx = await arweave.createTransaction({ + target, + quantity: fractionedToBalance(amount, token, "AR"), + data: message ? decodeURIComponent(message) : undefined + }); - storedTx.transaction = tx.toJSON(); - } else { - const tx = await arweave.createTransaction({ - target, - quantity: fractionedToBalance(amount, token, "AR"), - data: message ? decodeURIComponent(message) : undefined - }); + addTransferTags(tx); - addTransferTags(tx); + storedTx.transaction = tx.toJSON(); - storedTx.transaction = tx.toJSON(); - } return storedTx; } catch { return setToast({ @@ -304,34 +273,15 @@ export function ConfirmView({ }, 10000); }); - if (uToken) { - try { - const isOnline = await isUrlOnline(getWarpGatewayUrl("gw")); - const config = { - url: getWarpGatewayUrl(isOnline ? "gw" : "gateway", "sequencer"), - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json" - }, - body: JSON.stringify(transaction) - }; - await sendRequest(config); - } catch (err) { - console.log("err", err); - throw new Error("Unknown error occurred"); - } - } else { - try { - await Promise.race([ - arweave.transactions.post(transaction), - timeoutPromise - ]); - } catch (err) { - // SEGMENT - await trackEvent(EventType.TRANSACTION_INCOMPLETE, {}); - throw new Error("Error with posting to Arweave"); - } + try { + await Promise.race([ + arweave.transactions.post(transaction), + timeoutPromise + ]); + } catch (err) { + // SEGMENT + await trackEvent(EventType.TRANSACTION_INCOMPLETE, {}); + throw new Error("Error with posting to Arweave"); } } @@ -416,16 +366,14 @@ export function ConfirmView({ SubscriptionStatus.ACTIVE )); } catch (e) { - if (!uToken) { - gateway = fallbackGateway; - const fallbackArweave = new Arweave(gateway); - await fallbackArweave.transactions.sign( - convertedTransaction, - keyfile - ); - await submitTx(convertedTransaction, fallbackArweave, type); - await trackEvent(EventType.FALLBACK, {}); - } + gateway = fallbackGateway; + const fallbackArweave = new Arweave(gateway); + await fallbackArweave.transactions.sign( + convertedTransaction, + keyfile + ); + await submitTx(convertedTransaction, fallbackArweave, type); + await trackEvent(EventType.FALLBACK, {}); } setIsLoading(false); setToast({ @@ -439,13 +387,11 @@ export function ConfirmView({ fee: networkFee }); // Redirect - uToken - ? navigate("/") - : navigate( - `/send/completed/${ - convertedTransaction.id - }?back=${encodeURIComponent("/")}` - ); + navigate( + `/send/completed/${ + convertedTransaction.id + }?back=${encodeURIComponent("/")}` + ); // remove wallet from memory freeDecryptedWallet(keyfile); @@ -485,16 +431,14 @@ export function ConfirmView({ try { await submitTx(convertedTransaction, arweave, type); } catch (e) { - if (!uToken) { - gateway = fallbackGateway; - const fallbackArweave = new Arweave(gateway); - await fallbackArweave.transactions.sign( - convertedTransaction, - keyfile - ); - await submitTx(convertedTransaction, fallbackArweave, type); - await trackEvent(EventType.FALLBACK, {}); - } + gateway = fallbackGateway; + const fallbackArweave = new Arweave(gateway); + await fallbackArweave.transactions.sign( + convertedTransaction, + keyfile + ); + await submitTx(convertedTransaction, fallbackArweave, type); + await trackEvent(EventType.FALLBACK, {}); } setIsLoading(false); setToast({ @@ -507,13 +451,11 @@ export function ConfirmView({ amount: tokenID === "AR" ? +transactionAmount : 0, fee: networkFee }); - uToken - ? navigate("/") - : navigate( - `/send/completed/${ - convertedTransaction.id - }?back=${encodeURIComponent("/")}` - ); + navigate( + `/send/completed/${ + convertedTransaction.id + }?back=${encodeURIComponent("/")}` + ); freeDecryptedWallet(keyfile); } catch (e) { freeDecryptedWallet(keyfile); @@ -698,13 +640,9 @@ export function ConfirmView({ amount: tokenID === "AR" ? latestTxQty : 0, fee: networkFee }); - uToken - ? navigate("/") - : navigate( - `/send/completed/${transaction.id}?back=${encodeURIComponent( - "/" - )}` - ); + navigate( + `/send/completed/${transaction.id}?back=${encodeURIComponent("/")}` + ); } catch (e) { console.log(e); setToast({ diff --git a/src/routes/popup/send/index.tsx b/src/routes/popup/send/index.tsx index 74c6b9313..f34b5d618 100644 --- a/src/routes/popup/send/index.tsx +++ b/src/routes/popup/send/index.tsx @@ -1,6 +1,6 @@ import { PageType, trackPage } from "~utils/analytics"; import { useState, useEffect, useMemo } from "react"; -import styled, { css } from "styled-components"; +import styled from "styled-components"; import { ButtonV2, InputV2, @@ -10,7 +10,6 @@ import { useInput } from "@arconnect/components"; import browser from "webextension-polyfill"; -import * as viewblock from "~lib/viewblock"; import { ArrowUpRightIcon, ChevronDownIcon, @@ -26,32 +25,23 @@ import Token, { } from "~components/popup/Token"; import useSetting from "~settings/hook"; import { - balanceToFractioned, formatFiatBalance, formatTokenBalance, fractionedToBalance, getCurrencySymbol } from "~tokens/currency"; import { useStorage } from "@plasmohq/storage/hook"; -import { - ExtensionStorage, - TRANSFER_TX_STORAGE, - TempTransactionStorage -} from "~utils/storage"; -import { getDreForToken, useTokens } from "~tokens"; +import { ExtensionStorage, TempTransactionStorage } from "~utils/storage"; import { loadTokenLogo, type Token as TokenInterface } from "~tokens/token"; import { useTheme } from "~utils/theme"; import arLogoLight from "url:/assets/ar/logo_light.png"; import arLogoDark from "url:/assets/ar/logo_dark.png"; import Arweave from "arweave"; import { useBalance } from "~wallets/hooks"; -import { getArPrice, getPrice } from "~lib/coingecko"; -import redstone from "redstone-api"; +import { getArPrice } from "~lib/coingecko"; import Collectible from "~components/popup/Collectible"; import { findGateway } from "~gateways/wayfinder"; import { useLocation } from "~wallets/router/router.utils"; -import { DREContract, DRENode } from "@arconnect/warp-dre"; -import { isUToken } from "~utils/send"; import HeadV2 from "~components/popup/HeadV2"; import SliderMenu from "~components/SliderMenu"; import Recipient, { @@ -147,9 +137,6 @@ export function SendView({ params: { id } }: SendViewProps) { "token" ); - // tokens - const tokens = useTokens(); - // token that the user is going to send const [tokenID, setTokenID] = useStorage<"AR" | string>( { @@ -160,11 +147,9 @@ export function SendView({ params: { id } }: SendViewProps) { ); const token = useMemo(() => { - const matchingTokenInTokens = tokens.find((t) => t.id === tokenID); - - const matchingTokenInAoTokens = !matchingTokenInTokens - ? aoTokens.find((aoToken) => aoToken.id === tokenID) - : null; + const matchingTokenInAoTokens = aoTokens.find( + (aoToken) => aoToken.id === tokenID + ); if (matchingTokenInAoTokens) { setIsAo(true); return { @@ -179,8 +164,8 @@ export function SendView({ params: { id } }: SendViewProps) { } setIsAo(false); - return matchingTokenInTokens || arPlaceholder; - }, [tokenID, tokens, aoTokens]); + return arPlaceholder; + }, [tokenID, aoTokens]); const degraded = useMemo(() => { if (loading) { @@ -214,7 +199,6 @@ export function SendView({ params: { id } }: SendViewProps) { useEffect(() => { (async () => { - setLogo(viewblock.getTokenLogo(token.id)); setLogo(await loadTokenLogo(token.id, token.defaultLogo, theme)); })(); }, [theme, token]); @@ -242,23 +226,6 @@ export function SendView({ params: { id } }: SendViewProps) { // placeholder balance setBalance(token.balance); - if (!isAo) { - const dre = await getDreForToken(token.id); - const contract = new DREContract(tokenID || id, new DRENode(dre)); - const result = await contract.query<[number]>( - `$.balances.${activeAddress}` - ); - - setBalance( - balanceToFractioned(String(result[0] || 0), { - id: token.id, - decimals: token.decimals, - divisibility: token.divisibility - }).toString() - ); - } else { - setBalance(token.balance); - } })(); }, [token, activeAddress, arBalance.toString(), id]); @@ -274,34 +241,7 @@ export function SendView({ params: { id } }: SendViewProps) { return setPrice(arPrice.toString()); } - // get price from redstone - - if (isAo) { - return setPrice("0"); - } - - const redstonePromise = redstone.getPrice(token.ticker); - const multiplierPromise = - currency === "usd" - ? 1 - : await getPrice("usd", currency).catch((err) => { - console.warn(`Error fetching price for ${currency}`, err); - - return 0; - }); - - const [redstoneResponse, multiplier] = await Promise.all([ - redstonePromise, - multiplierPromise - ]); - - const redstoneValue = redstoneResponse.value; - - setPrice( - redstoneResponse && multiplier - ? BigNumber(redstoneValue).multipliedBy(multiplier).toString() - : "0" - ); + return setPrice("0"); })(); }, [token, currency]); @@ -389,8 +329,6 @@ export function SendView({ params: { id } }: SendViewProps) { setShownTokenSelector(false); } - const uToken = isUToken(tokenID); - // qty text size const qtySize = useMemo(() => { const maxLengthDef = 7; @@ -415,7 +353,7 @@ export function SendView({ params: { id } }: SendViewProps) { decimals: token.decimals, divisibility: token.divisibility }, - token.id === "AR" ? "AR" : isAo ? "AO" : "WARP" + token.id === "AR" ? "AR" : "AO" ); await TempTransactionStorage.set("send", { @@ -465,7 +403,6 @@ export function SendView({ params: { id } }: SendViewProps) {
)} - - {!uToken && ( - - - - )} + + + @@ -632,16 +567,6 @@ export function SendView({ params: { id } }: SendViewProps) { onClick={() => updateSelectedToken(token.id)} /> ))} - - {tokens - .filter((token) => token.type === "asset") - .map((token, i) => ( - updateSelectedToken(token.id)} - key={i} - /> - ))} diff --git a/src/routes/popup/settings/tokens/[id]/index.tsx b/src/routes/popup/settings/tokens/[id]/index.tsx index ae824d850..920a33806 100644 --- a/src/routes/popup/settings/tokens/[id]/index.tsx +++ b/src/routes/popup/settings/tokens/[id]/index.tsx @@ -6,7 +6,7 @@ import { TooltipV2, useToasts } from "@arconnect/components"; -import type { Token, TokenType } from "~tokens/token"; +import type { TokenType } from "~tokens/token"; import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; import { TrashIcon } from "@iconicicons/react"; @@ -20,7 +20,6 @@ import { CopyButton } from "~components/dashboard/subsettings/WalletSettings"; import HeadV2 from "~components/popup/HeadV2"; import type { CommonRouteProps } from "~wallets/router/router.types"; import { useLocation } from "~wallets/router/router.utils"; -import { ErrorTypes } from "~utils/error/error.utils"; import { LoadingView } from "~components/page/common/loading/loading.view"; export interface TokenSettingsParams { @@ -32,17 +31,8 @@ export type TokenSettingsProps = CommonRouteProps; export function TokenSettingsView({ params: { id } }: TokenSettingsProps) { const { navigate } = useLocation(); - // tokens - const [tokens, setTokens] = useStorage( - { - key: "tokens", - instance: ExtensionStorage - }, - [] - ); - // ao tokens - const [aoTokens] = useStorage( + const [aoTokens, setAoTokens] = useStorage( { key: "ao_tokens", instance: ExtensionStorage @@ -52,30 +42,21 @@ export function TokenSettingsView({ params: { id } }: TokenSettingsProps) { const { setToast } = useToasts(); - const { token, isAoToken } = useMemo(() => { + const token = useMemo(() => { const aoToken = aoTokens.find((ao) => ao.processId === id); - if (aoToken) { - return { - token: { - ...aoToken, - id: aoToken.processId, - name: aoToken.Name, - ticker: aoToken.Ticker - // Map additional AO token properties as needed - }, - isAoToken: true - }; - } - const regularToken = tokens.find((t) => t.id === id); + return { - token: regularToken, - isAoToken: false + ...aoToken, + id: aoToken.processId, + name: aoToken.Name, + ticker: aoToken.Ticker + // Map additional AO token properties as needed }; - }, [tokens, aoTokens, id]); + }, [aoTokens, id]); // update token type function updateType(type: TokenType) { - setTokens((allTokens) => { + setAoTokens((allTokens) => { const tokenIndex = allTokens.findIndex((t) => t.id === id); if (tokenIndex !== -1) { allTokens[tokenIndex].type = type; diff --git a/src/routes/popup/settings/tokens/index.tsx b/src/routes/popup/settings/tokens/index.tsx index cb1ec04ea..75fecf1e0 100644 --- a/src/routes/popup/settings/tokens/index.tsx +++ b/src/routes/popup/settings/tokens/index.tsx @@ -1,6 +1,6 @@ import { useStorage } from "@plasmohq/storage/hook"; import { ExtensionStorage } from "~utils/storage"; -import { useEffect, useMemo, useState } from "react"; +import { useMemo } from "react"; import type { Token, TokenType } from "~tokens/token"; import styled from "styled-components"; import browser from "webextension-polyfill"; @@ -14,15 +14,6 @@ import { TokenListItem } from "~components/popup/list/TokenListItem"; export function TokensSettingsView() { const { navigate } = useLocation(); - // tokens - const [tokens] = useStorage( - { - key: "tokens", - instance: ExtensionStorage - }, - [] - ); - const [aoTokens] = useStorage( { key: "ao_tokens", @@ -42,17 +33,6 @@ export function TokensSettingsView() { })); }, [aoTokens]); - const [aoSettingsState, setaoSettingsState] = useState(true); - - useEffect(() => { - (async () => { - const currentSetting = await ExtensionStorage.get( - "setting_ao_support" - ); - setaoSettingsState(currentSetting); - })(); - }, []); - // search const searchInput = useInput(); @@ -102,30 +82,12 @@ export function TokensSettingsView() {
- - {tokens.filter(filterSearchResults).map((token) => ( - - ))} - - {enhancedAoTokens.length > 0 && aoSettingsState && ( - <> - - {enhancedAoTokens.filter(filterSearchResults).map((token) => ( -
handleTokenClick(token)} key={token.id}> - -
- ))} - - )} + {enhancedAoTokens.length > 0 && + enhancedAoTokens.filter(filterSearchResults).map((token) => ( +
handleTokenClick(token)} key={token.id}> + +
+ ))}
diff --git a/src/routes/popup/token/[id].tsx b/src/routes/popup/token/[id].tsx index 15f137732..147492082 100644 --- a/src/routes/popup/token/[id].tsx +++ b/src/routes/popup/token/[id].tsx @@ -1,528 +1,4 @@ -import { - balanceToFractioned, - formatFiatBalance, - formatTokenBalance -} from "~tokens/currency"; -import { concatGatewayURL } from "~gateways/utils"; -import { AnimatePresence, motion, type Variants } from "framer-motion"; -import { Loading, Section, Spacer, Text } from "@arconnect/components"; -import { DREContract, DRENode } from "@arconnect/warp-dre"; -import { usePrice, usePriceHistory } from "~lib/redstone"; -import { useEffect, useMemo, useState } from "react"; -import { getDreForToken, useTokens } from "~tokens"; -import { useStorage } from "@plasmohq/storage/hook"; -import { ExtensionStorage } from "~utils/storage"; -import { getCommunityUrl } from "~utils/format"; -import { useLocation } from "~wallets/router/router.utils"; -import { useTheme } from "~utils/theme"; -import { - ArrowDownLeftIcon, - ArrowUpRightIcon, - CloseIcon, - EyeIcon, - GlobeIcon, - MessageIcon, - ShareIcon, - WarningTriangleIcon -} from "@iconicicons/react"; -import { - getInteractionsTxsForAddress, - getSettings, - loadTokenLogo, - parseInteractions, - type TokenInteraction, - type TokenState -} from "~tokens/token"; -import Title, { Heading } from "~components/popup/Title"; -import PeriodPicker from "~components/popup/asset/PeriodPicker"; -import Interaction from "~components/popup/asset/Interaction"; -import PriceChart from "~components/popup/asset/PriceChart"; -import TokenLoading from "~components/popup/asset/Loading"; -import * as viewblock from "~lib/viewblock"; -import browser from "webextension-polyfill"; -import Skeleton from "~components/Skeleton"; -import useSetting from "~settings/hook"; import styled from "styled-components"; -import { STAKED_GQL_FULL_HISTORY, useGateway } from "~gateways/wayfinder"; -import HeadV2 from "~components/popup/HeadV2"; -import type { CommonRouteProps } from "~wallets/router/router.types"; - -export interface AssetViewParams { - id: string; -} - -export type AssetViewProps = CommonRouteProps; - -export function AssetView({ params: { id } }: AssetViewProps) { - const { navigate } = useLocation(); - - // load state - const [state, setState] = useState(); - const [validity, setValidity] = useState<{ [id: string]: boolean }>(); - const [loading, setLoading] = useState(false); - - useEffect(() => { - (async () => { - setLoading(true); - - const dre = await getDreForToken(id); - const contract = new DREContract(id, new DRENode(dre)); - // @ts-expect-error - const { state, validity } = await contract.getState(); - - setState(state); - setValidity(validity); - setLoading(false); - })(); - }, [id]); - - // price period - const [period, setPeriod] = useState("Day"); - - // community settings - const settings = useMemo(() => { - if (!state || !state.settings) return undefined; - - return getSettings(state); - }, [state]); - - // chat link urls - const chatLinks = useMemo(() => { - const val = settings?.get("communityDiscussionLinks"); - - if (!val) return []; - - return val as string[]; - }, [settings]); - - // current address - const [activeAddress] = useStorage({ - key: "active_address", - instance: ExtensionStorage - }); - - // balance in units of the token - const tokenBalance = useMemo(() => { - if (!state) return "0"; - - const val = balanceToFractioned( - String(state.balances?.[activeAddress] || "0"), - { - id, - decimals: state.decimals, - divisibility: state.divisibility - } - ); - - return formatTokenBalance(val); - }, [id, state, activeAddress]); - - // token gateway - const tokens = useTokens(); - const defaultGateway = useGateway(STAKED_GQL_FULL_HISTORY); - const gateway = useMemo( - () => tokens.find((t) => t.id === id)?.gateway || defaultGateway, - [id, defaultGateway] - ); - - // fetch interactions - const [interactions, setInteractions] = useState([]); - const [loadingInteractions, setLoadingInteractions] = useState(false); - - useEffect(() => { - (async () => { - if (!activeAddress || !validity || !id) { - return; - } - - setLoadingInteractions(true); - setInteractions([]); - - try { - // fetch interactions - const allInteractions = await getInteractionsTxsForAddress( - id, - activeAddress, - gateway - ); - - // compare validity - const validInteractions = allInteractions.filter( - (tx) => !!validity[tx.node.id] - ); - - setInteractions( - parseInteractions( - validInteractions, - activeAddress, - state?.ticker, - state?.divisibility - ) - ); - } catch {} - - setLoadingInteractions(false); - })(); - }, [id, activeAddress, validity, state, gateway]); - - // token price - const { price, loading: loadingPrice } = usePrice(state?.ticker); - - // token historical prices - const { prices: historicalPrices, loading: loadingHistoricalPrices } = - usePriceHistory(period, state?.ticker); - - // currency setting - const [currency] = useSetting("currency"); - - // balance in fiat - const fiatBalance = useMemo(() => { - if (!state) { - return "0"; - } - - if (!price) { - return `?? ${currency.toUpperCase()}`; - } - - const bal = balanceToFractioned( - String(state.balances?.[activeAddress] || "0"), - { - id, - decimals: state.decimals, - divisibility: state.divisibility - } - ); - - return formatFiatBalance(bal.multipliedBy(price), currency); - }, [id, state, activeAddress, price, currency]); - - const [priceWarningShown, setPriceWarningShown] = useStorage({ - key: "price_warning_shown", - instance: ExtensionStorage - }); - - // display theme - const theme = useTheme(); - - // token logo - const [logo, setLogo] = useState(); - - useEffect(() => { - (async () => { - if (!id) return; - setLogo(viewblock.getTokenLogo(id)); - - if (!state) return; - const settings = getSettings(state); - - setLogo(await loadTokenLogo(id, settings.get("communityLogo"), theme)); - })(); - }, [id, state, theme]); - - return ( - <> - - - - {state && ( - - - setPeriod(p)} /> - - - )} - - {!state && ( -
- -
- )} - -
- -
- - {(state && browser.i18n.getMessage("your_balance")) || ( - - )} - - - - {(state && ( - <> - {tokenBalance} - {state.ticker || ""} - - )) || } - - - {((loading || loadingPrice || !state) && ( - - )) || - fiatBalance} - -
- - {state && ( - - - navigate(`/send/transfer/${id}`)} - /> - - navigate("/receive")} - /> - - - )} - -
- - {state && price && !priceWarningShown && ( - - - - {browser.i18n.getMessage("token_price_estimate_warning")}{" "} - - Redstone - - - setPriceWarningShown(true)} /> - - )} - - - {browser.i18n.getMessage("about_title")} - - - {(state && ( - <> - {(settings && settings.get("communityDescription")) || - state.description || - browser.i18n.getMessage("no_description")} - - )) || - new Array(5) - .fill("") - .map((_, i) => ( - - ))} - - - {browser.i18n.getMessage("info_title")} - - {chatLinks.map((link, i) => ( -
- - - {getCommunityUrl(link)} - - -
- ))} - {settings?.get("communityAppUrl") && ( - <> - - - {getCommunityUrl(settings.get("communityAppUrl") as string)} - - - - )} - {((!loading || chatLinks.length > 0 || !!settings) && ( - <> - - - Sonar - - - - - Viewblock - - - )) || - new Array(4) - .fill("") - .map((_, i) => ( - - ))} - - - {browser.i18n.getMessage("history")} - - {loadingInteractions && ( - - - - )} - - - - - {loadingInteractions && - new Array(6) - .fill("") - .map((_, i) => )} - - {!loadingInteractions && - interactions.map((interaction, i) => ( - - { - if (gateway.host !== "arweave.net") { - navigate( - `/transaction/${interaction.id}/${encodeURIComponent( - concatGatewayURL(gateway) - )}` - ); - } else { - navigate(`/transaction/${interaction.id}`); - } - }} - /> - - ))} - - {interactions.length === 0 && !loadingInteractions && ( - - {browser.i18n.getMessage("no_interaction_history")} - - )} - -
- {loading && } - - ); -} - -const opacityAnimation: Variants = { - hidden: { opacity: 0 }, - shown: { opacity: 1 } -}; - -const BalanceSection = styled.div` - display: flex; - justify-content: space-between; - align-items: center; -`; - -const BalanceLabel = styled(Text).attrs({ - noMargin: true -})` - font-size: 0.69rem; -`; - -const TokenBalance = styled(Text).attrs({ - noMargin: true, - heading: true -})` - display: flex; - gap: 0.3rem; - align-items: baseline; - font-size: 1.85rem; - line-height: 1.1em; - - span { - font-size: 0.57em; - text-transform: uppercase; - } -`; - -const FiatBalance = styled(Text).attrs({ - noMargin: true -})` - color: rgb(${(props) => props.theme.primaryText}); - font-weight: 600; - font-size: 0.74rem; -`; - -const TokenActions = styled.div` - display: flex; - align-items: center; - background-color: rgba(${(props) => props.theme.theme}, 0.15); - padding: 0.55rem 0.74rem; - gap: 0.74rem; - border-radius: 14px; -`; - -const TokenAction = styled(ArrowUpRightIcon)` - font-size: 1.45rem; - width: 1em; - height: 1em; - cursor: pointer; - color: rgb(${(props) => props.theme.theme}); - transition: all 0.23s ease-in-out; - - &:hover { - opacity: 0.85; - } - - &:active { - transform: scale(0.9); - } -`; - -const ActionSeparator = styled.div` - width: 1.5px; - height: 1.25rem; - background-color: rgba(${(props) => props.theme.theme}, 0.3); - border-radius: 2px; -`; - -const Description = styled(Text).attrs({ - noMargin: true -})` - font-size: 0.9rem; - text-align: justify; -`; export const Link = styled.a.attrs({ target: "_blank", @@ -548,56 +24,3 @@ export const Link = styled.a.attrs({ opacity: 0.8; } `; - -const InteractionsList = styled.div` - display: flex; - flex-direction: column; - gap: 0.9rem; -`; - -const NoInteractions = styled(Text).attrs({ - noMargin: true -})` - text-align: center; -`; - -const LoadingWrapper = styled(motion.div)` - display: flex; - color: rgb(${(props) => props.theme.theme}); - font-size: 1.075rem; -`; - -const PriceWarning = styled(motion.div)` - display: flex; - align-items: center; - justify-content: space-between; - font-size: 0.95rem; - font-weight: 500; - color: rgb(255, 184, 0); - background-color: rgba(255, 184, 0, 0.2); - cursor: pointer; - padding: 0.9rem 0.8rem; - border-radius: 19px; - margin-top: 1rem; - - &:active { - transform: scale(0.97); - } - - svg { - font-size: 1rem; - width: 1em; - height: 1em; - } -`; - -const PriceWarningContent = styled.div` - display: flex; - align-items: center; - gap: 0.45rem; - - a { - color: rgb(255, 184, 0); - text-decoration: underline; - } -`; diff --git a/src/routes/popup/tokens.tsx b/src/routes/popup/tokens.tsx index e1d513fde..a87205b12 100644 --- a/src/routes/popup/tokens.tsx +++ b/src/routes/popup/tokens.tsx @@ -1,12 +1,8 @@ import { useLocation } from "~wallets/router/router.utils"; import { ButtonV2, Section, useToasts, Loading } from "@arconnect/components"; import { EditIcon } from "@iconicicons/react"; -import { - getAoTokens, - getAoTokensAutoImportRestrictedIds, - useTokens -} from "~tokens"; -import { useEffect, useMemo, useState } from "react"; +import { getAoTokens, getAoTokensAutoImportRestrictedIds } from "~tokens"; +import { useEffect, useState } from "react"; import browser from "webextension-polyfill"; import Token from "~components/popup/Token"; import styled from "styled-components"; @@ -27,8 +23,7 @@ export function TokensView() { const [hasNextPage, setHasNextPage] = useState( undefined ); - // all tokens - const tokens = useTokens(); + // ao Tokens const [aoTokens] = useAoTokens(); @@ -45,12 +40,6 @@ export function TokensView() { false ); - // assets - const assets = useMemo( - () => tokens.filter((token) => token.type === "asset"), - [tokens] - ); - function handleTokenClick(tokenId: string) { navigate(`/send/transfer/${tokenId}`); } @@ -162,17 +151,6 @@ export function TokensView() { }} /> ))} - {assets.map((token, i) => ( - navigate(`/token/${token.id}`)} - onSettingsClick={(e) => { - e.preventDefault(); - navigate(`/quick-settings/tokens/${token.id}`); - }} - key={i} - /> - ))} {aoTokensCache.map((token) => ( ("tokens"); - - return tokens || defaultTokens; -} - /** * Get stored ao tokens */ @@ -86,75 +34,15 @@ export async function getAoTokensAutoImportRestrictedIds() { return removedIds || []; } -/** - * Get a token with id, type and dre - * - * @param id ID of the token contract - * @param type Type of the token - * @param dre DRE node for token - */ -export async function getToken(id: string, type: TokenType, dre?: string) { - // dre - if (!dre) dre = await getDreForToken(id); - const contract = new DREContract(id, new DRENode(dre)); - const { state } = await contract.getState(); - - // validate state - isTokenState(state); - - // add token - const activeAddress = await getActiveAddress(); - - if (!activeAddress) { - throw new Error("No active address set"); - } - - // parse settings - const settings = getSettings(state); - - return { - id, - name: state.name, - ticker: state.ticker, - type, - balance: String(state.balances[activeAddress] || 0), - divisibility: state.divisibility, - decimals: state.decimals, - defaultLogo: settings.get("communityLogo") as string, - dre - } as Token; -} - -/** - * Add a token to the stored tokens - * - * @param id ID of the token contract - */ -export async function addToken(id: string, type: TokenType, dre?: string) { - const token = await getToken(id, type, dre); - - // get tokens - const tokens = await getTokens(); - - tokens.push(token); - await ExtensionStorage.set("tokens", tokens); -} - /** * Remove a token from stored tokens * * @param id ID of the token contract */ export async function removeToken(id: string) { - const tokens = await getTokens(); const aoTokens = await getAoTokens(); - if (tokens.some((token) => token.id === id)) { - await ExtensionStorage.set( - "tokens", - tokens.filter((token) => token.id !== id) - ); - } else if (aoTokens.some((token) => token.processId === id)) { + if (aoTokens.some((token) => token.processId === id)) { const restrictedTokenIds = await getAoTokensAutoImportRestrictedIds(); if (!restrictedTokenIds.includes(id)) { restrictedTokenIds.push(id); @@ -168,11 +56,6 @@ export async function removeToken(id: string) { aoTokens.filter((token) => token.processId !== id) ); } - - await ExtensionStorage.set( - "tokens", - tokens.filter((token) => token.id !== id) - ); } export async function removeAoToken(id: string) { @@ -180,89 +63,3 @@ export async function removeAoToken(id: string) { const updatedTokens = tokens.filter((token) => token.processId !== id); await ExtensionStorage.set("ao_tokens", updatedTokens); } - -/** - * Get DRE node for a token - */ -export async function getDreForToken(id: string) { - const tokens = await ExtensionStorage.get("tokens"); - let node = (tokens || defaultTokens).find((t) => t.id === id)?.dre; - - if (!node) { - const contract = new DREContract(id); - - node = await contract.findNode(); - } - - return node; -} - -/** - * Hook for stored tokens - */ -export function useTokens() { - const [tokens, setTokens] = useStorage( - { - key: "tokens", - instance: ExtensionStorage - }, - [] - ); - - const [activeAddress] = useStorage({ - key: "active_address", - instance: ExtensionStorage - }); - - const [updatedTokens, setUpdatedTokens] = useState(false); - - useEffect(() => { - setUpdatedTokens(false); - }, [activeAddress]); - - useEffect(() => { - (async () => { - if (tokens.length === 0 || !activeAddress || updatedTokens) return; - - setTokens( - await Promise.all( - tokens.map(async (token) => { - const node = new DRENode(token.dre || NODES[0]); - const contract = new DREContract(token.id, node); - - const queryState = async () => { - // get state - const { state } = await contract.getState(); - - // parse settings - const settings = getSettings(state); - - token.balance = String(state.balances[activeAddress] || 0); - token.divisibility = state.divisibility; - token.decimals = state.decimals; - token.defaultLogo = settings.get("communityLogo"); - token.dre = contract.getNode().getURL(); - }; - - try { - await queryState(); - } catch { - await contract.findNode(NODES, [node.getURL()]); - await queryState(); - } - - return token; - }) - ) - ); - setUpdatedTokens(true); - })(); - }, [tokens, activeAddress, updatedTokens]); - - return tokens || []; -} - -/** - * Token contract state evaluation result - */ -export type ContractResult = EvalStateResult; diff --git a/src/tokens/token.ts b/src/tokens/token.ts index 58c1be9de..2ea52ad90 100644 --- a/src/tokens/token.ts +++ b/src/tokens/token.ts @@ -1,19 +1,9 @@ -import { - formatTokenBalance, - type DivisibilityOrDecimals, - balanceToFractioned -} from "./currency"; -import type { GQLEdgeInterface } from "ar-gql/dist/faces"; import type { DisplayTheme } from "@arconnect/components"; -import * as viewblock from "~lib/viewblock"; import { concatGatewayURL } from "~gateways/utils"; -import { gql } from "~gateways/api"; import arLogoLight from "url:/assets/ar/logo_light.png"; import arLogoDark from "url:/assets/ar/logo_dark.png"; import { findGateway } from "~gateways/wayfinder"; -import { type Gateway } from "~gateways/gateway"; import { ExtensionStorage } from "~utils/storage"; -import { defaultTokens } from "~tokens"; import { defaultAoTokens, type TokenInfo } from "./aoTokens/ao"; export interface Token { @@ -21,241 +11,14 @@ export interface Token { name?: string; ticker: string; type: TokenType; - gateway?: Gateway; - dre?: string; balance: string | null; divisibility?: number; decimals?: number; defaultLogo?: string; } -export interface TokenState { - name?: string; - ticker: string; - balances: Record; - [key: string]: any; -} - export type TokenType = "asset" | "collectible"; -/** - * Get the initial state of a contract - * - * @param id Contract ID - * @param gateway Gateway to fetch from - */ -export async function getInitialState( - id: string, - gateway: Gateway -): Promise> { - const { data } = await gql( - `query ($id: ID!) { - transaction (id: $id) { - tags { - name - value - } - } - }`, - { id }, - gateway - ); - - // init state tag - const initState = data.transaction.tags.find( - ({ name }) => name === "Init-State" - )?.value; - - if (initState) { - return JSON.parse(initState); - } - - // init state tx tag - const initStateTx = data.transaction.tags.find( - ({ name }) => name === "Init-State-TX" - )?.value; - - if (initStateTx) { - const initState = await ( - await fetch(`${concatGatewayURL(gateway)}/${initStateTx}`) - ).json(); - - return initState; - } - - // otherwise get the data of the contract tx - const contractData = await ( - await fetch(`${concatGatewayURL(gateway)}/${id}`) - ).json(); - - return contractData; -} - -/** - * Get incoming and outgoing interactions (including transfers) - * for an address using the specified contract - * - * @param contractId ID of the contract to get the interactions for - * @param address User address to get the interactions for - * @param gateway Optional gateway to fetch the interactions from - * @param limit Limit of the interactions returned - */ -export async function getInteractionsTxsForAddress( - contractId: string, - address: string, - gateway?: Gateway, - limit = 6 -) { - if (!gateway) { - gateway = await findGateway({ graphql: true }); - } - - // fetch outgoing interactions - const { data: out } = await gql( - ` - query($contractId: String!, $address: String!) { - transactions( - owners: [$address] - tags: [ - { name: "App-Name", values: "SmartWeaveAction" } - { name: "App-Version", values: "0.3.0" } - { name: "Contract", values: [$contractId] } - ] - ) { - edges { - node { - id - recipient - owner { - address - } - quantity { - ar - } - tags { - name - value - } - block { - timestamp - } - } - } - } - } - `, - { contractId, address }, - gateway - ); - - // fetch outgoing interactions - const { data: incoming } = await gql( - ` - query($contractId: String!, $address: String!) { - transactions( - recipients: [$address] - tags: [ - { name: "App-Name", values: "SmartWeaveAction" } - { name: "App-Version", values: "0.3.0" } - { name: "Contract", values: [$contractId] } - ] - ) { - edges { - node { - id - recipient - owner { - address - } - quantity { - ar - } - tags { - name - value - } - block { - timestamp - } - } - } - } - } - `, - { contractId, address }, - gateway - ); - - // sort interactions - const interactions = out.transactions.edges - .concat(incoming.transactions.edges) - .filter((tx) => !!tx?.node.block?.timestamp) - .sort((a, b) => b.node.block.timestamp - a.node.block.timestamp) - .slice(0, limit); - - return interactions; -} - -/** - * Parse interactions from interaction txs - * - * @param interactions Interaction txs to parse - * @param activeAddress Active wallet address - * @param ticker Ticker of the token contract - */ -export function parseInteractions( - interactions: GQLEdgeInterface[], - activeAddress: string, - ticker?: string, - fractionsCfg?: DivisibilityOrDecimals -): TokenInteraction[] { - return interactions.map((tx) => { - // interaction input - const input = JSON.parse( - tx.node.tags.find((tag) => tag.name === "Input")?.value - ); - const recipient = tx.node.recipient || input.target; - - // interaction data - let type: TokenInteractionType = "interaction"; - let qty = tx.node.quantity.ar; - let otherAddress: string; - - if (input.function === "transfer") { - type = (recipient === activeAddress && "in") || "out"; - qty = balanceToFractioned(input.qty, fractionsCfg).toFixed(); - otherAddress = - (recipient === activeAddress && tx.node.owner.address) || recipient; - } - - // parsed interaction data - return { - id: tx.node.id, - type, - qty: - formatTokenBalance(qty) + - " " + - (type === "interaction" ? "AR" : ticker || ""), - function: input.function, - otherAddress - }; - }); -} - -type TokenInteractionType = "interaction" | "in" | "out"; - -export interface TokenInteraction { - id: string; - type: TokenInteractionType; - // qty + ticker - qty: string; - // recipient for outgoing txs - // sender for incoming txs - otherAddress?: string; - // interaction function - function: string; -} - /** * Load token logo from Viewblock. If no logo * is returned, return the original logo from @@ -270,90 +33,38 @@ export async function loadTokenLogo( defaultLogo?: string, theme?: DisplayTheme ) { - const viewblockURL = viewblock.getTokenLogo(id, theme); + // find gateway with wayfinder + const gateway = await findGateway({ startBlock: 0 }); + + // get token logo from settings + if (defaultLogo) { + return `${concatGatewayURL(gateway)}/${defaultLogo}`; + } try { - const res = await fetch(viewblockURL); + // try to see if the token logo is the data + // of the token contract creation transaction + const res = await fetch(`${concatGatewayURL(gateway)}/${id}`); + const contentType = res.headers.get("content-type"); - // not the token logo we expected - if (res.status === 202 || res.status >= 400) { + if (!contentType.includes("image")) { throw new Error(); } - // let's return an object URL so we - // don't need to load the logo again - const blob = await res.blob(); - - // let's turn the - return URL.createObjectURL(blob); + return URL.createObjectURL(await res.blob()); } catch { - // find gateway with wayfinder - const gateway = await findGateway({ startBlock: 0 }); - - // get token logo from settings - if (defaultLogo) { - return `${concatGatewayURL(gateway)}/${defaultLogo}`; - } - - try { - // try to see if the token logo is the data - // of the token contract creation transaction - const res = await fetch(`${concatGatewayURL(gateway)}/${id}`); - const contentType = res.headers.get("content-type"); - - if (!contentType.includes("image")) { - throw new Error(); - } - - return URL.createObjectURL(await res.blob()); - } catch { - // if there are no logos in settings, return the AR logo - return theme === "dark" ? arLogoLight : arLogoDark; - } + // if there are no logos in settings, return the AR logo + return theme === "dark" ? arLogoLight : arLogoDark; } } -/** - * Parse settings from token state - */ -export function getSettings(state: TokenState) { - let rawSettings = state?.settings || []; - - // transform object setting structure - if (!Array.isArray(rawSettings)) { - rawSettings = Object.entries(rawSettings); - } - - return new Map(rawSettings); -} - -/** - * Overrides for well-known tokens' types - */ -export const tokenTypeRegistry: Record = { - "tfalT8Z-88riNtoXdF5ldaBtmsfcSmbMqWLh2DHJIbg": "asset" -}; - export async function loadTokens() { - const tokens: Token[] | undefined = await ExtensionStorage.get("tokens"); const aoTokens: TokenInfo[] | undefined = await ExtensionStorage.get( "ao_tokens" ); - const aoSupport: boolean | undefined = await ExtensionStorage.get( - "setting_ao_support" - ); - - // TODO: should this only be if it's undefined? - if (!tokens || tokens.length === 0) { - await ExtensionStorage.set("tokens", defaultTokens); - } // TODO: should this only be if it's undefined? if (!aoTokens || aoTokens.length === 0) { await ExtensionStorage.set("ao_tokens", defaultAoTokens); } - - if (!aoSupport) { - await ExtensionStorage.set("setting_ao_support", true); - } } diff --git a/src/utils/assertions.ts b/src/utils/assertions.ts index d335642d7..ffc9f972b 100644 --- a/src/utils/assertions.ts +++ b/src/utils/assertions.ts @@ -5,7 +5,7 @@ import type { SignMessageOptions } from "~api/modules/sign_message/types"; import type { SignatureAlgorithm } from "~api/modules/signature/types"; import type { RawDataItem } from "~api/modules/sign_data_item/types"; import type { DecryptedWallet, LocalWallet } from "~wallets"; -import type { TokenState, TokenType } from "~tokens/token"; +import type { TokenType } from "~tokens/token"; import type { JWKInterface } from "arweave/web/lib/wallet"; import type Transaction from "arweave/web/lib/transaction"; import type { DecodedTag } from "~api/modules/sign/tags"; @@ -335,17 +335,6 @@ export function isValidBalance(input: unknown): asserts input is number { isOneOfType(input, [isNumber, isNull, isUndefined], "Invalid balance."); } -export function isTokenState(input: unknown): asserts input is TokenState { - isRecord(input, "Invalid or no token state."); - isString(input.ticker, "Invalid token ticker: not a string."); - isRecord(input.balances, "Invalid balances object: not a record."); - - for (const address in input.balances) { - isString(address); - isValidBalance(input.balances[address]); - } -} - export function isNotEmptyArray(input: unknown): asserts input is unknown[] { isArray(input, "Input is not an array."); assert(input.length > 0, "Array is empty."); diff --git a/src/utils/notifications.ts b/src/utils/notifications.ts index 4b44a13c4..976354fe3 100644 --- a/src/utils/notifications.ts +++ b/src/utils/notifications.ts @@ -2,10 +2,7 @@ import { arPlaceholder } from "~routes/popup/send"; import { ExtensionStorage } from "./storage"; import type { Transaction } from "~notifications/api"; import type { Token } from "~tokens/token"; -import { fetchTokenByProcessId, tokenInfoMap } from "~lib/transactions"; -import { getToken } from "~tokens"; - -let tokens: Token[] = null; +import { fetchTokenByProcessId } from "~lib/transactions"; export const fetchNotifications = async (address: string) => { const n = await ExtensionStorage.get(`notifications_${address}`); @@ -54,38 +51,10 @@ export const mergeAndSortNotifications = ( export { fetchTokenByProcessId }; -async function fetchTokenInfo(id: string) { - try { - if (tokenInfoMap.has(id)) { - return tokenInfoMap.get(id) as Token; - } - - const token = await getToken(id, "asset"); - tokenInfoMap.set(id, token); - return token; - } catch { - return null; - } -} - export const fetchTokenById = async (tokenId: string): Promise => { - if (tokenId === "AR") { - return arPlaceholder; - } - - if (!tokens) { - tokens = await ExtensionStorage.get("tokens"); - } - - if (!tokens || !tokenId) return null; - - const token = tokens.find((token) => token.id === tokenId); - if (token) { - tokenInfoMap.set(tokenId, token); - return token; - } + if (tokenId === "AR") return arPlaceholder; - return fetchTokenInfo(tokenId); + return null; }; export const extractQuantityTransferred = (tags: any[]): number | null => { diff --git a/src/utils/send.ts b/src/utils/send.ts deleted file mode 100644 index d6a5dcd3f..000000000 --- a/src/utils/send.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Checks if the provided token ID is a Test U-Token or U-Token. - * - * @param {string} tokenID - The token ID to check. - * @returns {boolean} Returns `true` if the token ID is a U-Token, otherwise `false`. - */ - -export const isUToken = (tokenID: string): boolean => { - return ( - // Test U-TOKEN - tokenID === "FYJOKdtNKl18QgblxgLEZUfJMFUv6tZTQqGTtY-D6jQ" || - // U-TOKEN - tokenID === "KTzTXT_ANmF84fWEKHzWURD1LWd9QaFR9yfYUwH2Lxw" - ); -}; - -/** - * Sends an HTTP request for L2 token Transfers - * - * @param {RequestInit & { url: string }} config - The configuration for the Fetch request. - * It should include the URL, method, headers, and any other relevant options. - * @returns {Promise} - A Promise that resolves to the response object. - */ - -export const sendRequest = async ( - config: RequestInit & { url: string } -): Promise => { - try { - const response = await fetch(config.url, config); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const data = await response.json(); - - if (data !== undefined) { - return data; - } else { - throw new Error(`${config.url}: null response`); - } - } catch (error) { - throw new Error("Unknown error occurred"); - } -}; - -export async function isUrlOnline(url: RequestInfo | URL, timeoutMs = 5000) { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), timeoutMs); - - try { - const response = await fetch(url, { signal: controller.signal }); - clearTimeout(timeoutId); - return response.ok; - } catch (error) { - return false; - } -} - -export function getWarpGatewayUrl( - subdomain: string, - type: "gateway" | "sequencer" = "gateway" -) { - const baseUrl = `https://${subdomain}.warp.cc`; - return type === "sequencer" - ? `${baseUrl}/gateway/sequencer/register` - : baseUrl; -} diff --git a/src/wallets/router/auth/auth.routes.ts b/src/wallets/router/auth/auth.routes.ts index edc3dda92..9bd1f534b 100644 --- a/src/wallets/router/auth/auth.routes.ts +++ b/src/wallets/router/auth/auth.routes.ts @@ -8,7 +8,6 @@ import { SignatureAuthRequestView } from "~routes/auth/signature"; import { SignDataItemAuthRequestView } from "~routes/auth/signDataItem"; import { SignKeystoneAuthRequestView } from "~routes/auth/signKeystone"; import { SubscriptionAuthRequestView } from "~routes/auth/subscription"; -import { TokenAuthRequestView } from "~routes/auth/token"; import { UnlockAuthRequestView } from "~routes/auth/unlock"; import { getExtensionOverrides } from "~wallets/router/extension/extension.routes"; import type { RouteConfig } from "~wallets/router/router.types"; @@ -52,10 +51,6 @@ export const AUTH_ROUTES = [ path: AuthPaths.Allowance, component: AllowanceAuthRequestView }, - { - path: AuthPaths.Token, - component: TokenAuthRequestView - }, { path: AuthPaths.Decrypt, component: DecryptAuthRequestView diff --git a/src/wallets/router/popup/popup.routes.ts b/src/wallets/router/popup/popup.routes.ts index 1ba1adb22..77126ebcc 100644 --- a/src/wallets/router/popup/popup.routes.ts +++ b/src/wallets/router/popup/popup.routes.ts @@ -32,7 +32,6 @@ import { SubscriptionDetailsView } from "~routes/popup/subscriptions/subscriptio import { SubscriptionManagementView } from "~routes/popup/subscriptions/subscriptionManagement"; import { SubscriptionPaymentView } from "~routes/popup/subscriptions/subscriptionPayment"; import { SubscriptionsView } from "~routes/popup/subscriptions/subscriptions"; -import { AssetView } from "~routes/popup/token/[id]"; import { TokensView } from "~routes/popup/tokens"; import { TransactionView } from "~routes/popup/transaction/[id]"; import { TransactionsView } from "~routes/popup/transaction/transactions"; @@ -191,10 +190,6 @@ export const POPUP_ROUTES = [ path: PopupPaths.Tokens, component: TokensView }, - { - path: PopupPaths.Asset, - component: AssetView - }, { path: PopupPaths.Collectibles, component: CollectiblesView diff --git a/yarn.lock b/yarn.lock index 2ca17a751..78d229e45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30,11 +30,6 @@ qrcode.react "3.1.0" react-qr-reader "2.2.1" -"@arconnect/warp-dre@^0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@arconnect/warp-dre/-/warp-dre-0.0.1.tgz#461ba9c8f8fd74e6c9361dac725f57a86a9894a9" - integrity sha512-I02V6N7xYJi2NMluj17ytYTmBY0hY/GEXa30CwPbRkbJk87aH4FcejfFaN2euyWjiuQmkTS7SiK1P4nxwaFE0w== - "@arconnect/webext-bridge@^5.0.6": version "5.0.6" resolved "https://registry.yarnpkg.com/@arconnect/webext-bridge/-/webext-bridge-5.0.6.tgz#edcc28d0d7e215fba2e5a3c832cf7842f7046b9d" @@ -4482,19 +4477,6 @@ abortcontroller-polyfill@1.7.5, abortcontroller-polyfill@^1.1.9: resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== -abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abstract-level/-/abstract-level-1.0.4.tgz#3ad8d684c51cc9cbc9cf9612a7100b716c414b57" - integrity sha512-eUP/6pbXBkMbXFdx4IH2fVgvB7M0JvR7/lIL33zcs0IBcwjdzSSl31TOJsaCzmKSSDF9h8QYSOJux4Nd4YJqFg== - dependencies: - buffer "^6.0.3" - catering "^2.1.0" - is-buffer "^2.0.5" - level-supports "^4.0.0" - level-transcoder "^1.0.1" - module-error "^1.0.1" - queue-microtask "^1.2.3" - acorn@^8.10.0, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" @@ -4654,51 +4636,6 @@ arbundles@^0.9.5: multistream "^4.1.0" tmp-promise "^3.0.2" -archiver-utils@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-2.1.0.tgz#e8a460e94b693c3e3da182a098ca6285ba9249e2" - integrity sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw== - dependencies: - glob "^7.1.4" - graceful-fs "^4.2.0" - lazystream "^1.0.0" - lodash.defaults "^4.2.0" - lodash.difference "^4.5.0" - lodash.flatten "^4.4.0" - lodash.isplainobject "^4.0.6" - lodash.union "^4.6.0" - normalize-path "^3.0.0" - readable-stream "^2.0.0" - -archiver-utils@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-3.0.4.tgz#a0d201f1cf8fce7af3b5a05aea0a337329e96ec7" - integrity sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw== - dependencies: - glob "^7.2.3" - graceful-fs "^4.2.0" - lazystream "^1.0.0" - lodash.defaults "^4.2.0" - lodash.difference "^4.5.0" - lodash.flatten "^4.4.0" - lodash.isplainobject "^4.0.6" - lodash.union "^4.6.0" - normalize-path "^3.0.0" - readable-stream "^3.6.0" - -archiver@^5.3.0: - version "5.3.2" - resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.2.tgz#99991d5957e53bd0303a392979276ac4ddccf3b0" - integrity sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw== - dependencies: - archiver-utils "^2.1.0" - async "^3.2.4" - buffer-crc32 "^0.2.1" - readable-stream "^3.6.0" - readdir-glob "^1.1.2" - tar-stream "^2.2.0" - zip-stream "^4.1.0" - archy@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" @@ -4797,16 +4734,6 @@ arweave-stream-tx@^1.1.0: dependencies: exponential-backoff "^3.1.0" -arweave@1.14.4: - version "1.14.4" - resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.14.4.tgz#5ba22136aa0e7fd9495258a3931fb770c9d6bf21" - integrity sha512-tmqU9fug8XAmFETYwgUhLaD3WKav5DaM4p1vgJpEj/Px2ORPPMikwnSySlFymmL2qgRh2ZBcZsg11+RXPPGLsA== - dependencies: - arconnect "^0.4.2" - asn1.js "^5.4.1" - base64-js "^1.5.1" - bignumber.js "^9.0.2" - arweave@=1.11.8, arweave@^1.10.13, arweave@^1.10.15, arweave@^1.10.16, arweave@^1.13.0, arweave@^1.13.7: version "1.15.1" resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.15.1.tgz#c6183136b20980c81a8cb77ce6fd9fb333e1a174" @@ -4847,18 +4774,6 @@ assert@^2.0.0: object.assign "^4.1.4" util "^0.12.5" -async-mutex@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.4.1.tgz#bccf55b96f2baf8df90ed798cb5544a1f6ee4c2c" - integrity sha512-WfoBo4E/TbCX1G95XTjbWTE3X2XLG0m1Xbv2cwOtuPdyH9CZvnaA5nCt1ucjaKEgW2A5IF71hxrRhr83Je5xjA== - dependencies: - tslib "^2.4.0" - -async@^3.2.4: - version "3.2.5" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" - integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -4980,11 +4895,6 @@ better-path-resolve@1.0.0: dependencies: is-windows "^1.0.0" -bignumber.js@9.1.1: - version "9.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" - integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== - bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.0.2, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" @@ -5033,7 +4943,7 @@ bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.6, bn.js@^4.11.9: +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -5053,14 +4963,6 @@ bottleneck@^2.15.3: resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.19.5.tgz#5df0b90f59fd47656ebe63c78a98419205cadd91" integrity sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw== -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - brace-expansion@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" @@ -5087,16 +4989,6 @@ brorand@^1.0.1, brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== -browser-level@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browser-level/-/browser-level-1.0.1.tgz#36e8c3183d0fe1c405239792faaab5f315871011" - integrity sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ== - dependencies: - abstract-level "^1.0.2" - catering "^2.1.1" - module-error "^1.0.2" - run-parallel-limit "^1.1.0" - browserify-aes@^1.0.4, browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -5195,25 +5087,6 @@ bs58check@^2.1.2: create-hash "^1.1.0" safe-buffer "^5.1.2" -buffer-crc32@^0.2.1, buffer-crc32@^0.2.13: - version "0.2.13" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" - integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== - -buffer-pipe@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/buffer-pipe/-/buffer-pipe-0.0.0.tgz#186ec257d696e8e74c3051160a0e9e9a9811a387" - integrity sha512-PvKbsvQOH4dcUyUEvQQSs3CIkkuPcOHt3gKnXwf4HsPKFDxSN7bkmICVIWgOmW/jx/fAEGGn4mIayIJPLs7G8g== - dependencies: - safe-buffer "^5.1.1" - -buffer-pipe@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/buffer-pipe/-/buffer-pipe-0.0.3.tgz#242197681d4591e7feda213336af6c07a5ce2409" - integrity sha512-GlxfuD/NrKvCNs0Ut+7b1IHjylfdegMBxQIlZHj7bObKVQBxB5S84gtm2yu1mQ8/sSggceWBDPY0cPXgvX2MuA== - dependencies: - safe-buffer "^5.1.2" - buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" @@ -5333,11 +5206,6 @@ caniuse-lite@^1.0.30001541, caniuse-lite@^1.0.30001587: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz#809bc25f3f5027ceb33142a7d6c40759d7a901eb" integrity sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA== -catering@^2.1.0, catering@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" - integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== - cbor-sync@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/cbor-sync/-/cbor-sync-1.0.4.tgz#5a11a1ab75c2a14d1af1b237fd84aa8c1593662f" @@ -5445,17 +5313,6 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" -classic-level@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.4.1.tgz#169ecf9f9c6200ad42a98c8576af449c1badbaee" - integrity sha512-qGx/KJl3bvtOHrGau2WklEZuXhS3zme+jf+fsu6Ej7W7IP/C49v7KNlWIsT1jZu0YnfzSIYDGcEWpCa1wKGWXQ== - dependencies: - abstract-level "^1.0.2" - catering "^2.1.0" - module-error "^1.0.1" - napi-macros "^2.2.2" - node-gyp-build "^4.3.0" - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -5646,21 +5503,6 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" -compress-commons@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-4.1.2.tgz#6542e59cb63e1f46a8b21b0e06f9a32e4c8b06df" - integrity sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg== - dependencies: - buffer-crc32 "^0.2.13" - crc32-stream "^4.0.2" - normalize-path "^3.0.0" - readable-stream "^3.6.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - config-chain@^1.1.11: version "1.1.13" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" @@ -5763,19 +5605,6 @@ cosmiconfig@^9.0.0: js-yaml "^4.1.0" parse-json "^5.2.0" -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - -crc32-stream@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-4.0.3.tgz#85dd677eb78fa7cad1ba17cc506a597d41fc6f33" - integrity sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw== - dependencies: - crc-32 "^1.2.0" - readable-stream "^3.4.0" - crc@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/crc/-/crc-3.8.0.tgz#ad60269c2c856f8c299e2c4cc0de4556914056c6" @@ -6598,11 +6427,6 @@ external-editor@^3.1.0: iconv-lite "^0.4.24" tmp "^0.0.33" -fast-copy@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/fast-copy/-/fast-copy-3.0.2.tgz#59c68f59ccbcac82050ba992e0d5c389097c9d35" - integrity sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ== - fast-fifo@^1.1.0, fast-fifo@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" @@ -6824,11 +6648,6 @@ fs-minipass@^3.0.0, fs-minipass@^3.0.3: dependencies: minipass "^7.0.3" -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -6854,11 +6673,6 @@ function.prototype.name@^1.1.6: es-abstract "^1.22.1" functions-have-names "^1.2.3" -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== - functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" @@ -6957,18 +6771,6 @@ glob@^10.2.2, glob@^10.3.10, glob@^10.3.12: minipass "^7.0.4" path-scurry "^1.11.0" -glob@^7.1.4, glob@^7.2.3: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -7399,15 +7201,7 @@ index-to-position@^0.1.2: resolved "https://registry.yarnpkg.com/index-to-position/-/index-to-position-0.1.2.tgz#e11bfe995ca4d8eddb1ec43274488f3c201a7f09" integrity sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g== -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -7534,11 +7328,6 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-buffer@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" - integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== - is-buffer@~1.1.6: version "1.1.6" resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -8016,21 +7805,6 @@ kleur@^4.1.5: resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== -lazystream@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.1.tgz#494c831062f1f9408251ec44db1cba29242a2638" - integrity sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw== - dependencies: - readable-stream "^2.0.5" - -leb128@0.0.4, leb128@^0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/leb128/-/leb128-0.0.4.tgz#f96d698cf3ba5b677423abfe50b7e9b2df1463ff" - integrity sha512-2zejk0fCIgY8RVcc/KzvyfpDio5Oo8HgPZmkrOmdwmbk0KpKpgD+JKwikxKk8cZYkANIhwHK50SNukkCm3XkCQ== - dependencies: - bn.js "^4.11.6" - buffer-pipe "0.0.0" - less@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/less/-/less-4.2.0.tgz#cbefbfaa14a4cd388e2099b2b51f956e1465c450" @@ -8048,28 +7822,6 @@ less@^4.1.1: needle "^3.1.0" source-map "~0.6.0" -level-supports@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-4.0.1.tgz#431546f9d81f10ff0fea0e74533a0e875c08c66a" - integrity sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA== - -level-transcoder@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/level-transcoder/-/level-transcoder-1.0.1.tgz#f8cef5990c4f1283d4c86d949e73631b0bc8ba9c" - integrity sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w== - dependencies: - buffer "^6.0.3" - module-error "^1.0.1" - -level@^8.0.0: - version "8.0.1" - resolved "https://registry.yarnpkg.com/level/-/level-8.0.1.tgz#737161db1bc317193aca4e7b6f436e7e1df64379" - integrity sha512-oPBGkheysuw7DmzFQYyFe8NAia5jFLAgEnkgWnK3OXAuJr8qFT+xBQIwokAZPME2bhPFzS8hlYcL16m8UZrtwQ== - dependencies: - abstract-level "^1.0.4" - browser-level "^1.0.1" - classic-level "^1.2.0" - libnpmaccess@^8.0.1: version "8.0.5" resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-8.0.5.tgz#ef14fecab8385669e91d6be27971ae448064211f" @@ -8413,26 +8165,11 @@ lodash.capitalize@^4.2.1: resolved "https://registry.yarnpkg.com/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz#f826c9b4e2a8511d84e3aca29db05e1a4f3b72a9" integrity sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw== -lodash.defaults@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" - integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== - -lodash.difference@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.difference/-/lodash.difference-4.5.0.tgz#9ccb4e505d486b91651345772885a2df27fd017c" - integrity sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA== - lodash.escaperegexp@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" integrity sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw== -lodash.flatten@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" - integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g== - lodash.isplainobject@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" @@ -8453,11 +8190,6 @@ lodash.startcase@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" integrity sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg== -lodash.union@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88" - integrity sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw== - lodash.uniqby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" @@ -8610,15 +8342,6 @@ mdn-data@2.0.30: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc" integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA== -memory-level@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/memory-level/-/memory-level-1.0.0.tgz#7323c3fd368f9af2f71c3cd76ba403a17ac41692" - integrity sha512-UXzwewuWeHBz5krr7EvehKcmLFNoXxGcvuYhC41tRnkrTbJohtS7kVn9akmgirtRygg+f7Yjsfi8Uu5SGSQ4Og== - dependencies: - abstract-level "^1.0.0" - functional-red-black-tree "^1.0.1" - module-error "^1.0.1" - meow@^12.0.1: version "12.1.1" resolved "https://registry.yarnpkg.com/meow/-/meow-12.1.1.tgz#e558dddbab12477b69b2e9a2728c327f191bace6" @@ -8729,20 +8452,6 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^5.1.0: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" - minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.4: version "9.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" @@ -8868,11 +8577,6 @@ mnemonist@^0.39.8: dependencies: obliterator "^2.0.1" -module-error@^1.0.1, module-error@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/module-error/-/module-error-1.0.2.tgz#8d1a48897ca883f47a45816d4fb3e3c6ba404d86" - integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -8951,11 +8655,6 @@ napi-build-utils@^1.0.1: resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== -napi-macros@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.2.2.tgz#817fef20c3e0e40a963fbf7b37d1600bd0201044" - integrity sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g== - needle@^3.1.0: version "3.3.1" resolved "https://registry.yarnpkg.com/needle/-/needle-3.3.1.tgz#63f75aec580c2e77e209f3f324e2cdf3d29bd049" @@ -9055,7 +8754,7 @@ node-gyp-build-optional-packages@5.0.7: resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz#5d2632bbde0ab2f6e22f1bbac2199b07244ae0b3" integrity sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w== -node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: +node-gyp-build@^4.2.0: version "4.8.1" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== @@ -9344,7 +9043,7 @@ obliterator@^2.0.1: resolved "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== -once@^1.3.0, once@^1.3.1, once@^1.4.0: +once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -9643,11 +9342,6 @@ path-exists@^4.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -10061,7 +9755,7 @@ queue-lit@^3.0.0: resolved "https://registry.npmjs.org/queue-lit/-/queue-lit-3.0.0.tgz#5062f815e49c28759a2dc12124ab1723d563b932" integrity sha512-iyVL2X5G58kICVGLW/nseYmdHxBoAp2Gav16H23NPtIllyEJ+UheHlYZqBjO+lJHRYoZRSrX7chH8tMrH9MB/A== -queue-microtask@^1.2.2, queue-microtask@^1.2.3: +queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== @@ -10258,7 +9952,7 @@ read@^3.0.1: dependencies: mute-stream "^1.0.0" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.3.8, readable-stream@~2.3.6: +readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.3.8, readable-stream@~2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -10280,13 +9974,6 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" -readdir-glob@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.3.tgz#c3d831f51f5e7bfa62fa2ffbe4b508c640f09584" - integrity sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA== - dependencies: - minimatch "^5.1.0" - readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -10448,13 +10135,6 @@ run-async@^3.0.0: resolved "https://registry.yarnpkg.com/run-async/-/run-async-3.0.0.tgz#42a432f6d76c689522058984384df28be379daad" integrity sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q== -run-parallel-limit@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz#be80e936f5768623a38a963262d6bef8ff11e7ba" - integrity sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw== - dependencies: - queue-microtask "^1.2.2" - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -10505,11 +10185,6 @@ safe-regex-test@^1.0.3: es-errors "^1.3.0" is-regex "^1.1.4" -safe-stable-stringify@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz#34694bd8a30575b7f94792aa51527551bd733d61" - integrity sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA== - "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -10945,11 +10620,6 @@ stream-browserify@^3.0.0: inherits "~2.0.4" readable-stream "^3.5.0" -stream-buffers@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-3.0.2.tgz#5249005a8d5c2d00b3a32e6e0a6ea209dc4f3521" - integrity sha512-DQi1h8VEBA/lURbSwFtEHnSTb9s2/pwLEaFuNhXwy1Dx3Sa0lOuYT2yNUr4/j2fs8oCAMANtrZ5OrPZtyVs3MQ== - stream-combiner2@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" @@ -11218,7 +10888,7 @@ tar-fs@^3.0.4: bare-fs "^2.1.1" bare-path "^2.1.0" -tar-stream@^2.1.4, tar-stream@^2.2.0: +tar-stream@^2.1.4: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== @@ -11618,7 +11288,7 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici@^5.19.1, undici@^5.8.0: +undici@^5.19.1: version "5.28.4" resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== @@ -11686,13 +11356,6 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unzipit@^1.4.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/unzipit/-/unzipit-1.4.3.tgz#738298a6b235892bf7ce7db82cff813d4ca664ac" - integrity sha512-gsq2PdJIWWGhx5kcdWStvNWit9FVdTewm4SEG7gFskWs+XCVaULt9+BwuoBtJiRE8eo3L1IPAOrbByNLtLtIlg== - dependencies: - uzip-module "^1.0.2" - update-browserslist-db@^1.0.13: version "1.0.15" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.15.tgz#60ed9f8cba4a728b7ecf7356f641a31e3a691d97" @@ -11750,11 +11413,6 @@ uuid@^9.0.0, uuid@^9.0.1: resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== -uzip-module@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/uzip-module/-/uzip-module-1.0.3.tgz#6bbabe2a3efea5d5a4a47479f523a571de3427ce" - integrity sha512-AMqwWZaknLM77G+VPYNZLEruMGWGzyigPK3/Whg99B3S6vGHuqsyl5ZrOv1UUF3paGK1U6PM0cnayioaryg/fA== - validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -11811,34 +11469,6 @@ warp-arbundles@^1.0.4: buffer "^6.0.3" warp-isomorphic "^1.0.7" -warp-contracts@^1.2.13: - version "1.4.44" - resolved "https://registry.yarnpkg.com/warp-contracts/-/warp-contracts-1.4.44.tgz#77c85abd507c447623991939d439f1f28d055e4b" - integrity sha512-aMPIPqFdpln4pfv3/LQ/LIoI4ErspsVKN1zyyrfEPIGkK5DGMKJyXXf0P3KOJ+1eSPWtwOekX+Bt0Dfna7JdGA== - dependencies: - archiver "^5.3.0" - arweave "1.14.4" - async-mutex "^0.4.0" - bignumber.js "9.1.1" - events "3.3.0" - fast-copy "^3.0.0" - level "^8.0.0" - memory-level "^1.0.0" - safe-stable-stringify "2.4.1" - stream-buffers "^3.0.2" - unzipit "^1.4.0" - warp-arbundles "^1.0.4" - warp-isomorphic "^1.0.7" - warp-wasm-metering "1.0.1" - -warp-isomorphic@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/warp-isomorphic/-/warp-isomorphic-1.0.0.tgz#dccccfc046bc6ac77919f8be1024ced1385c70ea" - integrity sha512-E+9+brlrnZoNpNvpz8foIZiCk9fIVukRBZYEy/yefM+oAG+zNgDPb/xNaZyUJWC8rSZxE1DqrhRl0JxjtLVltA== - dependencies: - buffer "^6.0.3" - undici "^5.8.0" - warp-isomorphic@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/warp-isomorphic/-/warp-isomorphic-1.0.7.tgz#abf1ee7bce44bec7c6b97547859e614876869aa7" @@ -11847,23 +11477,6 @@ warp-isomorphic@^1.0.7: buffer "^6.0.3" undici "^5.19.1" -warp-wasm-json-toolkit@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/warp-wasm-json-toolkit/-/warp-wasm-json-toolkit-1.0.2.tgz#16ca399e5b20da804c01ff0d00979341b689a0e7" - integrity sha512-T6pKJz9mO0ZFYiu4jB2v8j8t8Cw21n/+uFh0QKbc/7cJSssGd3I26sV/VXjoDbGuG7bGzK9BewlFd+ukvxABOA== - dependencies: - buffer-pipe "0.0.3" - leb128 "0.0.4" - warp-isomorphic "1.0.0" - -warp-wasm-metering@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/warp-wasm-metering/-/warp-wasm-metering-1.0.1.tgz#1496b0b9a936985cf21a910e909b87630faa1c43" - integrity sha512-s2NtOPTGIDPWeDKyrY5UiUUf3oOjbjwGF9sgmRR3nqXzjxdgppvuf+6VYquzYM3xRMXIOq+AWMK2H/D/Yv+4tg== - dependencies: - leb128 "^0.0.4" - warp-wasm-json-toolkit "1.0.2" - wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -12165,15 +11778,6 @@ yoctocolors@^2.0.0: resolved "https://registry.yarnpkg.com/yoctocolors/-/yoctocolors-2.0.0.tgz#f6cd83f1fd0b211594810a6de413202d6d177075" integrity sha512-esbDnt0Z1zI1KgvOZU90hJbL6BkoUbrP9yy7ArNZ6TmxBxydMJTYMf9FZjmwwcA8ZgEQzriQ3hwZ0NYXhlFo8Q== -zip-stream@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.1.1.tgz#1337fe974dbaffd2fa9a1ba09662a66932bd7135" - integrity sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ== - dependencies: - archiver-utils "^3.0.4" - compress-commons "^4.1.2" - readable-stream "^3.6.0" - zod@^3.22.4, zod@^3.23.5: version "3.23.8" resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" From 2d82f89affda8534ab5033b9aa35684b84f7ba3c Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Tue, 7 Jan 2025 20:53:14 +0545 Subject: [PATCH 2/6] fix: resolve issue with token setting & remove ao support check --- assets/_locales/en/messages.json | 4 --- assets/_locales/zh_CN/messages.json | 4 --- src/components/dashboard/Tokens.tsx | 4 +-- .../dashboard/subsettings/TokenSettings.tsx | 5 +++- .../popup/settings/tokens/[id]/index.tsx | 1 + src/routes/popup/tokens.tsx | 18 +++---------- src/tokens/aoTokens/ao.ts | 27 +++++-------------- src/tokens/aoTokens/sync.ts | 10 ++----- 8 files changed, 18 insertions(+), 55 deletions(-) diff --git a/assets/_locales/en/messages.json b/assets/_locales/en/messages.json index 450e6081e..a58c78d47 100644 --- a/assets/_locales/en/messages.json +++ b/assets/_locales/en/messages.json @@ -2002,10 +2002,6 @@ } } }, - "setting_ao_support": { - "message": "ao support", - "description": "ao support settings title" - }, "setting_ao_support_description": { "message": "Show ao tokens in your wallet (beta)", "description": "ao support settings description" diff --git a/assets/_locales/zh_CN/messages.json b/assets/_locales/zh_CN/messages.json index b615f3116..9019e7b9b 100644 --- a/assets/_locales/zh_CN/messages.json +++ b/assets/_locales/zh_CN/messages.json @@ -1992,10 +1992,6 @@ } } }, - "setting_ao_support": { - "message": "ao 支持", - "description": "ao support settings title" - }, "setting_ao_support_description": { "message": "在您的钱包中显示 ao 代币(测试版)", "description": "ao support settings description" diff --git a/src/components/dashboard/Tokens.tsx b/src/components/dashboard/Tokens.tsx index d8463a18e..75531554b 100644 --- a/src/components/dashboard/Tokens.tsx +++ b/src/components/dashboard/Tokens.tsx @@ -17,7 +17,7 @@ export function TokensDashboardView() { const [matches, params] = useRoute<{ id?: string }>("/tokens/:id?"); // tokens - const [aoTokens, setAoTokens] = useStorage( + const [aoTokens] = useStorage( { key: "ao_tokens", instance: ExtensionStorage @@ -81,7 +81,7 @@ export function TokensDashboardView() { {}} values={aoTokens} style={{ display: "flex", flexDirection: "column", gap: "0.4rem" }} > diff --git a/src/components/dashboard/subsettings/TokenSettings.tsx b/src/components/dashboard/subsettings/TokenSettings.tsx index 34f2b3b78..fa8af84a5 100644 --- a/src/components/dashboard/subsettings/TokenSettings.tsx +++ b/src/components/dashboard/subsettings/TokenSettings.tsx @@ -47,8 +47,11 @@ export function TokenSettingsDashboardView({ const [loading, setLoading] = useState(false); + console.log({ aoTokens }); + const token = useMemo(() => { const aoToken = aoTokens.find((ao) => ao.processId === id); + if (!aoToken) return; return { ...aoToken, @@ -61,7 +64,7 @@ export function TokenSettingsDashboardView({ // update token type function updateType(type: TokenType) { setAoTokens((allTokens) => { - const tokenIndex = allTokens.findIndex((t) => t.id === id); + const tokenIndex = allTokens.findIndex((t) => t.processId === id); if (tokenIndex !== -1) { allTokens[tokenIndex].type = type; } diff --git a/src/routes/popup/settings/tokens/[id]/index.tsx b/src/routes/popup/settings/tokens/[id]/index.tsx index 920a33806..d27f5b086 100644 --- a/src/routes/popup/settings/tokens/[id]/index.tsx +++ b/src/routes/popup/settings/tokens/[id]/index.tsx @@ -44,6 +44,7 @@ export function TokenSettingsView({ params: { id } }: TokenSettingsProps) { const token = useMemo(() => { const aoToken = aoTokens.find((ao) => ao.processId === id); + if (!aoToken) return; return { ...aoToken, diff --git a/src/routes/popup/tokens.tsx b/src/routes/popup/tokens.tsx index a87205b12..43724cb62 100644 --- a/src/routes/popup/tokens.tsx +++ b/src/routes/popup/tokens.tsx @@ -14,7 +14,6 @@ import { } from "~tokens/aoTokens/ao"; import { ExtensionStorage } from "~utils/storage"; import { syncAoTokens } from "~tokens/aoTokens/sync"; -import { useStorage } from "@plasmohq/storage/hook"; export function TokensView() { const { navigate } = useLocation(); @@ -32,14 +31,6 @@ export function TokensView() { const { setToast } = useToasts(); - const [aoSupport] = useStorage( - { - key: "setting_ao_support", - instance: ExtensionStorage - }, - false - ); - function handleTokenClick(tokenId: string) { navigate(`/send/transfer/${tokenId}`); } @@ -112,7 +103,6 @@ export function TokensView() { }; async function searchAoTokens() { - if (!aoSupport) return; try { setIsLoading(true); const { hasNextPage } = await syncAoTokens(); @@ -123,10 +113,8 @@ export function TokensView() { } useEffect(() => { - if (aoSupport) { - searchAoTokens(); - } - }, [aoSupport]); + searchAoTokens(); + }, []); return ( <> @@ -171,7 +159,7 @@ export function TokensView() { /> ))} - {aoSupport && hasNextPage && ( + {hasNextPage && ( ({ - key: "setting_ao_support", - instance: ExtensionStorage - }); - const [aoTokens] = useStorage( { key: "ao_tokens", @@ -129,11 +124,6 @@ export function useAoTokens({ useEffect(() => { (async () => { try { - if (!aoSetting) { - setTokens([]); - return; - } - setTokens( aoTokens .filter((t) => { @@ -154,11 +144,11 @@ export function useAoTokens({ ); } catch {} })(); - }, [aoTokens, aoSetting]); + }, [aoTokens]); useEffect(() => { (async () => { - if (!activeAddress || !aoSetting) { + if (!activeAddress) { setBalances([]); return; } @@ -230,7 +220,7 @@ export function useAoTokens({ setLoading(false); } })(); - }, [tokens, activeAddress, aoSetting]); + }, [tokens, activeAddress]); return [tokensWithBalances, loading]; } @@ -324,11 +314,6 @@ export function useAoTokensCache(): [TokenInfoWithBalance[], boolean] { instance: ExtensionStorage }); - const [aoSetting] = useStorage({ - key: "setting_ao_support", - instance: ExtensionStorage - }); - const [aoTokens] = useStorage( { key: "ao_tokens", @@ -348,7 +333,7 @@ export function useAoTokensCache(): [TokenInfoWithBalance[], boolean] { ); const aoTokensToAdd = useMemo(() => { - if (!activeAddress || aoTokensCache.length === 0 || !aoSetting) { + if (!activeAddress || aoTokensCache.length === 0) { return []; } @@ -381,7 +366,7 @@ export function useAoTokensCache(): [TokenInfoWithBalance[], boolean] { useEffect(() => { (async () => { - if (!activeAddress || !aoSetting) { + if (!activeAddress) { return setBalances([]); } @@ -413,7 +398,7 @@ export function useAoTokensCache(): [TokenInfoWithBalance[], boolean] { setLoading(false); } })(); - }, [aoTokensToAdd, activeAddress, aoSetting]); + }, [aoTokensToAdd, activeAddress]); return [tokensWithBalances, loading]; } diff --git a/src/tokens/aoTokens/sync.ts b/src/tokens/aoTokens/sync.ts index 96a663499..4ff49933c 100644 --- a/src/tokens/aoTokens/sync.ts +++ b/src/tokens/aoTokens/sync.ts @@ -246,12 +246,9 @@ export async function syncAoTokens() { isSyncInProgress = true; try { - const [activeAddress, aoSupport] = await Promise.all([ - getActiveAddress(), - ExtensionStorage.get("setting_ao_support") - ]); + const activeAddress = await getActiveAddress(); - if (!activeAddress || !aoSupport) { + if (!activeAddress) { lastHasNextPage = false; return { hasNextPage: false, syncCount: 0 }; } @@ -354,9 +351,6 @@ export async function scheduleImportAoTokens() { const activeAddress = await getActiveAddress(); if (!activeAddress) return; - const aoSupport = await ExtensionStorage.get("setting_ao_support"); - if (!aoSupport) return; - await ExtensionStorage.set(AO_TOKENS_IMPORT_TIMESTAMP, Date.now()); browser.alarms.create("import_ao_tokens", { when: Date.now() + 2000 }); From 8860186f852d98d6a6680f59c0f01ef15da50ce7 Mon Sep 17 00:00:00 2001 From: 7i7o Date: Wed, 8 Jan 2025 12:04:08 -0300 Subject: [PATCH 3/6] fix dapp first load issue --- .../message/api-call-message/api-call-message.handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/background/handlers/message/api-call-message/api-call-message.handler.ts b/src/api/background/handlers/message/api-call-message/api-call-message.handler.ts index 5e3a5b75e..f25d93515 100644 --- a/src/api/background/handlers/message/api-call-message/api-call-message.handler.ts +++ b/src/api/background/handlers/message/api-call-message/api-call-message.handler.ts @@ -70,7 +70,7 @@ export const handleApiCallMessage: OnMessageCallback< }); // update app value with the app belonging to the frame - if (frame.url) { + if (frame?.url) { app = new Application(getAppURL(frame.url)); } } From 5b5d8bd8c89ab7a9a40c5b669974901e9cc77a27 Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Thu, 9 Jan 2025 14:02:09 +0545 Subject: [PATCH 4/6] fix: add missing password check in sign auth --- src/routes/auth/sign.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/routes/auth/sign.tsx b/src/routes/auth/sign.tsx index a7eafd2ea..2c3a331fc 100644 --- a/src/routes/auth/sign.tsx +++ b/src/routes/auth/sign.tsx @@ -43,6 +43,7 @@ import { getTagValue } from "~tokens/aoTokens/ao"; import { humanizeTimestampTags } from "~utils/timestamp"; import styled from "styled-components"; import { ChevronDownIcon, ChevronUpIcon } from "@iconicicons/react"; +import { checkPassword } from "~wallets/auth"; export function SignAuthRequestView() { const { authRequest, acceptRequest, rejectRequest } = @@ -240,6 +241,17 @@ export function SignAuthRequestView() { const sign = async () => { if (!transaction) return; + if (askPassword) { + const checkPw = await checkPassword(passwordInput.state); + if (!checkPw) { + setToast({ + type: "error", + content: browser.i18n.getMessage("invalidPassword"), + duration: 2400 + }); + return; + } + } if (wallet.type === "hardware") { // load tx ur if (!page) await loadTransactionUR(); From cc324f33967d19977bcf06d6e879d09645f99b1c Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Thu, 9 Jan 2025 23:14:55 +0545 Subject: [PATCH 5/6] fix: changing tokens type & add removed no tokens message --- src/components/popup/home/Tokens.tsx | 11 ++++++++++- src/routes/popup/settings/tokens/[id]/index.tsx | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/popup/home/Tokens.tsx b/src/components/popup/home/Tokens.tsx index 3d98cb6db..35f9c5b21 100644 --- a/src/components/popup/home/Tokens.tsx +++ b/src/components/popup/home/Tokens.tsx @@ -1,5 +1,5 @@ import { Heading, TokenCount, ViewAll } from "../Title"; -import { Spacer } from "@arconnect/components"; +import { Spacer, Text } from "@arconnect/components"; import browser from "webextension-polyfill"; import styled from "styled-components"; import Token from "../Token"; @@ -26,6 +26,9 @@ export default function Tokens() { + {aoTokens.length === 0 && ( + {browser.i18n.getMessage("no_assets")} + )} {aoTokens.map((token) => ( { - const tokenIndex = allTokens.findIndex((t) => t.id === id); + const tokenIndex = allTokens.findIndex((t) => t.processId === id); if (tokenIndex !== -1) { allTokens[tokenIndex].type = type; } From 5771d8b02a85bad7e02cb0e3a64d48146cd81527 Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Thu, 9 Jan 2025 23:21:55 +0545 Subject: [PATCH 6/6] refactor: clean console log --- src/components/dashboard/subsettings/TokenSettings.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/dashboard/subsettings/TokenSettings.tsx b/src/components/dashboard/subsettings/TokenSettings.tsx index fa8af84a5..f8b7c1892 100644 --- a/src/components/dashboard/subsettings/TokenSettings.tsx +++ b/src/components/dashboard/subsettings/TokenSettings.tsx @@ -47,8 +47,6 @@ export function TokenSettingsDashboardView({ const [loading, setLoading] = useState(false); - console.log({ aoTokens }); - const token = useMemo(() => { const aoToken = aoTokens.find((ao) => ao.processId === id); if (!aoToken) return;