Skip to content

Commit

Permalink
Merge branch 'develop' into feat/moonbean-network
Browse files Browse the repository at this point in the history
  • Loading branch information
developerfred authored May 20, 2022
2 parents fdc5403 + 83a6130 commit 7f9452d
Show file tree
Hide file tree
Showing 360 changed files with 7,380 additions and 4,608 deletions.
12 changes: 12 additions & 0 deletions .i18n-codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@
"trans": "Translate",
"sourceMap": "inline"
}
},
{
"input": "./packages/mask/src/plugins/Avatar/locales/en-US.json",
"output": "./packages/mask/src/plugins/Avatar/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.avatar",
"trans": "Translate",
"sourceMap": "inline"
}
}
]
}
4 changes: 3 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"multicall",
"multihop",
"newsfeed",
"nftavatar",
"nftrss",
"nftscan",
"nums",
Expand Down Expand Up @@ -227,7 +228,7 @@
"aicanft",
"algr",
"anft",
"avator",
"armv",
"blocto",
"bsct",
"btcb",
Expand Down Expand Up @@ -286,6 +287,7 @@
"nrge",
"nrgt",
"nyfi",
"okex",
"openocean",
"pausable",
"pkts",
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mask-network",
"packageManager": "pnpm@7.0.0",
"packageManager": "pnpm@7.1.1",
"engines": {
"node": ">=17.0.0",
"pnpm": ">=7.0.0",
Expand Down Expand Up @@ -33,16 +33,16 @@
"@emotion/serialize": "^1.0.3",
"@emotion/styled": "^11.8.1",
"@emotion/utils": "^1.1.0",
"@mui/icons-material": "5.6.2",
"@mui/lab": "5.0.0-alpha.80",
"@mui/material": "5.6.4",
"@mui/system": "5.6.4",
"@mui/icons-material": "5.8.0",
"@mui/lab": "5.0.0-alpha.82",
"@mui/material": "5.8.0",
"@mui/system": "5.8.0",
"@solana/web3.js": "1.39.1",
"@types/masknet__global-types": "workspace:*",
"@types/react": "18.0.8",
"@types/react-dom": "^18.0.3",
"@types/web": "^0.0.64",
"i18next": "^21.7.1",
"@types/react-dom": "^18.0.4",
"@types/web": "^0.0.66",
"i18next": "^21.8.2",
"immer": "9.0.12",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
Expand All @@ -56,9 +56,9 @@
"web3-core-method": "1.7.3"
},
"devDependencies": {
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@dimensiondev/eslint-plugin": "^0.0.2-20220414093950-7d54c58",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@dimensiondev/eslint-plugin": "0.0.2-20220516081411-2649814",
"@dimensiondev/patch-package": "^6.5.0",
"@jest/globals": "^28.1.0",
"@magic-works/i18n-codegen": "^0.1.0",
Expand All @@ -67,28 +67,28 @@
"@nice-labs/git-rev": "^3.5.0",
"@swc/core": "^1.2.177",
"@types/lodash-es": "^4.17.6",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/experimental-utils": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"cspell": "^5.20.0",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/experimental-utils": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"cspell": "^5.21.0",
"eslint": "8.15.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.5.0",
"eslint-plugin-unicorn": "^42.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"gulp": "^4.0.2",
"husky": "^7.0.4",
"husky": "^8.0.1",
"jest": "^28.1.0",
"lint-staged": "^12.4.1",
"prettier": "^2.6.2",
"ts-jest": "^28.0.1",
"ts-jest": "^28.0.2",
"ts-node": "^10.7.0",
"typescript": "4.7.0-beta"
},
"pnpm": {
"overrides": {
"@types/node": "^17.0.31",
"@types/node": "^17.0.34",
"@types/react": "18.0.9",
"@solana/web3.js": "1.39.1"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-useless-concat": "error",
"no-useless-rename": "error",
"no-useless-catch": "error",
"no-loss-of-precision": "error",
"prefer-regex-literals": "error",
"react/jsx-boolean-value": "error",
Expand All @@ -59,6 +61,7 @@
"unicorn/no-new-buffer": "error",
"unicorn/no-thenable": "error",
"unicorn/no-useless-promise-resolve-reject": "error",
"unicorn/no-array-reduce": ["error", { "allowSimpleOperations": false }],
"unicorn/prefer-add-event-listener": "error",
"unicorn/prefer-date-now": "error",
"unicorn/prefer-dom-node-dataset": "error",
Expand All @@ -70,6 +73,7 @@
"@dimensiondev/browser/prefer-location-assign": "error",
"@dimensiondev/jsx/no-class-component": "error",
"@dimensiondev/jsx/no-template-literal": "error",
"@dimensiondev/no-for-in": "error",
"@dimensiondev/no-number-constructor": "off",
"@dimensiondev/prefer-early-return": "error",
"@dimensiondev/string/no-interpolation": "off",
Expand All @@ -79,9 +83,9 @@
"@dimensiondev/type/no-instanceof-wrapper": "error",
"@dimensiondev/type/no-wrapper-type-reference": "error",
"@dimensiondev/unicode/specific-set": "error",
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-invalid-this": "error",
Expand Down
3 changes: 2 additions & 1 deletion packages/backup-format/src/utils/backupPreview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { NormalizedBackup } from '@masknet/backup-format'
import { sumBy } from 'lodash-unified'

export interface BackupPreview {
personas: number
Expand All @@ -20,7 +21,7 @@ export function getBackupPreviewInfo(json: NormalizedBackup.Data): BackupPreview

return {
personas: json.personas.size,
accounts: [...json.personas.values()].reduce((a, b) => a + b.linkedProfiles.size, 0),
accounts: sumBy([...json.personas.values()], (persona) => persona.linkedProfiles.size),
posts: json.posts.size,
contacts: json.profiles.size,
relations: json.relations.length,
Expand Down
6 changes: 4 additions & 2 deletions packages/backup-format/src/utils/hex2buffer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { sum } from 'lodash-unified'

/** @internal */
export function hex2buffer(hexString: string, padded?: boolean) {
if (hexString.length % 2) {
Expand All @@ -20,8 +22,8 @@ export function hex2buffer(hexString: string, padded?: boolean) {
}

/** @internal */
function concat(...buf: (Uint8Array | number[])[]) {
const res = new Uint8Array(buf.map((item) => item.length).reduce((prev, cur) => prev + cur))
function concat(...buf: Array<Uint8Array | number[]>) {
const res = new Uint8Array(sum(buf.map((item) => item.length)))
let offset = 0
buf.forEach((item) => {
for (let i = 0; i < item.length; i += 1) {
Expand Down
6 changes: 3 additions & 3 deletions packages/backup-format/src/version-1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ interface BackupJSONFileVersion1 {
publicKey: EC_Public_JsonWebKey
privateKey: EC_Private_JsonWebKey
localKey: AESJsonWebKey
previousIdentifiers?: { network: string; userId: string }[]
previousIdentifiers?: Array<{ network: string; userId: string }>
nickname?: string
}>
people?: Array<{
network: string
userId: string
publicKey: EC_Public_JsonWebKey
previousIdentifiers?: { network: string; userId: string }[]
previousIdentifiers?: Array<{ network: string; userId: string }>
nickname?: string
groups?: { network: string; groupID: string; virtualGroupOwner: string | null }[]
groups?: Array<{ network: string; groupID: string; virtualGroupOwner: string | null }>

// Note: those props are not existed in the backup, just to make the code more readable
privateKey?: EC_Private_JsonWebKey
Expand Down
4 changes: 2 additions & 2 deletions packages/backup-format/src/version-2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ interface BackupJSONFileVersion2 {
privateKey?: JsonWebKey
localKey?: JsonWebKey
nickname?: string
linkedProfiles: [/** ProfileIdentifier.toText() */ string, LinkedProfileDetails][]
linkedProfiles: Array<[/** ProfileIdentifier.toText() */ string, LinkedProfileDetails]>
createdAt: number // Unix timestamp
updatedAt: number // Unix timestamp
}>
Expand All @@ -345,7 +345,7 @@ interface BackupJSONFileVersion2 {
postBy: string // ProfileIdentifier.toText()
identifier: string // PostIVIdentifier.toText()
postCryptoKey?: JsonWebKey
recipients: 'everyone' | [/** ProfileIdentifier.toText() */ string, { reason: RecipientReasonJSON[] }][]
recipients: 'everyone' | Array<[/** ProfileIdentifier.toText() */ string, { reason: RecipientReasonJSON[] }]>
/** @deprecated */
recipientGroups: never[]
foundAt: number // Unix timestamp
Expand Down
14 changes: 7 additions & 7 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@dimensiondev/holoflows-kit": "^0.9.0-20210902104757-7c3d0d0",
"@hookform/resolvers": "^2.8.8",
"@hookform/resolvers": "^2.8.10",
"@masknet/backup-format": "workspace:*",
"@masknet/icons": "workspace:*",
"@masknet/plugin-example": "workspace:*",
Expand Down Expand Up @@ -43,13 +43,13 @@
"date-fns": "2.28.0",
"html-to-image": "^1.9.0",
"json-stable-stringify": "^1.0.1",
"react-avatar-editor": "^12.0.0",
"react-avatar-editor": "^13.0.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-hook-form": "^7.30.0",
"react-hook-form": "^7.31.1",
"react-qrcode-logo": "^2.7.0",
"react-router-dom": "^6.3.0",
"react-to-print": "^2.14.6",
"react-to-print": "^2.14.7",
"react-use": "^17.3.2",
"unstated-next": "^1.1.0",
"urlcat": "^2.0.4",
Expand All @@ -58,10 +58,10 @@
"wallet.ts": "^1.0.1",
"web3-core-helpers": "1.7.3",
"web3-utils": "1.7.3",
"zod": "^3.14.4"
"zod": "^3.16.0"
},
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/core": "^7.17.12",
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
Expand All @@ -71,6 +71,6 @@
"@types/use-subscription": "^1.0.0",
"@types/uuid": "^8.3.4",
"babel-loader": "^8.2.5",
"webpack": "^5.72.0"
"webpack": "^5.72.1"
}
}
4 changes: 2 additions & 2 deletions packages/dashboard/src/components/CreateWalletForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ const useStyles = makeStyles()((theme) => ({

// TODO: actions, and icon may be an img url
export interface CreateWalletFormProps {
options: {
options: Array<{
label: string
icon: React.ReactNode
value: number
}[]
}>
}

export function CreateWalletForm(props: CreateWalletFormProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const FeaturePromotions = memo(() => {
<div className={classes.container}>
<img
className={classes.img}
onClick={openTwitter(PluginId.RedPacket)}
onClick={() => openTwitter(PluginId.RedPacket)}
src={new URL('./SendLuckyDrop.png', import.meta.url).toString()}
/>
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const RestoreFromCloud = memo(() => {
)}
</Step>
<Step name="restore">
{(_, { backupJson: backupBasicInfoJson, handleRestore: handleRestore }) => (
{(_, { backupJson: backupBasicInfoJson, handleRestore }) => (
<>
<Box sx={{ width: '100%' }}>
<BackupPreviewCard json={backupBasicInfoJson} />
Expand Down
3 changes: 1 addition & 2 deletions packages/dashboard/src/initialization/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export default function DashboardRoot() {
const pluginID = usePluginID()
const PluginsWeb3State = useAllPluginsWeb3State()

// TODO:
// migrate EVM plugin
// TODO: migrate EVM plugin
fixWeb3State(PluginsWeb3State[NetworkPluginID.PLUGIN_EVM], Web3Context)

// #region theme
Expand Down
1 change: 1 addition & 0 deletions packages/dashboard/src/locales/qya-AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"wallets_empty_tokens_tip": "crwdns1789:0crwdne1789:0",
"wallets_empty_collectible_tip": "crwdns1791:0crwdne1791:0",
"wallets_address_copied": "crwdns1793:0crwdne1793:0",
"public_key_copied": "crwdns16574:0crwdne16574:0",
"wallets_address_copy": "crwdns1795:0crwdne1795:0",
"wallets_history_types": "crwdns1797:0crwdne1797:0",
"wallets_history_value": "crwdns1799:0crwdne1799:0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const ContactTableRowUI = memo<ContactTableRowUIProps>(
{/* To support emoji */}
{String.fromCodePoint(
first.codePointAt(0) ?? SPACE_POINT,
last.codePointAt(0) ?? SPACE_POINT,
last?.codePointAt(0) ?? SPACE_POINT,
)}
</Avatar>
{contact.fingerprint ? <MaskBlueIcon className={classes.maskIcon} /> : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ export const Balance = memo<BalanceCardProps>(
</Box>
{showOperations && (
<ButtonGroup>
<Button size="small" onClick={onSend} endIcon={<SendIcon fontSize="inherit" />}>
<Button
size="small"
onClick={onSend}
endIcon={<SendIcon style={{ fill: '#fff' }} fontSize="inherit" />}>
{t.wallets_balance_Send()}
</Button>
<Button size="small" onClick={onBuy} endIcon={<CardIcon fill="none" fontSize="inherit" />}>
<Button size="small" onClick={onBuy} endIcon={<CardIcon fontSize="inherit" />}>
{t.wallets_balance_Buy()}
</Button>
<Button size="small" onClick={onSwap} endIcon={<SwapIcon fontSize="inherit" />}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const FungibleTokenTable = memo<TokenTableProps>(({ selectedChainId }) =>
export interface TokenTableUIProps {
isLoading: boolean
isEmpty: boolean
dataSource: Web3Plugin.Asset<Web3Plugin.FungibleToken>[]
dataSource: Array<Web3Plugin.Asset<Web3Plugin.FungibleToken>>
onSwap(token: Web3Plugin.FungibleToken): void
onSend(token: Web3Plugin.FungibleToken): void
}
Expand Down
2 changes: 1 addition & 1 deletion packages/encryption/src/encryption/Decryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function* v38To40StaticECDH(
}
type StaticV38OrOlderECDH = {
type: 'static-v38-or-older'
derive: (postKeyIV: Uint8Array) => Promise<(readonly [key: AESCryptoKey, iv: Uint8Array])[]>
derive: (postKeyIV: Uint8Array) => Promise<Array<readonly [key: AESCryptoKey, iv: Uint8Array]>>
}
type EphemeralECDH = {
type: 'ephemeral'
Expand Down
2 changes: 1 addition & 1 deletion packages/encryption/src/encryption/Encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function e2e_v37(
target: EncryptTargetE2E,
io: EncryptIO,
): Promise<[PayloadWellFormed.EndToEndEncryption, EncryptResult['e2e']]> {
const { authorPublic, postIV: postIV, postKeyEncoded } = context
const { authorPublic, postIV, postKeyEncoded } = context
const authorPublicKey = await authorPublic
if (!authorPublicKey.some) throw new EncryptError(EncryptErrorReasons.PublicKeyNotFound)

Expand Down
2 changes: 1 addition & 1 deletion packages/encryption/src/encryption/v38-ecdh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function deriveAESByECDH_version38OrOlderExtraSteps(
deriveAESByECDH: (key: EC_Public_CryptoKey) => Promise<AESCryptoKey[]>,
pub: EC_Public_CryptoKey,
iv: Uint8Array,
): Promise<(readonly [key: AESCryptoKey, iv: Uint8Array])[]> {
): Promise<Array<readonly [key: AESCryptoKey, iv: Uint8Array]>> {
const deriveResult = await deriveAESByECDH(pub)
const extraSteps = deriveResult.map(async (key) => {
const derivedKeyRaw = await crypto.subtle.exportKey('raw', key)
Expand Down
1 change: 1 addition & 0 deletions packages/gun-utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EventIterator } from 'event-iterator'
import { getGunInstance, OnCloseEvent } from './instance'

function getGunNodeFromPath(path: string[]) {
// eslint-disable-next-line unicorn/no-array-reduce
const resultNode = path.reduce((gun, path) => gun.get(path as never), getGunInstance())
return resultNode
}
Expand Down
Loading

0 comments on commit 7f9452d

Please sign in to comment.