Skip to content

Commit

Permalink
Merge branch 'main' into remove-get-icons-pt1
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago authored Sep 26, 2023
2 parents 179da76 + 88d5382 commit aac86a1
Show file tree
Hide file tree
Showing 7 changed files with 475 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/utils/hooks/assetsHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,7 @@ export const useIsLoading = () => {
export const useLastTimeUpdated = () => {
return useAppSelector(state => state.assets.lastTimeUpdated);
};

export const useGetLatestOperations = () => {
return useAppSelector(state => state.assets.latestOperations);
};
10 changes: 10 additions & 0 deletions src/utils/redux/slices/assetsSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});

Expand All @@ -51,6 +52,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});

store.dispatch(
Expand All @@ -76,6 +78,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});

Expand Down Expand Up @@ -109,6 +112,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});

Expand Down Expand Up @@ -136,6 +140,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});

Expand All @@ -161,6 +166,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});

Expand Down Expand Up @@ -194,6 +200,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});

store.dispatch(
Expand Down Expand Up @@ -229,6 +236,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
store.dispatch(networksActions.setCurrent(GHOSTNET));
});
Expand Down Expand Up @@ -263,6 +271,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});

store.dispatch(
Expand Down Expand Up @@ -298,6 +307,7 @@ describe("assetsSlice", () => {
refetchTrigger: 0,
lastTimeUpdated: null,
isLoading: false,
latestOperations: [],
});
});
});
7 changes: 6 additions & 1 deletion src/utils/redux/slices/assetsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DelegationOperation } from "@tzkt/sdk-api";
import { compact, groupBy, mapValues } from "lodash";
import accountsSlice from "./accountsSlice";
import { TezTransfer, TokenTransfer } from "../../../types/Transfer";
import { TzktAccount } from "../../tezos";
import { TzktAccount, TzktCombinedOperation } from "../../tezos";
import { fromRaw, RawTokenBalance, TokenBalance } from "../../../types/TokenBalance";
import { Delegate } from "../../../types/Delegate";
import { RawPkh } from "../../../types/Address";
Expand All @@ -18,6 +18,7 @@ type State = {
tez: Record<string, TezTransfer[] | undefined>;
tokens: Record<string, TokenTransfer[] | undefined>;
};
latestOperations: TzktCombinedOperation[];
delegations: Record<string, DelegationOperation | undefined>;
bakers: Delegate[];
conversionRate: number | null; // XTZ/USD conversion rate
Expand Down Expand Up @@ -50,6 +51,7 @@ const initialState: State = {
},
transfers: { tez: {}, tokens: {} },
delegations: {},
latestOperations: [],
bakers: [],
conversionRate: null,
refetchTrigger: 0,
Expand Down Expand Up @@ -136,6 +138,9 @@ const assetsSlice = createSlice({
setLastTimeUpdated: (state, { payload: lastTimeUpdated }: { payload: string }) => {
state.lastTimeUpdated = lastTimeUpdated;
},
updateOperations: (state, { payload }: { payload: TzktCombinedOperation[] }) => {
state.latestOperations = payload;
},
},
});

Expand Down
Loading

0 comments on commit aac86a1

Please sign in to comment.