@triadxyz/triad-protocol 2.6.0-beta → 2.6.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.
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -633,7 +633,8 @@ class TriadProtocolClient {
|
|
|
633
633
|
ixs.push(yield this.program.methods
|
|
634
634
|
.createUserTrade()
|
|
635
635
|
.accounts({
|
|
636
|
-
signer: this.program.provider.publicKey
|
|
636
|
+
signer: this.program.provider.publicKey,
|
|
637
|
+
refer: referPDA
|
|
637
638
|
})
|
|
638
639
|
.instruction());
|
|
639
640
|
return {
|
|
@@ -820,9 +821,9 @@ class TriadProtocolClient {
|
|
|
820
821
|
if (feeBps > 0) {
|
|
821
822
|
const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
|
|
822
823
|
const fee = priceSpread
|
|
824
|
+
.mul(orderPrice)
|
|
823
825
|
.mul(new bn_js_1.default(feeBps))
|
|
824
826
|
.div(new bn_js_1.default(10000))
|
|
825
|
-
.mul(orderPrice)
|
|
826
827
|
.div(new bn_js_1.default(1000000));
|
|
827
828
|
adjustedPrice = orderPrice.add(fee);
|
|
828
829
|
}
|
|
@@ -830,7 +831,7 @@ class TriadProtocolClient {
|
|
|
830
831
|
.mul(new bn_js_1.default(Math.pow(10, this.decimals)))
|
|
831
832
|
.div(adjustedPrice);
|
|
832
833
|
const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
|
|
833
|
-
if (sharesToBuy.
|
|
834
|
+
if (sharesToBuy.lte(new bn_js_1.default(0)))
|
|
834
835
|
continue;
|
|
835
836
|
const usdcAmount = sharesToBuy
|
|
836
837
|
.mul(adjustedPrice)
|