-
Notifications
You must be signed in to change notification settings - Fork 575
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
adds decrypted notes to getAccountTransactions #3731
Conversation
optionally decrypts transaction output notes and includes them in the response from getAccountTransactions with each transaction. adding the decrypted notes will support adding both sender address and recipient address to the output of `wallet:transactions`: each note includes both the sender address and the 'owner' address, which is the recipient address.
@@ -72,3 +75,41 @@ export async function getAssetBalanceDeltas( | |||
|
|||
return assetBalanceDeltas | |||
} | |||
|
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 probably belongs in a different file, it isn't a type.
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.
yeah, i'll add a separate utils
module and then move the other non-type declarations from this file as well
memo: note.memo(), | ||
value: CurrencyUtils.encode(note.value()), | ||
assetId: note.assetId().toString('hex'), | ||
assetName: asset?.name.toString('hex') || '', |
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.
In what cases won't the asset be defined? Wouldn't it be a corrupt database if the asset isn't found but the note is decrypted?
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 logic came before assets were stored in the wallet db and looks the asset up from the chain database. if the note is from a pending mint transaction then the asset might not have been added to the chain yet.
we may be able to update this to use the wallet database instead of the chain now that it's available
@@ -33,6 +39,7 @@ export type GetAccountTransactionsResponse = { | |||
expiration: number | |||
timestamp: number | |||
assetBalanceDeltas: Array<{ assetId: string; assetName: string; delta: string }> | |||
notes?: RpcAccountDecryptedNote[] |
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 am partial to notes: RpcAccountDecryptedNote[] | undefined
since it is more explicit, not sure if this is the pattern we use though
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 suspect that we're not very consistent about using one vs the other. I'll add a task to the RPC uniformity project to address this and make it consistent!
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.
LGTM, few small comments/questions
* adds decrypted notes to getAccountTransactions optionally decrypts transaction output notes and includes them in the response from getAccountTransactions with each transaction. adding the decrypted notes will support adding both sender address and recipient address to the output of `wallet:transactions`: each note includes both the sender address and the 'owner' address, which is the recipient address. * moves getAccountDecryptedNotes from types to utils * fixes lint
Summary
optionally decrypts transaction output notes and includes them in the response from getAccountTransactions with each transaction.
adding the decrypted notes will support adding both sender address and recipient address to the output of
wallet:transactions
: each note includes both the sender address and the 'owner' address, which is the recipient address.Testing Plan
Documentation
Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference)? If yes, link a
related documentation pull request for the website.
Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.