fix token names in toast messages

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-08-11 21:07:42 +03:00
parent 3348a99155
commit 9b1c8c0f09
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
5 changed files with 47 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "ghost-dao-interface", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.2.2", "version": "0.2.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -19,7 +19,7 @@ const ClaimConfirmationModal = (props) => {
switch (props.action.toUpperCase()) { switch (props.action.toUpperCase()) {
case "FORFEIT": case "FORFEIT":
await forfeit(props.chainId, props.receiver); await forfeit(props.chainId, props.receiver, props.ftsoSymbol);
break; break;
case "CLAIM": case "CLAIM":
await claim( await claim(

View File

@ -91,6 +91,7 @@ export const ClaimsArea = ({ chainId, address, epoch }) => {
outputToken={claim.expiry > epoch.number ? ftsoSymbol : isPayoutGhst ? ghstSymbol : stnkSymbol} outputToken={claim.expiry > epoch.number ? ftsoSymbol : isPayoutGhst ? ghstSymbol : stnkSymbol}
stnkSymbol={stnkSymbol} stnkSymbol={stnkSymbol}
ghstSymbol={ghstSymbol} ghstSymbol={ghstSymbol}
ftsoSymbol={ftsoSymbol}
action={claim.expiry > epoch.number ? "forfeit" : "claim"} action={claim.expiry > epoch.number ? "forfeit" : "claim"}
chainId={chainId} chainId={chainId}
/> />

View File

@ -71,18 +71,46 @@ const StakeConfirmationModal = (props) => {
switch (props.action) { switch (props.action) {
case "STAKE": case "STAKE":
isRebase = props.bottomToken.toUpperCase() === "STNK"; isRebase = props.bottomToken === props.stnkSymbol;
await stake(props.chainId, props.address, actionAmount._value.toBigInt(), isRebase, props.isClaim); await stake(
props.chainId,
props.address,
actionAmount._value.toBigInt(),
isRebase,
props.isClaim,
props.ftsoSymbol,
props.stnkSymbol,
props.ghstSymbol
);
break; break;
case "UNSTAKE": case "UNSTAKE":
isRebase = props.upperToken.toUpperCase() === "STNK"; isRebase = props.upperToken === stnkSymbol;
await unstake(props.chainId, props.address, actionAmount._value.toBigInt(), props.isTrigger, isRebase); await unstake(
props.chainId,
props.address,
actionAmount._value.toBigInt(),
props.isTrigger,
isRebase,
props.ftsoSymbol,
props.stnkSymbol,
props.ghstSymbol
);
break; break;
case "WRAP": case "WRAP":
await wrap(props.chainId, props.address, actionAmount._value.toBigInt()); await wrap(
props.chainId,
props.address,
actionAmount._value.toBigInt(),
props.ghstSymbol
);
break; break;
case "UNWRAP": case "UNWRAP":
await unwrap(props.chainId, props.address, actionAmount._value.toBigInt()); await unwrap(
props.chainId,
props.address,
actionAmount._value.toBigInt(),
props.stnkSymbol
);
break; break;
default: default:
console.log("Wrong action to be executed!"); console.log("Wrong action to be executed!");

View File

@ -113,7 +113,7 @@ export const useGhostedSupply = (chainId) => {
return ghostedSupply; return ghostedSupply;
} }
export const stake = async (chainId, account, amount, isRebase, isClaim) => { export const stake = async (chainId, account, amount, isRebase, isClaim, ftsoSymbol, stnkSymbol, ghstSymbol) => {
const args = [ const args = [
amount, amount,
account, account,
@ -122,7 +122,7 @@ export const stake = async (chainId, account, amount, isRebase, isClaim) => {
]; ];
const messages = { const messages = {
replacedMsg: "Staking transaction was replaced. Wait for inclusion please.", replacedMsg: "Staking transaction was replaced. Wait for inclusion please.",
successMsg: `FTSO tokens staked successfully! Wait for the warmup period to claim your ${isRebase ? "STNK" : "GHST"}.`, successMsg: `${ftsoSymbol} tokens staked successfully! Wait for the warmup period to claim your ${isRebase ? stnkSymbol : ghstSymbol}.`,
errorMsg: "Staking transaction failed. Check logs for error detalization.", errorMsg: "Staking transaction failed. Check logs for error detalization.",
}; };
await executeOnChainTransaction( await executeOnChainTransaction(
@ -134,7 +134,7 @@ export const stake = async (chainId, account, amount, isRebase, isClaim) => {
); );
} }
export const unstake = async (chainId, account, amount, isTrigger, isRebase) => { export const unstake = async (chainId, account, amount, isTrigger, isRebase, ftsoSymbol, stnkSymbol, ghstSymbol) => {
const args = [ const args = [
amount, amount,
account, account,
@ -143,7 +143,7 @@ export const unstake = async (chainId, account, amount, isTrigger, isRebase) =>
]; ];
const messages = { const messages = {
replacedMsg: "Unstake transaction was replaced. Wait for inclusion please.", replacedMsg: "Unstake transaction was replaced. Wait for inclusion please.",
successMsg: `${isRebase ? "STNK" : "GHST"} tokens unstaked successfully! Check your FTSO balance on ${shorten(account)}.`, successMsg: `${isRebase ? stnkSymbol : ghstSymbol} tokens unstaked successfully! Check your ${ftsoSymbol} balance on ${shorten(account)}.`,
errorMsg: "Unstake transaction failed. Check logs for error detalization.", errorMsg: "Unstake transaction failed. Check logs for error detalization.",
}; };
await executeOnChainTransaction( await executeOnChainTransaction(
@ -155,10 +155,10 @@ export const unstake = async (chainId, account, amount, isTrigger, isRebase) =>
); );
} }
export const forfeit = async (chainId, account) => { export const forfeit = async (chainId, account, ftsoSymbol) => {
const messages = { const messages = {
replacedMsg: "Forfeit transaction was replaced. Wait for inclusion please.", replacedMsg: "Forfeit transaction was replaced. Wait for inclusion please.",
successMsg: `Tokens forfeited successfully! Check your FTSO balance on ${shorten(account)}.`, successMsg: `Tokens forfeited successfully! Check your ${ftsoSymbol} balance on ${shorten(account)}.`,
errorMsg: "Forfeit transaction failed. Check logs for error detalization.", errorMsg: "Forfeit transaction failed. Check logs for error detalization.",
}; };
await executeOnChainTransaction( await executeOnChainTransaction(
@ -186,10 +186,10 @@ export const claim = async (chainId, account, isStnk, stnkSymbol, ghstSymbol) =>
); );
} }
export const unwrap = async (chainId, account, amount) => { export const unwrap = async (chainId, account, amount, stnkSymbol) => {
const messages = { const messages = {
replacedMsg: "Unwrap transaction was replaced. Wait for inclusion please.", replacedMsg: "Unwrap transaction was replaced. Wait for inclusion please.",
successMsg: `Tokens unwrapped successfully! Check your STNK balance on ${shorten(account)}.`, successMsg: `Tokens unwrapped successfully! Check your ${stnkSymbol} balance on ${shorten(account)}.`,
errorMsg: "Unwrap transaction failed. Check logs for error detalization.", errorMsg: "Unwrap transaction failed. Check logs for error detalization.",
}; };
await executeOnChainTransaction( await executeOnChainTransaction(
@ -201,10 +201,10 @@ export const unwrap = async (chainId, account, amount) => {
); );
} }
export const wrap = async (chainId, account, amount) => { export const wrap = async (chainId, account, amount, ghstSymbol) => {
const messages = { const messages = {
replacedMsg: "Wrap transaction was replaced. Wait for inclusion please.", replacedMsg: "Wrap transaction was replaced. Wait for inclusion please.",
successMsg: `Tokens wrapped successfully! Check your GHST balance on ${shorten(account)}.`, successMsg: `Tokens wrapped successfully! Check your ${ghstSymbol} balance on ${shorten(account)}.`,
errorMsg: "Wrap transaction failed. Check logs for error detalization.", errorMsg: "Wrap transaction failed. Check logs for error detalization.",
}; };
await executeOnChainTransaction( await executeOnChainTransaction(