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

hicommonwealth / commonwealth / 18821517672

26 Oct 2025 05:44PM UTC coverage: 37.433% (-0.09%) from 37.519%
18821517672

push

github

web-flow
Tim/txn state client (#13152)

* move get txns to client

* todo

* update type

* temp tx calls

* verify claim txn updates

* added client changes for rechecking tx status

* fix lint

---------

Co-authored-by: timolegros <timothee@ualberta.ca>
Co-authored-by: Malik Zulqurnain <malikzulqurnain2121@gmail.com>

2028 of 5812 branches covered (34.89%)

Branch coverage included in aggregate %.

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

2 existing lines in 1 file now uncovered.

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/UpdateClaimCliffTransactionHash.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 UpdateClaimCliffTransactionHash(): 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 (
×
33
        claimAddress.magna_cliff_claim_tx_hash &&
×
34
        claimAddress.magna_cliff_claim_tx_at
35
      ) {
NEW
36
        return false;
×
37
      }
38

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

NEW
45
      const txnAt = await validateClaimTxnHash(
×
46
        transaction_hash,
47
        claimAddress.address,
48
      );
49

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

72
      return updated > 0;
×
73
    },
74
  };
75
}
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