Skip to content

Commit

Permalink
Merge branch 'feat/up' into tmp/20241220
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Dec 18, 2024
2 parents 218623e + 48d7e4d commit 9fef7a7
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/dist/index.js b/dist/index.js
index fd317674caba8bba044ea5fd24c8a67fad859ad8..799ca9a154f06d558383e9f2537216d33d418f17 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2371,8 +2371,7 @@ __export(eth_hd_keyring_exports, {
module.exports = __toCommonJS(eth_hd_keyring_exports);
var import_hdkey = require("ethereum-cryptography/hdkey");
var import_eth_simple_keyring = __toESM(require("@rabby-wallet/eth-simple-keyring"));
-var bip39 = __toESM(require("@scure/bip39"));
-var import_english = require("@scure/bip39/wordlists/english");
+var bip39 = __toESM(require("react-native-quick-bip39"));
var sigUtil = __toESM(require("eth-sig-util"));
var import_util = require("@ethereumjs/util");
var import_slip39 = __toESM(require_slip392());
@@ -2469,7 +2468,7 @@ var _HdKeyring = class _HdKeyring extends import_eth_simple_keyring.default {
}
addAccounts(numberOfAccounts = 1) {
if (!this.hdWallet) {
- this.initFromMnemonic(bip39.generateMnemonic(import_english.wordlist));
+ this.initFromMnemonic(bip39.generateMnemonic());
}
let count = numberOfAccounts;
let currentIdx = 0;
@@ -2612,7 +2611,7 @@ var _HdKeyring = class _HdKeyring extends import_eth_simple_keyring.default {
return (0, import_util.bytesToHex)((0, import_util.publicToAddress)(publicKey, true)).toLowerCase();
}
generateMnemonic() {
- return bip39.generateMnemonic(import_english.wordlist);
+ return bip39.generateMnemonic();
}
setHdPath(hdPath = HD_PATH_BASE["BIP44" /* BIP44 */]) {
this.hdPath = hdPath;
@@ -2690,7 +2689,7 @@ var _HdKeyring = class _HdKeyring extends import_eth_simple_keyring.default {
if (this.checkMnemonicIsSlip39(mnemonic)) {
return true;
}
- return bip39.validateMnemonic(mnemonic, import_english.wordlist);
+ return bip39.validateMnemonic(mnemonic, bip39.wordlists.english);
}
};
_HdKeyring.type = type;
2 changes: 1 addition & 1 deletion apps/mobile/android/link-assets-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"path": "assets/custom/InpageBridgeWeb3.js",
"sha1": "7488a411403159ead535e585a76bf5da4dac79c1"
"sha1": "d3bd4ca5ffb5ac158be3e14858e683c17c9ce3bd"
},
{
"path": "assets/custom/vconsole.min.js",
Expand Down
12 changes: 12 additions & 0 deletions apps/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ PODS:
- nanopb/encode (= 2.30909.1)
- nanopb/decode (2.30909.1)
- nanopb/encode (2.30909.1)
- OpenSSL-Universal (3.3.2000)
- PromisesObjC (2.3.1)
- RCT-Folly (2021.07.22.00):
- boost
Expand Down Expand Up @@ -464,6 +465,11 @@ PODS:
- react-native-pager-view (6.2.3):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-quick-crypto (0.7.10):
- OpenSSL-Universal
- RCT-Folly (= 2021.07.22.00)
- React
- React-Core
- react-native-randombytes (3.6.1):
- React-Core
- react-native-safe-area-context (4.8.2):
Expand Down Expand Up @@ -703,6 +709,7 @@ DEPENDENCIES:
- react-native-mmkv (from `../node_modules/react-native-mmkv`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-pager-view (from `../node_modules/react-native-pager-view`)
- react-native-quick-crypto (from `../node_modules/react-native-quick-crypto`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
Expand Down Expand Up @@ -771,6 +778,7 @@ SPEC REPOS:
- MMKVCore
- MultiplatformBleAdapter
- nanopb
- OpenSSL-Universal
- PromisesObjC
- SDWebImage
- SDWebImageWebPCoder
Expand Down Expand Up @@ -849,6 +857,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/netinfo"
react-native-pager-view:
:path: "../node_modules/react-native-pager-view"
react-native-quick-crypto:
:path: "../node_modules/react-native-quick-crypto"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-safe-area-context:
Expand Down Expand Up @@ -970,6 +980,7 @@ SPEC CHECKSUMS:
MMKVCore: 9e2e5fd529b64a9fe15f1a7afb3d73b2e27b4db9
MultiplatformBleAdapter: b1fddd0d499b96b607e00f0faa8e60648343dc1d
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
OpenSSL-Universal: b60a3702c9fea8b3145549d421fdb018e53ab7b4
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 83bca1c184feb4d2e51c72c8369b83d641443f95
Expand Down Expand Up @@ -998,6 +1009,7 @@ SPEC CHECKSUMS:
react-native-mmkv: 436ee510dcc43b58a49d7be0451f285e06a9fd1d
react-native-netinfo: 8a7fd3f7130ef4ad2fb4276d5c9f8d3f28d2df3d
react-native-pager-view: cf96a223846458cc7e932017636b5c6d8cc2c549
react-native-quick-crypto: 64b9662703b8613b41d909fdc85ff79552d21fde
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89
react-native-splash-screen: 4312f786b13a81b5169ef346d76d33bc0c6dc457
Expand Down
8 changes: 4 additions & 4 deletions apps/mobile/ios/RabbyMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* RabbyMobileTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* RabbyMobileTests.m */; };
013F94F32CF58D7B00CD67A4 /* InpageBridgeWeb3.js in Resources */ = {isa = PBXBuildFile; fileRef = 013F94F22CF58D7B00CD67A4 /* InpageBridgeWeb3.js */; };
014102622BF348FE00629679 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 014102612BF348FE00629679 /* PrivacyInfo.xcprivacy */; };
01BBE0162C3879380033D12B /* UIImage+ImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BBE0122C3879380033D12B /* UIImage+ImageEffects.m */; };
01BBE0172C3879380033D12B /* RNScreenshotPrevent.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BBE0132C3879380033D12B /* RNScreenshotPrevent.m */; };
Expand All @@ -23,6 +22,7 @@
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
3FB3928D597B4F3786F9EF3F /* vconsole.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 821CAA7F3D014D818B010EC1 /* vconsole.min.js */; };
422E2D11FE504BBDAB378000 /* InpageBridgeWeb3.js in Resources */ = {isa = PBXBuildFile; fileRef = CA1EB923E7E64222ADF0E902 /* InpageBridgeWeb3.js */; };
5497879220EF4D48850C0543 /* SF-Pro-Rounded-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 48A3C610244545BBA590D079 /* SF-Pro-Rounded-Regular.otf */; };
61119C058F0C8F2FBCC8530A /* Pods_RabbyMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3D14902716EB42CC78905B /* Pods_RabbyMobile.framework */; };
62F658AD5D35470FBE7DF799 /* SF-Pro-Rounded-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 5B9880A4659D4B78872720D4 /* SF-Pro-Rounded-Bold.otf */; };
Expand All @@ -46,7 +46,6 @@
00E356EE1AD99517003FC87E /* RabbyMobileTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RabbyMobileTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* RabbyMobileTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RabbyMobileTests.m; sourceTree = "<group>"; };
013F94F22CF58D7B00CD67A4 /* InpageBridgeWeb3.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = InpageBridgeWeb3.js; path = ../assets/custom/InpageBridgeWeb3.js; sourceTree = "<group>"; };
014102612BF348FE00629679 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
01BBE0122C3879380033D12B /* UIImage+ImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ImageEffects.m"; path = "RabbyMobile/UIImage+ImageEffects.m"; sourceTree = "<group>"; };
01BBE0132C3879380033D12B /* RNScreenshotPrevent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNScreenshotPrevent.m; path = RabbyMobile/RNScreenshotPrevent.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -77,6 +76,7 @@
A4836FAFC22B499AAA2E435D /* SF-Pro-Rounded-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "SF-Pro-Rounded-Medium.otf"; path = "../assets/fonts/SF-Pro-Rounded-Medium.otf"; sourceTree = "<group>"; };
A8D4D12C2C7EFDA1002B827D /* RabbyMobile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = RabbyMobile.entitlements; path = RabbyMobile/RabbyMobile.entitlements; sourceTree = "<group>"; };
ACB2DE2C2B72015F00A5516C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
CA1EB923E7E64222ADF0E902 /* InpageBridgeWeb3.js */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = InpageBridgeWeb3.js; path = ../assets/custom/InpageBridgeWeb3.js; sourceTree = "<group>"; };
CA3D14902716EB42CC78905B /* Pods_RabbyMobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RabbyMobile.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EAEC992AC950B3ACACBDE0F2 /* Pods_RabbyMobile_RabbyMobileTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RabbyMobile_RabbyMobileTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -204,12 +204,12 @@
D0CA49A24C31446D8C53F168 /* Resources */ = {
isa = PBXGroup;
children = (
013F94F22CF58D7B00CD67A4 /* InpageBridgeWeb3.js */,
821CAA7F3D014D818B010EC1 /* vconsole.min.js */,
5B9880A4659D4B78872720D4 /* SF-Pro-Rounded-Bold.otf */,
F13B8F76DB574CA1A0D00501 /* SF-Pro-Rounded-Heavy.otf */,
A4836FAFC22B499AAA2E435D /* SF-Pro-Rounded-Medium.otf */,
48A3C610244545BBA590D079 /* SF-Pro-Rounded-Regular.otf */,
CA1EB923E7E64222ADF0E902 /* InpageBridgeWeb3.js */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -311,7 +311,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
013F94F32CF58D7B00CD67A4 /* InpageBridgeWeb3.js in Resources */,
01E584B62C370990007F3280 /* LaunchScreen.xib in Resources */,
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
014102622BF348FE00629679 /* PrivacyInfo.xcprivacy in Resources */,
Expand All @@ -323,6 +322,7 @@
E576F98C62E44D04A874C8B7 /* SF-Pro-Rounded-Heavy.otf in Resources */,
0FDFDF1FBA404AB3A3E6ECCA /* SF-Pro-Rounded-Medium.otf in Resources */,
5497879220EF4D48850C0543 /* SF-Pro-Rounded-Regular.otf in Resources */,
422E2D11FE504BBDAB378000 /* InpageBridgeWeb3.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
10 changes: 5 additions & 5 deletions apps/mobile/ios/RabbyMobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false />
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>imtokenv2</string>
Expand All @@ -53,15 +53,15 @@
<string>debank</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true />
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true />
<true/>
</dict>
</dict>
</dict>
Expand All @@ -74,7 +74,7 @@
<key>NSFaceIDUsageDescription</key>
<string>$(PRODUCT_NAME) needs to authenticate</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string />
<string/>
<key>NSMicrophoneUsageDescription</key>
<string>Rabby needs microphone access to record audio</string>
<key>UIAppFonts</key>
Expand Down Expand Up @@ -103,7 +103,7 @@
<key>UIUserInterfaceStyle</key>
<string>Automatic</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false />
<false/>
<key>rabbit_code</key>
<string>$(RABBY_MOBILE_CODE)</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/ios/link-assets-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"path": "assets/custom/InpageBridgeWeb3.js",
"sha1": "7488a411403159ead535e585a76bf5da4dac79c1"
"sha1": "d3bd4ca5ffb5ac158be3e14858e683c17c9ce3bd"
},
{
"path": "assets/custom/vconsole.min.js",
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"@rematch/core": "^2.2.0",
"@rneui/base": "^4.0.0-rc.8",
"@rneui/themed": "^4.0.0-rc.8",
"@scure/bip39": "^1.3.0",
"@sentry/react-native": "5.31.0",
"@types/highlight-words-core": "1.2.3",
"@types/lodash.debounce": "^4.0.9",
Expand Down Expand Up @@ -152,6 +151,8 @@
"react-native-pager-view": "^6.2.3",
"react-native-permissions": "^4.1.2",
"react-native-qrcode-svg": "^6.2.0",
"react-native-quick-bip39": "0.0.9",
"react-native-quick-crypto": "0.7.10",
"react-native-randombytes": "^3.6.1",
"react-native-reanimated": "^3.6.1",
"react-native-root-toast": "^3.5.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/core/utils/mnemonic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as bip39 from '@scure/bip39';
import * as bip39 from 'react-native-quick-bip39';
import { HDKey } from 'ethereum-cryptography/hdkey';
import * as sigUtil from 'eth-sig-util';
import { bytesToHex, publicToAddress, privateToPublic } from '@ethereumjs/util';
Expand Down
7 changes: 3 additions & 4 deletions apps/mobile/src/screens/Address/ImportSeedPhraseScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { useScanner } from '../Scanner/ScannerScreen';
import { requestKeyring } from '@/core/apis/keyring';
import { toast } from '@/components/Toast';
import { useFocusEffect } from '@react-navigation/native';
import { wordlist } from '@scure/bip39/wordlists/english';
import * as bip39 from '@scure/bip39';
import * as bip39 from 'react-native-quick-bip39';

const getStyles = (colors: AppColorsVariants) =>
StyleSheet.create({
Expand Down Expand Up @@ -112,13 +111,13 @@ export const ImportSeedPhraseScreen = () => {
});
} else {
try {
bip39.mnemonicToEntropy(mnemonics?.trim(), wordlist);
bip39.mnemonicToEntropy(mnemonics?.trim(), bip39.wordlists.english);
} catch (e) {
if ((e as any).message.includes('Unknown letter:')) {
let errorWords: string[] = [];
mnemonics.split(/\s+/).forEach(word => {
let v = word?.trim();
if (v && !wordlist.includes(v)) {
if (v && !bip39.wordlists.english.includes(v)) {
errorWords.push(v);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { useScanner } from '../Scanner/ScannerScreen';
import { requestKeyring } from '@/core/apis/keyring';
import { toast } from '@/components2024/Toast';
import { useFocusEffect } from '@react-navigation/native';
import { wordlist } from '@scure/bip39/wordlists/english';
import * as bip39 from '@scure/bip39';
import * as bip39 from 'react-native-quick-bip39';
import PasteButton from '@/components2024/PasteButton';
import { NextInput } from '@/components2024/Form/Input';
import { createGetStyles2024, makeDebugBorder } from '@/utils/styles';
Expand Down Expand Up @@ -192,13 +191,13 @@ export const ImportSeedPhraseScreen2024 = () => {
});
} else {
try {
bip39.mnemonicToEntropy(mnemonics?.trim(), wordlist);
bip39.mnemonicToEntropy(mnemonics?.trim(), bip39.wordlists.english);
} catch (e) {
if ((e as any).message.includes('Unknown letter:')) {
let errorWords: string[] = [];
mnemonics.split(/\s+/).forEach(word => {
let v = word?.trim();
if (v && !wordlist.includes(v)) {
if (v && !bip39.wordlists.english.includes(v)) {
errorWords.push(v);
}
});
Expand Down
Loading

0 comments on commit 9fef7a7

Please sign in to comment.