From b37ceff049dd17a7974fa6e414c9157f3901a1cb Mon Sep 17 00:00:00 2001 From: Hoang Dinh Date: Tue, 3 Dec 2024 17:00:25 +1000 Subject: [PATCH] prettier --- .../use-wallet/src/__tests__/wallets/kmd.test.ts | 2 +- .../src/__tests__/wallets/mnemonic.test.ts | 13 ++++++++++--- packages/use-wallet/src/wallets/mnemonic.ts | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/use-wallet/src/__tests__/wallets/kmd.test.ts b/packages/use-wallet/src/__tests__/wallets/kmd.test.ts index bb6564d8..9b8e51da 100644 --- a/packages/use-wallet/src/__tests__/wallets/kmd.test.ts +++ b/packages/use-wallet/src/__tests__/wallets/kmd.test.ts @@ -428,7 +428,7 @@ describe('KmdWallet', () => { it('should handle null from cancelled prompt', async () => { // Mock prompt to return null (user cancelled) - global.prompt = vi.fn().mockReturnValue(null) + global.prompt = vi.fn().mockReturnValue(null) mockKmd.listKeys.mockResolvedValueOnce({ addresses: [account1.address] }) await wallet.connect() diff --git a/packages/use-wallet/src/__tests__/wallets/mnemonic.test.ts b/packages/use-wallet/src/__tests__/wallets/mnemonic.test.ts index 6c096605..36209369 100644 --- a/packages/use-wallet/src/__tests__/wallets/mnemonic.test.ts +++ b/packages/use-wallet/src/__tests__/wallets/mnemonic.test.ts @@ -363,12 +363,16 @@ describe('MnemonicWallet', () => { }) describe('custom prompt for mnemonic', () => { - const MOCK_ACCOUNT_MNEMONIC = 'just aim reveal time update elegant column reunion lazy ritual room unusual notice camera forward couple quantum gym laundry absurd drill pyramid tip able outdoor' + const MOCK_ACCOUNT_MNEMONIC = + 'just aim reveal time update elegant column reunion lazy ritual room unusual notice camera forward couple quantum gym laundry absurd drill pyramid tip able outdoor' beforeEach(() => { wallet = new MnemonicWallet({ id: WalletId.MNEMONIC, - options: { promptForMnemonic: () => Promise.resolve(MOCK_ACCOUNT_MNEMONIC), persistToStorage: true }, + options: { + promptForMnemonic: () => Promise.resolve(MOCK_ACCOUNT_MNEMONIC), + persistToStorage: true + }, metadata: {}, getAlgodClient: {} as any, store, @@ -384,7 +388,10 @@ describe('MnemonicWallet', () => { await wallet.connect() expect(global.prompt).toHaveBeenCalledTimes(0) - expect(storageSetItemSpy).toHaveBeenCalledWith(LOCAL_STORAGE_MNEMONIC_KEY, MOCK_ACCOUNT_MNEMONIC) + expect(storageSetItemSpy).toHaveBeenCalledWith( + LOCAL_STORAGE_MNEMONIC_KEY, + MOCK_ACCOUNT_MNEMONIC + ) }) }) }) diff --git a/packages/use-wallet/src/wallets/mnemonic.ts b/packages/use-wallet/src/wallets/mnemonic.ts index 0d62b7fc..9f1ec475 100644 --- a/packages/use-wallet/src/wallets/mnemonic.ts +++ b/packages/use-wallet/src/wallets/mnemonic.ts @@ -15,7 +15,6 @@ interface MnemonicConstructor { export type MnemonicOptions = Partial> & Omit - export const LOCAL_STORAGE_MNEMONIC_KEY = `${LOCAL_STORAGE_KEY}_mnemonic` const ICON = `data:image/svg+xml;base64,${btoa(` @@ -41,7 +40,10 @@ export class MnemonicWallet extends BaseWallet { }: WalletConstructor) { super({ id, metadata, getAlgodClient, store, subscribe }) - const { persistToStorage = false, promptForMnemonic = () => Promise.resolve(prompt('Enter 25-word mnemonic passphrase:')) } = options || {} + const { + persistToStorage = false, + promptForMnemonic = () => Promise.resolve(prompt('Enter 25-word mnemonic passphrase:')) + } = options || {} this.options = { persistToStorage, promptForMnemonic } this.store = store