Skip to content

Commit

Permalink
risk-level-type-update (#50)
Browse files Browse the repository at this point in the history
Signed-off-by: michalrozekariane <[email protected]>
  • Loading branch information
michalrozekariane authored Apr 16, 2024
1 parent d124b3f commit 297efdd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ The output interface for this function looks like this.
```json
{
"riskScore": "number representing total risk score",
"riskLevel": "<string: ENUM(NORISK, LOW, MEDIUM, HIGH)>"
"riskLevel": "<string: ENUM(NO RISK, LOW, MEDIUM, HIGH)>"
}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/hedera-nft-sdk",
"version": "3.0.2",
"version": "3.0.3",
"description": "NFT SDK for Hedera Hashgraph",
"author": "Michiel Mulders",
"license": "Apache License",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { calculateRarity, calculateRarityFromData, calculateTraitOccurrenceFromD

import { Attribute, Localization, File, Instance, Error, Problem, ValidationResult, Schema } from './types/validator';
import { NFTFile, NFTAttribute, ValueObject, AttributeConfig, RarityResult, TraitOccurrence } from './types/rarity';
import { WeightKeys, WeightProperties, Weights, KeyTypes, RiskLevels, RiskLevelTypes, Metadata, RiskResult } from './types/risk';
import { WeightKeys, WeightProperties, Weights, KeyTypes, RiskLevels, RiskLevel, Metadata, RiskResult } from './types/risk';
import type { CSVRow, MetadataObject } from './types/csv';
import type {
FileValidationResult,
Expand Down Expand Up @@ -93,7 +93,7 @@ export {
Weights,
KeyTypes,
RiskLevels,
RiskLevelTypes,
RiskLevel,
Metadata,
RiskResult,
TraitOccurrence,
Expand Down
2 changes: 1 addition & 1 deletion src/risk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const calculateRiskLevel = ({ score, customRiskLevels }: { score: number; custom
const riskLevels = customRiskLevels || defaultRiskLevels;

if (score <= riskLevels.NORISK) {
return 'NORISK';
return 'NO RISK';
} else if (score <= riskLevels.LOW) {
return 'LOW';
} else if (score <= riskLevels.MEDIUM) {
Expand Down
4 changes: 1 addition & 3 deletions src/types/risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ export interface Weights {

export type KeyTypes = keyof WeightKeys;

export type RiskLevel = 'NORISK' | 'LOW' | 'MEDIUM' | 'HIGH';
export type RiskLevel = 'NO RISK' | 'LOW' | 'MEDIUM' | 'HIGH';
export interface RiskLevels {
NORISK: number;
LOW: number;
MEDIUM: number;
HIGH: number;
}

export type RiskLevelTypes = keyof RiskLevels;

export type RiskScoreFactors = {
[key in KeyTypes]?: number;
} & {
Expand Down

0 comments on commit 297efdd

Please sign in to comment.