zklighter-perps 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/.circleci/config.yml +4 -4
  2. package/apis/TransactionApi.ts +34 -6
  3. package/models/AccountMarketStats.ts +18 -12
  4. package/models/AccountPnL.ts +7 -5
  5. package/models/AccountPosition.ts +33 -22
  6. package/models/AccountStats.ts +15 -10
  7. package/models/Block.ts +40 -27
  8. package/models/Blocks.ts +7 -5
  9. package/models/Candlestick.ts +21 -14
  10. package/models/Candlesticks.ts +7 -5
  11. package/models/ContractAddress.ts +6 -4
  12. package/models/CurrentHeight.ts +3 -2
  13. package/models/DetailedAccount.ts +11 -8
  14. package/models/DetailedAccounts.ts +7 -5
  15. package/models/EnrichedTx.ts +9 -6
  16. package/models/ExchangeStats.ts +13 -9
  17. package/models/Funding.ts +12 -8
  18. package/models/Fundings.ts +7 -5
  19. package/models/L1ProviderInfo.ts +12 -8
  20. package/models/Layer1BasicInfo.ts +24 -17
  21. package/models/Layer2BasicInfo.ts +9 -6
  22. package/models/MainAccount.ts +9 -6
  23. package/models/MainAccounts.ts +7 -5
  24. package/models/MarketInfo.ts +33 -22
  25. package/models/MarketSig.ts +12 -8
  26. package/models/NextNonce.ts +3 -2
  27. package/models/Order.ts +48 -32
  28. package/models/OrderBook.ts +30 -20
  29. package/models/OrderBookDepth.ts +11 -8
  30. package/models/OrderBookDetail.ts +54 -36
  31. package/models/OrderBookDetails.ts +4 -3
  32. package/models/OrderBookOrders.ts +14 -10
  33. package/models/OrderBookStats.ts +18 -12
  34. package/models/OrderBooks.ts +4 -3
  35. package/models/Orders.ts +4 -3
  36. package/models/Permission.ts +3 -2
  37. package/models/PnLEntry.ts +6 -4
  38. package/models/PriceLevel.ts +6 -4
  39. package/models/ReqDoFaucet.ts +3 -2
  40. package/models/ReqGetAccount.ts +6 -4
  41. package/models/ReqGetAccountActiveOrders.ts +9 -6
  42. package/models/ReqGetAccountByL1Address.ts +3 -2
  43. package/models/ReqGetAccountInactiveOrders.ts +12 -8
  44. package/models/ReqGetAccountOrders.ts +9 -6
  45. package/models/ReqGetAccountPnL.ts +18 -12
  46. package/models/ReqGetBlock.ts +6 -4
  47. package/models/ReqGetBlockTxs.ts +6 -4
  48. package/models/ReqGetByAccount.ts +6 -4
  49. package/models/ReqGetCandlesticks.ts +15 -10
  50. package/models/ReqGetFundings.ts +15 -10
  51. package/models/ReqGetL1Tx.ts +3 -2
  52. package/models/ReqGetMarketSig.ts +9 -6
  53. package/models/ReqGetNextNonce.ts +6 -4
  54. package/models/ReqGetOrderBookDetails.ts +3 -2
  55. package/models/ReqGetOrderBookOrders.ts +6 -4
  56. package/models/ReqGetOrderBooks.ts +3 -2
  57. package/models/ReqGetPermission.ts +9 -6
  58. package/models/ReqGetRangeWithCursor.ts +3 -2
  59. package/models/ReqGetRangeWithIndex.ts +3 -2
  60. package/models/ReqGetRecentTrades.ts +6 -4
  61. package/models/ReqGetRollbacks.ts +9 -6
  62. package/models/ReqGetSubAccount.ts +9 -6
  63. package/models/ReqGetTrades.ts +12 -8
  64. package/models/ReqGetTx.ts +6 -4
  65. package/models/ReqSearch.ts +3 -2
  66. package/models/ResultCode.ts +3 -2
  67. package/models/Rollback.ts +12 -8
  68. package/models/Rollbacks.ts +7 -5
  69. package/models/Search.ts +3 -2
  70. package/models/SignBody.ts +3 -2
  71. package/models/SimpleOrder.ts +18 -12
  72. package/models/Status.ts +6 -4
  73. package/models/SubAccount.ts +24 -16
  74. package/models/SubAccounts.ts +13 -9
  75. package/models/Trade.ts +36 -24
  76. package/models/Trades.ts +4 -3
  77. package/models/Tx.ts +42 -28
  78. package/models/TxHash.ts +3 -2
  79. package/models/Txs.ts +4 -3
  80. package/models/ValidatorInfo.ts +6 -4
  81. package/openapi.json +535 -79
  82. package/package.json +1 -1
@@ -44,6 +44,10 @@ jobs:
44
44
  name: Generate TS client using OpenAPI Generator
45
45
  command: |
46
46
  java -jar openapi-generator-cli.jar generate -i ./openapi.json -g typescript-fetch -o . -c config.yaml
47
+ - run:
48
+ name: Increase package version
49
+ command: |
50
+ jq '.version |= (split(".") | .[2] = ((.[2] | tonumber) + 1 | tostring) | join("."))' package.json > tmp.json && mv tmp.json package.json
47
51
  - run:
48
52
  name: push to new branch
49
53
  command: |
@@ -74,11 +78,7 @@ jobs:
74
78
  git config --global user.email "hasan@lighter.xyz"
75
79
  git config --global user.name "CircleCI Hasan"
76
80
  npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
77
- npm version patch
78
81
  npm publish
79
- git add .
80
- git commit -m "Update npm package"
81
- git push origin main
82
82
 
83
83
  parameters:
84
84
  update_ts_sdk:
@@ -54,8 +54,8 @@ export interface GetBlockTxsRequest {
54
54
  }
55
55
 
56
56
  export interface GetL2SignatureBodyRequest {
57
- txType?: number;
58
- txInfo?: string;
57
+ txType: number;
58
+ txInfo: string;
59
59
  }
60
60
 
61
61
  export interface GetNextNonceRequest {
@@ -83,8 +83,8 @@ export interface GetTxsRequest {
83
83
  }
84
84
 
85
85
  export interface SendTxRequest {
86
- txType?: number;
87
- txInfo?: string;
86
+ txType: number;
87
+ txInfo: string;
88
88
  }
89
89
 
90
90
  /**
@@ -263,6 +263,20 @@ export class TransactionApi extends runtime.BaseAPI {
263
263
  * Get transaction signature body
264
264
  */
265
265
  async getL2SignatureBodyRaw(requestParameters: GetL2SignatureBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SignBody>> {
266
+ if (requestParameters['txType'] == null) {
267
+ throw new runtime.RequiredError(
268
+ 'txType',
269
+ 'Required parameter "txType" was null or undefined when calling getL2SignatureBody().'
270
+ );
271
+ }
272
+
273
+ if (requestParameters['txInfo'] == null) {
274
+ throw new runtime.RequiredError(
275
+ 'txInfo',
276
+ 'Required parameter "txInfo" was null or undefined when calling getL2SignatureBody().'
277
+ );
278
+ }
279
+
266
280
  const queryParameters: any = {};
267
281
 
268
282
  const headerParameters: runtime.HTTPHeaders = {};
@@ -303,7 +317,7 @@ export class TransactionApi extends runtime.BaseAPI {
303
317
  /**
304
318
  * Get transaction signature body
305
319
  */
306
- async getL2SignatureBody(requestParameters: GetL2SignatureBodyRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SignBody> {
320
+ async getL2SignatureBody(requestParameters: GetL2SignatureBodyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SignBody> {
307
321
  const response = await this.getL2SignatureBodyRaw(requestParameters, initOverrides);
308
322
  return await response.value();
309
323
  }
@@ -527,6 +541,20 @@ export class TransactionApi extends runtime.BaseAPI {
527
541
  * Send raw transaction
528
542
  */
529
543
  async sendTxRaw(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TxHash>> {
544
+ if (requestParameters['txType'] == null) {
545
+ throw new runtime.RequiredError(
546
+ 'txType',
547
+ 'Required parameter "txType" was null or undefined when calling sendTx().'
548
+ );
549
+ }
550
+
551
+ if (requestParameters['txInfo'] == null) {
552
+ throw new runtime.RequiredError(
553
+ 'txInfo',
554
+ 'Required parameter "txInfo" was null or undefined when calling sendTx().'
555
+ );
556
+ }
557
+
530
558
  const queryParameters: any = {};
531
559
 
532
560
  const headerParameters: runtime.HTTPHeaders = {};
@@ -567,7 +595,7 @@ export class TransactionApi extends runtime.BaseAPI {
567
595
  /**
568
596
  * Send raw transaction
569
597
  */
570
- async sendTx(requestParameters: SendTxRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHash> {
598
+ async sendTx(requestParameters: SendTxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TxHash> {
571
599
  const response = await this.sendTxRaw(requestParameters, initOverrides);
572
600
  return await response.value();
573
601
  }
@@ -24,43 +24,49 @@ export interface AccountMarketStats {
24
24
  * @type {number}
25
25
  * @memberof AccountMarketStats
26
26
  */
27
- marketId?: number;
27
+ marketId: number;
28
28
  /**
29
29
  *
30
30
  * @type {number}
31
31
  * @memberof AccountMarketStats
32
32
  */
33
- dailyTradesCount?: number;
33
+ dailyTradesCount: number;
34
34
  /**
35
35
  *
36
36
  * @type {number}
37
37
  * @memberof AccountMarketStats
38
38
  */
39
- dailyBaseTokenVolume?: number;
39
+ dailyBaseTokenVolume: number;
40
40
  /**
41
41
  *
42
42
  * @type {number}
43
43
  * @memberof AccountMarketStats
44
44
  */
45
- dailyQuoteTokenVolume?: number;
45
+ dailyQuoteTokenVolume: number;
46
46
  /**
47
47
  *
48
48
  * @type {number}
49
49
  * @memberof AccountMarketStats
50
50
  */
51
- openPositionBase?: number;
51
+ openPositionBase: number;
52
52
  /**
53
53
  *
54
54
  * @type {number}
55
55
  * @memberof AccountMarketStats
56
56
  */
57
- openPositionQuote?: number;
57
+ openPositionQuote: number;
58
58
  }
59
59
 
60
60
  /**
61
61
  * Check if a given object implements the AccountMarketStats interface.
62
62
  */
63
63
  export function instanceOfAccountMarketStats(value: object): value is AccountMarketStats {
64
+ if (!('marketId' in value) || value['marketId'] === undefined) return false;
65
+ if (!('dailyTradesCount' in value) || value['dailyTradesCount'] === undefined) return false;
66
+ if (!('dailyBaseTokenVolume' in value) || value['dailyBaseTokenVolume'] === undefined) return false;
67
+ if (!('dailyQuoteTokenVolume' in value) || value['dailyQuoteTokenVolume'] === undefined) return false;
68
+ if (!('openPositionBase' in value) || value['openPositionBase'] === undefined) return false;
69
+ if (!('openPositionQuote' in value) || value['openPositionQuote'] === undefined) return false;
64
70
  return true;
65
71
  }
66
72
 
@@ -74,12 +80,12 @@ export function AccountMarketStatsFromJSONTyped(json: any, ignoreDiscriminator:
74
80
  }
75
81
  return {
76
82
 
77
- 'marketId': json['market_id'] == null ? undefined : json['market_id'],
78
- 'dailyTradesCount': json['daily_trades_count'] == null ? undefined : json['daily_trades_count'],
79
- 'dailyBaseTokenVolume': json['daily_base_token_volume'] == null ? undefined : json['daily_base_token_volume'],
80
- 'dailyQuoteTokenVolume': json['daily_quote_token_volume'] == null ? undefined : json['daily_quote_token_volume'],
81
- 'openPositionBase': json['open_position_base'] == null ? undefined : json['open_position_base'],
82
- 'openPositionQuote': json['open_position_quote'] == null ? undefined : json['open_position_quote'],
83
+ 'marketId': json['market_id'],
84
+ 'dailyTradesCount': json['daily_trades_count'],
85
+ 'dailyBaseTokenVolume': json['daily_base_token_volume'],
86
+ 'dailyQuoteTokenVolume': json['daily_quote_token_volume'],
87
+ 'openPositionBase': json['open_position_base'],
88
+ 'openPositionQuote': json['open_position_quote'],
83
89
  };
84
90
  }
85
91
 
@@ -43,19 +43,21 @@ export interface AccountPnL {
43
43
  * @type {string}
44
44
  * @memberof AccountPnL
45
45
  */
46
- resolution?: string;
46
+ resolution: string;
47
47
  /**
48
48
  *
49
49
  * @type {Array<PnLEntry>}
50
50
  * @memberof AccountPnL
51
51
  */
52
- pnl?: Array<PnLEntry>;
52
+ pnl: Array<PnLEntry>;
53
53
  }
54
54
 
55
55
  /**
56
56
  * Check if a given object implements the AccountPnL interface.
57
57
  */
58
58
  export function instanceOfAccountPnL(value: object): value is AccountPnL {
59
+ if (!('resolution' in value) || value['resolution'] === undefined) return false;
60
+ if (!('pnl' in value) || value['pnl'] === undefined) return false;
59
61
  return true;
60
62
  }
61
63
 
@@ -71,8 +73,8 @@ export function AccountPnLFromJSONTyped(json: any, ignoreDiscriminator: boolean)
71
73
 
72
74
  'code': json['code'] == null ? undefined : json['code'],
73
75
  'message': json['message'] == null ? undefined : json['message'],
74
- 'resolution': json['resolution'] == null ? undefined : json['resolution'],
75
- 'pnl': json['pnl'] == null ? undefined : ((json['pnl'] as Array<any>).map(PnLEntryFromJSON)),
76
+ 'resolution': json['resolution'],
77
+ 'pnl': ((json['pnl'] as Array<any>).map(PnLEntryFromJSON)),
76
78
  };
77
79
  }
78
80
 
@@ -85,7 +87,7 @@ export function AccountPnLToJSON(value?: AccountPnL | null): any {
85
87
  'code': value['code'],
86
88
  'message': value['message'],
87
89
  'resolution': value['resolution'],
88
- 'pnl': value['pnl'] == null ? undefined : ((value['pnl'] as Array<any>).map(PnLEntryToJSON)),
90
+ 'pnl': ((value['pnl'] as Array<any>).map(PnLEntryToJSON)),
89
91
  };
90
92
  }
91
93
 
@@ -24,73 +24,84 @@ export interface AccountPosition {
24
24
  * @type {number}
25
25
  * @memberof AccountPosition
26
26
  */
27
- marketId?: number;
27
+ marketId: number;
28
28
  /**
29
29
  *
30
30
  * @type {string}
31
31
  * @memberof AccountPosition
32
32
  */
33
- name?: string;
33
+ name: string;
34
34
  /**
35
35
  *
36
36
  * @type {string}
37
37
  * @memberof AccountPosition
38
38
  */
39
- symbol?: string;
39
+ symbol: string;
40
40
  /**
41
41
  *
42
42
  * @type {number}
43
43
  * @memberof AccountPosition
44
44
  */
45
- sign?: number;
45
+ sign: number;
46
46
  /**
47
47
  *
48
48
  * @type {string}
49
49
  * @memberof AccountPosition
50
50
  */
51
- position?: string;
51
+ position: string;
52
52
  /**
53
53
  *
54
54
  * @type {string}
55
55
  * @memberof AccountPosition
56
56
  */
57
- askOrderSize?: string;
57
+ askOrderSize: string;
58
58
  /**
59
59
  *
60
60
  * @type {string}
61
61
  * @memberof AccountPosition
62
62
  */
63
- bidOrderSize?: string;
63
+ bidOrderSize: string;
64
64
  /**
65
65
  *
66
66
  * @type {string}
67
67
  * @memberof AccountPosition
68
68
  */
69
- avgEntryPrice?: string;
69
+ avgEntryPrice: string;
70
70
  /**
71
71
  *
72
72
  * @type {string}
73
73
  * @memberof AccountPosition
74
74
  */
75
- positionValue?: string;
75
+ positionValue: string;
76
76
  /**
77
77
  *
78
78
  * @type {string}
79
79
  * @memberof AccountPosition
80
80
  */
81
- unrealizedPnl?: string;
81
+ unrealizedPnl: string;
82
82
  /**
83
83
  *
84
84
  * @type {string}
85
85
  * @memberof AccountPosition
86
86
  */
87
- realizedPnl?: string;
87
+ realizedPnl: string;
88
88
  }
89
89
 
90
90
  /**
91
91
  * Check if a given object implements the AccountPosition interface.
92
92
  */
93
93
  export function instanceOfAccountPosition(value: object): value is AccountPosition {
94
+ if (!('marketId' in value) || value['marketId'] === undefined) return false;
95
+ if (!('name' in value) || value['name'] === undefined) return false;
96
+ if (!('symbol' in value) || value['symbol'] === undefined) return false;
97
+ if (!('sign' in value) || value['sign'] === undefined) return false;
98
+ if (!('position' in value) || value['position'] === undefined) return false;
99
+ if (!('askOrderSize' in value) || value['askOrderSize'] === undefined) return false;
100
+ if (!('bidOrderSize' in value) || value['bidOrderSize'] === undefined) return false;
101
+ if (!('avgEntryPrice' in value) || value['avgEntryPrice'] === undefined) return false;
102
+ if (!('positionValue' in value) || value['positionValue'] === undefined) return false;
103
+ if (!('unrealizedPnl' in value) || value['unrealizedPnl'] === undefined) return false;
104
+ if (!('realizedPnl' in value) || value['realizedPnl'] === undefined) return false;
94
105
  return true;
95
106
  }
96
107
 
@@ -104,17 +115,17 @@ export function AccountPositionFromJSONTyped(json: any, ignoreDiscriminator: boo
104
115
  }
105
116
  return {
106
117
 
107
- 'marketId': json['market_id'] == null ? undefined : json['market_id'],
108
- 'name': json['name'] == null ? undefined : json['name'],
109
- 'symbol': json['symbol'] == null ? undefined : json['symbol'],
110
- 'sign': json['sign'] == null ? undefined : json['sign'],
111
- 'position': json['position'] == null ? undefined : json['position'],
112
- 'askOrderSize': json['ask_order_size'] == null ? undefined : json['ask_order_size'],
113
- 'bidOrderSize': json['bid_order_size'] == null ? undefined : json['bid_order_size'],
114
- 'avgEntryPrice': json['avg_entry_price'] == null ? undefined : json['avg_entry_price'],
115
- 'positionValue': json['position_value'] == null ? undefined : json['position_value'],
116
- 'unrealizedPnl': json['unrealized_pnl'] == null ? undefined : json['unrealized_pnl'],
117
- 'realizedPnl': json['realized_pnl'] == null ? undefined : json['realized_pnl'],
118
+ 'marketId': json['market_id'],
119
+ 'name': json['name'],
120
+ 'symbol': json['symbol'],
121
+ 'sign': json['sign'],
122
+ 'position': json['position'],
123
+ 'askOrderSize': json['ask_order_size'],
124
+ 'bidOrderSize': json['bid_order_size'],
125
+ 'avgEntryPrice': json['avg_entry_price'],
126
+ 'positionValue': json['position_value'],
127
+ 'unrealizedPnl': json['unrealized_pnl'],
128
+ 'realizedPnl': json['realized_pnl'],
118
129
  };
119
130
  }
120
131
 
@@ -24,37 +24,42 @@ export interface AccountStats {
24
24
  * @type {string}
25
25
  * @memberof AccountStats
26
26
  */
27
- portfolioValue?: string;
27
+ portfolioValue: string;
28
28
  /**
29
29
  *
30
30
  * @type {string}
31
31
  * @memberof AccountStats
32
32
  */
33
- leverage?: string;
33
+ leverage: string;
34
34
  /**
35
35
  *
36
36
  * @type {string}
37
37
  * @memberof AccountStats
38
38
  */
39
- freeCollateral?: string;
39
+ freeCollateral: string;
40
40
  /**
41
41
  *
42
42
  * @type {string}
43
43
  * @memberof AccountStats
44
44
  */
45
- marginUsage?: string;
45
+ marginUsage: string;
46
46
  /**
47
47
  *
48
48
  * @type {string}
49
49
  * @memberof AccountStats
50
50
  */
51
- buyingPower?: string;
51
+ buyingPower: string;
52
52
  }
53
53
 
54
54
  /**
55
55
  * Check if a given object implements the AccountStats interface.
56
56
  */
57
57
  export function instanceOfAccountStats(value: object): value is AccountStats {
58
+ if (!('portfolioValue' in value) || value['portfolioValue'] === undefined) return false;
59
+ if (!('leverage' in value) || value['leverage'] === undefined) return false;
60
+ if (!('freeCollateral' in value) || value['freeCollateral'] === undefined) return false;
61
+ if (!('marginUsage' in value) || value['marginUsage'] === undefined) return false;
62
+ if (!('buyingPower' in value) || value['buyingPower'] === undefined) return false;
58
63
  return true;
59
64
  }
60
65
 
@@ -68,11 +73,11 @@ export function AccountStatsFromJSONTyped(json: any, ignoreDiscriminator: boolea
68
73
  }
69
74
  return {
70
75
 
71
- 'portfolioValue': json['portfolio_value'] == null ? undefined : json['portfolio_value'],
72
- 'leverage': json['leverage'] == null ? undefined : json['leverage'],
73
- 'freeCollateral': json['free_collateral'] == null ? undefined : json['free_collateral'],
74
- 'marginUsage': json['margin_usage'] == null ? undefined : json['margin_usage'],
75
- 'buyingPower': json['buying_power'] == null ? undefined : json['buying_power'],
76
+ 'portfolioValue': json['portfolio_value'],
77
+ 'leverage': json['leverage'],
78
+ 'freeCollateral': json['free_collateral'],
79
+ 'marginUsage': json['margin_usage'],
80
+ 'buyingPower': json['buying_power'],
76
81
  };
77
82
  }
78
83
 
package/models/Block.ts CHANGED
@@ -31,85 +31,98 @@ export interface Block {
31
31
  * @type {string}
32
32
  * @memberof Block
33
33
  */
34
- commitment?: string;
34
+ commitment: string;
35
35
  /**
36
36
  *
37
37
  * @type {number}
38
38
  * @memberof Block
39
39
  */
40
- height?: number;
40
+ height: number;
41
41
  /**
42
42
  *
43
43
  * @type {string}
44
44
  * @memberof Block
45
45
  */
46
- stateRoot?: string;
46
+ stateRoot: string;
47
47
  /**
48
48
  *
49
49
  * @type {number}
50
50
  * @memberof Block
51
51
  */
52
- priorityOperations?: number;
52
+ priorityOperations: number;
53
53
  /**
54
54
  *
55
55
  * @type {number}
56
56
  * @memberof Block
57
57
  */
58
- onChainL2Operations?: number;
58
+ onChainL2Operations: number;
59
59
  /**
60
60
  *
61
61
  * @type {string}
62
62
  * @memberof Block
63
63
  */
64
- pendingOnChainOperationsPubData?: string;
64
+ pendingOnChainOperationsPubData: string;
65
65
  /**
66
66
  *
67
67
  * @type {string}
68
68
  * @memberof Block
69
69
  */
70
- committedTxHash?: string;
70
+ committedTxHash: string;
71
71
  /**
72
72
  *
73
73
  * @type {number}
74
74
  * @memberof Block
75
75
  */
76
- committedAt?: number;
76
+ committedAt: number;
77
77
  /**
78
78
  *
79
79
  * @type {string}
80
80
  * @memberof Block
81
81
  */
82
- verifiedTxHash?: string;
82
+ verifiedTxHash: string;
83
83
  /**
84
84
  *
85
85
  * @type {number}
86
86
  * @memberof Block
87
87
  */
88
- verifiedAt?: number;
88
+ verifiedAt: number;
89
89
  /**
90
90
  *
91
91
  * @type {Array<Tx>}
92
92
  * @memberof Block
93
93
  */
94
- txs?: Array<Tx>;
94
+ txs: Array<Tx>;
95
95
  /**
96
96
  *
97
97
  * @type {number}
98
98
  * @memberof Block
99
99
  */
100
- status?: number;
100
+ status: number;
101
101
  /**
102
102
  *
103
103
  * @type {number}
104
104
  * @memberof Block
105
105
  */
106
- size?: number;
106
+ size: number;
107
107
  }
108
108
 
109
109
  /**
110
110
  * Check if a given object implements the Block interface.
111
111
  */
112
112
  export function instanceOfBlock(value: object): value is Block {
113
+ if (!('commitment' in value) || value['commitment'] === undefined) return false;
114
+ if (!('height' in value) || value['height'] === undefined) return false;
115
+ if (!('stateRoot' in value) || value['stateRoot'] === undefined) return false;
116
+ if (!('priorityOperations' in value) || value['priorityOperations'] === undefined) return false;
117
+ if (!('onChainL2Operations' in value) || value['onChainL2Operations'] === undefined) return false;
118
+ if (!('pendingOnChainOperationsPubData' in value) || value['pendingOnChainOperationsPubData'] === undefined) return false;
119
+ if (!('committedTxHash' in value) || value['committedTxHash'] === undefined) return false;
120
+ if (!('committedAt' in value) || value['committedAt'] === undefined) return false;
121
+ if (!('verifiedTxHash' in value) || value['verifiedTxHash'] === undefined) return false;
122
+ if (!('verifiedAt' in value) || value['verifiedAt'] === undefined) return false;
123
+ if (!('txs' in value) || value['txs'] === undefined) return false;
124
+ if (!('status' in value) || value['status'] === undefined) return false;
125
+ if (!('size' in value) || value['size'] === undefined) return false;
113
126
  return true;
114
127
  }
115
128
 
@@ -123,19 +136,19 @@ export function BlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): Blo
123
136
  }
124
137
  return {
125
138
 
126
- 'commitment': json['commitment'] == null ? undefined : json['commitment'],
127
- 'height': json['height'] == null ? undefined : json['height'],
128
- 'stateRoot': json['state_root'] == null ? undefined : json['state_root'],
129
- 'priorityOperations': json['priority_operations'] == null ? undefined : json['priority_operations'],
130
- 'onChainL2Operations': json['on_chain_l2_operations'] == null ? undefined : json['on_chain_l2_operations'],
131
- 'pendingOnChainOperationsPubData': json['pending_on_chain_operations_pub_data'] == null ? undefined : json['pending_on_chain_operations_pub_data'],
132
- 'committedTxHash': json['committed_tx_hash'] == null ? undefined : json['committed_tx_hash'],
133
- 'committedAt': json['committed_at'] == null ? undefined : json['committed_at'],
134
- 'verifiedTxHash': json['verified_tx_hash'] == null ? undefined : json['verified_tx_hash'],
135
- 'verifiedAt': json['verified_at'] == null ? undefined : json['verified_at'],
136
- 'txs': json['txs'] == null ? undefined : ((json['txs'] as Array<any>).map(TxFromJSON)),
137
- 'status': json['status'] == null ? undefined : json['status'],
138
- 'size': json['size'] == null ? undefined : json['size'],
139
+ 'commitment': json['commitment'],
140
+ 'height': json['height'],
141
+ 'stateRoot': json['state_root'],
142
+ 'priorityOperations': json['priority_operations'],
143
+ 'onChainL2Operations': json['on_chain_l2_operations'],
144
+ 'pendingOnChainOperationsPubData': json['pending_on_chain_operations_pub_data'],
145
+ 'committedTxHash': json['committed_tx_hash'],
146
+ 'committedAt': json['committed_at'],
147
+ 'verifiedTxHash': json['verified_tx_hash'],
148
+ 'verifiedAt': json['verified_at'],
149
+ 'txs': ((json['txs'] as Array<any>).map(TxFromJSON)),
150
+ 'status': json['status'],
151
+ 'size': json['size'],
139
152
  };
140
153
  }
141
154
 
@@ -155,7 +168,7 @@ export function BlockToJSON(value?: Block | null): any {
155
168
  'committed_at': value['committedAt'],
156
169
  'verified_tx_hash': value['verifiedTxHash'],
157
170
  'verified_at': value['verifiedAt'],
158
- 'txs': value['txs'] == null ? undefined : ((value['txs'] as Array<any>).map(TxToJSON)),
171
+ 'txs': ((value['txs'] as Array<any>).map(TxToJSON)),
159
172
  'status': value['status'],
160
173
  'size': value['size'],
161
174
  };
package/models/Blocks.ts CHANGED
@@ -43,19 +43,21 @@ export interface Blocks {
43
43
  * @type {number}
44
44
  * @memberof Blocks
45
45
  */
46
- total?: number;
46
+ total: number;
47
47
  /**
48
48
  *
49
49
  * @type {Array<Block>}
50
50
  * @memberof Blocks
51
51
  */
52
- blocks?: Array<Block>;
52
+ blocks: Array<Block>;
53
53
  }
54
54
 
55
55
  /**
56
56
  * Check if a given object implements the Blocks interface.
57
57
  */
58
58
  export function instanceOfBlocks(value: object): value is Blocks {
59
+ if (!('total' in value) || value['total'] === undefined) return false;
60
+ if (!('blocks' in value) || value['blocks'] === undefined) return false;
59
61
  return true;
60
62
  }
61
63
 
@@ -71,8 +73,8 @@ export function BlocksFromJSONTyped(json: any, ignoreDiscriminator: boolean): Bl
71
73
 
72
74
  'code': json['code'] == null ? undefined : json['code'],
73
75
  'message': json['message'] == null ? undefined : json['message'],
74
- 'total': json['total'] == null ? undefined : json['total'],
75
- 'blocks': json['blocks'] == null ? undefined : ((json['blocks'] as Array<any>).map(BlockFromJSON)),
76
+ 'total': json['total'],
77
+ 'blocks': ((json['blocks'] as Array<any>).map(BlockFromJSON)),
76
78
  };
77
79
  }
78
80
 
@@ -85,7 +87,7 @@ export function BlocksToJSON(value?: Blocks | null): any {
85
87
  'code': value['code'],
86
88
  'message': value['message'],
87
89
  'total': value['total'],
88
- 'blocks': value['blocks'] == null ? undefined : ((value['blocks'] as Array<any>).map(BlockToJSON)),
90
+ 'blocks': ((value['blocks'] as Array<any>).map(BlockToJSON)),
89
91
  };
90
92
  }
91
93