@triadxyz/triad-protocol 2.4.2-beta → 2.4.3-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.d.ts CHANGED
@@ -188,7 +188,7 @@ export default class TriadProtocolClient {
188
188
  *
189
189
  * @param options - RPC options
190
190
  */
191
- createPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee, isFast }: CreatePoolArgs, options?: RpcOptions): Promise<string>;
191
+ createOrEditPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee, isFast }: CreatePoolArgs, options?: RpcOptions): Promise<string>;
192
192
  /**
193
193
  * Open Order
194
194
  * @param args.marketId - The ID of the Market
package/dist/index.js CHANGED
@@ -209,29 +209,34 @@ class TriadProtocolClient {
209
209
  *
210
210
  * @param options - RPC options
211
211
  */
212
- createPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee, isFast }, options) {
212
+ createOrEditPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee, isFast }, options) {
213
213
  return __awaiter(this, void 0, void 0, function* () {
214
214
  if (question.length > 80) {
215
215
  throw new Error('Pool question must be less than 80 characters');
216
216
  }
217
217
  const ixs = [];
218
218
  const poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
219
- ixs.push(yield this.program.methods
220
- .createPool({
221
- poolId: new bn_js_1.default(poolId),
222
- question: (0, helpers_1.encodeString)(question, 80),
223
- isFast
224
- })
225
- .accounts({
226
- signer: this.program.provider.publicKey
227
- })
228
- .instruction());
219
+ try {
220
+ yield this.getPoolById(poolId);
221
+ }
222
+ catch (_a) {
223
+ ixs.push(yield this.program.methods
224
+ .createPool({
225
+ poolId: new bn_js_1.default(poolId),
226
+ question: (0, helpers_1.encodeString)(question, 80),
227
+ isFast
228
+ })
229
+ .accounts({
230
+ signer: this.program.provider.publicKey
231
+ })
232
+ .instruction());
233
+ }
229
234
  let userTrade = null;
230
235
  try {
231
236
  yield this.getUserTrade(this.program.provider.publicKey);
232
237
  userTrade = (0, pda_1.getUserTradePDA)(this.program.programId, this.program.provider.publicKey);
233
238
  }
234
- catch (_a) { }
239
+ catch (_b) { }
235
240
  for (const market of markets) {
236
241
  if (market.question.length > 80) {
237
242
  throw new Error('Market question must be less than 80 characters');
@@ -403,6 +403,11 @@
403
403
  "writable": true,
404
404
  "signer": true
405
405
  },
406
+ {
407
+ "name": "squads",
408
+ "writable": true,
409
+ "address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
410
+ },
406
411
  {
407
412
  "name": "market",
408
413
  "writable": true
@@ -595,6 +595,11 @@ export type TriadProtocol = {
595
595
  writable: true;
596
596
  signer: true;
597
597
  },
598
+ {
599
+ name: 'squads';
600
+ writable: true;
601
+ address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
602
+ },
598
603
  {
599
604
  name: 'market';
600
605
  writable: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.4.2-beta",
3
+ "version": "2.4.3-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",