stakeapi-codestats 0.2.0__py3-none-any.whl

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.
stakeapi/endpoints.py ADDED
@@ -0,0 +1,916 @@
1
+ """API endpoints and GraphQL queries for StakeAPI."""
2
+
3
+
4
+ class Endpoints:
5
+ """API endpoint constants.
6
+
7
+ NOTE: All /api/v1/* REST endpoints are fictional and return 404.
8
+ The only real API surface is /_api/graphql (see GraphQLQueries).
9
+ These constants are kept for backward compatibility but should not be used.
10
+ """
11
+
12
+ GRAPHQL = "/_api/graphql"
13
+
14
+
15
+ class GraphQLQueries:
16
+ """GraphQL query constants for stake.com/stake.us API.
17
+
18
+ Verified against both domains on 2025-05-09/10. Queries that
19
+ differ between stake.com and stake.us are noted in docstrings.
20
+
21
+ Domain-specific notes:
22
+ - stake.us: uses ``isAcp: true`` in CurrencyConfiguration
23
+ - stake.com: uses ``isAcp: false``, has ``kycStatus`` field
24
+ - Sports queries are restricted on stake.us (region-locked)
25
+
26
+ Tags:
27
+ [verified] — tested against live API on stake.com and/or stake.us
28
+ [constructed] — built from Playwright-captured operation names & schema
29
+ patterns; NOT yet tested against live API
30
+ """
31
+
32
+ # ═══════════════════════════════════════════════════════════════════
33
+ # USER QUERIES [verified]
34
+ # ═══════════════════════════════════════════════════════════════════
35
+
36
+ USER_BALANCES = """
37
+ query UserBalances {
38
+ user {
39
+ id
40
+ balances {
41
+ available {
42
+ amount
43
+ currency
44
+ __typename
45
+ }
46
+ vault {
47
+ amount
48
+ currency
49
+ __typename
50
+ }
51
+ __typename
52
+ }
53
+ __typename
54
+ }
55
+ }
56
+ """
57
+
58
+ USER_PROFILE = """
59
+ query UserProfile {
60
+ user {
61
+ id
62
+ name
63
+ email
64
+ hasEmailVerified
65
+ isMuted
66
+ isRainproof
67
+ isBanned
68
+ createdAt
69
+ __typename
70
+ }
71
+ }
72
+ """
73
+
74
+ USER_META = """
75
+ query UserMeta($name: String) {
76
+ user(name: $name) {
77
+ id
78
+ name
79
+ balances {
80
+ available {
81
+ amount
82
+ currency
83
+ __typename
84
+ }
85
+ __typename
86
+ }
87
+ __typename
88
+ }
89
+ }
90
+ """
91
+
92
+ USER_META_EXTENDED = """
93
+ query UserMetaExtended($name: String, $signupCode: Boolean = false) {
94
+ user(name: $name) {
95
+ id
96
+ name
97
+ isMuted
98
+ isRainproof
99
+ isBanned
100
+ createdAt
101
+ campaignSet
102
+ selfExclude {
103
+ id
104
+ status
105
+ active
106
+ createdAt
107
+ expireAt
108
+ __typename
109
+ }
110
+ signupCode @include(if: $signupCode) {
111
+ id
112
+ code {
113
+ id
114
+ code
115
+ }
116
+ __typename
117
+ }
118
+ __typename
119
+ }
120
+ }
121
+ """
122
+
123
+ USER_ACCOUNT_INFO = """
124
+ query UserAccountInfo {
125
+ user {
126
+ id
127
+ name
128
+ email
129
+ createdAt
130
+ __typename
131
+ }
132
+ }
133
+ """
134
+
135
+ USER_KYC_STATUS = """
136
+ query UserKycStatus {
137
+ user {
138
+ id
139
+ kycStatus
140
+ __typename
141
+ }
142
+ }
143
+ """
144
+
145
+ USER_SESSIONS = """
146
+ query UserSessions {
147
+ user {
148
+ id
149
+ sessionList {
150
+ id
151
+ sessionName
152
+ ip
153
+ active
154
+ country
155
+ city
156
+ createdAt
157
+ updatedAt
158
+ __typename
159
+ }
160
+ __typename
161
+ }
162
+ }
163
+ """
164
+
165
+ USER_API_KEYS = """
166
+ query UserApiKeys {
167
+ user {
168
+ id
169
+ apiKeys {
170
+ id
171
+ ip
172
+ active
173
+ sessionName
174
+ type
175
+ createdAt
176
+ updatedAt
177
+ __typename
178
+ }
179
+ __typename
180
+ }
181
+ }
182
+ """
183
+
184
+ USER_STATISTIC = """
185
+ query UserStatistic {
186
+ user {
187
+ id
188
+ statistic {
189
+ id
190
+ betAmount
191
+ profit
192
+ amount
193
+ currency
194
+ __typename
195
+ }
196
+ __typename
197
+ }
198
+ }
199
+ """
200
+
201
+ USER_SEED_PAIR = """
202
+ query UserSeedPair {
203
+ user {
204
+ id
205
+ activeClientSeed {
206
+ id
207
+ seed
208
+ __typename
209
+ }
210
+ activeServerSeed {
211
+ id
212
+ nonce
213
+ seedHash
214
+ nextSeedHash
215
+ __typename
216
+ }
217
+ __typename
218
+ }
219
+ }
220
+ """
221
+
222
+ IS_USER_TFA_ENABLED = """
223
+ query IsUserTfaEnabled {
224
+ user {
225
+ id
226
+ hasTfaEnabled
227
+ __typename
228
+ }
229
+ }
230
+ """
231
+
232
+ USER_PREFERENCES = """
233
+ query UserPreferences {
234
+ user {
235
+ id
236
+ preference {
237
+ __typename
238
+ }
239
+ __typename
240
+ }
241
+ }
242
+ """
243
+
244
+ USER_RECENT_GAME_LIST = """
245
+ query UserRecentGameList($limit: Int = 10) {
246
+ user {
247
+ id
248
+ recentGameList(limit: $limit) {
249
+ id
250
+ name
251
+ slug
252
+ __typename
253
+ }
254
+ __typename
255
+ }
256
+ }
257
+ """
258
+
259
+ # ═══════════════════════════════════════════════════════════════════
260
+ # VIP / RELOAD / FAUCET QUERIES [verified]
261
+ # ═══════════════════════════════════════════════════════════════════
262
+
263
+ VIP_META = """
264
+ query VipMeta {
265
+ user {
266
+ id
267
+ balances {
268
+ available {
269
+ amount
270
+ currency
271
+ __typename
272
+ }
273
+ __typename
274
+ }
275
+ reload: faucet {
276
+ id
277
+ active
278
+ value
279
+ claimInterval
280
+ lastClaim
281
+ expireAt
282
+ __typename
283
+ }
284
+ __typename
285
+ }
286
+ }
287
+ """
288
+
289
+ FAUCET = """
290
+ query Faucet {
291
+ user {
292
+ id
293
+ faucet {
294
+ id
295
+ active
296
+ value
297
+ claimInterval
298
+ lastClaim
299
+ expireAt
300
+ __typename
301
+ }
302
+ __typename
303
+ }
304
+ }
305
+ """
306
+
307
+ ACTIVE_RAKEBACK = """
308
+ query ActiveRakeback {
309
+ user {
310
+ id
311
+ rakeback {
312
+ id
313
+ __typename
314
+ }
315
+ __typename
316
+ }
317
+ }
318
+ """
319
+
320
+ TIP_LIMIT = """
321
+ query TipList($limit: Int = 20) {
322
+ user {
323
+ id
324
+ tipList(limit: $limit) {
325
+ id
326
+ amount
327
+ currency
328
+ user {
329
+ id
330
+ name
331
+ __typename
332
+ }
333
+ __typename
334
+ }
335
+ __typename
336
+ }
337
+ }
338
+ """
339
+
340
+ # ═══════════════════════════════════════════════════════════════════
341
+ # CURRENCY / CONFIG QUERIES [verified]
342
+ # ═══════════════════════════════════════════════════════════════════
343
+
344
+ CURRENCY_CONFIGURATION = """
345
+ query CurrencyConfiguration($isAcp: Boolean!) {
346
+ currencyConfiguration(isAcp: $isAcp) {
347
+ currencies {
348
+ name
349
+ rates {
350
+ currency
351
+ rate
352
+ __typename
353
+ }
354
+ __typename
355
+ }
356
+ launchedFiatCurrencies
357
+ displayFiatCurrencies
358
+ __typename
359
+ }
360
+ }
361
+ """
362
+
363
+ CURRENCY_NEW_CONVERSION_RATE = """
364
+ query CurrencyNewConversionRate(
365
+ $displayCurrencies: [FiatCurrencyEnum!]!
366
+ ) {
367
+ info {
368
+ currencies {
369
+ name
370
+ values(displayCurrencies: $displayCurrencies) {
371
+ currency
372
+ rate
373
+ __typename
374
+ }
375
+ __typename
376
+ }
377
+ __typename
378
+ }
379
+ }
380
+ """
381
+
382
+ # ═══════════════════════════════════════════════════════════════════
383
+ # BONUS / PROMO QUERIES [verified]
384
+ # ═══════════════════════════════════════════════════════════════════
385
+
386
+ BONUS_CODE_INFORMATION = """
387
+ query BonusCodeInformation($code: String!, $couponType: CouponType!) {
388
+ bonusCodeInformation(code: $code, couponType: $couponType) {
389
+ availabilityStatus
390
+ bonusValue
391
+ cryptoMultiplier
392
+ __typename
393
+ }
394
+ }
395
+ """
396
+
397
+ CAMPAIGN_LIST = """
398
+ query CampaignList {
399
+ raceList {
400
+ id
401
+ name
402
+ __typename
403
+ }
404
+ }
405
+ """
406
+
407
+ CAMPAIGN_BALANCES = """
408
+ query CampaignBalances {
409
+ user {
410
+ id
411
+ campaignBalances {
412
+ __typename
413
+ }
414
+ __typename
415
+ }
416
+ }
417
+ """
418
+
419
+ # ═══════════════════════════════════════════════════════════════════
420
+ # TRANSACTION / HISTORY QUERIES [verified]
421
+ # ═══════════════════════════════════════════════════════════════════
422
+
423
+ TRANSACTION = """
424
+ query Transaction($types: [TransactionTypeEnum!], $offset: Int, $limit: Int) {
425
+ user {
426
+ id
427
+ transaction(types: $types, offset: $offset, limit: $limit) {
428
+ id
429
+ amount
430
+ currency
431
+ type
432
+ createdAt
433
+ __typename
434
+ }
435
+ __typename
436
+ }
437
+ }
438
+ """
439
+
440
+ DEPOSIT_LIST = """
441
+ query DepositList($offset: Int, $limit: Int) {
442
+ user {
443
+ id
444
+ depositList(offset: $offset, limit: $limit) {
445
+ id
446
+ amount
447
+ currency
448
+ status
449
+ createdAt
450
+ __typename
451
+ }
452
+ __typename
453
+ }
454
+ }
455
+ """
456
+
457
+ WITHDRAWAL_LIST = """
458
+ query WithdrawalList($offset: Int, $limit: Int) {
459
+ user {
460
+ id
461
+ withdrawalList(offset: $offset, limit: $limit) {
462
+ id
463
+ amount
464
+ currency
465
+ status
466
+ createdAt
467
+ __typename
468
+ }
469
+ __typename
470
+ }
471
+ }
472
+ """
473
+
474
+ MY_BET_LIST = """
475
+ query MyBetList($limit: Int = 20) {
476
+ user {
477
+ id
478
+ chatList(limit: $limit) {
479
+ id
480
+ __typename
481
+ }
482
+ __typename
483
+ }
484
+ }
485
+ """
486
+
487
+ # ═══════════════════════════════════════════════════════════════════
488
+ # CASINO / GAME QUERIES [verified for Blackjack]
489
+ # ═══════════════════════════════════════════════════════════════════
490
+
491
+ BLACKJACK_ACTIVE_BET = """
492
+ query BlackjackActiveBet {
493
+ user {
494
+ id
495
+ activeCasinoBet(game: blackjack) {
496
+ id
497
+ active
498
+ nonce
499
+ payoutMultiplier
500
+ amountMultiplier
501
+ amount
502
+ payout
503
+ updatedAt
504
+ currency
505
+ game
506
+ clientSeed {
507
+ seed
508
+ __typename
509
+ }
510
+ serverSeed {
511
+ seedHash
512
+ __typename
513
+ }
514
+ user {
515
+ id
516
+ name
517
+ __typename
518
+ }
519
+ state {
520
+ ... on CasinoGameBlackjack {
521
+ player {
522
+ value
523
+ actions
524
+ cards {
525
+ rank
526
+ suit
527
+ __typename
528
+ }
529
+ __typename
530
+ }
531
+ dealer {
532
+ value
533
+ actions
534
+ cards {
535
+ rank
536
+ suit
537
+ __typename
538
+ }
539
+ __typename
540
+ }
541
+ }
542
+ }
543
+ __typename
544
+ }
545
+ __typename
546
+ }
547
+ }
548
+ """
549
+
550
+ KURATOR_COLLECTION = """
551
+ query KuratorCollection($type: GameKuratorCollectionEnum!) {
552
+ kuratorCollection(type: $type) {
553
+ id
554
+ __typename
555
+ }
556
+ }
557
+ """
558
+
559
+ SLUG_KURATOR_GROUP = """
560
+ query SlugKuratorGroup($slug: String!) {
561
+ slugKuratorGroup(slug: $slug) {
562
+ id
563
+ name
564
+ slug
565
+ gameCount
566
+ __typename
567
+ }
568
+ }
569
+ """
570
+
571
+ # ═══════════════════════════════════════════════════════════════════
572
+ # SPORTS QUERIES [constructed — verified only for stake.com]
573
+ # ═══════════════════════════════════════════════════════════════════
574
+
575
+ SPORT_LIST_MENU = """
576
+ query SportListMenu {
577
+ sportList {
578
+ id
579
+ name
580
+ slug
581
+ __typename
582
+ }
583
+ }
584
+ """
585
+
586
+ # ═══════════════════════════════════════════════════════════════════
587
+ # RACE / SOCIAL / MISC QUERIES [constructed]
588
+ # ═══════════════════════════════════════════════════════════════════
589
+
590
+ ACTIVE_RACES = """
591
+ query ActiveRaces {
592
+ activeRaces {
593
+ id
594
+ name
595
+ startTime
596
+ endTime
597
+ type
598
+ currency
599
+ __typename
600
+ }
601
+ }
602
+ """
603
+
604
+ NOTIFICATION_LIST = """
605
+ query NotificationList($offset: Int, $limit: Int = 20) {
606
+ user {
607
+ id
608
+ notificationList(offset: $offset, limit: $limit) {
609
+ id
610
+ type
611
+ createdAt
612
+ __typename
613
+ }
614
+ __typename
615
+ }
616
+ }
617
+ """
618
+
619
+ PUBLIC_CHATS = """
620
+ query PublicChats {
621
+ chats {
622
+ id
623
+ __typename
624
+ }
625
+ }
626
+ """
627
+
628
+ BANNED_COUNTRIES = """
629
+ query BannedCountries {
630
+ info {
631
+ bannedCountries {
632
+ name
633
+ value
634
+ __typename
635
+ }
636
+ __typename
637
+ }
638
+ }
639
+ """
640
+
641
+ PLAYER_COUNT_BY_SCOPE = """
642
+ query PlayerCountByScope {
643
+ playerCountByScope {
644
+ __typename
645
+ }
646
+ }
647
+ """
648
+
649
+ FEATURE_FLAG_DETAILS = """
650
+ query FeatureFlagDetails {
651
+ featureFlagList {
652
+ name
653
+ __typename
654
+ }
655
+ }
656
+ """
657
+
658
+ # ═══════════════════════════════════════════════════════════════════
659
+ # MUTATIONS — BONUS / FAUCET / RAKEBACK [verified]
660
+ # ═══════════════════════════════════════════════════════════════════
661
+
662
+ CLAIM_CONDITION_BONUS_CODE = """
663
+ mutation ClaimConditionBonusCode(
664
+ $code: String!,
665
+ $currency: CurrencyEnum!,
666
+ $turnstileToken: String!
667
+ ) {
668
+ claimConditionBonusCode(
669
+ code: $code,
670
+ currency: $currency,
671
+ turnstileToken: $turnstileToken
672
+ ) {
673
+ bonusCode {
674
+ id
675
+ code
676
+ __typename
677
+ }
678
+ amount
679
+ currency
680
+ user {
681
+ id
682
+ balances {
683
+ available {
684
+ amount
685
+ currency
686
+ __typename
687
+ }
688
+ __typename
689
+ }
690
+ __typename
691
+ }
692
+ __typename
693
+ }
694
+ }
695
+ """
696
+
697
+ CLAIM_FAUCET = """
698
+ mutation ClaimFaucet($currency: CurrencyEnum!, $turnstileToken: String!) {
699
+ claimFaucet(currency: $currency, turnstileToken: $turnstileToken) {
700
+ faucet {
701
+ id
702
+ active
703
+ value
704
+ claimInterval
705
+ lastClaim
706
+ expireAt
707
+ __typename
708
+ }
709
+ __typename
710
+ }
711
+ }
712
+ """
713
+
714
+ CLAIM_RAKEBACK = """
715
+ mutation ClaimRakeback {
716
+ claimRakeback {
717
+ amount
718
+ currency
719
+ user {
720
+ id
721
+ balances {
722
+ available {
723
+ amount
724
+ currency
725
+ __typename
726
+ }
727
+ __typename
728
+ }
729
+ __typename
730
+ }
731
+ __typename
732
+ }
733
+ }
734
+ """
735
+
736
+ # ═══════════════════════════════════════════════════════════════════
737
+ # MUTATIONS — VAULT [verified]
738
+ # ═══════════════════════════════════════════════════════════════════
739
+
740
+ CREATE_VAULT_DEPOSIT = """
741
+ mutation CreateVaultDeposit($currency: CurrencyEnum!, $amount: Float!) {
742
+ createVaultDeposit(currency: $currency, amount: $amount) {
743
+ id
744
+ amount
745
+ currency
746
+ user {
747
+ id
748
+ balances {
749
+ available {
750
+ amount
751
+ currency
752
+ }
753
+ vault {
754
+ amount
755
+ currency
756
+ }
757
+ }
758
+ __typename
759
+ }
760
+ __typename
761
+ }
762
+ }
763
+ """
764
+
765
+ # ═══════════════════════════════════════════════════════════════════
766
+ # MUTATIONS — SEED [verified]
767
+ # ═══════════════════════════════════════════════════════════════════
768
+
769
+ ROTATE_SEED_PAIR = """
770
+ mutation RotateSeedPair($seed: String!) {
771
+ rotateSeedPair(seed: $seed) {
772
+ clientSeed {
773
+ user {
774
+ id
775
+ activeClientSeed {
776
+ id
777
+ seed
778
+ __typename
779
+ }
780
+ activeServerSeed {
781
+ id
782
+ nonce
783
+ seedHash
784
+ nextSeedHash
785
+ __typename
786
+ }
787
+ __typename
788
+ }
789
+ __typename
790
+ }
791
+ __typename
792
+ }
793
+ }
794
+ """
795
+
796
+ # ═══════════════════════════════════════════════════════════════════
797
+ # MUTATIONS — BLACKJACK [verified — from wen-bj-bot]
798
+ # ═══════════════════════════════════════════════════════════════════
799
+
800
+ BLACKJACK_BET = """
801
+ mutation BlackjackBet(
802
+ $amount: Float!,
803
+ $currency: CurrencyEnum!,
804
+ $identifier: String!
805
+ ) {
806
+ blackjackBet(
807
+ amount: $amount,
808
+ currency: $currency,
809
+ identifier: $identifier
810
+ ) {
811
+ id
812
+ active
813
+ nonce
814
+ payoutMultiplier
815
+ amountMultiplier
816
+ amount
817
+ payout
818
+ updatedAt
819
+ currency
820
+ game
821
+ clientSeed {
822
+ seed
823
+ __typename
824
+ }
825
+ serverSeed {
826
+ seedHash
827
+ __typename
828
+ }
829
+ user {
830
+ id
831
+ name
832
+ __typename
833
+ }
834
+ state {
835
+ ... on CasinoGameBlackjack {
836
+ player {
837
+ value
838
+ actions
839
+ cards {
840
+ rank
841
+ suit
842
+ __typename
843
+ }
844
+ __typename
845
+ }
846
+ dealer {
847
+ value
848
+ actions
849
+ cards {
850
+ rank
851
+ suit
852
+ __typename
853
+ }
854
+ __typename
855
+ }
856
+ }
857
+ }
858
+ __typename
859
+ }
860
+ }
861
+ """
862
+
863
+ BLACKJACK_NEXT = """
864
+ mutation BlackjackNext($action: BlackjackNextActionInput!, $identifier: String!) {
865
+ blackjackNext(action: $action, identifier: $identifier) {
866
+ id
867
+ active
868
+ nonce
869
+ payoutMultiplier
870
+ amountMultiplier
871
+ amount
872
+ payout
873
+ updatedAt
874
+ currency
875
+ game
876
+ clientSeed {
877
+ seed
878
+ __typename
879
+ }
880
+ serverSeed {
881
+ seedHash
882
+ __typename
883
+ }
884
+ user {
885
+ id
886
+ name
887
+ __typename
888
+ }
889
+ state {
890
+ ... on CasinoGameBlackjack {
891
+ player {
892
+ value
893
+ actions
894
+ cards {
895
+ rank
896
+ suit
897
+ __typename
898
+ }
899
+ __typename
900
+ }
901
+ dealer {
902
+ value
903
+ actions
904
+ cards {
905
+ rank
906
+ suit
907
+ __typename
908
+ }
909
+ __typename
910
+ }
911
+ }
912
+ }
913
+ __typename
914
+ }
915
+ }
916
+ """