Skip to content

Commit 5673a4c

Browse files
committed
Don't use temp manager
1 parent 2b881ae commit 5673a4c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

packages/wallet/dapp-client/src/ChainSessionManager.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -655,27 +655,22 @@ export class ChainSessionManager {
655655
): Promise<void> {
656656
if (!this.provider || !this.wallet)
657657
throw new InitializationError('Manager core components not ready for explicit session.')
658+
if (!this.sessionManager) throw new InitializationError('Main session manager is not initialized.')
659+
660+
const signerAddress = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey: pk }))
658661

659662
const maxRetries = allowRetries ? 3 : 1
660663
let lastError: Error | null = null
661664

662665
for (let attempt = 1; attempt <= maxRetries; attempt++) {
663666
try {
664-
const tempManager = new Signers.SessionManager(this.wallet, {
665-
sessionManagerAddress: Extensions.Rc3.sessions,
666-
provider: this.provider,
667-
})
668-
const topology = await tempManager.getTopology()
667+
const topology = await this.sessionManager.getTopology()
669668

670-
const signerAddress = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey: pk }))
671669
const permissions = SessionConfig.getSessionPermissions(topology, signerAddress)
672-
673670
if (!permissions) {
674671
throw new InitializationError(`Permissions not found for session key.`)
675672
}
676673

677-
if (!this.sessionManager) throw new InitializationError('Main session manager is not initialized.')
678-
679674
const explicitSigner = new Signers.Session.Explicit(pk, permissions)
680675
this.sessionManager = this.sessionManager.withExplicitSigner(explicitSigner)
681676

0 commit comments

Comments
 (0)