From a840e9d238223217b5f291ec8737722edd41821d Mon Sep 17 00:00:00 2001 From: pandablue0809 Date: Wed, 2 Jul 2025 03:07:02 +0900 Subject: [PATCH 1/4] add destination tag check --- pages/services/send.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pages/services/send.js b/pages/services/send.js index dc9b86f6..81b4dd6b 100644 --- a/pages/services/send.js +++ b/pages/services/send.js @@ -48,6 +48,7 @@ export default function Send({ const [agreeToSiteTerms, setAgreeToSiteTerms] = useState(false) const [isDestinationFlagged, setIsDestinationFlagged] = useState(false) const [agreeToSendToFlagged, setAgreeToSendToFlagged] = useState(false) + const [requireDestTag, setRequireDestTag] = useState(false) const [selectedToken, setSelectedToken] = useState({ currency: nativeCurrency }) const onTokenChange = (token) => { @@ -114,13 +115,13 @@ export default function Send({ } try { - const response = await axios(`/v2/address/${address}?blacklist=true`) + const response = await axios(`/v2/address/${address}?blacklist=true&ledgerInfo=true`) const data = response?.data if (data?.address) { const isFlagged = data.blacklist?.blacklisted || false setIsDestinationFlagged(isFlagged) - + setRequireDestTag(data.ledgerInfo?.flags?.requireDestTag || false) // Reset agreement if account is no longer flagged if (!isFlagged) { setAgreeToSendToFlagged(false) @@ -165,6 +166,12 @@ export default function Send({ return } + // Check if destination requires a tag but none is provided + if (requireDestTag && !destinationTag) { + setError('This destination account requires a destination tag. Please enter a destination tag.') + return + } + if (destinationTag && !isTagValid(destinationTag)) { setError('Please enter a valid destination tag.') return @@ -322,6 +329,7 @@ export default function Send({ onKeyPress={typeNumberOnly} defaultValue={destinationTag} /> + {requireDestTag && This destination account requires a destination tag}
From cd484a3f51ef8bdf7cbf3078439ba1513f8c9565 Mon Sep 17 00:00:00 2001 From: pandablue0809 Date: Thu, 10 Jul 2025 05:49:46 +0900 Subject: [PATCH 2/4] fix endpoint --- pages/services/send.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pages/services/send.js b/pages/services/send.js index 81b4dd6b..05a0930e 100644 --- a/pages/services/send.js +++ b/pages/services/send.js @@ -111,17 +111,18 @@ export default function Send({ if (!address || !isAddressValid(address)) { setIsDestinationFlagged(false) setAgreeToSendToFlagged(false) + setRequireDestTag(false) return } try { - const response = await axios(`/v2/address/${address}?blacklist=true&ledgerInfo=true`) - const data = response?.data + // Fetch flagged status from original endpoint + const flaggedResponse = await axios(`/v2/address/${address}?blacklist=true`) + const flaggedData = flaggedResponse?.data - if (data?.address) { - const isFlagged = data.blacklist?.blacklisted || false + if (flaggedData?.address) { + const isFlagged = flaggedData.blacklist?.blacklisted || false setIsDestinationFlagged(isFlagged) - setRequireDestTag(data.ledgerInfo?.flags?.requireDestTag || false) // Reset agreement if account is no longer flagged if (!isFlagged) { setAgreeToSendToFlagged(false) @@ -130,10 +131,20 @@ export default function Send({ setIsDestinationFlagged(false) setAgreeToSendToFlagged(false) } + + // Fetch destination tag requirement from new endpoint + const accountResponse = await axios(`/xrpl/accounts/${address}`) + const accountData = accountResponse?.data + if (accountData?.account) { + setRequireDestTag(accountData?.account_data?.require_dest_tag || false) + } else { + setRequireDestTag(false) + } } catch (error) { setError('Error fetching destination account data') setIsDestinationFlagged(false) setAgreeToSendToFlagged(false) + setRequireDestTag(false) } } From e33d81e60bc0482f9de2cd3db13c2382a390c6dd Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 13 Jul 2025 11:58:01 +0500 Subject: [PATCH 3/4] bug fix --- pages/services/send.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/services/send.js b/pages/services/send.js index 67a689c0..a1eae72a 100644 --- a/pages/services/send.js +++ b/pages/services/send.js @@ -220,8 +220,8 @@ export default function Send({ // Fetch destination tag requirement from new endpoint const accountResponse = await axios(`/xrpl/accounts/${address}`) const accountData = accountResponse?.data - if (accountData?.account) { - setRequireDestTag(accountData?.account_data?.require_dest_tag || false) + if (accountData?.account_data?.require_dest_tag) { + setRequireDestTag(accountData?.account_data?.require_dest_tag) } else { setRequireDestTag(false) } From 0e057eea25687a4a9fe12d4a97069e2f5566ebef Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 13 Jul 2025 12:03:12 +0500 Subject: [PATCH 4/4] don't make UI jumps when DT is required --- pages/services/send.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pages/services/send.js b/pages/services/send.js index a1eae72a..865d3f87 100644 --- a/pages/services/send.js +++ b/pages/services/send.js @@ -455,14 +455,25 @@ export default function Send({
+ {t('table.destination-tag')}{' '} + {requireDestTag ? ( + <> + {' '} + (required) + + ) : ( + '' + )} + + } placeholder={t('form.placeholder.destination-tag')} setInnerValue={setDestinationTag} hideButton={true} onKeyPress={typeNumberOnly} defaultValue={destinationTag} /> - {requireDestTag && This destination account requires a destination tag}