Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/widget/src/common/get-token-balances.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type { QueryClient } from "@tanstack/react-query";
import { EitherAsync, Right } from "purify-ts";
import type { SKWallet } from "../domain/types/wallet";
import { getDefaultTokens } from "../hooks/api/use-default-tokens";
import type { DashboardYieldCategory } from "../domain/types/yields";
import {
getDefaultTokens,
getYieldTypesForDashboardCategory,
} from "../hooks/api/use-default-tokens";
import { getTokenBalancesScan } from "../hooks/api/use-token-balances-scan";
import type { ApiClient } from "../providers/api/api-client";
import type { SettingsProps } from "../providers/settings/types";
Expand All @@ -11,6 +15,7 @@ export const getTokenBalances = ({
address,
apiClient,
network,
selectedDashboardYieldCategory,
queryClient,
tokensForEnabledYieldsOnly,
}: {
Expand All @@ -19,6 +24,7 @@ export const getTokenBalances = ({
apiClient: ApiClient;
queryClient: QueryClient;
network: SKWallet["network"];
selectedDashboardYieldCategory?: DashboardYieldCategory | null;
tokensForEnabledYieldsOnly: SettingsProps["tokensForEnabledYieldsOnly"];
}) =>
EitherAsync.fromPromise(() =>
Expand All @@ -28,6 +34,9 @@ export const getTokenBalances = ({
queryClient,
network: network ?? undefined,
enabledYieldsOnly: tokensForEnabledYieldsOnly,
yieldTypes: getYieldTypesForDashboardCategory(
selectedDashboardYieldCategory
),
}),
EitherAsync.liftEither(
Right({ additionalAddresses, address, network })
Expand Down
2 changes: 2 additions & 0 deletions packages/widget/src/domain/types/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type TransactionGasEstimate = {
export const ActionTypes = {
STAKE: "STAKE",
UNSTAKE: "UNSTAKE",
WITHDRAW_REQUEST: "WITHDRAW_REQUEST",
INSTANT_WITHDRAW: "INSTANT_WITHDRAW",
CLAIM_REWARDS: "CLAIM_REWARDS",
AUTO_SWEEP_UNSTAKE_REWARDS: "AUTO_SWEEP_UNSTAKE_REWARDS",
AUTO_SWEEP_WITHDRAW_REWARDS: "AUTO_SWEEP_WITHDRAW_REWARDS",
Expand Down
5 changes: 2 additions & 3 deletions packages/widget/src/domain/types/kyc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ export type KycGate =
};

type KycUrlSource = {
readonly status?: Pick<KycStatusResponseDto, "kycUrl"> | null;
readonly status?: Pick<KycStatusResponseDto, "authorizeUrl"> | null;
readonly yieldDto?: Yield | null;
};

export const getKycProviderName = (yieldDto: Yield | null | undefined) =>
yieldDto?.provider?.name ?? null;

export const getKycUrl = ({ status, yieldDto }: KycUrlSource) =>
status?.kycUrl ??
status?.authorizeUrl ??
yieldDto?.mechanics.requirements?.kyc?.authorizeUrl ??
yieldDto?.mechanics.requirements?.kycUrl ??
yieldDto?.provider?.website;

const getKycGateUrlFields = ({
Expand Down
8 changes: 7 additions & 1 deletion packages/widget/src/domain/types/token-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import type {
TokenBalanceScanResponseDto as LegacyTokenBalanceScanResponseDto,
YieldBalanceLabelDto as LegacyYieldBalanceLabelDto,
} from "../../generated/api/legacy";
import type { TokenDto } from "./tokens";

export type TokenBalanceScanDto = LegacyTokenBalanceScanDto;
export type TokenBalanceScanResponseDto = LegacyTokenBalanceScanResponseDto;
export type TokenBalanceScanResponseDto = Omit<
LegacyTokenBalanceScanResponseDto,
"token"
> & {
readonly token: TokenDto;
};
export type YieldBalanceLabelDto = LegacyYieldBalanceLabelDto;
Loading