Skip to content

Commit

Permalink
Merge branch 'main' into feat/link-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciosantise committed Jul 17, 2024
2 parents c620838 + c42bbbe commit d23c6de
Show file tree
Hide file tree
Showing 67 changed files with 33,970 additions and 23,088 deletions.
52 changes: 9 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,29 @@
# React Native Examples

React Native examples implementing WalletConnect v2

Catalogue of wallet and dapp examples WalletConnect's various SDKs via React Native. Each example contains its own README with further instructions and explanations.

### Wallet (Demo)

https://user-images.githubusercontent.com/45455218/217548710-778dbba8-5a5a-4f48-86c2-c3299347083b.mov

### Dapp (Demo)

https://user-images.githubusercontent.com/45455218/220603463-a8c4dc92-1209-443c-998c-a613bf3f1adb.mp4
React Native examples implementing WalletConnect AppKit and WalletKit

## Wallets

Full Example

- React Native CLI Wallet (0.68.5) `wallets/rn_cli_wallet_068_5`

Skeleton Example (WIP)

- React Native CLI Wallet `wallets/rn_cli_wallet`
- React Native Expo Wallet `wallets/rn_expo_wallet`
- Wallet: `wallets/rn_cli_wallet`
- Wallet with RN 0.68.5: `wallets/rn_cli_wallet_068_5`

## Dapps

- WalletConnect Modal + Viem: `dapps/ModalViem`
- WalletConnect Modal + Ethers v5: `dapps/ModalEthers`
- WalletConnect Modal + Universal Provider: `dapps/ModalUProvider`

- AppKit + Wagmi v1: `dapps/W3MWagmi`
- AppKit + Ethers: `dapps/W3MEthers`
- AppKit + Ethers v5: `dapps/W3MEthers5`

## Getting Started

- Ensure your[ React Native environment](https://reactnative.dev/docs/next/environment-setup) has been properly setup (XCode, ruby etc). Note for Mac users to have the correct Ruby versions if doing a fresh install.
- Read through our [React Native guide](https://docs.walletconnect.com/2.0/reactnative/overview)
- Check the respective `/wallet` folder to see the `rn_cli_wallet` or `rn_expo_wallet` repo
- Ensure your [React Native environment](https://reactnative.dev/docs/next/set-up-your-environment) has been properly setup (XCode, ruby etc).
- Read our [React Native docs](https://docs.walletconnect.com/appkit/react-native/core/installation)
- Read through the various README files for further information
- Submit any issues / feature requests.

Note:
If you are switching between these wallets (i.e. `rn_cli_068_5` & `rn_cli_070_6`), it is recommended to clear caches using the following command:

```
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
```

If you run into issues with the simulator version:

```
npx react-native run-ios
error No simulator available with name "iPhone 13".
```

Change the flag with:

```
npx react-native run-ios --simulator="iPhone 14"
```

If you have `/ios` or Pod Issues, delete the `Podfile.lock` and re-run `pod update && pod install` worked for my case

## Support

Expand Down
2 changes: 2 additions & 0 deletions dapps/W3MEthers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ yarn android
```bash
# using npm
npm run ios
cd ios && pod install

# OR using Yarn
yarn ios
cd ios && pod install
```

If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
Expand Down
2 changes: 2 additions & 0 deletions dapps/W3MEthers5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ yarn android
```bash
# using npm
npm run ios
cd ios && pod install

# OR using Yarn
yarn ios
cd ios && pod install
```

If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
Expand Down
13 changes: 10 additions & 3 deletions dapps/W3MWagmi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local
**/.xcode.env.local

# Android/IntelliJ
#
Expand Down Expand Up @@ -55,7 +55,7 @@ yarn-error.log
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
**/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
Expand All @@ -69,6 +69,13 @@ yarn-error.log
dist/
web-build/


# asdf
**/.tool-versions

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
874 changes: 874 additions & 0 deletions dapps/W3MWagmi/.yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dapps/W3MWagmi/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.4.cjs
1 change: 0 additions & 1 deletion dapps/W3MWagmi/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
Expand Down
1 change: 1 addition & 0 deletions dapps/W3MWagmi/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:theme="@style/BootTheme"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
Expand Down
1 change: 1 addition & 0 deletions dapps/W3MWagmi/android/app/src/main/assets/modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.zoontek.rnbootsplash.RNBootSplash

class MainActivity : ReactActivity() {

Expand All @@ -24,6 +25,7 @@ class MainActivity : ReactActivity() {

// React navigation
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
RNBootSplash.init(this, R.style.BootTheme)
super.onCreate(savedInstanceState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {
Expand All @@ -34,7 +33,7 @@ class MainApplication : Application(), ReactApplication {
})

override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
Expand All @@ -43,7 +42,6 @@ class MainApplication : Application(), ReactApplication {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
ApplicationLifecycleDispatcher.onApplicationCreate(this)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
>

<selector>
<!--
Expand Down
3 changes: 3 additions & 0 deletions dapps/W3MWagmi/android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<color name="bootsplash_background">#D3D7EE</color>
</resources>
2 changes: 1 addition & 1 deletion dapps/W3MWagmi/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">RN W3Modal</string>
<string name="app_name">RN AppKit</string>
</resources>
7 changes: 7 additions & 0 deletions dapps/W3MWagmi/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>

<!-- BootTheme should inherit from Theme.BootSplash or Theme.BootSplash.EdgeToEdge -->
<style name="BootTheme" parent="Theme.BootSplash">
<item name="bootSplashBackground">@color/bootsplash_background</item>
<item name="bootSplashLogo">@drawable/bootsplash_logo</item>
<item name="postBootSplashTheme">@style/AppTheme</item>
</style>

</resources>
4 changes: 2 additions & 2 deletions dapps/W3MWagmi/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
compileSdkVersion = 34
targetSdkVersion = 34

ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions dapps/W3MWagmi/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 11 additions & 11 deletions dapps/W3MWagmi/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down Expand Up @@ -89,4 +89,4 @@ exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
3 changes: 1 addition & 2 deletions dapps/W3MWagmi/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"name": "W3MWagmi",
"displayName": "W3MWagmi"
"name": "W3MWagmi"
}
19 changes: 2 additions & 17 deletions dapps/W3MWagmi/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ require Pod::Executable.execute_command('node', ['-p',
platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
Expand All @@ -39,11 +28,6 @@ abstract_target 'App' do

use_react_native!(
:path => config[:reactNativePath],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand Down Expand Up @@ -71,7 +55,8 @@ abstract_target 'App' do
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)

# This is necessary for Xcode 14, because it signs resource bundles by default
Expand Down
Loading

0 comments on commit d23c6de

Please sign in to comment.