MCPcopy Create free account
hub / github.com/dailydotdev/apps / getTransactionType

Function getTransactionType

packages/shared/src/lib/transaction.tsx:16–36  ·  view source on GitHub ↗
({
  transaction,
  user,
}: {
  transaction: UserTransaction;
  user: LoggedUser;
})

Source from the content-addressed store, hash-verified

14const QUEST_REWARD_REFERENCE_PREFIX = 'quest_reward:';
15
16export const getTransactionType = ({
17 transaction,
18 user,
19}: {
20 transaction: UserTransaction;
21 user: LoggedUser;
22}): TransactionItemType => {
23 if (!transaction.sender && !transaction.product) {
24 return 'purchase';
25 }
26
27 if (transaction.receiver.id === user.id) {
28 return 'receive';
29 }
30
31 if (transaction.sender?.id === user.id) {
32 return 'send';
33 }
34
35 return 'unknown';
36};
37
38export const getTransactionLabel = ({
39 transaction,

Callers 3

FirstCoresPopupFunction · 0.90
WalletFunction · 0.90
getTransactionLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected