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

hicommonwealth / commonwealth / 18821535732

26 Oct 2025 05:46PM UTC coverage: 37.427%. First build
18821535732

Pull #13151

github

web-flow
Merge 2d7804ee3 into 9551a6b43
Pull Request #13151: Merge beta → production

2027 of 5812 branches covered (34.88%)

Branch coverage included in aggregate %.

2 of 25 new or added lines in 3 files covered. (8.0%)

3526 of 9025 relevant lines covered (39.07%)

44.41 hits per line

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

4.55
/libs/model/src/aggregates/token-allocation/UpdateClaimTransactionHash.command.ts
1
import { type Command, InvalidState, logger } from '@hicommonwealth/core';
2
import * as schemas from '@hicommonwealth/schemas';
3
import { QueryTypes } from 'sequelize';
4
import { models } from '../../database';
5
import { validateClaimTxnHash } from '../../utils/validateClaimTxnHash';
6

7
const log = logger(import.meta);
30✔
8

9
export function UpdateClaimTransactionHash(): Command<
10
  typeof schemas.UpdateClaimTransactionHash
11
> {
12
  return {
×
13
    ...schemas.UpdateClaimTransactionHash,
14
    auth: [],
15
    secure: true,
16
    body: async ({ payload, actor }) => {
17
      const { transaction_hash } = payload;
×
18

NEW
19
      const claimAddress = await models.ClaimAddresses.findOne({
×
20
        where: {
21
          user_id: actor.user.id,
22
        },
23
      });
24

NEW
25
      if (!claimAddress) {
×
NEW
26
        log.error('Claim address not found for user', undefined, {
×
27
          user_id: actor.user.id,
28
        });
NEW
29
        throw new InvalidState('Claim address not found');
×
30
      }
31

NEW
32
      if (claimAddress.magna_claim_tx_hash && claimAddress.magna_claim_tx_at) {
×
NEW
33
        return false;
×
34
      }
35

NEW
36
      if (!claimAddress.address) {
×
NEW
37
        throw new InvalidState(
×
38
          'Cannot set transaction hash without a claim address',
39
        );
40
      }
41

NEW
42
      const txnAt = await validateClaimTxnHash(
×
43
        transaction_hash,
44
        claimAddress.address,
45
      );
46

47
      const [, updated] = await models.sequelize.query(
×
48
        `
49
          UPDATE "ClaimAddresses"
50
          SET 
51
            magna_claim_tx_hash = :transaction_hash,
52
            magna_claim_tx_at = :transaction_at
53
          WHERE
54
            user_id = :user_id
55
            AND magna_claimed_at IS NOT NULL
56
            AND magna_claim_data IS NOT NULL
57
            AND magna_claim_tx_hash IS NULL;
58
        `,
59
        {
60
          type: QueryTypes.UPDATE,
61
          replacements: {
62
            user_id: actor.user.id,
63
            transaction_hash,
64
            transaction_at: txnAt,
65
          },
66
        },
67
      );
68

69
      return updated > 0;
×
70
    },
71
  };
72
}
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

© 2026 Coveralls, Inc