@triadxyz/triad-protocol 1.5.9-beta → 1.6.0-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 CHANGED
@@ -25,7 +25,7 @@ const sendTransactionWithOptions_1 = __importDefault(require("./utils/sendTransa
25
25
  class TriadProtocolClient {
26
26
  constructor(connection, wallet) {
27
27
  this.provider = new anchor_1.AnchorProvider(connection, wallet, {
28
- commitment: 'processed'
28
+ commitment: 'confirmed'
29
29
  });
30
30
  this.program = new anchor_1.Program(idl_triad_protocol_json_1.default, this.provider);
31
31
  this.trade = new trade_1.default(this.program, this.provider);
package/dist/trade.js CHANGED
@@ -191,20 +191,21 @@ class Trade {
191
191
  })
192
192
  .instruction());
193
193
  }
194
- try {
195
- userTradePDA = yield this.getUserTradeNonceWithSlots(myUserTrades);
196
- console.log(userTradePDA);
197
- }
198
- catch (_a) {
199
- const mainUserTrade = myUserTrades.find((userTrade) => !userTrade.isSubUser);
200
- const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, Number(mainUserTrade.nonce) + 1);
201
- userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
202
- ixs.push(yield this.program.methods
203
- .createSubUserTrade(subUserTradePDA)
204
- .accounts({
205
- signer: this.provider.publicKey
206
- })
207
- .instruction());
194
+ if (myUserTrades.length > 0) {
195
+ try {
196
+ userTradePDA = yield this.getUserTradeNonceWithSlots(myUserTrades);
197
+ }
198
+ catch (_a) {
199
+ const mainUserTrade = myUserTrades.find((userTrade) => !userTrade.isSubUser);
200
+ const subUserTradePDA = (0, trade_1.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, Number(mainUserTrade.nonce) + 1);
201
+ userTradePDA = (0, trade_1.getUserTradePDA)(this.program.programId, subUserTradePDA);
202
+ ixs.push(yield this.program.methods
203
+ .createSubUserTrade(subUserTradePDA)
204
+ .accounts({
205
+ signer: this.provider.publicKey
206
+ })
207
+ .instruction());
208
+ }
208
209
  }
209
210
  if (token !== constants_1.TRD_MINT.toBase58()) {
210
211
  const { setupInstructions, swapIxs, addressLookupTableAccounts, trdAmount } = yield (0, swap_1.swap)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.5.9-beta",
3
+ "version": "1.6.0-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",