File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
price_service/sdk/js/src/schemas Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 10
10
/**
11
11
* Represents an aggregate price from Pyth publisher feeds.
12
12
*/
13
- export interface PriceFeed {
13
+ export class PriceFeed {
14
14
/**
15
15
* Exponentially-weighted moving average Price
16
16
*/
@@ -31,6 +31,18 @@ export interface PriceFeed {
31
31
* VAA of the price
32
32
*/
33
33
vaa ?: string ;
34
+
35
+ constructor ( data : any ) {
36
+ this . ema_price = data . ema_price ;
37
+ this . id = data . id ;
38
+ this . metadata = data . metadata ;
39
+ this . price = data . price ;
40
+ this . vaa = data . vaa ;
41
+ }
42
+
43
+ static fromJson ( json : any ) : PriceFeed {
44
+ return new PriceFeed ( Convert . toPriceFeed ( json ) ) ;
45
+ }
34
46
}
35
47
36
48
/**
@@ -40,7 +52,7 @@ export interface PriceFeed {
40
52
*
41
53
* Price
42
54
*/
43
- export interface Price {
55
+ export class Price {
44
56
/**
45
57
* Confidence interval around the price.
46
58
*/
@@ -57,6 +69,17 @@ export interface Price {
57
69
* Publish Time of the price
58
70
*/
59
71
publish_time : number ;
72
+
73
+ constructor ( data : any ) {
74
+ this . conf = data . conf ;
75
+ this . expo = data . expo ;
76
+ this . price = data . price ;
77
+ this . publish_time = data . publish_time ;
78
+ }
79
+
80
+ static fromJson ( json : any ) : Price {
81
+ return new Price ( Convert . toPrice ( json ) ) ;
82
+ }
60
83
}
61
84
62
85
/**
You can’t perform that action at this time.
0 commit comments