Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 335x 334x 107x 225x 225x 3x | import { VerifierError } from '../../../models';
import { getText } from '../../i18n/useCases';
import type { Receipt } from '../../../models/Receipt';
import type { MerkleProof2017Anchor } from '../../../models/MerkleProof2017';
export default function getTransactionId (certificateReceipt: Receipt = {}): string {
try {
const { anchors } = certificateReceipt;
const anchor = anchors[0];
if ((anchor as MerkleProof2017Anchor).sourceId) {
return (anchor as MerkleProof2017Anchor).sourceId;
}
if (typeof anchor === 'string') {
const dataArray = anchor.split(':');
return dataArray.pop();
}
} catch (err) {
throw new VerifierError('', getText('errors', 'getTransactionId'));
}
}
|