@1upmonster/duel 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.
Files changed (39) hide show
  1. package/README.md +120 -59
  2. package/dist/admin.d.ts +8 -1
  3. package/dist/admin.js +52 -9
  4. package/dist/generated/duel/errors/duel.d.ts +1 -3
  5. package/dist/generated/duel/errors/duel.js +2 -4
  6. package/dist/generated/duel/instructions/index.d.ts +2 -0
  7. package/dist/generated/duel/instructions/index.js +3 -1
  8. package/dist/generated/duel/instructions/joinQueue.d.ts +1 -1
  9. package/dist/generated/duel/instructions/joinQueue.js +3 -3
  10. package/dist/generated/duel/instructions/setupQueuePermission.d.ts +51 -0
  11. package/dist/generated/duel/instructions/setupQueuePermission.js +63 -0
  12. package/dist/generated/duel/instructions/setupTicketPermission.d.ts +54 -0
  13. package/dist/generated/duel/instructions/setupTicketPermission.js +63 -0
  14. package/dist/generated/duel/programs/duel.d.ts +11 -3
  15. package/dist/generated/duel/programs/duel.js +19 -3
  16. package/dist/player.d.ts +8 -1
  17. package/dist/player.js +56 -5
  18. package/dist/tee.d.ts +4 -3
  19. package/dist/tee.js +17 -23
  20. package/dist/transaction.d.ts +2 -0
  21. package/dist/transaction.js +30 -19
  22. package/dist/utils.d.ts +10 -0
  23. package/dist/utils.js +28 -1
  24. package/package.json +1 -1
  25. package/src/admin.ts +67 -7
  26. package/src/duel.json +57 -5
  27. package/src/generated/duel/errors/duel.ts +2 -4
  28. package/src/generated/duel/instructions/index.ts +3 -1
  29. package/src/generated/duel/instructions/joinQueue.ts +3 -3
  30. package/src/generated/duel/instructions/setupQueuePermission.ts +112 -0
  31. package/src/generated/duel/instructions/setupTicketPermission.ts +115 -0
  32. package/src/generated/duel/programs/duel.ts +12 -4
  33. package/src/player.ts +72 -1
  34. package/src/tee.ts +18 -22
  35. package/src/transaction.ts +33 -18
  36. package/src/utils.ts +34 -0
  37. package/src/encryption.ts +0 -154
  38. package/src/idl/private_matchmaking.json +0 -1027
  39. package/src/idl/private_matchmaking.ts +0 -1033
@@ -1,1033 +0,0 @@
1
- /**
2
- * Program IDL in camelCase format in order to be used in JS/TS.
3
- *
4
- * Note that this is only a type helper and is not the actual IDL. The original
5
- * IDL can be found at `target/idl/private_matchmaking.json`.
6
- */
7
- export type PrivateMatchmaking = {
8
- "address": "DYDe2VCrFjzxy9zuovGeum67kYybr65G6Zbxt9gPJP1f",
9
- "metadata": {
10
- "name": "privateMatchmaking",
11
- "version": "0.1.0",
12
- "spec": "0.1.0",
13
- "description": "Created with Anchor"
14
- },
15
- "instructions": [
16
- {
17
- "name": "closePage",
18
- "discriminator": [
19
- 205,
20
- 141,
21
- 25,
22
- 179,
23
- 31,
24
- 1,
25
- 103,
26
- 43
27
- ],
28
- "accounts": [
29
- {
30
- "name": "queue",
31
- "writable": true
32
- },
33
- {
34
- "name": "page",
35
- "writable": true,
36
- "pda": {
37
- "seeds": [
38
- {
39
- "kind": "const",
40
- "value": [
41
- 112,
42
- 97,
43
- 103,
44
- 101
45
- ]
46
- },
47
- {
48
- "kind": "account",
49
- "path": "queue"
50
- },
51
- {
52
- "kind": "arg",
53
- "path": "pageIndex"
54
- }
55
- ]
56
- }
57
- },
58
- {
59
- "name": "authority",
60
- "writable": true,
61
- "signer": true
62
- }
63
- ],
64
- "args": [
65
- {
66
- "name": "pageIndex",
67
- "type": "u64"
68
- }
69
- ]
70
- },
71
- {
72
- "name": "closeQueue",
73
- "discriminator": [
74
- 199,
75
- 20,
76
- 99,
77
- 205,
78
- 82,
79
- 40,
80
- 134,
81
- 109
82
- ],
83
- "accounts": [
84
- {
85
- "name": "queue",
86
- "writable": true,
87
- "pda": {
88
- "seeds": [
89
- {
90
- "kind": "const",
91
- "value": [
92
- 113,
93
- 117,
94
- 101,
95
- 117,
96
- 101,
97
- 45,
98
- 104,
99
- 101,
100
- 97,
101
- 100
102
- ]
103
- },
104
- {
105
- "kind": "account",
106
- "path": "authority"
107
- },
108
- {
109
- "kind": "arg",
110
- "path": "queueId"
111
- }
112
- ]
113
- }
114
- },
115
- {
116
- "name": "authority",
117
- "writable": true,
118
- "signer": true
119
- }
120
- ],
121
- "args": [
122
- {
123
- "name": "queueId",
124
- "type": "string"
125
- }
126
- ]
127
- },
128
- {
129
- "name": "createMockPlayer",
130
- "discriminator": [
131
- 168,
132
- 23,
133
- 255,
134
- 112,
135
- 93,
136
- 42,
137
- 58,
138
- 223
139
- ],
140
- "accounts": [
141
- {
142
- "name": "playerAccount",
143
- "writable": true,
144
- "signer": true
145
- },
146
- {
147
- "name": "authority",
148
- "writable": true,
149
- "signer": true
150
- },
151
- {
152
- "name": "systemProgram",
153
- "address": "11111111111111111111111111111111"
154
- }
155
- ],
156
- "args": [
157
- {
158
- "name": "elo",
159
- "type": "u64"
160
- }
161
- ]
162
- },
163
- {
164
- "name": "delegateQueue",
165
- "discriminator": [
166
- 31,
167
- 200,
168
- 139,
169
- 125,
170
- 93,
171
- 239,
172
- 83,
173
- 87
174
- ],
175
- "accounts": [
176
- {
177
- "name": "bufferPda",
178
- "writable": true,
179
- "pda": {
180
- "seeds": [
181
- {
182
- "kind": "const",
183
- "value": [
184
- 98,
185
- 117,
186
- 102,
187
- 102,
188
- 101,
189
- 114
190
- ]
191
- },
192
- {
193
- "kind": "account",
194
- "path": "pda"
195
- }
196
- ],
197
- "program": {
198
- "kind": "const",
199
- "value": [
200
- 186,
201
- 75,
202
- 137,
203
- 215,
204
- 241,
205
- 191,
206
- 83,
207
- 129,
208
- 57,
209
- 126,
210
- 236,
211
- 131,
212
- 241,
213
- 98,
214
- 116,
215
- 32,
216
- 255,
217
- 94,
218
- 207,
219
- 189,
220
- 126,
221
- 244,
222
- 40,
223
- 252,
224
- 115,
225
- 71,
226
- 34,
227
- 33,
228
- 50,
229
- 188,
230
- 53,
231
- 38
232
- ]
233
- }
234
- }
235
- },
236
- {
237
- "name": "delegationRecordPda",
238
- "writable": true,
239
- "pda": {
240
- "seeds": [
241
- {
242
- "kind": "const",
243
- "value": [
244
- 100,
245
- 101,
246
- 108,
247
- 101,
248
- 103,
249
- 97,
250
- 116,
251
- 105,
252
- 111,
253
- 110
254
- ]
255
- },
256
- {
257
- "kind": "account",
258
- "path": "pda"
259
- }
260
- ],
261
- "program": {
262
- "kind": "account",
263
- "path": "delegationProgram"
264
- }
265
- }
266
- },
267
- {
268
- "name": "delegationMetadataPda",
269
- "writable": true,
270
- "pda": {
271
- "seeds": [
272
- {
273
- "kind": "const",
274
- "value": [
275
- 100,
276
- 101,
277
- 108,
278
- 101,
279
- 103,
280
- 97,
281
- 116,
282
- 105,
283
- 111,
284
- 110,
285
- 45,
286
- 109,
287
- 101,
288
- 116,
289
- 97,
290
- 100,
291
- 97,
292
- 116,
293
- 97
294
- ]
295
- },
296
- {
297
- "kind": "account",
298
- "path": "pda"
299
- }
300
- ],
301
- "program": {
302
- "kind": "account",
303
- "path": "delegationProgram"
304
- }
305
- }
306
- },
307
- {
308
- "name": "pda",
309
- "writable": true,
310
- "pda": {
311
- "seeds": [
312
- {
313
- "kind": "const",
314
- "value": [
315
- 113,
316
- 117,
317
- 101,
318
- 117,
319
- 101,
320
- 45,
321
- 104,
322
- 101,
323
- 97,
324
- 100
325
- ]
326
- },
327
- {
328
- "kind": "account",
329
- "path": "authority"
330
- },
331
- {
332
- "kind": "arg",
333
- "path": "queueId"
334
- }
335
- ]
336
- }
337
- },
338
- {
339
- "name": "authority",
340
- "signer": true
341
- },
342
- {
343
- "name": "payer",
344
- "writable": true,
345
- "signer": true
346
- },
347
- {
348
- "name": "validator",
349
- "optional": true
350
- },
351
- {
352
- "name": "ownerProgram",
353
- "address": "DYDe2VCrFjzxy9zuovGeum67kYybr65G6Zbxt9gPJP1f"
354
- },
355
- {
356
- "name": "delegationProgram",
357
- "address": "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh"
358
- },
359
- {
360
- "name": "systemProgram",
361
- "address": "11111111111111111111111111111111"
362
- }
363
- ],
364
- "args": [
365
- {
366
- "name": "queueId",
367
- "type": "string"
368
- }
369
- ]
370
- },
371
- {
372
- "name": "initializePage",
373
- "discriminator": [
374
- 26,
375
- 128,
376
- 8,
377
- 201,
378
- 196,
379
- 58,
380
- 74,
381
- 74
382
- ],
383
- "accounts": [
384
- {
385
- "name": "queue",
386
- "writable": true
387
- },
388
- {
389
- "name": "page",
390
- "writable": true,
391
- "pda": {
392
- "seeds": [
393
- {
394
- "kind": "const",
395
- "value": [
396
- 112,
397
- 97,
398
- 103,
399
- 101
400
- ]
401
- },
402
- {
403
- "kind": "account",
404
- "path": "queue"
405
- },
406
- {
407
- "kind": "arg",
408
- "path": "pageIndex"
409
- }
410
- ]
411
- }
412
- },
413
- {
414
- "name": "authority",
415
- "writable": true,
416
- "signer": true
417
- },
418
- {
419
- "name": "systemProgram",
420
- "address": "11111111111111111111111111111111"
421
- }
422
- ],
423
- "args": [
424
- {
425
- "name": "pageIndex",
426
- "type": "u64"
427
- }
428
- ]
429
- },
430
- {
431
- "name": "initializeQueue",
432
- "discriminator": [
433
- 174,
434
- 102,
435
- 132,
436
- 232,
437
- 90,
438
- 202,
439
- 27,
440
- 20
441
- ],
442
- "accounts": [
443
- {
444
- "name": "queue",
445
- "writable": true,
446
- "pda": {
447
- "seeds": [
448
- {
449
- "kind": "const",
450
- "value": [
451
- 113,
452
- 117,
453
- 101,
454
- 117,
455
- 101,
456
- 45,
457
- 104,
458
- 101,
459
- 97,
460
- 100
461
- ]
462
- },
463
- {
464
- "kind": "account",
465
- "path": "authority"
466
- },
467
- {
468
- "kind": "arg",
469
- "path": "queueId"
470
- }
471
- ]
472
- }
473
- },
474
- {
475
- "name": "tenantProgramId"
476
- },
477
- {
478
- "name": "authority",
479
- "writable": true,
480
- "signer": true
481
- },
482
- {
483
- "name": "systemProgram",
484
- "address": "11111111111111111111111111111111"
485
- }
486
- ],
487
- "args": [
488
- {
489
- "name": "queueId",
490
- "type": "string"
491
- },
492
- {
493
- "name": "config",
494
- "type": {
495
- "defined": {
496
- "name": "queueConfig"
497
- }
498
- }
499
- },
500
- {
501
- "name": "capacity",
502
- "type": "u16"
503
- },
504
- {
505
- "name": "pageSize",
506
- "type": "u8"
507
- }
508
- ]
509
- },
510
- {
511
- "name": "joinQueue",
512
- "discriminator": [
513
- 157,
514
- 115,
515
- 48,
516
- 109,
517
- 65,
518
- 86,
519
- 203,
520
- 238
521
- ],
522
- "accounts": [
523
- {
524
- "name": "queue",
525
- "writable": true
526
- },
527
- {
528
- "name": "page",
529
- "writable": true
530
- },
531
- {
532
- "name": "playerStatus",
533
- "writable": true,
534
- "pda": {
535
- "seeds": [
536
- {
537
- "kind": "const",
538
- "value": [
539
- 115,
540
- 116,
541
- 97,
542
- 116,
543
- 117,
544
- 115
545
- ]
546
- },
547
- {
548
- "kind": "account",
549
- "path": "playerGameAccount"
550
- }
551
- ]
552
- }
553
- },
554
- {
555
- "name": "playerAuthority",
556
- "writable": true,
557
- "signer": true
558
- },
559
- {
560
- "name": "playerGameAccount",
561
- "docs": [
562
- "The account containing ELO data"
563
- ]
564
- },
565
- {
566
- "name": "tenantProgram",
567
- "docs": [
568
- "MUST match the queue.tenant_program_id."
569
- ]
570
- },
571
- {
572
- "name": "systemProgram",
573
- "address": "11111111111111111111111111111111"
574
- }
575
- ],
576
- "args": []
577
- },
578
- {
579
- "name": "processMatch",
580
- "discriminator": [
581
- 139,
582
- 58,
583
- 77,
584
- 101,
585
- 46,
586
- 54,
587
- 202,
588
- 140
589
- ],
590
- "accounts": [
591
- {
592
- "name": "queueAccount",
593
- "writable": true
594
- },
595
- {
596
- "name": "page",
597
- "writable": true,
598
- "pda": {
599
- "seeds": [
600
- {
601
- "kind": "const",
602
- "value": [
603
- 112,
604
- 97,
605
- 103,
606
- 101
607
- ]
608
- },
609
- {
610
- "kind": "account",
611
- "path": "queueAccount"
612
- },
613
- {
614
- "kind": "arg",
615
- "path": "pageIndex"
616
- }
617
- ]
618
- }
619
- }
620
- ],
621
- "args": [
622
- {
623
- "name": "pageIndex",
624
- "type": "u64"
625
- }
626
- ]
627
- },
628
- {
629
- "name": "processUndelegation",
630
- "discriminator": [
631
- 196,
632
- 28,
633
- 41,
634
- 206,
635
- 48,
636
- 37,
637
- 51,
638
- 167
639
- ],
640
- "accounts": [
641
- {
642
- "name": "baseAccount",
643
- "writable": true
644
- },
645
- {
646
- "name": "buffer"
647
- },
648
- {
649
- "name": "payer",
650
- "writable": true
651
- },
652
- {
653
- "name": "systemProgram"
654
- }
655
- ],
656
- "args": [
657
- {
658
- "name": "accountSeeds",
659
- "type": {
660
- "vec": "bytes"
661
- }
662
- }
663
- ]
664
- },
665
- {
666
- "name": "resizeQueue",
667
- "discriminator": [
668
- 140,
669
- 145,
670
- 226,
671
- 236,
672
- 71,
673
- 103,
674
- 230,
675
- 105
676
- ],
677
- "accounts": [
678
- {
679
- "name": "queue",
680
- "writable": true
681
- },
682
- {
683
- "name": "authority",
684
- "signer": true,
685
- "relations": [
686
- "queue"
687
- ]
688
- }
689
- ],
690
- "args": [
691
- {
692
- "name": "newCapacity",
693
- "type": "u16"
694
- }
695
- ]
696
- },
697
- {
698
- "name": "unlockPlayer",
699
- "discriminator": [
700
- 226,
701
- 41,
702
- 76,
703
- 17,
704
- 253,
705
- 9,
706
- 82,
707
- 188
708
- ],
709
- "accounts": [
710
- {
711
- "name": "queue"
712
- },
713
- {
714
- "name": "authority",
715
- "writable": true,
716
- "signer": true
717
- },
718
- {
719
- "name": "playerStatus",
720
- "writable": true,
721
- "pda": {
722
- "seeds": [
723
- {
724
- "kind": "const",
725
- "value": [
726
- 115,
727
- 116,
728
- 97,
729
- 116,
730
- 117,
731
- 115
732
- ]
733
- },
734
- {
735
- "kind": "account",
736
- "path": "playerGameAccount"
737
- }
738
- ]
739
- }
740
- },
741
- {
742
- "name": "player",
743
- "writable": true
744
- },
745
- {
746
- "name": "playerGameAccount"
747
- }
748
- ],
749
- "args": []
750
- }
751
- ],
752
- "accounts": [
753
- {
754
- "name": "mockPlayer",
755
- "discriminator": [
756
- 128,
757
- 205,
758
- 19,
759
- 217,
760
- 238,
761
- 150,
762
- 18,
763
- 255
764
- ]
765
- },
766
- {
767
- "name": "playerStatus",
768
- "discriminator": [
769
- 28,
770
- 122,
771
- 125,
772
- 124,
773
- 167,
774
- 143,
775
- 216,
776
- 176
777
- ]
778
- },
779
- {
780
- "name": "queueHead",
781
- "discriminator": [
782
- 252,
783
- 245,
784
- 9,
785
- 149,
786
- 18,
787
- 35,
788
- 210,
789
- 142
790
- ]
791
- },
792
- {
793
- "name": "queuePage",
794
- "discriminator": [
795
- 44,
796
- 9,
797
- 254,
798
- 108,
799
- 121,
800
- 225,
801
- 80,
802
- 69
803
- ]
804
- }
805
- ],
806
- "events": [
807
- {
808
- "name": "matchFound",
809
- "discriminator": [
810
- 73,
811
- 161,
812
- 70,
813
- 145,
814
- 232,
815
- 249,
816
- 72,
817
- 211
818
- ]
819
- }
820
- ],
821
- "errors": [
822
- {
823
- "code": 6000,
824
- "name": "invalidAccountOwner",
825
- "msg": "Account owner is invalid"
826
- },
827
- {
828
- "code": 6001,
829
- "name": "queueFull",
830
- "msg": "Queue is full"
831
- },
832
- {
833
- "code": 6002,
834
- "name": "accountTooSmall",
835
- "msg": "Account data too small for ELO offset"
836
- },
837
- {
838
- "code": 6003,
839
- "name": "invalidEloType",
840
- "msg": "Invalid ELO type configuration"
841
- },
842
- {
843
- "code": 6004,
844
- "name": "indexOutOfBounds",
845
- "msg": "Page index out of bounds"
846
- }
847
- ],
848
- "types": [
849
- {
850
- "name": "matchFound",
851
- "type": {
852
- "kind": "struct",
853
- "fields": [
854
- {
855
- "name": "queue",
856
- "type": "pubkey"
857
- },
858
- {
859
- "name": "playerA",
860
- "type": "pubkey"
861
- },
862
- {
863
- "name": "playerB",
864
- "type": "pubkey"
865
- },
866
- {
867
- "name": "eloA",
868
- "type": "u64"
869
- },
870
- {
871
- "name": "eloB",
872
- "type": "u64"
873
- },
874
- {
875
- "name": "timestamp",
876
- "type": "i64"
877
- }
878
- ]
879
- }
880
- },
881
- {
882
- "name": "mockPlayer",
883
- "type": {
884
- "kind": "struct",
885
- "fields": [
886
- {
887
- "name": "elo",
888
- "type": "u64"
889
- }
890
- ]
891
- }
892
- },
893
- {
894
- "name": "playerEntry",
895
- "type": {
896
- "kind": "struct",
897
- "fields": [
898
- {
899
- "name": "authority",
900
- "type": "pubkey"
901
- },
902
- {
903
- "name": "account",
904
- "type": "pubkey"
905
- },
906
- {
907
- "name": "elo",
908
- "type": "u64"
909
- },
910
- {
911
- "name": "joinedAt",
912
- "type": "i64"
913
- }
914
- ]
915
- }
916
- },
917
- {
918
- "name": "playerStatus",
919
- "type": {
920
- "kind": "struct",
921
- "fields": [
922
- {
923
- "name": "player",
924
- "type": "pubkey"
925
- },
926
- {
927
- "name": "queue",
928
- "type": "pubkey"
929
- },
930
- {
931
- "name": "inMatch",
932
- "type": "bool"
933
- },
934
- {
935
- "name": "joinedAt",
936
- "type": "i64"
937
- },
938
- {
939
- "name": "bump",
940
- "type": "u8"
941
- }
942
- ]
943
- }
944
- },
945
- {
946
- "name": "queueConfig",
947
- "type": {
948
- "kind": "struct",
949
- "fields": [
950
- {
951
- "name": "matchThreshold",
952
- "type": "u32"
953
- },
954
- {
955
- "name": "searchWindow",
956
- "type": "u32"
957
- },
958
- {
959
- "name": "reserved",
960
- "type": {
961
- "array": [
962
- "u8",
963
- 64
964
- ]
965
- }
966
- }
967
- ]
968
- }
969
- },
970
- {
971
- "name": "queueHead",
972
- "type": {
973
- "kind": "struct",
974
- "fields": [
975
- {
976
- "name": "authority",
977
- "type": "pubkey"
978
- },
979
- {
980
- "name": "tenantProgramId",
981
- "type": "pubkey"
982
- },
983
- {
984
- "name": "config",
985
- "type": {
986
- "defined": {
987
- "name": "queueConfig"
988
- }
989
- }
990
- },
991
- {
992
- "name": "capacity",
993
- "type": "u16"
994
- },
995
- {
996
- "name": "pageSize",
997
- "type": "u8"
998
- },
999
- {
1000
- "name": "writePageIndex",
1001
- "type": "u64"
1002
- },
1003
- {
1004
- "name": "readPageIndex",
1005
- "type": "u64"
1006
- },
1007
- {
1008
- "name": "bump",
1009
- "type": "u8"
1010
- }
1011
- ]
1012
- }
1013
- },
1014
- {
1015
- "name": "queuePage",
1016
- "type": {
1017
- "kind": "struct",
1018
- "fields": [
1019
- {
1020
- "name": "players",
1021
- "type": {
1022
- "vec": {
1023
- "defined": {
1024
- "name": "playerEntry"
1025
- }
1026
- }
1027
- }
1028
- }
1029
- ]
1030
- }
1031
- }
1032
- ]
1033
- };