Skip to content

Commit

Permalink
Merge branch 'x' into fix-desktop-build-failed
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming committed Feb 13, 2025
2 parents 5875156 + d56305a commit 0c7e0b9
Show file tree
Hide file tree
Showing 114 changed files with 834 additions and 665 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ assignees: ''
Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.**

- [ ] I checked to make sure that this issue has not already been filed
- [ ] I've asked for help in the [OneKey Discord](https://discord.com/invite/onekey) before filing this issue.

**Describe the bug**
A clear and concise description of what the bug is.
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ A clear and concise description of any alternative solutions or features you've
**Community & Quick support**

- [Community Forum](https://github.com/orgs/OneKeyHQ/discussions). Best for: help with building, discussion about best practices.
- [Discord](https://discord.gg/onekey). Best for: sharing your ideas and hanging out with the community.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[![Last commit](https://img.shields.io/github/last-commit/OneKeyHQ/app-monorepo.svg?style=for-the-badge&labelColor=000)](https://github.com/OneKeyHQ/app-monorepo/commits/onekey)
[![Issues](https://img.shields.io/github/issues-raw/OneKeyHQ/app-monorepo.svg?style=for-the-badge&labelColor=000)](https://github.com/OneKeyHQ/app-monorepo/issues?q=is%3Aissue+is%3Aopen)
[![Pull Requests](https://img.shields.io/github/issues-pr-raw/OneKeyHQ/app-monorepo.svg?style=for-the-badge&labelColor=000)](https://github.com/OneKeyHQ/app-monorepo/pulls?q=is%3Apr+is%3Aopen)
[![Discord](https://img.shields.io/discord/868309113942196295?style=for-the-badge&labelColor=000)](https://discord.gg/onekey)
[![Twitter Follow](https://img.shields.io/twitter/follow/OneKeyHQ?style=for-the-badge&labelColor=000)](https://twitter.com/OneKeyHQ)


Expand All @@ -33,7 +32,6 @@

- [Community Forum](https://github.com/orgs/OneKeyHQ/discussions). Best for: help with building, discussion about best practices.
- [GitHub Issues](https://github.com/OneKeyHQ/app-monorepo/issues). Best for: bugs and errors you encounter using OneKey.
- [Discord](https://discord.gg/onekey). Best for: sharing your ideas and hanging out with the community.

## Repo Status

Expand Down
2 changes: 0 additions & 2 deletions apps/mobile/ios/OneKeyWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/RevenueCat/RevenueCat.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/RevenueCatUI/RevenueCat_RevenueCatUI.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/Sentry/Sentry.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
);
Expand All @@ -444,7 +443,6 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RevenueCat.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RevenueCat_RevenueCatUI.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Sentry.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
);
Expand Down
226 changes: 105 additions & 121 deletions apps/mobile/ios/Podfile.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
"react-native-passkeys": "^0.3.0",
"react-native-permissions": "^4.1.5",
"react-native-purchases": "^8.5.0",
"react-native-purchases-ui": "^8.5.0",
"react-native-qrcode-styled": "^0.3.3",
"react-native-randombytes": "^3.6.1",
"react-native-reanimated": "3.6.1",
Expand Down
1 change: 0 additions & 1 deletion docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.**

- [ ] I checked to make sure that this issue has not already been filed
- [ ] I've asked for help in the [OneKey Discord](https://discord.com/invite/onekey) before filing this issue.

## Summary
<!--- Concise overview of the issue. -->
Expand Down
42 changes: 38 additions & 4 deletions packages/kit-bg/src/dbs/local/LocalDbBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,23 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
});
}

async updateWalletsHash(walletsHashMap: { [walletId: string]: string }) {
await this.withTransaction(async (tx) => {
await this.txUpdateRecords({
tx,
name: ELocalDBStoreNames.Wallet,
ids: Object.keys(walletsHashMap),
updater(item) {
const newHash = walletsHashMap[item.id];
if (!isNil(newHash)) {
item.hash = newHash;
}
return item;
},
});
});
}

async updateIndexedAccountOrder({
indexedAccountId,
order,
Expand Down Expand Up @@ -1199,9 +1216,11 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
async buildCreateHDAndHWWalletResult({
walletId,
addedHdAccountIndex,
isOverrideWallet,
}: {
walletId: string;
addedHdAccountIndex: number;
isOverrideWallet?: boolean;
}) {
const dbWallet = await this.getWallet({
walletId,
Expand All @@ -1228,6 +1247,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
wallet: dbWallet,
indexedAccount: dbIndexedAccount,
device: dbDevice,
isOverrideWallet,
};
}

Expand Down Expand Up @@ -1255,7 +1275,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
id: walletId,
name: walletName,
hash: walletHash || undefined,
avatar: avatar && JSON.stringify(avatar), // TODO save object to realmDB?
avatar: avatar ? JSON.stringify(avatar) : undefined, // TODO save object to realmDB?
type: WALLET_TYPE_HD,
backuped,
nextIds: {
Expand Down Expand Up @@ -1736,6 +1756,13 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
const { dbDeviceId, dbWalletId, deviceUUID, rawDeviceId } =
await this.buildHwWalletId(params);

const existingWallet = await this.getWalletSafe({
walletId: dbWalletId,
});
const isExistingHiddenWallet = accountUtils.isHwHiddenWallet({
wallet: existingWallet,
});

let parentWalletId: string | undefined;
const deviceName = await deviceUtils.buildDeviceName({ device, features });
let walletName = name || deviceName;
Expand Down Expand Up @@ -1881,6 +1908,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
return this.buildCreateHDAndHWWalletResult({
walletId: dbWalletId,
addedHdAccountIndex,
isOverrideWallet: existingWallet && !isExistingHiddenWallet,
});
}

Expand Down Expand Up @@ -2273,7 +2301,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
account,
}: {
networkId: string;
account: INetworkAccount;
account: INetworkAccount; // TODO support accounts array
}) {
const accountId = account.id;
const { indexedAccountId, address, addressDetail, type } = account;
Expand Down Expand Up @@ -2373,7 +2401,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
importedCredential?: ICoreImportedCredentialEncryptHex | undefined;
// accountNameBuilder for watching, imported, external account
accountNameBuilder?: (data: { nextAccountId: number }) => string;
}): Promise<void> {
}): Promise<{ isOverrideAccounts: boolean }> {
this.validateAccountsFields(accounts);

const wallet = await this.getWallet({ walletId });
Expand All @@ -2383,7 +2411,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
defaultValue: 1,
});

await this.withTransaction(async (tx) => {
const addResults = await this.withTransaction(async (tx) => {
const firstAccount: IDBAccount | undefined = accounts?.[0];
if (
firstAccount &&
Expand Down Expand Up @@ -2535,6 +2563,11 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
});
}

const isOverrideAccounts = removed > 0 && actualAdded === 0;

return {
isOverrideAccounts,
};
// TODO should add accountId to wallet.accounts or wallet.indexedAccounts?
});

Expand All @@ -2555,6 +2588,7 @@ export abstract class LocalDbBase extends LocalDbBaseContainer {
walletId,
accounts,
});
return addResults;
}

async saveTonImportedAccountMnemonic({
Expand Down
3 changes: 3 additions & 0 deletions packages/kit-bg/src/dbs/simple/base/SimpleDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SimpleDbEntityAccountValue } from '../entity/SimpleDbEntityAccountValue
import { SimpleDbEntityAddressBook } from '../entity/SimpleDbEntityAddressBook';
import { SimpleDbEntityAllNetworks } from '../entity/SimpleDbEntityAllNetworks';
import { SimpleDbEntityAppCleanup } from '../entity/SimpleDbEntityAppCleanup';
import { SimpleDbEntityAppStatus } from '../entity/SimpleDbEntityAppStatus';
import { SimpleDbEntityBabylonSync } from '../entity/SimpleDbEntityBabylonSync';
import { SimpleDbEntityBrowserBookmarks } from '../entity/SimpleDbEntityBrowserBookmarks';
import { SimpleDbEntityBrowserClosedTabs } from '../entity/SimpleDbEntityBrowserClosedTabs';
Expand Down Expand Up @@ -109,5 +110,7 @@ export class SimpleDb {

babylonSync = new SimpleDbEntityBabylonSync();

appStatus = new SimpleDbEntityAppStatus();

allNetworks = new SimpleDbEntityAllNetworks();
}
3 changes: 3 additions & 0 deletions packages/kit-bg/src/dbs/simple/base/SimpleDbProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { SimpleDbEntityAccountValue } from '../entity/SimpleDbEntityAccount
import type { SimpleDbEntityAddressBook } from '../entity/SimpleDbEntityAddressBook';
import type { SimpleDbEntityAllNetworks } from '../entity/SimpleDbEntityAllNetworks';
import type { SimpleDbEntityAppCleanup } from '../entity/SimpleDbEntityAppCleanup';
import type { SimpleDbEntityAppStatus } from '../entity/SimpleDbEntityAppStatus';
import type { SimpleDbEntityBabylonSync } from '../entity/SimpleDbEntityBabylonSync';
import type { SimpleDbEntityBrowserBookmarks } from '../entity/SimpleDbEntityBrowserBookmarks';
import type { SimpleDbEntityBrowserClosedTabs } from '../entity/SimpleDbEntityBrowserClosedTabs';
Expand Down Expand Up @@ -190,6 +191,8 @@ export class SimpleDbProxy
'babylonSync',
) as SimpleDbEntityBabylonSync;

appStatus = this._createProxyService('appStatus') as SimpleDbEntityAppStatus;

allNetworks = this._createProxyService(
'allNetworks',
) as SimpleDbEntityAllNetworks;
Expand Down
11 changes: 11 additions & 0 deletions packages/kit-bg/src/dbs/simple/entity/SimpleDbEntityAppStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { SimpleDbEntityBase } from '../base/SimpleDbEntityBase';

export interface ISimpleDBAppStatus {
hdWalletHashGenerated?: boolean;
}

export class SimpleDbEntityAppStatus extends SimpleDbEntityBase<ISimpleDBAppStatus> {
entityName = 'appStatus';

override enableCache = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1625,13 +1625,7 @@ export class V4MigrationForAccount extends V4MigrationManagerBase {
name: v4wallet.name,
mnemonic: await servicePassword.encodeSensitiveText({
text: mnemonic,
}),
walletHashBuilder: () => {
const text = `${mnemonic}--4863FBE1-7B9B-4006-91D0-24212CCCC375--${v4wallet.id}`;
const buff = sha256(bufferUtils.toBuffer(text, 'utf8'));
const walletHash = bufferUtils.bytesToHex(buff);
return walletHash;
},
})
});
v5dbWallet = v5walletSaved;
}
Expand Down
Loading

0 comments on commit 0c7e0b9

Please sign in to comment.