@triadxyz/triad-protocol 2.3.3-beta → 2.3.4-beta

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/trade.d.ts CHANGED
@@ -324,7 +324,7 @@ export default class Trade {
324
324
  * @param options - RPC options
325
325
  *
326
326
  */
327
- placeAskOrder({ marketId, amount, direction, price, bidOrderId, bidNonce }: PlaceAskOrderArgs, options?: RpcOptions): Promise<string>;
327
+ placeAskOrder({ marketId, orders, direction }: PlaceAskOrderArgs, options?: RpcOptions): Promise<string>;
328
328
  /**
329
329
  * Cancel Bid Order
330
330
  * @param args.marketId - The ID of the Market
package/dist/trade.js CHANGED
@@ -619,7 +619,7 @@ class Trade {
619
619
  * @param options - RPC options
620
620
  *
621
621
  */
622
- placeAskOrder({ marketId, amount, direction, price, bidOrderId, bidNonce }, options) {
622
+ placeAskOrder({ marketId, orders, direction }, options) {
623
623
  return __awaiter(this, void 0, void 0, function* () {
624
624
  const ixs = [];
625
625
  const { userTradePDA: askUserTradePDA, ixs: userTradeIxs } = yield this.getUserTradeIxs();
@@ -627,24 +627,26 @@ class Trade {
627
627
  ixs.push(...userTradeIxs);
628
628
  }
629
629
  let bidUserTradePDA = (0, pda_1.getUserTradePDA)(this.program.programId, this.program.provider.publicKey);
630
- if (bidNonce !== 0) {
631
- const subUserTradePDA = (0, pda_1.getSubUserTradePDA)(this.program.programId, this.program.provider.publicKey, bidNonce);
632
- bidUserTradePDA = (0, pda_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
630
+ for (const order of orders) {
631
+ if (order.bidNonce !== 0) {
632
+ const subUserTradePDA = (0, pda_1.getSubUserTradePDA)(this.program.programId, this.program.provider.publicKey, order.bidNonce);
633
+ bidUserTradePDA = (0, pda_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
634
+ }
635
+ ixs.push(yield this.program.methods
636
+ .placeAskOrder({
637
+ shares: new bn_js_1.default(order.amount * Math.pow(10, this.decimals)),
638
+ price: new bn_js_1.default(order.price * Math.pow(10, this.decimals)),
639
+ bidOrderId: new bn_js_1.default(order.bidOrderId),
640
+ orderDirection: direction
641
+ })
642
+ .accounts({
643
+ signer: this.program.provider.publicKey,
644
+ market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
645
+ askUserTrade: askUserTradePDA,
646
+ bidUserTrade: bidUserTradePDA
647
+ })
648
+ .instruction());
633
649
  }
634
- ixs.push(yield this.program.methods
635
- .placeAskOrder({
636
- shares: new bn_js_1.default(amount * Math.pow(10, this.decimals)),
637
- price: new bn_js_1.default(price * Math.pow(10, this.decimals)),
638
- bidOrderId: new bn_js_1.default(bidOrderId),
639
- orderDirection: direction
640
- })
641
- .accounts({
642
- signer: this.program.provider.publicKey,
643
- market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
644
- askUserTrade: askUserTradePDA,
645
- bidUserTrade: bidUserTradePDA
646
- })
647
- .instruction());
648
650
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
649
651
  });
650
652
  }
@@ -112,15 +112,17 @@ export type PlaceBidOrderArgs = {
112
112
  };
113
113
  export type PlaceAskOrderArgs = {
114
114
  marketId: number;
115
- amount: number;
116
- price: number;
115
+ orders: {
116
+ amount: number;
117
+ price: number;
118
+ bidOrderId: number;
119
+ bidNonce: number;
120
+ }[];
117
121
  direction: {
118
122
  hype: {};
119
123
  } | {
120
124
  flop: {};
121
125
  };
122
- bidOrderId: number;
123
- bidNonce: number;
124
126
  };
125
127
  export type InitializeMarketArgs = {
126
128
  marketId: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.3.3-beta",
3
+ "version": "2.3.4-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",