@dydxprotocol/v4-client-js 0.38.4 → 0.38.5

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.
@@ -13,7 +13,7 @@ import { UserError } from '../lib/errors';
13
13
  import { encodeJson } from '../lib/helpers';
14
14
  import { deriveHDKeyFromEthereumSignature } from '../lib/onboarding';
15
15
  import { NetworkOptimizer } from '../network_optimizer';
16
- import { CompositeClient } from './composite-client';
16
+ import { CompositeClient, MarketInfo } from './composite-client';
17
17
  import {
18
18
  Network, OrderType, OrderSide, OrderTimeInForce, OrderExecution, IndexerConfig, ValidatorConfig,
19
19
  } from './constants';
@@ -224,6 +224,9 @@ export async function placeOrder(
224
224
  const reduceOnly = json.reduceOnly ?? false;
225
225
  const triggerPrice = json.triggerPrice;
226
226
 
227
+ const marketInfo = json.marketInfo as MarketInfo;
228
+ const currentHeight = json.currentHeight as number;
229
+
227
230
  const subaccount = new Subaccount(wallet, subaccountNumber);
228
231
  const tx = await client.placeOrder(
229
232
  subaccount,
@@ -239,6 +242,8 @@ export async function placeOrder(
239
242
  postOnly,
240
243
  reduceOnly,
241
244
  triggerPrice,
245
+ marketInfo,
246
+ currentHeight,
242
247
  );
243
248
  return encodeJson(tx);
244
249
  } catch (error) {
@@ -580,9 +585,13 @@ export async function simulateDeposit(
580
585
  );
581
586
  const msgs: EncodeObject[] = [msg];
582
587
  const encodeObjects: Promise<EncodeObject[]> = new Promise((resolve) => resolve(msgs));
583
- const stdFee = await client.simulate(globalThis.wallet, () => {
584
- return encodeObjects;
585
- });
588
+
589
+ const stdFee = await client.simulate(
590
+ globalThis.wallet,
591
+ () => {
592
+ return encodeObjects;
593
+ },
594
+ );
586
595
  return JSON.stringify(stdFee);
587
596
  } catch (error) {
588
597
  return wrappedError(error);
@@ -619,9 +628,13 @@ export async function simulateWithdraw(
619
628
  );
620
629
  const msgs: EncodeObject[] = [msg];
621
630
  const encodeObjects: Promise<EncodeObject[]> = new Promise((resolve) => resolve(msgs));
622
- const stdFee = await client.simulate(globalThis.wallet, () => {
623
- return encodeObjects;
624
- });
631
+
632
+ const stdFee = await client.simulate(
633
+ globalThis.wallet,
634
+ () => {
635
+ return encodeObjects;
636
+ },
637
+ );
625
638
  return encodeJson(stdFee);
626
639
  } catch (error) {
627
640
  return wrappedError(error);
@@ -662,6 +675,7 @@ export async function simulateTransferNativeToken(
662
675
  );
663
676
  const msgs: EncodeObject[] = [msg];
664
677
  const encodeObjects: Promise<EncodeObject[]> = new Promise((resolve) => resolve(msgs));
678
+
665
679
  const stdFee = await client.simulate(
666
680
  globalThis.wallet,
667
681
  () => {