@triadxyz/poseidons-protocol 0.2.9 → 0.3.0

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.
@@ -118,10 +118,20 @@ class Wheel {
118
118
  }
119
119
  if (this.program.provider.publicKey.toBase58() !==
120
120
  ((_b = (_a = this.rpcOptions) === null || _a === void 0 ? void 0 : _a.payer) === null || _b === void 0 ? void 0 : _b.toBase58())) {
121
+ console.log('sendVersionedTransaction');
121
122
  return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
122
123
  }
123
124
  const transaction = (yield (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions));
124
- return { transaction, prize: yield (0, helpers_1.getPrize)(this.program, transaction) };
125
+ const { blockhash, lastValidBlockHeight } = yield this.program.provider.connection.getLatestBlockhash();
126
+ yield this.program.provider.connection.confirmTransaction({
127
+ signature: transaction,
128
+ blockhash,
129
+ lastValidBlockHeight
130
+ }, 'finalized');
131
+ return {
132
+ transaction,
133
+ prize: yield (0, helpers_1.getPrize)(this.program, transaction)
134
+ };
125
135
  });
126
136
  }
127
137
  }
@@ -542,6 +542,43 @@
542
542
  ],
543
543
  "args": []
544
544
  },
545
+ {
546
+ "name": "close_wheel",
547
+ "discriminator": [75, 225, 55, 245, 208, 36, 25, 90],
548
+ "accounts": [
549
+ {
550
+ "name": "signer",
551
+ "writable": true,
552
+ "signer": true
553
+ },
554
+ {
555
+ "name": "wheel",
556
+ "writable": true,
557
+ "pda": {
558
+ "seeds": [
559
+ {
560
+ "kind": "const",
561
+ "value": [119, 104, 101, 101, 108]
562
+ },
563
+ {
564
+ "kind": "arg",
565
+ "path": "id"
566
+ }
567
+ ]
568
+ }
569
+ },
570
+ {
571
+ "name": "system_program",
572
+ "address": "11111111111111111111111111111111"
573
+ }
574
+ ],
575
+ "args": [
576
+ {
577
+ "name": "id",
578
+ "type": "u8"
579
+ }
580
+ ]
581
+ },
545
582
  {
546
583
  "name": "create_chest",
547
584
  "discriminator": [146, 35, 76, 242, 243, 197, 90, 0],
@@ -1018,6 +1055,11 @@
1018
1055
  "code": 6007,
1019
1056
  "name": "InsufficientSpins",
1020
1057
  "msg": "Insufficient spins"
1058
+ },
1059
+ {
1060
+ "code": 6008,
1061
+ "name": "WheelIsNotActive",
1062
+ "msg": "Wheel is not active"
1021
1063
  }
1022
1064
  ],
1023
1065
  "types": [
@@ -717,6 +717,43 @@ export type PoseidonsProtocol = {
717
717
  ];
718
718
  args: [];
719
719
  },
720
+ {
721
+ name: 'closeWheel';
722
+ discriminator: [75, 225, 55, 245, 208, 36, 25, 90];
723
+ accounts: [
724
+ {
725
+ name: 'signer';
726
+ writable: true;
727
+ signer: true;
728
+ },
729
+ {
730
+ name: 'wheel';
731
+ writable: true;
732
+ pda: {
733
+ seeds: [
734
+ {
735
+ kind: 'const';
736
+ value: [119, 104, 101, 101, 108];
737
+ },
738
+ {
739
+ kind: 'arg';
740
+ path: 'id';
741
+ }
742
+ ];
743
+ };
744
+ },
745
+ {
746
+ name: 'systemProgram';
747
+ address: '11111111111111111111111111111111';
748
+ }
749
+ ];
750
+ args: [
751
+ {
752
+ name: 'id';
753
+ type: 'u8';
754
+ }
755
+ ];
756
+ },
720
757
  {
721
758
  name: 'createChest';
722
759
  discriminator: [146, 35, 76, 242, 243, 197, 90, 0];
@@ -1309,6 +1346,11 @@ export type PoseidonsProtocol = {
1309
1346
  code: 6007;
1310
1347
  name: 'insufficientSpins';
1311
1348
  msg: 'Insufficient spins';
1349
+ },
1350
+ {
1351
+ code: 6008;
1352
+ name: 'wheelIsNotActive';
1353
+ msg: 'Wheel is not active';
1312
1354
  }
1313
1355
  ];
1314
1356
  types: [
@@ -92,13 +92,15 @@ exports.formatWheel = formatWheel;
92
92
  const getPrize = (program, transaction) => __awaiter(void 0, void 0, void 0, function* () {
93
93
  var _a, _b;
94
94
  const prize = [];
95
- const tx = yield program.provider.connection.getParsedTransaction(transaction);
95
+ const tx = yield program.provider.connection.getParsedTransaction(transaction, {
96
+ maxSupportedTransactionVersion: 0
97
+ });
96
98
  if ((_a = tx === null || tx === void 0 ? void 0 : tx.meta) === null || _a === void 0 ? void 0 : _a.logMessages) {
97
99
  const eventParser = new anchor_1.EventParser(program.programId, new anchor_1.BorshCoder(program.idl));
98
100
  const events = eventParser.parseLogs((_b = tx === null || tx === void 0 ? void 0 : tx.meta) === null || _b === void 0 ? void 0 : _b.logMessages);
99
101
  for (let event of events) {
100
102
  switch (event.name) {
101
- case 'SpinWheelEvent':
103
+ case 'spinWheelEvent':
102
104
  prize.push(event.data.prizeId);
103
105
  break;
104
106
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/poseidons-protocol",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",