@triadxyz/triad-protocol 4.3.9 → 4.4.1

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.
@@ -37,4 +37,9 @@ export default class Customer {
37
37
  * @param args.payoutFeeBps - The payout fee in basis points of the customer
38
38
  */
39
39
  updateCustomer({ customerId, marketFeeBps, payoutFeeBps }: UpdateCustomerArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
40
+ /**
41
+ * Collect Customer Fee
42
+ * @param customerId - The ID of the customer
43
+ */
44
+ collectCustomerFee(customerId: number): Promise<string | import("@solana/web3.js").VersionedTransaction>;
40
45
  }
package/dist/customer.js CHANGED
@@ -106,5 +106,25 @@ class Customer {
106
106
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
107
107
  });
108
108
  }
109
+ /**
110
+ * Collect Customer Fee
111
+ * @param customerId - The ID of the customer
112
+ */
113
+ collectCustomerFee(customerId) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const customer = yield this.getCustomerById(customerId);
116
+ const ixs = [
117
+ yield this.program.methods
118
+ .collectCustomerFee()
119
+ .accounts({
120
+ signer: this.program.provider.publicKey,
121
+ customer: customer.address,
122
+ feeRecipient: customer.feeRecipient
123
+ })
124
+ .instruction()
125
+ ];
126
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
127
+ });
128
+ }
109
129
  }
110
130
  exports.default = Customer;
package/dist/index.d.ts CHANGED
@@ -32,6 +32,10 @@ export default class TriadProtocol {
32
32
  constructor(connection: Connection, wallet: Wallet, rpcOptions: RpcOptions);
33
33
  getPriorityFee(): Promise<void>;
34
34
  getCentral(): Promise<import("./types").Central>;
35
+ /**
36
+ * Collect Central Fee (transfers accumulated fees to the protocol treasury)
37
+ */
38
+ collectCentralFee(): Promise<string | import("@solana/web3.js").VersionedTransaction>;
35
39
  /**
36
40
  * Burn Triad
37
41
  * @param amount - Amount to burn
package/dist/index.js CHANGED
@@ -83,6 +83,22 @@ class TriadProtocol {
83
83
  return (0, helpers_1.formatCentral)(central, centralPDA);
84
84
  });
85
85
  }
86
+ /**
87
+ * Collect Central Fee (transfers accumulated fees to the protocol treasury)
88
+ */
89
+ collectCentralFee() {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const ixs = [
92
+ yield this.program.methods
93
+ .collectCentralFee()
94
+ .accounts({
95
+ signer: this.program.provider.publicKey
96
+ })
97
+ .instruction()
98
+ ];
99
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
100
+ });
101
+ }
86
102
  /**
87
103
  * Burn Triad
88
104
  * @param amount - Amount to burn
package/dist/market.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { Program } from '@coral-xyz/anchor';
3
3
  import { TriadProtocol } from './types/triad_protocol';
4
- import { RpcOptions, CreateMarketArgs, CreatePoolArgs, UpdateMarketWinningDirectionArgs, UpdateMarketPayoutArgs, UpdateMarketQuestionArgs, UpdateMarketEndArgs, CreateMarketPythArgs } from './types';
4
+ import { RpcOptions, CreateMarketArgs, CreatePoolArgs, UpdateMarketWinningDirectionArgs, UpdateMarketPayoutArgs, UpdateMarketQuestionArgs, UpdateMarketEndArgs, CreateMarketPythArgs, UpdateCentralArgs } from './types';
5
5
  export default class Market {
6
6
  private program;
7
7
  private rpcOptions;
@@ -35,7 +35,7 @@ export default class Market {
35
35
  */
36
36
  getMarketByAddress(marketAddress: PublicKey): Promise<import("./types").Market>;
37
37
  /**
38
- * Get Current Market ID
38
+ * Get Next Market ID (from central account)
39
39
  */
40
40
  nextMarketId(): Promise<number>;
41
41
  /**
@@ -45,11 +45,9 @@ export default class Market {
45
45
  /**
46
46
  * Create Market
47
47
  * @param args.markets - Array of markets to create
48
- * @param args.markets.marketId - Market ID
49
48
  * @param args.markets.startTime - start time
50
49
  * @param args.markets.endTime - end time
51
50
  * @param args.markets.question - question (max 80 characters)
52
- * @param args.markets.liquidityAtStart - liquidity at start
53
51
  * @param args.markets.payoutFee - payout fee (to add affiliate system)
54
52
  * @param args.customer - The customer of the market
55
53
  * @param args.poolId - The ID of the pool
@@ -125,10 +123,9 @@ export default class Market {
125
123
  /**
126
124
  * Create Market Pyth
127
125
  * @param args.markets - Array of markets to create
128
- * @param args.markets.marketId - Market ID
129
126
  * @param args.markets.resolveIn - Time to add for resolver the market in seconds
130
- * @param args.customer - The customer of the market
131
- * @param args.poolId - The ID of the pool
127
+ * @param args.markets.customer - The customer of the market
128
+ * @param args.markets.poolId - The ID of the pool
132
129
  */
133
130
  createMarketPyth({ markets }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
134
131
  /**
@@ -139,7 +136,6 @@ export default class Market {
139
136
  * @param toResolve.poolId - Pool ID
140
137
  * @param toResolve.withPayout - Whether to update market payout
141
138
  * @param market - Market to create
142
- * @param market.marketId - Market ID
143
139
  * @param market.resolveIn - Time to add for resolver the market in seconds
144
140
  * @param market.direction - Direction of the market
145
141
  * @param market.customer - The customer of the market
@@ -153,11 +149,15 @@ export default class Market {
153
149
  * @param toResolve.winningDirection - Winning direction
154
150
  * @param toResolve.withPayout - Whether to update market payout
155
151
  * @param market - Market to create
156
- * @param market.marketId - Market ID
157
152
  * @param market.resolveIn - Time to add for resolver the market in seconds
158
- * @param market.direction - Direction of the market
159
153
  * @param market.customer - The customer of the market
160
154
  * @param market.poolId - The ID of the pool
161
155
  */
162
156
  createAndResolveMarket(toResolve: UpdateMarketWinningDirectionArgs['markets'][0], market: CreateMarketArgs['markets'][0], customer: PublicKey): Promise<string | import("@solana/web3.js").VersionedTransaction>;
157
+ /**
158
+ * Update Central
159
+ * @param args.nextMarketId - Override the next market ID
160
+ * @param args.isLocked - Lock or unlock the protocol
161
+ */
162
+ updateCentral({ nextMarketId, isLocked }: UpdateCentralArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
163
163
  }
package/dist/market.js CHANGED
@@ -93,21 +93,13 @@ class Market {
93
93
  });
94
94
  }
95
95
  /**
96
- * Get Current Market ID
96
+ * Get Next Market ID (from central account)
97
97
  */
98
98
  nextMarketId() {
99
99
  return __awaiter(this, void 0, void 0, function* () {
100
- let validId = null;
101
- while (!validId) {
102
- const marketId = Math.floor(Math.random() * 1000000000000000);
103
- try {
104
- yield this.program.account.marketV2.fetch((0, pda_1.getMarketPDA)(this.program.programId, marketId));
105
- }
106
- catch (_a) {
107
- validId = marketId;
108
- }
109
- }
110
- return validId;
100
+ const centralPDA = (0, pda_1.getCentralPDA)(this.program.programId);
101
+ const central = yield this.program.account.central.fetch(centralPDA);
102
+ return central.nextMarketId.toNumber() + 1;
111
103
  });
112
104
  }
113
105
  /**
@@ -122,11 +114,9 @@ class Market {
122
114
  /**
123
115
  * Create Market
124
116
  * @param args.markets - Array of markets to create
125
- * @param args.markets.marketId - Market ID
126
117
  * @param args.markets.startTime - start time
127
118
  * @param args.markets.endTime - end time
128
119
  * @param args.markets.question - question (max 80 characters)
129
- * @param args.markets.liquidityAtStart - liquidity at start
130
120
  * @param args.markets.payoutFee - payout fee (to add affiliate system)
131
121
  * @param args.customer - The customer of the market
132
122
  * @param args.poolId - The ID of the pool
@@ -134,17 +124,21 @@ class Market {
134
124
  createMarket({ markets, customer, poolId }) {
135
125
  return __awaiter(this, void 0, void 0, function* () {
136
126
  const ixs = [];
127
+ const centralPDA = (0, pda_1.getCentralPDA)(this.program.programId);
128
+ const central = yield this.program.account.central.fetch(centralPDA);
129
+ const baseMarketId = central.nextMarketId.toNumber();
137
130
  let poolPDA = null;
138
131
  if (poolId) {
139
132
  poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
140
133
  }
141
- for (const market of markets) {
134
+ for (let i = 0; i < markets.length; i++) {
135
+ const market = markets[i];
136
+ const nextMarketId = baseMarketId + 1 + i;
142
137
  if (market.question.length > 80) {
143
138
  throw new Error('Question must be less than 80 characters');
144
139
  }
145
140
  ixs.push(yield this.program.methods
146
141
  .createMarket({
147
- marketId: new bn_js_1.default(market.marketId),
148
142
  question: (0, helpers_1.encodeString)(market.question, 80),
149
143
  marketStart: new bn_js_1.default(market.startTime),
150
144
  marketEnd: new bn_js_1.default(market.endTime),
@@ -160,10 +154,10 @@ class Market {
160
154
  })
161
155
  .instruction());
162
156
  ixs.push(yield this.program.methods
163
- .createOrderBook(new bn_js_1.default(market.marketId))
157
+ .createOrderBook()
164
158
  .accounts({
165
159
  signer: this.program.provider.publicKey,
166
- market: (0, pda_1.getMarketPDA)(this.program.programId, market.marketId)
160
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
167
161
  })
168
162
  .instruction());
169
163
  }
@@ -209,13 +203,17 @@ class Market {
209
203
  feed: (0, helpers_1.getFeedIdFromHex)(feedId)
210
204
  })
211
205
  .instruction());
212
- for (const market of markets) {
206
+ const centralPDA = (0, pda_1.getCentralPDA)(this.program.programId);
207
+ const central = yield this.program.account.central.fetch(centralPDA);
208
+ const baseMarketId = central.nextMarketId.toNumber();
209
+ for (let i = 0; i < markets.length; i++) {
210
+ const market = markets[i];
211
+ const nextMarketId = baseMarketId + 1 + i;
213
212
  if (market.question.length > 80) {
214
213
  throw new Error('Market question must be less than 80 characters');
215
214
  }
216
215
  ixs.push(yield this.program.methods
217
216
  .createMarket({
218
- marketId: new bn_js_1.default(market.marketId),
219
217
  question: (0, helpers_1.encodeString)(market.question, 80),
220
218
  marketStart: new bn_js_1.default(startTime),
221
219
  marketEnd: new bn_js_1.default(endTime),
@@ -231,10 +229,10 @@ class Market {
231
229
  })
232
230
  .instruction());
233
231
  ixs.push(yield this.program.methods
234
- .createOrderBook(new bn_js_1.default(market.marketId))
232
+ .createOrderBook()
235
233
  .accounts({
236
234
  signer: this.program.provider.publicKey,
237
- market: (0, pda_1.getMarketPDA)(this.program.programId, market.marketId)
235
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
238
236
  })
239
237
  .instruction());
240
238
  }
@@ -395,20 +393,23 @@ class Market {
395
393
  /**
396
394
  * Create Market Pyth
397
395
  * @param args.markets - Array of markets to create
398
- * @param args.markets.marketId - Market ID
399
396
  * @param args.markets.resolveIn - Time to add for resolver the market in seconds
400
- * @param args.customer - The customer of the market
401
- * @param args.poolId - The ID of the pool
397
+ * @param args.markets.customer - The customer of the market
398
+ * @param args.markets.poolId - The ID of the pool
402
399
  */
403
400
  createMarketPyth({ markets }) {
404
401
  return __awaiter(this, void 0, void 0, function* () {
405
402
  const ixs = [];
406
- for (const market of markets) {
407
- let poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, market.poolId);
403
+ const centralPDA = (0, pda_1.getCentralPDA)(this.program.programId);
404
+ const central = yield this.program.account.central.fetch(centralPDA);
405
+ const baseMarketId = central.nextMarketId.toNumber();
406
+ for (let i = 0; i < markets.length; i++) {
407
+ const market = markets[i];
408
+ const nextMarketId = baseMarketId + 1 + i;
409
+ const poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, market.poolId);
408
410
  const feedPDA = (0, helpers_2.getPriceFeedAccountForProgram)(market.feedId);
409
411
  ixs.push(yield this.program.methods
410
412
  .createMarketPyth({
411
- marketId: new bn_js_1.default(market.marketId),
412
413
  resolveIn: new bn_js_1.default(market.resolveIn),
413
414
  direction: market.direction
414
415
  })
@@ -420,10 +421,10 @@ class Market {
420
421
  })
421
422
  .instruction());
422
423
  ixs.push(yield this.program.methods
423
- .createOrderBook(new bn_js_1.default(market.marketId))
424
+ .createOrderBook()
424
425
  .accounts({
425
426
  signer: this.program.provider.publicKey,
426
- market: (0, pda_1.getMarketPDA)(this.program.programId, market.marketId)
427
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
427
428
  })
428
429
  .instruction());
429
430
  }
@@ -438,7 +439,6 @@ class Market {
438
439
  * @param toResolve.poolId - Pool ID
439
440
  * @param toResolve.withPayout - Whether to update market payout
440
441
  * @param market - Market to create
441
- * @param market.marketId - Market ID
442
442
  * @param market.resolveIn - Time to add for resolver the market in seconds
443
443
  * @param market.direction - Direction of the market
444
444
  * @param market.customer - The customer of the market
@@ -447,7 +447,11 @@ class Market {
447
447
  createAndResolvePythMarket(toResolve, market) {
448
448
  return __awaiter(this, void 0, void 0, function* () {
449
449
  const ixs = [];
450
- const marketInfo = yield this.getMarketById(toResolve.marketId);
450
+ const [marketInfo, central] = yield Promise.all([
451
+ this.getMarketById(toResolve.marketId),
452
+ this.program.account.central.fetch((0, pda_1.getCentralPDA)(this.program.programId))
453
+ ]);
454
+ const nextMarketId = central.nextMarketId.toNumber() + 1;
451
455
  if (marketInfo.winningDirection === types_1.WinningDirection.NONE) {
452
456
  ixs.push(yield this.program.methods
453
457
  .updateMarketWinningDirection(toResolve.winningDirection)
@@ -472,7 +476,6 @@ class Market {
472
476
  const feedPDA = (0, helpers_2.getPriceFeedAccountForProgram)(market.feedId);
473
477
  ixs.push(yield this.program.methods
474
478
  .createMarketPyth({
475
- marketId: new bn_js_1.default(market.marketId),
476
479
  resolveIn: new bn_js_1.default(market.resolveIn),
477
480
  direction: market.direction
478
481
  })
@@ -486,10 +489,10 @@ class Market {
486
489
  })
487
490
  .instruction());
488
491
  ixs.push(yield this.program.methods
489
- .createOrderBook(new bn_js_1.default(market.marketId))
492
+ .createOrderBook()
490
493
  .accounts({
491
494
  signer: this.program.provider.publicKey,
492
- market: (0, pda_1.getMarketPDA)(this.program.programId, market.marketId)
495
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
493
496
  })
494
497
  .instruction());
495
498
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
@@ -502,16 +505,18 @@ class Market {
502
505
  * @param toResolve.winningDirection - Winning direction
503
506
  * @param toResolve.withPayout - Whether to update market payout
504
507
  * @param market - Market to create
505
- * @param market.marketId - Market ID
506
508
  * @param market.resolveIn - Time to add for resolver the market in seconds
507
- * @param market.direction - Direction of the market
508
509
  * @param market.customer - The customer of the market
509
510
  * @param market.poolId - The ID of the pool
510
511
  */
511
512
  createAndResolveMarket(toResolve, market, customer) {
512
513
  return __awaiter(this, void 0, void 0, function* () {
513
514
  const ixs = [];
514
- const marketInfo = yield this.getMarketById(toResolve.marketId);
515
+ const [marketInfo, central] = yield Promise.all([
516
+ this.getMarketById(toResolve.marketId),
517
+ this.program.account.central.fetch((0, pda_1.getCentralPDA)(this.program.programId))
518
+ ]);
519
+ const nextMarketId = central.nextMarketId.toNumber() + 1;
515
520
  if (marketInfo.winningDirection === types_1.WinningDirection.NONE) {
516
521
  ixs.push(yield this.program.methods
517
522
  .updateMarketWinningDirection(toResolve.winningDirection)
@@ -535,7 +540,6 @@ class Market {
535
540
  }
536
541
  ixs.push(yield this.program.methods
537
542
  .createMarket({
538
- marketId: new bn_js_1.default(market.marketId),
539
543
  question: (0, helpers_1.encodeString)(market.question, 80),
540
544
  marketStart: new bn_js_1.default(market.startTime),
541
545
  marketEnd: new bn_js_1.default(market.endTime),
@@ -553,14 +557,35 @@ class Market {
553
557
  })
554
558
  .instruction());
555
559
  ixs.push(yield this.program.methods
556
- .createOrderBook(new bn_js_1.default(market.marketId))
560
+ .createOrderBook()
557
561
  .accounts({
558
562
  signer: this.program.provider.publicKey,
559
- market: (0, pda_1.getMarketPDA)(this.program.programId, market.marketId)
563
+ market: (0, pda_1.getMarketPDA)(this.program.programId, nextMarketId)
560
564
  })
561
565
  .instruction());
562
566
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
563
567
  });
564
568
  }
569
+ /**
570
+ * Update Central
571
+ * @param args.nextMarketId - Override the next market ID
572
+ * @param args.isLocked - Lock or unlock the protocol
573
+ */
574
+ updateCentral({ nextMarketId, isLocked }) {
575
+ return __awaiter(this, void 0, void 0, function* () {
576
+ const ixs = [
577
+ yield this.program.methods
578
+ .updateCentral({
579
+ nextMarketId: nextMarketId != null ? new bn_js_1.default(nextMarketId) : null,
580
+ isLocked: isLocked !== null && isLocked !== void 0 ? isLocked : null
581
+ })
582
+ .accounts({
583
+ signer: this.program.provider.publicKey
584
+ })
585
+ .instruction()
586
+ ];
587
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
588
+ });
589
+ }
565
590
  }
566
591
  exports.default = Market;
@@ -310,11 +310,6 @@
310
310
  "writable": true,
311
311
  "signer": true
312
312
  },
313
- {
314
- "name": "squads",
315
- "writable": true,
316
- "address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
317
- },
318
313
  {
319
314
  "name": "market",
320
315
  "writable": true,
@@ -381,6 +376,114 @@
381
376
  ],
382
377
  "args": []
383
378
  },
379
+ {
380
+ "name": "collect_central_fee",
381
+ "discriminator": [6, 142, 3, 94, 210, 59, 147, 136],
382
+ "accounts": [
383
+ {
384
+ "name": "signer",
385
+ "writable": true,
386
+ "signer": true
387
+ },
388
+ {
389
+ "name": "central",
390
+ "writable": true,
391
+ "pda": {
392
+ "seeds": [
393
+ {
394
+ "kind": "const",
395
+ "value": [99, 101, 110, 116, 114, 97, 108]
396
+ },
397
+ {
398
+ "kind": "const",
399
+ "value": [
400
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
401
+ ]
402
+ }
403
+ ]
404
+ }
405
+ },
406
+ {
407
+ "name": "fee_recipient",
408
+ "writable": true,
409
+ "address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
410
+ },
411
+ {
412
+ "name": "mint",
413
+ "writable": true,
414
+ "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
415
+ },
416
+ {
417
+ "name": "central_ata",
418
+ "writable": true,
419
+ "pda": {
420
+ "seeds": [
421
+ {
422
+ "kind": "account",
423
+ "path": "central"
424
+ },
425
+ {
426
+ "kind": "account",
427
+ "path": "token_program"
428
+ },
429
+ {
430
+ "kind": "account",
431
+ "path": "mint"
432
+ }
433
+ ],
434
+ "program": {
435
+ "kind": "const",
436
+ "value": [
437
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
438
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
439
+ 219, 233, 248, 89
440
+ ]
441
+ }
442
+ }
443
+ },
444
+ {
445
+ "name": "fee_recipient_ata",
446
+ "writable": true,
447
+ "pda": {
448
+ "seeds": [
449
+ {
450
+ "kind": "account",
451
+ "path": "fee_recipient"
452
+ },
453
+ {
454
+ "kind": "account",
455
+ "path": "token_program"
456
+ },
457
+ {
458
+ "kind": "account",
459
+ "path": "mint"
460
+ }
461
+ ],
462
+ "program": {
463
+ "kind": "const",
464
+ "value": [
465
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
466
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
467
+ 219, 233, 248, 89
468
+ ]
469
+ }
470
+ }
471
+ },
472
+ {
473
+ "name": "token_program",
474
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
475
+ },
476
+ {
477
+ "name": "associated_token_program",
478
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
479
+ },
480
+ {
481
+ "name": "system_program",
482
+ "address": "11111111111111111111111111111111"
483
+ }
484
+ ],
485
+ "args": []
486
+ },
384
487
  {
385
488
  "name": "collect_customer_fee",
386
489
  "discriminator": [187, 253, 215, 126, 168, 246, 253, 21],
@@ -679,6 +782,24 @@
679
782
  "writable": true,
680
783
  "signer": true
681
784
  },
785
+ {
786
+ "name": "central",
787
+ "writable": true,
788
+ "pda": {
789
+ "seeds": [
790
+ {
791
+ "kind": "const",
792
+ "value": [99, 101, 110, 116, 114, 97, 108]
793
+ },
794
+ {
795
+ "kind": "const",
796
+ "value": [
797
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
798
+ ]
799
+ }
800
+ ]
801
+ }
802
+ },
682
803
  {
683
804
  "name": "customer",
684
805
  "writable": true
@@ -698,8 +819,9 @@
698
819
  "value": [109, 97, 114, 107, 101, 116]
699
820
  },
700
821
  {
701
- "kind": "arg",
702
- "path": "args.market_id"
822
+ "kind": "account",
823
+ "path": "central.next_market_id.checked_add(1)",
824
+ "account": "Central"
703
825
  }
704
826
  ]
705
827
  }
@@ -729,6 +851,24 @@
729
851
  "writable": true,
730
852
  "signer": true
731
853
  },
854
+ {
855
+ "name": "central",
856
+ "writable": true,
857
+ "pda": {
858
+ "seeds": [
859
+ {
860
+ "kind": "const",
861
+ "value": [99, 101, 110, 116, 114, 97, 108]
862
+ },
863
+ {
864
+ "kind": "const",
865
+ "value": [
866
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
867
+ ]
868
+ }
869
+ ]
870
+ }
871
+ },
732
872
  {
733
873
  "name": "customer",
734
874
  "writable": true
@@ -747,8 +887,9 @@
747
887
  "value": [109, 97, 114, 107, 101, 116]
748
888
  },
749
889
  {
750
- "kind": "arg",
751
- "path": "args.market_id"
890
+ "kind": "account",
891
+ "path": "central.next_market_id.checked_add(1)",
892
+ "account": "Central"
752
893
  }
753
894
  ]
754
895
  }
@@ -796,8 +937,9 @@
796
937
  "value": [111, 114, 100, 101, 114, 95, 98, 111, 111, 107]
797
938
  },
798
939
  {
799
- "kind": "arg",
800
- "path": "market_id"
940
+ "kind": "account",
941
+ "path": "market.market_id",
942
+ "account": "MarketV2"
801
943
  }
802
944
  ]
803
945
  }
@@ -807,12 +949,7 @@
807
949
  "address": "11111111111111111111111111111111"
808
950
  }
809
951
  ],
810
- "args": [
811
- {
812
- "name": "market_id",
813
- "type": "u64"
814
- }
815
- ]
952
+ "args": []
816
953
  },
817
954
  {
818
955
  "name": "create_pool",
@@ -1610,6 +1747,49 @@
1610
1747
  ],
1611
1748
  "args": []
1612
1749
  },
1750
+ {
1751
+ "name": "update_central",
1752
+ "discriminator": [251, 46, 123, 120, 218, 7, 245, 140],
1753
+ "accounts": [
1754
+ {
1755
+ "name": "signer",
1756
+ "writable": true,
1757
+ "signer": true
1758
+ },
1759
+ {
1760
+ "name": "central",
1761
+ "writable": true,
1762
+ "pda": {
1763
+ "seeds": [
1764
+ {
1765
+ "kind": "const",
1766
+ "value": [99, 101, 110, 116, 114, 97, 108]
1767
+ },
1768
+ {
1769
+ "kind": "const",
1770
+ "value": [
1771
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
1772
+ ]
1773
+ }
1774
+ ]
1775
+ }
1776
+ },
1777
+ {
1778
+ "name": "system_program",
1779
+ "address": "11111111111111111111111111111111"
1780
+ }
1781
+ ],
1782
+ "args": [
1783
+ {
1784
+ "name": "args",
1785
+ "type": {
1786
+ "defined": {
1787
+ "name": "UpdateCentralArgs"
1788
+ }
1789
+ }
1790
+ }
1791
+ ]
1792
+ },
1613
1793
  {
1614
1794
  "name": "update_customer",
1615
1795
  "discriminator": [158, 118, 103, 177, 241, 229, 169, 124],
@@ -2557,10 +2737,14 @@
2557
2737
  "name": "rewards_paid",
2558
2738
  "type": "u64"
2559
2739
  },
2740
+ {
2741
+ "name": "next_market_id",
2742
+ "type": "u64"
2743
+ },
2560
2744
  {
2561
2745
  "name": "padding",
2562
2746
  "type": {
2563
- "array": ["u8", 295]
2747
+ "array": ["u8", 287]
2564
2748
  }
2565
2749
  }
2566
2750
  ]
@@ -2689,10 +2873,6 @@
2689
2873
  "type": {
2690
2874
  "kind": "struct",
2691
2875
  "fields": [
2692
- {
2693
- "name": "market_id",
2694
- "type": "u64"
2695
- },
2696
2876
  {
2697
2877
  "name": "question",
2698
2878
  "type": {
@@ -2731,10 +2911,6 @@
2731
2911
  "type": {
2732
2912
  "kind": "struct",
2733
2913
  "fields": [
2734
- {
2735
- "name": "market_id",
2736
- "type": "u64"
2737
- },
2738
2914
  {
2739
2915
  "name": "resolve_in",
2740
2916
  "type": "i64"
@@ -4014,6 +4190,26 @@
4014
4190
  ]
4015
4191
  }
4016
4192
  },
4193
+ {
4194
+ "name": "UpdateCentralArgs",
4195
+ "type": {
4196
+ "kind": "struct",
4197
+ "fields": [
4198
+ {
4199
+ "name": "next_market_id",
4200
+ "type": {
4201
+ "option": "u64"
4202
+ }
4203
+ },
4204
+ {
4205
+ "name": "is_locked",
4206
+ "type": {
4207
+ "option": "bool"
4208
+ }
4209
+ }
4210
+ ]
4211
+ }
4212
+ },
4017
4213
  {
4018
4214
  "name": "UpdateCustomerArgs",
4019
4215
  "type": {
@@ -147,7 +147,6 @@ export type InitializeMarketArgs = {
147
147
  };
148
148
  export type CreateMarketArgs = {
149
149
  markets: {
150
- marketId: number;
151
150
  startTime: number;
152
151
  endTime: number;
153
152
  question: string;
@@ -159,7 +158,6 @@ export type CreateMarketArgs = {
159
158
  };
160
159
  export type CreateMarketPythArgs = {
161
160
  markets: {
162
- marketId: number;
163
161
  resolveIn: number;
164
162
  customer: PublicKey;
165
163
  poolId: number;
@@ -167,6 +165,10 @@ export type CreateMarketPythArgs = {
167
165
  direction: 'Above' | 'Below';
168
166
  }[];
169
167
  };
168
+ export type UpdateCentralArgs = {
169
+ nextMarketId?: number;
170
+ isLocked?: boolean;
171
+ };
170
172
  export type CreatePoolArgs = {
171
173
  poolId: number;
172
174
  question?: string;
@@ -415,11 +415,6 @@ export type TriadProtocol = {
415
415
  writable: true;
416
416
  signer: true;
417
417
  },
418
- {
419
- name: 'squads';
420
- writable: true;
421
- address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
422
- },
423
418
  {
424
419
  name: 'market';
425
420
  writable: true;
@@ -486,6 +481,183 @@ export type TriadProtocol = {
486
481
  ];
487
482
  args: [];
488
483
  },
484
+ {
485
+ name: 'collectCentralFee';
486
+ discriminator: [6, 142, 3, 94, 210, 59, 147, 136];
487
+ accounts: [
488
+ {
489
+ name: 'signer';
490
+ writable: true;
491
+ signer: true;
492
+ },
493
+ {
494
+ name: 'central';
495
+ writable: true;
496
+ pda: {
497
+ seeds: [
498
+ {
499
+ kind: 'const';
500
+ value: [99, 101, 110, 116, 114, 97, 108];
501
+ },
502
+ {
503
+ kind: 'const';
504
+ value: [
505
+ 116,
506
+ 114,
507
+ 105,
508
+ 97,
509
+ 100,
510
+ 109,
511
+ 97,
512
+ 114,
513
+ 107,
514
+ 101,
515
+ 116,
516
+ 115
517
+ ];
518
+ }
519
+ ];
520
+ };
521
+ },
522
+ {
523
+ name: 'feeRecipient';
524
+ writable: true;
525
+ address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
526
+ },
527
+ {
528
+ name: 'mint';
529
+ writable: true;
530
+ address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
531
+ },
532
+ {
533
+ name: 'centralAta';
534
+ writable: true;
535
+ pda: {
536
+ seeds: [
537
+ {
538
+ kind: 'account';
539
+ path: 'central';
540
+ },
541
+ {
542
+ kind: 'account';
543
+ path: 'tokenProgram';
544
+ },
545
+ {
546
+ kind: 'account';
547
+ path: 'mint';
548
+ }
549
+ ];
550
+ program: {
551
+ kind: 'const';
552
+ value: [
553
+ 140,
554
+ 151,
555
+ 37,
556
+ 143,
557
+ 78,
558
+ 36,
559
+ 137,
560
+ 241,
561
+ 187,
562
+ 61,
563
+ 16,
564
+ 41,
565
+ 20,
566
+ 142,
567
+ 13,
568
+ 131,
569
+ 11,
570
+ 90,
571
+ 19,
572
+ 153,
573
+ 218,
574
+ 255,
575
+ 16,
576
+ 132,
577
+ 4,
578
+ 142,
579
+ 123,
580
+ 216,
581
+ 219,
582
+ 233,
583
+ 248,
584
+ 89
585
+ ];
586
+ };
587
+ };
588
+ },
589
+ {
590
+ name: 'feeRecipientAta';
591
+ writable: true;
592
+ pda: {
593
+ seeds: [
594
+ {
595
+ kind: 'account';
596
+ path: 'feeRecipient';
597
+ },
598
+ {
599
+ kind: 'account';
600
+ path: 'tokenProgram';
601
+ },
602
+ {
603
+ kind: 'account';
604
+ path: 'mint';
605
+ }
606
+ ];
607
+ program: {
608
+ kind: 'const';
609
+ value: [
610
+ 140,
611
+ 151,
612
+ 37,
613
+ 143,
614
+ 78,
615
+ 36,
616
+ 137,
617
+ 241,
618
+ 187,
619
+ 61,
620
+ 16,
621
+ 41,
622
+ 20,
623
+ 142,
624
+ 13,
625
+ 131,
626
+ 11,
627
+ 90,
628
+ 19,
629
+ 153,
630
+ 218,
631
+ 255,
632
+ 16,
633
+ 132,
634
+ 4,
635
+ 142,
636
+ 123,
637
+ 216,
638
+ 219,
639
+ 233,
640
+ 248,
641
+ 89
642
+ ];
643
+ };
644
+ };
645
+ },
646
+ {
647
+ name: 'tokenProgram';
648
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
649
+ },
650
+ {
651
+ name: 'associatedTokenProgram';
652
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
653
+ },
654
+ {
655
+ name: 'systemProgram';
656
+ address: '11111111111111111111111111111111';
657
+ }
658
+ ];
659
+ args: [];
660
+ },
489
661
  {
490
662
  name: 'collectCustomerFee';
491
663
  discriminator: [187, 253, 215, 126, 168, 246, 253, 21];
@@ -922,6 +1094,35 @@ export type TriadProtocol = {
922
1094
  writable: true;
923
1095
  signer: true;
924
1096
  },
1097
+ {
1098
+ name: 'central';
1099
+ writable: true;
1100
+ pda: {
1101
+ seeds: [
1102
+ {
1103
+ kind: 'const';
1104
+ value: [99, 101, 110, 116, 114, 97, 108];
1105
+ },
1106
+ {
1107
+ kind: 'const';
1108
+ value: [
1109
+ 116,
1110
+ 114,
1111
+ 105,
1112
+ 97,
1113
+ 100,
1114
+ 109,
1115
+ 97,
1116
+ 114,
1117
+ 107,
1118
+ 101,
1119
+ 116,
1120
+ 115
1121
+ ];
1122
+ }
1123
+ ];
1124
+ };
1125
+ },
925
1126
  {
926
1127
  name: 'customer';
927
1128
  writable: true;
@@ -941,8 +1142,9 @@ export type TriadProtocol = {
941
1142
  value: [109, 97, 114, 107, 101, 116];
942
1143
  },
943
1144
  {
944
- kind: 'arg';
945
- path: 'args.market_id';
1145
+ kind: 'account';
1146
+ path: 'central.next_market_id.checked_add(1)';
1147
+ account: 'central';
946
1148
  }
947
1149
  ];
948
1150
  };
@@ -972,6 +1174,35 @@ export type TriadProtocol = {
972
1174
  writable: true;
973
1175
  signer: true;
974
1176
  },
1177
+ {
1178
+ name: 'central';
1179
+ writable: true;
1180
+ pda: {
1181
+ seeds: [
1182
+ {
1183
+ kind: 'const';
1184
+ value: [99, 101, 110, 116, 114, 97, 108];
1185
+ },
1186
+ {
1187
+ kind: 'const';
1188
+ value: [
1189
+ 116,
1190
+ 114,
1191
+ 105,
1192
+ 97,
1193
+ 100,
1194
+ 109,
1195
+ 97,
1196
+ 114,
1197
+ 107,
1198
+ 101,
1199
+ 116,
1200
+ 115
1201
+ ];
1202
+ }
1203
+ ];
1204
+ };
1205
+ },
975
1206
  {
976
1207
  name: 'customer';
977
1208
  writable: true;
@@ -990,8 +1221,9 @@ export type TriadProtocol = {
990
1221
  value: [109, 97, 114, 107, 101, 116];
991
1222
  },
992
1223
  {
993
- kind: 'arg';
994
- path: 'args.market_id';
1224
+ kind: 'account';
1225
+ path: 'central.next_market_id.checked_add(1)';
1226
+ account: 'central';
995
1227
  }
996
1228
  ];
997
1229
  };
@@ -1039,8 +1271,9 @@ export type TriadProtocol = {
1039
1271
  value: [111, 114, 100, 101, 114, 95, 98, 111, 111, 107];
1040
1272
  },
1041
1273
  {
1042
- kind: 'arg';
1043
- path: 'marketId';
1274
+ kind: 'account';
1275
+ path: 'market.market_id';
1276
+ account: 'marketV2';
1044
1277
  }
1045
1278
  ];
1046
1279
  };
@@ -1050,12 +1283,7 @@ export type TriadProtocol = {
1050
1283
  address: '11111111111111111111111111111111';
1051
1284
  }
1052
1285
  ];
1053
- args: [
1054
- {
1055
- name: 'marketId';
1056
- type: 'u64';
1057
- }
1058
- ];
1286
+ args: [];
1059
1287
  },
1060
1288
  {
1061
1289
  name: 'createPool';
@@ -2078,6 +2306,60 @@ export type TriadProtocol = {
2078
2306
  ];
2079
2307
  args: [];
2080
2308
  },
2309
+ {
2310
+ name: 'updateCentral';
2311
+ discriminator: [251, 46, 123, 120, 218, 7, 245, 140];
2312
+ accounts: [
2313
+ {
2314
+ name: 'signer';
2315
+ writable: true;
2316
+ signer: true;
2317
+ },
2318
+ {
2319
+ name: 'central';
2320
+ writable: true;
2321
+ pda: {
2322
+ seeds: [
2323
+ {
2324
+ kind: 'const';
2325
+ value: [99, 101, 110, 116, 114, 97, 108];
2326
+ },
2327
+ {
2328
+ kind: 'const';
2329
+ value: [
2330
+ 116,
2331
+ 114,
2332
+ 105,
2333
+ 97,
2334
+ 100,
2335
+ 109,
2336
+ 97,
2337
+ 114,
2338
+ 107,
2339
+ 101,
2340
+ 116,
2341
+ 115
2342
+ ];
2343
+ }
2344
+ ];
2345
+ };
2346
+ },
2347
+ {
2348
+ name: 'systemProgram';
2349
+ address: '11111111111111111111111111111111';
2350
+ }
2351
+ ];
2352
+ args: [
2353
+ {
2354
+ name: 'args';
2355
+ type: {
2356
+ defined: {
2357
+ name: 'updateCentralArgs';
2358
+ };
2359
+ };
2360
+ }
2361
+ ];
2362
+ },
2081
2363
  {
2082
2364
  name: 'updateCustomer';
2083
2365
  discriminator: [158, 118, 103, 177, 241, 229, 169, 124];
@@ -3094,10 +3376,14 @@ export type TriadProtocol = {
3094
3376
  name: 'rewardsPaid';
3095
3377
  type: 'u64';
3096
3378
  },
3379
+ {
3380
+ name: 'nextMarketId';
3381
+ type: 'u64';
3382
+ },
3097
3383
  {
3098
3384
  name: 'padding';
3099
3385
  type: {
3100
- array: ['u8', 295];
3386
+ array: ['u8', 287];
3101
3387
  };
3102
3388
  }
3103
3389
  ];
@@ -3226,10 +3512,6 @@ export type TriadProtocol = {
3226
3512
  type: {
3227
3513
  kind: 'struct';
3228
3514
  fields: [
3229
- {
3230
- name: 'marketId';
3231
- type: 'u64';
3232
- },
3233
3515
  {
3234
3516
  name: 'question';
3235
3517
  type: {
@@ -3268,10 +3550,6 @@ export type TriadProtocol = {
3268
3550
  type: {
3269
3551
  kind: 'struct';
3270
3552
  fields: [
3271
- {
3272
- name: 'marketId';
3273
- type: 'u64';
3274
- },
3275
3553
  {
3276
3554
  name: 'resolveIn';
3277
3555
  type: 'i64';
@@ -4551,6 +4829,26 @@ export type TriadProtocol = {
4551
4829
  ];
4552
4830
  };
4553
4831
  },
4832
+ {
4833
+ name: 'updateCentralArgs';
4834
+ type: {
4835
+ kind: 'struct';
4836
+ fields: [
4837
+ {
4838
+ name: 'nextMarketId';
4839
+ type: {
4840
+ option: 'u64';
4841
+ };
4842
+ },
4843
+ {
4844
+ name: 'isLocked';
4845
+ type: {
4846
+ option: 'bool';
4847
+ };
4848
+ }
4849
+ ];
4850
+ };
4851
+ },
4554
4852
  {
4555
4853
  name: 'updateCustomerArgs';
4556
4854
  type: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.3.9",
3
+ "version": "4.4.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",