Skip to content

Commit

Permalink
[Release] Hotfix 2.21.2 => 2.21.3 (patch) (#9933)
Browse files Browse the repository at this point in the history
* chore: bump version 2.21.3

* refactor: wc v1 bridge url (#9934)

* refactor: update bridge url

* refactor: deactive remote flags

* refactor: enable remote config

* fix: sentry tx reports (#10062)

* chore: add logs

* refactor: update comment

* chore: remove dev guard

* Revert "chore: remove dev guard"

This reverts commit 89eb425.

* Revert "chore: add logs"

This reverts commit d29021e.

* fix: all tx should be recorded

* fix: relation service query (#10096)

* fix: mf-4561 click on shadowdom cause ui jumping (#10114)

* fix: mf-4448 some nft have been filtered out (#10112)

* fixup! fix: mf-4561 click on shadowdom cause ui jumping (#10114) (#10125)

* fix: relation service (#10138)

* fix: relation service

* refactor: reply review

* fix: twitter api (#10139)

* fix: relation service (#10141)

---------

Co-authored-by: lelenei <72531217+lelenei@users.noreply.github.com>
Co-authored-by: UncleBill <billbill290@gmail.com>
  • Loading branch information
3 people committed Jul 22, 2023
1 parent b010c54 commit 9cb401b
Show file tree
Hide file tree
Showing 15 changed files with 310 additions and 227 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.21.2",
"version": "2.21.3",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/flags/src/flags/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const flags = {
sentry_async_transaction_enabled: devOnly,

// wallet connect
wc_v1_bridge_url: 'https://bridge.walletconnect.org',
wc_v1_bridge_url: 'https://wc.firefly.land',
wc_v2_relay_url: 'wss://relay.walletconnect.com',
wc_v2_project_id: '8f1769933420afe8873860925fcca14f',
wc_v2_mode: process.env.NODE_ENV === 'production' ? 'error' : 'debug',
Expand Down
6 changes: 2 additions & 4 deletions packages/mask/src/components/GuideStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,20 @@ export default function GuideStep({ total, step, tip, children, arrow = true, on

useLayoutEffect(() => {
let stopped = false
requestAnimationFrame(function self() {
requestAnimationFrame(function fn() {
if (stopped) return
requestAnimationFrame(self)
requestAnimationFrame(fn)
if (!childrenRef.current) return
const cr = childrenRef.current.getBoundingClientRect()
if (!cr.height) return
const bottomAvailable = window.innerHeight - cr.height - cr.top > 200
setBottomAvailable(bottomAvailable)
let update = false
setClientRect((old) => {
if (
old &&
(old.height === cr.height || old.left === cr.left || old.top === cr.top || old.width === cr.width)
)
return old
update = true
return cr
})
if (box1Ref.current) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Mask Network",
"version": "2.21.2",
"version": "2.21.3",
"manifest_version": 2,
"permissions": ["storage", "downloads", "webNavigation", "activeTab"],
"optional_permissions": ["<all_urls>", "notifications", "clipboardRead"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export function injectProfileTabAtTwitter(signal: AbortSignal) {
name: 'Last tab in the profile page',
rule: isProfilePageLike,
},
shadowRootDelegatesFocus: false,
})
attachReactTreeWithContainer(watcher.firstDOMProxy.afterShadow, { signal }).render(
<>
Expand All @@ -277,5 +278,6 @@ export function injectProfileTabAtTwitter(signal: AbortSignal) {
startWatch(contentWatcher, {
signal,
missingReportRule: { name: 'ProfileTab', rule: isProfilePageLike },
shadowRootDelegatesFocus: false,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {

function injectProfileTabContentForEmptyState(signal: AbortSignal) {
const watcher = new MutationObserverWatcher(searchProfileEmptySelector())
startWatch(watcher, signal)
startWatch(watcher, { signal, shadowRootDelegatesFocus: false })
attachReactTreeWithContainer(watcher.firstDOMProxy.afterShadow, { signal }).render(
<ProfileTabContentAtTwitter floating />,
)
}

function injectProfileTabContentState(signal: AbortSignal) {
const watcher = new MutationObserverWatcher(searchProfileTabPageSelector())
startWatch(watcher, signal)
startWatch(watcher, { signal, shadowRootDelegatesFocus: false })
attachReactTreeWithContainer(watcher.firstDOMProxy.afterShadow, { signal }).render(<ProfileTabContentAtTwitter />)
}

Expand All @@ -36,9 +36,9 @@ export function injectProfileTabContentAtTwitter(signal: AbortSignal) {
MaskMessages.events.profileTabHidden.sendToLocal({ hidden: false }),
)

startWatch(contentLoseConnectionWatcher, signal)
startWatch(contentContentWatcher, signal)
startWatch(ContentForEmptyWatcher, signal)
startWatch(contentLoseConnectionWatcher, { signal, shadowRootDelegatesFocus: false })
startWatch(contentContentWatcher, { signal, shadowRootDelegatesFocus: false })
startWatch(ContentForEmptyWatcher, { signal, shadowRootDelegatesFocus: false })

injectProfileTabContentForEmptyState(signal)
injectProfileTabContentState(signal)
Expand Down
7 changes: 4 additions & 3 deletions packages/mask/src/utils/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function startWatch<T extends MutationObserverWatcher<any, any, any, any>
if (options instanceof AbortSignal) {
options = { signal: options }
}
const { signal, missingReportRule } = options
const { signal, missingReportRule, shadowRootDelegatesFocus: delegatesFocus } = options

if (missingReportRule) {
watchers.set(watcher, missingReportRule)
Expand All @@ -39,8 +39,8 @@ export function startWatch<T extends MutationObserverWatcher<any, any, any, any>

watcher
.setDOMProxyOption({
afterShadowRootInit: Flags.shadowRootInit,
beforeShadowRootInit: Flags.shadowRootInit,
afterShadowRootInit: { ...Flags.shadowRootInit, delegatesFocus },
beforeShadowRootInit: { ...Flags.shadowRootInit, delegatesFocus },
})
.startWatch({ subtree: true, childList: true }, signal)
return watcher
Expand All @@ -59,6 +59,7 @@ export interface MissingReportRuleOptions {
export interface WatchOptions {
signal: AbortSignal
missingReportRule?: MissingReportRuleOptions
shadowRootDelegatesFocus?: boolean
}

const watchers = new Map<MutationObserverWatcher<any>, MissingReportRuleOptions>()
Expand Down
1 change: 1 addition & 0 deletions packages/shared-base/src/NextID/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface NextIDEnsRecord {
category: 'ENS'
chain: string
id: string
uuid: string
}

export interface NextIDIdentity {
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/ShadowRoot/ShadowRootIsolation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function ShadowRootIsolation({ children, rootElement = 'div', ...props }:
if (dom.shadowRoot) return

// Note: ShadowRootIsolation is expected to use inside other closed ShadowRoot
const shadow = dom.attachShadow({ ...Flags.shadowRootInit, mode: 'open' })
const shadow = dom.attachShadow({ ...Flags.shadowRootInit, mode: 'open', delegatesFocus: false })
shadow.appendChild(container.current!)
}, [dom])

Expand Down
119 changes: 78 additions & 41 deletions packages/web3-providers/src/NextID/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,83 @@ const BASE_URL =
process.env.channel === 'stable' && process.env.NODE_ENV === 'production' ? PROOF_BASE_URL_PROD : PROOF_BASE_URL_DEV

const relationServiceDomainQuery = `domain(domainSystem: $domainSystem, name: $domain) {
source
system
name
fetcher
resolved {
identity
platform
displayName
}
owner {
identity
platform
displayName
uuid
nft(category: ["ENS"], limit: 100, offset: 0) {
uuid
category
chain
id
}
neighborWithTraversal(depth: 5) {
... on ProofRecord {
source
system
name
fetcher
resolved {
identity
from {
nft(category: ["ENS"], limit: 100, offset: 0) {
uuid
category
chain
id
}
uuid
platform
identity
displayName
}
owner {
to {
nft(category: ["ENS"], limit: 100, offset: 0) {
uuid
category
chain
id
}
uuid
platform
identity
displayName
}
}
... on HoldRecord {
source
from {
nft(category: ["ENS"], limit: 100, offset: 0) {
uuid
category
chain
id
}
uuid
platform
identity
displayName
neighborWithTraversal(depth: 5) {
... on ProofRecord {
__typename
source
from {
uuid
platform
identity
displayName
}
to {
uuid
platform
identity
displayName
}
}
... on HoldRecord {
__typename
source
from {
uuid
platform
identity
displayName
}
to {
uuid
platform
identity
displayName
}
}
}
to {
nft(category: ["ENS"], limit: 100, offset: 0) {
uuid
category
chain
id
}
uuid
platform
identity
displayName
}
}
}
}
}`

const relationServiceIdentityQuery = `
Expand Down Expand Up @@ -326,6 +355,7 @@ export class NextIDProofAPI implements NextIDBaseAPI.Proof {
domain: {
owner: {
neighborWithTraversal: NeighborList
nft: NextIDEnsRecord[]
}
} | null
}
Expand All @@ -348,7 +378,7 @@ export class NextIDProofAPI implements NextIDBaseAPI.Proof {
)

if (!data.domain) return EMPTY_LIST
const bindings = createBindProofsFromNeighbor(data.domain.owner.neighborWithTraversal, [])
const bindings = createBindProofsFromNeighbor(data.domain.owner.neighborWithTraversal, data.domain.owner.nft)
return uniqWith(bindings, (a, b) => a.identity === b.identity && a.platform === b.platform).filter(
(x) => ![NextIDPlatform.Ethereum, NextIDPlatform.NextID].includes(x.platform) && x.identity,
)
Expand Down Expand Up @@ -412,7 +442,14 @@ export class NextIDProofAPI implements NextIDBaseAPI.Proof {
{ enableSquash: true },
)

const bindings = createBindProofsFromNeighbor(data.identity.neighborWithTraversal, data.identity.nft)
const nft = uniqBy(
data.identity.neighborWithTraversal
.flatMap((x) => x.from.nft)
.concat(data.identity.neighborWithTraversal.flatMap((x) => x.from.nft)),
(x) => x.uuid,
)

const bindings = createBindProofsFromNeighbor(data.identity.neighborWithTraversal, nft)

return uniqWith(bindings, (a, b) => a.identity === b.identity && a.platform === b.platform).filter(
(x) => ![NextIDPlatform.Ethereum, NextIDPlatform.NextID].includes(x.platform) && x.identity,
Expand Down
18 changes: 9 additions & 9 deletions packages/web3-providers/src/SimpleHash/apis/EVM.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import urlcat from 'urlcat'
import { compact, uniqBy } from 'lodash-es'
import { compact } from 'lodash-es'
import { MaskIconURLs } from '@masknet/icons'
import {
EMPTY_LIST,
Expand Down Expand Up @@ -42,7 +42,7 @@ import {
resolveEventType,
resolveSimpleHashRange,
checkBlurToken,
checkLensFollower,
isLensFollower,
} from '../helpers.js'
import {
type Asset,
Expand Down Expand Up @@ -287,16 +287,16 @@ export class SimpleHashAPI_EVM implements NonFungibleTokenAPI.Provider<ChainId,

const response = await fetchFromSimpleHash<{ collections: Collection[] }>(path)

const filteredCollections = uniqBy(response.collections, (x) => x.top_contracts?.[0])
const filteredCollections = response.collections
// Might got bad data responded including id field and other fields empty
.filter(
(x) =>
x?.id &&
.filter((x) => {
if (!x?.id || x.spam_score === 100) return false
return (
isValidChainId(resolveChainId(x.chain)) &&
x.spam_score !== 100 &&
x.top_contracts.length > 0 &&
(!checkLensFollower(x.name ?? '') || !isERC712Only),
)
(!isLensFollower(x.name) || !isERC712Only)
)
})

let erc721CollectionIdList: string[] = EMPTY_LIST

Expand Down
19 changes: 11 additions & 8 deletions packages/web3-providers/src/SimpleHash/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isEmpty, memoize } from 'lodash-es'
import { unreachable } from '@masknet/kit'
import {
SourceType,
TokenType,
Expand All @@ -8,15 +10,13 @@ import {
import { ChainId, SchemaType, WNATIVE, chainResolver, isValidChainId, resolveImageURL } from '@masknet/web3-shared-evm'
import { ChainId as SolanaChainId } from '@masknet/web3-shared-solana'
import { ChainId as FlowChainId } from '@masknet/web3-shared-flow'
import { isEmpty } from 'lodash-es'
import { createPermalink } from '../NFTScan/helpers/EVM.js'
import { fetchJSON, getAssetFullName } from '../entry-helpers.js'
import { ETH_BLUR_TOKEN_ADDRESS, SIMPLE_HASH_URL } from './constants.js'
import { ActivityType as ActivityTypeSimpleHash, type Asset, type Collection } from './type.js'
import { NetworkPluginID, createLookupTableResolver, queryClient } from '@masknet/shared-base'
import type { Web3Helper } from '@masknet/web3-helpers'
import { TrendingAPI } from '../entry-types.js'
import { unreachable } from '@masknet/kit'
import { fetchJSON, getAssetFullName } from '../entry-helpers.js'
import { ETH_BLUR_TOKEN_ADDRESS, SIMPLE_HASH_URL } from './constants.js'
import { ActivityType as ActivityTypeSimpleHash, type Asset, type Collection } from './type.js'

export async function fetchFromSimpleHash<T>(path: string, init?: RequestInit) {
return queryClient.fetchQuery<T>({
Expand Down Expand Up @@ -132,7 +132,9 @@ export function createNonFungibleCollection(collection: Collection): NonFungible
}
}

export function resolveChainId(chain: string): ChainId | undefined {
export const resolveChainId: (chainId: string) => ChainId | undefined = memoize(function resolveChainId(
chain: string,
): ChainId | undefined {
// Some of the `chainResolver.chainId()` results do not match.
switch (chain) {
case 'ethereum':
Expand All @@ -152,7 +154,7 @@ export function resolveChainId(chain: string): ChainId | undefined {
default:
return undefined
}
}
})

const ChainNameMap: Record<NetworkPluginID, Record<number, string>> = {
[NetworkPluginID.PLUGIN_EVM]: {
Expand Down Expand Up @@ -184,7 +186,8 @@ export function checkBlurToken(pluginId: NetworkPluginID, chainId: Web3Helper.Ch
return `${resolveChain(pluginId, chainId)}.${address.toLowerCase()}` === `ethereum.${ETH_BLUR_TOKEN_ADDRESS}`
}

export function checkLensFollower(name: string) {
export function isLensFollower(name: string) {
if (!name) return false
return name.endsWith('.lens-Follower')
}

Expand Down

0 comments on commit 9cb401b

Please sign in to comment.