@triadxyz/triad-protocol 3.4.6-beta → 3.4.9-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 +10 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -519,7 +519,8 @@ class TriadProtocol {
|
|
|
519
519
|
signer: this.program.provider.publicKey,
|
|
520
520
|
payer: this.rpcOptions.payer,
|
|
521
521
|
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
522
|
-
mint
|
|
522
|
+
mint,
|
|
523
|
+
order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, marketId, (0, helpers_1.getOrderDirection)(orderDirection))
|
|
523
524
|
})
|
|
524
525
|
.instruction());
|
|
525
526
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions, addressLookupTableAccounts);
|
|
@@ -539,7 +540,8 @@ class TriadProtocol {
|
|
|
539
540
|
signer: this.program.provider.publicKey,
|
|
540
541
|
payer: this.rpcOptions.payer,
|
|
541
542
|
market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
|
|
542
|
-
mint: constants_1.TRD_MINT
|
|
543
|
+
mint: constants_1.TRD_MINT,
|
|
544
|
+
order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, marketId, (0, helpers_1.getOrderDirection)(orderDirection))
|
|
543
545
|
})
|
|
544
546
|
.instruction()
|
|
545
547
|
];
|
|
@@ -566,7 +568,8 @@ class TriadProtocol {
|
|
|
566
568
|
payer: this.rpcOptions.payer,
|
|
567
569
|
market: (0, pda_1.getMarketPDA)(this.program.programId, order.marketId),
|
|
568
570
|
mint: order.mint,
|
|
569
|
-
tokenProgram: (0, helpers_2.getTokenProgram)(order.mint)
|
|
571
|
+
tokenProgram: (0, helpers_2.getTokenProgram)(order.mint),
|
|
572
|
+
order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, order.marketId, (0, helpers_1.getOrderDirection)(order.orderDirection))
|
|
570
573
|
})
|
|
571
574
|
.instruction());
|
|
572
575
|
}
|
|
@@ -836,13 +839,14 @@ class TriadProtocol {
|
|
|
836
839
|
.div(new bn_js_1.default(Math.pow(10, constants_1.BASE_DECIMALS)));
|
|
837
840
|
if (usdcAmount.lte(new bn_js_1.default(0)))
|
|
838
841
|
continue;
|
|
842
|
+
const oppositeOrderDirection = (0, helpers_1.getOppositeOrderDirectionEncoded)(orderDirection);
|
|
839
843
|
ixs.push(yield this.program.methods
|
|
840
844
|
.marketBidOrder({
|
|
841
845
|
amount: new bn_js_1.default(usdcAmount),
|
|
842
846
|
marketId: new bn_js_1.default(marketId),
|
|
843
847
|
orderDirection,
|
|
844
848
|
bookOrderAskId: new bn_js_1.default(order.id),
|
|
845
|
-
oppositeOrderDirection
|
|
849
|
+
oppositeOrderDirection
|
|
846
850
|
})
|
|
847
851
|
.accounts({
|
|
848
852
|
signer: this.program.provider.publicKey,
|
|
@@ -850,7 +854,8 @@ class TriadProtocol {
|
|
|
850
854
|
market: marketPDA,
|
|
851
855
|
orderBook: (0, pda_1.getOrderBookPDA)(this.program.programId, marketId),
|
|
852
856
|
bookOrderAskAuthority: new web3_js_1.PublicKey(order.authority),
|
|
853
|
-
|
|
857
|
+
order: (0, pda_1.getOrderPDA)(this.program.programId, this.program.provider.publicKey, marketId, (0, helpers_1.getOrderDirection)(orderDirection)),
|
|
858
|
+
oppositeOrder: (0, pda_1.getOrderPDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), marketId, (0, helpers_1.getOrderDirection)(oppositeOrderDirection))
|
|
854
859
|
})
|
|
855
860
|
.instruction());
|
|
856
861
|
remainingUSDC = remainingUSDC.sub(usdcAmount);
|