@triadxyz/poseidons-protocol 0.2.1 → 0.2.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.
- package/dist/game/index.d.ts +14 -0
- package/dist/game/index.js +35 -0
- package/dist/game/wheel.d.ts +61 -0
- package/dist/game/wheel.js +122 -0
- package/dist/types/idl_poseidons_protocol.json +345 -1
- package/dist/types/index.d.ts +15 -0
- package/dist/types/poseidons_protocol.d.ts +345 -1
- package/dist/utils/helpers.d.ts +2 -1
- package/dist/utils/helpers.js +18 -1
- package/dist/utils/pda.d.ts +1 -0
- package/dist/utils/pda.js +5 -1
- package/package.json +1 -1
package/dist/game/index.d.ts
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
|
+
/// <reference types="@coral-xyz/anchor/node_modules/@solana/web3.js" />
|
|
1
2
|
import { Program } from '@coral-xyz/anchor';
|
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
4
|
import { PoseidonsProtocol } from './../types/poseidons_protocol';
|
|
3
5
|
import { RpcOptions } from './../types';
|
|
4
6
|
import Chest from './chest';
|
|
7
|
+
import Wheel from './wheel';
|
|
5
8
|
export default class Game {
|
|
6
9
|
private program;
|
|
7
10
|
private rpcOptions;
|
|
8
11
|
chest: Chest;
|
|
12
|
+
wheel: Wheel;
|
|
9
13
|
constructor(program: Program<PoseidonsProtocol>, rpcOptions: RpcOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Add spins to a user
|
|
16
|
+
* @param user - The user to add spins to
|
|
17
|
+
* @param spins - The number of spins to add
|
|
18
|
+
* @returns The transaction signature or versioned transaction
|
|
19
|
+
*/
|
|
20
|
+
addSpin({ user, spins }: {
|
|
21
|
+
user: PublicKey;
|
|
22
|
+
spins: number;
|
|
23
|
+
}): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
10
24
|
}
|
package/dist/game/index.js
CHANGED
|
@@ -1,14 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
16
|
const chest_1 = __importDefault(require("./chest"));
|
|
17
|
+
const wheel_1 = __importDefault(require("./wheel"));
|
|
18
|
+
const sendVersionedTransaction_1 = __importDefault(require("../utils/sendVersionedTransaction"));
|
|
19
|
+
const pda_1 = require("../utils/pda");
|
|
7
20
|
class Game {
|
|
8
21
|
constructor(program, rpcOptions) {
|
|
9
22
|
this.program = program;
|
|
10
23
|
this.rpcOptions = rpcOptions;
|
|
11
24
|
this.chest = new chest_1.default(this.program, this.rpcOptions);
|
|
25
|
+
this.wheel = new wheel_1.default(this.program, this.rpcOptions);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add spins to a user
|
|
29
|
+
* @param user - The user to add spins to
|
|
30
|
+
* @param spins - The number of spins to add
|
|
31
|
+
* @returns The transaction signature or versioned transaction
|
|
32
|
+
*/
|
|
33
|
+
addSpin({ user, spins }) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const userPDA = (0, pda_1.getUserPDA)(user);
|
|
36
|
+
const instructions = [
|
|
37
|
+
yield this.program.methods
|
|
38
|
+
.addSpin(new anchor_1.BN(spins))
|
|
39
|
+
.accounts({
|
|
40
|
+
signer: this.program.provider.publicKey,
|
|
41
|
+
user: userPDA
|
|
42
|
+
})
|
|
43
|
+
.instruction()
|
|
44
|
+
];
|
|
45
|
+
return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
|
|
46
|
+
});
|
|
12
47
|
}
|
|
13
48
|
}
|
|
14
49
|
exports.default = Game;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="@coral-xyz/anchor/node_modules/@solana/web3.js" />
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import { Program } from '@coral-xyz/anchor';
|
|
4
|
+
import { PoseidonsProtocol } from './../types/poseidons_protocol';
|
|
5
|
+
import { RpcOptions } from './../types';
|
|
6
|
+
export default class Wheel {
|
|
7
|
+
private program;
|
|
8
|
+
private rpcOptions;
|
|
9
|
+
constructor(program: Program<PoseidonsProtocol>, rpcOptions: RpcOptions);
|
|
10
|
+
/**
|
|
11
|
+
* Get all wheels
|
|
12
|
+
* @returns The chests
|
|
13
|
+
*/
|
|
14
|
+
getAllWheel(): Promise<import("./../types").Wheel[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a wheel
|
|
17
|
+
* @param id - The id of the wheel
|
|
18
|
+
* @returns The wheel
|
|
19
|
+
*/
|
|
20
|
+
getWheel(id: number): Promise<import("./../types").Wheel>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a wheel
|
|
23
|
+
* @param id - The id of the wheel
|
|
24
|
+
* @param name - The name of the wheel
|
|
25
|
+
* @param prizes - The prizes of the wheel
|
|
26
|
+
* @returns The transaction signature or versioned transaction
|
|
27
|
+
*/
|
|
28
|
+
createWheel({ id, name, prizes }: {
|
|
29
|
+
id: number;
|
|
30
|
+
name: string;
|
|
31
|
+
prizes: {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
available: number;
|
|
35
|
+
rangeMin: number;
|
|
36
|
+
rangeMax: number;
|
|
37
|
+
unit: number;
|
|
38
|
+
}[];
|
|
39
|
+
}): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
40
|
+
/**
|
|
41
|
+
* Add a prize to a wheel
|
|
42
|
+
* @param id - The id of the chest
|
|
43
|
+
* @param available - The available quantity of the prize
|
|
44
|
+
* @returns The transaction signature or versioned transaction
|
|
45
|
+
*/
|
|
46
|
+
addWheelPrize({ id, available }: {
|
|
47
|
+
id: number;
|
|
48
|
+
available: number;
|
|
49
|
+
}): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
50
|
+
/**
|
|
51
|
+
* Spin a wheel
|
|
52
|
+
* @param id - The id of the wheel
|
|
53
|
+
* @param spins - The number of spins
|
|
54
|
+
* @returns The transaction signature or versioned transaction
|
|
55
|
+
*/
|
|
56
|
+
spinWheel({ user, id, spins }: {
|
|
57
|
+
user: PublicKey;
|
|
58
|
+
id: number;
|
|
59
|
+
spins: number;
|
|
60
|
+
}): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
16
|
+
const sendVersionedTransaction_1 = __importDefault(require("./../utils/sendVersionedTransaction"));
|
|
17
|
+
const pda_1 = require("./../utils/pda");
|
|
18
|
+
const helpers_1 = require("./../utils/helpers");
|
|
19
|
+
class Wheel {
|
|
20
|
+
constructor(program, rpcOptions) {
|
|
21
|
+
this.program = program;
|
|
22
|
+
this.rpcOptions = rpcOptions;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get all wheels
|
|
26
|
+
* @returns The chests
|
|
27
|
+
*/
|
|
28
|
+
getAllWheel() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const wheels = yield this.program.account.wheel.all();
|
|
31
|
+
return wheels.map((wheel) => (0, helpers_1.formatWheel)(wheel.account, wheel.publicKey));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get a wheel
|
|
36
|
+
* @param id - The id of the wheel
|
|
37
|
+
* @returns The wheel
|
|
38
|
+
*/
|
|
39
|
+
getWheel(id) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const wheelPDA = (0, pda_1.getWheelPDA)(id);
|
|
42
|
+
const wheel = yield this.program.account.wheel.fetch(wheelPDA, this.rpcOptions.commitment);
|
|
43
|
+
return (0, helpers_1.formatWheel)(wheel, wheelPDA);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a wheel
|
|
48
|
+
* @param id - The id of the wheel
|
|
49
|
+
* @param name - The name of the wheel
|
|
50
|
+
* @param prizes - The prizes of the wheel
|
|
51
|
+
* @returns The transaction signature or versioned transaction
|
|
52
|
+
*/
|
|
53
|
+
createWheel({ id, name, prizes }) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const instructions = [
|
|
56
|
+
yield this.program.methods
|
|
57
|
+
.createWheel({
|
|
58
|
+
id,
|
|
59
|
+
name,
|
|
60
|
+
prizes: prizes.map((prize) => ({
|
|
61
|
+
id: prize.id,
|
|
62
|
+
name: prize.name,
|
|
63
|
+
available: new anchor_1.BN(prize.available),
|
|
64
|
+
rangeMin: new anchor_1.BN(prize.rangeMin),
|
|
65
|
+
rangeMax: new anchor_1.BN(prize.rangeMax),
|
|
66
|
+
unit: new anchor_1.BN(prize.unit)
|
|
67
|
+
}))
|
|
68
|
+
})
|
|
69
|
+
.accounts({
|
|
70
|
+
signer: this.program.provider.publicKey
|
|
71
|
+
})
|
|
72
|
+
.instruction()
|
|
73
|
+
];
|
|
74
|
+
return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Add a prize to a wheel
|
|
79
|
+
* @param id - The id of the chest
|
|
80
|
+
* @param available - The available quantity of the prize
|
|
81
|
+
* @returns The transaction signature or versioned transaction
|
|
82
|
+
*/
|
|
83
|
+
addWheelPrize({ id, available }) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const instructions = [
|
|
86
|
+
yield this.program.methods
|
|
87
|
+
.addWheelPrize({
|
|
88
|
+
id,
|
|
89
|
+
available: new anchor_1.BN(available)
|
|
90
|
+
})
|
|
91
|
+
.accounts({
|
|
92
|
+
signer: this.program.provider.publicKey
|
|
93
|
+
})
|
|
94
|
+
.instruction()
|
|
95
|
+
];
|
|
96
|
+
return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Spin a wheel
|
|
101
|
+
* @param id - The id of the wheel
|
|
102
|
+
* @param spins - The number of spins
|
|
103
|
+
* @returns The transaction signature or versioned transaction
|
|
104
|
+
*/
|
|
105
|
+
spinWheel({ user, id, spins }) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const userPDA = (0, pda_1.getUserPDA)(user);
|
|
108
|
+
const instructions = [];
|
|
109
|
+
for (let i = 0; i < spins; i++) {
|
|
110
|
+
instructions.push(yield this.program.methods
|
|
111
|
+
.spinWheel(id)
|
|
112
|
+
.accounts({
|
|
113
|
+
signer: this.program.provider.publicKey,
|
|
114
|
+
user: userPDA
|
|
115
|
+
})
|
|
116
|
+
.instruction());
|
|
117
|
+
}
|
|
118
|
+
return (0, sendVersionedTransaction_1.default)(this.program, instructions, this.rpcOptions);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.default = Wheel;
|
|
@@ -272,6 +272,77 @@
|
|
|
272
272
|
}
|
|
273
273
|
]
|
|
274
274
|
},
|
|
275
|
+
{
|
|
276
|
+
"name": "add_spin",
|
|
277
|
+
"discriminator": [168, 78, 42, 73, 116, 58, 113, 193],
|
|
278
|
+
"accounts": [
|
|
279
|
+
{
|
|
280
|
+
"name": "signer",
|
|
281
|
+
"writable": true,
|
|
282
|
+
"signer": true
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"name": "squads",
|
|
286
|
+
"writable": true,
|
|
287
|
+
"address": "Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "user",
|
|
291
|
+
"writable": true
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "system_program",
|
|
295
|
+
"address": "11111111111111111111111111111111"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"args": [
|
|
299
|
+
{
|
|
300
|
+
"name": "spins",
|
|
301
|
+
"type": "u64"
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"name": "add_wheel_prize",
|
|
307
|
+
"discriminator": [171, 239, 227, 40, 5, 150, 213, 239],
|
|
308
|
+
"accounts": [
|
|
309
|
+
{
|
|
310
|
+
"name": "signer",
|
|
311
|
+
"writable": true,
|
|
312
|
+
"signer": true
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "wheel",
|
|
316
|
+
"writable": true,
|
|
317
|
+
"pda": {
|
|
318
|
+
"seeds": [
|
|
319
|
+
{
|
|
320
|
+
"kind": "const",
|
|
321
|
+
"value": [119, 104, 101, 108, 108]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"kind": "arg",
|
|
325
|
+
"path": "args.id"
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"name": "system_program",
|
|
332
|
+
"address": "11111111111111111111111111111111"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"args": [
|
|
336
|
+
{
|
|
337
|
+
"name": "args",
|
|
338
|
+
"type": {
|
|
339
|
+
"defined": {
|
|
340
|
+
"name": "AddWheelPrizeArgs"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
},
|
|
275
346
|
{
|
|
276
347
|
"name": "burn_nft",
|
|
277
348
|
"discriminator": [119, 13, 183, 17, 194, 243, 38, 31],
|
|
@@ -628,6 +699,47 @@
|
|
|
628
699
|
}
|
|
629
700
|
]
|
|
630
701
|
},
|
|
702
|
+
{
|
|
703
|
+
"name": "create_wheel",
|
|
704
|
+
"discriminator": [175, 177, 194, 49, 117, 130, 179, 161],
|
|
705
|
+
"accounts": [
|
|
706
|
+
{
|
|
707
|
+
"name": "signer",
|
|
708
|
+
"writable": true,
|
|
709
|
+
"signer": true
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"name": "wheel",
|
|
713
|
+
"writable": true,
|
|
714
|
+
"pda": {
|
|
715
|
+
"seeds": [
|
|
716
|
+
{
|
|
717
|
+
"kind": "const",
|
|
718
|
+
"value": [119, 104, 101, 108, 108]
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"kind": "arg",
|
|
722
|
+
"path": "args.id"
|
|
723
|
+
}
|
|
724
|
+
]
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"name": "system_program",
|
|
729
|
+
"address": "11111111111111111111111111111111"
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
"args": [
|
|
733
|
+
{
|
|
734
|
+
"name": "args",
|
|
735
|
+
"type": {
|
|
736
|
+
"defined": {
|
|
737
|
+
"name": "CreateWheelArgs"
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
]
|
|
742
|
+
},
|
|
631
743
|
{
|
|
632
744
|
"name": "place_chest_bid",
|
|
633
745
|
"discriminator": [82, 31, 146, 177, 220, 1, 7, 157],
|
|
@@ -750,6 +862,48 @@
|
|
|
750
862
|
}
|
|
751
863
|
}
|
|
752
864
|
]
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
"name": "spin_wheel",
|
|
868
|
+
"discriminator": [25, 214, 214, 83, 131, 150, 190, 91],
|
|
869
|
+
"accounts": [
|
|
870
|
+
{
|
|
871
|
+
"name": "signer",
|
|
872
|
+
"writable": true,
|
|
873
|
+
"signer": true
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"name": "wheel",
|
|
877
|
+
"writable": true,
|
|
878
|
+
"pda": {
|
|
879
|
+
"seeds": [
|
|
880
|
+
{
|
|
881
|
+
"kind": "const",
|
|
882
|
+
"value": [119, 104, 101, 108, 108]
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"kind": "arg",
|
|
886
|
+
"path": "id"
|
|
887
|
+
}
|
|
888
|
+
]
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"name": "user",
|
|
893
|
+
"writable": true
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"name": "system_program",
|
|
897
|
+
"address": "11111111111111111111111111111111"
|
|
898
|
+
}
|
|
899
|
+
],
|
|
900
|
+
"args": [
|
|
901
|
+
{
|
|
902
|
+
"name": "id",
|
|
903
|
+
"type": "u8"
|
|
904
|
+
}
|
|
905
|
+
],
|
|
906
|
+
"returns": "u8"
|
|
753
907
|
}
|
|
754
908
|
],
|
|
755
909
|
"accounts": [
|
|
@@ -776,6 +930,10 @@
|
|
|
776
930
|
{
|
|
777
931
|
"name": "User",
|
|
778
932
|
"discriminator": [159, 117, 95, 227, 239, 151, 58, 236]
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"name": "Wheel",
|
|
936
|
+
"discriminator": [196, 41, 11, 47, 123, 180, 10, 219]
|
|
779
937
|
}
|
|
780
938
|
],
|
|
781
939
|
"events": [
|
|
@@ -783,6 +941,10 @@
|
|
|
783
941
|
"name": "BidChestEvent",
|
|
784
942
|
"discriminator": [162, 64, 11, 176, 231, 173, 217, 89]
|
|
785
943
|
},
|
|
944
|
+
{
|
|
945
|
+
"name": "BuySpinEvent",
|
|
946
|
+
"discriminator": [253, 97, 83, 130, 75, 128, 156, 7]
|
|
947
|
+
},
|
|
786
948
|
{
|
|
787
949
|
"name": "ChestCreatedEvent",
|
|
788
950
|
"discriminator": [27, 178, 135, 161, 240, 189, 246, 238]
|
|
@@ -807,6 +969,10 @@
|
|
|
807
969
|
"name": "PoseidonRewardsEvent",
|
|
808
970
|
"discriminator": [93, 26, 205, 192, 107, 244, 92, 119]
|
|
809
971
|
},
|
|
972
|
+
{
|
|
973
|
+
"name": "SpinWheelEvent",
|
|
974
|
+
"discriminator": [136, 0, 170, 174, 167, 129, 91, 187]
|
|
975
|
+
},
|
|
810
976
|
{
|
|
811
977
|
"name": "UserCreatedEvent",
|
|
812
978
|
"discriminator": [41, 186, 252, 198, 103, 111, 139, 224]
|
|
@@ -842,6 +1008,16 @@
|
|
|
842
1008
|
"code": 6005,
|
|
843
1009
|
"name": "InvalidRefer",
|
|
844
1010
|
"msg": "Invalid refer"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
"code": 6006,
|
|
1014
|
+
"name": "InsufficientFunds",
|
|
1015
|
+
"msg": "Insufficient funds"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"code": 6007,
|
|
1019
|
+
"name": "InsufficientSpins",
|
|
1020
|
+
"msg": "Insufficient spins"
|
|
845
1021
|
}
|
|
846
1022
|
],
|
|
847
1023
|
"types": [
|
|
@@ -878,6 +1054,22 @@
|
|
|
878
1054
|
]
|
|
879
1055
|
}
|
|
880
1056
|
},
|
|
1057
|
+
{
|
|
1058
|
+
"name": "AddWheelPrizeArgs",
|
|
1059
|
+
"type": {
|
|
1060
|
+
"kind": "struct",
|
|
1061
|
+
"fields": [
|
|
1062
|
+
{
|
|
1063
|
+
"name": "id",
|
|
1064
|
+
"type": "u8"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
"name": "available",
|
|
1068
|
+
"type": "u64"
|
|
1069
|
+
}
|
|
1070
|
+
]
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
881
1073
|
{
|
|
882
1074
|
"name": "BaseAssetV1",
|
|
883
1075
|
"type": {
|
|
@@ -988,6 +1180,30 @@
|
|
|
988
1180
|
]
|
|
989
1181
|
}
|
|
990
1182
|
},
|
|
1183
|
+
{
|
|
1184
|
+
"name": "BuySpinEvent",
|
|
1185
|
+
"type": {
|
|
1186
|
+
"kind": "struct",
|
|
1187
|
+
"fields": [
|
|
1188
|
+
{
|
|
1189
|
+
"name": "user",
|
|
1190
|
+
"type": "pubkey"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
"name": "spins",
|
|
1194
|
+
"type": "u64"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
"name": "fee",
|
|
1198
|
+
"type": "u64"
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
"name": "timestamp",
|
|
1202
|
+
"type": "i64"
|
|
1203
|
+
}
|
|
1204
|
+
]
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
991
1207
|
{
|
|
992
1208
|
"name": "Chest",
|
|
993
1209
|
"type": {
|
|
@@ -1240,6 +1456,35 @@
|
|
|
1240
1456
|
]
|
|
1241
1457
|
}
|
|
1242
1458
|
},
|
|
1459
|
+
{
|
|
1460
|
+
"name": "CreateWheelArgs",
|
|
1461
|
+
"type": {
|
|
1462
|
+
"kind": "struct",
|
|
1463
|
+
"fields": [
|
|
1464
|
+
{
|
|
1465
|
+
"name": "id",
|
|
1466
|
+
"type": "u8"
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
"name": "name",
|
|
1470
|
+
"type": "string"
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
"name": "prizes",
|
|
1474
|
+
"type": {
|
|
1475
|
+
"array": [
|
|
1476
|
+
{
|
|
1477
|
+
"defined": {
|
|
1478
|
+
"name": "Prize"
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
12
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
]
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1243
1488
|
{
|
|
1244
1489
|
"name": "Key",
|
|
1245
1490
|
"type": {
|
|
@@ -1454,6 +1699,58 @@
|
|
|
1454
1699
|
]
|
|
1455
1700
|
}
|
|
1456
1701
|
},
|
|
1702
|
+
{
|
|
1703
|
+
"name": "Prize",
|
|
1704
|
+
"type": {
|
|
1705
|
+
"kind": "struct",
|
|
1706
|
+
"fields": [
|
|
1707
|
+
{
|
|
1708
|
+
"name": "id",
|
|
1709
|
+
"type": "u8"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"name": "name",
|
|
1713
|
+
"type": "string"
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
"name": "available",
|
|
1717
|
+
"type": "u64"
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
"name": "range_min",
|
|
1721
|
+
"type": "u64"
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
"name": "range_max",
|
|
1725
|
+
"type": "u64"
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
"name": "unit",
|
|
1729
|
+
"type": "u64"
|
|
1730
|
+
}
|
|
1731
|
+
]
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
"name": "SpinWheelEvent",
|
|
1736
|
+
"type": {
|
|
1737
|
+
"kind": "struct",
|
|
1738
|
+
"fields": [
|
|
1739
|
+
{
|
|
1740
|
+
"name": "user",
|
|
1741
|
+
"type": "pubkey"
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
"name": "prize_id",
|
|
1745
|
+
"type": "u8"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
"name": "timestamp",
|
|
1749
|
+
"type": "i64"
|
|
1750
|
+
}
|
|
1751
|
+
]
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1457
1754
|
{
|
|
1458
1755
|
"name": "UpdateAuthority",
|
|
1459
1756
|
"type": {
|
|
@@ -1498,10 +1795,14 @@
|
|
|
1498
1795
|
"name": "coins",
|
|
1499
1796
|
"type": "u64"
|
|
1500
1797
|
},
|
|
1798
|
+
{
|
|
1799
|
+
"name": "spins",
|
|
1800
|
+
"type": "u64"
|
|
1801
|
+
},
|
|
1501
1802
|
{
|
|
1502
1803
|
"name": "padding",
|
|
1503
1804
|
"type": {
|
|
1504
|
-
"array": ["u8",
|
|
1805
|
+
"array": ["u8", 48]
|
|
1505
1806
|
}
|
|
1506
1807
|
}
|
|
1507
1808
|
]
|
|
@@ -1530,6 +1831,49 @@
|
|
|
1530
1831
|
}
|
|
1531
1832
|
]
|
|
1532
1833
|
}
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
"name": "Wheel",
|
|
1837
|
+
"type": {
|
|
1838
|
+
"kind": "struct",
|
|
1839
|
+
"fields": [
|
|
1840
|
+
{
|
|
1841
|
+
"name": "bump",
|
|
1842
|
+
"type": "u8"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
"name": "id",
|
|
1846
|
+
"type": "u8"
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
"name": "name",
|
|
1850
|
+
"type": "string"
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
"name": "count",
|
|
1854
|
+
"type": "u64"
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
"name": "prizes",
|
|
1858
|
+
"type": {
|
|
1859
|
+
"array": [
|
|
1860
|
+
{
|
|
1861
|
+
"defined": {
|
|
1862
|
+
"name": "Prize"
|
|
1863
|
+
}
|
|
1864
|
+
},
|
|
1865
|
+
12
|
|
1866
|
+
]
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
"name": "padding",
|
|
1871
|
+
"type": {
|
|
1872
|
+
"array": ["u8", 32]
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
]
|
|
1876
|
+
}
|
|
1533
1877
|
}
|
|
1534
1878
|
]
|
|
1535
1879
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -51,3 +51,18 @@ export type Chest = {
|
|
|
51
51
|
createdAt: number;
|
|
52
52
|
finishedAt: number;
|
|
53
53
|
};
|
|
54
|
+
export type Wheel = {
|
|
55
|
+
address: string;
|
|
56
|
+
id: number;
|
|
57
|
+
name: string;
|
|
58
|
+
count: number;
|
|
59
|
+
prizes: Prize[];
|
|
60
|
+
};
|
|
61
|
+
export type Prize = {
|
|
62
|
+
id: number;
|
|
63
|
+
name: string;
|
|
64
|
+
available: number;
|
|
65
|
+
rangeMin: number;
|
|
66
|
+
rangeMax: number;
|
|
67
|
+
unit: number;
|
|
68
|
+
};
|
|
@@ -377,6 +377,77 @@ export type PoseidonsProtocol = {
|
|
|
377
377
|
}
|
|
378
378
|
];
|
|
379
379
|
},
|
|
380
|
+
{
|
|
381
|
+
name: 'addSpin';
|
|
382
|
+
discriminator: [168, 78, 42, 73, 116, 58, 113, 193];
|
|
383
|
+
accounts: [
|
|
384
|
+
{
|
|
385
|
+
name: 'signer';
|
|
386
|
+
writable: true;
|
|
387
|
+
signer: true;
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: 'squads';
|
|
391
|
+
writable: true;
|
|
392
|
+
address: 'Hk1r2NUL4LbUhx1agg1w44tyZiNr72mbeLsg6suF5MA4';
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: 'user';
|
|
396
|
+
writable: true;
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: 'systemProgram';
|
|
400
|
+
address: '11111111111111111111111111111111';
|
|
401
|
+
}
|
|
402
|
+
];
|
|
403
|
+
args: [
|
|
404
|
+
{
|
|
405
|
+
name: 'spins';
|
|
406
|
+
type: 'u64';
|
|
407
|
+
}
|
|
408
|
+
];
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: 'addWheelPrize';
|
|
412
|
+
discriminator: [171, 239, 227, 40, 5, 150, 213, 239];
|
|
413
|
+
accounts: [
|
|
414
|
+
{
|
|
415
|
+
name: 'signer';
|
|
416
|
+
writable: true;
|
|
417
|
+
signer: true;
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: 'wheel';
|
|
421
|
+
writable: true;
|
|
422
|
+
pda: {
|
|
423
|
+
seeds: [
|
|
424
|
+
{
|
|
425
|
+
kind: 'const';
|
|
426
|
+
value: [119, 104, 101, 108, 108];
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
kind: 'arg';
|
|
430
|
+
path: 'args.id';
|
|
431
|
+
}
|
|
432
|
+
];
|
|
433
|
+
};
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
name: 'systemProgram';
|
|
437
|
+
address: '11111111111111111111111111111111';
|
|
438
|
+
}
|
|
439
|
+
];
|
|
440
|
+
args: [
|
|
441
|
+
{
|
|
442
|
+
name: 'args';
|
|
443
|
+
type: {
|
|
444
|
+
defined: {
|
|
445
|
+
name: 'addWheelPrizeArgs';
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
];
|
|
450
|
+
},
|
|
380
451
|
{
|
|
381
452
|
name: 'burnNft';
|
|
382
453
|
discriminator: [119, 13, 183, 17, 194, 243, 38, 31];
|
|
@@ -861,6 +932,47 @@ export type PoseidonsProtocol = {
|
|
|
861
932
|
}
|
|
862
933
|
];
|
|
863
934
|
},
|
|
935
|
+
{
|
|
936
|
+
name: 'createWheel';
|
|
937
|
+
discriminator: [175, 177, 194, 49, 117, 130, 179, 161];
|
|
938
|
+
accounts: [
|
|
939
|
+
{
|
|
940
|
+
name: 'signer';
|
|
941
|
+
writable: true;
|
|
942
|
+
signer: true;
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
name: 'wheel';
|
|
946
|
+
writable: true;
|
|
947
|
+
pda: {
|
|
948
|
+
seeds: [
|
|
949
|
+
{
|
|
950
|
+
kind: 'const';
|
|
951
|
+
value: [119, 104, 101, 108, 108];
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
kind: 'arg';
|
|
955
|
+
path: 'args.id';
|
|
956
|
+
}
|
|
957
|
+
];
|
|
958
|
+
};
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
name: 'systemProgram';
|
|
962
|
+
address: '11111111111111111111111111111111';
|
|
963
|
+
}
|
|
964
|
+
];
|
|
965
|
+
args: [
|
|
966
|
+
{
|
|
967
|
+
name: 'args';
|
|
968
|
+
type: {
|
|
969
|
+
defined: {
|
|
970
|
+
name: 'createWheelArgs';
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
];
|
|
975
|
+
},
|
|
864
976
|
{
|
|
865
977
|
name: 'placeChestBid';
|
|
866
978
|
discriminator: [82, 31, 146, 177, 220, 1, 7, 157];
|
|
@@ -1041,6 +1153,48 @@ export type PoseidonsProtocol = {
|
|
|
1041
1153
|
};
|
|
1042
1154
|
}
|
|
1043
1155
|
];
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
name: 'spinWheel';
|
|
1159
|
+
discriminator: [25, 214, 214, 83, 131, 150, 190, 91];
|
|
1160
|
+
accounts: [
|
|
1161
|
+
{
|
|
1162
|
+
name: 'signer';
|
|
1163
|
+
writable: true;
|
|
1164
|
+
signer: true;
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
name: 'wheel';
|
|
1168
|
+
writable: true;
|
|
1169
|
+
pda: {
|
|
1170
|
+
seeds: [
|
|
1171
|
+
{
|
|
1172
|
+
kind: 'const';
|
|
1173
|
+
value: [119, 104, 101, 108, 108];
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
kind: 'arg';
|
|
1177
|
+
path: 'id';
|
|
1178
|
+
}
|
|
1179
|
+
];
|
|
1180
|
+
};
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
name: 'user';
|
|
1184
|
+
writable: true;
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
name: 'systemProgram';
|
|
1188
|
+
address: '11111111111111111111111111111111';
|
|
1189
|
+
}
|
|
1190
|
+
];
|
|
1191
|
+
args: [
|
|
1192
|
+
{
|
|
1193
|
+
name: 'id';
|
|
1194
|
+
type: 'u8';
|
|
1195
|
+
}
|
|
1196
|
+
];
|
|
1197
|
+
returns: 'u8';
|
|
1044
1198
|
}
|
|
1045
1199
|
];
|
|
1046
1200
|
accounts: [
|
|
@@ -1067,6 +1221,10 @@ export type PoseidonsProtocol = {
|
|
|
1067
1221
|
{
|
|
1068
1222
|
name: 'user';
|
|
1069
1223
|
discriminator: [159, 117, 95, 227, 239, 151, 58, 236];
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: 'wheel';
|
|
1227
|
+
discriminator: [196, 41, 11, 47, 123, 180, 10, 219];
|
|
1070
1228
|
}
|
|
1071
1229
|
];
|
|
1072
1230
|
events: [
|
|
@@ -1074,6 +1232,10 @@ export type PoseidonsProtocol = {
|
|
|
1074
1232
|
name: 'bidChestEvent';
|
|
1075
1233
|
discriminator: [162, 64, 11, 176, 231, 173, 217, 89];
|
|
1076
1234
|
},
|
|
1235
|
+
{
|
|
1236
|
+
name: 'buySpinEvent';
|
|
1237
|
+
discriminator: [253, 97, 83, 130, 75, 128, 156, 7];
|
|
1238
|
+
},
|
|
1077
1239
|
{
|
|
1078
1240
|
name: 'chestCreatedEvent';
|
|
1079
1241
|
discriminator: [27, 178, 135, 161, 240, 189, 246, 238];
|
|
@@ -1098,6 +1260,10 @@ export type PoseidonsProtocol = {
|
|
|
1098
1260
|
name: 'poseidonRewardsEvent';
|
|
1099
1261
|
discriminator: [93, 26, 205, 192, 107, 244, 92, 119];
|
|
1100
1262
|
},
|
|
1263
|
+
{
|
|
1264
|
+
name: 'spinWheelEvent';
|
|
1265
|
+
discriminator: [136, 0, 170, 174, 167, 129, 91, 187];
|
|
1266
|
+
},
|
|
1101
1267
|
{
|
|
1102
1268
|
name: 'userCreatedEvent';
|
|
1103
1269
|
discriminator: [41, 186, 252, 198, 103, 111, 139, 224];
|
|
@@ -1133,6 +1299,16 @@ export type PoseidonsProtocol = {
|
|
|
1133
1299
|
code: 6005;
|
|
1134
1300
|
name: 'invalidRefer';
|
|
1135
1301
|
msg: 'Invalid refer';
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
code: 6006;
|
|
1305
|
+
name: 'insufficientFunds';
|
|
1306
|
+
msg: 'Insufficient funds';
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
code: 6007;
|
|
1310
|
+
name: 'insufficientSpins';
|
|
1311
|
+
msg: 'Insufficient spins';
|
|
1136
1312
|
}
|
|
1137
1313
|
];
|
|
1138
1314
|
types: [
|
|
@@ -1169,6 +1345,22 @@ export type PoseidonsProtocol = {
|
|
|
1169
1345
|
];
|
|
1170
1346
|
};
|
|
1171
1347
|
},
|
|
1348
|
+
{
|
|
1349
|
+
name: 'addWheelPrizeArgs';
|
|
1350
|
+
type: {
|
|
1351
|
+
kind: 'struct';
|
|
1352
|
+
fields: [
|
|
1353
|
+
{
|
|
1354
|
+
name: 'id';
|
|
1355
|
+
type: 'u8';
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
name: 'available';
|
|
1359
|
+
type: 'u64';
|
|
1360
|
+
}
|
|
1361
|
+
];
|
|
1362
|
+
};
|
|
1363
|
+
},
|
|
1172
1364
|
{
|
|
1173
1365
|
name: 'baseAssetV1';
|
|
1174
1366
|
type: {
|
|
@@ -1279,6 +1471,30 @@ export type PoseidonsProtocol = {
|
|
|
1279
1471
|
];
|
|
1280
1472
|
};
|
|
1281
1473
|
},
|
|
1474
|
+
{
|
|
1475
|
+
name: 'buySpinEvent';
|
|
1476
|
+
type: {
|
|
1477
|
+
kind: 'struct';
|
|
1478
|
+
fields: [
|
|
1479
|
+
{
|
|
1480
|
+
name: 'user';
|
|
1481
|
+
type: 'pubkey';
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
name: 'spins';
|
|
1485
|
+
type: 'u64';
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
name: 'fee';
|
|
1489
|
+
type: 'u64';
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
name: 'timestamp';
|
|
1493
|
+
type: 'i64';
|
|
1494
|
+
}
|
|
1495
|
+
];
|
|
1496
|
+
};
|
|
1497
|
+
},
|
|
1282
1498
|
{
|
|
1283
1499
|
name: 'chest';
|
|
1284
1500
|
type: {
|
|
@@ -1531,6 +1747,35 @@ export type PoseidonsProtocol = {
|
|
|
1531
1747
|
];
|
|
1532
1748
|
};
|
|
1533
1749
|
},
|
|
1750
|
+
{
|
|
1751
|
+
name: 'createWheelArgs';
|
|
1752
|
+
type: {
|
|
1753
|
+
kind: 'struct';
|
|
1754
|
+
fields: [
|
|
1755
|
+
{
|
|
1756
|
+
name: 'id';
|
|
1757
|
+
type: 'u8';
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
name: 'name';
|
|
1761
|
+
type: 'string';
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
name: 'prizes';
|
|
1765
|
+
type: {
|
|
1766
|
+
array: [
|
|
1767
|
+
{
|
|
1768
|
+
defined: {
|
|
1769
|
+
name: 'prize';
|
|
1770
|
+
};
|
|
1771
|
+
},
|
|
1772
|
+
12
|
|
1773
|
+
];
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
];
|
|
1777
|
+
};
|
|
1778
|
+
},
|
|
1534
1779
|
{
|
|
1535
1780
|
name: 'key';
|
|
1536
1781
|
type: {
|
|
@@ -1745,6 +1990,58 @@ export type PoseidonsProtocol = {
|
|
|
1745
1990
|
];
|
|
1746
1991
|
};
|
|
1747
1992
|
},
|
|
1993
|
+
{
|
|
1994
|
+
name: 'prize';
|
|
1995
|
+
type: {
|
|
1996
|
+
kind: 'struct';
|
|
1997
|
+
fields: [
|
|
1998
|
+
{
|
|
1999
|
+
name: 'id';
|
|
2000
|
+
type: 'u8';
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
name: 'name';
|
|
2004
|
+
type: 'string';
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
name: 'available';
|
|
2008
|
+
type: 'u64';
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
name: 'rangeMin';
|
|
2012
|
+
type: 'u64';
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
name: 'rangeMax';
|
|
2016
|
+
type: 'u64';
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
name: 'unit';
|
|
2020
|
+
type: 'u64';
|
|
2021
|
+
}
|
|
2022
|
+
];
|
|
2023
|
+
};
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
name: 'spinWheelEvent';
|
|
2027
|
+
type: {
|
|
2028
|
+
kind: 'struct';
|
|
2029
|
+
fields: [
|
|
2030
|
+
{
|
|
2031
|
+
name: 'user';
|
|
2032
|
+
type: 'pubkey';
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
name: 'prizeId';
|
|
2036
|
+
type: 'u8';
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
name: 'timestamp';
|
|
2040
|
+
type: 'i64';
|
|
2041
|
+
}
|
|
2042
|
+
];
|
|
2043
|
+
};
|
|
2044
|
+
},
|
|
1748
2045
|
{
|
|
1749
2046
|
name: 'updateAuthority';
|
|
1750
2047
|
type: {
|
|
@@ -1789,10 +2086,14 @@ export type PoseidonsProtocol = {
|
|
|
1789
2086
|
name: 'coins';
|
|
1790
2087
|
type: 'u64';
|
|
1791
2088
|
},
|
|
2089
|
+
{
|
|
2090
|
+
name: 'spins';
|
|
2091
|
+
type: 'u64';
|
|
2092
|
+
},
|
|
1792
2093
|
{
|
|
1793
2094
|
name: 'padding';
|
|
1794
2095
|
type: {
|
|
1795
|
-
array: ['u8',
|
|
2096
|
+
array: ['u8', 48];
|
|
1796
2097
|
};
|
|
1797
2098
|
}
|
|
1798
2099
|
];
|
|
@@ -1821,6 +2122,49 @@ export type PoseidonsProtocol = {
|
|
|
1821
2122
|
}
|
|
1822
2123
|
];
|
|
1823
2124
|
};
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
name: 'wheel';
|
|
2128
|
+
type: {
|
|
2129
|
+
kind: 'struct';
|
|
2130
|
+
fields: [
|
|
2131
|
+
{
|
|
2132
|
+
name: 'bump';
|
|
2133
|
+
type: 'u8';
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
name: 'id';
|
|
2137
|
+
type: 'u8';
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
name: 'name';
|
|
2141
|
+
type: 'string';
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
name: 'count';
|
|
2145
|
+
type: 'u64';
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
name: 'prizes';
|
|
2149
|
+
type: {
|
|
2150
|
+
array: [
|
|
2151
|
+
{
|
|
2152
|
+
defined: {
|
|
2153
|
+
name: 'prize';
|
|
2154
|
+
};
|
|
2155
|
+
},
|
|
2156
|
+
12
|
|
2157
|
+
];
|
|
2158
|
+
};
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
name: 'padding';
|
|
2162
|
+
type: {
|
|
2163
|
+
array: ['u8', 32];
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
];
|
|
2167
|
+
};
|
|
1824
2168
|
}
|
|
1825
2169
|
];
|
|
1826
2170
|
};
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IdlAccounts } from '@coral-xyz/anchor';
|
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
|
3
3
|
import { PoseidonsProtocol } from '../types/poseidons_protocol';
|
|
4
|
-
import { PoseidonVault, Poseidon, Chest, User } from '../types';
|
|
4
|
+
import { PoseidonVault, Poseidon, Chest, User, Wheel } from '../types';
|
|
5
5
|
export declare const formatPoseidonVault: (account: IdlAccounts<PoseidonsProtocol>['poseidonVault'], address: PublicKey) => PoseidonVault;
|
|
6
6
|
export declare const formatPoseidon: (account: IdlAccounts<PoseidonsProtocol>['poseidon'], address: PublicKey) => Poseidon;
|
|
7
7
|
export declare const formatUser: (account: IdlAccounts<PoseidonsProtocol>['user'], address: PublicKey) => User;
|
|
8
8
|
export declare const formatChest: (account: IdlAccounts<PoseidonsProtocol>['chest'], address: PublicKey) => Chest;
|
|
9
|
+
export declare const formatWheel: (account: IdlAccounts<PoseidonsProtocol>['wheel'], address: PublicKey) => Wheel;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatChest = exports.formatUser = exports.formatPoseidon = exports.formatPoseidonVault = void 0;
|
|
3
|
+
exports.formatWheel = exports.formatChest = exports.formatUser = exports.formatPoseidon = exports.formatPoseidonVault = void 0;
|
|
4
4
|
const formatPoseidonVault = (account, address) => {
|
|
5
5
|
return {
|
|
6
6
|
address: address.toString(),
|
|
@@ -60,3 +60,20 @@ const formatChest = (account, address) => {
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
exports.formatChest = formatChest;
|
|
63
|
+
const formatWheel = (account, address) => {
|
|
64
|
+
return {
|
|
65
|
+
address: address.toString(),
|
|
66
|
+
id: account.id,
|
|
67
|
+
name: account.name,
|
|
68
|
+
count: account.count.toNumber(),
|
|
69
|
+
prizes: account.prizes.map((prize) => ({
|
|
70
|
+
id: prize.id,
|
|
71
|
+
name: prize.name,
|
|
72
|
+
available: prize.available.toNumber(),
|
|
73
|
+
rangeMin: prize.rangeMin.toNumber(),
|
|
74
|
+
rangeMax: prize.rangeMax.toNumber(),
|
|
75
|
+
unit: prize.unit.toNumber()
|
|
76
|
+
}))
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.formatWheel = formatWheel;
|
package/dist/utils/pda.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare const getPoseidonVaultPDA: () => PublicKey;
|
|
|
4
4
|
export declare const getPoseidonPDA: (mint: PublicKey) => PublicKey;
|
|
5
5
|
export declare const getUserPDA: (authority: PublicKey) => PublicKey;
|
|
6
6
|
export declare const getChestPDA: (id: number) => PublicKey;
|
|
7
|
+
export declare const getWheelPDA: (id: number) => PublicKey;
|
package/dist/utils/pda.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getChestPDA = exports.getUserPDA = exports.getPoseidonPDA = exports.getPoseidonVaultPDA = exports.getTokenATA = void 0;
|
|
3
|
+
exports.getWheelPDA = exports.getChestPDA = exports.getUserPDA = exports.getPoseidonPDA = exports.getPoseidonVaultPDA = exports.getTokenATA = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const spl_token_1 = require("@solana/spl-token");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
@@ -25,3 +25,7 @@ const getChestPDA = (id) => {
|
|
|
25
25
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('chest'), new anchor_1.BN(id).toArrayLike(Buffer, 'le', 8)], constants_1.POSEIDON_VAULT_PROGRAM_ID)[0];
|
|
26
26
|
};
|
|
27
27
|
exports.getChestPDA = getChestPDA;
|
|
28
|
+
const getWheelPDA = (id) => {
|
|
29
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('wheel'), new anchor_1.BN(id).toArrayLike(Buffer, 'le', 8)], constants_1.POSEIDON_VAULT_PROGRAM_ID)[0];
|
|
30
|
+
};
|
|
31
|
+
exports.getWheelPDA = getWheelPDA;
|