Skip to content

Commit 284db0b

Browse files
committed
image hash for sapient signers always defined
1 parent 7d6f79c commit 284db0b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

packages/wallet/core/src/signers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface Signer {
2020

2121
export interface SapientSigner {
2222
readonly address: MaybePromise<Address.Address>
23-
readonly imageHash: MaybePromise<Hex.Hex | undefined>
23+
readonly imageHash: MaybePromise<Hex.Hex>
2424

2525
signSapient: (
2626
wallet: Address.Address,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ export class SessionManager implements SapientSigner {
4949
this._provider = options.provider
5050
}
5151

52-
get imageHash(): Promise<Hex.Hex | undefined> {
52+
get imageHash(): Promise<Hex.Hex> {
5353
return this.getImageHash()
5454
}
5555

56-
async getImageHash(): Promise<Hex.Hex | undefined> {
56+
async getImageHash(): Promise<Hex.Hex> {
5757
const { configuration } = await this.wallet.getStatus()
5858
const sessionConfigLeaf = Config.findSignerLeaf(configuration, this.address)
5959
if (!sessionConfigLeaf || !Config.isSapientSignerLeaf(sessionConfigLeaf)) {
60-
return undefined
60+
throw new Error(`Session configuration not found for wallet ${this.wallet.address}`)
6161
}
6262
return sessionConfigLeaf.imageHash
6363
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,9 +898,7 @@ export class ChainSessionManager {
898898
...envelope.payload,
899899
parentWallets: [this.wallet.address],
900900
}
901-
const imageHash = await this.sessionManager.imageHash
902-
if (imageHash === undefined) throw new SessionConfigError('Session manager image hash is undefined')
903-
901+
const imageHash = await this.sessionManager.getImageHash()
904902
const signature = await this.sessionManager.signSapient(
905903
this.wallet.address,
906904
this.chainId,

0 commit comments

Comments
 (0)