@triadxyz/triad-protocol 1.5.6-beta → 1.5.8-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.
Files changed (2) hide show
  1. package/dist/trade.js +4 -7
  2. package/package.json +1 -1
package/dist/trade.js CHANGED
@@ -149,7 +149,7 @@ class Trade {
149
149
  }
150
150
  let status = Object.keys(order.status)[0];
151
151
  if (status !== 'open') {
152
- nonce = userTrade.nonce;
152
+ nonce = userTrade.isSubUser ? Number(userTrade.nonce) : 0;
153
153
  }
154
154
  });
155
155
  }
@@ -182,10 +182,8 @@ class Trade {
182
182
  const addressLookupTableAccounts = [];
183
183
  let amountInTRD = amount * Math.pow(10, constants_1.TRD_DECIMALS);
184
184
  let myUserTrades = [];
185
- try {
186
- myUserTrades = yield this.getMyUserTrades(this.provider.publicKey);
187
- }
188
- catch (_a) {
185
+ myUserTrades = yield this.getMyUserTrades(this.provider.publicKey);
186
+ if (myUserTrades.length === 0) {
189
187
  ixs.push(yield this.program.methods
190
188
  .createUserTrade()
191
189
  .accounts({
@@ -195,9 +193,8 @@ class Trade {
195
193
  }
196
194
  try {
197
195
  userTradePDA = yield this.getUserTradeNonceWithSlots(myUserTrades);
198
- console.log(userTradePDA);
199
196
  }
200
- catch (_b) {
197
+ catch (_a) {
201
198
  const mainUserTrade = myUserTrades.find((userTrade) => !userTrade.isSubUser);
202
199
  const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, Number(mainUserTrade.nonce) + 1);
203
200
  userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.5.6-beta",
3
+ "version": "1.5.8-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",