diff --git a/src/frontend/src/lib/stores/transactions.store.ts b/src/frontend/src/lib/stores/transactions.store.ts index be5beb3715..c1c3412421 100644 --- a/src/frontend/src/lib/stores/transactions.store.ts +++ b/src/frontend/src/lib/stores/transactions.store.ts @@ -16,6 +16,7 @@ export interface TransactionsStore extends CertifiedStore append: (params: { tokenId: TokenId; transactions: CertifiedTransaction[] }) => void; cleanUp: (params: { tokenId: TokenId; transactionIds: string[] }) => void; nullify: (tokenId: TokenId) => void; + resetAll: () => void; } export const initTransactionsStore = < @@ -64,6 +65,7 @@ export const initTransactionsStore = < [tokenId]: null })), reset, + resetAll: () => update(() => ({})), subscribe }; }; diff --git a/src/frontend/src/tests/lib/stores/transactions.store.spec.ts b/src/frontend/src/tests/lib/stores/transactions.store.spec.ts index ca58a40472..7e99605148 100644 --- a/src/frontend/src/tests/lib/stores/transactions.store.spec.ts +++ b/src/frontend/src/tests/lib/stores/transactions.store.spec.ts @@ -227,4 +227,21 @@ describe('transactions.store', () => { })(); })); }); + + describe('resetAll', () => { + it('should clear all transactions and keys', () => + new Promise((done) => { + const store = initTransactionsStore(); + + const transactions = [createCertifiedIcTransactionUiMock('tx1')]; + store.append({ tokenId, transactions }); + store.resetAll(); + + store.subscribe((state) => { + expect(state).toEqual({}); + + done(); + })(); + })); + }); });