+ {(() => {
+ const getUnstakingSummary = () => (
+ <>
+
+ Redelegation Amount (XION)
+ {formatToSmallDisplay(amountXIONParsed)}
+
+ {formatXionToUSD(getXionCoin(amountXIONParsed))}
+
+
+ {!!memo && (
+
+ )}
+ >
+ );
+
+ if (step === "completed") {
+ return (
+ <>
+
+
+ SUCCESS!
+
+
+ You have successfully redelegate from{" "}
+ {validator.description.moniker}
+ to {dstValidator?.description.moniker}
+
+
+ {getUnstakingSummary()}
+
{
+ stakingRef.staking.dispatch(setModalOpened(null));
+ }}
+ >
+ CLOSE
+
+ >
+ );
+ }
+
+ if (step === "review") {
+ return (
+ <>
+
+
+ REVIEW
+
+
+ You are about to redelegate your token from{" "}
+ {validator.description.moniker} to
+ {dstValidator?.description.moniker}. Remember, you will not
+ able to redelegate these token within {unbondingDays} days.
+
+
+ {getUnstakingSummary()}
+
{
+ if (!client || !dstValidator) return;
+
+ setIsLoading(true);
+
+ redelegateAction(
+ {
+ amount: getXionCoin(amountXIONParsed),
+ client,
+ delegatorAddress: account.bech32Address,
+ memo,
+ validatorDstAddress: dstValidator?.operatorAddress,
+ validatorSrcAddress: validator.operatorAddress,
+ },
+ staking,
+ )
+ .then((fetchDataFn) => {
+ setStep("completed");
+
+ return fetchDataFn();
+ })
+ .catch(() => {
+ toast("Redelegation error", { type: "error" });
+ })
+ .finally(() => setIsLoading(false));
+ }}
+ >
+ PROCEED
+
+ >
+ );
+ }
+
+ return (
+ <>
+
+
+ Redelegate From {validator.description.moniker}
+
+
+
+
To
+
+ Available:{" "}
+ {!!delegatedTokens &&
+ formatCoin(delegatedTokens, undefined, true)}{" "}
+ XION
+
+
+
{
+ if (!!validatorAddress) {
+ setDstValidator(validatorsPerAddress[validatorAddress]);
+ }
+ }}
+ renderValue={(option: null | SelectOption) =>
+ option == null ? (
+
+ ) : (
+
+ )
+ }
+ >
+
+ {Object.values(validators).map((v) => (
+
+ ))}
+
+
+
+
Amount
+ {!!amountUSD && (
+
=${formatToSmallDisplay(amountUSD)}
+ )}
+
+
+ >
+ );
+ })()}
+
+