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

feat: activity service #853

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

feat: activity service #853

wants to merge 1 commit into from

Conversation

alexp3y
Copy link
Contributor

@alexp3y alexp3y commented Feb 7, 2025

@pete-watters Still working on this first pass at an activity service + queries but wanted to show my thinking here on how we could potentially unify transaction data under this base discriminable Activity model (per our conversation yesterday).

@@ -7,12 +7,36 @@ import {
} from './stacks-transactions.utils';

export interface StacksTransactionsService {
getTotalTransactions(address: string, signal?: AbortSignal): Promise<StacksTx[]>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it would be good to accept token here too? Then we would be able to get SIP-10 / Stacks only data for the Token view pages also directly from the service?

We can also search in the cache client side for that too but I'm not sure what would be the most efficient 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point. It might make sense to eventually separate out into individual asset activity services (similar to how balances are structured). So, there may end up being a different entry point (e.g. sip10ActivityService.getAllActivity(), sip10ActivityService.getTokenActivity(token)), but yeah, I will try to support this kind of functionality via service call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @alexp3y 👏 separating into separate calls would be good but i think if we can pass a token it would help with further sub-categorisation of SIP-10's. For example if we are viewing our BANANA / TREMP SIP-10's

@pete-watters
Copy link
Contributor

@pete-watters Still working on this first pass at an activity service + queries but wanted to show my thinking here on how we could potentially unify transaction data under this base discriminable Activity model (per our conversation yesterday).

This is awesome, thanks @alexp3y 👏 exactly what we need so the UI can keep light and just get Activity rather than data crunching

};
export type TokenTransferDirection = keyof typeof TokenTransferDirections;

export interface TokenTransferActivity extends BaseActivity {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤙 this is perfect and is all the details we need for the UI

}

export function useAccountActivityQuery(account: UnifiedAccountIdentifier) {
const { fiatCurrencyPreference } = useSettings();
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing this here now too and it's actually great to have gotten this done now as it will be pre-built for our next tasks from the start

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.

2 participants