@series-inc/venus-sdk 3.0.4 → 3.0.6

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.
@@ -56,7 +56,6 @@ declare class RpcClient {
56
56
  private addPendingCall;
57
57
  private removePendingCall;
58
58
  private getPendingCall;
59
- private generateId;
60
59
  private handleRpcResponse;
61
60
  private handleRpcNotification;
62
61
  }
@@ -392,12 +391,12 @@ interface Recipe {
392
391
  }
393
392
  interface TriggerRecipeChainOptions {
394
393
  roomId?: string;
395
- context?: any;
394
+ context?: Record<string, unknown>;
396
395
  }
397
396
  interface CollectRecipeResult {
398
397
  success: boolean;
399
398
  runId: string;
400
- rewards: any;
399
+ rewards: Record<string, unknown>;
401
400
  message: string;
402
401
  }
403
402
  interface ExecuteScopedRecipeResult {
@@ -417,28 +416,265 @@ interface GetBatchRecipeRequirements {
417
416
  success: boolean;
418
417
  results: RecipeRequirementResult[];
419
418
  }
419
+ interface SimulationPersonalState {
420
+ inventory: Record<string, number | string>;
421
+ activeRuns: SimulationRunSummary[];
422
+ disabledRecipes: string[];
423
+ }
424
+ interface SimulationRoomActiveRecipe {
425
+ recipeId: string;
426
+ scope: 'room' | 'actor';
427
+ startedAt: number;
428
+ expiresAt: number;
429
+ commitmentEndsAt?: number;
430
+ }
431
+ interface SimulationRoomState {
432
+ activeRecipes: Record<string, SimulationRoomActiveRecipe>;
433
+ sharedAssets: Record<string, number | string>;
434
+ actors: Array<Record<string, unknown>>;
435
+ activeRuns: SimulationRunSummary[];
436
+ }
437
+ type SimulationState = SimulationPersonalState | SimulationRoomState;
438
+ interface SimulationSlotContainer {
439
+ entityId: string;
440
+ slots: Record<string, unknown>;
441
+ isOwned: boolean;
442
+ powerCalculationRecipe?: string;
443
+ }
444
+ interface SimulationAvailableItem {
445
+ entityId: string;
446
+ quantity: number;
447
+ metadata: Record<string, unknown>;
448
+ tags: string[];
449
+ isCompatible: boolean;
450
+ }
451
+ interface SimulationSlotValidationResult {
452
+ valid: boolean;
453
+ error?: string;
454
+ }
455
+ interface SimulationAssignment {
456
+ id: string;
457
+ containerId: string;
458
+ slotId: string;
459
+ itemId: string | null;
460
+ profileId: string;
461
+ appId: string;
462
+ createdAt: number;
463
+ metadata?: Record<string, unknown>;
464
+ }
465
+ interface SimulationSlotMutationResult {
466
+ success: boolean;
467
+ error?: string;
468
+ association?: SimulationAssignment;
469
+ }
470
+ interface SimulationBatchOperationAssign {
471
+ type: 'assign';
472
+ containerId: string;
473
+ slotId: string;
474
+ itemId: string;
475
+ }
476
+ interface SimulationBatchOperationRemove {
477
+ type: 'remove';
478
+ containerId: string;
479
+ slotId: string;
480
+ itemId?: string;
481
+ }
482
+ type SimulationBatchOperation = SimulationBatchOperationAssign | SimulationBatchOperationRemove;
483
+ interface SimulationBatchOperationResult {
484
+ success: boolean;
485
+ error?: string;
486
+ association?: SimulationAssignment;
487
+ operation: SimulationBatchOperation;
488
+ }
489
+ interface SimulationBatchOperationsResult {
490
+ success: boolean;
491
+ results: SimulationBatchOperationResult[];
492
+ affectedContainers: string[];
493
+ }
494
+ interface SimulationPowerPreview {
495
+ currentPower: number;
496
+ previewPower: number;
497
+ powerDelta: number;
498
+ breakdown: Record<string, number>;
499
+ }
500
+ interface ExecuteRecipeResponse {
501
+ success: boolean;
502
+ status?: string;
503
+ runId?: string;
504
+ expiresAt?: string;
505
+ queuePosition?: number;
506
+ outputs?: Record<string, number | string>;
507
+ data?: Record<string, unknown>;
508
+ message?: string;
509
+ amountRequested?: number;
510
+ amountFulfilled?: number;
511
+ partialSuccess?: boolean;
512
+ }
420
513
  interface SimulationApi {
421
- getStateAsync(roomId?: string): Promise<any>;
514
+ isEnabled(): boolean;
515
+ getStateAsync(roomId?: string): Promise<SimulationState>;
422
516
  getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
423
- executeRecipeAsync(recipeId: string, inputs?: any, options?: ExecuteRecipeOptions): Promise<any>;
424
- getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<any>;
517
+ executeRecipeAsync(recipeId: string, inputs?: Record<string, unknown>, options?: ExecuteRecipeOptions): Promise<ExecuteRecipeResponse>;
518
+ getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<SimulationRunSummary[]>;
425
519
  collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
426
- executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: any, options?: ExecuteScopedRecipeOptions | any): Promise<ExecuteScopedRecipeResult>;
427
- triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<any>;
520
+ executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, unknown>, options?: ExecuteScopedRecipeOptions): Promise<ExecuteScopedRecipeResult>;
521
+ triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<ExecuteRecipeResponse>;
428
522
  getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
429
523
  getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
430
524
  getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
431
- resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
432
- getEntityMetadataAsync(entityId: string): Promise<any>;
433
- getSlotContainersAsync(): Promise<any>;
434
- getSlotAssignmentsAsync(containerId: string): Promise<any>;
435
- assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
436
- removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
437
- getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
438
- calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
439
- validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
440
- executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
441
- sumContributions(contributions: Record<string, any>): Record<string, number>;
525
+ resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<unknown>;
526
+ getEntityMetadataAsync(entityId: string): Promise<Record<string, unknown>>;
527
+ getSlotContainersAsync(): Promise<SimulationSlotContainer[]>;
528
+ getSlotAssignmentsAsync(containerId: string): Promise<SimulationAssignment[]>;
529
+ assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotMutationResult>;
530
+ removeItemFromSlotAsync(containerId: string, slotId: string): Promise<SimulationSlotMutationResult>;
531
+ getAvailableItemsAsync(containerId: string, slotId: string): Promise<SimulationAvailableItem[]>;
532
+ calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<SimulationPowerPreview>;
533
+ validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotValidationResult>;
534
+ executeBatchOperationsAsync(operations: Array<SimulationBatchOperation>, validateOnly?: boolean): Promise<SimulationBatchOperationsResult>;
535
+ subscribeAsync(options: SimulationSubscribeOptions): Promise<() => void>;
536
+ }
537
+
538
+ interface VenusRoomPayload extends Record<string, unknown> {
539
+ id: string;
540
+ name?: string;
541
+ currentPlayers?: string[];
542
+ maxPlayers?: number;
543
+ gameType?: string;
544
+ appId?: string;
545
+ type?: string;
546
+ createdBy?: string;
547
+ createdAt?: number;
548
+ updatedAt?: number;
549
+ isPrivate?: boolean;
550
+ status?: string;
551
+ customMetadata?: Record<string, unknown>;
552
+ admins?: string[];
553
+ roomCode?: string;
554
+ description?: string;
555
+ data?: Record<string, unknown>;
556
+ version?: string;
557
+ }
558
+ declare class VenusRoom {
559
+ readonly id: string;
560
+ name?: string;
561
+ players: string[];
562
+ maxPlayers?: number;
563
+ gameType?: string;
564
+ appId?: string;
565
+ type?: string;
566
+ createdBy?: string;
567
+ createdAt?: number;
568
+ updatedAt?: number;
569
+ isPrivate?: boolean;
570
+ status?: string;
571
+ customMetadata: Record<string, unknown>;
572
+ admins: string[];
573
+ roomCode?: string;
574
+ description?: string;
575
+ data: Record<string, unknown>;
576
+ version?: string;
577
+ constructor(roomData: VenusRoomPayload);
578
+ }
579
+
580
+ interface CreateRoomOptions {
581
+ maxPlayers?: number;
582
+ gameType?: string;
583
+ isPrivate?: boolean;
584
+ roomCode?: string;
585
+ name?: string;
586
+ description?: string;
587
+ customMetadata?: Record<string, unknown>;
588
+ data?: Record<string, unknown>;
589
+ }
590
+ interface JoinRoomMatchCriteria {
591
+ isPrivate?: boolean;
592
+ hasSpace?: boolean;
593
+ gameType?: string;
594
+ [key: string]: unknown;
595
+ }
596
+ interface JoinOrCreateRoomOptions {
597
+ matchCriteria?: JoinRoomMatchCriteria;
598
+ createOptions: CreateRoomOptions;
599
+ }
600
+ interface JoinOrCreateResult {
601
+ action: 'created' | 'joined';
602
+ room: VenusRoom;
603
+ playersJoined: number;
604
+ }
605
+ interface ListRoomsOptions {
606
+ includeArchived?: boolean;
607
+ }
608
+ interface RoomDataUpdate {
609
+ type: 'H5_ROOM_DATA_UPDATED';
610
+ roomId: string;
611
+ roomData: Record<string, unknown>;
612
+ timestamp?: number;
613
+ }
614
+ type RoomMessageEventType = 'H5_ROOM_MESSAGE_RECEIVED' | 'H5_ROOM_MESSAGE_UPDATED' | 'H5_ROOM_MESSAGE_DELETED';
615
+ interface RoomMessageEvent {
616
+ type: RoomMessageEventType;
617
+ roomId: string;
618
+ message: Record<string, unknown>;
619
+ timestamp?: number;
620
+ }
621
+ interface ProposedMoveEvent {
622
+ type: 'app:h5:proposedMoveValidationUpdated';
623
+ roomId: string;
624
+ proposedMoveData: Record<string, unknown>;
625
+ proposedMoveId?: string;
626
+ changeType?: string;
627
+ timestamp?: number;
628
+ }
629
+ interface RoomSubscriptionOptions {
630
+ onData?: (event: RoomDataUpdate) => void;
631
+ onMessages?: (event: RoomMessageEvent) => void;
632
+ onGameEvents?: (event: ProposedMoveEvent) => void;
633
+ }
634
+ interface ProposeMoveRequest {
635
+ gameSpecificState: Record<string, unknown>;
636
+ moveType: string;
637
+ clientContext?: Record<string, unknown>;
638
+ clientProposalId?: string;
639
+ }
640
+ interface ProposeMoveResult {
641
+ proposedMoveId: string;
642
+ }
643
+ interface ValidateMoveVerdict {
644
+ isValid: boolean;
645
+ reason?: string | null;
646
+ validatorId?: string | null;
647
+ }
648
+ interface ValidateMoveResult {
649
+ success: boolean;
650
+ moveId: string;
651
+ isValid: boolean;
652
+ reason?: string | null;
653
+ }
654
+ interface UpdateRoomDataOptions {
655
+ merge?: boolean;
656
+ }
657
+ interface RoomMessageRequest {
658
+ message: Record<string, unknown>;
659
+ metadata?: Record<string, unknown>;
660
+ }
661
+ interface StartRoomGameOptions {
662
+ gameConfig?: Record<string, unknown>;
663
+ turnOrder?: string[] | null;
664
+ }
665
+ interface RoomsApi {
666
+ createRoomAsync(options: CreateRoomOptions): Promise<VenusRoom>;
667
+ joinOrCreateRoomAsync(options: JoinOrCreateRoomOptions): Promise<JoinOrCreateResult>;
668
+ joinRoomByCodeAsync(roomCode: string): Promise<VenusRoom>;
669
+ getUserRoomsAsync(options?: ListRoomsOptions): Promise<VenusRoom[]>;
670
+ subscribeAsync(room: VenusRoom, options?: RoomSubscriptionOptions): Promise<() => void>;
671
+ updateRoomDataAsync(room: VenusRoom, updates: Record<string, unknown>, options?: UpdateRoomDataOptions): Promise<void>;
672
+ getRoomDataAsync(room: VenusRoom): Promise<Record<string, unknown>>;
673
+ sendRoomMessageAsync(room: VenusRoom, message: RoomMessageRequest): Promise<string>;
674
+ leaveRoomAsync(room: VenusRoom): Promise<void>;
675
+ startRoomGameAsync(room: VenusRoom, options?: StartRoomGameOptions): Promise<void>;
676
+ proposeMoveAsync(room: VenusRoom, request: ProposeMoveRequest): Promise<ProposeMoveResult>;
677
+ validateMoveAsync(room: VenusRoom, moveId: string, verdict: ValidateMoveVerdict): Promise<ValidateMoveResult>;
442
678
  }
443
679
 
444
680
  interface VenusMessage {
@@ -529,83 +765,6 @@ declare class VenusTransport implements RpcTransport {
529
765
  private notifyVenusMessageReceived;
530
766
  }
531
767
 
532
- declare class VenusRoom {
533
- readonly id: string;
534
- name: string;
535
- players: any[];
536
- maxPlayers: number;
537
- gameType: string;
538
- appId: string;
539
- type: any;
540
- createdBy: string;
541
- createdAt: number;
542
- updatedAt: number;
543
- isPrivate: boolean;
544
- currentPlayers: string[];
545
- status: any;
546
- customMetadata: Record<string, any>;
547
- admins: string[];
548
- roomCode: string;
549
- description: string;
550
- data: Record<string, any>;
551
- version: string;
552
- private _subscriptions;
553
- constructor(roomData: any);
554
- private updateFromRoomData;
555
- }
556
-
557
- interface CreateRoomOptions {
558
- maxPlayers?: number;
559
- gameType?: string;
560
- isPrivate?: boolean;
561
- roomCode?: string;
562
- name?: string;
563
- description?: string;
564
- customMetadata?: Record<string, any>;
565
- }
566
- interface JoinOrCreateResult {
567
- action: 'created' | 'joined';
568
- room: VenusRoom;
569
- playersJoined: number;
570
- }
571
- interface RoomSubscriptionOptions {
572
- onData?: (roomData: any) => void;
573
- onMessages?: (messagePayload: any) => void;
574
- onMoves?: (movePayload: any) => void;
575
- onGameEvents?: (eventPayload: any) => void;
576
- }
577
- interface ProposeMovePayload {
578
- gameSpecificState: any;
579
- moveType: string;
580
- clientContext?: Record<string, any>;
581
- clientProposalId?: string;
582
- }
583
- interface ProposeMoveResult {
584
- proposedMoveId: string;
585
- }
586
- interface ValidateMoveResult {
587
- success: boolean;
588
- moveId: string;
589
- isValid: boolean;
590
- reason?: string | null;
591
- }
592
- interface RoomsApi {
593
- createRoom(options: CreateRoomOptions): Promise<VenusRoom>;
594
- joinOrCreateRoom(options: CreateRoomOptions): Promise<JoinOrCreateResult>;
595
- joinRoomByCode?(roomCode: string): Promise<VenusRoom>;
596
- getUserRooms?(includeArchived?: boolean): Promise<VenusRoom[]>;
597
- subscribe?(room: VenusRoom, options: RoomSubscriptionOptions): (() => void) | {
598
- unsubscribe(): void;
599
- };
600
- updateData?(room: VenusRoom, updates: Record<string, any>, merge?: boolean): Promise<any>;
601
- getData?(room: VenusRoom): Promise<any>;
602
- sendMessage?(room: VenusRoom, messageData: any): Promise<string>;
603
- leave?(room: VenusRoom): Promise<any>;
604
- startGame?(room: VenusRoom, gameConfig?: Record<string, any>, turnOrder?: string[] | null): Promise<any>;
605
- proposeMove?(room: VenusRoom, proposalPayload: ProposeMovePayload): Promise<ProposeMoveResult>;
606
- validateMove?(room: VenusRoom, moveId: string, isValid: boolean, reason?: string | null, validatorId?: string | null): Promise<ValidateMoveResult>;
607
- }
608
-
609
768
  interface LoggingApi {
610
769
  logDebug(message: string, ...args: any[]): void;
611
770
  logError(message: string, ...args: any[]): void;
@@ -668,25 +827,29 @@ interface LeaderboardConfig {
668
827
  maxDurationSec: number;
669
828
  minScore: number;
670
829
  maxScore: number;
671
- requiresHash: boolean;
672
- scoringFields: string[];
830
+ requiresToken: boolean;
831
+ enableScoreSealing: boolean;
832
+ scoreSealingSecret?: string;
673
833
  modes: Record<string, LeaderboardModeConfig>;
674
834
  periods: Record<string, LeaderboardPeriodConfig>;
675
835
  antiCheat: LeaderboardAntiCheatConfig;
676
836
  displaySettings: LeaderboardDisplaySettings;
677
837
  }
678
- interface StartRunResult {
679
- sessionId: string;
838
+ interface ScoreToken {
839
+ token: string;
680
840
  startTime: number;
681
841
  expiresAt: number;
682
- hashNonce?: string | null;
842
+ sealingNonce?: string | null;
843
+ sealingSecret?: string | null;
683
844
  mode: string;
684
845
  }
685
- interface SubmitScoreOptions {
846
+ interface SubmitScoreParams {
847
+ token?: string;
848
+ score: number;
849
+ duration: number;
686
850
  mode?: string;
687
851
  telemetry?: Record<string, any>;
688
852
  metadata?: Record<string, any>;
689
- hash?: string;
690
853
  }
691
854
  interface SubmitScoreResult {
692
855
  accepted: boolean;
@@ -694,7 +857,7 @@ interface SubmitScoreResult {
694
857
  zScore?: number | null;
695
858
  isAnomaly?: boolean;
696
859
  }
697
- interface GetLeaderboardOptions {
860
+ interface GetPagedScoresOptions {
698
861
  mode?: string;
699
862
  period?: string;
700
863
  periodDate?: number | string;
@@ -710,9 +873,9 @@ interface LeaderboardEntry {
710
873
  username: string;
711
874
  avatarUrl: string | null;
712
875
  score: number;
713
- durationSec: number;
876
+ duration: number;
714
877
  submittedAt: number;
715
- sessionId?: string;
878
+ token?: string;
716
879
  rank: number | null;
717
880
  zScore?: number | null;
718
881
  isAnomaly?: boolean;
@@ -722,7 +885,7 @@ interface LeaderboardEntry {
722
885
  metadata?: Record<string, any> | null;
723
886
  isSeed?: boolean;
724
887
  }
725
- interface LeaderboardResponse {
888
+ interface PagedScoresResponse {
726
889
  variant: 'standard' | 'highlight';
727
890
  entries: LeaderboardEntry[];
728
891
  totalEntries: number;
@@ -730,12 +893,12 @@ interface LeaderboardResponse {
730
893
  playerRank: number | null;
731
894
  periodInstance: string;
732
895
  }
733
- interface PlayerStatsOptions {
896
+ interface PlayerRankOptions {
734
897
  mode?: string;
735
898
  period?: string;
736
899
  periodDate?: number | string;
737
900
  }
738
- interface PlayerStats {
901
+ interface PlayerRankResult {
739
902
  rank: number | null;
740
903
  score?: number;
741
904
  totalPlayers: number;
@@ -743,7 +906,7 @@ interface PlayerStats {
743
906
  trustScore: number;
744
907
  periodInstance: string;
745
908
  }
746
- interface LeaderboardHighlightContext {
909
+ interface PodiumScoresContext {
747
910
  topEntries: LeaderboardEntry[];
748
911
  beforePlayer: LeaderboardEntry[];
749
912
  playerEntry?: LeaderboardEntry | null;
@@ -753,18 +916,18 @@ interface LeaderboardHighlightContext {
753
916
  omittedBefore: number;
754
917
  omittedAfter: number;
755
918
  }
756
- interface LeaderboardHighlightResponse extends LeaderboardResponse {
919
+ interface PodiumScoresResponse extends PagedScoresResponse {
757
920
  variant: 'highlight';
758
- context: LeaderboardHighlightContext;
921
+ context: PodiumScoresContext;
759
922
  }
760
- interface LeaderboardHighlightOptions extends Omit<GetLeaderboardOptions, 'variant'> {
923
+ interface GetPodiumScoresOptions extends Omit<GetPagedScoresOptions, 'variant'> {
761
924
  }
762
925
  interface LeaderboardApi {
763
- startRun(mode?: string): Promise<StartRunResult>;
764
- submitScore(sessionId: string, score: number, durationSec: number, options?: SubmitScoreOptions): Promise<SubmitScoreResult>;
765
- getLeaderboard(options?: GetLeaderboardOptions): Promise<LeaderboardResponse>;
766
- getPlayerStats(options?: PlayerStatsOptions): Promise<PlayerStats>;
767
- getLeaderboardHighlight(options?: LeaderboardHighlightOptions): Promise<LeaderboardHighlightResponse>;
926
+ createScoreToken(mode?: string): Promise<ScoreToken>;
927
+ submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
928
+ getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
929
+ getMyRank(options?: PlayerRankOptions): Promise<PlayerRankResult>;
930
+ getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
768
931
  }
769
932
 
770
933
  interface PreloaderApi {
@@ -818,7 +981,7 @@ interface SocialApi {
818
981
  * - iOS / Android: opens the native share sheet.
819
982
  * - Web: copies the generated URL to the clipboard (with fallback toast).
820
983
  *
821
- * @param options.launchParams Arbitrary launch parameters (must include gameId).
984
+ * @param options.launchParams Arbitrary launch parameters for your game.
822
985
  * @param options.metadata Optional OpenGraph metadata for rich previews.
823
986
  * @returns The generated share URL.
824
987
  */
@@ -831,7 +994,7 @@ interface SocialApi {
831
994
  *
832
995
  * Games can render or print the returned QR image or re-use the share URL.
833
996
  *
834
- * @param options.launchParams Arbitrary launch parameters (must include gameId).
997
+ * @param options.launchParams Arbitrary launch parameters for your game.
835
998
  * @param options.metadata Optional OpenGraph metadata for the share.
836
999
  * @param options.qrOptions Customisation for the generated QR code.
837
1000
  * @returns The generated share URL and QR code (as a data URL).
@@ -982,23 +1145,72 @@ interface RecipeRequirementResult {
982
1145
  recipeId: string;
983
1146
  entity: string | null;
984
1147
  amount?: number;
985
- inputs: Record<string, any>;
1148
+ inputs: Record<string, number | string>;
986
1149
  canAfford: boolean;
987
1150
  disabled: boolean;
988
1151
  }
989
- interface VenusSimulationState {
990
- inventory: Record<string, number | string>;
1152
+ interface SimulationRunSummary {
1153
+ id: string;
1154
+ recipeId: string;
1155
+ status: string;
1156
+ startTime: number;
1157
+ expiresAt: number;
1158
+ entity?: string;
1159
+ inputs?: Record<string, number | string>;
1160
+ outputs?: Record<string, number | string>;
1161
+ commitmentEndsAt?: number;
1162
+ participantCount?: number;
1163
+ }
1164
+ type VenusSimulationStateResponse = SimulationPersonalState | SimulationRoomState;
1165
+ type SimulationUpdateType = 'entity' | 'activeRuns' | 'snapshot';
1166
+ interface SimulationUpdateBase {
1167
+ timestamp: number;
1168
+ reason?: 'recipe_completed' | 'auto_restart' | 'manual_update' | 'state_sync';
1169
+ }
1170
+ interface SimulationEntityUpdate extends SimulationUpdateBase {
1171
+ type: 'entity';
1172
+ entities: Array<{
1173
+ entityId: string;
1174
+ quantity: number | string;
1175
+ }>;
1176
+ }
1177
+ interface SimulationActiveRunsUpdate extends SimulationUpdateBase {
1178
+ type: 'activeRuns';
991
1179
  activeRuns: Array<{
992
1180
  id: string;
993
1181
  recipeId: string;
994
1182
  status: string;
995
1183
  startTime: number;
996
1184
  expiresAt: number;
1185
+ entity?: string;
997
1186
  inputs?: Record<string, number | string>;
998
1187
  outputs?: Record<string, number | string>;
1188
+ }>;
1189
+ }
1190
+ interface SimulationSnapshotUpdate extends SimulationUpdateBase {
1191
+ type: 'snapshot';
1192
+ entities?: Array<{
1193
+ entityId: string;
1194
+ quantity: number | string;
1195
+ }>;
1196
+ activeRuns?: Array<{
1197
+ id: string;
1198
+ recipeId: string;
1199
+ status: string;
1200
+ startTime: number;
1201
+ expiresAt: number;
999
1202
  entity?: string;
1203
+ inputs?: Record<string, number | string>;
1204
+ outputs?: Record<string, number | string>;
1000
1205
  }>;
1001
- disabledRecipes: string[];
1206
+ }
1207
+ type SimulationUpdateData = SimulationEntityUpdate | SimulationActiveRunsUpdate | SimulationSnapshotUpdate;
1208
+ interface SimulationSubscribeOptions {
1209
+ entities?: string[];
1210
+ tags?: string[];
1211
+ activeRuns?: boolean;
1212
+ roomId?: string;
1213
+ onUpdate: (data: SimulationUpdateData) => void;
1002
1214
  }
1003
1215
  interface VenusSimulationEffect {
1004
1216
  type: string;
@@ -1052,35 +1264,46 @@ interface RecipeRequirementQuery {
1052
1264
  interface BatchRecipeRequirementsResult {
1053
1265
  success: boolean;
1054
1266
  results: RecipeRequirementResult[];
1055
- errors?: Array<any>;
1267
+ errors?: Array<unknown>;
1056
1268
  }
1057
- interface VenusSimulationAPI {
1058
- isEnabled(): boolean;
1059
- getStateAsync(options?: {
1060
- roomId?: string;
1061
- }): Promise<VenusSimulationState>;
1062
- getConfigAsync(): Promise<VenusSimulationConfig>;
1063
- executeRecipeAsync(recipeId: string, inputs?: Record<string, any>, options?: any): Promise<any>;
1064
- executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, any>, roomId?: string, options?: any): Promise<any>;
1065
- getActiveRunsAsync(): Promise<any[]>;
1066
- collectRecipeAsync(runId: string): Promise<any>;
1067
- triggerRecipeChainAsync(triggerRecipeId: string, context?: any, roomId?: string): Promise<any>;
1068
- getRecipeRequirementsAsync(recipeId: string, entity?: string, amount?: number): Promise<RecipeRequirementResult>;
1069
- getBatchRecipeRequirementsAsync(queries: RecipeRequirementQuery[]): Promise<BatchRecipeRequirementsResult>;
1070
- getAvailableRecipesAsync(roomId?: string, includeActorRecipes?: boolean): Promise<Array<any>>;
1071
- resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
1072
- getEntityMetadataAsync(entityId: string): Promise<any>;
1073
- getSlotContainersAsync(): Promise<Array<any>>;
1074
- getSlotAssignmentsAsync(containerId: string): Promise<Array<any>>;
1075
- assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
1076
- removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
1077
- getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
1078
- calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
1079
- validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
1080
- executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
1081
- sumContributions(contributions: Record<string, any>): Record<string, number>;
1269
+ interface VenusExecuteRecipeOptions {
1270
+ roomId?: string;
1271
+ batchAmount?: number;
1272
+ allowPartialBatch?: boolean;
1273
+ entity?: string;
1274
+ }
1275
+ interface VenusExecuteScopedRecipeOptions {
1276
+ roomId?: string;
1277
+ }
1278
+ interface VenusAvailableRecipe {
1279
+ id: string;
1280
+ scope: string;
1281
+ clientViewable: boolean;
1282
+ }
1283
+ interface VenusCollectRecipeResult {
1284
+ success: boolean;
1285
+ runId: string;
1286
+ rewards: Record<string, unknown>;
1287
+ message: string;
1288
+ }
1289
+ interface VenusExecuteRecipeResult {
1290
+ success: boolean;
1291
+ status?: string;
1292
+ runId?: string;
1293
+ expiresAt?: string;
1294
+ queuePosition?: number;
1295
+ outputs?: Record<string, number | string>;
1296
+ data?: Record<string, unknown>;
1297
+ message?: string;
1298
+ amountRequested?: number;
1299
+ amountFulfilled?: number;
1300
+ partialSuccess?: boolean;
1082
1301
  }
1083
1302
  interface VenusConfig {
1303
+ /**
1304
+ * @deprecated Use VenusAPI.getLocale() and VenusAPI.getLanguageCode() instead. Will be removed in v4.0.0
1305
+ * TODO: Remove in SDK v4.0.0
1306
+ */
1084
1307
  user?: {
1085
1308
  id: string;
1086
1309
  username?: string;
@@ -1105,7 +1328,6 @@ interface VenusConfig {
1105
1328
  orientation: string;
1106
1329
  hapticsEnabled: boolean;
1107
1330
  };
1108
- theme?: Record<string, any>;
1109
1331
  environment?: {
1110
1332
  isDevelopment: boolean;
1111
1333
  platform: string;
@@ -1161,7 +1383,7 @@ interface VenusAPI {
1161
1383
  venus: any;
1162
1384
  };
1163
1385
  initializeAsync(options?: InitializationOptions): Promise<InitializationContext>;
1164
- simulation: VenusSimulationAPI;
1386
+ simulation: SimulationApi;
1165
1387
  leaderboard: LeaderboardApi;
1166
1388
  log(message: string, ...args: any[]): void;
1167
1389
  error(message: string, ...args: any[]): void;
@@ -1188,6 +1410,8 @@ interface VenusAPI {
1188
1410
  }): Promise<any>;
1189
1411
  getCurrentProfile(): Profile;
1190
1412
  getLaunchParams(): Record<string, string>;
1413
+ getLocale(): string;
1414
+ getLanguageCode(): string;
1191
1415
  /**
1192
1416
  * @deprecated Please use the popups API. (e.g, VenusAPI.popups)
1193
1417
  */
@@ -1320,7 +1544,7 @@ interface VenusAPI {
1320
1544
  isOptional?: boolean;
1321
1545
  }>>;
1322
1546
  cleanupAssets(): void;
1323
- assetLoader?: {
1547
+ assetLoader: {
1324
1548
  getCached(url: string): string | null;
1325
1549
  };
1326
1550
  showAvatar3dEditorAsync(options: {
@@ -1341,43 +1565,22 @@ interface VenusAPI {
1341
1565
  isInStack: boolean;
1342
1566
  stackPosition: number;
1343
1567
  };
1344
- rooms: {
1345
- create(options: any): Promise<VenusRoom>;
1346
- joinOrCreate(options: any): Promise<{
1347
- action: 'created' | 'joined';
1348
- room: VenusRoom;
1349
- playersJoined: number;
1350
- }>;
1351
- joinByCode(roomCode: string): Promise<VenusRoom>;
1352
- list(includeArchived?: boolean): Promise<VenusRoom[]>;
1353
- subscribeToRoom(room: VenusRoom, options: {
1354
- onData?: (event: any) => void;
1355
- onMessages?: (event: any) => void;
1356
- onMoves?: (event: any) => void;
1357
- onGameEvents?: (event: any) => void;
1358
- }): () => void;
1359
- proposeMove(room: VenusRoom, proposalPayload: {
1360
- gameSpecificState: any;
1361
- moveType: string;
1362
- clientContext?: Record<string, any>;
1363
- clientProposalId?: string;
1364
- }): Promise<{
1365
- proposedMoveId: string;
1366
- }>;
1367
- validateMove(room: VenusRoom, moveId: string, isValid: boolean, reason?: string, validatorId?: string): Promise<any>;
1368
- updateRoomData(room: VenusRoom, updates: any, merge?: boolean): Promise<any>;
1369
- getRoomData(room: VenusRoom): Promise<any>;
1370
- sendRoomMessage(room: VenusRoom, messageData: any): Promise<string>;
1371
- startRoomGame(room: VenusRoom, gameConfig?: any, turnOrder?: any): Promise<any>;
1372
- leaveRoom(room: VenusRoom): Promise<any>;
1373
- };
1568
+ rooms: RoomsApi;
1374
1569
  notifyCleanupComplete(): void;
1375
1570
  RoomEvents: {
1376
1571
  OPTIMISTIC_GAME_STATE_UPDATED: string;
1377
1572
  PROPOSED_MOVE_VALIDATION_UPDATED: string;
1378
1573
  };
1379
- numbers?: {
1380
- normalize(value: string | number): string;
1574
+ numbers: {
1575
+ isBigNumber(value: any): boolean;
1576
+ normalize(value: string | number | any): any;
1577
+ format: {
1578
+ incremental(value: any): string;
1579
+ };
1580
+ calculateGeometricSeriesCost(baseCost: number | string, multiplier: number, currentQuantity: number, purchaseAmount: number): any;
1581
+ calculateMaxAffordableDecimal(availableCash: number | string, baseCost: number | string, multiplier: number, currentQuantity: number): number;
1582
+ formatDecimalCurrency(decimalValue: any): string;
1583
+ Decimal: any;
1381
1584
  };
1382
1585
  iap: IapApi;
1383
1586
  cdn: CdnApi;
@@ -1406,4 +1609,4 @@ interface AdsApi {
1406
1609
  showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
1407
1610
  }
1408
1611
 
1409
- export { type Recipe as $, type AnalyticsApi as A, type Subscription as B, type CdnApi as C, type AwakeCallback as D, type Experiment as E, type FetchBlobOptions as F, type GetFutureTimeOptions as G, type Host as H, type PauseCallback as I, type ResumeCallback as J, type QuitCallback as K, type LifecycleApi as L, type SimulationApi as M, type NavigationApi as N, type VenusSimulationConfig as O, type PushAppOptions as P, type QuitOptions as Q, type RpcRequest as R, type StorageApi as S, type TimeApi as T, type ExecuteRecipeOptions as U, type VenusAPI as V, type CollectRecipeResult as W, type GetActiveRunsOptions as X, type ExecuteScopedRecipeResult as Y, type GetAvailableRecipesOptions as Z, type GetAvailableRecipesResult as _, type RpcResponse as a, type LeaderboardEntry as a$, type GetBatchRecipeRequirements as a0, type TriggerRecipeChainOptions as a1, type RecipeRequirementResult as a2, VenusTransport as a3, type LoggingApi as a4, type IapApi as a5, type SpendCurrencyOptions as a6, type LoadEmbeddedAssetsResponse as a7, type SharedAssetsApi as a8, type LeaderboardApi as a9, type AiMessage as aA, type Asset as aB, type Category as aC, MockAvatarApi as aD, type TimeIntervalTriggerInput as aE, type NotificationTriggerInput as aF, type OnRequestCallback as aG, type OnResponseCallback as aH, type OnNotificationCallback as aI, type RpcTransport as aJ, VenusRoom as aK, type CreateRoomOptions as aL, type JoinOrCreateResult as aM, type RoomSubscriptionOptions as aN, type ProposeMovePayload as aO, type ProposeMoveResult as aP, type ValidateMoveResult as aQ, type ExecuteScopedRecipeOptions as aR, type RecipeInfo as aS, RpcSharedAssetsApi as aT, type LoadEmbeddedAssetsRequest as aU, type LeaderboardModeConfig as aV, type LeaderboardPeriodType as aW, type LeaderboardPeriodConfig as aX, type LeaderboardAntiCheatConfig as aY, type LeaderboardDisplaySettings as aZ, type LeaderboardConfig as a_, type StartRunResult as aa, type SubmitScoreOptions as ab, type SubmitScoreResult as ac, type GetLeaderboardOptions as ad, type LeaderboardResponse as ae, type PlayerStatsOptions as af, type PlayerStats as ag, type LeaderboardHighlightOptions as ah, type LeaderboardHighlightResponse as ai, type PreloaderApi as aj, type SocialApi as ak, type ShareMetadata as al, type ShareLinkResult as am, type SocialQRCodeOptions as an, type QRCodeResult as ao, type Avatar3dApi as ap, type AssetManifest as aq, type Avatar3dConfig as ar, type ShowEditorOptions as as, type Avatar3dEdits as at, type AdsApi as au, type PostApi as av, type RoomsApi as aw, type InitializationOptions as ax, type InitializationContext as ay, type HudInsets as az, type RpcNotification as b, type LeaderboardHighlightContext as b0, createHost as b1, type VenusSimulationState as b2, type VenusSimulationEffect as b3, type VenusSimulationRecipe as b4, type RecipeRequirementQuery as b5, type BatchRecipeRequirementsResult as b6, type VenusSimulationAPI as b7, type VenusConfig as b8, type VenusRoomsConfig as b9, type ActionSheetOption as ba, RpcClient as c, type NavigationStackInfo as d, type NotificationsApi as e, type ScheduleLocalNotification as f, type ScheduleNotificationOptions as g, type PopupsApi as h, type ActionSheetItem as i, type ShowActionSheetOptions as j, type ShowAlertOptions as k, type ShowConfirmOptions as l, type ShowToastOptions as m, type ShowInterstitialAdOptions as n, type ShowRewardedAdOptions as o, type ProfileApi as p, type Profile as q, type SubPath as r, type ServerTimeData as s, type AiApi as t, type AiChatCompletionRequest as u, type AiChatCompletionData as v, type HapticsApi as w, HapticFeedbackStyle as x, type FeaturesApi as y, type SleepCallback as z };
1612
+ export { type SimulationSlotContainer as $, type AnalyticsApi as A, type Subscription as B, type CdnApi as C, type AwakeCallback as D, type Experiment as E, type FetchBlobOptions as F, type GetFutureTimeOptions as G, type Host as H, type PauseCallback as I, type ResumeCallback as J, type QuitCallback as K, type LifecycleApi as L, type SimulationApi as M, type NavigationApi as N, type SimulationSlotValidationResult as O, type PushAppOptions as P, type QuitOptions as Q, type RpcRequest as R, type StorageApi as S, type TimeApi as T, type SimulationSubscribeOptions as U, type VenusAPI as V, type SimulationBatchOperation as W, type SimulationBatchOperationsResult as X, type SimulationAvailableItem as Y, type SimulationPowerPreview as Z, type SimulationSlotMutationResult as _, type RpcResponse as a, type InitializationContext as a$, type SimulationAssignment as a0, type SimulationState as a1, type VenusSimulationConfig as a2, type ExecuteRecipeOptions as a3, type ExecuteRecipeResponse as a4, type CollectRecipeResult as a5, type GetActiveRunsOptions as a6, type SimulationRunSummary as a7, type ExecuteScopedRecipeOptions as a8, type ExecuteScopedRecipeResult as a9, type SpendCurrencyOptions as aA, type LoadEmbeddedAssetsResponse as aB, type SharedAssetsApi as aC, type LeaderboardApi as aD, type ScoreToken as aE, type SubmitScoreParams as aF, type SubmitScoreResult as aG, type GetPagedScoresOptions as aH, type PagedScoresResponse as aI, type PlayerRankOptions as aJ, type PlayerRankResult as aK, type GetPodiumScoresOptions as aL, type PodiumScoresResponse as aM, type PreloaderApi as aN, type SocialApi as aO, type ShareMetadata as aP, type ShareLinkResult as aQ, type SocialQRCodeOptions as aR, type QRCodeResult as aS, type Avatar3dApi as aT, type AssetManifest as aU, type Avatar3dConfig as aV, type ShowEditorOptions as aW, type Avatar3dEdits as aX, type AdsApi as aY, type PostApi as aZ, type InitializationOptions as a_, type GetAvailableRecipesOptions as aa, type GetAvailableRecipesResult as ab, type Recipe as ac, type RecipeRequirementResult as ad, type GetBatchRecipeRequirements as ae, type TriggerRecipeChainOptions as af, type RoomDataUpdate as ag, type RoomMessageEvent as ah, type ProposedMoveEvent as ai, VenusTransport as aj, type RoomsApi as ak, type CreateRoomOptions as al, VenusRoom as am, type JoinOrCreateRoomOptions as an, type JoinOrCreateResult as ao, type ListRoomsOptions as ap, type UpdateRoomDataOptions as aq, type RoomMessageRequest as ar, type StartRoomGameOptions as as, type ProposeMoveRequest as at, type ProposeMoveResult as au, type ValidateMoveVerdict as av, type ValidateMoveResult as aw, type RoomSubscriptionOptions as ax, type LoggingApi as ay, type IapApi as az, type RpcNotification as b, type HudInsets as b0, type AiMessage as b1, type Asset as b2, type Category as b3, MockAvatarApi as b4, type TimeIntervalTriggerInput as b5, type NotificationTriggerInput as b6, type OnRequestCallback as b7, type OnResponseCallback as b8, type OnNotificationCallback as b9, type SimulationSnapshotUpdate as bA, type SimulationUpdateData as bB, type VenusSimulationEffect as bC, type VenusSimulationRecipe as bD, type RecipeRequirementQuery as bE, type BatchRecipeRequirementsResult as bF, type VenusExecuteRecipeOptions as bG, type VenusExecuteScopedRecipeOptions as bH, type VenusAvailableRecipe as bI, type VenusCollectRecipeResult as bJ, type VenusExecuteRecipeResult as bK, type VenusConfig as bL, type VenusRoomsConfig as bM, type ActionSheetOption as bN, type RpcTransport as ba, type JoinRoomMatchCriteria as bb, type RoomMessageEventType as bc, type VenusRoomPayload as bd, type RecipeInfo as be, type SimulationPersonalState as bf, type SimulationRoomActiveRecipe as bg, type SimulationRoomState as bh, type SimulationBatchOperationAssign as bi, type SimulationBatchOperationRemove as bj, type SimulationBatchOperationResult as bk, RpcSharedAssetsApi as bl, type LoadEmbeddedAssetsRequest as bm, type LeaderboardModeConfig as bn, type LeaderboardPeriodType as bo, type LeaderboardPeriodConfig as bp, type LeaderboardAntiCheatConfig as bq, type LeaderboardDisplaySettings as br, type LeaderboardConfig as bs, type LeaderboardEntry as bt, type PodiumScoresContext as bu, createHost as bv, type VenusSimulationStateResponse as bw, type SimulationUpdateType as bx, type SimulationEntityUpdate as by, type SimulationActiveRunsUpdate as bz, RpcClient as c, type NavigationStackInfo as d, type NotificationsApi as e, type ScheduleLocalNotification as f, type ScheduleNotificationOptions as g, type PopupsApi as h, type ActionSheetItem as i, type ShowActionSheetOptions as j, type ShowAlertOptions as k, type ShowConfirmOptions as l, type ShowToastOptions as m, type ShowInterstitialAdOptions as n, type ShowRewardedAdOptions as o, type ProfileApi as p, type Profile as q, type SubPath as r, type ServerTimeData as s, type AiApi as t, type AiChatCompletionRequest as u, type AiChatCompletionData as v, type HapticsApi as w, HapticFeedbackStyle as x, type FeaturesApi as y, type SleepCallback as z };