@triadxyz/triad-protocol 1.8.2-beta → 1.8.3-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.
Files changed (2) hide show
  1. package/dist/trade.js +8 -2
  2. package/package.json +1 -1
package/dist/trade.js CHANGED
@@ -522,11 +522,16 @@ class Trade {
522
522
  const { userTradePDA: buyerTrade, ixs: userTradeIxs } = yield this.getUserTradeIxs();
523
523
  const orderBook = yield this.getOrderBook(marketId);
524
524
  let remainingUSDC = amount * Math.pow(10, this.decimals);
525
- const orders = direction[0].hype ? orderBook.hype.ask : orderBook.flop.ask;
525
+ const orders = Object.keys(direction)[0] === 'hype'
526
+ ? orderBook.hype.ask
527
+ : orderBook.flop.ask;
526
528
  const sortedOrders = orders.sort((a, b) => Number(a.price) - Number(b.price));
527
529
  for (const order of sortedOrders) {
528
530
  if (remainingUSDC <= 0)
529
531
  break;
532
+ if (order.authority === this.provider.publicKey.toBase58()) {
533
+ continue;
534
+ }
530
535
  const orderPrice = Number(order.price);
531
536
  const maxSharesForPrice = remainingUSDC / orderPrice;
532
537
  const availableShares = Number(order.totalShares);
@@ -548,7 +553,8 @@ class Trade {
548
553
  buyerTrade,
549
554
  sellerTrade: sellerTradePDA,
550
555
  mint,
551
- tokenProgram: (0, helpers_1.getTokenProgram)(mint)
556
+ tokenProgram: (0, helpers_1.getTokenProgram)(mint),
557
+ sellerAuthority: new web3_js_1.PublicKey(order.authority)
552
558
  })
553
559
  .instruction());
554
560
  remainingUSDC -= usdcAmount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.8.2-beta",
3
+ "version": "1.8.3-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",