Skip to content
Merged
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
27 changes: 27 additions & 0 deletions src/screens/SendTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,37 @@ function SendTokens() {
});
}

/**
* Check if any token being sent is a fee-based token.
* The version is read from the Redux tokens list (kept fresh by useTokensDetails),
* not from the local txTokens copies which may be stale.
*
* @returns {boolean}
*/
const hasFeeBasedToken = () => {
return txTokens.some(txToken => {
const fullToken = tokens.find(t => t.uid === txToken.uid);
return fullToken?.version === hathorLib.TokenVersion.FEE;
});
}

/**
* Validates form, prepares modal data, and shows the Transaction Overview modal.
*/
const beforeSend = () => {
// Fee-based tokens carry a fee header that the Hathor Ledger app cannot deserialize yet,
// so block the send early with a clear message instead of letting the device reject it.
if (LOCAL_STORE.isHardwareWallet() && hasFeeBasedToken()) {
globalModalContext.showModal(MODAL_TYPES.ALERT_NOT_SUPPORTED, {
children: (
<div>
<p>{t`Unfortunately sending fee-based tokens is not yet supported when using a hardware wallet. If you need to send this token, you can use it by switching to a software wallet.`}</p>
</div>
)
});
return;
}

const isValid = validateFormData();
if (!isValid) return;

Expand Down
Loading