Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wallets/rn_cli_wallet/ios/.xcode.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
## echo export NODE_BINARY=$(command -v node) > .xcode.env.local
## echo export NODE_BINARY=$(command -v node) \\nexport SENTRY_ALLOW_FAILURE=true > .xcode.env.local

# NODE_BINARY variable contains the PATH to the node executable.
#
Expand Down
32 changes: 32 additions & 0 deletions wallets/rn_cli_wallet/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,34 @@ PODS:
- React-Core
- react-native-get-random-values (1.11.0):
- React-Core
- react-native-mmkv (3.3.3):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- react-native-netinfo (11.4.1):
- React-Core
- react-native-quick-base64 (2.2.2):
Expand Down Expand Up @@ -2820,6 +2848,7 @@ DEPENDENCIES:
- "react-native-compat (from `../node_modules/@walletconnect/react-native-compat`)"
- react-native-config (from `../node_modules/react-native-config`)
- react-native-get-random-values (from `../node_modules/react-native-get-random-values`)
- react-native-mmkv (from `../node_modules/react-native-mmkv`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-quick-base64 (from `../node_modules/react-native-quick-base64`)
- react-native-quick-crypto (from `../node_modules/react-native-quick-crypto`)
Expand Down Expand Up @@ -2963,6 +2992,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-config"
react-native-get-random-values:
:path: "../node_modules/react-native-get-random-values"
react-native-mmkv:
:path: "../node_modules/react-native-mmkv"
react-native-netinfo:
:path: "../node_modules/@react-native-community/netinfo"
react-native-quick-base64:
Expand Down Expand Up @@ -3103,6 +3134,7 @@ SPEC CHECKSUMS:
react-native-compat: 3573295702a92c9b13cc0ee3dd47499c5aee0c32
react-native-config: 644074ab88db883fcfaa584f03520ec29589d7df
react-native-get-random-values: d16467cf726c618e9c7a8c3c39c31faa2244bbba
react-native-mmkv: ac7507625cd74bac0eb5333604a7cd7b08fe9e3e
react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187
react-native-quick-base64: 6568199bb2ac8e72ecdfdc73a230fbc5c1d3aac4
react-native-quick-crypto: dac9db2adb0a61b4881909b6db7c51eaaada66a8
Expand Down
40 changes: 6 additions & 34 deletions wallets/rn_cli_wallet/ios/RNWeb3Wallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
1F4795A12E9D5C1200B52C86 /*
Upload Debug Symbols to Sentry */,
1F4795A12E9D5C1200B52C86 /* Upload Debug Symbols to Sentry */,
330B5F4BDC32F3AF53024071 /* [CP] Embed Pods Frameworks */,
42B98FB2BE62A040A5D168B5 /* [CP] Copy Pods Resources */,
);
Expand All @@ -202,8 +201,7 @@ Upload Debug Symbols to Sentry */,
1FCDA2922B9B8E6200E0BF0C /* Frameworks */,
1FCDA2942B9B8E6200E0BF0C /* Resources */,
1FCDA29A2B9B8E6200E0BF0C /* Bundle React Native code and images */,
1F4795A02E9D5BFE00B52C86 /*
Upload Debug Symbols to Sentry */,
1F4795A02E9D5BFE00B52C86 /* Upload Debug Symbols to Sentry */,
210BFE96CABEC2224D5DEA2E /* [CP] Embed Pods Frameworks */,
1F19C9ADE7D476C9B83CC003 /* [CP] Copy Pods Resources */,
);
Expand Down Expand Up @@ -340,14 +338,10 @@ Upload Debug Symbols to Sentry */,
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-resources.sh\"\n";
Expand All @@ -367,8 +361,7 @@ Upload Debug Symbols to Sentry */,
shellPath = /bin/sh;
shellScript = "/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh\n";
};
1F4795A02E9D5BFE00B52C86 /*
Upload Debug Symbols to Sentry */ = {
1F4795A02E9D5BFE00B52C86 /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -377,7 +370,7 @@ Upload Debug Symbols to Sentry */ = {
);
inputPaths = (
);
name = "\nUpload Debug Symbols to Sentry";
name = "Upload Debug Symbols to Sentry";
outputFileListPaths = (
);
outputPaths = (
Expand All @@ -386,8 +379,7 @@ Upload Debug Symbols to Sentry */ = {
shellPath = /bin/sh;
shellScript = "/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh\n";
};
1F4795A12E9D5C1200B52C86 /*
Upload Debug Symbols to Sentry */ = {
1F4795A12E9D5C1200B52C86 /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -396,7 +388,7 @@ Upload Debug Symbols to Sentry */ = {
);
inputPaths = (
);
name = "\nUpload Debug Symbols to Sentry";
name = "Upload Debug Symbols to Sentry";
outputFileListPaths = (
);
outputPaths = (
Expand Down Expand Up @@ -505,14 +497,10 @@ Upload Debug Symbols to Sentry */ = {
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Debug/Pods-App-RNWallet Debug-frameworks.sh\"\n";
Expand All @@ -526,14 +514,10 @@ Upload Debug Symbols to Sentry */ = {
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-frameworks.sh\"\n";
Expand All @@ -547,14 +531,10 @@ Upload Debug Symbols to Sentry */ = {
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet/Pods-App-RNWallet-resources.sh\"\n";
Expand Down Expand Up @@ -612,14 +592,10 @@ Upload Debug Symbols to Sentry */ = {
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-resources.sh\"\n";
Expand All @@ -633,14 +609,10 @@ Upload Debug Symbols to Sentry */ = {
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App-RNWallet Internal/Pods-App-RNWallet Internal-frameworks.sh\"\n";
Expand Down
1 change: 1 addition & 0 deletions wallets/rn_cli_wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react-native-dialog": "9.3.0",
"react-native-gesture-handler": "2.28.0",
"react-native-get-random-values": "1.11.0",
"react-native-mmkv": "3.3.3",
"react-native-modal": "14.0.0-rc.1",
"react-native-permissions": "5.4.2",
"react-native-quick-base64": "2.2.2",
Expand Down
4 changes: 2 additions & 2 deletions wallets/rn_cli_wallet/src/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useSnapshot} from 'valtio';
import {useEffect, useState} from 'react';
import {Text, View, Alert, ScrollView} from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import Clipboard from '@react-native-clipboard/clipboard';
import {getVersion, getBuildNumber} from 'react-native-device-info';

Expand All @@ -11,6 +10,7 @@ import {Card} from '@/components/Card';
import {useTheme} from '@/hooks/useTheme';
import styles from './styles';
import {SettingsStackScreenProps} from '@/utils/TypesUtil';
import { storage } from '@/utils/storage';

type Props = SettingsStackScreenProps<'Settings'>;

Expand All @@ -21,7 +21,7 @@ export default function Settings({navigation}: Props) {

useEffect(() => {
async function getAsyncData() {
const _clientId = await AsyncStorage.getItem('WALLETCONNECT_CLIENT_ID');
const _clientId = await storage.getItem('WALLETCONNECT_CLIENT_ID');
if (_clientId) {
setClientId(_clientId);
}
Expand Down
6 changes: 3 additions & 3 deletions wallets/rn_cli_wallet/src/store/SettingsStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {proxy} from 'valtio';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {Verify, SessionTypes} from '@walletconnect/types';

import { storage } from '@/utils/storage';
import EIP155Lib from '../lib/EIP155Lib';
import SuiLib from '../lib/SuiLib';

Expand Down Expand Up @@ -98,9 +98,9 @@ const SettingsStore = {
toggleTestNets() {
state.testNets = !state.testNets;
if (state.testNets) {
AsyncStorage.setItem('TEST_NETS', 'YES');
storage.setItem('TEST_NETS', 'YES');
} else {
AsyncStorage.removeItem('TEST_NETS');
storage.removeItem('TEST_NETS');
}
},

Expand Down
10 changes: 5 additions & 5 deletions wallets/rn_cli_wallet/src/utils/EIP155WalletUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import EIP155Lib from '../lib/EIP155Lib';
import { storage } from './storage';

export let wallet1: EIP155Lib;
export let wallet2: EIP155Lib;
Expand All @@ -13,8 +13,8 @@ let address2: string;
* Utilities
*/
export async function createOrRestoreEIP155Wallet() {
const mnemonic1 = await AsyncStorage.getItem('EIP155_MNEMONIC_1');
const mnemonic2 = await AsyncStorage.getItem('EIP155_MNEMONIC_2');
const mnemonic1 = await storage.getItem('EIP155_MNEMONIC_1');
const mnemonic2 = await storage.getItem('EIP155_MNEMONIC_2');

if (mnemonic1 && mnemonic2) {
wallet1 = EIP155Lib.init({mnemonic: mnemonic1});
Expand All @@ -24,8 +24,8 @@ export async function createOrRestoreEIP155Wallet() {
wallet2 = EIP155Lib.init({});

// Don't store mnemonic in local storage in a production project!
AsyncStorage.setItem('EIP155_MNEMONIC_1', wallet1.getMnemonic());
AsyncStorage.setItem('EIP155_MNEMONIC_2', wallet2.getMnemonic());
storage.setItem('EIP155_MNEMONIC_1', wallet1.getMnemonic());
storage.setItem('EIP155_MNEMONIC_2', wallet2.getMnemonic());
}

address1 = wallet1.getAddress();
Expand Down
6 changes: 3 additions & 3 deletions wallets/rn_cli_wallet/src/utils/SuiWalletUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SuiLib from '../lib/SuiLib';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { storage } from './storage';

export let wallet1: SuiLib;
export let suiAddresses: string[];
Expand All @@ -8,14 +8,14 @@ export let suiAddresses: string[];
* Utilities
*/
export async function createOrRestoreSuiWallet() {
const mnemonic1 = await AsyncStorage.getItem('SUI_MNEMONIC_1');
const mnemonic1 = await storage.getItem('SUI_MNEMONIC_1');

if (mnemonic1) {
wallet1 = await SuiLib.init({mnemonic: mnemonic1});
} else {
wallet1 = await SuiLib.init({});
// Don't store private keys in local storage in a production project!
await AsyncStorage.setItem('SUI_MNEMONIC_1', wallet1.getMnemonic());
await storage.setItem('SUI_MNEMONIC_1', wallet1.getMnemonic());
console.log('SUI_MNEMONIC_1', wallet1.getMnemonic());
}

Expand Down
5 changes: 3 additions & 2 deletions wallets/rn_cli_wallet/src/utils/WalletKitUtil.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {WalletKit, IWalletKit} from '@reown/walletkit';
import {Core} from '@walletconnect/core';
import AsyncStorage from '@react-native-async-storage/async-storage';
import Config from 'react-native-config';
import {getMetadata} from './misc';
import { storage } from './storage';

export let walletKit: IWalletKit;

export async function createWalletKit(relayerRegionURL: string) {
const core = new Core({
projectId: Config.ENV_PROJECT_ID,
storage,
relayUrl: relayerRegionURL ?? Config.ENV_RELAY_URL,
});
walletKit = await WalletKit.init({
Expand All @@ -20,7 +21,7 @@ export async function createWalletKit(relayerRegionURL: string) {
const clientId =
await walletKit.engine.signClient.core.crypto.getClientId();
console.log('WalletConnect ClientID: ', clientId);
AsyncStorage.setItem('WALLETCONNECT_CLIENT_ID', clientId);
storage.setItem('WALLETCONNECT_CLIENT_ID', clientId);
} catch (error) {
console.error(
'Failed to set WalletConnect clientId in localStorage: ',
Expand Down
33 changes: 33 additions & 0 deletions wallets/rn_cli_wallet/src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { MMKV } from 'react-native-mmkv';
import { safeJsonParse, safeJsonStringify } from '@walletconnect/safe-json';

const mmkv = new MMKV();

export const storage = {
getKeys: async () => {
return mmkv.getAllKeys();
},
getEntries: async <T = any>(): Promise<[string, T][]> => {
function parseEntry(key: string): [string, any] {
const value = mmkv.getString(key);
return [key, safeJsonParse(value ?? '')];
}

const keys = mmkv.getAllKeys();
return keys.map(parseEntry);
},
setItem: async <T = any>(key: string, value: T) => {
return mmkv.set(key, safeJsonStringify(value));
},
getItem: async <T = any>(key: string): Promise<T | undefined> => {
const item = mmkv.getString(key);
if (typeof item === 'undefined' || item === null) {
return undefined;
}

return safeJsonParse(item) as T;
},
removeItem: async (key: string) => {
return mmkv.delete(key);
},
};
Loading