@triadxyz/poseidons-protocol 0.5.3 → 0.5.4
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.
- package/dist/game/wheel.d.ts +2 -1
- package/dist/game/wheel.js +17 -5
- package/package.json +1 -1
package/dist/game/wheel.d.ts
CHANGED
|
@@ -78,9 +78,10 @@ export default class Wheel {
|
|
|
78
78
|
* @param isUsdc - Whether to use USDC or SOL
|
|
79
79
|
* @returns The transaction signature or versioned transaction
|
|
80
80
|
*/
|
|
81
|
-
addWheelTicket({ wheelId, tickets, isUsdc }: {
|
|
81
|
+
addWheelTicket({ wheelId, tickets, isUsdc, refer }: {
|
|
82
82
|
wheelId: number;
|
|
83
83
|
tickets: number;
|
|
84
84
|
isUsdc: boolean;
|
|
85
|
+
refer: PublicKey;
|
|
85
86
|
}): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
86
87
|
}
|
package/dist/game/wheel.js
CHANGED
|
@@ -165,10 +165,22 @@ class Wheel {
|
|
|
165
165
|
* @param isUsdc - Whether to use USDC or SOL
|
|
166
166
|
* @returns The transaction signature or versioned transaction
|
|
167
167
|
*/
|
|
168
|
-
addWheelTicket({ wheelId, tickets, isUsdc }) {
|
|
168
|
+
addWheelTicket({ wheelId, tickets, isUsdc, refer }) {
|
|
169
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
const ixs = [
|
|
171
|
-
|
|
170
|
+
const ixs = [];
|
|
171
|
+
const userPDA = (0, pda_1.getUserPDA)(this.program.provider.publicKey);
|
|
172
|
+
try {
|
|
173
|
+
yield this.program.account.user.fetch(userPDA, this.rpcOptions.commitment);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
ixs.push(yield this.program.methods
|
|
177
|
+
.createUser(refer)
|
|
178
|
+
.accounts({
|
|
179
|
+
signer: this.program.provider.publicKey,
|
|
180
|
+
payer: this.rpcOptions.payer
|
|
181
|
+
})
|
|
182
|
+
.instruction());
|
|
183
|
+
ixs.push(yield this.program.methods
|
|
172
184
|
.addWheelTicket({
|
|
173
185
|
tickets: new anchor_1.BN(tickets),
|
|
174
186
|
isUsdc
|
|
@@ -178,8 +190,8 @@ class Wheel {
|
|
|
178
190
|
user: (0, pda_1.getUserPDA)(this.program.provider.publicKey),
|
|
179
191
|
wheel: (0, pda_1.getWheelPDA)(wheelId)
|
|
180
192
|
})
|
|
181
|
-
.instruction()
|
|
182
|
-
|
|
193
|
+
.instruction());
|
|
194
|
+
}
|
|
183
195
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
|
|
184
196
|
});
|
|
185
197
|
}
|