@andy-liquid-labs/lighter-ts-sdk 1.0.4 → 1.0.6

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/dist/index.d.mts CHANGED
@@ -1894,6 +1894,7 @@ interface Candlestick {
1894
1894
  l: number;
1895
1895
  c: number;
1896
1896
  v: number;
1897
+ V: number;
1897
1898
  }
1898
1899
  interface CandlesRequest {
1899
1900
  market_id: number;
@@ -3427,6 +3428,22 @@ declare class ExchangeClient {
3427
3428
  orderExpiry: bigint;
3428
3429
  priceProtection?: boolean;
3429
3430
  }): Promise<TxHashResponse>;
3431
+ /**
3432
+ * Build the sendTx payload for creating an order without sending it
3433
+ */
3434
+ buildCreateOrderPayload(params: {
3435
+ marketIndex: number;
3436
+ clientOrderIndex: bigint;
3437
+ baseAmount: bigint;
3438
+ price: number;
3439
+ isAsk: number;
3440
+ orderType: number;
3441
+ timeInForce: number;
3442
+ reduceOnly: number;
3443
+ triggerPrice: number;
3444
+ orderExpiry: bigint;
3445
+ priceProtection?: boolean;
3446
+ }): Promise<SendTxFormRequest>;
3430
3447
  /**
3431
3448
  * Cancel an order using TypeScript signing
3432
3449
  */
@@ -3571,6 +3588,23 @@ declare class ExchangeClient {
3571
3588
  orderExpiry: bigint;
3572
3589
  }>;
3573
3590
  }): Promise<TxHashesResponse>;
3591
+ /**
3592
+ * Build the sendTxBatch payload for multiple orders without sending them
3593
+ */
3594
+ buildBatchOrdersPayload(params: {
3595
+ orders: Array<{
3596
+ marketIndex: number;
3597
+ clientOrderIndex: bigint;
3598
+ baseAmount: bigint;
3599
+ price: number;
3600
+ isAsk: number;
3601
+ orderType: number;
3602
+ timeInForce: number;
3603
+ reduceOnly: number;
3604
+ triggerPrice: number;
3605
+ orderExpiry: bigint;
3606
+ }>;
3607
+ }): Promise<SendTransactionBatchFormRequest>;
3574
3608
  /**
3575
3609
  * Generate change public key L1 sign message
3576
3610
  */
package/dist/index.d.ts CHANGED
@@ -1894,6 +1894,7 @@ interface Candlestick {
1894
1894
  l: number;
1895
1895
  c: number;
1896
1896
  v: number;
1897
+ V: number;
1897
1898
  }
1898
1899
  interface CandlesRequest {
1899
1900
  market_id: number;
@@ -3427,6 +3428,22 @@ declare class ExchangeClient {
3427
3428
  orderExpiry: bigint;
3428
3429
  priceProtection?: boolean;
3429
3430
  }): Promise<TxHashResponse>;
3431
+ /**
3432
+ * Build the sendTx payload for creating an order without sending it
3433
+ */
3434
+ buildCreateOrderPayload(params: {
3435
+ marketIndex: number;
3436
+ clientOrderIndex: bigint;
3437
+ baseAmount: bigint;
3438
+ price: number;
3439
+ isAsk: number;
3440
+ orderType: number;
3441
+ timeInForce: number;
3442
+ reduceOnly: number;
3443
+ triggerPrice: number;
3444
+ orderExpiry: bigint;
3445
+ priceProtection?: boolean;
3446
+ }): Promise<SendTxFormRequest>;
3430
3447
  /**
3431
3448
  * Cancel an order using TypeScript signing
3432
3449
  */
@@ -3571,6 +3588,23 @@ declare class ExchangeClient {
3571
3588
  orderExpiry: bigint;
3572
3589
  }>;
3573
3590
  }): Promise<TxHashesResponse>;
3591
+ /**
3592
+ * Build the sendTxBatch payload for multiple orders without sending them
3593
+ */
3594
+ buildBatchOrdersPayload(params: {
3595
+ orders: Array<{
3596
+ marketIndex: number;
3597
+ clientOrderIndex: bigint;
3598
+ baseAmount: bigint;
3599
+ price: number;
3600
+ isAsk: number;
3601
+ orderType: number;
3602
+ timeInForce: number;
3603
+ reduceOnly: number;
3604
+ triggerPrice: number;
3605
+ orderExpiry: bigint;
3606
+ }>;
3607
+ }): Promise<SendTransactionBatchFormRequest>;
3574
3608
  /**
3575
3609
  * Generate change public key L1 sign message
3576
3610
  */
package/dist/index.js CHANGED
@@ -5446,6 +5446,28 @@ var ExchangeClient = class {
5446
5446
  price_protection: params.priceProtection
5447
5447
  });
5448
5448
  }
5449
+ /**
5450
+ * Build the sendTx payload for creating an order without sending it
5451
+ */
5452
+ async buildCreateOrderPayload(params) {
5453
+ const txInfo = await this.txClient.signCreateOrder({
5454
+ marketIndex: params.marketIndex,
5455
+ clientOrderIndex: params.clientOrderIndex,
5456
+ baseAmount: params.baseAmount,
5457
+ price: params.price,
5458
+ isAsk: params.isAsk,
5459
+ type: params.orderType,
5460
+ timeInForce: params.timeInForce,
5461
+ reduceOnly: params.reduceOnly,
5462
+ triggerPrice: params.triggerPrice,
5463
+ orderExpiry: params.orderExpiry
5464
+ });
5465
+ return {
5466
+ tx_type: TxType.L2CreateOrder,
5467
+ tx_info: serializeCreateOrder(txInfo),
5468
+ price_protection: params.priceProtection
5469
+ };
5470
+ }
5449
5471
  /**
5450
5472
  * Cancel an order using TypeScript signing
5451
5473
  */
@@ -5672,6 +5694,38 @@ var ExchangeClient = class {
5672
5694
  tx_infos: JSON.stringify(txInfos)
5673
5695
  });
5674
5696
  }
5697
+ /**
5698
+ * Build the sendTxBatch payload for multiple orders without sending them
5699
+ */
5700
+ async buildBatchOrdersPayload(params) {
5701
+ const txTypes = [];
5702
+ const txInfos = [];
5703
+ let nextNonce = await this.txClient.getNextNonce();
5704
+ for (const order of params.orders) {
5705
+ const txInfo = await this.txClient.signCreateOrder(
5706
+ {
5707
+ marketIndex: order.marketIndex,
5708
+ clientOrderIndex: order.clientOrderIndex,
5709
+ baseAmount: order.baseAmount,
5710
+ price: order.price,
5711
+ isAsk: order.isAsk,
5712
+ type: order.orderType,
5713
+ timeInForce: order.timeInForce,
5714
+ reduceOnly: order.reduceOnly,
5715
+ triggerPrice: order.triggerPrice,
5716
+ orderExpiry: order.orderExpiry
5717
+ },
5718
+ { nonce: nextNonce }
5719
+ );
5720
+ nextNonce++;
5721
+ txTypes.push(TxType.L2CreateOrder);
5722
+ txInfos.push(serializeCreateOrder(txInfo));
5723
+ }
5724
+ return {
5725
+ tx_types: JSON.stringify(txTypes),
5726
+ tx_infos: JSON.stringify(txInfos)
5727
+ };
5728
+ }
5675
5729
  /**
5676
5730
  * Generate change public key L1 sign message
5677
5731
  */