socialfi/server/utils/normalize.js
2025-12-18 00:05:55 +09:00

20 lines
385 B
JavaScript

export const COURSE_STATES = {
0: "purchased",
1: "activated",
2: "deactivated",
}
export const normalizeOwnedCourse = web3 => (course, ownedCourse) => {
return {
...course,
ownedCourseId: ownedCourse.id,
proof: ownedCourse.proof,
owned: ownedCourse.owner,
price: web3.utils.fromWei(ownedCourse.price),
state: COURSE_STATES[ownedCourse.state]
}
}