Skip to content
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

client/asset: Add WalletHistorian interface and RPC method #2500

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

martonp
Copy link
Contributor

@martonp martonp commented Sep 4, 2023

This adds a WalletHistorian interface which exposes a TxHistory
function. This will allow wallets to display the history of their
transactions. Also adds a method to the RPC server to retrieve the
wallet history.

@martonp martonp force-pushed the walletHistorian branch 2 times, most recently from 4506720 to 42bc5dc Compare September 7, 2023 03:32
@martonp martonp changed the title client/asset: Add WalletHistorian interface client/asset: Add WalletHistorian interface and RPC method Sep 7, 2023
This adds a `WalletHistorian` interface which exposes a `TxHistory`
function. This will allow wallets to display the history of their
transactions. Also adds a method to the RPC server to retrieve the
wallet history.
@martonp
Copy link
Contributor Author

martonp commented Sep 7, 2023

CI failure is unrelated: #2505

client/asset/interface.go Outdated Show resolved Hide resolved
client/asset/interface.go Outdated Show resolved Hide resolved
Comment on lines +1059 to +1069
// WalletHistorian is a wallet that is able to retrieve the history of all
// transactions it has made.
type WalletHistorian interface {
// TxHistory returns all the transactions a wallet has made. If refID
// is nil, then transactions starting from the most recent are returned
// (past is ignored). If past is true, the transactions prior to the
// refID are returned, otherwise the transactions after the refID are
// returned. n is the number of transactions to return. If n is <= 0,
// all the transactions will be returned.
TxHistory(n int, refID *dex.Bytes, past bool) ([]*WalletTransaction, error)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are a lot of transactions, this could be pretty big. Maybe add a hard limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the front ends should handle that. I'll update the RPC server to have a default of 10. Would something go wrong if too many are requested?

client/asset/interface.go Outdated Show resolved Hide resolved
client/asset/interface.go Outdated Show resolved Hide resolved
client/asset/interface.go Outdated Show resolved Hide resolved
@buck54321 buck54321 merged commit 2b02687 into decred:master Sep 12, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants