• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hicommonwealth / commonwealth / 18689677366

21 Oct 2025 03:48PM UTC coverage: 37.226% (-0.007%) from 37.233%
18689677366

Pull #13119

github

web-flow
Merge e255e068f into 40a502422
Pull Request #13119: Add claim tx dates

1987 of 5750 branches covered (34.56%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 2 files covered. (0.0%)

11 existing lines in 3 files now uncovered.

3480 of 8936 relevant lines covered (38.94%)

44.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/model/src/aggregates/token-allocation/GetClaimAddress.query.ts
1
import { InvalidState, type Query } from '@hicommonwealth/core';
2
import * as schemas from '@hicommonwealth/schemas';
3
import { QueryTypes } from 'sequelize';
4
import z from 'zod';
5
import { config } from '../../config';
6
import { models } from '../../database';
7

8
export function GetClaimAddress(): Query<typeof schemas.GetClaimAddress> {
9
  return {
×
10
    ...schemas.GetClaimAddress,
11
    auth: [],
12
    secure: true,
13
    body: async ({ actor }) => {
14
      const claimAddress = await models.sequelize.query<
×
15
        z.infer<typeof schemas.ClaimAddressView>
16
      >(
17
        `
18
          SELECT
19
            A.user_id,
20
            A.address,
21
            A.magna_allocation_id,
22
            A.magna_synced_at,
23
            A.magna_claimed_at,
24
            A.magna_claim_tx_hash,
25
            A.magna_claim_tx_at,
26
            A.magna_cliff_claimed_at,
27
            A.magna_cliff_claim_tx_hash,
28
            A.magna_cliff_claim_tx_at,
29
            COALESCE(HA.token_allocation, 0)::numeric 
30
            + COALESCE(AA.token_allocation, 0)::numeric
31
            + COALESCE(NA.total_token_allocation, 0)::numeric as tokens
32
          FROM
33
            "ClaimAddresses" A
34
            LEFT JOIN "HistoricalAllocations" HA ON A.user_id = HA.user_id
35
            LEFT JOIN "AuraAllocations" AA ON A.user_id = AA.user_id
36
            LEFT JOIN "NftSnapshot" NA ON A.user_id = NA.user_id
37
          WHERE
38
            A.user_id = :user_id
39
          LIMIT 1;
40
        `,
41
        {
42
          type: QueryTypes.SELECT,
43
          replacements: {
44
            user_id: actor.user.id,
45
          },
46
        },
47
      );
48

UNCOV
49
      if (!claimAddress || claimAddress.length === 0) return null;
×
UNCOV
50
      if (claimAddress.length > 1) {
×
51
        // this will never happen but included for type-narrowing
52
        throw new InvalidState('Duplicate claim addresses found');
×
53
      }
54

UNCOV
55
      return {
×
56
        ...claimAddress[0],
57
        token: config.MAGNA?.TOKEN || '',
×
58
        description: config.MAGNA?.EVENT_DESC || '',
×
59
        initial_percentage: config.MAGNA?.INITIAL_PERCENTAGE || 0,
×
60
        cliff_date: config.MAGNA?.CLIFF_DATE || new Date(),
×
61
      };
62
    },
63
  };
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc