Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samobasquiat committed Dec 5, 2023
1 parent 082db78 commit 7d14aeb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion widget/embedded/src/containers/Wallets/Wallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Main(props: PropsWithChildren<PropTypes>) {
useSyncStoresWithConfig();

useEffect(() => {
void fetchMeta().catch();
void fetchMeta().catch(console.log);
}, []);

useEffect(() => {
Expand Down
16 changes: 9 additions & 7 deletions widget/embedded/src/containers/WidgetInfo/WidgetInfo.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import {

import { getPendingSwaps } from '../../utils/queue';

interface WidgetHistoryActions {
retrySwap: (pendingSwap: PendingSwap, meta: Meta) => void;
// Add other actions as needed
}

export class WidgetHistory {
private manager: Manager | undefined;
private retrySwap: (pendingSwap: PendingSwap, meta: Meta) => void;
private actions: WidgetHistoryActions;

constructor(
manager: Manager | undefined,
retrySwap: (pendingSwap: PendingSwap, meta: Meta) => void
) {
constructor(manager: Manager | undefined, actions: WidgetHistoryActions) {
this.manager = manager;
this.retrySwap = retrySwap;
this.actions = actions;
}

public getAllSwaps() {
Expand All @@ -40,7 +42,7 @@ export class WidgetHistory {
}

public retry(swap: PendingSwap, meta: Meta) {
return this.retrySwap(swap, meta);
return this.actions.retrySwap(swap, meta);
}

public cancel(id: string) {
Expand Down
4 changes: 2 additions & 2 deletions widget/embedded/src/containers/WidgetInfo/WidgetInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const WidgetInfoContext = createContext<

export function WidgetInfo(props: React.PropsWithChildren) {
const { manager } = useManager();
const retry = useQuoteStore.use.retry();
const history = new WidgetHistory(manager, retry);
const retrySwap = useQuoteStore.use.retry();
const history = new WidgetHistory(manager, { retrySwap });
const details = useWalletsStore.use.connectedWallets();
const isLoading = useWalletsStore.use.loading();
const totalBalance = calculateWalletUsdValue(details);
Expand Down

0 comments on commit 7d14aeb

Please sign in to comment.