Skip to content

Commit 02e365f

Browse files
committed
chore: fix bigint for unnecessary enum types
1 parent 19924fd commit 02e365f

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/clients/SubtopiaClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export class SubtopiaClient {
344344
maxSubs: BigInt(globalState.max_subscribers),
345345
coinID: BigInt(globalState.coin_id),
346346
productType: globalState.product_type,
347-
lifecycle: BigInt(globalState.lifecycle),
347+
lifecycle: globalState.lifecycle,
348348
createdAt: BigInt(globalState.created_at),
349349
duration: globalState.duration,
350350
oracleID: BigInt(globalState.oracle_id),

src/interfaces/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ChainType,
99
DiscountType,
1010
Duration,
11+
LifecycleState,
1112
LockerType,
1213
ProductType,
1314
} from "../types/enums";
@@ -92,7 +93,7 @@ interface ProductGlobalState {
9293
coinID: bigint;
9394
productType: ProductType;
9495
duration: Duration;
95-
lifecycle: bigint;
96+
lifecycle: LifecycleState;
9697
createdAt: bigint;
9798
oracleID: bigint;
9899
unitName: string;

src/types/product.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface ProductGlobalState {
2222
coinID: bigint;
2323
productType: ProductType;
2424
duration: Duration;
25-
lifecycle: bigint;
25+
lifecycle: LifecycleState;
2626
createdAt: bigint;
2727
oracleID: bigint;
2828
unitName: string;

src/utils/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,15 @@ export function parseTokenProductGlobalState(input: AppState) {
435435
// @ts-ignore
436436
input[key].valueRaw,
437437
);
438+
} else if (keyMap[key] === "duration") {
439+
// Convert duration from bigint to number to match Duration enum type
440+
output[keyMap[key]] = Number(input[key].value);
441+
} else if (keyMap[key] === "product_type") {
442+
// Convert product_type from bigint to number to match ProductType enum type
443+
output[keyMap[key]] = Number(input[key].value);
444+
} else if (keyMap[key] === "lifecycle") {
445+
// Convert lifecycle from bigint to number to match LifecycleState enum type
446+
output[keyMap[key]] = Number(input[key].value);
438447
} else {
439448
output[keyMap[key]] = input[key].value;
440449
}

0 commit comments

Comments
 (0)