WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit bf23f6c

Browse files
committed
Update example apps to latest
1 parent 24d5f19 commit bf23f6c

File tree

5 files changed

+131
-630
lines changed

5 files changed

+131
-630
lines changed

demo/rn-bare-example/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const chainConfig = {
3434
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
3535
};
3636

37-
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
37+
const privateKeyProvider = new EthereumPrivateKeyProvider({
3838
config: {
3939
chainConfig,
4040
},
@@ -46,7 +46,7 @@ const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
4646
redirectUrl,
4747
// IMP END - Whitelist bundle ID
4848
network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks
49-
privateKeyProvider: ethereumPrivateKeyProvider,
49+
privateKeyProvider,
5050
});
5151
// IMP END - SDK Initialization
5252

demo/rn-bare-example/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/rn-expo-example/App.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ const chainConfig = {
3939
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
4040
};
4141

42-
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
42+
const privateKeyProvider = new EthereumPrivateKeyProvider({
4343
config: {
4444
chainConfig,
4545
},
4646
});
4747

4848
const web3auth = new Web3Auth(WebBrowser, SecureStore, {
4949
clientId,
50+
privateKeyProvider,
5051
// IMP START - Whitelist bundle ID
5152
redirectUrl,
5253
// IMP END - Whitelist bundle ID
@@ -64,11 +65,10 @@ export default function App() {
6465
const init = async () => {
6566
// IMP START - SDK Initialization
6667
await web3auth.init();
68+
// IMP END - SDK Initialization
6769

68-
if (web3auth.privKey) {
69-
await ethereumPrivateKeyProvider.setupProvider(web3auth.privKey);
70-
// IMP END - SDK Initialization
71-
setProvider(ethereumPrivateKeyProvider);
70+
if (web3auth.connected) {
71+
setProvider(web3auth.provider);
7272
setLoggedIn(true);
7373
}
7474
};
@@ -94,11 +94,10 @@ export default function App() {
9494
login_hint: email,
9595
},
9696
});
97+
// IMP END - Login
9798

98-
if (web3auth.privKey) {
99-
await ethereumPrivateKeyProvider.setupProvider(web3auth.privKey);
100-
// IMP END - Login
101-
setProvider(ethereumPrivateKeyProvider);
99+
if (web3auth.connected) {
100+
setProvider(web3auth.provider);
102101
uiConsole("Logged In");
103102
setLoggedIn(true);
104103
}
@@ -118,7 +117,7 @@ export default function App() {
118117
await web3auth.logout();
119118
// IMP END - Logout
120119

121-
if (!web3auth.privKey) {
120+
if (!web3auth.connected) {
122121
setProvider(null);
123122
uiConsole("Logged out");
124123
setLoggedIn(false);

0 commit comments

Comments
 (0)