@dydxprotocol/v4-client-js 1.1.13 → 1.1.15

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 (151) hide show
  1. package/.eslintrc.js +3 -5
  2. package/.prettierignore +3 -0
  3. package/.prettierrc.json +6 -0
  4. package/.telescope.json +2 -4
  5. package/.vscode/launch.json +10 -10
  6. package/README.md +3 -1
  7. package/__native__/__ios__/v4-native-client.js +2680 -799
  8. package/__tests__/helpers/constants.ts +10 -8
  9. package/__tests__/lib/helpers.test.ts +22 -23
  10. package/__tests__/lib/util.test.ts +2 -8
  11. package/__tests__/lib/validation.test.ts +23 -26
  12. package/__tests__/modules/client/Transfers.test.ts +4 -19
  13. package/__tests__/modules/client/ValidatorPostEndpoints.test.ts +2 -5
  14. package/__tests__/modules/client/constants.ts +4 -2
  15. package/__tests__/modules/onboarding.test.ts +9 -7
  16. package/build/__tests__/helpers/constants.js +7 -7
  17. package/build/__tests__/lib/helpers.test.js +2 -6
  18. package/build/__tests__/lib/util.test.js +1 -1
  19. package/build/__tests__/lib/validation.test.js +3 -11
  20. package/build/__tests__/modules/client/Transfers.test.js +1 -1
  21. package/build/__tests__/modules/client/ValidatorPostEndpoints.test.js +2 -2
  22. package/build/__tests__/modules/client/constants.js +1 -1
  23. package/build/__tests__/modules/onboarding.test.js +2 -3
  24. package/build/examples/account_endpoints.js +4 -3
  25. package/build/examples/composite_example.js +5 -4
  26. package/build/examples/constants.js +1 -1
  27. package/build/examples/faucet_endpoint.js +4 -3
  28. package/build/examples/long_term_order_cancel_example.js +4 -3
  29. package/build/examples/markets_endpoints.js +4 -3
  30. package/build/examples/native_examples.js +4 -3
  31. package/build/examples/noble_example.js +1 -1
  32. package/build/examples/optimal_node.js +4 -12
  33. package/build/examples/short_term_order_cancel_example.js +4 -3
  34. package/build/examples/short_term_order_composite_example.js +4 -3
  35. package/build/examples/test.js +5 -4
  36. package/build/examples/transfer_example_deposit.js +4 -3
  37. package/build/examples/transfer_example_send.js +1 -1
  38. package/build/examples/transfer_example_subaccount_transfer.js +4 -3
  39. package/build/examples/transfer_example_withdraw.js +4 -3
  40. package/build/examples/transfer_example_withdraw_other.js +1 -1
  41. package/build/examples/utility_endpoints.js +4 -3
  42. package/build/examples/validator_get_example.js +15 -9
  43. package/build/examples/validator_post_example.js +4 -3
  44. package/build/examples/wallet_address.js +5 -4
  45. package/build/examples/websocket_example.js +1 -1
  46. package/build/src/clients/composite-client.d.ts +222 -222
  47. package/build/src/clients/composite-client.js +234 -228
  48. package/build/src/clients/constants.d.ts +3 -0
  49. package/build/src/clients/constants.js +6 -2
  50. package/build/src/clients/faucet-client.d.ts +4 -4
  51. package/build/src/clients/faucet-client.js +5 -5
  52. package/build/src/clients/helpers/chain-helpers.js +1 -1
  53. package/build/src/clients/helpers/request-helpers.js +5 -4
  54. package/build/src/clients/indexer-client.js +1 -1
  55. package/build/src/clients/lib/axios/axiosRequest.js +1 -1
  56. package/build/src/clients/lib/axios/errors.js +1 -1
  57. package/build/src/clients/lib/cctpProto.d.ts +2 -2
  58. package/build/src/clients/lib/cctpProto.js +287 -237
  59. package/build/src/clients/lib/errors.js +1 -1
  60. package/build/src/clients/modules/account.js +1 -1
  61. package/build/src/clients/modules/composer.d.ts +4 -0
  62. package/build/src/clients/modules/composer.js +39 -3
  63. package/build/src/clients/modules/get.d.ts +10 -3
  64. package/build/src/clients/modules/get.js +41 -54
  65. package/build/src/clients/modules/local-wallet.js +1 -1
  66. package/build/src/clients/modules/post.d.ts +6 -0
  67. package/build/src/clients/modules/post.js +50 -18
  68. package/build/src/clients/modules/proto-includes.d.ts +1 -0
  69. package/build/src/clients/modules/proto-includes.js +3 -2
  70. package/build/src/clients/modules/rest.js +1 -1
  71. package/build/src/clients/modules/signer.js +1 -1
  72. package/build/src/clients/modules/tendermintClient.d.ts +5 -5
  73. package/build/src/clients/modules/tendermintClient.js +6 -6
  74. package/build/src/clients/native.d.ts +5 -0
  75. package/build/src/clients/native.js +44 -9
  76. package/build/src/clients/noble-client.js +1 -1
  77. package/build/src/clients/socket-client.js +1 -1
  78. package/build/src/clients/subaccount.js +1 -1
  79. package/build/src/clients/types.d.ts +1 -1
  80. package/build/src/clients/types.js +1 -1
  81. package/build/src/clients/validator-client.d.ts +12 -12
  82. package/build/src/clients/validator-client.js +13 -13
  83. package/build/src/lib/errors.js +1 -1
  84. package/build/src/lib/onboarding.js +1 -1
  85. package/build/src/lib/utils.js +3 -3
  86. package/build/src/lib/validation.js +5 -4
  87. package/build/src/network_optimizer.js +10 -11
  88. package/build/src/types.d.ts +1 -1
  89. package/build/src/types.js +1 -1
  90. package/examples/account_endpoints.ts +5 -4
  91. package/examples/composite_example.ts +12 -7
  92. package/examples/constants.ts +10 -4
  93. package/examples/faucet_endpoint.ts +5 -4
  94. package/examples/human_readable_orders.json +85 -85
  95. package/examples/human_readable_short_term_orders.json +41 -41
  96. package/examples/long_term_order_cancel_example.ts +11 -6
  97. package/examples/markets_endpoints.ts +5 -4
  98. package/examples/native_examples.ts +8 -7
  99. package/examples/noble_example.ts +11 -23
  100. package/examples/optimal_node.ts +4 -14
  101. package/examples/raw_orders.json +128 -128
  102. package/examples/short_term_order_cancel_example.ts +7 -8
  103. package/examples/short_term_order_composite_example.ts +7 -8
  104. package/examples/test.ts +12 -7
  105. package/examples/transfer_example_deposit.ts +6 -9
  106. package/examples/transfer_example_send.ts +2 -10
  107. package/examples/transfer_example_subaccount_transfer.ts +6 -11
  108. package/examples/transfer_example_withdraw.ts +6 -9
  109. package/examples/transfer_example_withdraw_other.ts +1 -5
  110. package/examples/utility_endpoints.ts +5 -4
  111. package/examples/validator_get_example.ts +19 -10
  112. package/examples/validator_post_example.ts +7 -9
  113. package/examples/wallet_address.ts +6 -5
  114. package/examples/websocket_example.ts +5 -1
  115. package/package.json +4 -1
  116. package/src/clients/composite-client.ts +272 -329
  117. package/src/clients/constants.ts +38 -26
  118. package/src/clients/faucet-client.ts +5 -8
  119. package/src/clients/helpers/chain-helpers.ts +10 -6
  120. package/src/clients/helpers/request-helpers.ts +6 -5
  121. package/src/clients/indexer-client.ts +34 -34
  122. package/src/clients/lib/axios/axiosRequest.ts +4 -7
  123. package/src/clients/lib/axios/errors.ts +16 -21
  124. package/src/clients/lib/cctpProto.ts +655 -387
  125. package/src/clients/lib/errors.ts +8 -17
  126. package/src/clients/modules/account.ts +4 -12
  127. package/src/clients/modules/composer.ts +61 -20
  128. package/src/clients/modules/get.ts +71 -89
  129. package/src/clients/modules/local-wallet.ts +41 -56
  130. package/src/clients/modules/post.ts +684 -634
  131. package/src/clients/modules/proto-includes.ts +1 -0
  132. package/src/clients/modules/rest.ts +23 -26
  133. package/src/clients/modules/signer.ts +8 -22
  134. package/src/clients/modules/tendermintClient.ts +13 -36
  135. package/src/clients/native.ts +119 -140
  136. package/src/clients/noble-client.ts +1 -5
  137. package/src/clients/socket-client.ts +216 -216
  138. package/src/clients/subaccount.ts +16 -16
  139. package/src/clients/types.ts +14 -10
  140. package/src/clients/validator-client.ts +14 -16
  141. package/src/codegen/helpers.ts +149 -150
  142. package/src/codegen/index.ts +4 -5
  143. package/src/lib/errors.ts +3 -9
  144. package/src/lib/onboarding.ts +7 -2
  145. package/src/lib/utils.ts +5 -12
  146. package/src/lib/validation.ts +21 -19
  147. package/src/network_optimizer.ts +78 -65
  148. package/src/types.ts +5 -6
  149. package/tasks.json +15 -15
  150. package/tsconfig.eslint.json +1 -4
  151. package/tsconfig.json +2 -6
@@ -25,7 +25,7 @@ export enum IndexerApiHost {
25
25
  TESTNET = 'https://dydx-testnet.imperator.co',
26
26
  LOCAL = 'http://localhost:3002',
27
27
  // For the deployment by DYDX token holders
28
- MAINNET = 'https://indexer.dydx.trade'
28
+ MAINNET = 'https://indexer.dydx.trade',
29
29
  }
30
30
 
31
31
  export enum IndexerWSHost {
@@ -43,7 +43,7 @@ export enum ValidatorApiHost {
43
43
  TESTNET = 'https://test-dydx.kingnodes.com',
44
44
  LOCAL = 'http://localhost:26657',
45
45
  // For the deployment by DYDX token holders
46
- MAINNET = 'https://dydx-ops-rpc.kingnodes.com:443'
46
+ MAINNET = 'https://dydx-ops-rpc.kingnodes.com:443',
47
47
  }
48
48
 
49
49
  // ------------ Network IDs ------------
@@ -51,7 +51,7 @@ export enum ValidatorApiHost {
51
51
  export enum NetworkId {
52
52
  TESTNET = 'dydx-testnet-4',
53
53
  // For the deployment by DYDX token holders
54
- MAINNET = 'dydx-mainnet-1'
54
+ MAINNET = 'dydx-mainnet-1',
55
55
  }
56
56
  export const NETWORK_ID_TESTNET: string = 'dydxprotocol-testnet';
57
57
  // For the deployment by DYDX token holders
@@ -89,9 +89,16 @@ export const TYPE_URL_MSG_CREATE_ORACLE_MARKET = '/dydxprotocol.prices.MsgCreate
89
89
 
90
90
  // x/sending
91
91
  export const TYPE_URL_MSG_CREATE_TRANSFER = '/dydxprotocol.sending.MsgCreateTransfer';
92
- export const TYPE_URL_MSG_WITHDRAW_FROM_SUBACCOUNT = '/dydxprotocol.sending.MsgWithdrawFromSubaccount';
92
+ export const TYPE_URL_MSG_WITHDRAW_FROM_SUBACCOUNT =
93
+ '/dydxprotocol.sending.MsgWithdrawFromSubaccount';
93
94
  export const TYPE_URL_MSG_DEPOSIT_TO_SUBACCOUNT = '/dydxprotocol.sending.MsgDepositToSubaccount';
94
95
 
96
+ // x/staking
97
+ export const TYPE_URL_MSG_DELEGATE = '/cosmos.staking.v1beta1.MsgDelegate';
98
+ export const TYPE_URL_MSG_UNDELEGATE = '/cosmos.staking.v1beta1.MsgUndelegate';
99
+ export const TYPE_URL_MSG_WITHDRAW_DELEGATOR_REWARD =
100
+ '/cosmos.staking.v1beta1.MsgWithdrawDelegatorReward';
101
+
95
102
  // ------------ Chain Constants ------------
96
103
  // The following are same across different networks / deployments.
97
104
  export const GOV_MODULE_ADDRESS = 'dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky';
@@ -150,7 +157,7 @@ export enum OrderStatus {
150
157
  }
151
158
 
152
159
  export enum TickerType {
153
- PERPETUAL = 'PERPETUAL', // Only PERPETUAL is supported right now
160
+ PERPETUAL = 'PERPETUAL', // Only PERPETUAL is supported right now
154
161
  }
155
162
 
156
163
  export enum PositionStatus {
@@ -188,8 +195,7 @@ export class IndexerConfig {
188
195
  public restEndpoint: string;
189
196
  public websocketEndpoint: string;
190
197
 
191
- constructor(restEndpoint: string,
192
- websocketEndpoint: string) {
198
+ constructor(restEndpoint: string, websocketEndpoint: string) {
193
199
  this.restEndpoint = restEndpoint;
194
200
  this.websocketEndpoint = websocketEndpoint;
195
201
  }
@@ -223,54 +229,60 @@ export class Network {
223
229
  public env: string,
224
230
  public indexerConfig: IndexerConfig,
225
231
  public validatorConfig: ValidatorConfig,
226
- ) { }
232
+ ) {}
227
233
 
228
234
  static testnet(): Network {
229
- const indexerConfig = new IndexerConfig(
230
- IndexerApiHost.TESTNET,
231
- IndexerWSHost.TESTNET,
232
- );
233
- const validatorConfig = new ValidatorConfig(ValidatorApiHost.TESTNET, TESTNET_CHAIN_ID,
235
+ const indexerConfig = new IndexerConfig(IndexerApiHost.TESTNET, IndexerWSHost.TESTNET);
236
+ const validatorConfig = new ValidatorConfig(
237
+ ValidatorApiHost.TESTNET,
238
+ TESTNET_CHAIN_ID,
234
239
  {
235
240
  CHAINTOKEN_DENOM: 'adv4tnt',
236
241
  USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
237
242
  USDC_GAS_DENOM: 'uusdc',
238
243
  USDC_DECIMALS: 6,
239
244
  CHAINTOKEN_DECIMALS: 18,
240
- }, undefined, 'Client Example');
245
+ },
246
+ undefined,
247
+ 'Client Example',
248
+ );
241
249
  return new Network('testnet', indexerConfig, validatorConfig);
242
250
  }
243
251
 
244
252
  static local(): Network {
245
- const indexerConfig = new IndexerConfig(
246
- IndexerApiHost.LOCAL,
247
- IndexerWSHost.LOCAL,
248
- );
249
- const validatorConfig = new ValidatorConfig(ValidatorApiHost.LOCAL, LOCAL_CHAIN_ID,
253
+ const indexerConfig = new IndexerConfig(IndexerApiHost.LOCAL, IndexerWSHost.LOCAL);
254
+ const validatorConfig = new ValidatorConfig(
255
+ ValidatorApiHost.LOCAL,
256
+ LOCAL_CHAIN_ID,
250
257
  {
251
258
  CHAINTOKEN_DENOM: 'adv4tnt',
252
259
  USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
253
260
  USDC_GAS_DENOM: 'uusdc',
254
261
  USDC_DECIMALS: 6,
255
262
  CHAINTOKEN_DECIMALS: 18,
256
- }, undefined, 'Client Example');
263
+ },
264
+ undefined,
265
+ 'Client Example',
266
+ );
257
267
  return new Network('local', indexerConfig, validatorConfig);
258
268
  }
259
269
 
260
270
  // For the deployment by DYDX token holders.
261
271
  static mainnet(): Network {
262
- const indexerConfig = new IndexerConfig(
263
- IndexerApiHost.MAINNET,
264
- IndexerWSHost.MAINNET,
265
- );
266
- const validatorConfig = new ValidatorConfig(ValidatorApiHost.MAINNET, MAINNET_CHAIN_ID,
272
+ const indexerConfig = new IndexerConfig(IndexerApiHost.MAINNET, IndexerWSHost.MAINNET);
273
+ const validatorConfig = new ValidatorConfig(
274
+ ValidatorApiHost.MAINNET,
275
+ MAINNET_CHAIN_ID,
267
276
  {
268
277
  CHAINTOKEN_DENOM: 'adydx',
269
278
  USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
270
279
  USDC_GAS_DENOM: 'uusdc',
271
280
  USDC_DECIMALS: 6,
272
281
  CHAINTOKEN_DECIMALS: 18,
273
- }, undefined, 'Client Example');
282
+ },
283
+ undefined,
284
+ 'Client Example',
285
+ );
274
286
  return new Network('mainnet', indexerConfig, validatorConfig);
275
287
  }
276
288
 
@@ -3,10 +3,10 @@ import RestClient from './modules/rest';
3
3
 
4
4
  export class FaucetClient extends RestClient {
5
5
  /**
6
- * @description For testnet only, add USDC to an subaccount
7
- *
8
- * @returns The HTTP response.
9
- */
6
+ * @description For testnet only, add USDC to an subaccount
7
+ *
8
+ * @returns The HTTP response.
9
+ */
10
10
  public async fill(
11
11
  address: string,
12
12
  subaccountNumber: number,
@@ -33,10 +33,7 @@ export class FaucetClient extends RestClient {
33
33
  * @param headers requestHeaders
34
34
  * @returns The HTTP response.
35
35
  */
36
- public async fillNative(
37
- address: string,
38
- headers?: {},
39
- ): Promise<Response> {
36
+ public async fillNative(address: string, headers?: {}): Promise<Response> {
40
37
  const uri = '/faucet/native-token';
41
38
 
42
39
  return this.post(
@@ -1,8 +1,6 @@
1
1
  import Long from 'long';
2
2
 
3
- import {
4
- OrderType, OrderSide, OrderTimeInForce, OrderExecution,
5
- } from '../constants';
3
+ import { OrderType, OrderSide, OrderTimeInForce, OrderExecution } from '../constants';
6
4
  import { Order_ConditionType, Order_Side, Order_TimeInForce } from '../modules/proto-includes';
7
5
  import { OrderFlags } from '../types';
8
6
 
@@ -105,10 +103,14 @@ export function calculateTimeInForce(
105
103
  }
106
104
  switch (execution) {
107
105
  case OrderExecution.DEFAULT:
108
- throw new Error('Execution value DEFAULT not supported for STOP_MARKET or TAKE_PROFIT_MARKET');
106
+ throw new Error(
107
+ 'Execution value DEFAULT not supported for STOP_MARKET or TAKE_PROFIT_MARKET',
108
+ );
109
109
 
110
110
  case OrderExecution.POST_ONLY:
111
- throw new Error('Execution value POST_ONLY not supported for STOP_MARKET or TAKE_PROFIT_MARKET');
111
+ throw new Error(
112
+ 'Execution value POST_ONLY not supported for STOP_MARKET or TAKE_PROFIT_MARKET',
113
+ );
112
114
 
113
115
  case OrderExecution.FOK:
114
116
  return Order_TimeInForce.TIME_IN_FORCE_FILL_OR_KILL;
@@ -201,7 +203,9 @@ export function calculateConditionalOrderTriggerSubticks(
201
203
  case OrderType.TAKE_PROFIT_LIMIT:
202
204
  case OrderType.TAKE_PROFIT_MARKET:
203
205
  if (triggerPrice === undefined) {
204
- throw new Error('triggerPrice must be set if orderType is STOP_LIMIT, STOP_MARKET, TAKE_PROFIT_LIMIT, or TAKE_PROFIT_MARKET');
206
+ throw new Error(
207
+ 'triggerPrice must be set if orderType is STOP_LIMIT, STOP_MARKET, TAKE_PROFIT_LIMIT, or TAKE_PROFIT_MARKET',
208
+ );
205
209
  }
206
210
  return calculateSubticks(
207
211
  triggerPrice,
@@ -1,13 +1,14 @@
1
1
  export function generateQueryPath(url: string, params: {}): string {
2
- const definedEntries = Object.entries(params)
3
- .filter(([_key, value]: [string, unknown]) => value !== undefined);
2
+ const definedEntries = Object.entries(params).filter(
3
+ ([_key, value]: [string, unknown]) => value !== undefined,
4
+ );
4
5
 
5
6
  if (!definedEntries.length) {
6
7
  return url;
7
8
  }
8
9
 
9
- const paramsString = definedEntries.map(
10
- ([key, value]: [string, unknown]) => `${key}=${value}`,
11
- ).join('&');
10
+ const paramsString = definedEntries
11
+ .map(([key, value]: [string, unknown]) => `${key}=${value}`)
12
+ .join('&');
12
13
  return `${url}?${paramsString}`;
13
14
  }
@@ -7,43 +7,43 @@ import UtilityClient from './modules/utility';
7
7
  * @description Client for Indexer
8
8
  */
9
9
  export class IndexerClient {
10
- public readonly config: IndexerConfig;
11
- readonly apiTimeout: number;
12
- readonly _markets: MarketsClient;
13
- readonly _account: AccountClient;
14
- readonly _utility: UtilityClient;
10
+ public readonly config: IndexerConfig;
11
+ readonly apiTimeout: number;
12
+ readonly _markets: MarketsClient;
13
+ readonly _account: AccountClient;
14
+ readonly _utility: UtilityClient;
15
15
 
16
- constructor(config: IndexerConfig, apiTimeout?: number) {
17
- this.config = config;
18
- this.apiTimeout = apiTimeout ?? DEFAULT_API_TIMEOUT;
16
+ constructor(config: IndexerConfig, apiTimeout?: number) {
17
+ this.config = config;
18
+ this.apiTimeout = apiTimeout ?? DEFAULT_API_TIMEOUT;
19
19
 
20
- this._markets = new MarketsClient(config.restEndpoint);
21
- this._account = new AccountClient(config.restEndpoint);
22
- this._utility = new UtilityClient(config.restEndpoint);
23
- }
20
+ this._markets = new MarketsClient(config.restEndpoint);
21
+ this._account = new AccountClient(config.restEndpoint);
22
+ this._utility = new UtilityClient(config.restEndpoint);
23
+ }
24
24
 
25
- /**
26
- * @description Get the public module, used for interacting with public endpoints.
27
- *
28
- * @returns The public module
29
- */
30
- get markets(): MarketsClient {
31
- return this._markets;
32
- }
25
+ /**
26
+ * @description Get the public module, used for interacting with public endpoints.
27
+ *
28
+ * @returns The public module
29
+ */
30
+ get markets(): MarketsClient {
31
+ return this._markets;
32
+ }
33
33
 
34
- /**
35
- * @description Get the private module, used for interacting with private endpoints.
36
- *
37
- * @returns The private module
38
- */
39
- get account(): AccountClient {
40
- return this._account;
41
- }
34
+ /**
35
+ * @description Get the private module, used for interacting with private endpoints.
36
+ *
37
+ * @returns The private module
38
+ */
39
+ get account(): AccountClient {
40
+ return this._account;
41
+ }
42
42
 
43
- /**
44
- * @description Get the utility module, used for interacting with non-market public endpoints.
45
- */
46
- get utility(): UtilityClient {
47
- return this._utility;
48
- }
43
+ /**
44
+ * @description Get the utility module, used for interacting with non-market public endpoints.
45
+ */
46
+ get utility(): UtilityClient {
47
+ return this._utility;
48
+ }
49
49
  }
@@ -1,16 +1,13 @@
1
1
  import axios, { AxiosRequestConfig } from 'axios';
2
2
 
3
3
  import { Data } from '../../types';
4
- import {
5
- AxiosServerError,
6
- AxiosError,
7
- } from './errors';
4
+ import { AxiosServerError, AxiosError } from './errors';
8
5
  import { RequestMethod } from './types';
9
6
 
10
7
  export interface Response {
11
- status: number,
12
- data: Data,
13
- headers: {},
8
+ status: number;
9
+ data: Data;
10
+ headers: {};
14
11
  }
15
12
 
16
13
  async function axiosRequest(options: AxiosRequestConfig): Promise<Response> {
@@ -1,6 +1,4 @@
1
- import {
2
- WrappedError,
3
- } from '../errors';
1
+ import { WrappedError } from '../errors';
4
2
 
5
3
  interface AxiosOriginalError extends Error {
6
4
  isAxiosError: true;
@@ -8,9 +6,9 @@ interface AxiosOriginalError extends Error {
8
6
  }
9
7
 
10
8
  interface AxiosErrorResponse {
11
- status: number,
12
- statusText: string,
13
- data: {},
9
+ status: number;
10
+ statusText: string;
11
+ data: {};
14
12
  }
15
13
 
16
14
  /**
@@ -27,20 +25,17 @@ export class AxiosError extends WrappedError {}
27
25
  * @description Axios error with response error fields.
28
26
  */
29
27
  export class AxiosServerError extends AxiosError {
30
- public readonly status: number;
31
- public readonly statusText: string;
32
- public readonly data: {};
28
+ public readonly status: number;
29
+ public readonly statusText: string;
30
+ public readonly data: {};
33
31
 
34
- constructor(
35
- response: AxiosErrorResponse,
36
- originalError: AxiosOriginalError,
37
- ) {
38
- super(
39
- `${response.status}: ${response.statusText} - ${JSON.stringify(response.data, null, 2)}`,
40
- originalError,
41
- );
42
- this.status = response.status;
43
- this.statusText = response.statusText;
44
- this.data = response.data;
45
- }
32
+ constructor(response: AxiosErrorResponse, originalError: AxiosOriginalError) {
33
+ super(
34
+ `${response.status}: ${response.statusText} - ${JSON.stringify(response.data, null, 2)}`,
35
+ originalError,
36
+ );
37
+ this.status = response.status;
38
+ this.statusText = response.statusText;
39
+ this.data = response.data;
40
+ }
46
41
  }