@triadxyz/triad-protocol 2.1.4-beta → 2.1.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/trade.js
CHANGED
|
@@ -667,20 +667,6 @@ class Trade {
|
|
|
667
667
|
if (order.authority === this.program.provider.publicKey.toBase58()) {
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
|
-
let linkedSellerBidTradePDA = null;
|
|
671
|
-
if (order.linkedBidOrderId !== '0') {
|
|
672
|
-
const userOrders = yield this.getUserOrders(new web3_js_1.PublicKey(order.authority));
|
|
673
|
-
linkedSellerBidTradePDA = (0, pda_1.getUserTradePDA)(this.program.programId, new web3_js_1.PublicKey(order.authority));
|
|
674
|
-
const linkedBidOrder = userOrders.find((item) => item.orderId === order.linkedBidOrderId &&
|
|
675
|
-
item.marketId === marketId.toString());
|
|
676
|
-
if (!linkedBidOrder) {
|
|
677
|
-
throw new Error('Linked bid order not found');
|
|
678
|
-
}
|
|
679
|
-
if (linkedBidOrder.userNonce !== '0') {
|
|
680
|
-
const subUserTradePDA = (0, pda_1.getSubUserTradePDA)(this.program.programId, new web3_js_1.PublicKey(order.authority), Number(linkedBidOrder.userNonce));
|
|
681
|
-
linkedSellerBidTradePDA = (0, pda_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
670
|
const orderPrice = new bn_js_1.default(order.price);
|
|
685
671
|
const availableShares = new bn_js_1.default(order.totalShares);
|
|
686
672
|
let adjustedPrice = orderPrice;
|
|
@@ -719,8 +705,7 @@ class Trade {
|
|
|
719
705
|
tokenProgram,
|
|
720
706
|
sellerAuthority: new web3_js_1.PublicKey(order.authority),
|
|
721
707
|
marketAta: (0, pda_2.getTokenATA)(marketPDA, mint, tokenProgram),
|
|
722
|
-
buyerAta: (0, pda_2.getTokenATA)(this.program.provider.publicKey, mint, tokenProgram)
|
|
723
|
-
linkedSellerBidTrade: linkedSellerBidTradePDA
|
|
708
|
+
buyerAta: (0, pda_2.getTokenATA)(this.program.provider.publicKey, mint, tokenProgram)
|
|
724
709
|
})
|
|
725
710
|
.instruction());
|
|
726
711
|
remainingUSDC = remainingUSDC.sub(usdcAmount);
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"signer": true
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
"name": "
|
|
57
|
+
"name": "market",
|
|
58
58
|
"writable": true
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
"name": "
|
|
61
|
+
"name": "bid_user_trade",
|
|
62
62
|
"writable": true
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
"name": "
|
|
65
|
+
"name": "ask_user_trade",
|
|
66
66
|
"writable": true
|
|
67
67
|
},
|
|
68
68
|
{
|
|
@@ -856,6 +856,10 @@
|
|
|
856
856
|
"writable": true,
|
|
857
857
|
"signer": true
|
|
858
858
|
},
|
|
859
|
+
{
|
|
860
|
+
"name": "market",
|
|
861
|
+
"writable": true
|
|
862
|
+
},
|
|
859
863
|
{
|
|
860
864
|
"name": "squads",
|
|
861
865
|
"writable": true,
|
|
@@ -873,15 +877,6 @@
|
|
|
873
877
|
"name": "seller_trade",
|
|
874
878
|
"writable": true
|
|
875
879
|
},
|
|
876
|
-
{
|
|
877
|
-
"name": "linked_seller_bid_trade",
|
|
878
|
-
"writable": true,
|
|
879
|
-
"optional": true
|
|
880
|
-
},
|
|
881
|
-
{
|
|
882
|
-
"name": "market",
|
|
883
|
-
"writable": true
|
|
884
|
-
},
|
|
885
880
|
{
|
|
886
881
|
"name": "mint",
|
|
887
882
|
"writable": true
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -60,15 +60,15 @@ export type TriadProtocol = {
|
|
|
60
60
|
signer: true;
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
name: '
|
|
63
|
+
name: 'market';
|
|
64
64
|
writable: true;
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
name: '
|
|
67
|
+
name: 'bidUserTrade';
|
|
68
68
|
writable: true;
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
|
-
name: '
|
|
71
|
+
name: 'askUserTrade';
|
|
72
72
|
writable: true;
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -1164,6 +1164,10 @@ export type TriadProtocol = {
|
|
|
1164
1164
|
writable: true;
|
|
1165
1165
|
signer: true;
|
|
1166
1166
|
},
|
|
1167
|
+
{
|
|
1168
|
+
name: 'market';
|
|
1169
|
+
writable: true;
|
|
1170
|
+
},
|
|
1167
1171
|
{
|
|
1168
1172
|
name: 'squads';
|
|
1169
1173
|
writable: true;
|
|
@@ -1181,15 +1185,6 @@ export type TriadProtocol = {
|
|
|
1181
1185
|
name: 'sellerTrade';
|
|
1182
1186
|
writable: true;
|
|
1183
1187
|
},
|
|
1184
|
-
{
|
|
1185
|
-
name: 'linkedSellerBidTrade';
|
|
1186
|
-
writable: true;
|
|
1187
|
-
optional: true;
|
|
1188
|
-
},
|
|
1189
|
-
{
|
|
1190
|
-
name: 'market';
|
|
1191
|
-
writable: true;
|
|
1192
|
-
},
|
|
1193
1188
|
{
|
|
1194
1189
|
name: 'mint';
|
|
1195
1190
|
writable: true;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -83,7 +83,8 @@ const formatMarket = (account, address) => {
|
|
|
83
83
|
: '0',
|
|
84
84
|
payoutFee: account.payoutFee,
|
|
85
85
|
customer: account.customerId === 0 ? 'Triad' : account.customerId.toString(),
|
|
86
|
-
version: account.version.toNumber()
|
|
86
|
+
version: account.version.toNumber(),
|
|
87
|
+
poolId: account.poolId.toNumber()
|
|
87
88
|
};
|
|
88
89
|
};
|
|
89
90
|
exports.formatMarket = formatMarket;
|