-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.ts
86 lines (75 loc) · 1.89 KB
/
product.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { DiscountRecord } from "types";
import {
ProductType,
Duration,
DiscountType,
LifecycleState,
ChainType,
} from "./enums";
import { TransactionSignerAccount } from "@algorandfoundation/algokit-utils/types/account";
import AlgodClient from "algosdk/dist/types/client/v2/algod/algod";
/**
* Interface for the product global state.
*/
interface ProductGlobalState {
productName: string;
subscriptionName: string;
manager: string;
price: number;
totalSubs: number;
maxSubs: number;
coinID: number;
productType: ProductType;
duration: Duration;
lifecycle: number;
createdAt: number;
oracleID: number;
unitName: string;
imageURL: string;
}
/**
* Interface for the product state.
*/
export interface ProductState extends ProductGlobalState {
discount?: DiscountRecord;
}
export interface ProductLifecycleStateUpdate {
lifecycle: LifecycleState;
}
export interface ProductDiscountCreationParams {
discountType: DiscountType;
discountValue: number;
expiresIn: number;
parseWholeUnits?: boolean;
}
export interface ProductSubscriptionCreationParams {
subscriber: TransactionSignerAccount;
}
export interface ProductSubscriptionTransferParams {
oldSubscriber: TransactionSignerAccount;
newSubscriberAddress: string;
subscriptionID: number;
}
export interface ProductSubscriptionClaimParams {
subscriber: TransactionSignerAccount;
subscriptionID: number;
}
export interface ProductSubscriptionDeletionParams {
subscriber: TransactionSignerAccount;
subscriptionID: number;
}
export interface ProductSubscriberCheckParams {
subscriberAddress: string;
}
export interface ProductSubscriptionRetrievalParams {
algodClient: AlgodClient;
subscriberAddress: string;
}
export interface ProductInitParams {
algodClient: AlgodClient;
chainType: ChainType;
productID: number;
creator: TransactionSignerAccount;
registryID?: number;
timeout?: number;
}