@triadxyz/triad-protocol 2.6.1-beta → 2.6.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.
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -821,9 +821,9 @@ class TriadProtocolClient {
|
|
|
821
821
|
if (feeBps > 0) {
|
|
822
822
|
const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
|
|
823
823
|
const fee = priceSpread
|
|
824
|
+
.mul(orderPrice)
|
|
824
825
|
.mul(new bn_js_1.default(feeBps))
|
|
825
826
|
.div(new bn_js_1.default(10000))
|
|
826
|
-
.mul(orderPrice)
|
|
827
827
|
.div(new bn_js_1.default(1000000));
|
|
828
828
|
adjustedPrice = orderPrice.add(fee);
|
|
829
829
|
}
|
|
@@ -831,7 +831,8 @@ class TriadProtocolClient {
|
|
|
831
831
|
.mul(new bn_js_1.default(Math.pow(10, this.decimals)))
|
|
832
832
|
.div(adjustedPrice);
|
|
833
833
|
const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
|
|
834
|
-
|
|
834
|
+
console.log('sharesToBuy', sharesToBuy.toString());
|
|
835
|
+
if (sharesToBuy.lte(new bn_js_1.default(0)))
|
|
835
836
|
continue;
|
|
836
837
|
const usdcAmount = sharesToBuy
|
|
837
838
|
.mul(adjustedPrice)
|
|
@@ -860,6 +861,7 @@ class TriadProtocolClient {
|
|
|
860
861
|
if (userTradeIxs.length > 0) {
|
|
861
862
|
ixs.unshift(...userTradeIxs);
|
|
862
863
|
}
|
|
864
|
+
console.log('ixs', ixs.length);
|
|
863
865
|
if (ixs.length === 0) {
|
|
864
866
|
throw new Error('No matching orders found to fill the requested amount');
|
|
865
867
|
}
|