@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.
- package/__native__/__ios__/v4-native-client.js +897 -147
- package/build/examples/short_term_order_composite_example.js +2 -2
- package/build/src/clients/composite-client.d.ts +19 -5
- package/build/src/clients/composite-client.js +62 -26
- package/build/src/clients/constants.d.ts +1 -0
- package/build/src/clients/constants.js +3 -2
- package/build/src/clients/modules/post.d.ts +11 -4
- package/build/src/clients/modules/post.js +41 -16
- package/build/src/clients/native.js +4 -2
- package/examples/short_term_order_composite_example.ts +1 -1
- package/package.json +1 -1
- package/src/clients/composite-client.ts +129 -23
- package/src/clients/constants.ts +2 -0
- package/src/clients/modules/post.ts +90 -12
- package/src/clients/native.ts +21 -7
- package/__native__/__ios__/v4-native-client.js.map +0 -1
package/src/clients/native.ts
CHANGED
|
@@ -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
|
-
|
|
584
|
-
|
|
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
|
-
|
|
623
|
-
|
|
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
|
() => {
|