From 3a1615531e8df180a13fd5696fc785e55822e6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Thu, 11 Jul 2024 09:15:33 -0300 Subject: [PATCH] fix: invalid feedback modal on pin screen --- src/sagas/wallet.js | 2 + src/screens/CreateTokenConfirm.js | 10 +- src/screens/Dashboard.js | 140 ------------------ src/screens/PinScreen.js | 6 + .../WalletConnect/SignMessageRequestScreen.js | 2 + 5 files changed, 16 insertions(+), 144 deletions(-) diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 648158477..54bcfdb7d 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -144,6 +144,8 @@ export function* startWallet(action) { pin, } = action.payload; + console.log('PIN: ', pin); + const uniqueDeviceId = getUniqueId(); const useWalletService = false; // yield call(isWalletServiceEnabled); const usePushNotification = yield call(isPushNotificationEnabled); diff --git a/src/screens/CreateTokenConfirm.js b/src/screens/CreateTokenConfirm.js index 9439435ad..1656d9f62 100644 --- a/src/screens/CreateTokenConfirm.js +++ b/src/screens/CreateTokenConfirm.js @@ -103,6 +103,7 @@ class CreateTokenConfirm extends React.Component { }, }); }, (err) => { + console.log('Err: ', err); this.onError(err.message); }); } @@ -112,7 +113,7 @@ class CreateTokenConfirm extends React.Component { */ onSendPress = () => { const params = { - cb: this.executeCreate, + cb: this.executeCreate.bind(this), screenText: t`Enter your 6-digit pin to create your token`, biometryText: t`Authorize token creation`, canCancel: true, @@ -138,6 +139,7 @@ class CreateTokenConfirm extends React.Component { * @param {String} message Error message */ onError = (message) => { + console.log('Message on error: ', message); this.setState({ modalType: 'FeedbackModal', modal: { @@ -169,9 +171,9 @@ class CreateTokenConfirm extends React.Component { this.state.modalType === 'FeedbackModal' ? ( // eslint-disable-next-line react/jsx-indent ) : ( // eslint-disable-next-line react/jsx-indent diff --git a/src/screens/Dashboard.js b/src/screens/Dashboard.js index e508a6722..c6cd949f6 100644 --- a/src/screens/Dashboard.js +++ b/src/screens/Dashboard.js @@ -25,122 +25,6 @@ import { COLORS } from '../styles/themes'; import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens'; import { NanoContractsList } from '../components/NanoContract/NanoContractsList'; import { getNanoContractFeatureToggle } from '../utils'; -import { Address } from '@hathor/wallet-lib'; - -const MOCK_DEPOSIT = (wallet) => ({ - type: 'WC_SESSION_REQUEST', - payload: { - id: 3, - topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4', - jsonrpc: '2.0', - params: { - request: { - method: 'htr_sendNanoContractTx', - params: { - push_tx: true, - network: 'testnet', - method: 'bet', - blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595', - nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553', - actions: [{ - type: 'deposit', - token: '00', - amount: 1 - }], - args: [ - (new Address('WdXfZ6zKa1mQpBAhGQVj9pCuWDqCrG5ZR6', { - network: wallet.getNetwork() - })).decode().toString('hex'), - 'true' - ], - }, - }, - }, - }, -}); - -const MOCK_INITIALIZE = (wallet) => ({ - type: 'WC_SESSION_REQUEST', - payload: { - id: 3, - topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4', - jsonrpc: '2.0', - params: { - request: { - method: 'htr_sendNanoContractTx', - params: { - push_tx: true, - network: 'testnet', - method: 'initialize', - blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595', - args: [ - '76a914969647cffd30891b1444944ff228f3bd7582fa4588ac', - '00', - 1720281665, - ], - }, - }, - }, - }, -}); - -const MOCK_WITHDRAWL = (wallet) => ({ - type: 'WC_SESSION_REQUEST', - payload: { - id: 3, - topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4', - jsonrpc: '2.0', - params: { - request: { - method: 'htr_sendNanoContractTx', - params: { - push_tx: true, - network: 'testnet', - method: 'withdrawl', - blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595', - nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553', - actions: [{ - type: 'withdrawal', - token: '00', - amount: 1 - }], - }, - }, - }, - }, -}); - -const MOCK_SET_RESULT = (wallet) => ({ - type: 'WC_SESSION_REQUEST', - payload: { - id: 3, - topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4', - jsonrpc: '2.0', - params: { - request: { - method: 'htr_sendNanoContractTx', - params: { - push_tx: true, - network: 'testnet', - method: 'set_result', - blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595', - nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553', - actions: [{ - type: 'deposit', - token: '00', - amount: 1 - }], - args: [ - (new Address('WdXfZ6zKa1mQpBAhGQVj9pCuWDqCrG5ZR6', { - network: wallet.getNetwork() - })).decode().toString('hex'), - 'true' - ], - }, - }, - }, - }, -}); /** * State filter to retrieve token-related data from root state. @@ -233,32 +117,8 @@ export const Dashboard = () => { navigation.navigate('MainScreen'); } - const onInitializeNanoTx = () => { - dispatch(MOCK_INITIALIZE(wallet)); - console.log('initialize call on nano contract'); - }; - - const onSendNanoTx = () => { - dispatch(MOCK_DEPOSIT(wallet)); - console.log('deposit call on nano contract'); - }; - - const onWithdrawalNanoTx = () => { - dispatch(MOCK_WITHDRAWL(wallet)); - console.log('withdrawal call on nano contract'); - }; - - const onSetResultNanoTx = () => { - dispatch(MOCK_SET_RESULT(wallet)); - console.log('set_result call on nano contract'); - }; - return ( -