Skip to content

Commit

Permalink
Index: show prompt untill success
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia1ch committed Dec 22, 2023
1 parent 9d5128d commit c631d84
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/neuron-ui/src/components/Perun/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ const Perun = () => {
}, [perunState])

const handleSigningRequest = async (password: string) => {
setShowPrompt(false)
const handleSignMessage = async (request: any) => {
const addressBytes = request.pubkey.data
// Uint8Array -> String
Expand All @@ -150,20 +149,17 @@ const Perun = () => {
data: res.result,
},
})
setShowPasswordDialog(false)
} else if (res.status === ErrorCode.PasswordIncorrect) {
setShowPasswordDialog(false)
showErrorMessage('Error', 'Password incorrect')
} else if (res.status === ErrorCode.AddressNotFound) {
setShowPasswordDialog(false)
showErrorMessage('Error', 'Address not found')
}
setShowPrompt(false)
setShowPasswordDialog(false)
return res
}

const handleSignTransaction = async (request: any) => {
setShowPrompt(false)
console.log('handleSignTransaction', request)
console.log('inputs', request.transaction.inputs)
// TODO: Inject NetworkType.
Expand All @@ -180,6 +176,7 @@ const Perun = () => {

if (!isSuccessResponse(res)) {
showErrorMessage('Error', errorFormatter(res.message, t))
setShowPrompt(false)
setShowPasswordDialog(false)
return res
}
Expand Down Expand Up @@ -247,6 +244,7 @@ const Perun = () => {
data: JSON.stringify(compatibleTx),
},
})
setShowPrompt(false)
setShowPasswordDialog(false)
return res
}
Expand Down

0 comments on commit c631d84

Please sign in to comment.