feat: reuse existing bunker connection on account switch (#401)

This commit is contained in:
hoppe 2025-06-23 10:56:08 +09:00 committed by GitHub
parent 4e80d59c1c
commit f66ca6346f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -12,7 +12,7 @@ export class BunkerSigner implements ISigner {
this.clientSecretKey = clientSecretKey ? hexToBytes(clientSecretKey) : generateSecretKey()
}
async login(bunker: string): Promise<string> {
async login(bunker: string, isInitialConnection = true): Promise<string> {
const bunkerPointer = await parseBunkerInput(bunker)
if (!bunkerPointer) {
throw new Error('Invalid bunker')
@ -23,7 +23,9 @@ export class BunkerSigner implements ISigner {
window.open(url, '_blank')
}
})
await this.signer.connect()
if (isInitialConnection) {
await this.signer.connect()
}
return await this.signer.getPublicKey()
}