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: using injection to Provider #99

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 15 additions & 10 deletions demo/redirect-flow-example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BN } from "bn.js";
import jwt, { Algorithm } from "jsonwebtoken";
import { flow } from "./flow";


import { EthereumSigningProvider } from "@web3auth-mpc/ethereum-provider";
const uiConsole = (...args: any[]): void => {
const el = document.querySelector("#console>p");
if (el) {
Expand Down Expand Up @@ -92,15 +92,20 @@ function App() {
await coreKitInstance.handleRedirectResult();
}

if (coreKitInstance.provider) {
setProvider(coreKitInstance.provider);
} else {
if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
coreKitInstance.setupProvider({ chainConfig: DEFAULT_CHAIN_CONFIG }).then(() => {
setProvider(coreKitInstance.provider);
});
}
}
// if (coreKitInstance.provider) {
// setProvider(coreKitInstance.provider);
// } else {
// if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
// coreKitInstance.setupProvider({ chainConfig: DEFAULT_CHAIN_CONFIG }).then(() => {
// setProvider(coreKitInstance.provider);
// });
// }
// }

const ethProvider = new EthereumSigningProvider({ config: { chainConfig : DEFAULT_CHAIN_CONFIG} });
await ethProvider.setupProvider(coreKitInstance)
setProvider(ethProvider.provider);


if (coreKitInstance.status === COREKIT_STATUS.REQUIRED_SHARE) {
uiConsole("required more shares, please enter your backup/ device factor key, or reset account unrecoverable once reset, please use it with caution]");
Expand Down
Loading