@@ -5,30 +5,58 @@ import { CreateSecurityToken, TransferReservationOwnership } from '../procedures
5
5
import { PolymathError } from '../PolymathError' ;
6
6
import { ErrorCode } from '../types' ;
7
7
8
+ /**
9
+ * Represents a unique security token reservation
10
+ */
8
11
export interface UniqueIdentifiers {
9
12
symbol : string ;
10
13
}
11
14
15
+ /**
16
+ * Check if the provided value is of type [[UniqueIdentifiers]]
17
+ *
18
+ * @param identifiers - internal security token reservation representation
19
+ */
12
20
function isUniqueIdentifiers ( identifiers : any ) : identifiers is UniqueIdentifiers {
13
21
const { symbol } = identifiers ;
14
22
15
23
return typeof symbol === 'string' ;
16
24
}
17
25
26
+ /**
27
+ * Represents a single Security Token Reservation
28
+ */
18
29
export interface Params {
30
+ /**
31
+ * expiry date for the ticker reservation
32
+ */
19
33
expiry : Date ;
34
+ /**
35
+ * date at which ticker is registered
36
+ */
20
37
reservedAt : Date ;
21
38
ownerAddress : string ;
22
39
securityTokenAddress ?: string ;
23
40
}
24
41
42
+ /**
43
+ * Class used to manage all the Security Token Reservation functionality
44
+ */
25
45
export class SecurityTokenReservation extends Entity < Params > {
46
+ /**
47
+ * Transform object to string
48
+ */
26
49
public static generateId ( { symbol } : UniqueIdentifiers ) {
27
50
return serialize ( 'securityTokenReservation' , {
28
51
symbol,
29
52
} ) ;
30
53
}
31
54
55
+ /**
56
+ * Unserialize string to a Security Token Reservation object representation
57
+ *
58
+ * @param serialize - security token's serialized representation
59
+ */
32
60
public static unserialize ( serialized : string ) {
33
61
const unserialized = unserialize ( serialized ) ;
34
62
@@ -68,6 +96,9 @@ export class SecurityTokenReservation extends Entity<Params> {
68
96
69
97
protected context : Context ;
70
98
99
+ /**
100
+ * Create a new SecurityTokenReservation instance
101
+ */
71
102
constructor ( params : Params & UniqueIdentifiers , context : Context ) {
72
103
super ( ) ;
73
104
@@ -126,12 +157,18 @@ export class SecurityTokenReservation extends Entity<Params> {
126
157
return procedure . prepare ( ) ;
127
158
} ;
128
159
160
+ /**
161
+ * Convert entity as a POJO (Plain Old Javascript Object)
162
+ */
129
163
public toPojo ( ) {
130
164
const { uid, symbol, expiry, securityTokenAddress, reservedAt, ownerAddress } = this ;
131
165
132
166
return { uid, symbol, expiry, securityTokenAddress, reservedAt, ownerAddress } ;
133
167
}
134
168
169
+ /**
170
+ * Hydrating the entity
171
+ */
135
172
public _refresh ( params : Partial < Params > ) {
136
173
const { expiry, securityTokenAddress, reservedAt, ownerAddress } = params ;
137
174
0 commit comments