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

Function getTransactionType

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

Source from the content-addressed store, hash-verified

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

Callers 2

WalletFunction · 0.90
getTransactionLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected