-
Notifications
You must be signed in to change notification settings - Fork 26
feat: rpc lib integration #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f9d5596
66f94a9
44da5e7
09a658e
43c15b0
045511c
d24554a
8b57915
cbdae1d
299bc2e
9573d5f
2764f7e
43de255
c91aad8
ff789cf
af8a9c3
0b62655
ae98424
f8858d5
562c4e2
e1563b1
a48a2e4
533653e
81b4cfa
57e61ff
33ee31e
8316ba8
b6ba639
2752d81
5403440
f5fe1a3
eec0b40
b2c2f52
873766b
dc10aa0
621443c
771acdb
dbdb9fb
7f65f7f
029cefe
308bfe0
1a740f8
40b30a4
6744781
ac566b2
d160bbc
5af9719
970c979
550d865
5089ce2
82262f3
04ee8e1
0fa1982
84295b3
03fb3a1
9241af8
156f089
2963bb9
ad2808f
e9ef38e
f72cacd
59c4a11
0532acf
960bd40
37ef1b1
d56a201
13d03db
b219fdf
5fd89fe
f5043d3
0c0a9e9
dd242ac
25c32a4
2a8130d
2de2950
3112dfb
a3e8f3a
6cfccf5
25f2de8
0fde00c
a3b1e23
d116326
e083f61
fede251
26f761a
4b4486a
0c0eb69
2bd638e
7b17750
c426b6f
468c5d5
cf96b79
d497129
6023375
74c60a4
d6e0e10
c9b4495
8feae30
3a50028
790f87c
2a6ebf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,74 @@ | ||
diff --git a/package.json b/package.json | ||
index b5a16f3..8c13347 100644 | ||
--- a/package.json | ||
+++ b/package.json | ||
@@ -26,6 +26,8 @@ | ||
"@react-navigation/native": "6.1.7", | ||
"@react-navigation/stack": "6.3.17", | ||
"@sentry/react-native": "^5.6.0", | ||
+ "@walletconnect/core": "^2.10.2", | ||
+ "@walletconnect/web3wallet": "^1.9.2", | ||
"assert": "^2.0.0", | ||
"buffer": "^4.9.2", | ||
"console-browserify": "^1.2.0", | ||
@@ -67,6 +69,7 @@ | ||
"redux-saga": "^1.2.0", | ||
"redux-thunk": "^2.4.1", | ||
"stream-browserify": "^1.0.0", | ||
+ "text-encoding": "^0.7.0", | ||
"ttag": "^1.7.24", | ||
"unleash-proxy-client": "^1.11.0", | ||
"url": "^0.11.0" | ||
diff --git a/shim.js b/shim.js | ||
index 73c130d..10d894b 100644 | ||
index 73c130d..deae975 100644 | ||
--- a/shim.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you have the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, can you check again? |
||
+++ b/shim.js | ||
@@ -26,3 +26,8 @@ if (typeof localStorage !== 'undefined') { | ||
@@ -26,3 +26,20 @@ if (typeof localStorage !== 'undefined') { | ||
// If using the crypto shim, uncomment the following line to ensure | ||
// crypto is loaded first, so it can populate global.crypto | ||
require('crypto') | ||
+const TextEncoder = require('text-encoding').TextEncoder; | ||
+const TextDecoder = require('text-encoding').TextDecoder; | ||
+ | ||
+const { TextEncoder, TextDecoder } = require('text-encoding'); | ||
+ | ||
+global.TextDecoder = TextDecoder; | ||
+global.TextEncoder = TextEncoder; | ||
+ | ||
+if (typeof btoa === 'undefined') { | ||
+ global.btoa = function (str) { | ||
+ return Buffer.from(str, 'binary').toString('base64'); | ||
+ }; | ||
+} | ||
+ | ||
+if (typeof atob === 'undefined') { | ||
+ global.atob = function (b64Encoded) { | ||
+ return Buffer.from(b64Encoded, 'base64').toString('binary'); | ||
+ }; | ||
+} | ||
diff --git a/src/sagas/walletConnect.js b/src/sagas/walletConnect.js | ||
index 5e954de..39ff15b 100644 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is also duplicated here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, can you check again? |
||
index 160cb11..07ccb34 100644 | ||
--- a/src/sagas/walletConnect.js | ||
+++ b/src/sagas/walletConnect.js | ||
@@ -61,6 +61,8 @@ import { | ||
@@ -45,6 +45,7 @@ | ||
* loaded. | ||
*/ | ||
|
||
+import '@walletconnect/react-native-compat'; | ||
import { | ||
call, | ||
fork, | ||
@@ -62,6 +63,8 @@ import { | ||
} from 'redux-saga/effects'; | ||
import { eventChannel } from 'redux-saga'; | ||
import { get, values } from 'lodash'; | ||
+import { Core } from '@walletconnect/core'; | ||
+import { Web3Wallet } from '@walletconnect/web3wallet'; | ||
|
||
import { WalletConnectModalTypes } from '../components/WalletConnect/WalletConnectModal'; | ||
import { | ||
@@ -95,12 +97,6 @@ const ERROR_CODES = { | ||
INVALID_PAYLOAD: 5003, | ||
TriggerTypes, | ||
TriggerResponseTypes, | ||
@@ -100,12 +103,6 @@ const AVAILABLE_METHODS = { | ||
}; | ||
const AVAILABLE_EVENTS = []; | ||
|
||
-// We're mocking it here because we don't want to add the walletconnect | ||
-// libraries in our production build. If you really want to add it, just run the | ||
-// src/walletconnect.sh script | ||
-const Core = class {}; | ||
-const Web3Wallet = class {}; | ||
- | ||
function* isWalletConnectEnabled() { | ||
/** | ||
* Those are the only ones we are currently using, extracted from | ||
* https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes | ||
@@ -118,13 +115,10 @@ const ERROR_CODES = { | ||
INVALID_PAYLOAD: 5003, | ||
}; | ||
|
||
-function isWalletConnectEnabled() { | ||
- return false; | ||
- /* | ||
+function* isWalletConnectEnabled() { | ||
const walletConnectEnabled = yield call(checkForFeatureFlag, WALLET_CONNECT_FEATURE_TOGGLE); | ||
|
||
return walletConnectEnabled; | ||
- */ | ||
} | ||
|
||
function* init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should cause any changes to package-lock.json to fail