diff --git a/packages/starknet-snap/src/utils/snap-state.ts b/packages/starknet-snap/src/utils/snap-state.ts index 6902ba76..310bd345 100644 --- a/packages/starknet-snap/src/utils/snap-state.ts +++ b/packages/starknet-snap/src/utils/snap-state.ts @@ -67,10 +67,10 @@ export abstract class SnapStateManager { * * @param callback - A Promise function that takes the state as an argument. */ - public async withTransaction( - callback: (state: State) => Promise, - ): Promise { - await this.mtx.runExclusive(async () => { + public async withTransaction( + callback: (state: State) => Promise, + ): Promise { + return await this.mtx.runExclusive(async () => { await this.#beginTransaction(); if ( @@ -88,8 +88,9 @@ export abstract class SnapStateManager { ); try { - await callback(this.#transaction.current); + const result = await callback(this.#transaction.current); await this.set(this.#transaction.current); + return result; } catch (error) { logger.info( `SnapStateManager.withTransaction [${