Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/fair-poets-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stakekit/widget": patch
---

feat: additional validator info
12 changes: 9 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@
"noInferrableTypes": "error",
"noUselessElse": "error"
},
"suspicious": { "noArrayIndexKey": "off" },
"suspicious": {
"noArrayIndexKey": "off",
"useIterableCallbackReturn": "off"
},
"a11y": { "noSvgWithoutTitle": "off" },
"correctness": { "useJsxKeyInIterable": "off" },
"complexity": { "noForEach": "off" }
"correctness": {
"useJsxKeyInIterable": "off",
"useUniqueElementIds": "off"
},
"complexity": { "noForEach": "off", "useIndexOf": "off" }
}
},
"javascript": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": "changeset version"
},
"devDependencies": {
"@biomejs/biome": "^2.1.2",
"@biomejs/biome": "^2.2.0",
"@changesets/cli": "^2.29.5",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@radix-ui/react-visually-hidden": "^1.2.3",
"@safe-global/safe-apps-provider": "^0.18.6",
"@safe-global/safe-apps-sdk": "^9.1.0",
"@stakekit/api-hooks": "0.0.108",
"@stakekit/api-hooks": "0.0.109",
"@stakekit/common": "^0.0.55",
"@stakekit/rainbowkit": "^2.2.6",
"@tanstack/react-query": "^5.83.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const useMetaInfo = ({
rewardType,
website,
nominatorCount,
subnetName,
marketCap,
tokenSymbol,
}: {
[Key in keyof Pick<
ValidatorDto,
Expand All @@ -30,6 +33,9 @@ export const useMetaInfo = ({
| "address"
| "website"
| "nominatorCount"
| "subnetName"
| "marketCap"
| "tokenSymbol"
>]: ValidatorDto[Key] | undefined;
} & {
stakedBalanceToken: YieldDto["token"] | undefined;
Expand All @@ -47,6 +53,9 @@ export const useMetaInfo = ({
| "address"
| "website"
| "nominatorCount"
| "subnetName"
| "marketCap"
| "tokenSymbol"
>]: { title: string; val: ReactNode } | null;
}>(
() => ({
Expand Down Expand Up @@ -115,6 +124,24 @@ export const useMetaInfo = ({
),
}
: null,
subnetName: subnetName
? {
title: t("details.validators_subnet_name"),
val: subnetName,
}
: null,
marketCap: marketCap
? {
title: t("details.validators_market_cap"),
val: formatNumber(marketCap, 2),
}
: null,
tokenSymbol: tokenSymbol
? {
title: t("details.validators_token_symbol"),
val: tokenSymbol,
}
: null,
}),
[
rewardRate,
Expand All @@ -127,6 +154,9 @@ export const useMetaInfo = ({
address,
website,
nominatorCount,
subnetName,
marketCap,
tokenSymbol,
]
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ export const SelectValidatorList = ({
stakedBalance={item.stakedBalance}
votingPower={item.votingPower}
nominatorCount={item.nominatorCount}
subnetName={item.subnetName}
marketCap={item.marketCap}
tokenSymbol={item.tokenSymbol}
rewardRate={undefined}
rewardType={undefined}
stakedBalanceToken={selectedStake.token}
Expand Down
8 changes: 0 additions & 8 deletions packages/widget/src/domain/types/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ export type TokenString = `${TokenDto["network"]}-${TokenDto["address"]}`;
export const isUSDeToken = (token: TokenDto) =>
token.network === EvmNetworks.ethereum &&
token.address === "0x4c9edd5852cd905f086c759e8383e09bff1e68b3";

export const bittensorAlphaToken: TokenDto = {
name: "Alpha",
network: "bittensor",
symbol: "Alpha",
decimals: 9,
logoURI: "https://assets.stakek.it/tokens/tao.svg",
};
2 changes: 1 addition & 1 deletion packages/widget/src/hooks/use-estimated-rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useEstimatedRewards = ({

/**
* If the selected stake is a bittensor staking, we need to divide the stake amount by the price per share
* to convert to Alpha token
* to convert to subnet token
*/
const correctAmount = useMemo(() => {
return selectedStake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
stakeTokenSameAsGasToken,
tokenString,
} from "../../../../domain";
import { bittensorAlphaToken } from "../../../../domain/types/tokens";
import {
type ExtendedYieldType,
getExtendedYieldType,
Expand Down Expand Up @@ -133,9 +132,10 @@ export const EarnPageContextProvider = ({ children }: PropsWithChildren) => {
const rewardsTokenSymbol = useMemo(() => {
return selectedStake
.filter((val) => isBittensorStaking(val.id))
.map(() => bittensorAlphaToken.symbol)
.chain(() => List.head([...selectedValidators.values()]))
.map((validator) => validator.tokenSymbol ?? "")
.orDefault(symbol);
}, [selectedStake, symbol]);
}, [selectedStake, symbol, selectedValidators]);

const formattedPrice = useMemo(
() =>
Expand Down
5 changes: 4 additions & 1 deletion packages/widget/src/translation/English/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@
"validators_address": "Address",
"validators_comission": "Commission",
"validators_website": "Website",
"validators_nominator_count": "Nominator count"
"validators_nominator_count": "Nominator count",
"validators_subnet_name": "Subnet name",
"validators_market_cap": "Market cap",
"validators_token_symbol": "Token symbol"
},
"dashboard": {
"details": {
Expand Down
70 changes: 62 additions & 8 deletions packages/widget/src/translation/French/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"earn": "Earn",
"estimated_reward": "Récompenses estimées",
"earn_with": "Earn avec",
"restake_with": "Restake avec",
"additional_info": "Infos supplémentaires",
"rewards": {
"receive": "Vous recevrez des <symbols1></symbols1> via",
Expand All @@ -66,6 +67,10 @@
"no_opportunities": "Pas d'opportunité de yield pour ce token",
"selected_validators_one": "{{providerName}}",
"selected_validators_other": "{{providerName}} + {{count}} autres",
"campaign_susd_description": "Après avoir staké sUSD, la position est bloquée jusqu'au 20 avril 2026.",
"campaign_susd_extra": "Les récompenses gagnées sont distribuées périodiquement sous forme de SNX et se débloquent linéairement sur 3 mois après la fin du programme.",
"campaign_susd_position_locked": "La position est bloquée jusqu'au 20 avril 2026. <link0>En savoir plus</link0>",
"campaign_susd": "En savoir plus sur le programme de staking sUSD <link0>ici</link0>",
"campaign": "Les récompenses sont bloquées jusqu'au 28 mai 2026. Les retraits anticipés peuvent entraîner des pénalités. <link0>En savoir plus</link0>",
"lockup_period": "La période de blocage minimum est de {{days}} jours",
"native_staking": {
Expand All @@ -78,6 +83,7 @@
},
"vault": {
"description": "En déposant du {{stakeToken}} vous recevrez du {{depositToken}}. Vous pouvez trader cet actif liquide à tout moment",
"description_ethena_usde": "En déposant du {{stakeToken}} vous recevrez du {{depositToken}}.",
"earn_after_warmup_one": "Vous commencerez à être récompensé {{count}} jour après avoir fourni vos actifs",
"earn_after_warmup_other": "Vous commencerez à être récompensé {{count}} jours après avoir fourni vos actifs",
"earn_yield_auto": "Le yield gagné est mis à jour chaque {{rewardSchedule}} et se cumule automatiquement",
Expand Down Expand Up @@ -121,6 +127,7 @@
"opportunity_search_title": "Sélectionnez un rendement",
"validator_search_title_one": "Sélectionnez un validateur",
"validator_search_title_other": "Sélectionnez des validateurs",
"provider_search_title": "Sélectionnez un fournisseur",
"reward_token": "Vous recevrez des <symbols1></symbols1> <highlight2>via {{providerName}}</highlight2>",
"tabs": {
"earn": "Earn",
Expand All @@ -137,7 +144,10 @@
"validators_address": "Adresse",
"validators_comission": "Commission",
"validators_website": "Site web",
"validators_nominator_count": "Nombre de nominators"
"validators_nominator_count": "Nombre de nominators",
"validators_subnet_name": "Nom du sous-réseau",
"validators_market_cap": "Capitalisation boursière",
"validators_token_symbol": "Symbole du token"
},
"review": {
"estimated_reward": "Récompenses estimées",
Expand Down Expand Up @@ -178,10 +188,13 @@
"DEPOSIT": "DÉPÔT",
"APPROVAL": "APPROBATION",
"STAKE": "MISE",
"STAKE_ETHENA_USDE": "DÉPÔT",
"CLAIM_UNSTAKED": "RÉCLAMER NON MIS",
"CLAIM_UNSTAKED_ETHENA_USDE": "RÉCLAMER",
"CLAIM_REWARDS": "RÉCLAMER RÉCOMPENSES",
"RESTAKE_REWARDS": "REMISE DES RÉCOMPENSES",
"UNSTAKE": "RETIRER",
"UNSTAKE_ETHENA_USDE": "REFROIDISSEMENT",
"SPLIT": "DIVISER",
"MERGE": "FUSIONNER",
"LOCK": "VERROUILLER",
Expand Down Expand Up @@ -215,7 +228,15 @@
"INFSTONES_EXIT_REQUEST": "DEMANDE DE SORTIE INFSTONES",
"INFSTONES_CLAIM_REQUEST": "DEMANDE DE RÉCLAMATION INFSTONES",
"WRAP": "ENVELOPER",
"UNWRAP": "DÉENVELOPER"
"UNWRAP": "DÉENVELOPER",
"DELEGATE": "DÉLÉGUER",
"UNDELEGATE": "ANNULER DÉLÉGATION",
"VERIFY_WITHDRAW_CREDENTIALS": "VÉRIFIER IDENTIFIANTS RETRAIT",
"CREATE_EIGENPOD": "CRÉER EIGENPOD",
"START_CHECKPOINT": "DÉMARRER CHECKPOINT",
"VERIFY_CHECKPOINT_PROOFS": "VÉRIFIER PREUVES CHECKPOINT",
"QUEUE_WITHDRAWALS": "METTRE EN FILE RETRAITS",
"COMPLETE_QUEUED_WITHDRAWALS": "COMPLÉTER RETRAITS EN FILE"
}
},
"complete": {
Expand All @@ -224,9 +245,11 @@
"successfully_pending_action": "{{amount}} {{tokenNetwork}} {{pendingAction}} avec succès",
"view_transaction": "Voir la transaction {{type}}",
"via": "via {{providerName}}",
"continue": "Aller au tableau de bord Earn",
"continue": "Aller au tableau de bord Aperçu",
"continue_ledger": "Aller au tableau de bord Earn",
"stake": {
"staking": "staké",
"staking_ethena_usde": "déposé",
"liquid-staking": "staké",
"vault": "déposé",
"lending": "fourni",
Expand All @@ -236,6 +259,7 @@
},
"unstake": {
"staking": "déstaké",
"staking_ethena_usde": "retiré",
"liquid-staking": "déstaké",
"vault": "retiré",
"lending": "retiré",
Expand All @@ -251,6 +275,7 @@
"withdraw": "reitré",
"restake": "restaké",
"claim_unstaked": "déstakés réclamés",
"claim_unstaked_ethena_usde": "réclamé",
"unlock_locked": "bloqués débloqués",
"unlock_locked_legacy": "bloqués débloqués",
"stake_locked": "bloqués stakés",
Expand All @@ -260,7 +285,15 @@
"revote": "Revoter",
"rebond": "Re-staker",
"migrate": "Migrer",
"withdraw_all": "Retirer tout"
"withdraw_all": "Retirer tout",
"verify_withdraw_credentials": "identifiants de retrait vérifiés",
"delegate": "délégué",
"undelegate": "délégation annulée",
"create_eigenpod": "eigenpod créé",
"start_checkpoint": "checkpoint démarré",
"verify_checkpoint_proofs": "preuves de checkpoint vérifiées",
"queue_withdrawals": "retraits mis en file",
"complete_queued_withdrawals": "retraits en file complétés"
}
},
"help_modals": {
Expand Down Expand Up @@ -396,6 +429,7 @@
"withdraw_all": "Retirer tout",
"restake": "Restaker",
"claim_unstaked": "Réclamer les déstakés",
"claim_unstaked_ethena_usde": "Réclamer",
"unlock_locked": "Débloquer",
"unlock_locked_legacy": "Débloquer",
"stake_locked": "Staker",
Expand All @@ -404,7 +438,15 @@
"vote_locked": "Voter",
"revote": "Revoter",
"rebond": "Re-staker",
"migrate": "Migrer"
"migrate": "Migrer",
"verify_withdraw_credentials": "Vérifier identifiants de retrait",
"delegate": "Déléguer",
"undelegate": "Annuler délégation",
"create_eigenpod": "Créer eigenpod",
"start_checkpoint": "Démarrer checkpoint",
"verify_checkpoint_proofs": "Vérifier preuves checkpoint",
"queue_withdrawals": "Mettre en file retraits",
"complete_queued_withdrawals": "Compléter retraits en file"
},
"pending_action_button": {
"stake": "Staker",
Expand All @@ -423,7 +465,9 @@
"vote_locked": "Voter bloqué",
"revote": "Revoter",
"rebond": "Re-staker",
"migrate": "Migrer"
"migrate": "Migrer",
"verify_withdraw_credentials": "Vérifier identifiants de retrait",
"delegate": "Déléguer"
},
"unstake_sign": {
"title": "Vérifier la propriété",
Expand All @@ -444,6 +488,7 @@
"withdraw_all": "Retirer tout de {{providerName}}",
"restake": "Restaker avec {{providerName}}",
"claim_unstaked": "Réclamer le déstaké de {{providerName}}",
"claim_unstaked_ethena_usde": "Réclamer de {{providerName}}",
"unlock_locked": "Débloquer le bloqué de {{providerName}}",
"unlock_locked_legacy": "Débloquer le bloqué de {{providerName}}",
"stake_locked": "Staker le bloqué avec {{providerName}}",
Expand All @@ -452,7 +497,9 @@
"vote_locked": "Voter bloqué avec {{providerName}}",
"revote": "Revoter avec {{providerName}}",
"rebond": "Re-staker avec {{providerName}}",
"migrate": "Migrer de {{providerName}}"
"migrate": "Migrer de {{providerName}}",
"verify_withdraw_credentials": "Vérifier identifiants de retrait de {{providerName}}",
"delegate": "Déléguer avec {{providerName}}"
}
},
"select_token": {
Expand All @@ -463,14 +510,21 @@
"error_modal": {
"solution": "Solution potentielle :"
},
"chain_modal_disclaimer": "Alimenté par Yield.xyz",
"dashboard": {
"details": {
"tabs": {
"overview": "Aperçu",
"rewards": "Récompenses",
"activity": "Activité"
},
"positions_tooltip": "Les positions sont vos soldes actuellement stakés sur le réseau."
"positions_tooltip": "Les positions sont vos soldes liés au rendement sur le réseau.",
"positions_yield": "Rendement",
"positions_reward_rate": "Taux de récompense",
"positions_amount": "Montant",
"positions_rewards": "Récompenses",
"positions_connect_wallet": "Connectez un portefeuille pour voir vos positions",
"activity_connect_wallet": "Connectez un portefeuille pour voir votre activité"
},
"position_details_info": {
"balances": "Soldes"
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/tests/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const originalConsoleError = console.error;
const originalConsoleLog = console.log;

const originalStdoutWrite = process.stdout.write.bind(process.stdout);
//@ts-ignore
//@ts-expect-error
process.stdout.write = (chunk, encoding, callback) => {
if (typeof chunk === "string" && chunk.includes("relay.walletconnect")) {
return true;
Expand Down
Loading