@rabby-wallet/hyperliquid-sdk 1.1.2-beta.12 → 1.1.2-beta.13

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.
@@ -599,21 +599,28 @@ class ExchangeClient {
599
599
  batchModifyOrder(params) {
600
600
  return __awaiter(this, void 0, void 0, function* () {
601
601
  const nonce = Date.now();
602
+ const assetIndexCache = new Map();
603
+ const modifies = yield Promise.all(params.map((param) => __awaiter(this, void 0, void 0, function* () {
604
+ let assetIndex = assetIndexCache.get(param.coin);
605
+ if (assetIndex === undefined) {
606
+ assetIndex = yield this.symbolConversion.getAssetIndex(param.coin);
607
+ assetIndexCache.set(param.coin, assetIndex);
608
+ }
609
+ return {
610
+ oid: param.oid,
611
+ order: {
612
+ a: assetIndex,
613
+ b: param.isBuy,
614
+ p: (0, number_1.removeTrailingZeros)(param.limitPx),
615
+ s: (0, number_1.removeTrailingZeros)(param.sz),
616
+ r: param.reduceOnly || false,
617
+ t: param.orderType || { limit: { tif: 'Gtc' } },
618
+ }
619
+ };
620
+ })));
602
621
  const action = {
603
622
  type: constants_1.ExchangeType.BATCH_MODIFY,
604
- modifies: params.map((param) => __awaiter(this, void 0, void 0, function* () {
605
- return ({
606
- oid: param.oid,
607
- order: {
608
- a: yield this.symbolConversion.getAssetIndex(param.coin),
609
- b: param.isBuy,
610
- p: (0, number_1.removeTrailingZeros)(param.limitPx),
611
- s: (0, number_1.removeTrailingZeros)(param.sz),
612
- r: param.reduceOnly || false,
613
- t: param.orderType || { limit: { tif: 'Gtc' } },
614
- }
615
- });
616
- })),
623
+ modifies,
617
624
  };
618
625
  const signature = (0, signer_1.signL1AgentAction)(this.getAgentPrivateKey(), action, this.isTestnet, nonce);
619
626
  return this.httpClient.exchange({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/hyperliquid-sdk",
3
- "version": "1.1.2-beta.12",
3
+ "version": "1.1.2-beta.13",
4
4
  "description": "Simplified Hyperliquid Perpetuals Trading SDK for Frontend Applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",