Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove web3-shared dependency in shared package #3519

Merged
merged 2 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@dimensiondev/holoflows-kit": "0.8.0-20210317064617-6c4792c",
"@dimensiondev/kit": "^0.0.0-20210221102734-0b4a937",
"@dimensiondev/kit": "=0.0.0-20210624142900-972fd05",
"@masknet/icons": "workspace:*",
"@masknet/plugin-example": "workspace:*",
"@masknet/plugin-infra": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { Dispatch, memo, SetStateAction, useState } from 'react'
import { Box, makeStyles, TablePagination } from '@material-ui/core'
import {
ChainId,
CollectibleProvider,
ERC1155TokenAssetDetailed,
ERC721TokenAssetDetailed,
EthereumTokenType,
formatEthereumAddress,
useAccount,
useChainId,
useWallet,
CollectibleProvider,
useCollectibles,
useWallet,
} from '@masknet/web3-shared'
import { useCurrentCollectibleDataProvider } from '../../api'
import { LoadingPlaceholder } from '../LoadingPlacholder'
import { EmptyPlaceholder } from '../EmptyPlaceholder'
import { formatEthereumAddress } from '@masknet/shared'
import { CollectibleCard } from '../CollectibleCard'
import { useDashboardI18N } from '../../../../locales'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { Dispatch, memo, SetStateAction, useState } from 'react'
import {
Table,
TableContainer,
TableHead,
TableRow,
TableCell,
Box,
makeStyles,
TableBody,
Pagination,
PaginationItem,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
} from '@material-ui/core'
import { MaskColorVar } from '@masknet/theme'
import { useDashboardI18N } from '../../../../locales'
import { EmptyPlaceholder } from '../EmptyPlaceholder'
import { LoadingPlaceholder } from '../LoadingPlacholder'
import { TokenTableRow } from '../TokenTableRow'
import { formatBalance } from '@masknet/shared'
import { Asset, formatBalance, useAssets, useERC20TokensPaged } from '@masknet/web3-shared'
import BigNumber from 'bignumber.js'
import { ceil } from 'lodash-es'
import { Asset, useAssets, useERC20TokensPaged } from '@masknet/web3-shared'

const useStyles = makeStyles((theme) => ({
container: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { memo } from 'react'
import { Box, TableRow, Typography, makeStyles, TableCell, Button } from '@material-ui/core'
import { Box, Button, makeStyles, TableCell, TableRow, Typography } from '@material-ui/core'
import { TokenIcon } from '../TokenIcon'
import { formatBalance, formatCurrency, FormattedCurrency, pow10 } from '@masknet/shared'
import { CurrencyType, Asset, getTokenUSDValue } from '@masknet/web3-shared'
import { FormattedCurrency } from '@masknet/shared'
import { Asset, CurrencyType, formatBalance, formatCurrency, getTokenUSDValue, pow10 } from '@masknet/web3-shared'
import BigNumber from 'bignumber.js'
import { useNavigate } from 'react-router'
import { RoutePaths } from '../../../../type'
Expand Down
2 changes: 1 addition & 1 deletion packages/maskbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@balancer-labs/sor": "^1.0.0",
"@dimensiondev/common-protocols": "1.6.0-20201027083702-d0ae6e2",
"@dimensiondev/holoflows-kit": "0.8.0-20210317064617-6c4792c",
"@dimensiondev/kit": "0.0.0-20210221102734-0b4a937",
"@dimensiondev/kit": "=0.0.0-20210624142900-972fd05",
"@dimensiondev/metamask-extension-provider": "3.0.6-20210519045409-1835d4d",
"@dimensiondev/stego-js": "=0.11.1-20201027083223-8ab41be",
"@dimensiondev/uniswap-sdk": "=3.0.4-20210619092641-a270dc0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo, useState, useEffect, useReducer, Fragment } from 'react'
import { unreachable, makeTypedMessageTuple, TypedMessageTuple } from '@masknet/shared'
import { Fragment, useEffect, useMemo, useReducer, useState } from 'react'
import { makeTypedMessageTuple, TypedMessageTuple } from '@masknet/shared'
import { unreachable } from '@dimensiondev/kit'

import { delay } from '../../../utils/utils'
import { ServicesWithProgress } from '../../../extension/service'
Expand All @@ -11,8 +12,8 @@ import type {
SuccessDecryption,
} from '../../../extension/background-script/CryptoServices/decryptFrom'
import { DecryptPostSuccess, DecryptPostSuccessProps } from './DecryptedPostSuccess'
import { DecryptPostAwaitingProps, DecryptPostAwaiting } from './DecryptPostAwaiting'
import { DecryptPostFailedProps, DecryptPostFailed } from './DecryptPostFailed'
import { DecryptPostAwaiting, DecryptPostAwaitingProps } from './DecryptPostAwaiting'
import { DecryptPostFailed, DecryptPostFailedProps } from './DecryptPostFailed'
import { DecryptedPostDebug } from './DecryptedPostDebug'
import { usePostClaimedAuthor, usePostInfoDetails, usePostInfoSharedPublic } from '../../DataSource/usePostInfo'
import { asyncIteratorWithResult } from '../../../utils/type-transform/asyncIteratorHelpers'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { makeStyles, Typography, MenuItem } from '@material-ui/core'
import { makeStyles, MenuItem, Typography } from '@material-ui/core'
import classNames from 'classnames'
import {
useAccount,
useChainId,
formatEthereumAddress,
NetworkType,
resolveChainColor,
useAccount,
useChainDetailed,
useChainId,
useChainIdValid,
NetworkType,
} from '@masknet/web3-shared'
import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord'
import { MaskbookSharpIconOfSize, WalletSharp } from '../../resources/MaskbookIcon'
Expand All @@ -27,7 +28,7 @@ import { Flags } from '../../utils/flags'
import { useStylesExtends } from '../custom-ui-helper'
import { ClaimAllDialog } from '../../plugins/ITO/UI/ClaimAllDialog'
import { WalletIcon } from '../shared/WalletIcon'
import { formatEthereumAddress, useValueRef } from '@masknet/shared'
import { useValueRef } from '@masknet/shared'
import { useI18N } from '../../utils'
import { currentNetworkSettings } from '../../plugins/Wallet/settings'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ValueRef } from '@dimensiondev/holoflows-kit'
import { useValueRef, getEnumAsArray } from '@masknet/shared'
import { useValueRef } from '@masknet/shared'
import { getEnumAsArray } from '@dimensiondev/kit'
import {
ListItem,
ListItemIcon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import {
Avatar,
ListItem,
ListItemAvatar,
ListItemIcon,
ListItemText,
ListTypeMap,
makeStyles,
Theme,
ListTypeMap,
ListItemAvatar,
ListItemIcon,
} from '@material-ui/core'
import CheckIcon from '@material-ui/icons/Check'
import type { DefaultComponentProps } from '@material-ui/core/OverridableComponent'
import { Wallet, useBlockie } from '@masknet/web3-shared'
import { formatEthereumAddress } from '@masknet/shared'
import { formatEthereumAddress, useBlockie, Wallet } from '@masknet/web3-shared'
import { useI18N } from '../../../utils'
import { useStylesExtends } from '../../custom-ui-helper'

Expand Down
4 changes: 2 additions & 2 deletions packages/maskbook/src/database/Persona/consistency.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { FullPersonaDBTransaction } from './Persona.db'
import { ProfileIdentifier, PersonaIdentifier, Identifier, ECKeyIdentifier } from '../type'
import { ECKeyIdentifier, Identifier, PersonaIdentifier, ProfileIdentifier } from '../type'
import type { IdentifierMap } from '../IdentifierMap'
import { restorePrototype } from '../../utils/type'
import { unreachable } from '@masknet/shared'
import { unreachable } from '@dimensiondev/kit'

type ReadwriteFullPersonaDBTransaction = FullPersonaDBTransaction<'readwrite'>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ProfileIdentifier, GroupIdentifier } from '../../../database/type'
import { GroupIdentifier, ProfileIdentifier } from '../../../database/type'
import { queryPublicKey } from '../../../database'
import { IdentifierMap } from '../../../database/IdentifierMap'
import type { RecipientDetail, RecipientReason } from '../../../database/post'
import { queryUserGroup } from '../UserGroupService'
import type { EC_Public_JsonWebKey } from '../../../modules/CryptoAlgorithm/interfaces/utils'
import { unreachable } from '@masknet/shared'
import { unreachable } from '@dimensiondev/kit'

export async function prepareRecipientDetail(to: (ProfileIdentifier | GroupIdentifier)[]) {
const recipients = new IdentifierMap<ProfileIdentifier, RecipientDetail>(new Map(), ProfileIdentifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { HttpProvider, TransactionConfig } from 'web3-core'
import type { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers'
import { addGasMargin, EthereumMethodType, ProviderType } from '@masknet/web3-shared'
import type { IJsonRpcRequest } from '@walletconnect/types'
import { safeUnreachable } from '@masknet/shared'
import { safeUnreachable } from '@dimensiondev/kit'
import { createWeb3 } from './web3'
import * as WalletConnect from './providers/WalletConnect'
import { currentAccountSettings, currentProviderSettings } from '../../../plugins/Wallet/settings'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { memoizePromise } from '@dimensiondev/kit'
import { formatEthereumAddress } from '@masknet/shared'
import { EthereumTokenType, ChainId, ERC20TokenDetailed, getChainDetailed } from '@masknet/web3-shared'
import {
ChainId,
ERC20TokenDetailed,
EthereumTokenType,
formatEthereumAddress,
getChainDetailed,
} from '@masknet/web3-shared'

interface TokenList {
keywords: string[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProviderType } from '@masknet/web3-shared'
import { unreachable } from '@masknet/shared'
import { unreachable } from '@dimensiondev/kit'
import * as Maskbook from './providers/Maskbook'
import * as MetaMask from './providers/MetaMask'
import * as WalletConnect from './providers/WalletConnect'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatEthereumAddress, useValueRef } from '@masknet/shared'
import { EthereumTokenType, useAccount, Wallet } from '@masknet/web3-shared'
import { useValueRef } from '@masknet/shared'
import { EthereumTokenType, formatEthereumAddress, useAccount, Wallet } from '@masknet/web3-shared'
import { Box, Button, makeStyles, Skeleton, TablePagination, Typography } from '@material-ui/core'
import { createContext, useState } from 'react'
import { useUpdateEffect } from 'react-use'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import classNames from 'classnames'
import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline'
import RadioButtonUncheckedIcon from '@material-ui/icons/RadioButtonUnchecked'
import { Table, TableBody, TableRow, TableCell, Typography, makeStyles, Theme } from '@material-ui/core'
import { unreachable } from '@masknet/shared'
import { makeStyles, Table, TableBody, TableCell, TableRow, Theme, Typography } from '@material-ui/core'
import { unreachable } from '@dimensiondev/kit'
import { useI18N } from '../../../utils'
import { useStylesExtends } from '../../../components/custom-ui-helper'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { formatEthereumAddress } from '@masknet/shared'
import { ChainId, getChainFullName, getTokenConstants, useBlockie, useChainDetailed } from '@masknet/web3-shared'
import {
ChainId,
formatEthereumAddress,
getChainFullName,
getTokenConstants,
useBlockie,
useChainDetailed,
} from '@masknet/web3-shared'
import { Avatar, AvatarProps, makeStyles, Theme } from '@material-ui/core'
import { useStylesExtends } from '../../../components/custom-ui-helper'
import { useImageFailover } from '../../../utils/hooks/useImageFailover'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatEthereumAddress } from '@masknet/shared'
import {
currySameAddress,
formatEthereumAddress,
FungibleTokenDetailed,
resolveTokenLinkOnExplorer,
useTokenConstants,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,27 @@ import BigNumber from 'bignumber.js'
import classNames from 'classnames'
import ExpandLessIcon from '@material-ui/icons/ExpandLess'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import type { Asset } from '@masknet/web3-shared'
import {
CurrencyType,
currySameAddress,
EthereumTokenType,
Wallet,
useStableTokensDebank,
useChainDetailed,
formatBalance,
formatCurrency,
getChainIdFromName,
currySameAddress,
isGreaterThan,
useAssets,
useChainDetailed,
useStableTokensDebank,
Wallet,
} from '@masknet/web3-shared'
import { useStylesExtends } from '../../../components/custom-ui-helper'
import { formatBalance, formatCurrency, FormattedCurrency, isGreaterThan } from '@masknet/shared'
import { useMatchXS, useI18N } from '../../../utils'
import { FormattedCurrency } from '@masknet/shared'
import { useI18N, useMatchXS } from '../../../utils'
import { TokenIcon } from './TokenIcon'
import { ActionsBarFT } from './ActionsBarFT'
import { useTrustedERC20TokensFromDB } from '../../../plugins/Wallet/hooks/useERC20Tokens'
import type { Asset } from '../../../plugins/Wallet/types'
import { getTokenUSDValue } from '../../../plugins/Wallet/helpers'
import { useAssets } from '../../../plugins/Wallet/hooks/useAssets'

const useStyles = makeStyles<
Theme,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Trash2 as TrashIcon } from 'react-feather'
import { Button } from '@material-ui/core'
import { unreachable } from '@masknet/shared'
import { unreachable } from '@dimensiondev/kit'
import {
isNative,
ERC1155TokenDetailed,
ERC20TokenDetailed,
ERC721TokenDetailed,
EthereumTokenType,
FungibleTokenDetailed,
isNative,
NonFungibleTokenDetailed,
EthereumTokenType,
} from '@masknet/web3-shared'
import { WalletRPC } from '../../../../plugins/Wallet/messages'
import { useI18N } from '../../../../utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Button, makeStyles, TextField } from '@material-ui/core'
import { useCallback, useContext, useEffect, useMemo, useState } from 'react'
import { EthereumAddress } from 'wallet.ts'
import {
useTokenTransferCallback,
TransactionStateType,
ERC1155TokenAssetDetailed,
ERC721TokenAssetDetailed,
formatEthereumAddress,
TransactionStateType,
useTokenTransferCallback,
} from '@masknet/web3-shared'
import { useRemoteControlledDialog, useI18N } from '../../../../utils'
import { useI18N, useRemoteControlledDialog } from '../../../../utils'
import { Image } from '../../../../components/shared/Image'
import { WalletMessages } from '../../../../plugins/Wallet/messages'
import { formatEthereumAddress } from '@masknet/shared'
import { MaskbookIconOutlined } from '../../../../resources/MaskbookIcon'
import { CollectibleContext } from '../../DashboardComponents/CollectibleList'
import { DashboardDialogCore, DashboardDialogWrapper, WrappedDialogProps } from '../Base'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import { Button, makeStyles, TextField } from '@material-ui/core'
import BigNumber from 'bignumber.js'
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react'
import { EthereumAddress } from 'wallet.ts'
import { formatBalance, formatEthereumAddress, isGreaterThan, isZero, pow10 } from '@masknet/shared'
import {
Wallet,
EthereumTokenType,
formatBalance,
formatEthereumAddress,
FungibleTokenDetailed,
isGreaterThan,
isZero,
pow10,
TransactionStateType,
useTokenBalance,
useTokenTransferCallback,
TransactionStateType,
FungibleTokenDetailed,
EthereumTokenType,
Wallet,
} from '@masknet/web3-shared'
import { useRemoteControlledDialog, useI18N } from '../../../../utils'
import { useI18N, useRemoteControlledDialog } from '../../../../utils'
import { WalletMessages } from '../../../../plugins/Wallet/messages'
import { TokenAmountPanel } from '../../../../web3/UI/TokenAmountPanel'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import { useStylesExtends } from '../../../components/custom-ui-helper'
import { usePostLink } from '../../../components/DataSource/usePostInfo'
import { AirdropIcon } from '../../../resources/AirdropIcon'
import { activatedSocialNetworkUI } from '../../../social-network'
import { useRemoteControlledDialog } from '../../../utils/hooks/useRemoteControlledDialog'
import { useAccount, TransactionStateType, ERC20TokenDetailed, useChainId } from '@masknet/web3-shared'
import { useRemoteControlledDialog } from '../../../utils'
import {
ERC20TokenDetailed,
formatPercentage,
isZero,
pow10,
TransactionStateType,
useAccount,
useChainId,
} from '@masknet/web3-shared'
import { WalletMessages } from '../../Wallet/messages'
import { formatPercentage, isZero, pow10 } from '@masknet/shared'
import { useAirdropPacket } from '../hooks/useAirdropPacket'
import { useClaimCallback } from '../hooks/useClaimCallback'
import { CheckStateType, useCheckCallback } from '../hooks/useCheckCallback'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js'
import { useCallback, useState } from 'react'
import { EthereumAddress } from 'wallet.ts'
import { formatEthereumAddress, isGreaterThan, ONE } from '@masknet/shared'
import { formatEthereumAddress, isGreaterThan, ONE } from '@masknet/web3-shared'
import type { AirdropPacket } from '../apis'
import { useAirdropContract } from '../contracts/useAirdropContract'
import { AirdropRPC } from '../messages'
Expand Down
Loading