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/config api #96

Merged
merged 8 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions demo/rn-bare-example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
singleQuote: false,
semi: true,
trailingComma: 'es5',
printWidth: 150,
};
12 changes: 6 additions & 6 deletions demo/rn-bare-example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import {
TextInput,
View,
} from 'react-native';
import {useEffect, useState} from 'react';
import Web3Auth, {
IWeb3Auth,
LOGIN_PROVIDER,
OpenloginUserInfo,
} from '@web3auth/react-native-sdk';
import { useEffect, useState } from 'react';

import {ChainNamespace} from '@web3auth/react-native-sdk';
import { ChainNamespace } from '@web3auth/react-native-sdk';
import EncryptedStorage from 'react-native-encrypted-storage';
import RPC from './ethersRPC'; // for using ethers.js

const scheme = 'web3authrnbareexample'; // Or your desired app redirection scheme
const resolvedRedirectUrl = `${scheme}://openlogin`;
const clientId =
'BHr_dKcxC0ecKn_2dZQmQeNdjPgWykMkcodEHkVvPMo71qzOV6SgtoN8KCvFdLN7bf34JOm89vWQMLFmSfIo84A';
'BFuUqebV5I8Pz5F7a5A2ihW7YVmbv_OHXnHYDv6OltAD5NGr6e-ViNvde3U4BHdn6HvwfkgobhVu4VwC-OSJkik';

const chainConfig = {
chainNamespace: ChainNamespace.EIP155,
Expand All @@ -44,7 +44,7 @@ export default function App() {
const [key, setKey] = useState<string | undefined>('');
const [console, setConsole] = useState<string>('');
const [web3auth, setWeb3Auth] = useState<IWeb3Auth | null>(null);
const [email, setEmail] = useState('yash@tor.us');
const [email, setEmail] = useState('hello@tor.us');

const login = async () => {
try {
Expand Down Expand Up @@ -209,7 +209,7 @@ export default function App() {
const init = async () => {
const auth = new Web3Auth(WebBrowser, EncryptedStorage, {
clientId,
network: 'testnet', // or other networks
network: 'sapphire_devnet', // or other networks
useCoreKitKey: false,
loginConfig: {},
enableLogging: true,
Expand Down Expand Up @@ -303,7 +303,7 @@ export default function App() {
onChangeText={text => setEmail(text)}
value={email}
// eslint-disable-next-line react-native/no-inline-styles
style={{padding: 10}}
style={{ padding: 10 }}
/>
<Button title="Login with Web3Auth" onPress={login} />
</View>
Expand Down
2 changes: 1 addition & 1 deletion demo/rn-bare-example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
presets: ["module:@react-native/babel-preset"],
};
14 changes: 0 additions & 14 deletions demo/rn-bare-example/globals.js

This file was deleted.

17 changes: 17 additions & 0 deletions demo/rn-bare-example/globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { install } from "react-native-quick-crypto";

install();

// Needed so that 'stream-http' chooses the right default protocol.
// @ts-ignore
global.location = {
protocol: "file:",
};
// @ts-ignore
global.process.version = "v16.0.0";
if (!global.process.version) {
global.process = require("process");
console.log({ process: global.process });
}
// @ts-ignore
process.browser = true;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AppRegistry } from "react-native";
import "react-native-get-random-values";
import "./globals";
import App from "./App";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent(appName, () => App);
Loading