-
Notifications
You must be signed in to change notification settings - Fork 101
frontend: add received date to coin control UTXO list #3249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add the received date (block header timestamp) to the UTXO detail in the coin control view. This makes it easier for users to view the date, which can be helpful for various reasons, without having to open each UTXO individually in the block explorer.
a29ba3c
to
df304dd
Compare
// GetHeaderTimestamp retrieves the header timestamp for a given transaction hash. | ||
func (transactions *Transactions) GetHeaderTimestamp(txHash chainhash.Hash) (*time.Time, error) { | ||
transactions.synchronizer.WaitSynchronized() | ||
return DBView(transactions.db, func(dbTx DBTxInterface) (*time.Time, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds one dbTx per UTXO. In transactions.SpendableOutputs() we aleady call TxInfo()
on each UTXO, so it would be more natural to simply fetch the timestamp there.
if err != nil { | ||
return nil, err | ||
} | ||
return txInfo.HeaderTimestamp, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HeaderTimestamp is nil
when the utxo is unconfirmed. If nil you should take the CreatedTimestamp
, like here:
It would probably be good to add a method Timestamp()
to the TransactionData
struct and add this logic there.
"note": handlers.account.TxNote(output.OutPoint.Hash.String()), | ||
"addressReused": addressReused, | ||
"isChange": output.IsChange, | ||
"headerTimestamp": output.HeaderTimestamp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't the timestamp need to be formatted like here?
@@ -408,6 +408,7 @@ export type TUTXO = { | |||
scriptType: ScriptType; | |||
addressReused: boolean; | |||
isChange: boolean; | |||
headerTimestamp: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in theory both the HeaderTimestamp and the CreatedTimestamp could be nil
, so that means headerTimestamp should be string | null
.
{t('send.coincontrol.receivedDate')}: | ||
</span> | ||
<span className={style.shrink}> | ||
<Date time={utxo.headerTimestamp} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this date format is used in the tx list of the account, but there the transactions are sorted by time. Here I find it a bit confusing to see dates like Saturday, March 22
or Wednesday, October 30, 2024
. I think it would be easier to have a dd/mm/YYYY
format or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please dont' hardcode dd/mm/YYYY
but use {parseTimeShort(utxo.headerTimestamp, i18n.language)}
, so the date is localized and short.
new Date().toLocaleString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric'
})
"Apr 4, 2025"
new Date().toLocaleString('de-CH', {
month: 'short',
day: 'numeric',
year: 'numeric'
})
"4. Apr. 2025"
Add the received date (block header timestamp) to the UTXO detail in the coin control view. This makes it easier for users to view the date, which can be helpful for various reasons, without having to open each UTXO individually in the block explorer.