@triadxyz/poseidons-protocol 0.3.0 → 0.3.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.
@@ -37,10 +37,9 @@ export default class Chest {
37
37
  * @param refer - The refer of the user
38
38
  * @returns The transaction signature or versioned transaction
39
39
  */
40
- placeChestBid({ id, coins, refer }: {
40
+ placeChestBid({ id, coins }: {
41
41
  id: number;
42
42
  coins: number;
43
- refer: PublicKey;
44
43
  }): Promise<string | import("@solana/web3.js").VersionedTransaction>;
45
44
  /**
46
45
  * Add chest winners
@@ -74,7 +74,7 @@ class Chest {
74
74
  * @param refer - The refer of the user
75
75
  * @returns The transaction signature or versioned transaction
76
76
  */
77
- placeChestBid({ id, coins, refer }) {
77
+ placeChestBid({ id, coins }) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
79
  const instructions = [
80
80
  yield this.program.methods
@@ -84,7 +84,6 @@ class Chest {
84
84
  })
85
85
  .accounts({
86
86
  signer: this.program.provider.publicKey,
87
- refer: (0, pda_1.getUserPDA)(refer),
88
87
  user: (0, pda_1.getUserPDA)(this.program.provider.publicKey)
89
88
  })
90
89
  .instruction()
@@ -61,4 +61,10 @@ export default class Wheel {
61
61
  transaction: string;
62
62
  prize: number[];
63
63
  }>;
64
+ /**
65
+ * Close a wheel
66
+ * @param id - The id of the wheel
67
+ * @returns The transaction signature or versioned transaction
68
+ */
69
+ closeWheel(id: number): Promise<string | import("@solana/web3.js").VersionedTransaction>;
64
70
  }
@@ -106,19 +106,20 @@ class Wheel {
106
106
  var _a, _b;
107
107
  return __awaiter(this, void 0, void 0, function* () {
108
108
  const userPDA = (0, pda_1.getUserPDA)(user);
109
+ const wheelPDA = (0, pda_1.getWheelPDA)(id);
109
110
  const instructions = [];
110
111
  for (let i = 0; i < spins; i++) {
111
112
  instructions.push(yield this.program.methods
112
- .spinWheel(id)
113
+ .spinWheel()
113
114
  .accounts({
114
115
  signer: this.program.provider.publicKey,
115
- user: userPDA
116
+ user: userPDA,
117
+ wheel: wheelPDA
116
118
  })
117
119
  .instruction());
118
120
  }
119
121
  if (this.program.provider.publicKey.toBase58() !==
120
122
  ((_b = (_a = this.rpcOptions) === null || _a === void 0 ? void 0 : _a.payer) === null || _b === void 0 ? void 0 : _b.toBase58())) {
121
- console.log('sendVersionedTransaction');
122
123
  return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
123
124
  }
124
125
  const transaction = (yield (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions));
@@ -134,5 +135,25 @@ class Wheel {
134
135
  };
135
136
  });
136
137
  }
138
+ /**
139
+ * Close a wheel
140
+ * @param id - The id of the wheel
141
+ * @returns The transaction signature or versioned transaction
142
+ */
143
+ closeWheel(id) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const wheelPDA = (0, pda_1.getWheelPDA)(id);
146
+ const instructions = [
147
+ yield this.program.methods
148
+ .closeWheel()
149
+ .accounts({
150
+ signer: this.program.provider.publicKey,
151
+ wheel: wheelPDA
152
+ })
153
+ .instruction()
154
+ ];
155
+ return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
156
+ });
157
+ }
137
158
  }
138
159
  exports.default = Wheel;
@@ -553,31 +553,14 @@
553
553
  },
554
554
  {
555
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
- }
556
+ "writable": true
569
557
  },
570
558
  {
571
559
  "name": "system_program",
572
560
  "address": "11111111111111111111111111111111"
573
561
  }
574
562
  ],
575
- "args": [
576
- {
577
- "name": "id",
578
- "type": "u8"
579
- }
580
- ]
563
+ "args": []
581
564
  },
582
565
  {
583
566
  "name": "create_chest",
@@ -813,7 +796,20 @@
813
796
  },
814
797
  {
815
798
  "name": "refer",
816
- "writable": true
799
+ "writable": true,
800
+ "pda": {
801
+ "seeds": [
802
+ {
803
+ "kind": "const",
804
+ "value": [117, 115, 101, 114]
805
+ },
806
+ {
807
+ "kind": "account",
808
+ "path": "refer.authority",
809
+ "account": "User"
810
+ }
811
+ ]
812
+ }
817
813
  },
818
814
  {
819
815
  "name": "mint",
@@ -900,6 +896,38 @@
900
896
  }
901
897
  ]
902
898
  },
899
+ {
900
+ "name": "send_core_nft",
901
+ "discriminator": [126, 77, 224, 79, 238, 78, 141, 32],
902
+ "accounts": [
903
+ {
904
+ "name": "signer",
905
+ "writable": true,
906
+ "signer": true
907
+ },
908
+ {
909
+ "name": "system_program",
910
+ "address": "11111111111111111111111111111111"
911
+ }
912
+ ],
913
+ "args": []
914
+ },
915
+ {
916
+ "name": "send_token",
917
+ "discriminator": [157, 183, 177, 53, 196, 251, 54, 185],
918
+ "accounts": [
919
+ {
920
+ "name": "signer",
921
+ "writable": true,
922
+ "signer": true
923
+ },
924
+ {
925
+ "name": "system_program",
926
+ "address": "11111111111111111111111111111111"
927
+ }
928
+ ],
929
+ "args": []
930
+ },
903
931
  {
904
932
  "name": "spin_wheel",
905
933
  "discriminator": [25, 214, 214, 83, 131, 150, 190, 91],
@@ -911,19 +939,7 @@
911
939
  },
912
940
  {
913
941
  "name": "wheel",
914
- "writable": true,
915
- "pda": {
916
- "seeds": [
917
- {
918
- "kind": "const",
919
- "value": [119, 104, 101, 101, 108]
920
- },
921
- {
922
- "kind": "arg",
923
- "path": "id"
924
- }
925
- ]
926
- }
942
+ "writable": true
927
943
  },
928
944
  {
929
945
  "name": "user",
@@ -934,12 +950,7 @@
934
950
  "address": "11111111111111111111111111111111"
935
951
  }
936
952
  ],
937
- "args": [
938
- {
939
- "name": "id",
940
- "type": "u8"
941
- }
942
- ],
953
+ "args": [],
943
954
  "returns": "u8"
944
955
  }
945
956
  ],
@@ -1060,6 +1071,11 @@
1060
1071
  "code": 6008,
1061
1072
  "name": "WheelIsNotActive",
1062
1073
  "msg": "Wheel is not active"
1074
+ },
1075
+ {
1076
+ "code": 6009,
1077
+ "name": "NotAuthorized",
1078
+ "msg": "Not authorized"
1063
1079
  }
1064
1080
  ],
1065
1081
  "types": [
@@ -729,30 +729,13 @@ export type PoseidonsProtocol = {
729
729
  {
730
730
  name: 'wheel';
731
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
732
  },
745
733
  {
746
734
  name: 'systemProgram';
747
735
  address: '11111111111111111111111111111111';
748
736
  }
749
737
  ];
750
- args: [
751
- {
752
- name: 'id';
753
- type: 'u8';
754
- }
755
- ];
738
+ args: [];
756
739
  },
757
740
  {
758
741
  name: 'createChest';
@@ -1047,6 +1030,19 @@ export type PoseidonsProtocol = {
1047
1030
  {
1048
1031
  name: 'refer';
1049
1032
  writable: true;
1033
+ pda: {
1034
+ seeds: [
1035
+ {
1036
+ kind: 'const';
1037
+ value: [117, 115, 101, 114];
1038
+ },
1039
+ {
1040
+ kind: 'account';
1041
+ path: 'refer.authority';
1042
+ account: 'user';
1043
+ }
1044
+ ];
1045
+ };
1050
1046
  },
1051
1047
  {
1052
1048
  name: 'mint';
@@ -1191,6 +1187,38 @@ export type PoseidonsProtocol = {
1191
1187
  }
1192
1188
  ];
1193
1189
  },
1190
+ {
1191
+ name: 'sendCoreNft';
1192
+ discriminator: [126, 77, 224, 79, 238, 78, 141, 32];
1193
+ accounts: [
1194
+ {
1195
+ name: 'signer';
1196
+ writable: true;
1197
+ signer: true;
1198
+ },
1199
+ {
1200
+ name: 'systemProgram';
1201
+ address: '11111111111111111111111111111111';
1202
+ }
1203
+ ];
1204
+ args: [];
1205
+ },
1206
+ {
1207
+ name: 'sendToken';
1208
+ discriminator: [157, 183, 177, 53, 196, 251, 54, 185];
1209
+ accounts: [
1210
+ {
1211
+ name: 'signer';
1212
+ writable: true;
1213
+ signer: true;
1214
+ },
1215
+ {
1216
+ name: 'systemProgram';
1217
+ address: '11111111111111111111111111111111';
1218
+ }
1219
+ ];
1220
+ args: [];
1221
+ },
1194
1222
  {
1195
1223
  name: 'spinWheel';
1196
1224
  discriminator: [25, 214, 214, 83, 131, 150, 190, 91];
@@ -1203,18 +1231,6 @@ export type PoseidonsProtocol = {
1203
1231
  {
1204
1232
  name: 'wheel';
1205
1233
  writable: true;
1206
- pda: {
1207
- seeds: [
1208
- {
1209
- kind: 'const';
1210
- value: [119, 104, 101, 101, 108];
1211
- },
1212
- {
1213
- kind: 'arg';
1214
- path: 'id';
1215
- }
1216
- ];
1217
- };
1218
1234
  },
1219
1235
  {
1220
1236
  name: 'user';
@@ -1225,12 +1241,7 @@ export type PoseidonsProtocol = {
1225
1241
  address: '11111111111111111111111111111111';
1226
1242
  }
1227
1243
  ];
1228
- args: [
1229
- {
1230
- name: 'id';
1231
- type: 'u8';
1232
- }
1233
- ];
1244
+ args: [];
1234
1245
  returns: 'u8';
1235
1246
  }
1236
1247
  ];
@@ -1351,6 +1362,11 @@ export type PoseidonsProtocol = {
1351
1362
  code: 6008;
1352
1363
  name: 'wheelIsNotActive';
1353
1364
  msg: 'Wheel is not active';
1365
+ },
1366
+ {
1367
+ code: 6009;
1368
+ name: 'notAuthorized';
1369
+ msg: 'Not authorized';
1354
1370
  }
1355
1371
  ];
1356
1372
  types: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/poseidons-protocol",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",