All files / src/on-demand on-demand-signer.ts

54.54% Statements 6/11
100% Branches 0/0
0% Functions 0/2
44.44% Lines 4/9

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 23 243x 3x   3x                               3x        
import { DataPackage } from "../data-package/DataPackage";
import { NumericDataPoint } from "../data-point/NumericDataPoint";
 
export const signOnDemandDataPackage = (
  address: string,
  score: number,
  timestamp: number,
  privateKey: string
) => {
  const dataPoint = new NumericDataPoint({
    dataFeedId: address,
    value: score,
    decimals: 0,
  });
 
  const dataPackage = new DataPackage([dataPoint], timestamp);
  return dataPackage.sign(privateKey);
};
 
export const prepareMessageToSign = (timestamp: number) => {
  const utcDate = new Date(timestamp).toUTCString();
  return `Allow verification of my account on ${utcDate}`;
};