Skip to content

Commit

Permalink
Wallet connect (#334)
Browse files Browse the repository at this point in the history
Summary:

This is the first commit of wallet-connect branch which include poc: deep-links and poc: wallet-connect. I gonna begin to work from here to finish the implementation of the whole wallet connect feature.

* poc: deep-links working

* poc: wallet-connect working

Co-authored-by: Matias Grote <mattgrote@Matiass-MBP.fibertel.com.ar>
Co-authored-by: Matias Grote <44204622+mattgle@users.noreply.github.com>
Co-authored-by: Nico Poggi <73345016+nicolaspoggi@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: nachosan <ignacio.santise@gmail.com>
Co-authored-by: ignaciosantise <nachosan@fleek.co>

Author:    Alejo Acevedo <ale.acevedo@live.com.ar>

Changes to be committed:
	modified:   App.js
	modified:   ios/Plug.xcodeproj/project.pbxproj
	modified:   ios/Plug/AppDelegate.m
	modified:   ios/Plug/Info.plist
	new file:   ios/Plug/Plug.entitlements
	modified:   ios/Podfile.lock
	modified:   package.json
	modified:   shim.js
	new file:   src/constants/walletconnect.js
	new file:   src/hooks/useDeepLink.js
	modified:   src/navigation/Routes.js
	modified:   src/navigation/index.js
	modified:   src/navigation/navigators/SwipeNavigator.js
	modified:   src/redux/slices/user.js
	new file:   src/redux/slices/walletconnect.js
	modified:   src/redux/store.js
	new file:   src/screens/flows/WalletConnect/index.js
	new file:   src/screens/flows/WalletConnect/screens/RequestCall/index.js
	new file:   src/screens/flows/WalletConnect/styles.js
	new file:   src/utils/deepLink.js
	new file:   src/utils/utilities.js
	new file:   src/utils/walletConnect.js
	modified:   yarn.lock

Summary: 

After poc: wallet-connect we make a refactor to follow plug-mobile infra and implement main functions to be compatible with extension provider. We need to make the merge of the controller to use just one controller for mobile and extension

* refactor: make it clear and follow plug-mobile infrastructure

* feat : implement utils and other stuff for modules implementation

* feat: implement connection, information and transaction modules

* feat: unify controllers

* feat: changing parse functions of tokens for new controller

* feat: unified getAssets and getBalance

* fix: send params as object (#386)

* feat: implement allWhitelisted method

* fix: request transfer

* chore: use checkPassword

* chore: install last controller

Co-authored-by: nachosan <ignacio.santise@gmail.com>
Co-authored-by: Matias Grote <mattgrote@MacBook-Pro.home>
  • Loading branch information
3 people authored Aug 3, 2022
1 parent 590f469 commit 0d998d4
Show file tree
Hide file tree
Showing 91 changed files with 4,958 additions and 398 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ module.exports = {
'react-hooks/exhaustive-deps': 0,
'simple-import-sort/imports': 'error',
},
globals: {
BigInt: true,
},
};
8 changes: 6 additions & 2 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { isIos } from '@/constants/platform';
import Routes from '@/navigation';
import { initKeyring } from '@/redux/slices/keyring';
import { persistor, store } from '@/redux/store';
import { TopLevelNavigationRef } from '@/utils/navigation';

const routingInstrumentation = new Sentry.ReactNavigationInstrumentation();
const baseDist = getBuildNumber();
Expand All @@ -32,7 +33,7 @@ Sentry.init({
dsn: Config.SENTRY_DSN,
tracesSampleRate: 1.0,
dist: baseDist,
debug: __DEV__,
debug: false,
release: baseRelease,
environment: __DEV__ ? 'local' : 'productive',
normalizeDepth: 10,
Expand Down Expand Up @@ -89,7 +90,10 @@ const PersistedApp = () => {
<SafeAreaProvider>
<StatusBar barStyle="light-content" backgroundColor="black" />
{!!instance && (
<Routes routingInstrumentation={routingInstrumentation} />
<Routes
routingInstrumentation={routingInstrumentation}
ref={TopLevelNavigationRef}
/>
)}
</SafeAreaProvider>
</ErrorBoundary>
Expand Down
8 changes: 7 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.psychedelic.plug">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand All @@ -26,6 +26,12 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="wc" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</application>
<queries>
Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'@/constants': './src/constants',
'@/hooks': './src/hooks',
'@/interfaces': './src/interfaces',
'@/modules': './src/modules',
'@/navigation': './src/navigation',
'@/redux': './src/redux',
'@/screens': './src/screens',
Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.jpg';
declare module '*.json';
declare module '*.png';
declare module '*.mp4';
6 changes: 5 additions & 1 deletion ios/Plug.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Plug/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Plug/main.m; sourceTree = "<group>"; };
1F25339C284E554700B76386 /* BootSplash.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = BootSplash.storyboard; path = Plug/BootSplash.storyboard; sourceTree = "<group>"; };
1FF442DA28999BC30086AFD3 /* Plug.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; name = Plug.entitlements; path = Plug/Plug.entitlements; sourceTree = "<group>"; };
33E5DE36FA63D06ED1690823 /* Pods-Plug-PlugTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plug-PlugTests.release.xcconfig"; path = "Target Support Files/Pods-Plug-PlugTests/Pods-Plug-PlugTests.release.xcconfig"; sourceTree = "<group>"; };
3809386EBD20482F923CAB29 /* Inter-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-SemiBold.ttf"; path = "../assets/fonts/Inter-SemiBold.ttf"; sourceTree = "<group>"; };
4ABFD47BAF2E44B9AE285C85 /* Inter-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-Regular.ttf"; path = "../assets/fonts/Inter-Regular.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -116,6 +117,7 @@
13B07FAE1A68108700A75B9A /* Plug */ = {
isa = PBXGroup;
children = (
1FF442DA28999BC30086AFD3 /* Plug.entitlements */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
1F25339C284E554700B76386 /* BootSplash.storyboard */,
Expand Down Expand Up @@ -295,7 +297,7 @@
/* Begin PBXShellScriptBuildPhase section */
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 12;
files = (
);
inputPaths = (
Expand Down Expand Up @@ -659,6 +661,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
Expand Down Expand Up @@ -721,6 +724,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
DEFINES_MODULE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
Expand Down
26 changes: 24 additions & 2 deletions ios/Plug/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
#import <CodePush/CodePush.h>
#import "RNBootSplash.h"

Expand All @@ -30,14 +31,35 @@ static void InitializeFlipper(UIApplication *application) {
#endif

@implementation AppDelegate
#pragma mark - Handling URLs

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
#import <React/RCTLinkingManager.h>

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager
application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler
];
}

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTSetLogThreshold(RCTLogLevelInfo - 1);
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Plug"
Expand Down
13 changes: 13 additions & 0 deletions ios/Plug/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>plug</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CodePushDeploymentKey</key>
Expand Down
10 changes: 10 additions & 0 deletions ios/Plug/Plug.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:plugwallet.ooo</string>
</array>
</dict>
</plist>
50 changes: 47 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
PODS:
- AFNetworking (3.2.1):
- AFNetworking/NSURLSession (= 3.2.1)
- AFNetworking/Reachability (= 3.2.1)
- AFNetworking/Security (= 3.2.1)
- AFNetworking/Serialization (= 3.2.1)
- AFNetworking/UIKit (= 3.2.1)
- AFNetworking/NSURLSession (3.2.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (3.2.1)
- AFNetworking/Security (3.2.1)
- AFNetworking/Serialization (3.2.1)
- AFNetworking/UIKit (3.2.1):
- AFNetworking/NSURLSession
- Base64 (1.1.2)
- boost (1.76.0)
- BVLinearGradient (2.5.6):
Expand Down Expand Up @@ -300,6 +315,9 @@ PODS:
- react-native-file-access (2.4.1):
- React-Core
- ZIPFoundation (< 0.9.12)
- react-native-minimizer (1.3.3):
- AFNetworking (~> 3.0)
- React
- react-native-pager-view (5.4.11):
- React-Core
- react-native-randombytes (3.6.1):
Expand All @@ -312,6 +330,12 @@ PODS:
- ReactCommon/turbomodule/core
- react-native-sensitive-info (6.0.0-alpha.9):
- React-Core
- react-native-tcp-socket (5.6.2):
- CocoaAsyncSocket
- React-Core
- react-native-udp (4.1.5):
- CocoaAsyncSocket
- React-Core
- react-native-video (5.2.0):
- React-Core
- react-native-video/Video (= 5.2.0)
Expand Down Expand Up @@ -404,6 +428,8 @@ PODS:
- React-Core
- RNLocalize (2.2.2):
- React-Core
- RNOS (1.2.6):
- React
- RNReactNativeHapticFeedback (1.13.1):
- React-Core
- RNReanimated (2.8.0):
Expand Down Expand Up @@ -504,10 +530,13 @@ DEPENDENCIES:
- "react-native-blur (from `../node_modules/@react-native-community/blur`)"
- react-native-config (from `../node_modules/react-native-config`)
- react-native-file-access (from `../node_modules/react-native-file-access`)
- react-native-minimizer (from `../node_modules/react-native-minimizer`)
- react-native-pager-view (from `../node_modules/react-native-pager-view`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-sensitive-info (from `../node_modules/react-native-sensitive-info`)
- react-native-tcp-socket (from `../node_modules/react-native-tcp-socket`)
- react-native-udp (from `../node_modules/react-native-udp`)
- react-native-video (from `../node_modules/react-native-video`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
Expand All @@ -531,6 +560,7 @@ DEPENDENCIES:
- RNFileViewer (from `../node_modules/react-native-file-viewer`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNLocalize (from `../node_modules/react-native-localize`)
- RNOS (from `../node_modules/react-native-os`)
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
Expand All @@ -542,6 +572,7 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- AFNetworking
- Base64
- CocoaAsyncSocket
- Flipper
Expand Down Expand Up @@ -609,6 +640,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-config"
react-native-file-access:
:path: "../node_modules/react-native-file-access"
react-native-minimizer:
:path: "../node_modules/react-native-minimizer"
react-native-pager-view:
:path: "../node_modules/react-native-pager-view"
react-native-randombytes:
Expand All @@ -617,6 +650,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-safe-area-context"
react-native-sensitive-info:
:path: "../node_modules/react-native-sensitive-info"
react-native-tcp-socket:
:path: "../node_modules/react-native-tcp-socket"
react-native-udp:
:path: "../node_modules/react-native-udp"
react-native-video:
:path: "../node_modules/react-native-video"
react-native-webview:
Expand Down Expand Up @@ -663,6 +700,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-gesture-handler"
RNLocalize:
:path: "../node_modules/react-native-localize"
RNOS:
:path: "../node_modules/react-native-os"
RNReactNativeHapticFeedback:
:path: "../node_modules/react-native-haptic-feedback"
RNReanimated:
Expand All @@ -687,12 +726,13 @@ CHECKOUT OPTIONS:
:tag: 7.20.0

SPEC CHECKSUMS:
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
Base64: cecfb41a004124895a7bcee567a89bae5a89d49b
boost: a7c83b31436843459a1961bfd74b96033dc77234
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
CodePush: b51b7ac64c07d4eacfc8cc5750a1dd28adbf2528
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: de148e8310b8b878db304ceea2fec13f2c02e3a0
FBReactNativeSpec: 6192956c9e346013d5f1809ba049af720b11c6a4
Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733
Expand All @@ -705,12 +745,12 @@ SPEC CHECKSUMS:
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
FlipperKit: d8d346844eca5d9120c17d441a2f38596e8ed2b9
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
glog: 5337263514dd6f09803962437687240c5dc39aa4
JWT: ef71dfb03e1f842081e64dc42eef0e164f35d251
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a
RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9
RCTRequired: 59d2b744d8c2bf2d9bc7032a9f654809adcf7d50
RCTTypeSafety: d0aaf7ccae5c70a4aaa3a5c3e9e0db97efae760e
React: fbe655dd1d12c052299b61abdc576720098d80fc
Expand All @@ -725,10 +765,13 @@ SPEC CHECKSUMS:
react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c
react-native-config: 6502b1879f97ed5ac570a029961fc35ea606cd14
react-native-file-access: 8c7b3c8935f7f33e31e16439b5882caa620cc493
react-native-minimizer: b33b62100148ac712cd6b314fcfd9c9a98a8d1a3
react-native-pager-view: 7f00d63688f7df9fad86dfb0154814419cc5eb8d
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
react-native-safe-area-context: ebf8c413eb8b5f7c392a036a315eb7b46b96845f
react-native-sensitive-info: d44e909d065f9c0e15734245e5dd6a24b82e3dcd
react-native-tcp-socket: c1b7297619616b4c9caae6889bcb0aba78086989
react-native-udp: 8864b1211857e9d8224ae5cbaf8580970fb99de1
react-native-video: a4c2635d0802f983594b7057e1bce8f442f0ad28
react-native-webview: 6e600df419b3fb92ee209d0bb7a71c1934e41938
React-perflogger: 73732888d37d4f5065198727b167846743232882
Expand All @@ -752,6 +795,7 @@ SPEC CHECKSUMS:
RNFileViewer: ce7ca3ac370e18554d35d6355cffd7c30437c592
RNGestureHandler: 61628a2c859172551aa2100d3e73d1e57878392f
RNLocalize: 95a43f85e41a966be7bc9cff2437128911c52da0
RNOS: 6f2f9a70895bbbfbdad7196abd952e7b01d45027
RNReactNativeHapticFeedback: 4085973f5a38b40d3c6793a3ee5724773eae045e
RNReanimated: 58b57be69a237fb02ec8099d25171057638cf41a
RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19
Expand Down
2 changes: 2 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"@/constants/*": ["./src/constants/*"],
"@/hooks/*": ["./src/hooks/*"],
"@/interfaces/*": ["./src/interfaces/*"],
"@/modules/*": ["./src/modules/*"],
"@/interfaces/*": ["./src/interfaces/*"],
"@/navigation/*": ["./src/navigation/*"],
"@/redux/*": ["./src/redux/*"],
"@/screens/*": ["./src/screens/*"],
Expand Down
Loading

0 comments on commit 0d998d4

Please sign in to comment.