@triadxyz/triad-protocol 3.0.3-beta → 3.0.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 +6 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -743,10 +743,10 @@ class TriadProtocolClient {
|
|
|
743
743
|
return __awaiter(this, void 0, void 0, function* () {
|
|
744
744
|
const ixs = [];
|
|
745
745
|
const addressLookupTableAccounts = [];
|
|
746
|
-
let amountInUSDC = new bn_js_1.default(
|
|
746
|
+
let amountInUSDC = new bn_js_1.default(0);
|
|
747
747
|
if (isTrdPayout) {
|
|
748
748
|
const trdPrice = yield (0, swap_1.getPrice)(constants_1.TRD_MINT.toString());
|
|
749
|
-
const amountInTRD = amount / trdPrice;
|
|
749
|
+
const amountInTRD = (amount / trdPrice) * 1.01;
|
|
750
750
|
const { swapIxs, addressLookupTableAccounts: swapAddressLookupTableAccounts, outAmount, setupInstructions } = yield (0, swap_1.swap)({
|
|
751
751
|
connection: this.program.provider.connection,
|
|
752
752
|
wallet: this.program.provider.publicKey.toBase58(),
|
|
@@ -762,13 +762,16 @@ class TriadProtocolClient {
|
|
|
762
762
|
ixs.push(...swapIxs);
|
|
763
763
|
addressLookupTableAccounts.push(...swapAddressLookupTableAccounts);
|
|
764
764
|
}
|
|
765
|
+
if (amountInUSDC.lt(new bn_js_1.default(amount * Math.pow(10, this.decimals)))) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
765
768
|
const { userTradePDA, userTradeIxs } = yield this.getUserTradeNonce(marketId, Object.keys(direction)[0]);
|
|
766
769
|
if (userTradeIxs.length > 0) {
|
|
767
770
|
ixs.push(...userTradeIxs);
|
|
768
771
|
}
|
|
769
772
|
ixs.push(yield this.program.methods
|
|
770
773
|
.placeBidOrder({
|
|
771
|
-
amount:
|
|
774
|
+
amount: new bn_js_1.default(amount * Math.pow(10, this.decimals)),
|
|
772
775
|
price: new bn_js_1.default(price * Math.pow(10, this.decimals)),
|
|
773
776
|
orderDirection: direction
|
|
774
777
|
})
|