@triadxyz/triad-protocol 4.1.2 → 4.1.4

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
@@ -116,8 +116,9 @@ export default class TriadProtocol {
116
116
  * Update Market Winning Direction
117
117
  * @param args.marketId - The ID of the Market
118
118
  * @param args.winningDirection - The Winning Direction of the Market
119
+ * @param args.poolId - The ID of the Pool
119
120
  */
120
- updateMarketWinningDirection({ marketId, winningDirection }: UpdateMarketWinningDirectionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
121
+ updateMarketWinningDirection({ marketId, winningDirection, poolId }: UpdateMarketWinningDirectionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
121
122
  /**
122
123
  * Update Market Payout
123
124
  * @param args.marketId - The ID of the market
@@ -171,5 +172,10 @@ export default class TriadProtocol {
171
172
  * @param args.customer - The customer of the market
172
173
  * @param args.poolId - The ID of the pool
173
174
  */
174
- createMarketPyth({ marketId, resolveIn, customer, poolId, feedId }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
175
+ createMarketPyth({ marketId, resolveIn, customer, poolId, feedId, direction }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
176
+ /**
177
+ * Burn Triad
178
+ * @param amount - Amount to burn
179
+ */
180
+ burnTriad(amount: number): Promise<string | import("@solana/web3.js").VersionedTransaction>;
175
181
  }
package/dist/index.js CHANGED
@@ -339,15 +339,17 @@ class TriadProtocol {
339
339
  * Update Market Winning Direction
340
340
  * @param args.marketId - The ID of the Market
341
341
  * @param args.winningDirection - The Winning Direction of the Market
342
+ * @param args.poolId - The ID of the Pool
342
343
  */
343
- updateMarketWinningDirection({ marketId, winningDirection }) {
344
+ updateMarketWinningDirection({ marketId, winningDirection, poolId }) {
344
345
  return __awaiter(this, void 0, void 0, function* () {
345
346
  const ixs = [
346
347
  yield this.program.methods
347
348
  .updateMarketWinningDirection(winningDirection)
348
349
  .accounts({
349
350
  signer: this.program.provider.publicKey,
350
- market: (0, pda_1.getMarketPDA)(this.program.programId, marketId)
351
+ market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
352
+ pool: poolId ? (0, pda_1.getPoolPDA)(this.program.programId, poolId) : null
351
353
  })
352
354
  .instruction()
353
355
  ];
@@ -483,7 +485,7 @@ class TriadProtocol {
483
485
  * @param args.customer - The customer of the market
484
486
  * @param args.poolId - The ID of the pool
485
487
  */
486
- createMarketPyth({ marketId, resolveIn, customer, poolId, feedId }) {
488
+ createMarketPyth({ marketId, resolveIn, customer, poolId, feedId, direction }) {
487
489
  return __awaiter(this, void 0, void 0, function* () {
488
490
  const ixs = [];
489
491
  let poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
@@ -491,7 +493,8 @@ class TriadProtocol {
491
493
  ixs.push(yield this.program.methods
492
494
  .createMarketPyth({
493
495
  marketId: new bn_js_1.default(marketId),
494
- resolveIn: new bn_js_1.default(resolveIn)
496
+ resolveIn: new bn_js_1.default(resolveIn),
497
+ direction
495
498
  })
496
499
  .accounts({
497
500
  signer: this.program.provider.publicKey,
@@ -511,5 +514,22 @@ class TriadProtocol {
511
514
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
512
515
  });
513
516
  }
517
+ /**
518
+ * Burn Triad
519
+ * @param amount - Amount to burn
520
+ */
521
+ burnTriad(amount) {
522
+ return __awaiter(this, void 0, void 0, function* () {
523
+ const ixs = [
524
+ yield this.program.methods
525
+ .burnTriad(new bn_js_1.default(amount * Math.pow(10, 6)))
526
+ .accounts({
527
+ signer: this.program.provider.publicKey
528
+ })
529
+ .instruction()
530
+ ];
531
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
532
+ });
533
+ }
514
534
  }
515
535
  exports.default = TriadProtocol;
@@ -147,6 +147,68 @@
147
147
  ],
148
148
  "args": []
149
149
  },
150
+ {
151
+ "name": "burn_triad",
152
+ "discriminator": [243, 235, 96, 117, 187, 41, 238, 3],
153
+ "accounts": [
154
+ {
155
+ "name": "signer",
156
+ "writable": true,
157
+ "signer": true
158
+ },
159
+ {
160
+ "name": "mint",
161
+ "writable": true,
162
+ "address": "3ADvYyTbmQcLMiqdFSo1m2KpQWxYg9X6wW4N8viRTNf9"
163
+ },
164
+ {
165
+ "name": "signer_ata",
166
+ "writable": true,
167
+ "pda": {
168
+ "seeds": [
169
+ {
170
+ "kind": "account",
171
+ "path": "signer"
172
+ },
173
+ {
174
+ "kind": "account",
175
+ "path": "token_program"
176
+ },
177
+ {
178
+ "kind": "account",
179
+ "path": "mint"
180
+ }
181
+ ],
182
+ "program": {
183
+ "kind": "const",
184
+ "value": [
185
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
186
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
187
+ 219, 233, 248, 89
188
+ ]
189
+ }
190
+ }
191
+ },
192
+ {
193
+ "name": "token_program",
194
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
195
+ },
196
+ {
197
+ "name": "associated_token_program",
198
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
199
+ },
200
+ {
201
+ "name": "system_program",
202
+ "address": "11111111111111111111111111111111"
203
+ }
204
+ ],
205
+ "args": [
206
+ {
207
+ "name": "amount",
208
+ "type": "u64"
209
+ }
210
+ ]
211
+ },
150
212
  {
151
213
  "name": "cancel_ask_order",
152
214
  "discriminator": [211, 157, 113, 122, 34, 180, 162, 178],
@@ -891,7 +953,8 @@
891
953
  },
892
954
  {
893
955
  "name": "feed",
894
- "writable": true
956
+ "writable": true,
957
+ "optional": true
895
958
  },
896
959
  {
897
960
  "name": "system_program",
@@ -2037,6 +2100,11 @@
2037
2100
  "writable": true,
2038
2101
  "signer": true
2039
2102
  },
2103
+ {
2104
+ "name": "pool",
2105
+ "writable": true,
2106
+ "optional": true
2107
+ },
2040
2108
  {
2041
2109
  "name": "market",
2042
2110
  "writable": true
@@ -2342,6 +2410,10 @@
2342
2410
  "name": "BookOrderEvent",
2343
2411
  "discriminator": [175, 216, 61, 224, 98, 215, 181, 62]
2344
2412
  },
2413
+ {
2414
+ "name": "BurnTriadEvent",
2415
+ "discriminator": [2, 86, 74, 29, 119, 7, 53, 82]
2416
+ },
2345
2417
  {
2346
2418
  "name": "CollectMarketFeeEvent",
2347
2419
  "discriminator": [210, 147, 203, 216, 158, 111, 59, 143]
@@ -2770,6 +2842,26 @@
2770
2842
  ]
2771
2843
  }
2772
2844
  },
2845
+ {
2846
+ "name": "BurnTriadEvent",
2847
+ "type": {
2848
+ "kind": "struct",
2849
+ "fields": [
2850
+ {
2851
+ "name": "authority",
2852
+ "type": "pubkey"
2853
+ },
2854
+ {
2855
+ "name": "amount",
2856
+ "type": "u64"
2857
+ },
2858
+ {
2859
+ "name": "timestamp",
2860
+ "type": "i64"
2861
+ }
2862
+ ]
2863
+ }
2864
+ },
2773
2865
  {
2774
2866
  "name": "CancelOrderArgs",
2775
2867
  "type": {
@@ -2960,6 +3052,10 @@
2960
3052
  {
2961
3053
  "name": "resolve_in",
2962
3054
  "type": "i64"
3055
+ },
3056
+ {
3057
+ "name": "direction",
3058
+ "type": "string"
2963
3059
  }
2964
3060
  ]
2965
3061
  }
@@ -3287,7 +3383,7 @@
3287
3383
  },
3288
3384
  {
3289
3385
  "name": "pyth_price",
3290
- "type": "u64"
3386
+ "type": "i64"
3291
3387
  }
3292
3388
  ]
3293
3389
  }
@@ -3453,7 +3549,7 @@
3453
3549
  },
3454
3550
  {
3455
3551
  "name": "pyth_price",
3456
- "type": "u64"
3552
+ "type": "i64"
3457
3553
  },
3458
3554
  {
3459
3555
  "name": "padding",
@@ -3742,10 +3838,14 @@
3742
3838
  "name": "feed",
3743
3839
  "type": "pubkey"
3744
3840
  },
3841
+ {
3842
+ "name": "has_actived_market",
3843
+ "type": "bool"
3844
+ },
3745
3845
  {
3746
3846
  "name": "padding",
3747
3847
  "type": {
3748
- "array": ["u8", 30]
3848
+ "array": ["u8", 29]
3749
3849
  }
3750
3850
  }
3751
3851
  ]
@@ -13,6 +13,8 @@ export type Pool = {
13
13
  authority: string;
14
14
  isFast: boolean;
15
15
  isPyth: boolean;
16
+ feed: string;
17
+ hasActivedMarket: boolean;
16
18
  };
17
19
  export type Market = {
18
20
  address: string;
@@ -159,6 +161,7 @@ export type CreateMarketPythArgs = {
159
161
  customer: PublicKey;
160
162
  poolId: number;
161
163
  feedId: string;
164
+ direction: 'Above' | 'Below';
162
165
  };
163
166
  export type CreatePoolArgs = {
164
167
  poolId: number;
@@ -179,6 +182,7 @@ export type CreatePoolArgs = {
179
182
  export type UpdateMarketWinningDirectionArgs = {
180
183
  marketId: number;
181
184
  winningDirection: WinningDirectionEncoded;
185
+ poolId: number;
182
186
  };
183
187
  export type UpdateMarketPayoutArgs = {
184
188
  marketId: number;
@@ -223,6 +223,97 @@ export type TriadProtocol = {
223
223
  ];
224
224
  args: [];
225
225
  },
226
+ {
227
+ name: 'burnTriad';
228
+ discriminator: [243, 235, 96, 117, 187, 41, 238, 3];
229
+ accounts: [
230
+ {
231
+ name: 'signer';
232
+ writable: true;
233
+ signer: true;
234
+ },
235
+ {
236
+ name: 'mint';
237
+ writable: true;
238
+ address: '3ADvYyTbmQcLMiqdFSo1m2KpQWxYg9X6wW4N8viRTNf9';
239
+ },
240
+ {
241
+ name: 'signerAta';
242
+ writable: true;
243
+ pda: {
244
+ seeds: [
245
+ {
246
+ kind: 'account';
247
+ path: 'signer';
248
+ },
249
+ {
250
+ kind: 'account';
251
+ path: 'tokenProgram';
252
+ },
253
+ {
254
+ kind: 'account';
255
+ path: 'mint';
256
+ }
257
+ ];
258
+ program: {
259
+ kind: 'const';
260
+ value: [
261
+ 140,
262
+ 151,
263
+ 37,
264
+ 143,
265
+ 78,
266
+ 36,
267
+ 137,
268
+ 241,
269
+ 187,
270
+ 61,
271
+ 16,
272
+ 41,
273
+ 20,
274
+ 142,
275
+ 13,
276
+ 131,
277
+ 11,
278
+ 90,
279
+ 19,
280
+ 153,
281
+ 218,
282
+ 255,
283
+ 16,
284
+ 132,
285
+ 4,
286
+ 142,
287
+ 123,
288
+ 216,
289
+ 219,
290
+ 233,
291
+ 248,
292
+ 89
293
+ ];
294
+ };
295
+ };
296
+ },
297
+ {
298
+ name: 'tokenProgram';
299
+ address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
300
+ },
301
+ {
302
+ name: 'associatedTokenProgram';
303
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
304
+ },
305
+ {
306
+ name: 'systemProgram';
307
+ address: '11111111111111111111111111111111';
308
+ }
309
+ ];
310
+ args: [
311
+ {
312
+ name: 'amount';
313
+ type: 'u64';
314
+ }
315
+ ];
316
+ },
226
317
  {
227
318
  name: 'cancelAskOrder';
228
319
  discriminator: [211, 157, 113, 122, 34, 180, 162, 178];
@@ -1241,6 +1332,7 @@ export type TriadProtocol = {
1241
1332
  {
1242
1333
  name: 'feed';
1243
1334
  writable: true;
1335
+ optional: true;
1244
1336
  },
1245
1337
  {
1246
1338
  name: 'systemProgram';
@@ -2856,6 +2948,11 @@ export type TriadProtocol = {
2856
2948
  writable: true;
2857
2949
  signer: true;
2858
2950
  },
2951
+ {
2952
+ name: 'pool';
2953
+ writable: true;
2954
+ optional: true;
2955
+ },
2859
2956
  {
2860
2957
  name: 'market';
2861
2958
  writable: true;
@@ -3259,6 +3356,10 @@ export type TriadProtocol = {
3259
3356
  name: 'bookOrderEvent';
3260
3357
  discriminator: [175, 216, 61, 224, 98, 215, 181, 62];
3261
3358
  },
3359
+ {
3360
+ name: 'burnTriadEvent';
3361
+ discriminator: [2, 86, 74, 29, 119, 7, 53, 82];
3362
+ },
3262
3363
  {
3263
3364
  name: 'collectMarketFeeEvent';
3264
3365
  discriminator: [210, 147, 203, 216, 158, 111, 59, 143];
@@ -3687,6 +3788,26 @@ export type TriadProtocol = {
3687
3788
  ];
3688
3789
  };
3689
3790
  },
3791
+ {
3792
+ name: 'burnTriadEvent';
3793
+ type: {
3794
+ kind: 'struct';
3795
+ fields: [
3796
+ {
3797
+ name: 'authority';
3798
+ type: 'pubkey';
3799
+ },
3800
+ {
3801
+ name: 'amount';
3802
+ type: 'u64';
3803
+ },
3804
+ {
3805
+ name: 'timestamp';
3806
+ type: 'i64';
3807
+ }
3808
+ ];
3809
+ };
3810
+ },
3690
3811
  {
3691
3812
  name: 'cancelOrderArgs';
3692
3813
  type: {
@@ -3877,6 +3998,10 @@ export type TriadProtocol = {
3877
3998
  {
3878
3999
  name: 'resolveIn';
3879
4000
  type: 'i64';
4001
+ },
4002
+ {
4003
+ name: 'direction';
4004
+ type: 'string';
3880
4005
  }
3881
4006
  ];
3882
4007
  };
@@ -4204,7 +4329,7 @@ export type TriadProtocol = {
4204
4329
  },
4205
4330
  {
4206
4331
  name: 'pythPrice';
4207
- type: 'u64';
4332
+ type: 'i64';
4208
4333
  }
4209
4334
  ];
4210
4335
  };
@@ -4370,7 +4495,7 @@ export type TriadProtocol = {
4370
4495
  },
4371
4496
  {
4372
4497
  name: 'pythPrice';
4373
- type: 'u64';
4498
+ type: 'i64';
4374
4499
  },
4375
4500
  {
4376
4501
  name: 'padding';
@@ -4659,10 +4784,14 @@ export type TriadProtocol = {
4659
4784
  name: 'feed';
4660
4785
  type: 'pubkey';
4661
4786
  },
4787
+ {
4788
+ name: 'hasActivedMarket';
4789
+ type: 'bool';
4790
+ },
4662
4791
  {
4663
4792
  name: 'padding';
4664
4793
  type: {
4665
- array: ['u8', 30];
4794
+ array: ['u8', 29];
4666
4795
  };
4667
4796
  }
4668
4797
  ];
@@ -11,5 +11,6 @@ export declare const PRICE_FEED: {
11
11
  BTC: string;
12
12
  SOL: string;
13
13
  ETH: string;
14
+ OIL: string;
14
15
  };
15
16
  export declare const DEFAULT_PUSH_ORACLE_PROGRAM_ID: PublicKey;
@@ -13,6 +13,7 @@ exports.BOOK_ORDER_NULL = 61;
13
13
  exports.PRICE_FEED = {
14
14
  BTC: '0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
15
15
  SOL: '0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d',
16
- ETH: '0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace'
16
+ ETH: '0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
17
+ OIL: '0x67784f72e95ac01337edb7d7bd5bbd1c03669101b7068a620df228ed4e52ef14'
17
18
  };
18
19
  exports.DEFAULT_PUSH_ORACLE_PROGRAM_ID = new web3_js_1.PublicKey('pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT');
@@ -65,7 +65,9 @@ const formatPool = (account, address) => {
65
65
  question: Buffer.from(account.question).toString().replace(/\0+$/, ''),
66
66
  authority: account.authority.toString(),
67
67
  isFast: account.isFast,
68
- isPyth: account.isPyth
68
+ isPyth: account.isPyth,
69
+ feed: account.feed.toString(),
70
+ hasActivedMarket: account.hasActivedMarket
69
71
  };
70
72
  };
71
73
  exports.formatPool = formatPool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",