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

Mintbase / mintbase-js / 7886709676

13 Feb 2024 12:46PM UTC coverage: 76.836%. First build
7886709676

Pull #470

github

rubenmarcus
add to mintbase
Pull Request #470: change node version

803 of 1223 branches covered (65.66%)

Branch coverage included in aggregate %.

1101 of 1255 relevant lines covered (87.73%)

12.72 hits per line

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

71.67
/packages/rpc/src/methods/txnstatus.ts
1
import { requestFromNearRpc } from '../util';
3✔
2

3
export type TxnStatus = 'pending' | 'success' | 'failure';
4

5
export const getTxnStatus = async (
3✔
6
  txnHash: string,
7
  senderId: string,
8
  network?: string,
9
): Promise<TxnStatus> => {
9✔
10
  const res = await requestFromNearRpc({
9✔
11
    jsonrpc: '2.0',
12
    id: 'dontcare',
13
    method: 'tx',
14
    params: [txnHash, senderId],
15
  }, network);
16
  if (res?.error) {
9!
17
    throw res.error;
×
18
  }
19

20
  let failure = false;
9✔
21
  let pending = false;
9✔
22
  if (!(res.result?.receipts_outcome instanceof Array)) {
9!
23
    throw new Error(`Malformed response: ${JSON.stringify(res)}`);
×
24
  }
25
  res.result?.receipts_outcome?.forEach((outcome: any) => {
9!
26
    if (!outcome?.outcome?.status) {
12!
27
      throw new Error(`Malformed response: ${JSON.stringify(res)}`);
×
28
    }
29
    if (outcome.outcome.status.Unknown) {
12!
30
      pending = true;
×
31
    }
32
    if (outcome.outcome.status.Failure) {
12✔
33
      failure = true;
3✔
34
    }
35
  });
36
  if (failure) {
9✔
37
    return 'failure';
3✔
38
  }
39
  if (pending) {
6!
40
    return 'pending';
×
41
  }
42
  return 'success';
6✔
43
};
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