/
Purchase.ts
106 lines (85 loc) · 2.59 KB
/
Purchase.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { deserialize, Expose, serialize, Transform, Type } from "class-transformer";
import * as Long from "long";
import { Moment } from "moment";
import {
ChainObjectArrayToClass,
ChainObjectArrayToPlain,
ChainObjectToClass,
ChainObjectToPlain,
LongToClass,
LongToPlain,
MomentToClass,
MomentToPlain,
} from "../net/adapter/TypeAdapters";
import { AssetAmount } from "./AssetAmount";
import { ChainObject } from "./ChainObject";
import { KeyPart } from "./KeyPart";
import { PubKey } from "./PubKey";
import { Synopsis } from "./Synopsis";
export class Purchase {
@ChainObjectToPlain
@ChainObjectToClass
@Expose({ name: "id" })
public id: ChainObject;
@Expose({ name: "consumer" })
public author: string;
@Expose({ name: "URI" })
public uri: string;
@Type(() => Synopsis)
@Transform((value: Synopsis) => serialize(value), { toPlainOnly: true })
@Transform((value: string) => deserialize(Synopsis, value), { toClassOnly: true })
@Expose({ name: "synopsis" })
public synopsis: Synopsis;
@Type(() => AssetAmount)
@Expose({ name: "price" })
public price: AssetAmount;
@Type(() => AssetAmount)
@Expose({ name: "paid_price_before_exchange" })
public priceBefore: AssetAmount;
@Type(() => AssetAmount)
@Expose({ name: "paid_price_after_exchange" })
public priceAfter: AssetAmount;
@ChainObjectArrayToPlain
@ChainObjectArrayToClass
@Expose({ name: "seeders_answered" })
public seedersAnswered: ChainObject[];
// UInt64
@LongToPlain
@LongToClass
@Expose({ name: "size" })
public size: Long;
// UInt64
@LongToPlain
@LongToClass
@Expose({ name: "rating" })
public rating: Long;
@Expose({ name: "comment" })
public comment: string;
@MomentToPlain
@MomentToClass
@Expose({ name: "expiration_time" })
public expiration: Moment;
@Type(() => PubKey)
@Expose({ name: "pubKey" })
public pubElGamalKey: PubKey;
@Type(() => KeyPart)
@Expose({ name: "key_particles" })
public keyParticles: KeyPart[];
@Expose({ name: "expired" })
public expired: boolean;
@Expose({ name: "delivered" })
public delivered: boolean;
@MomentToPlain
@MomentToClass
@Expose({ name: "expiration_or_delivery_time" })
public deliveryExpiration: Moment;
@Expose({ name: "rated_or_commented" })
public ratedOrCommented: boolean;
@MomentToPlain
@MomentToClass
@Expose({ name: "created" })
public created: Moment;
// UInt32
@Expose({ name: "region_code_from" })
public regionFrom: number;
}