@triadxyz/triad-protocol 4.1.1 → 4.1.3

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
2
  import { Program } from '@coral-xyz/anchor';
4
3
  import { TriadProtocol } from './types/triad_protocol';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { Connection, PublicKey } from '@solana/web3.js';
3
2
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
4
3
  import { TriadProtocol as TriadProtocolIDL } from './types/triad_protocol';
@@ -172,5 +171,5 @@ export default class TriadProtocol {
172
171
  * @param args.customer - The customer of the market
173
172
  * @param args.poolId - The ID of the pool
174
173
  */
175
- createMarketPyth({ marketId, resolveIn, customer, poolId, feedId }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
174
+ createMarketPyth({ marketId, resolveIn, customer, poolId, feedId, direction }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
176
175
  }
package/dist/index.js CHANGED
@@ -41,7 +41,6 @@ const poseidon_1 = __importDefault(require("./poseidon"));
41
41
  const predictor_1 = __importDefault(require("./predictor"));
42
42
  const trade_1 = __importDefault(require("./trade"));
43
43
  const customer_1 = __importDefault(require("./customer"));
44
- const pyth_solana_receiver_1 = require("@pythnetwork/pyth-solana-receiver");
45
44
  __exportStar(require("./types"), exports);
46
45
  __exportStar(require("./types/predictor"), exports);
47
46
  __exportStar(require("./types/stake"), exports);
@@ -286,7 +285,7 @@ class TriadProtocol {
286
285
  const ixs = [];
287
286
  let feedPDA = null;
288
287
  if (isPyth) {
289
- feedPDA = (0, pyth_solana_receiver_1.getPriceFeedAccountForProgram)(0, feedId);
288
+ feedPDA = (0, helpers_2.getPriceFeedAccountForProgram)(feedId);
290
289
  }
291
290
  const poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
292
291
  ixs.push(yield this.program.methods
@@ -484,15 +483,16 @@ class TriadProtocol {
484
483
  * @param args.customer - The customer of the market
485
484
  * @param args.poolId - The ID of the pool
486
485
  */
487
- createMarketPyth({ marketId, resolveIn, customer, poolId, feedId }) {
486
+ createMarketPyth({ marketId, resolveIn, customer, poolId, feedId, direction }) {
488
487
  return __awaiter(this, void 0, void 0, function* () {
489
488
  const ixs = [];
490
489
  let poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
491
- const feedPDA = (0, pyth_solana_receiver_1.getPriceFeedAccountForProgram)(0, feedId);
490
+ const feedPDA = (0, helpers_2.getPriceFeedAccountForProgram)(feedId);
492
491
  ixs.push(yield this.program.methods
493
492
  .createMarketPyth({
494
493
  marketId: new bn_js_1.default(marketId),
495
- resolveIn: new bn_js_1.default(resolveIn)
494
+ resolveIn: new bn_js_1.default(resolveIn),
495
+ direction
496
496
  })
497
497
  .accounts({
498
498
  signer: this.program.provider.publicKey,
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { Program } from '@coral-xyz/anchor';
3
2
  import { PublicKey } from '@solana/web3.js';
4
3
  import { TriadProtocol } from './types/triad_protocol';
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
2
  import { Program } from '@coral-xyz/anchor';
4
3
  import { TriadProtocol } from './types/triad_protocol';
package/dist/stake.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { Program } from '@coral-xyz/anchor';
3
2
  import { PublicKey } from '@solana/web3.js';
4
3
  import { TriadProtocol } from './types/triad_protocol';
package/dist/trade.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
2
  import { Program } from '@coral-xyz/anchor';
4
3
  import { TriadProtocol } from './types/triad_protocol';
@@ -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;
@@ -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.1",
3
+ "version": "4.1.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",