@triadxyz/triad-protocol 1.6.5-beta → 1.6.7-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.
@@ -274,7 +274,11 @@ const closeOrders = () => __awaiter(void 0, void 0, void 0, function* () {
274
274
  }
275
275
  });
276
276
  const resolveMarket = () => __awaiter(void 0, void 0, void 0, function* () {
277
- const marketsToResolve = [{ marketId: 130, winningDirection: { hype: {} } }];
277
+ const marketsToResolve = [
278
+ { marketId: 123, winningDirection: { flop: {} } },
279
+ { marketId: 125, winningDirection: { flop: {} } },
280
+ { marketId: 124, winningDirection: { flop: {} } }
281
+ ];
278
282
  for (const market of marketsToResolve) {
279
283
  const response = yield triadProtocol.trade.resolveMarket({
280
284
  marketId: market.marketId,
@@ -440,7 +444,7 @@ const collectRemainingLiquidity = () => __awaiter(void 0, void 0, void 0, functi
440
444
  }
441
445
  });
442
446
  const allowMarketToPayout = () => __awaiter(void 0, void 0, void 0, function* () {
443
- const markets = [130];
447
+ const markets = [123, 124, 125];
444
448
  for (const market of markets) {
445
449
  try {
446
450
  const response = yield triadProtocol.trade.allowMarketToPayout(Number(market));
@@ -492,15 +496,15 @@ const deployImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
492
496
  // 8 - 2k tridents
493
497
  // 9 - 50 HXD - 10,000
494
498
  // 10 - 0.01 ORE - 10 ORE
495
- // 11 - TRD 100 - 5,000
499
+ // 11 - PYTH 20 - 5,000
496
500
  // 12 - 10 STREAM - 15K STREAM
497
501
  const addWheelPrize = () => __awaiter(void 0, void 0, void 0, function* () {
498
502
  const response = yield triadProtocol.wheel.addWheelPrize({
499
- prize: 3,
500
- amount: 5,
501
- rangeMin: 2012,
502
- rangeMax: 103012,
503
- availableQuantity: 2000
503
+ prize: 11,
504
+ amount: 20,
505
+ rangeMin: 922970,
506
+ rangeMax: 923970,
507
+ availableQuantity: 30
504
508
  });
505
509
  console.log(response);
506
510
  });
@@ -517,6 +521,7 @@ const getWheel = () => __awaiter(void 0, void 0, void 0, function* () {
517
521
  }));
518
522
  console.table(prizes);
519
523
  });
524
+ getWheel();
520
525
  const spinWheel = () => __awaiter(void 0, void 0, void 0, function* () {
521
526
  const spin = (0, pda_1.getWheelPDA)(triadProtocol.program.programId, constants_1.VALENT_SPIN_NAME);
522
527
  console.log(spin);
@@ -21,11 +21,11 @@ class InitMarket {
21
21
  this.triadProtocol = triadProtocol;
22
22
  this.markets = [
23
23
  {
24
- marketId: 1001,
25
- question: 'Will PHOTOM flip TRON in 7D revenue by february 15?',
24
+ marketId: 131,
25
+ question: 'Will $HXD be above $0.015 on february 17 at 11PM UTC?',
26
26
  startTime: 1239663940,
27
- endTime: 1739663940,
28
- image: ''
27
+ endTime: 1739833140,
28
+ image: 'hxd.png'
29
29
  }
30
30
  ];
31
31
  this.initializeMarkets = () => __awaiter(this, void 0, void 0, function* () {
package/dist/wheel.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- /// <reference types="bn.js" />
2
- import { AnchorProvider, BN, Program } from '@coral-xyz/anchor';
1
+ import { AnchorProvider, Program } from '@coral-xyz/anchor';
3
2
  import { Keypair } from '@solana/web3.js';
4
3
  import { TriadProtocol } from './types/triad_protocol';
5
4
  import { RpcOptions } from './types';
@@ -45,16 +44,14 @@ export default class Wheel {
45
44
  */
46
45
  spinWheel(args: {
47
46
  isSol: boolean;
48
- prize: number[];
47
+ prizes: number[];
49
48
  verifier: Keypair;
50
49
  }, options?: RpcOptions): Promise<string>;
51
50
  /**
52
51
  * Get Spin Wheel
53
52
  *
54
53
  */
55
- getSpinWheel(): Promise<BN | {
56
- none: {};
57
- }>;
54
+ getSpinWheel(amount: number): Promise<number[]>;
58
55
  /**
59
56
  * Swap Wheel Token
60
57
  * @param amount - Amount of tokens to buy
package/dist/wheel.js CHANGED
@@ -87,7 +87,7 @@ class Wheel {
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
88
  const wheelPDA = (0, pda_1.getWheelPDA)(this.program.programId, constants_1.VALENT_SPIN_NAME);
89
89
  let ixs = [];
90
- for (const prize of args.prize) {
90
+ for (const prize of args.prizes) {
91
91
  ixs.push(yield this.program.methods
92
92
  .spinWheel({
93
93
  isSol: args.isSol,
@@ -100,25 +100,29 @@ class Wheel {
100
100
  mint: constants_1.WHEEL_MINT
101
101
  })
102
102
  .instruction());
103
- return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], args.verifier);
104
103
  }
104
+ return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], args.verifier);
105
105
  });
106
106
  }
107
107
  /**
108
108
  * Get Spin Wheel
109
109
  *
110
110
  */
111
- getSpinWheel() {
111
+ getSpinWheel(amount) {
112
112
  return __awaiter(this, void 0, void 0, function* () {
113
113
  const [wheel] = yield this.program.account.wheel.all();
114
- const randomNumber = Math.floor(Math.random() * 1000000) + 1;
115
- const prize = wheel.account.prizes.find((p) => randomNumber >= p.rangeMin.toNumber() &&
116
- randomNumber <= p.rangeMax.toNumber() &&
117
- p.status.claimed);
118
- if (!prize) {
119
- return { none: {} };
114
+ const prizes = [];
115
+ for (let i = 0; i < amount; i++) {
116
+ const randomNumber = Math.floor(Math.random() * 1000000) + 1;
117
+ const prize = wheel.account.prizes.find((p) => randomNumber >= p.rangeMin.toNumber() &&
118
+ randomNumber <= p.rangeMax.toNumber() &&
119
+ p.status.claimed);
120
+ if (!prize) {
121
+ prizes.push(999);
122
+ }
123
+ prizes.push(prize.prize.toNumber());
120
124
  }
121
- return prize.prize;
125
+ return prizes;
122
126
  });
123
127
  }
124
128
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.6.5-beta",
3
+ "version": "1.6.7-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",