@triadxyz/triad-protocol 2.3.1-beta → 2.3.2-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 +3 -3
  2. package/package.json +1 -1
package/dist/trade.js CHANGED
@@ -735,10 +735,10 @@ class Trade {
735
735
  if (remainingUSDC.div(new bn_js_1.default(Math.pow(10, this.decimals))).toNumber() === 0)
736
736
  break;
737
737
  if (order.authority === this.program.provider.publicKey.toBase58()) {
738
- return;
738
+ continue;
739
739
  }
740
740
  const orderPrice = new bn_js_1.default(order.price);
741
- const availableShares = new bn_js_1.default(order.totalShares);
741
+ const availableShares = new bn_js_1.default(order.totalShares).sub(new bn_js_1.default(order.filledShares));
742
742
  let adjustedPrice = orderPrice;
743
743
  if (feeBps > 0) {
744
744
  const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
@@ -749,7 +749,7 @@ class Trade {
749
749
  .mul(new bn_js_1.default(Math.pow(10, this.decimals)))
750
750
  .div(adjustedPrice);
751
751
  const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
752
- if (sharesToBuy.lten(0))
752
+ if (sharesToBuy.lt(new bn_js_1.default(0)))
753
753
  continue;
754
754
  const usdcAmount = sharesToBuy
755
755
  .mul(adjustedPrice)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.3.1-beta",
3
+ "version": "2.3.2-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",