Skip to content

Commit

Permalink
fix: fix webview screen sleep2s to sign next tx
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenQian committed Sep 6, 2024
1 parent a02171f commit 1c3f50d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/features/browser/BrowserWebViewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ const BrowserWebViewScreen = () => {
const signedTransaction =
await anchorProvider?.wallet.signTransaction(convertTx)
signedTransactions.push(signedTransaction)
await new Promise((resolve) => setTimeout(resolve, 2000))
} catch (e) {
throw new Error('Failed to sign transaction')
}
Expand Down
8 changes: 5 additions & 3 deletions src/features/keystone/KeystoneModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ const KeystoneModal = forwardRef(
message?: Buffer
}): Promise<Buffer | undefined> => {
const requestId = uuid.v4()
bottomSheetModalRef.current?.present()

// why need setTimeout? modal mounted --> sleep 1s --> modal present
setTimeout(() => {
bottomSheetModalRef.current?.present()
}, 1000)
if (transaction) {
setSolSignRequest({
requestId,
Expand Down Expand Up @@ -85,8 +87,8 @@ const KeystoneModal = forwardRef(
})
// listen the keystone signature event
eventEmitter.on(`keystoneSignature_${requestId}`, (signature) => {
promiseResolve(Buffer.from(signature, 'hex'))
bottomSheetModalRef.current?.dismiss()
promiseResolve(Buffer.from(signature, 'hex'))
})

eventEmitter.on('closeKeystoneSignatureModal', () => {
Expand Down

0 comments on commit 1c3f50d

Please sign in to comment.