Skip to content

Commit e339fc2

Browse files
committed
Reduce calls to wallet
1 parent 19be638 commit e339fc2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/wallet/core/src/signers/session-manager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export class SessionManager implements SapientSigner {
7171
if (!imageHash) {
7272
throw new Error(`Session configuration not found for image hash ${imageHash}`)
7373
}
74+
return this._getTopologyForImageHash(imageHash)
75+
}
76+
77+
private async _getTopologyForImageHash(imageHash: Hex.Hex): Promise<SessionConfig.SessionsTopology> {
7478
const tree = await this.stateProvider.getTree(imageHash)
7579
if (!tree) {
7680
throw new Error(`Session configuration not found for image hash ${imageHash}`)
@@ -235,6 +239,7 @@ export class SessionManager implements SapientSigner {
235239
if ((await this.imageHash) !== imageHash) {
236240
throw new Error('Unexpected image hash')
237241
}
242+
const topology = await this._getTopologyForImageHash(imageHash)
238243
//FIXME Test chain id
239244
// if (this._provider) {
240245
// const providerChainId = await this._provider.request({
@@ -311,7 +316,7 @@ export class SessionManager implements SapientSigner {
311316

312317
const encodedSignature = SessionSignature.encodeSessionCallSignatures(
313318
signatures,
314-
await this.topology,
319+
topology,
315320
explicitSigners,
316321
implicitSigners,
317322
)

0 commit comments

Comments
 (0)