Skip to content

Commit

Permalink
fix: the actual plugin id (#10820)
Browse files Browse the repository at this point in the history
* fix: actual plugin id

* refactor: remove unused code
  • Loading branch information
guanbinrui committed Sep 22, 2023
1 parent 91b06be commit 1003eae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from '@masknet/shared'
import { Icons } from '@masknet/icons'
import { useCurrentVisitingIdentity } from '@masknet/plugin-infra/content-script'
import { useChainContext, useWallet, useNativeTokenPrice, useNetworkContext } from '@masknet/web3-hooks-base'
import { useChainContext, useWallet, useNativeTokenPrice, useEnvironmentContext } from '@masknet/web3-hooks-base'
import { ChainResolver, SmartPayBundler, Web3 } from '@masknet/web3-providers'
import { useI18N } from '../locales/index.js'
import { RED_PACKET_DEFAULT_SHARES, RED_PACKET_MAX_SHARES, RED_PACKET_MIN_SHARES } from '../constants.js'
Expand Down Expand Up @@ -113,7 +113,7 @@ export function RedPacketERC20Form(props: RedPacketFormProps) {
const { onChange, onNext, origin, gasOption, onGasOptionChange, expectedChainId } = props
// context
const wallet = useWallet()
const { pluginID } = useNetworkContext()
const { pluginID } = useEnvironmentContext()
const { account, chainId } = useChainContext<NetworkPluginID.PLUGIN_EVM>({ chainId: expectedChainId })
const { HAPPY_RED_PACKET_ADDRESS_V4 } = useRedPacketConstants(chainId)
const { value: smartPayChainId } = useAsync(async () => SmartPayBundler.getSupportedChainId(), [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
useNativeTokenPrice,
useWallet,
useNonFungibleAssetsByCollectionAndOwner,
useEnvironmentContext,
} from '@masknet/web3-hooks-base'
import { NetworkPluginID, EMPTY_LIST } from '@masknet/shared-base'
import { SourceType } from '@masknet/web3-shared-base'
Expand Down Expand Up @@ -245,6 +246,7 @@ export function RedPacketERC721Form(props: RedPacketERC721FormProps) {
const { classes, cx } = useStyles()
const [selectOption, setSelectOption] = useState<NFTSelectOption | undefined>(undefined)
const { account, chainId } = useChainContext<NetworkPluginID.PLUGIN_EVM>()
const { pluginID } = useEnvironmentContext()
const [collection, setCollection] = useState<NonFungibleCollection<ChainId, SchemaType>>()
const [manualSelectedTokenDetailedList, setExistTokenDetailedList] = useState<OrderedERC721Token[]>(EMPTY_LIST)
const [onceAllSelectedTokenDetailedList, setAllTokenDetailedList] = useState<OrderedERC721Token[]>(EMPTY_LIST)
Expand Down Expand Up @@ -497,7 +499,10 @@ export function RedPacketERC721Form(props: RedPacketERC721FormProps) {
</Box>

<Box style={{ position: 'absolute', bottom: 0, width: '100%' }}>
<PluginWalletStatusBar>
<PluginWalletStatusBar
expectedPluginID={NetworkPluginID.PLUGIN_EVM}
expectedChainId={chainId}
actualPluginID={pluginID}>
<ChainBoundary
expectedPluginID={NetworkPluginID.PLUGIN_EVM}
expectedChainId={chainId}
Expand Down
2 changes: 0 additions & 2 deletions packages/plugins/Savings/src/SiteAdaptor/SavingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Web3ContextProvider,
useFungibleTokens,
RevokeChainContextProvider,
useNetworkContext,
ChainContextProvider,
useChainContext,
} from '@masknet/web3-hooks-base'
Expand Down Expand Up @@ -65,7 +64,6 @@ const chains = [ChainId.Mainnet]
export function SavingsDialog({ open, onClose }: SavingsDialogProps) {
const t = useI18N()
const { classes } = useStyles()
const { pluginID } = useNetworkContext()

const { chainId } = useChainContext<NetworkPluginID.PLUGIN_EVM>({ chainId: ChainId.Mainnet })
const [selectedProtocol, setSelectedProtocol] = useState<SavingsProtocol | null>(null)
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Savings/src/SiteAdaptor/SavingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function SavingsFormDialog({ chainId, protocol, tab, onClose }: SavingsFo
)
} catch {
// do nothing
console.log('Failed to estimate gas')
console.error('Failed to estimate gas')
}
}, [chainId, isDeposit, protocol, tokenAmount])
// #endregion
Expand Down

0 comments on commit 1003eae

Please sign in to comment.