Skip to content

Commit 148c687

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feat/MetisNetwork
2 parents fbdbe3a + 357550e commit 148c687

File tree

108 files changed

+1743
-355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1743
-355
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enabled: true
2+
label: "Blocked: Has Conflict"

.github/workflows/bot.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@
310310
"crwdns",
311311
"dodoapi",
312312
"getdodoroute",
313+
"openocean",
314+
"OPENOCEAN",
313315
"getx",
314316
"hookform",
315317
"idiv",

packages/dashboard/src/initialization/PluginHost.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ import { InMemoryStorages, PersistentStorages } from '../utils/kv-storage'
99

1010
const PluginHost: Plugin.__Host.Host<Plugin.Dashboard.DashboardContext> = {
1111
enabled: {
12+
// Due to MASK-391, we don't have a user configurable "disabled" plugin.
13+
// All plugins are always loaded but it might be displayed in the invisible mode.
14+
isEnabled: () => true,
15+
events: new Emitter(),
16+
},
17+
minimalMode: {
1218
events: new Emitter(),
1319
isEnabled: (id) => {
14-
return Services.Settings.getPluginEnabled(id)
20+
return Services.Settings.getPluginMinimalModeEnabled(id)
1521
},
1622
},
1723
addI18NResource(plugin, resource) {
@@ -27,7 +33,8 @@ const PluginHost: Plugin.__Host.Host<Plugin.Dashboard.DashboardContext> = {
2733
},
2834
}
2935
setTimeout(() => {
30-
Messages.events.pluginEnabled.on((id) => PluginHost.enabled.events.emit('enabled', id))
31-
Messages.events.pluginDisabled.on((id) => PluginHost.enabled.events.emit('disabled', id))
36+
Messages.events.pluginMinimalModeChanged.on(([id, status]) => {
37+
PluginHost.minimalMode.events.emit(status ? 'enabled' : 'disabled', id)
38+
})
3239
startPluginDashboard(PluginHost)
3340
})

packages/dashboard/src/pages/Labs/components/PluginItem.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface PluginItemProps {
5858
desc: string
5959
icon?: ReactNode
6060
enabled?: boolean
61+
hideSwitch?: boolean
6162
onSwitch: (id: string, checked: boolean) => void
6263
onTwitter?: (id: string) => void
6364
onFacebook?: (id: string) => void
@@ -72,7 +73,20 @@ export function PluginItemPlaceholder() {
7273
}
7374

7475
export default function PluginItem(props: PluginItemProps) {
75-
const { id, title, desc, icon, enabled, onSwitch, onTwitter, onFacebook, onExplore, onSetting, onTutorial } = props
76+
const {
77+
id,
78+
title,
79+
desc,
80+
icon,
81+
enabled = false,
82+
hideSwitch,
83+
onSwitch,
84+
onTwitter,
85+
onFacebook,
86+
onExplore,
87+
onSetting,
88+
onTutorial,
89+
} = props
7690
const { classes } = useStyles()
7791
return (
7892
<Box className={classes.root}>
@@ -98,7 +112,7 @@ export default function PluginItem(props: PluginItemProps) {
98112
{onExplore ? <Explore onClick={() => onExplore(id)} /> : null}
99113
</Box>
100114
) : null}
101-
{id ? (
115+
{!hideSwitch ? (
102116
<SettingSwitch
103117
size="small"
104118
checked={enabled}

packages/dashboard/src/pages/Labs/components/SwapSettingDialog.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,34 @@ export default function SwapSettingDialog({ open, onClose }: SettingDialogProps)
3030
{ label: 'Balancer', value: TradeProvider.BALANCER },
3131
{ label: 'DODO', value: TradeProvider.DODO },
3232
{ label: 'Bancor', value: TradeProvider.BANCOR },
33+
{ label: 'OpenOcean', value: TradeProvider.OPENOCEAN },
3334
]
3435

3536
const polygonOptions = [
3637
{ label: 'QuickSwap', value: TradeProvider.QUICKSWAP },
3738
{ label: 'SushiSwap', value: TradeProvider.SUSHISWAP },
3839
{ label: '0x', value: TradeProvider.ZRX },
3940
{ label: 'DODO', value: TradeProvider.DODO },
41+
{ label: 'OpenOcean', value: TradeProvider.OPENOCEAN },
4042
]
4143

4244
const bscOptions = [
4345
{ label: 'PancakeSwap', value: TradeProvider.PANCAKESWAP },
4446
{ label: 'SushiSwap', value: TradeProvider.SUSHISWAP },
4547
{ label: '0x', value: TradeProvider.ZRX },
4648
{ label: 'DODO', value: TradeProvider.DODO },
49+
{ label: 'OpenOcean', value: TradeProvider.OPENOCEAN },
4750
]
4851

49-
const arbitrumOptions = [{ label: 'UniSwap V3', value: TradeProvider.UNISWAP_V3 }]
52+
const arbitrumOptions = [
53+
{ label: 'UniSwap V3', value: TradeProvider.UNISWAP_V3 },
54+
{ label: 'OpenOcean', value: TradeProvider.OPENOCEAN },
55+
]
5056

51-
const xDaiOptions = [{ label: 'SushiSwap', value: TradeProvider.SUSHISWAP }]
57+
const xDaiOptions = [
58+
{ label: 'SushiSwap', value: TradeProvider.SUSHISWAP },
59+
{ label: 'OpenOcean', value: TradeProvider.OPENOCEAN },
60+
]
5261
const fantomOptions = xDaiOptions
5362

5463
const celoOptions = [{ label: 'SushiSwap', value: TradeProvider.SUSHISWAP }]

packages/dashboard/src/pages/Labs/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import { useDashboardI18N } from '../../locales'
2222
import MarketTrendSettingDialog from './components/MarketTrendSettingDialog'
2323
import { useAccount } from '@masknet/web3-shared-evm'
24-
import { Services, PluginMessages } from '../../API'
24+
import { Messages, Services, PluginMessages } from '../../API'
2525
import { useRemoteControlledDialog } from '@masknet/shared'
2626
import { TUTORIAL_URLS_EN } from './constants'
2727
import { ContentContainer } from '../../components/ContentContainer'
@@ -71,6 +71,14 @@ export default function Plugins() {
7171
[PluginId.PoolTogether]: true,
7272
})
7373

74+
useEffect(
75+
() =>
76+
Messages.events.pluginMinimalModeChanged.on(([id, newValue]) =>
77+
setPluginStatus({ ...pluginStatus, [id]: newValue }),
78+
),
79+
[pluginStatus],
80+
)
81+
7482
const plugins = [
7583
{
7684
id: PluginId.RedPacket,
@@ -107,13 +115,15 @@ export default function Plugins() {
107115
icon: <SwapServiceIcon />,
108116
enabled: pluginStatus[PluginId.Trader],
109117
setting: true,
118+
hideSwitch: true,
110119
},
111120
{
112121
id: PluginId.Transak,
113122
title: t.labs_transak(),
114123
desc: t.labs_transak_desc(),
115124
icon: <TransakIcon />,
116125
enabled: pluginStatus[PluginId.Transak],
126+
hideSwitch: true,
117127
},
118128
{
119129
id: PluginId.Collectible,
@@ -189,7 +199,7 @@ export default function Plugins() {
189199
const { openDialog: openSwapDialog } = useRemoteControlledDialog(PluginMessages.Swap.swapDialogUpdated)
190200

191201
async function onSwitch(id: string, checked: boolean) {
192-
await Services.Settings.setPluginEnabled(id, checked)
202+
await Services.Settings.setPluginMinimalModeEnabled(id, !checked)
193203
setPluginStatus({ ...pluginStatus, [id]: checked })
194204
}
195205

@@ -215,7 +225,7 @@ export default function Plugins() {
215225

216226
useEffect(() => {
217227
Object.values(PluginId).forEach(async (id) => {
218-
const enabled = await Services.Settings.getPluginEnabled(id)
228+
const enabled = await Services.Settings.getPluginMinimalModeEnabled(id)
219229
setPluginStatus((status) => ({ ...status, [id]: enabled }))
220230
})
221231
}, [])
@@ -247,6 +257,7 @@ export default function Plugins() {
247257
onSwitch={onSwitch}
248258
onTutorial={onTutorial}
249259
onSetting={p.setting ? onSetting : undefined}
260+
hideSwitch={p.hideSwitch}
250261
/>
251262
))}
252263
</Box>

packages/mask/shared-ui/locales/en-US.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
"user_guide_tip_2": "Click here to have a quick start.",
9292
"create_persona": "Create persona",
9393
"connect_persona": "Connect persona",
94+
"please_create_persona": "Please create persona",
95+
"please_connect_persona": "Please connect persona",
9496
"mask_network": "Mask Network",
9597
"import": "Import",
9698
"no_search_result": "No result",
@@ -174,6 +176,7 @@
174176
"wallet_search_no_result": "No results.",
175177
"wallet_confirm_with_password": "Confirm with password",
176178
"wallet_airdrop_nft_unclaimed_title": "NFT Airdrop Unclaimed:",
179+
"plugin_not_enabled": "{{plugin}} (Not Enabled)",
177180
"plugin_external_unknown_plugin": "New unknown Mask plugins found. Do you want to load them?",
178181
"plugin_external_loader_search_holder": "Search for an external plugin",
179182
"plugin_external_loader_search_button": "Search for plugin",
@@ -365,6 +368,14 @@
365368
"plugin_red_packet_nft_account_name": "Wallet account",
366369
"plugin_red_packet_nft_attached_message": "Attached Message",
367370
"plugin_red_packet_nft_total_amount": "Total Amount",
371+
"plugin_red_packet_nft_select_collection": "Choose your collection",
372+
"plugin_red_packet_nft_max_shares": "The maximum number of NFTs to be sold in NFT lucky drop contract is {{amount}}.",
373+
"plugin_red_packet_nft_max_shares_tip": "The collection lucky drop contract supports up to {{amount}} NFTs for sale.",
374+
"plugin_red_packet_nft_shift_select_tip": "You can also use <text>{{text}}</text> to select multiple NFTs.",
375+
"plugin_red_packet_nft_non_existed_tip": "Token ID <tokenIdList></tokenIdList> does not exist or belong to you.",
376+
"plugin_red_packet_nft_select_all_option": "ALL ({{total}} NFT)",
377+
"plugin_red_packet_nft_select_partially_option": "Select partially",
378+
"plugin_red_packet_nft_approve_all_tip": "Note: When selecting approve all, all NFTs in the contract will be authorized for sale by default, including the NFTs transfered later.",
368379
"plugin_red_packet_completed": "Completed",
369380
"plugin_red_packet_expired": "Expired",
370381
"plugin_red_packet_indivisible": "The minimum amount for each share is {{amount}} {{symbol}}",

packages/mask/src/components/CompositionDialog/BadgeRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface BadgeRendererProps {
1818
}
1919

2020
export function BadgeRenderer({ meta, onDeleteMeta, readonly }: BadgeRendererProps) {
21-
const plugins = useActivatedPluginsSNSAdaptor()
21+
const plugins = useActivatedPluginsSNSAdaptor('any')
2222
const i18n = usePluginI18NField()
2323
const { t } = useI18N()
2424
if (!meta) return null

packages/mask/src/components/CompositionDialog/PluginEntryRender.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const PluginEntryRender = memo(
2929
const chainId = useChainId()
3030
const pluginID = usePluginIDContext()
3131
const operatingSupportedChainMapping = useActivatedPluginSNSAdaptor_Web3Supported(chainId, pluginID)
32-
const result = [...useActivatedPluginsSNSAdaptor()]
32+
const result = [...useActivatedPluginsSNSAdaptor('any')]
3333
.sort((plugin) => {
3434
// TODO: support priority order
3535
if (plugin.ID === RedPacketPluginID || plugin.ID === ITO_PluginID) return -1

0 commit comments

Comments
 (0)