Skip to content

Commit ef16982

Browse files
committed
docs: security token reservation documentation
1 parent 856b432 commit ef16982

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/entities/SecurityTokenReservation.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,58 @@ import { CreateSecurityToken, TransferReservationOwnership } from '../procedures
55
import { PolymathError } from '../PolymathError';
66
import { ErrorCode } from '../types';
77

8+
/**
9+
* Represents a unique security token reservation
10+
*/
811
export interface UniqueIdentifiers {
912
symbol: string;
1013
}
1114

15+
/**
16+
* Check if the provided value is of type [[UniqueIdentifiers]]
17+
*
18+
* @param identifiers - internal security token reservation representation
19+
*/
1220
function isUniqueIdentifiers(identifiers: any): identifiers is UniqueIdentifiers {
1321
const { symbol } = identifiers;
1422

1523
return typeof symbol === 'string';
1624
}
1725

26+
/**
27+
* Represents a single Security Token Reservation
28+
*/
1829
export interface Params {
30+
/**
31+
* expiry date for the ticker reservation
32+
*/
1933
expiry: Date;
34+
/**
35+
* date at which ticker is registered
36+
*/
2037
reservedAt: Date;
2138
ownerAddress: string;
2239
securityTokenAddress?: string;
2340
}
2441

42+
/**
43+
* Class used to manage all the Security Token Reservation functionality
44+
*/
2545
export class SecurityTokenReservation extends Entity<Params> {
46+
/**
47+
* Transform object to string
48+
*/
2649
public static generateId({ symbol }: UniqueIdentifiers) {
2750
return serialize('securityTokenReservation', {
2851
symbol,
2952
});
3053
}
3154

55+
/**
56+
* Unserialize string to a Security Token Reservation object representation
57+
*
58+
* @param serialize - security token's serialized representation
59+
*/
3260
public static unserialize(serialized: string) {
3361
const unserialized = unserialize(serialized);
3462

@@ -68,6 +96,9 @@ export class SecurityTokenReservation extends Entity<Params> {
6896

6997
protected context: Context;
7098

99+
/**
100+
* Create a new SecurityTokenReservation instance
101+
*/
71102
constructor(params: Params & UniqueIdentifiers, context: Context) {
72103
super();
73104

@@ -126,12 +157,18 @@ export class SecurityTokenReservation extends Entity<Params> {
126157
return procedure.prepare();
127158
};
128159

160+
/**
161+
* Convert entity as a POJO (Plain Old Javascript Object)
162+
*/
129163
public toPojo() {
130164
const { uid, symbol, expiry, securityTokenAddress, reservedAt, ownerAddress } = this;
131165

132166
return { uid, symbol, expiry, securityTokenAddress, reservedAt, ownerAddress };
133167
}
134168

169+
/**
170+
* Hydrating the entity
171+
*/
135172
public _refresh(params: Partial<Params>) {
136173
const { expiry, securityTokenAddress, reservedAt, ownerAddress } = params;
137174

0 commit comments

Comments
 (0)