@triadxyz/triad-protocol 2.6.4-beta → 2.6.5-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/index.js +2 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -810,7 +810,7 @@ class TriadProtocolClient {
|
|
|
810
810
|
const sortedOrders = orders.sort((a, b) => Number(a.price) - Number(b.price));
|
|
811
811
|
const tokenProgram = (0, helpers_1.getTokenProgram)(mint);
|
|
812
812
|
for (const order of sortedOrders) {
|
|
813
|
-
if (remainingUSDC.
|
|
813
|
+
if (remainingUSDC.lt(new bn_js_1.default(1000000)))
|
|
814
814
|
break;
|
|
815
815
|
if (order.authority === this.program.provider.publicKey.toBase58()) {
|
|
816
816
|
continue;
|
|
@@ -827,13 +827,11 @@ class TriadProtocolClient {
|
|
|
827
827
|
.div(new bn_js_1.default(1000000));
|
|
828
828
|
adjustedPrice = orderPrice.add(fee);
|
|
829
829
|
}
|
|
830
|
-
console.log('remainingUSDC', remainingUSDC.toString());
|
|
831
830
|
const maxSharesForPrice = remainingUSDC
|
|
832
831
|
.mul(new bn_js_1.default(Math.pow(10, this.decimals)))
|
|
833
832
|
.div(adjustedPrice);
|
|
834
833
|
const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
|
|
835
|
-
|
|
836
|
-
if (sharesToBuy.lte(new bn_js_1.default(0)))
|
|
834
|
+
if (sharesToBuy.lt(new bn_js_1.default(1000000)))
|
|
837
835
|
continue;
|
|
838
836
|
const usdcAmount = sharesToBuy
|
|
839
837
|
.mul(adjustedPrice)
|