@triadxyz/triad-protocol 1.6.4-beta → 1.6.6-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));
@@ -482,25 +486,25 @@ const deployImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
482
486
  console.log(file);
483
487
  return file;
484
488
  });
485
- // 1 - TRD 10k - 10,000 / 1 to 20
486
- // 2 - TRD 50 - 10,000 / 21 to 2021
487
- // 3 - TRD 5 - 50,000 / 2022 to 102022
488
- // 4 - Honeyland NFT - 30 NFT / 102023 to 132023
489
- // 5 - Poseidon NFT - 20 NFT / 132024 to 152024
490
- // 6 - SMB 3 - 2 NFT / 152025 to 157025
491
- // 7 - 500 tridents / 157026 to 657026
492
- // 8 - 2k tridents / 657027 to 857027
493
- // 9 - 50 HXD - 10,000 / 857028 to 864008
494
- // 10 - 0.01 ORE - 10 ORE / 864009 to 924009
495
- // 11 - TRD 100 - 5,000 / 924010 to 925010
496
- // 12 - 10 STREAM - 15K STREAM / 925011 to 1000000
489
+ // 1 - TRD 10k - 10,000
490
+ // 2 - TRD 50 - 10,000
491
+ // 3 - TRD 5 - 50,000
492
+ // 4 - Honeyland NFT - 30 NFT
493
+ // 5 - Poseidon NFT - 20 NFT
494
+ // 6 - SMB 3 - 2 NFT
495
+ // 7 - 500 tridents
496
+ // 8 - 2k tridents
497
+ // 9 - 50 HXD - 10,000
498
+ // 10 - 0.01 ORE - 10 ORE
499
+ // 11 - PYTH 20 - 5,000
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
503
  prize: 11,
500
504
  amount: 20,
501
- rangeMin: 924010,
502
- rangeMax: 925010,
503
- availableQuantity: 50
505
+ rangeMin: 922970,
506
+ rangeMax: 923970,
507
+ availableQuantity: 30
504
508
  });
505
509
  console.log(response);
506
510
  });
@@ -515,10 +519,10 @@ const getWheel = () => __awaiter(void 0, void 0, void 0, function* () {
515
519
  rangeMax: prize.rangeMax.toString(),
516
520
  availableQuantity: prize.availableQuantity.toString()
517
521
  }));
518
- console.log(prizes);
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);
523
528
  });
524
- spinWheel();
@@ -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<any[] | 999>;
58
55
  /**
59
56
  * Swap Wheel Token
60
57
  * @param amount - Amount of tokens to buy
package/dist/wheel.js CHANGED
@@ -86,36 +86,43 @@ class Wheel {
86
86
  spinWheel(args, options) {
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
- const ix = yield this.program.methods
90
- .spinWheel({
91
- isSol: args.isSol,
92
- prize: new anchor_1.BN(args.prize)
93
- })
94
- .accounts({
95
- signer: this.provider.wallet.publicKey,
96
- verifier: constants_1.VERIFIER,
97
- wheel: wheelPDA,
98
- mint: constants_1.WHEEL_MINT
99
- })
100
- .instruction();
101
- return (0, sendVersionedTransaction_1.default)(this.provider, [ix], options, undefined, [], args.verifier);
89
+ let ixs = [];
90
+ for (const prize of args.prizes) {
91
+ ixs.push(yield this.program.methods
92
+ .spinWheel({
93
+ isSol: args.isSol,
94
+ prize: new anchor_1.BN(prize)
95
+ })
96
+ .accounts({
97
+ signer: this.provider.wallet.publicKey,
98
+ verifier: constants_1.VERIFIER,
99
+ wheel: wheelPDA,
100
+ mint: constants_1.WHEEL_MINT
101
+ })
102
+ .instruction());
103
+ return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options, undefined, [], args.verifier);
104
+ }
102
105
  });
103
106
  }
104
107
  /**
105
108
  * Get Spin Wheel
106
109
  *
107
110
  */
108
- getSpinWheel() {
111
+ getSpinWheel(amount) {
109
112
  return __awaiter(this, void 0, void 0, function* () {
110
113
  const [wheel] = yield this.program.account.wheel.all();
111
- const randomNumber = Math.floor(Math.random() * 1000000) + 1;
112
- const prize = wheel.account.prizes.find((p) => randomNumber >= p.rangeMin.toNumber() &&
113
- randomNumber <= p.rangeMax.toNumber() &&
114
- p.status.claimed);
115
- if (!prize) {
116
- 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
+ return 999;
122
+ }
123
+ prizes.push(prize.prize);
117
124
  }
118
- return prize.prize;
125
+ return prizes;
119
126
  });
120
127
  }
121
128
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.6.4-beta",
3
+ "version": "1.6.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",