diff --git a/packages/core/src/defineWalletSetup.ts b/packages/core/src/defineWalletSetup.ts index 16990c6a1..bd97a3a5c 100644 --- a/packages/core/src/defineWalletSetup.ts +++ b/packages/core/src/defineWalletSetup.ts @@ -4,11 +4,12 @@ import { getWalletSetupFuncHash } from './utils/getWalletSetupFuncHash' export type WalletSetupFunction = (context: BrowserContext, walletPage: Page) => Promise // TODO: This runs at least twice. Should we cache it somehow? -export function defineWalletSetup(fn: WalletSetupFunction) { +export function defineWalletSetup(walletPassword: string, fn: WalletSetupFunction) { const hash = getWalletSetupFuncHash(fn) return { hash, - fn + fn, + walletPassword } } diff --git a/packages/core/test/defineWalletSetup.test.ts b/packages/core/test/defineWalletSetup.test.ts index 454a8607e..03efba24f 100644 --- a/packages/core/test/defineWalletSetup.test.ts +++ b/packages/core/test/defineWalletSetup.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest' import { defineWalletSetup } from '../src/defineWalletSetup' +const PASSWORD = 'Quack Quack! 🦆' const EXPECTED_HASH = '69620d59802a61c6900f' const testWalletSetupFunction = async (): Promise => { @@ -13,9 +14,10 @@ const testWalletSetupFunction = async (): Promise => { } describe('defineWalletSetup', () => { - it('returns both hash and function', async () => { - const { hash, fn } = defineWalletSetup(testWalletSetupFunction) + it('returns hash, function and wallet password', async () => { + const { hash, fn, walletPassword } = defineWalletSetup(PASSWORD, testWalletSetupFunction) expect(hash).toEqual(EXPECTED_HASH) expect(fn.toString()).toEqual(testWalletSetupFunction.toString()) + expect(walletPassword).toEqual(PASSWORD) }) })