Skip to content
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

feat: logging and rejecting invalid blueprint errors #536

Open
wants to merge 85 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
1cb5aac
feat: implement Nano Contract integration with Wallet Connect
alexruzenhack Jun 20, 2024
9f48b97
feat: adapt new nc tx to initialize, set result and withdrawal
alexruzenhack Jul 10, 2024
95629d7
feat: make ncAddress react to firstAddress the right way
alexruzenhack Jul 11, 2024
bc5f6ab
feat: add name to method arguments
alexruzenhack Jul 16, 2024
aeb5717
i18n: udpate files
alexruzenhack Jul 17, 2024
37c91d2
i18n: update translations and fix some typos
alexruzenhack Jul 17, 2024
6aecd30
review: apply suggestions and do some fixes
alexruzenhack Aug 8, 2024
28b0b76
refactor: load of token details not refistered but used in actions
alexruzenhack Aug 9, 2024
dce9e41
lint: comply with rules
alexruzenhack Aug 9, 2024
347ccf4
chore: remove unused action
alexruzenhack Aug 14, 2024
63da64e
chore: add undeclared style
alexruzenhack Aug 14, 2024
f3204e5
refactor: walletConnect.tokens to unregisteredTokens
alexruzenhack Aug 14, 2024
d2e68fa
chore: remove unused actions, reducer and saga effect
alexruzenhack Aug 14, 2024
ca000ad
chore: improving feedback message
alexruzenhack Aug 14, 2024
a0e7ce2
refactor: move requestTokens from walletConnect saga to tokens saga
alexruzenhack Aug 14, 2024
079d9a6
refactor: rename effect requestTokens to requestUnregisteredTokens
alexruzenhack Aug 14, 2024
a4daab0
feat: fire sentry error notification for method info not found
alexruzenhack Aug 14, 2024
c46b004
feat: improve title of Arguments component
alexruzenhack Aug 14, 2024
b8e03dd
chore: remove blueprint info action and reducer
alexruzenhack Aug 14, 2024
7974539
feat: retrieve fallback arg entries when blueprint is loading
alexruzenhack Aug 14, 2024
443e591
feat: add nft check to action token on Actions component
alexruzenhack Aug 14, 2024
ef847e7
chore: apply suggestions and improve documentation on new nc tx request
alexruzenhack Aug 14, 2024
fc2f31e
lint: comply with rules
alexruzenhack Aug 14, 2024
df22c87
fix: check if blueprintInfo is not null
alexruzenhack Aug 14, 2024
8484393
refactor: reanem style value to field
alexruzenhack Aug 14, 2024
b647b3e
type: recursar
alexruzenhack Aug 14, 2024
21dc439
i18n: update translation files
alexruzenhack Aug 14, 2024
d32db25
feat: add blueprint download to the tx loading flag and a redundancy
alexruzenhack Aug 15, 2024
c72b2ea
fix: FeedbackContent margin style
alexruzenhack Aug 15, 2024
b2afb9e
lint: comply with rules
alexruzenhack Aug 15, 2024
5c625ca
fix: typo
alexruzenhack Aug 16, 2024
f5befb4
chore: added dependencies and shims needed by walletconnect
andreabadesso Apr 11, 2024
5814849
refactor: using object destructuring in shims
andreabadesso Apr 24, 2024
5ee3d99
chore: rebase me
andreabadesso Jul 1, 2024
abaa33e
refactor: rootSaga now restarts failed sagas and sends errors to sentry
andreabadesso Jul 3, 2024
e208c64
feat: added actions and reducers
andreabadesso Jul 3, 2024
84888f2
refactor: NewNanoContract modal handling in wallet connect global modal
andreabadesso Jul 3, 2024
94f6267
feat: handling send nano contract tx triggers
andreabadesso Jul 3, 2024
b77a0da
refactor: removed unused import
andreabadesso Jul 3, 2024
e697778
refactor: typo
andreabadesso Jul 3, 2024
c7427ba
refactor: unused log
andreabadesso Jul 3, 2024
0dd62e6
refactor: refactored SignMessageRequest to use new modal format
andreabadesso Jul 3, 2024
29520b2
chore: rebase me, adding mocks to dashboard
andreabadesso Jul 4, 2024
6df4df1
refactor: removed function from redux
andreabadesso Jul 7, 2024
39861e9
refactor: convert PinScreen to a function component
andreabadesso Jul 7, 2024
cb049a4
refactor: pin screen now dispatches an action (as a param)
andreabadesso Jul 7, 2024
ad6572f
fix: invalid feedback modal on pin screen
andreabadesso Jul 11, 2024
f61235a
Revert "fix: invalid feedback modal on pin screen"
andreabadesso Jul 11, 2024
515c98a
Revert "refactor: pin screen now dispatches an action (as a param)"
andreabadesso Jul 11, 2024
6f6f6d6
Revert "fix: invalid feedback modal on pin screen"
andreabadesso Jul 11, 2024
1d3cc06
Revert "refactor: convert PinScreen to a function component"
andreabadesso Jul 11, 2024
b977c78
refactor: removed mocks from dashboard
andreabadesso Jul 11, 2024
2f7feac
chore: removed useless log
andreabadesso Jul 12, 2024
02b0c08
fix: added onDismiss as a dependency to useCallback as it might change
andreabadesso Jul 12, 2024
7ce76f7
refactor: re-enable wallet-service, stop initializing wallet-connect …
andreabadesso Jul 12, 2024
32efafb
docs: added docstring to promptHandler
andreabadesso Jul 12, 2024
9f79608
docs: added docstring to requests
andreabadesso Jul 12, 2024
009df64
refactor: removed unused imports on Dashboard
andreabadesso Jul 12, 2024
4089f1d
chore: update locale
andreabadesso Jul 12, 2024
d19f825
chore: fix broken rebase
andreabadesso Jul 12, 2024
10225e1
refactor: removed navigation from useEffect deps
andreabadesso Jul 31, 2024
19a4292
docs: added hathor header and comment explaining createStore deprecation
andreabadesso Jul 31, 2024
bdc620e
feat: added log when wallet-service is enabled and wallet-connect tri…
andreabadesso Jul 31, 2024
46513e0
refactor: added retry strategy
andreabadesso Jul 31, 2024
82aea5b
refactor: wallet-connect will always fork the init, so it restarts su…
andreabadesso Aug 2, 2024
f52ac02
refactor: nano contract saga is critical
andreabadesso Aug 2, 2024
3df12a8
feat: added log for sagas crash and max retries
andreabadesso Aug 2, 2024
81aeeeb
fix: log being called incorrectly
andreabadesso Aug 2, 2024
faa90bb
feat: logging when wallet-connect is initialzed
andreabadesso Aug 2, 2024
977cab7
fix: added missing import
andreabadesso Aug 16, 2024
296e951
fix: broken rebase fixes
andreabadesso Aug 20, 2024
639bf52
chore: updated translations
andreabadesso Aug 20, 2024
156d3b3
refactor: removed fuzzy translations
andreabadesso Aug 20, 2024
6327d32
refactor: removed unused import on NanoContactTransactionHeader
andreabadesso Aug 20, 2024
6a8474b
feat: logging error on root saga
andreabadesso Aug 20, 2024
7625ed7
chore: removed walletconnect libraries from package
andreabadesso Aug 20, 2024
d0e01e5
feat: added hathor-rpc-handler from the deployed lib
andreabadesso Aug 20, 2024
5b5f7bb
chore: changed CI version to 18x and 20x
andreabadesso Aug 20, 2024
1a9a566
chore: updated enable walletconnect script
andreabadesso Aug 20, 2024
a9f30c5
refactor: removed error logging on NanoContractMethodArgs
andreabadesso Aug 20, 2024
3f087ab
chore: removed local library from package-lock.json
andreabadesso Aug 20, 2024
b1213ce
refactor: removed unused option on PinScreen
andreabadesso Aug 21, 2024
3b0593b
fix: added missing import
andreabadesso Aug 21, 2024
d372cb5
chore: removed comment on pt-br texts
andreabadesso Aug 21, 2024
4ebda42
feat: logging and rejecting invalid blueprint errors
andreabadesso Aug 21, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
timeout-minutes: 40 # default is 360
strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
run: npm ci
- name: Install gettext
run: sudo apt-get install gettext
- name: Check version
Expand Down
126 changes: 99 additions & 27 deletions enable-walletconnect.patch
Original file line number Diff line number Diff line change
@@ -1,60 +1,132 @@
diff --git a/package.json b/package.json
index b5a16f3..8c13347 100644
index b60cc5a..1156937 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,8 @@
@@ -17,27 +17,35 @@
"postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack"
},
"dependencies": {
+ "@ethersproject/shims": "5.7.0",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-regular-svg-icons": "6.4.0",
"@fortawesome/free-solid-svg-icons": "6.4.0",
"@fortawesome/react-native-fontawesome": "0.2.7",
- "@hathor/hathor-rpc-handler": "0.0.1-experimental-alpha",
+ "@hathor/hathor-rpc-handler": "^0.0.1-experimental-alpha",
"@hathor/unleash-client": "0.1.0",
"@hathor/wallet-lib": "1.8.0",
+ "@json-rpc-tools/utils": "1.7.6",
"@notifee/react-native": "5.7.0",
"@react-native-async-storage/async-storage": "1.19.0",
+ "@react-native-community/netinfo": "11.3.1",
"@react-native-firebase/app": "16.7.0",
"@react-native-firebase/messaging": "16.7.0",
"@react-navigation/bottom-tabs": "6.5.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"
"@sentry/react-native": "5.6.0",
+ "@walletconnect/core": "2.12.2",
+ "@walletconnect/react-native-compat": "2.12.2",
+ "@walletconnect/web3wallet": "1.11.2",
"assert": "2.0.0",
"buffer": "4.9.2",
"console-browserify": "1.2.0",
"crypto-js": "4.1.1",
"deprecated-react-native-prop-types": "2.3.0",
- "events": "1.1.1",
+ "ethers": "5.7.2",
+ "events": "3.3.0",
+ "fast-text-encoding": "1.0.6",
"intl": "1.2.5",
"lodash": "4.17.21",
"metro-config": "0.70.4",
@@ -52,6 +60,7 @@
"react-native-device-info": "8.7.1",
"react-native-exception-handler": "2.10.10",
"react-native-gesture-handler": "2.13.1",
+ "react-native-get-random-values": "1.11.0",
"react-native-keychain": "8.1.1",
"react-native-localize": "2.2.6",
"react-native-modal": "13.0.1",
@@ -73,6 +82,7 @@
"redux-saga": "1.2.3",
"redux-thunk": "2.4.2",
"stream-browserify": "1.0.0",
+ "text-encoding": "0.7.0",
"ttag": "1.7.24",
"unleash-proxy-client": "1.11.0",
"url": "0.11.1"
diff --git a/shim.js b/shim.js
index 73c130d..10d894b 100644
index 73c130d..deae975 100644
--- a/shim.js
+++ 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
index 755753a..55e9c5f 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() {
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: c422aedd0c3b236578801088c8afef28030c3c83

COCOAPODS: 1.13.0
COCOAPODS: 1.15.2
Loading