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 1010/**
1111 * Represents an aggregate price from Pyth publisher feeds.
1212 */
13- export interface PriceFeed {
13+ export class PriceFeed {
1414 /**
1515 * Exponentially-weighted moving average Price
1616 */
@@ -31,6 +31,18 @@ export interface PriceFeed {
3131 * VAA of the price
3232 */
3333 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+ }
3446}
3547
3648/**
@@ -40,7 +52,7 @@ export interface PriceFeed {
4052 *
4153 * Price
4254 */
43- export interface Price {
55+ export class Price {
4456 /**
4557 * Confidence interval around the price.
4658 */
@@ -57,6 +69,17 @@ export interface Price {
5769 * Publish Time of the price
5870 */
5971 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+ }
6083}
6184
6285/**
You can’t perform that action at this time.
0 commit comments