this is my .env
REACT_APP_MORALIS_APPLICATION_ID=4iIHci6fwlwJ6cfphuObaEcdKCgFPkw7feYagGz7
REACT_APP_MORALIS_SERVER_URL=https://fagrndp36ogz.usemoralis.com:2053/server
this is my provider.tsx
i
mport React from 'react';
import {MoralisProvider} from 'react-moralis';
import Moralis from 'moralis/react-native.js';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {enableViaWalletConnect} from './Moralis/enableViaWalletConnect';
import WalletConnectProvider, {
WalletConnectProviderProps,
} from './WalletConnect';
import {Platform} from 'react-native';
import Qrcode from "./Qrcode";
//import { expo } from "../app.json";
import {MoralisDappProvider} from './providers/MoralisDappProvider/MoralisDappProvider';
import {ApplicationProvider, Layout, Text} from '@ui-kitten/components';
import * as eva from '@eva-design/eva';
import {
REACT_APP_MORALIS_APPLICATION_ID,
REACT_APP_MORALIS_SERVER_URL,
} from '@env';
interface ProvidersProps {
readonly children: JSX.Element;
}
/**
* Initialization of Moralis
*/
const appId = REACT_APP_MORALIS_APPLICATION_ID;
const serverUrl = REACT_APP_MORALIS_SERVER_URL;
const environment = 'native';
// Initialize Moralis with AsyncStorage to support react-native storage
Moralis.setAsyncStorage(AsyncStorage);
// Replace the enable function to use the react-native WalletConnect
// @ts-ignore
Moralis.enable = enableViaWalletConnect;
// console.log(AsyncStorage.getAllKeys(), 'KEYS');
const walletConnectOptions: WalletConnectProviderProps = {
storageOptions: {
// @ts-ignore
asyncStorage: AsyncStorage,
},
qrcodeModalOptions: {
mobileLinks: [
'rainbow',
'metamask',
'argent',
'trust',
'imtoken',
'pillar',
],
},
// Uncomment to show a QR-code to connect a wallet
renderQrcodeModal: Qrcode,
};
const Providers = ({children}: ProvidersProps) => {
return (
<WalletConnectProvider {...walletConnectOptions}>
<MoralisProvider
appId={appId}
serverUrl={serverUrl}
environment={environment}>
<MoralisDappProvider>
<ApplicationProvider {...eva} theme={eva.light}>
{children}
</ApplicationProvider>
</MoralisDappProvider>
</MoralisProvider>
</WalletConnectProvider>
);
};
export default Providers;
and here my cryptoAuth.tsx
import React, { useState, createRef, useRef, useEffect } from “react”;
import {
StyleSheet,
TextInput,
View,
Text,
ScrollView,
Image,
Keyboard,
TouchableOpacity,
KeyboardAvoidingView,
Linking,
Animated,
Dimensions,
ImageBackground,
} from “react-native”;
import {
Button,
Paragraph,
Dialog,
Portal,
Provider,
ActivityIndicator,
} from “react-native-paper”;
import {
useMoralis,
useMoralisWeb3Api,
useMoralisWeb3ApiCall,
} from “react-moralis”;
import { useWalletConnect } from “…/WalletConnect”;
import LottieView from “lottie-react-native”;
import AsyncStorage from “@react-native-async-storage/async-storage”;
import Animation from “…/splashLottie.json”;
import { KeyboardAwareScrollView } from “react-native-keyboard-aware-scroll-view”;
// import Loader from ‘./Components/Loader’;
const SCREEN_HEIGHT: number = Math.round(Dimensions.get(‘window’).height)
const SCREEN_WIDTH: number = Math.round(Dimensions.get(‘window’).width)
const LoginScreen = ({navigation}) => {
const connector = useWalletConnect();
const {
authenticate,
authError,
isAuthenticating,
isAuthenticated,
logout,
Moralis,
} = useMoralis();
const [userEmail, setUserEmail] = useState("");
const [userPassword, setUserPassword] = useState("");
const [loading, setLoading] = useState(false);
const [errortext, setErrortext] = useState("");
const [visible, setVisible] = React.useState(false);
const showDialog = () => setVisible(true);
const hideDialog = () => setVisible(false);
const passwordInputRef = createRef();
function handleCryptoLogin() {
authenticate( {connector})
.then(() => {
if (authError) {
setErrortext(authError.message);
setVisible(true);
} else {
if (isAuthenticated) {
navigation.navigate(“Home”);
}
}
})
.catch(() => {});
};
useEffect(() => {
isAuthenticated && navigation.navigate(“Home”);
}, [isAuthenticated]);
return (
<Image
style={{ flex: 1 }}
source={require("../../assets/Ize-png.png")}
/>
<View style={{ flex: 1 }}>
<View style={{
alignItems: "center" }}>
<LottieView source={Animation} loop autoPlay />
<Image
source={require("../../assets/IzeBho-real.png")}
style={{
width: "50%",
height: 100,
resizeMode: "contain",
margin: 30,
}}
/>
</View>
<View>
{authError && (
<Portal>
<Dialog visible={visible} onDismiss={hideDialog}>
<Dialog.Title>Authentication error:</Dialog.Title>
<Dialog.Content>
<Paragraph>
{authError ? authError.message : ""}
</Paragraph>
</Dialog.Content>
<Dialog.Actions>
<Button onPress={hideDialog}>Done</Button>
</Dialog.Actions>
</Dialog>
</Portal>
)}
{isAuthenticating && (
<ActivityIndicator animating={true} color={"#694fad"} />
)}
</View>
<TouchableOpacity
style={styles.buttonStyle}
activeOpacity={0.5}
onPress={handleCryptoLogin}>
<Text style={styles.buttonTextStyle}>Crypto Wallet Login</Text>
</TouchableOpacity>
{/*
<Text
style={styles.registerTextStyle}
onPress={() =>
Linking.openURL(“https://ethereum.org/en/wallets/”)
}>
What are wallets?
*/}
</View>
</KeyboardAwareScrollView>
</View>
</Provider>
);
};
export default LoginScreen;
const styles = StyleSheet.create({
mainBody: {
flex: 1,
justifyContent: “center”,
backgroundColor: “#e7eaf3”,
alignContent: “center”,
},
SectionStyle: {
flexDirection: “row”,
height: 40,
marginTop: 20,
marginLeft: 35,
marginRight: 35,
margin: 10,
},
buttonStyle: {
backgroundColor: “#694fad”,
borderWidth: 0,
color: “#e7eaf3”,
borderColor: “#694fad”,
height: 40,
alignItems: “center”,
borderRadius: 30,
marginLeft: 35,
marginRight: 35,
marginTop: 20,
marginBottom: 25,
},
buttonTextStyle: {
color: “#e7eaf3”,
paddingVertical: 10,
fontSize: 16,
fontWeight: “600”,
},
inputStyle: {
flex: 1,
color: “white”,
paddingLeft: 15,
paddingRight: 15,
borderWidth: 1,
borderRadius: 30,
borderColor: “#dadae8”,
},
errorTextStyle: {
color: “red”,
textAlign: “center”,
fontSize: 14,
},
});
{/*
registerTextStyle: {
color: “black”,
textAlign: “center”,
fontWeight: “bold”,
fontSize: 14,
alignSelf: “center”,
backgroundColor: “#e7eaf3”,
padding: 10,
},
*/}
and here is the error that i have been battling with
errors.js:39
Uncaught (in promise) Error: Provider not set or invalid
at Object.InvalidProvider (errors.js:39:1)
at RequestManager../node_modules/web3-core-requestmanager/lib/index.js.RequestManager.send (index.js:147:1)
at sendRequest (index.js:623:1)
at Eth.send [as getBlock] (index.js:655:1)
at ENS../node_modules/moralis/node_modules/web3-eth-ens/lib/ENS.js.ENS.checkNetwork (ENS.js:468:1)
at new Registry (Registry.js:38:1)
at ENS.get [as registry] (ENS.js:41:1)
at ENS.get [as resolverMethodHandler] (ENS.js:47:1)
at JSON.stringify (<anonymous>)
at Object.parseData (<anonymous>:8:116)
at <anonymous>:10:2186
at Array.reduce (<anonymous>)
at <anonymous>:10:2114
at i (<anonymous>:10:2685)
at <anonymous>:10:2972
at _ (<anonymous>:10:3098)
at <anonymous>:10:3342
at <anonymous>:347:34
at Array.map (<anonymous>)
at Object.emit (<anonymous>:347:24)
at attachRenderer (react_devtools_backend.js:15640:12)
at react_devtools_backend.js:15652:5
at Map.forEach (<anonymous>)
at initBackend (react_devtools_backend.js:15651:18)
at setup (react_devtools_backend.js:12561:3)
at welcome (react_devtools_backend.js:12507:3)
InvalidProvider @ errors.js:39
./node_modules/web3-core-requestmanager/lib/index.js.RequestManager.send @ index.js:147
sendRequest @ index.js:623
send @ index.js:655
./node_modules/moralis/node_modules/web3-eth-ens/lib/ENS.js.ENS.checkNetwork @ ENS.js:468
Registry @ Registry.js:38
get @ ENS.js:41
get @ ENS.js:47
parseData @ VM67:8
(anonymous) @ VM67:10
(anonymous) @ VM67:10
i @ VM67:10
(anonymous) @ VM67:10
_ @ VM67:10
(anonymous) @ VM67:10
(anonymous) @ VM58:347
emit @ VM58:347
attachRenderer @ react_devtools_backend.js:15640
(anonymous) @ react_devtools_backend.js:15652
initBackend @ react_devtools_backend.js:15651
setup @ react_devtools_backend.js:12561
welcome @ react_devtools_backend.js:12507
Promise.then (async)
Registry @ Registry.js:38
get @ ENS.js:41
get @ ENS.js:47
parseData @ VM67:8
(anonymous) @ VM67:10
(anonymous) @ VM67:10
i @ VM67:10
(anonymous) @ VM67:10
_ @ VM67:10
(anonymous) @ VM67:10
(anonymous) @ VM58:347
emit @ VM58:347
attachRenderer @ react_devtools_backend.js:15640
(anonymous) @ react_devtools_backend.js:15652
initBackend @ react_devtools_backend.js:15651
setup @ react_devtools_backend.js:12561
welcome @ react_devtools_backend.js:12507
postMessage (async)
sayHelloToBackend @ contentScript.js:100
(anonymous) @ contentScript.js:148
setInterval (async)
115 @ contentScript.js:144
webpack_require @ contentScript.js:20
(anonymous) @ contentScript.js:84
(anonymous) @ contentScript.js:87
RESTController.js:302
POST https://jil5yvvpm3pd.usemoralis.com:2053/server/functions/getPluginSpecs net::ERR_NAME_NOT_RESOLVED
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
ajax @ RESTController.js:309
(anonymous) @ RESTController.js:416
Promise.then (async)
request @ RESTController.js:410
run @ Cloud.js:172
run @ Cloud.js:98
(anonymous) @ MoralisWeb3.js:652
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ MoralisWeb3.js:746
(anonymous) @ Parse.js:223
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ Parse.js:238
(anonymous) @ index.esm.js:3902
step @ index.esm.js:91
(anonymous) @ index.esm.js:72
(anonymous) @ index.esm.js:65
__awaiter @ index.esm.js:61
(anonymous) @ index.esm.js:3888
(anonymous) @ index.esm.js:3922
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
enqueueForceUpdate @ react-dom.development.js:12504
./node_modules/react/cjs/react.development.js.Component.forceUpdate @ react.development.js:384
AnimatedComponent._this._animatedPropsCallback @ createAnimatedComponent.js:103
update @ AnimatedProps.js:116
(anonymous) @ AnimatedValue.js:62
_flush @ AnimatedValue.js:61
_updateValue @ AnimatedValue.js:287
(anonymous) @ AnimatedValue.js:247
onUpdate @ TimingAnimation.js:125
requestAnimationFrame (async)
start @ TimingAnimation.js:96
start @ TimingAnimation.js:104
animate @ AnimatedValue.js:244
start @ AnimatedImplementation.js:147
start @ AnimatedImplementation.js:153
(anonymous) @ Card.tsx:200
componentDidMount @ Card.tsx:108
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
scheduleUpdateOnFiber @ react-dom.development.js:21881
updateContainer @ react-dom.development.js:25482
(anonymous) @ react-dom.development.js:26021
unbatchedUpdates @ react-dom.development.js:22431
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
render @ react-dom.development.js:26103
renderApplication @ renderApplication.js:23
run @ index.js:49
runApplication @ index.js:93
registerRootComponent @ registerRootComponent.tsx:14
(anonymous) @ index.js?41f5:36
./index.js @ index.js?41f5:36
webpack_require @ bootstrap:789
fn @ bootstrap:100
0 @ immutable.js:19
webpack_require @ bootstrap:789
(anonymous) @ bootstrap:856
(anonymous) @ bootstrap:856
Show 68 more frames
RESTController.js:302
POST https://jil5yvvpm3pd.usemoralis.com:2053/server/functions/getPluginSpecs net::ERR_NAME_NOT_RESOLVED
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
ajax @ RESTController.js:309
(anonymous) @ RESTController.js:416
Promise.then (async)
request @ RESTController.js:410
run @ Cloud.js:172
run @ Cloud.js:98
(anonymous) @ MoralisWeb3.js:652
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ MoralisWeb3.js:746
(anonymous) @ Parse.js:223
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ Parse.js:238
(anonymous) @ index.esm.js:3902
step @ index.esm.js:91
(anonymous) @ index.esm.js:72
(anonymous) @ index.esm.js:65
__awaiter @ index.esm.js:61
(anonymous) @ index.esm.js:3888
(anonymous) @ index.esm.js:3922
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
enqueueForceUpdate @ react-dom.development.js:12504
./node_modules/react/cjs/react.development.js.Component.forceUpdate @ react.development.js:384
AnimatedComponent._this._animatedPropsCallback @ createAnimatedComponent.js:103
update @ AnimatedProps.js:116
(anonymous) @ AnimatedValue.js:62
_flush @ AnimatedValue.js:61
_updateValue @ AnimatedValue.js:287
(anonymous) @ AnimatedValue.js:247
onUpdate @ TimingAnimation.js:125
requestAnimationFrame (async)
start @ TimingAnimation.js:96
start @ TimingAnimation.js:104
animate @ AnimatedValue.js:244
start @ AnimatedImplementation.js:147
start @ AnimatedImplementation.js:153
(anonymous) @ Card.tsx:200
componentDidMount @ Card.tsx:108
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
scheduleUpdateOnFiber @ react-dom.development.js:21881
updateContainer @ react-dom.development.js:25482
(anonymous) @ react-dom.development.js:26021
unbatchedUpdates @ react-dom.development.js:22431
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
render @ react-dom.development.js:26103
renderApplication @ renderApplication.js:23
run @ index.js:49
runApplication @ index.js:93
registerRootComponent @ registerRootComponent.tsx:14
(anonymous) @ index.js?41f5:36
./index.js @ index.js?41f5:36
webpack_require @ bootstrap:789
fn @ bootstrap:100
0 @ immutable.js:19
webpack_require @ bootstrap:789
(anonymous) @ bootstrap:856
(anonymous) @ bootstrap:856
Show 70 more frames
construct.js:25