@drift-labs/sdk 2.157.0-beta.7 → 2.158.0-beta.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.157.0-beta.7
1
+ 2.158.0-beta.0
@@ -40,7 +40,12 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
40
40
  filters: [],
41
41
  }, resubOpts) {
42
42
  var _a, _b;
43
- const client = await (0, grpc_1.createClient)(grpcConfigs.endpoint, grpcConfigs.token, (_a = grpcConfigs.channelOptions) !== null && _a !== void 0 ? _a : {});
43
+ const channelOptions = {
44
+ ...((_a = grpcConfigs.channelOptions) !== null && _a !== void 0 ? _a : {}),
45
+ grpcDefaultCompressionAlgorithm: 1, // always use zstd compression
46
+ grpcHttp2AdaptiveWindow: true, // enable adaptive window size management
47
+ };
48
+ const client = await (0, grpc_1.createClient)(grpcConfigs.endpoint, grpcConfigs.token, channelOptions);
44
49
  const commitmentLevel =
45
50
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
46
51
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : grpc_1.CommitmentLevel.CONFIRMED;
@@ -5,7 +5,7 @@
5
5
  import * as anchor from '@coral-xyz/anchor';
6
6
  import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
7
7
  import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
8
- import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
8
+ import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, ScaleOrderParams, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
9
9
  import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
10
10
  import { TokenFaucet } from './tokenFaucet';
11
11
  import { EventEmitter } from 'events';
@@ -578,6 +578,18 @@ export declare class DriftClient {
578
578
  authority?: PublicKey;
579
579
  }): Promise<TransactionInstruction>;
580
580
  getPlaceOrdersAndSetPositionMaxLevIx(params: OptionalOrderParams[], positionMaxLev: number, subAccountId?: number): Promise<TransactionInstruction[]>;
581
+ /**
582
+ * Place scale orders: multiple limit orders distributed across a price range
583
+ * @param params Scale order parameters
584
+ * @param txParams Optional transaction parameters
585
+ * @param subAccountId Optional sub account ID
586
+ * @returns Transaction signature
587
+ */
588
+ placeScaleOrders(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
589
+ preparePlaceScaleOrdersTx(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<{
590
+ placeScaleOrdersTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
591
+ }>;
592
+ getPlaceScaleOrdersIx(params: ScaleOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
581
593
  fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionSignature>;
582
594
  getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionInstruction>;
583
595
  getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
@@ -2867,6 +2867,65 @@ class DriftClient {
2867
2867
  const setPositionMaxLevIxs = await this.getUpdateUserPerpPositionCustomMarginRatioIx(readablePerpMarketIndex[0], marginRatio, subAccountId);
2868
2868
  return [placeOrdersIxs, setPositionMaxLevIxs];
2869
2869
  }
2870
+ /**
2871
+ * Place scale orders: multiple limit orders distributed across a price range
2872
+ * @param params Scale order parameters
2873
+ * @param txParams Optional transaction parameters
2874
+ * @param subAccountId Optional sub account ID
2875
+ * @returns Transaction signature
2876
+ */
2877
+ async placeScaleOrders(params, txParams, subAccountId) {
2878
+ const { txSig } = await this.sendTransaction((await this.preparePlaceScaleOrdersTx(params, txParams, subAccountId))
2879
+ .placeScaleOrdersTx, [], this.opts, false);
2880
+ return txSig;
2881
+ }
2882
+ async preparePlaceScaleOrdersTx(params, txParams, subAccountId) {
2883
+ const lookupTableAccounts = await this.fetchAllLookupTableAccounts();
2884
+ const tx = await this.buildTransaction(await this.getPlaceScaleOrdersIx(params, subAccountId), txParams, undefined, lookupTableAccounts);
2885
+ return {
2886
+ placeScaleOrdersTx: tx,
2887
+ };
2888
+ }
2889
+ async getPlaceScaleOrdersIx(params, subAccountId) {
2890
+ const user = await this.getUserAccountPublicKey(subAccountId);
2891
+ const isPerp = (0, types_1.isVariant)(params.marketType, 'perp');
2892
+ const remainingAccounts = this.getRemainingAccounts({
2893
+ userAccounts: [this.getUserAccount(subAccountId)],
2894
+ readablePerpMarketIndex: isPerp ? [params.marketIndex] : [],
2895
+ readableSpotMarketIndexes: isPerp ? [] : [params.marketIndex],
2896
+ useMarketLastSlotCache: true,
2897
+ });
2898
+ if ((0, orderParams_1.isUpdateHighLeverageMode)(params.bitFlags)) {
2899
+ remainingAccounts.push({
2900
+ pubkey: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
2901
+ isWritable: true,
2902
+ isSigner: false,
2903
+ });
2904
+ }
2905
+ const formattedParams = {
2906
+ marketType: params.marketType,
2907
+ direction: params.direction,
2908
+ marketIndex: params.marketIndex,
2909
+ totalBaseAssetAmount: params.totalBaseAssetAmount,
2910
+ startPrice: params.startPrice,
2911
+ endPrice: params.endPrice,
2912
+ orderCount: params.orderCount,
2913
+ sizeDistribution: params.sizeDistribution,
2914
+ reduceOnly: params.reduceOnly,
2915
+ postOnly: params.postOnly,
2916
+ bitFlags: params.bitFlags,
2917
+ maxTs: params.maxTs,
2918
+ };
2919
+ return await this.program.instruction.placeScaleOrders(formattedParams, {
2920
+ accounts: {
2921
+ state: await this.getStatePublicKey(),
2922
+ user,
2923
+ userStats: this.getUserStatsAccountPublicKey(),
2924
+ authority: this.wallet.publicKey,
2925
+ },
2926
+ remainingAccounts,
2927
+ });
2928
+ }
2870
2929
  async fillPerpOrder(userAccountPublicKey, user, order, makerInfo, referrerInfo, txParams, fillerSubAccountId, fillerAuthority, hasBuilderFee) {
2871
2930
  const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getFillPerpOrderIx(userAccountPublicKey, user, order, makerInfo, referrerInfo, fillerSubAccountId, undefined, fillerAuthority, hasBuilderFee), txParams), [], this.opts);
2872
2931
  return txSig;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.156.0",
2
+ "version": "2.157.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -1382,6 +1382,34 @@
1382
1382
  }
1383
1383
  ]
1384
1384
  },
1385
+ {
1386
+ "name": "placeScaleOrders",
1387
+ "accounts": [
1388
+ {
1389
+ "name": "state",
1390
+ "isMut": false,
1391
+ "isSigner": false
1392
+ },
1393
+ {
1394
+ "name": "user",
1395
+ "isMut": true,
1396
+ "isSigner": false
1397
+ },
1398
+ {
1399
+ "name": "authority",
1400
+ "isMut": false,
1401
+ "isSigner": true
1402
+ }
1403
+ ],
1404
+ "args": [
1405
+ {
1406
+ "name": "params",
1407
+ "type": {
1408
+ "defined": "ScaleOrderParams"
1409
+ }
1410
+ }
1411
+ ]
1412
+ },
1385
1413
  {
1386
1414
  "name": "beginSwap",
1387
1415
  "accounts": [
@@ -13260,6 +13288,102 @@
13260
13288
  ]
13261
13289
  }
13262
13290
  },
13291
+ {
13292
+ "name": "ScaleOrderParams",
13293
+ "docs": [
13294
+ "Parameters for placing scale orders - multiple limit orders distributed across a price range"
13295
+ ],
13296
+ "type": {
13297
+ "kind": "struct",
13298
+ "fields": [
13299
+ {
13300
+ "name": "marketType",
13301
+ "type": {
13302
+ "defined": "MarketType"
13303
+ }
13304
+ },
13305
+ {
13306
+ "name": "direction",
13307
+ "type": {
13308
+ "defined": "PositionDirection"
13309
+ }
13310
+ },
13311
+ {
13312
+ "name": "marketIndex",
13313
+ "type": "u16"
13314
+ },
13315
+ {
13316
+ "name": "totalBaseAssetAmount",
13317
+ "docs": [
13318
+ "Total base asset amount to distribute across all orders"
13319
+ ],
13320
+ "type": "u64"
13321
+ },
13322
+ {
13323
+ "name": "startPrice",
13324
+ "docs": [
13325
+ "Starting price for the scale (in PRICE_PRECISION)"
13326
+ ],
13327
+ "type": "u64"
13328
+ },
13329
+ {
13330
+ "name": "endPrice",
13331
+ "docs": [
13332
+ "Ending price for the scale (in PRICE_PRECISION)"
13333
+ ],
13334
+ "type": "u64"
13335
+ },
13336
+ {
13337
+ "name": "orderCount",
13338
+ "docs": [
13339
+ "Number of orders to place (min 2, max 32)"
13340
+ ],
13341
+ "type": "u8"
13342
+ },
13343
+ {
13344
+ "name": "sizeDistribution",
13345
+ "docs": [
13346
+ "How to distribute sizes across orders"
13347
+ ],
13348
+ "type": {
13349
+ "defined": "SizeDistribution"
13350
+ }
13351
+ },
13352
+ {
13353
+ "name": "reduceOnly",
13354
+ "docs": [
13355
+ "Whether orders should be reduce-only"
13356
+ ],
13357
+ "type": "bool"
13358
+ },
13359
+ {
13360
+ "name": "postOnly",
13361
+ "docs": [
13362
+ "Post-only setting for all orders"
13363
+ ],
13364
+ "type": {
13365
+ "defined": "PostOnlyParam"
13366
+ }
13367
+ },
13368
+ {
13369
+ "name": "bitFlags",
13370
+ "docs": [
13371
+ "Bit flags (e.g., for high leverage mode)"
13372
+ ],
13373
+ "type": "u8"
13374
+ },
13375
+ {
13376
+ "name": "maxTs",
13377
+ "docs": [
13378
+ "Maximum timestamp for orders to be valid"
13379
+ ],
13380
+ "type": {
13381
+ "option": "i64"
13382
+ }
13383
+ }
13384
+ ]
13385
+ }
13386
+ },
13263
13387
  {
13264
13388
  "name": "InsuranceClaim",
13265
13389
  "type": {
@@ -15607,6 +15731,26 @@
15607
15731
  ]
15608
15732
  }
15609
15733
  },
15734
+ {
15735
+ "name": "SizeDistribution",
15736
+ "docs": [
15737
+ "How to distribute order sizes across scale orders"
15738
+ ],
15739
+ "type": {
15740
+ "kind": "enum",
15741
+ "variants": [
15742
+ {
15743
+ "name": "Flat"
15744
+ },
15745
+ {
15746
+ "name": "Ascending"
15747
+ },
15748
+ {
15749
+ "name": "Descending"
15750
+ }
15751
+ ]
15752
+ }
15753
+ },
15610
15754
  {
15611
15755
  "name": "PerpOperation",
15612
15756
  "type": {
@@ -19824,9 +19968,16 @@
19824
19968
  "code": 6345,
19825
19969
  "name": "InvalidIsolatedPerpMarket",
19826
19970
  "msg": "Invalid Isolated Perp Market"
19971
+ },
19972
+ {
19973
+ "code": 6346,
19974
+ "name": "InvalidOrderScaleOrderCount",
19975
+ "msg": "Invalid scale order count - must be between 2 and 10"
19976
+ },
19977
+ {
19978
+ "code": 6347,
19979
+ "name": "InvalidOrderScalePriceRange",
19980
+ "msg": "Invalid scale order price range"
19827
19981
  }
19828
- ],
19829
- "metadata": {
19830
- "address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
19831
- }
19982
+ ]
19832
19983
  }
@@ -1346,6 +1346,46 @@ export declare class PostOnlyParams {
1346
1346
  slide: {};
1347
1347
  };
1348
1348
  }
1349
+ /**
1350
+ * How to distribute order sizes across scale orders
1351
+ */
1352
+ export declare class SizeDistribution {
1353
+ static readonly FLAT: {
1354
+ flat: {};
1355
+ };
1356
+ static readonly ASCENDING: {
1357
+ ascending: {};
1358
+ };
1359
+ static readonly DESCENDING: {
1360
+ descending: {};
1361
+ };
1362
+ }
1363
+ /**
1364
+ * Parameters for placing scale orders - multiple limit orders distributed across a price range
1365
+ */
1366
+ export type ScaleOrderParams = {
1367
+ marketType: MarketType;
1368
+ direction: PositionDirection;
1369
+ marketIndex: number;
1370
+ /** Total base asset amount to distribute across all orders */
1371
+ totalBaseAssetAmount: BN;
1372
+ /** Starting price for the scale (in PRICE_PRECISION) */
1373
+ startPrice: BN;
1374
+ /** Ending price for the scale (in PRICE_PRECISION) */
1375
+ endPrice: BN;
1376
+ /** Number of orders to place (min 2, max 32). User cannot exceed 32 total open orders. */
1377
+ orderCount: number;
1378
+ /** How to distribute sizes across orders */
1379
+ sizeDistribution: SizeDistribution;
1380
+ /** Whether orders should be reduce-only */
1381
+ reduceOnly: boolean;
1382
+ /** Post-only setting for all orders */
1383
+ postOnly: PostOnlyParams;
1384
+ /** Bit flags (e.g., for high leverage mode) */
1385
+ bitFlags: number;
1386
+ /** Maximum timestamp for orders to be valid */
1387
+ maxTs: BN | null;
1388
+ };
1349
1389
  export declare class OrderParamsBitFlag {
1350
1390
  static readonly ImmediateOrCancel = 1;
1351
1391
  static readonly UpdateHighLeverageMode = 2;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OracleValidity = exports.SwapReduceOnly = exports.PlaceAndTakeOrderSuccessCondition = exports.FuelOverflowStatus = exports.ReferrerStatus = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PositionFlag = exports.OrderParamsBitFlag = exports.PostOnlyParams = exports.LiquidationBitFlag = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.SettlePnlMode = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderBitFlag = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSourceNum = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.TokenProgramFlag = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.MarginMode = exports.UserStatsPausedOperation = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.FeatureBitFlags = exports.ExchangeStatus = void 0;
4
- exports.ConstituentLpOperation = exports.ConstituentStatus = void 0;
3
+ exports.SwapReduceOnly = exports.PlaceAndTakeOrderSuccessCondition = exports.FuelOverflowStatus = exports.ReferrerStatus = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PositionFlag = exports.OrderParamsBitFlag = exports.SizeDistribution = exports.PostOnlyParams = exports.LiquidationBitFlag = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.SettlePnlMode = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderBitFlag = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSourceNum = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.TokenProgramFlag = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.MarginMode = exports.UserStatsPausedOperation = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.FeatureBitFlags = exports.ExchangeStatus = void 0;
4
+ exports.ConstituentLpOperation = exports.ConstituentStatus = exports.OracleValidity = void 0;
5
5
  const numericConstants_1 = require("./constants/numericConstants");
6
6
  // # Utility Types / Enums / Constants
7
7
  var ExchangeStatus;
@@ -371,6 +371,15 @@ PostOnlyParams.NONE = { none: {} };
371
371
  PostOnlyParams.MUST_POST_ONLY = { mustPostOnly: {} }; // Tx fails if order can't be post only
372
372
  PostOnlyParams.TRY_POST_ONLY = { tryPostOnly: {} }; // Tx succeeds and order not placed if can't be post only
373
373
  PostOnlyParams.SLIDE = { slide: {} }; // Modify price to be post only if can't be post only
374
+ /**
375
+ * How to distribute order sizes across scale orders
376
+ */
377
+ class SizeDistribution {
378
+ }
379
+ exports.SizeDistribution = SizeDistribution;
380
+ SizeDistribution.FLAT = { flat: {} }; // Equal size for all orders
381
+ SizeDistribution.ASCENDING = { ascending: {} }; // Smallest at start price, largest at end price
382
+ SizeDistribution.DESCENDING = { descending: {} }; // Largest at start price, smallest at end price
374
383
  class OrderParamsBitFlag {
375
384
  }
376
385
  exports.OrderParamsBitFlag = OrderParamsBitFlag;
@@ -1 +1 @@
1
- {"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAwBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAsBrC,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IA+FH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
1
+ {"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAwBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IA2BrC,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IA+FH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
@@ -40,7 +40,12 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
40
40
  filters: [],
41
41
  }, resubOpts) {
42
42
  var _a, _b;
43
- const client = await (0, grpc_1.createClient)(grpcConfigs.endpoint, grpcConfigs.token, (_a = grpcConfigs.channelOptions) !== null && _a !== void 0 ? _a : {});
43
+ const channelOptions = {
44
+ ...((_a = grpcConfigs.channelOptions) !== null && _a !== void 0 ? _a : {}),
45
+ grpcDefaultCompressionAlgorithm: 1, // always use zstd compression
46
+ grpcHttp2AdaptiveWindow: true, // enable adaptive window size management
47
+ };
48
+ const client = await (0, grpc_1.createClient)(grpcConfigs.endpoint, grpcConfigs.token, channelOptions);
44
49
  const commitmentLevel =
45
50
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
46
51
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : grpc_1.CommitmentLevel.CONFIRMED;
@@ -5,7 +5,7 @@
5
5
  import * as anchor from '@coral-xyz/anchor';
6
6
  import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
7
7
  import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
8
- import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
8
+ import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, ScaleOrderParams, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig, SignedMsgOrderParamsDelegateMessage, PostOnlyParams, LPPoolAccount, ConstituentAccount, ConstituentTargetBaseAccount, AmmCache } from './types';
9
9
  import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
10
10
  import { TokenFaucet } from './tokenFaucet';
11
11
  import { EventEmitter } from 'events';
@@ -578,6 +578,18 @@ export declare class DriftClient {
578
578
  authority?: PublicKey;
579
579
  }): Promise<TransactionInstruction>;
580
580
  getPlaceOrdersAndSetPositionMaxLevIx(params: OptionalOrderParams[], positionMaxLev: number, subAccountId?: number): Promise<TransactionInstruction[]>;
581
+ /**
582
+ * Place scale orders: multiple limit orders distributed across a price range
583
+ * @param params Scale order parameters
584
+ * @param txParams Optional transaction parameters
585
+ * @param subAccountId Optional sub account ID
586
+ * @returns Transaction signature
587
+ */
588
+ placeScaleOrders(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
589
+ preparePlaceScaleOrdersTx(params: ScaleOrderParams, txParams?: TxParams, subAccountId?: number): Promise<{
590
+ placeScaleOrdersTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
591
+ }>;
592
+ getPlaceScaleOrdersIx(params: ScaleOrderParams, subAccountId?: number): Promise<TransactionInstruction>;
581
593
  fillPerpOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, txParams?: TxParams, fillerSubAccountId?: number, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionSignature>;
582
594
  getFillPerpOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, fillerSubAccountId?: number, isSignedMsg?: boolean, fillerAuthority?: PublicKey, hasBuilderFee?: boolean): Promise<TransactionInstruction>;
583
595
  getRevertFillIx(fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;