@triadxyz/poseidons-protocol 0.3.3 → 0.3.5
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
CHANGED
|
@@ -53,11 +53,13 @@ export default class Wheel {
|
|
|
53
53
|
* @param spins - The number of spins
|
|
54
54
|
* @returns The transaction signature or versioned transaction
|
|
55
55
|
*/
|
|
56
|
-
spinWheel({ user, id, spins }: {
|
|
56
|
+
spinWheel({ user, id, spins, refer, newUser }: {
|
|
57
57
|
user: PublicKey;
|
|
58
58
|
id: number;
|
|
59
59
|
spins: number;
|
|
60
|
-
|
|
60
|
+
refer: PublicKey;
|
|
61
|
+
newUser: boolean;
|
|
62
|
+
}): Promise<{
|
|
61
63
|
transaction: string;
|
|
62
64
|
prize: number[];
|
|
63
65
|
}>;
|
package/dist/game/wheel.js
CHANGED
|
@@ -102,12 +102,20 @@ class Wheel {
|
|
|
102
102
|
* @param spins - The number of spins
|
|
103
103
|
* @returns The transaction signature or versioned transaction
|
|
104
104
|
*/
|
|
105
|
-
spinWheel({ user, id, spins }) {
|
|
106
|
-
var _a, _b;
|
|
105
|
+
spinWheel({ user, id, spins, refer, newUser }) {
|
|
107
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
107
|
const userPDA = (0, pda_1.getUserPDA)(user);
|
|
109
108
|
const wheelPDA = (0, pda_1.getWheelPDA)(id);
|
|
110
109
|
const instructions = [];
|
|
110
|
+
if (newUser) {
|
|
111
|
+
instructions.push(yield this.program.methods
|
|
112
|
+
.createUser(refer)
|
|
113
|
+
.accounts({
|
|
114
|
+
signer: this.program.provider.publicKey,
|
|
115
|
+
payer: this.rpcOptions.payer
|
|
116
|
+
})
|
|
117
|
+
.instruction());
|
|
118
|
+
}
|
|
111
119
|
for (let i = 0; i < spins; i++) {
|
|
112
120
|
instructions.push(yield this.program.methods
|
|
113
121
|
.spinWheel()
|
|
@@ -118,10 +126,6 @@ class Wheel {
|
|
|
118
126
|
})
|
|
119
127
|
.instruction());
|
|
120
128
|
}
|
|
121
|
-
if (this.program.provider.publicKey.toBase58() !==
|
|
122
|
-
((_b = (_a = this.rpcOptions) === null || _a === void 0 ? void 0 : _a.payer) === null || _b === void 0 ? void 0 : _b.toBase58())) {
|
|
123
|
-
return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
|
|
124
|
-
}
|
|
125
129
|
const transaction = (yield (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions));
|
|
126
130
|
const { blockhash, lastValidBlockHeight } = yield this.program.provider.connection.getLatestBlockhash();
|
|
127
131
|
yield this.program.provider.connection.confirmTransaction({
|
|
@@ -678,8 +678,7 @@
|
|
|
678
678
|
"accounts": [
|
|
679
679
|
{
|
|
680
680
|
"name": "signer",
|
|
681
|
-
"writable": true
|
|
682
|
-
"signer": true
|
|
681
|
+
"writable": true
|
|
683
682
|
},
|
|
684
683
|
{
|
|
685
684
|
"name": "payer",
|
|
@@ -1795,7 +1794,7 @@
|
|
|
1795
1794
|
"kind": "struct",
|
|
1796
1795
|
"fields": [
|
|
1797
1796
|
{
|
|
1798
|
-
"name": "
|
|
1797
|
+
"name": "authority",
|
|
1799
1798
|
"type": "pubkey"
|
|
1800
1799
|
},
|
|
1801
1800
|
{
|
|
@@ -912,7 +912,6 @@ export type PoseidonsProtocol = {
|
|
|
912
912
|
{
|
|
913
913
|
name: 'signer';
|
|
914
914
|
writable: true;
|
|
915
|
-
signer: true;
|
|
916
915
|
},
|
|
917
916
|
{
|
|
918
917
|
name: 'payer';
|
|
@@ -2086,7 +2085,7 @@ export type PoseidonsProtocol = {
|
|
|
2086
2085
|
kind: 'struct';
|
|
2087
2086
|
fields: [
|
|
2088
2087
|
{
|
|
2089
|
-
name: '
|
|
2088
|
+
name: 'authority';
|
|
2090
2089
|
type: 'pubkey';
|
|
2091
2090
|
},
|
|
2092
2091
|
{
|