@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
@@ -1,130 +1,130 @@
1
1
  [
2
- {
3
- "timeInForce": 0,
4
- "reduceOnly": false,
5
- "orderFlags": 64,
6
- "side": 1,
7
- "quantums": 10000000,
8
- "subticks": 40000000000
9
- },
10
- {
11
- "timeInForce": 2,
12
- "reduceOnly": false,
13
- "orderFlags": 64 ,
14
- "side": 1,
15
- "quantums": 10000000,
16
- "subticks": 40000000000
17
- },
18
- {
19
- "timeInForce": 0,
20
- "reduceOnly": true,
21
- "orderFlags": 64,
22
- "side": 1,
23
- "quantums": 10000000,
24
- "subticks": 40000000000
25
- },
26
- {
27
- "timeInForce": 2,
28
- "reduceOnly": true,
29
- "orderFlags": 64 ,
30
- "side": 1,
31
- "quantums": 10000000,
32
- "subticks": 40000000000
33
- },
34
- {
35
- "timeInForce": 1,
36
- "reduceOnly": false,
37
- "orderFlags": 0,
38
- "side": 1,
39
- "quantums": 10000000,
40
- "subticks": 40000000000
41
- },
42
- {
43
- "timeInForce": 1,
44
- "reduceOnly": true,
45
- "orderFlags": 0 ,
46
- "side": 1,
47
- "quantums": 10000000,
48
- "subticks": 40000000000
49
- },
50
- {
51
- "timeInForce": 3,
52
- "reduceOnly": false,
53
- "orderFlags": 0,
54
- "side": 1,
55
- "quantums": 10000000,
56
- "subticks": 40000000000
57
- },
58
- {
59
- "timeInForce": 3,
60
- "reduceOnly": true,
61
- "orderFlags": 0 ,
62
- "side": 1,
63
- "quantums": 10000000,
64
- "subticks": 40000000000
65
- },
66
- {
67
- "timeInForce": 0,
68
- "reduceOnly": false,
69
- "orderFlags": 64,
70
- "side": 2,
71
- "quantums": 10000000,
72
- "subticks": 1000000000
73
- },
74
- {
75
- "timeInForce": 2,
76
- "reduceOnly": false,
77
- "orderFlags": 64 ,
78
- "side": 2,
79
- "quantums": 10000000,
80
- "subticks": 1000000000
81
- },
82
- {
83
- "timeInForce": 0,
84
- "reduceOnly": true,
85
- "orderFlags": 64,
86
- "side": 2,
87
- "quantums": 10000000,
88
- "subticks": 1000000000
89
- },
90
- {
91
- "timeInForce": 2,
92
- "reduceOnly": true,
93
- "orderFlags": 64 ,
94
- "side": 2,
95
- "quantums": 10000000,
96
- "subticks": 1000000000
97
- },
98
- {
99
- "timeInForce": 1,
100
- "reduceOnly": false,
101
- "orderFlags": 0,
102
- "side": 2,
103
- "quantums": 10000000,
104
- "subticks": 1000000000
105
- },
106
- {
107
- "timeInForce": 1,
108
- "reduceOnly": true,
109
- "orderFlags": 0 ,
110
- "side": 2,
111
- "quantums": 10000000,
112
- "subticks": 1000000000
113
- },
114
- {
115
- "timeInForce": 3,
116
- "reduceOnly": false,
117
- "orderFlags": 0,
118
- "side": 2,
119
- "quantums": 10000000,
120
- "subticks": 1000000000
121
- },
122
- {
123
- "timeInForce": 3,
124
- "reduceOnly": true,
125
- "orderFlags": 0 ,
126
- "side": 2,
127
- "quantums": 10000000,
128
- "subticks": 1000000000
129
- }
2
+ {
3
+ "timeInForce": 0,
4
+ "reduceOnly": false,
5
+ "orderFlags": 64,
6
+ "side": 1,
7
+ "quantums": 10000000,
8
+ "subticks": 40000000000
9
+ },
10
+ {
11
+ "timeInForce": 2,
12
+ "reduceOnly": false,
13
+ "orderFlags": 64,
14
+ "side": 1,
15
+ "quantums": 10000000,
16
+ "subticks": 40000000000
17
+ },
18
+ {
19
+ "timeInForce": 0,
20
+ "reduceOnly": true,
21
+ "orderFlags": 64,
22
+ "side": 1,
23
+ "quantums": 10000000,
24
+ "subticks": 40000000000
25
+ },
26
+ {
27
+ "timeInForce": 2,
28
+ "reduceOnly": true,
29
+ "orderFlags": 64,
30
+ "side": 1,
31
+ "quantums": 10000000,
32
+ "subticks": 40000000000
33
+ },
34
+ {
35
+ "timeInForce": 1,
36
+ "reduceOnly": false,
37
+ "orderFlags": 0,
38
+ "side": 1,
39
+ "quantums": 10000000,
40
+ "subticks": 40000000000
41
+ },
42
+ {
43
+ "timeInForce": 1,
44
+ "reduceOnly": true,
45
+ "orderFlags": 0,
46
+ "side": 1,
47
+ "quantums": 10000000,
48
+ "subticks": 40000000000
49
+ },
50
+ {
51
+ "timeInForce": 3,
52
+ "reduceOnly": false,
53
+ "orderFlags": 0,
54
+ "side": 1,
55
+ "quantums": 10000000,
56
+ "subticks": 40000000000
57
+ },
58
+ {
59
+ "timeInForce": 3,
60
+ "reduceOnly": true,
61
+ "orderFlags": 0,
62
+ "side": 1,
63
+ "quantums": 10000000,
64
+ "subticks": 40000000000
65
+ },
66
+ {
67
+ "timeInForce": 0,
68
+ "reduceOnly": false,
69
+ "orderFlags": 64,
70
+ "side": 2,
71
+ "quantums": 10000000,
72
+ "subticks": 1000000000
73
+ },
74
+ {
75
+ "timeInForce": 2,
76
+ "reduceOnly": false,
77
+ "orderFlags": 64,
78
+ "side": 2,
79
+ "quantums": 10000000,
80
+ "subticks": 1000000000
81
+ },
82
+ {
83
+ "timeInForce": 0,
84
+ "reduceOnly": true,
85
+ "orderFlags": 64,
86
+ "side": 2,
87
+ "quantums": 10000000,
88
+ "subticks": 1000000000
89
+ },
90
+ {
91
+ "timeInForce": 2,
92
+ "reduceOnly": true,
93
+ "orderFlags": 64,
94
+ "side": 2,
95
+ "quantums": 10000000,
96
+ "subticks": 1000000000
97
+ },
98
+ {
99
+ "timeInForce": 1,
100
+ "reduceOnly": false,
101
+ "orderFlags": 0,
102
+ "side": 2,
103
+ "quantums": 10000000,
104
+ "subticks": 1000000000
105
+ },
106
+ {
107
+ "timeInForce": 1,
108
+ "reduceOnly": true,
109
+ "orderFlags": 0,
110
+ "side": 2,
111
+ "quantums": 10000000,
112
+ "subticks": 1000000000
113
+ },
114
+ {
115
+ "timeInForce": 3,
116
+ "reduceOnly": false,
117
+ "orderFlags": 0,
118
+ "side": 2,
119
+ "quantums": 10000000,
120
+ "subticks": 1000000000
121
+ },
122
+ {
123
+ "timeInForce": 3,
124
+ "reduceOnly": true,
125
+ "orderFlags": 0,
126
+ "side": 2,
127
+ "quantums": 10000000,
128
+ "subticks": 1000000000
129
+ }
130
130
  ]
@@ -1,8 +1,6 @@
1
1
  import { BECH32_PREFIX, OrderFlags, Order_TimeInForce } from '../src';
2
2
  import { CompositeClient } from '../src/clients/composite-client';
3
- import {
4
- Network, OrderSide,
5
- } from '../src/clients/constants';
3
+ import { Network, OrderSide } from '../src/clients/constants';
6
4
  import LocalWallet from '../src/clients/modules/local-wallet';
7
5
  import { SubaccountInfo } from '../src/clients/subaccount';
8
6
  import { randomInt, sleep } from '../src/lib/utils';
@@ -43,7 +41,7 @@ async function test(): Promise<void> {
43
41
  console.log(error.message);
44
42
  }
45
43
 
46
- await sleep(5000); // wait for placeOrder to complete
44
+ await sleep(5000); // wait for placeOrder to complete
47
45
 
48
46
  try {
49
47
  // cancel the short term order
@@ -63,7 +61,8 @@ async function test(): Promise<void> {
63
61
  }
64
62
  }
65
63
 
66
- test().then(() => {
67
- }).catch((error) => {
68
- console.log(error.message);
69
- });
64
+ test()
65
+ .then(() => {})
66
+ .catch((error) => {
67
+ console.log(error.message);
68
+ });
@@ -2,9 +2,7 @@ import { Order_TimeInForce } from '@dydxprotocol/v4-proto/src/codegen/dydxprotoc
2
2
 
3
3
  import { BECH32_PREFIX } from '../src';
4
4
  import { CompositeClient } from '../src/clients/composite-client';
5
- import {
6
- Network, OrderExecution, OrderSide,
7
- } from '../src/clients/constants';
5
+ import { Network, OrderExecution, OrderSide } from '../src/clients/constants';
8
6
  import LocalWallet from '../src/clients/modules/local-wallet';
9
7
  import { SubaccountInfo } from '../src/clients/subaccount';
10
8
  import { randomInt } from '../src/lib/utils';
@@ -56,7 +54,7 @@ async function test(): Promise<void> {
56
54
  console.log(error.message);
57
55
  }
58
56
 
59
- await sleep(5000); // wait for placeOrder to complete
57
+ await sleep(5000); // wait for placeOrder to complete
60
58
  }
61
59
  }
62
60
 
@@ -75,7 +73,8 @@ function orderExecutionToTimeInForce(orderExecution: string): Order_TimeInForce
75
73
  }
76
74
  }
77
75
 
78
- test().then(() => {
79
- }).catch((error) => {
80
- console.log(error.message);
81
- });
76
+ test()
77
+ .then(() => {})
78
+ .catch((error) => {
79
+ console.log(error.message);
80
+ });
package/examples/test.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { BECH32_PREFIX } from '../src';
2
2
  import { CompositeClient } from '../src/clients/composite-client';
3
3
  import {
4
- Network, OrderExecution, OrderSide, OrderTimeInForce, OrderType,
4
+ Network,
5
+ OrderExecution,
6
+ OrderSide,
7
+ OrderTimeInForce,
8
+ OrderType,
5
9
  } from '../src/clients/constants';
6
10
  import LocalWallet from '../src/clients/modules/local-wallet';
7
11
  import { SubaccountInfo } from '../src/clients/subaccount';
@@ -28,7 +32,7 @@ async function test(): Promise<void> {
28
32
  const timeInForceString = orderParams.timeInForce ?? 'GTT';
29
33
  const timeInForce = OrderTimeInForce[timeInForceString as keyof typeof OrderTimeInForce];
30
34
  const price = orderParams.price ?? 1350;
31
- const timeInForceSeconds = (timeInForce === OrderTimeInForce.GTT) ? 60 : 0;
35
+ const timeInForceSeconds = timeInForce === OrderTimeInForce.GTT ? 60 : 0;
32
36
  const postOnly = orderParams.postOnly ?? false;
33
37
  const tx = await client.placeOrder(
34
38
  subaccount,
@@ -50,11 +54,12 @@ async function test(): Promise<void> {
50
54
  console.log(error.message);
51
55
  }
52
56
 
53
- await sleep(5000); // wait for placeOrder to complete
57
+ await sleep(5000); // wait for placeOrder to complete
54
58
  }
55
59
  }
56
60
 
57
- test().then(() => {
58
- }).catch((error) => {
59
- console.log(error.message);
60
- });
61
+ test()
62
+ .then(() => {})
63
+ .catch((error) => {
64
+ console.log(error.message);
65
+ });
@@ -16,16 +16,13 @@ async function test(): Promise<void> {
16
16
  console.log(client);
17
17
 
18
18
  const subaccount = new SubaccountInfo(wallet, 0);
19
- const tx = await client.post.deposit(
20
- subaccount,
21
- 0,
22
- new Long(10_000_000),
23
- );
19
+ const tx = await client.post.deposit(subaccount, 0, new Long(10_000_000));
24
20
  console.log('**Deposit Tx**');
25
21
  console.log(tx);
26
22
  }
27
23
 
28
- test().then(() => {
29
- }).catch((error) => {
30
- console.log(error.message);
31
- });
24
+ test()
25
+ .then(() => {})
26
+ .catch((error) => {
27
+ console.log(error.message);
28
+ });
@@ -11,10 +11,7 @@ import { ValidatorClient } from '../src/clients/validator-client';
11
11
  import { DYDX_TEST_MNEMONIC } from './constants';
12
12
 
13
13
  async function test(): Promise<void> {
14
- const wallet = await LocalWallet.fromMnemonic(
15
- DYDX_TEST_MNEMONIC,
16
- BECH32_PREFIX,
17
- );
14
+ const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
18
15
  console.log(wallet);
19
16
 
20
17
  const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
@@ -36,12 +33,7 @@ async function test(): Promise<void> {
36
33
  resolve([msg]);
37
34
  });
38
35
 
39
- const totalFee = await client.post.simulate(
40
- subaccount.wallet,
41
- () => msgs,
42
- undefined,
43
- undefined,
44
- );
36
+ const totalFee = await client.post.simulate(subaccount.wallet, () => msgs, undefined, undefined);
45
37
  console.log('**Total Fee**');
46
38
  console.log(totalFee);
47
39
 
@@ -17,18 +17,13 @@ async function test(): Promise<void> {
17
17
 
18
18
  const subaccount = new SubaccountInfo(wallet, 0);
19
19
 
20
- const tx = await client.post.transfer(
21
- subaccount,
22
- subaccount.address,
23
- 1,
24
- 0,
25
- new Long(10_000_000),
26
- );
20
+ const tx = await client.post.transfer(subaccount, subaccount.address, 1, 0, new Long(10_000_000));
27
21
  console.log('**Transfer Tx**');
28
22
  console.log(tx);
29
23
  }
30
24
 
31
- test().then(() => {
32
- }).catch((error) => {
33
- console.log(error.message);
34
- });
25
+ test()
26
+ .then(() => {})
27
+ .catch((error) => {
28
+ console.log(error.message);
29
+ });
@@ -19,16 +19,13 @@ async function test(): Promise<void> {
19
19
 
20
20
  const subaccount = new SubaccountInfo(wallet, 0);
21
21
 
22
- const tx = await client.post.withdraw(
23
- subaccount,
24
- 0,
25
- new Long(1_00_000_000),
26
- );
22
+ const tx = await client.post.withdraw(subaccount, 0, new Long(1_00_000_000));
27
23
  console.log('**Withdraw Tx**');
28
24
  console.log(tx);
29
25
  }
30
26
 
31
- test().then(() => {
32
- }).catch((error) => {
33
- console.log(error.message);
34
- });
27
+ test()
28
+ .then(() => {})
29
+ .catch((error) => {
30
+ console.log(error.message);
31
+ });
@@ -34,11 +34,7 @@ async function test(): Promise<void> {
34
34
  resolve([msg]);
35
35
  });
36
36
 
37
- const totalFee = await client.post.simulate(
38
- subaccount.wallet,
39
- () => msgs,
40
- undefined,
41
- );
37
+ const totalFee = await client.post.simulate(subaccount.wallet, () => msgs, undefined);
42
38
  console.log('**Total Fee**');
43
39
  console.log(totalFee);
44
40
 
@@ -35,7 +35,8 @@ async function test(): Promise<void> {
35
35
  }
36
36
  }
37
37
 
38
- test().then(() => {
39
- }).catch((error) => {
40
- console.log(error.message);
41
- });
38
+ test()
39
+ .then(() => {})
40
+ .catch((error) => {
41
+ console.log(error.message);
42
+ });
@@ -110,14 +110,23 @@ async function test(): Promise<void> {
110
110
  }
111
111
 
112
112
  try {
113
- const unbondingDelegations = await client
114
- .get.getDelegatorUnbondingDelegations(DYDX_TEST_ADDRESS);
113
+ const unbondingDelegations =
114
+ await client.get.getDelegatorUnbondingDelegations(DYDX_TEST_ADDRESS);
115
115
  console.log('Unbonding Delegationss');
116
116
  console.log(JSON.stringify(unbondingDelegations));
117
117
  } catch (error) {
118
118
  console.log(JSON.stringify(error.message));
119
119
  }
120
120
 
121
+ try {
122
+ const delegationsTotalRewards =
123
+ await client.get.getDelegationTotalRewards(DYDX_TEST_ADDRESS);
124
+ console.log('Delegations total rewards');
125
+ console.log(JSON.stringify(delegationsTotalRewards));
126
+ } catch (error) {
127
+ console.log(JSON.stringify(error.message));
128
+ }
129
+
121
130
  try {
122
131
  const getAllBondedValidators = await client.get.getAllValidators('BOND_STATUS_BONDED');
123
132
  console.log('All Validators');
@@ -127,8 +136,7 @@ async function test(): Promise<void> {
127
136
  }
128
137
 
129
138
  try {
130
- const delayedCompleteBridgeMessagesParams = await client
131
- .get.getDelayedCompleteBridgeMessages();
139
+ const delayedCompleteBridgeMessagesParams = await client.get.getDelayedCompleteBridgeMessages();
132
140
  console.log('All delayed complete bridge messages');
133
141
  console.log(JSON.stringify(delayedCompleteBridgeMessagesParams));
134
142
  } catch (error) {
@@ -136,8 +144,8 @@ async function test(): Promise<void> {
136
144
  }
137
145
 
138
146
  try {
139
- const delayedCompleteBridgeMessagesParams = await client
140
- .get.getDelayedCompleteBridgeMessages(DYDX_TEST_ADDRESS);
147
+ const delayedCompleteBridgeMessagesParams =
148
+ await client.get.getDelayedCompleteBridgeMessages(DYDX_TEST_ADDRESS);
141
149
  console.log('Filtered delayed complete bridge messages');
142
150
  console.log(JSON.stringify(delayedCompleteBridgeMessagesParams));
143
151
  } catch (error) {
@@ -145,7 +153,8 @@ async function test(): Promise<void> {
145
153
  }
146
154
  }
147
155
 
148
- test().then(() => {
149
- }).catch((error) => {
150
- console.log(error.message);
151
- });
156
+ test()
157
+ .then(() => {})
158
+ .catch((error) => {
159
+ console.log(error.message);
160
+ });
@@ -63,21 +63,19 @@ async function test(): Promise<void> {
63
63
  placeOrder.goodTilBlockTime = 0;
64
64
  }
65
65
 
66
- const tx = await client.post.placeOrderObject(
67
- subaccount,
68
- placeOrder,
69
- );
66
+ const tx = await client.post.placeOrderObject(subaccount, placeOrder);
70
67
  console.log('**Order Tx**');
71
68
  console.log(tx);
72
69
  } catch (error) {
73
70
  console.log(error.message);
74
71
  }
75
72
 
76
- await sleep(5000); // wait for placeOrder to complete
73
+ await sleep(5000); // wait for placeOrder to complete
77
74
  }
78
75
  }
79
76
 
80
- test().then(() => {
81
- }).catch((error) => {
82
- console.log(error.message);
83
- });
77
+ test()
78
+ .then(() => {})
79
+ .catch((error) => {
80
+ console.log(error.message);
81
+ });
@@ -6,12 +6,13 @@ async function test(): Promise<void> {
6
6
  const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
7
7
  console.log(wallet);
8
8
  const address = wallet.address;
9
- const addressOk = (address === DYDX_TEST_ADDRESS);
9
+ const addressOk = address === DYDX_TEST_ADDRESS;
10
10
  console.log(addressOk);
11
11
  console.log(address);
12
12
  }
13
13
 
14
- test().then(() => {
15
- }).catch((error) => {
16
- console.log(error.message);
17
- });
14
+ test()
15
+ .then(() => {})
16
+ .catch((error) => {
17
+ console.log(error.message);
18
+ });
@@ -1,5 +1,9 @@
1
1
  import { Network } from '../src/clients/constants';
2
- import { CandlesResolution, IncomingMessageTypes, SocketClient } from '../src/clients/socket-client';
2
+ import {
3
+ CandlesResolution,
4
+ IncomingMessageTypes,
5
+ SocketClient,
6
+ } from '../src/clients/socket-client';
3
7
  import { DYDX_TEST_ADDRESS } from './constants';
4
8
 
5
9
  function test(): void {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dydxprotocol/v4-client-js",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "General client library for the new dYdX system (v4 decentralized)",
5
5
  "main": "build/src/index.js",
6
6
  "scripts": {
@@ -59,6 +59,7 @@
59
59
  "@types/ffi-napi": "^4.0.4",
60
60
  "@types/ws": "8.5.4",
61
61
  "@typescript-eslint/eslint-plugin": "v5.42.0",
62
+ "@typescript-eslint/parser": "v5.42.0",
62
63
  "acorn": "^8.8.2",
63
64
  "babel-loader": "^9.1.2",
64
65
  "babel-polyfill": "^6.26.0",
@@ -66,10 +67,12 @@
66
67
  "browserify-zlib": "^0.2.0",
67
68
  "buffer": "^6.0.3",
68
69
  "crypto-browserify": "^3.12.0",
70
+ "eslint-config-prettier": "^9.1.0",
69
71
  "grpc-tools": "^1.12.4",
70
72
  "https-browserify": "^1.0.0",
71
73
  "node-polyfill-webpack-plugin": "^2.0.1",
72
74
  "path-browserify": "^1.0.1",
75
+ "prettier": "3.2.5",
73
76
  "stream-browserify": "^3.0.0",
74
77
  "stream-http": "^3.2.0",
75
78
  "ts-loader": "^9.4.2",