Skip to content

Commit

Permalink
fix: Catch errors during signing with social login
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Oct 31, 2023
1 parent 1049858 commit 7526a76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/components/common/SocialSigner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const SocialSigner = ({
if (status === COREKIT_STATUS.LOGGED_IN) {
onLogin?.()
setLoginPending(false)
return
}

if (status === COREKIT_STATUS.REQUIRED_SHARE) {
Expand All @@ -96,7 +97,11 @@ export const SocialSigner = ({
() => {},
false,
)
return
}

// TODO: Show error if login fails
setLoginPending(false)
}

const isSocialLogin = isSocialLoginWallet(wallet?.label)
Expand Down
9 changes: 6 additions & 3 deletions src/services/mpc/SocialLoginModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ function MpcModule(): WalletInit {
* We have to fallback to web3ReadOnly for eth_estimateGas because the provider by Web3Auth does not expose / implement it.
*/
if ('eth_estimateGas' === request.method) {
web3ReadOnly?.send(request.method, request.params ?? []).then(resolve)
web3ReadOnly
?.send(request.method, request.params ?? [])
.then(resolve)
.catch(reject)
return
}

/*
* If the provider is defined we already have access to the accounts. So we can just reply with the current account.
*/
if ('eth_requestAccounts' === request.method) {
web3.request({ method: 'eth_accounts' }).then(resolve)
web3.request({ method: 'eth_accounts' }).then(resolve).catch(reject)
return
}

Expand All @@ -64,7 +67,7 @@ function MpcModule(): WalletInit {
}

// Default: we call the inner provider
web3.request(request).then(resolve)
web3.request(request).then(resolve).catch(reject)
return
} catch (error) {
reject(
Expand Down

0 comments on commit 7526a76

Please sign in to comment.