@thestatic-tv/dcl-sdk 2.5.29 → 2.6.0

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/README.md CHANGED
@@ -41,11 +41,11 @@ export function main() {
41
41
 
42
42
  ## Example Scene
43
43
 
44
- Clone our starter scene to get up and running quickly:
44
+ Clone our free-tier starter scene to get up and running quickly ([thestatic-dcl-standard](https://github.com/thestatic-tv/thestatic-dcl-standard) and [thestatic-dcl-pro](https://github.com/thestatic-tv/thestatic-dcl-pro) are the Standard and Pro starters):
45
45
 
46
46
  ```bash
47
- git clone https://github.com/thestatic-tv/thestatic-dcl-starter.git
48
- cd thestatic-dcl-starter
47
+ git clone https://github.com/thestatic-tv/thestatic-dcl-free.git
48
+ cd thestatic-dcl-free
49
49
  npm install
50
50
  npm start
51
51
  ```
@@ -99,23 +99,33 @@ staticTV.guideUI.toggle()
99
99
  staticTV.chatUI.toggle()
100
100
  ```
101
101
 
102
+ ## In-world admin, chat and watch time (2.6.0)
103
+
104
+ The Admin Panel, Chat, the watch heartbeat and like/follow send DCL signed requests: Decentraland
105
+ signs each one as the player, and thestatic.tv checks that it came from the scene deployed where
106
+ your scene is registered. Set your scene's parcel (or its World name) on
107
+ [thestatic.tv/dashboard](https://thestatic.tv/dashboard) - without it, none of them work. Versions
108
+ before 2.6.0 named the player's wallet in the request instead, which the server no longer accepts:
109
+ update and redeploy your scene to keep them working. Chill to Earn credits the player who signed
110
+ the heartbeat; a guest's minutes count for the channel but earn nothing, and a guest cannot like
111
+ or follow.
112
+
102
113
  ## Pricing & Tiers
103
114
 
104
115
  See [thestatic.tv/info](https://thestatic.tv/info) for current pricing and tier features.
105
116
 
106
- All new keys include a **7-day free trial**.
117
+ New keys start on the free tier (session tracking, no expiry); Standard and Pro are paid upgrades.
107
118
 
108
119
  ## Documentation
109
120
 
110
121
  Full API reference and Pro tier features (Admin Panel, Custom Tabs) available at:
111
122
 
112
123
  - **Docs**: [thestatic.tv/info](https://thestatic.tv/info)
113
- - **Examples**: [github.com/thestatic-tv/thestatic-dcl-starter](https://github.com/thestatic-tv/thestatic-dcl-starter)
124
+ - **Examples**: [thestatic-dcl-free](https://github.com/thestatic-tv/thestatic-dcl-free), [thestatic-dcl-standard](https://github.com/thestatic-tv/thestatic-dcl-standard), [thestatic-dcl-pro](https://github.com/thestatic-tv/thestatic-dcl-pro)
114
125
 
115
126
  ## Support
116
127
 
117
- - Discord: [thestatic.tv Discord](https://discord.gg/thestatic)
118
- - Issues: [GitHub Issues](https://github.com/thestatic-tv/dcl-sdk/issues)
128
+ - Support: [thestatic.tv/support](https://thestatic.tv/support)
119
129
 
120
130
  ## License
121
131
 
package/dist/index.d.mts CHANGED
@@ -100,7 +100,7 @@ interface StaticTVConfig {
100
100
  */
101
101
  player?: PlayerData;
102
102
  /**
103
- * Custom boundary check function — overrides the SDK's auto-detected parcel bounds.
103
+ * Custom boundary check function - overrides the SDK's auto-detected parcel bounds.
104
104
  * Use this for L-shaped or irregular estates where the bounding box is too large.
105
105
  * Return true if the player is physically inside your scene, false if nearby but outside.
106
106
  * @example
@@ -185,6 +185,8 @@ interface SessionResponse {
185
185
  */
186
186
  interface HeartbeatResponse {
187
187
  success: boolean;
188
+ /** false when this player's last minute counted under a minute ago (a channel switch) */
189
+ counted?: boolean;
188
190
  channelSlug: string;
189
191
  sceneOwnerChannel: string;
190
192
  version: string;
@@ -555,7 +557,10 @@ declare class SessionModule {
555
557
  /**
556
558
  * Heartbeat module - track video watching metrics
557
559
  *
558
- * Only tracks when player is within scene bounds.
560
+ * Only tracks when player is within scene bounds. Each heartbeat is a DCL signed request (2.6.0):
561
+ * the explorer signs it as the player and thestatic.tv credits the minute - and any Sparks - to
562
+ * that proven wallet. It names no wallet: earlier versions sent one, and the server credited
563
+ * whichever account listed it.
559
564
  */
560
565
 
561
566
  declare class HeartbeatModule {
@@ -575,10 +580,6 @@ declare class HeartbeatModule {
575
580
  * Stop tracking video watching
576
581
  */
577
582
  stopWatching(): void;
578
- /**
579
- * Get player wallet - prioritize config, fallback to runtime detection
580
- */
581
- private getWallet;
582
583
  /**
583
584
  * Send a watching heartbeat (1 heartbeat = 1 minute watched)
584
585
  * Only sends if player is within scene bounds
@@ -596,6 +597,11 @@ declare class HeartbeatModule {
596
597
 
597
598
  /**
598
599
  * Interactions module - like/follow channels from DCL scenes
600
+ *
601
+ * Each is a DCL signed request (2.6.0): the explorer signs it as the player, and thestatic.tv
602
+ * records the like or follow for that proven wallet. It names no wallet: earlier versions sent
603
+ * one, and the server recorded the interaction for whichever wallet was named. Guests cannot
604
+ * like or follow.
599
605
  */
600
606
 
601
607
  declare class InteractionsModule {
@@ -702,7 +708,7 @@ declare class ChatUIModule {
702
708
  private config;
703
709
  private _isVisible;
704
710
  private _unreadCount;
705
- private idToken;
711
+ private authChecked;
706
712
  private isSigningIn;
707
713
  private isRegisteredUser;
708
714
  private currentUsername;
@@ -873,6 +879,13 @@ declare class AdminPanelUIModule {
873
879
  private stopStreamPolling;
874
880
  private startCommandPolling;
875
881
  private stopCommandPolling;
882
+ /**
883
+ * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
884
+ * explorer signs it with the player's identity, and the server checks the signature and that it
885
+ * came from the scene deployed at this scene's registered location. A wallet named in a query or
886
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
887
+ */
888
+ private signedRequest;
876
889
  private pollCommands;
877
890
  private fetchStreamData;
878
891
  private refreshStreamStatus;
@@ -1043,6 +1056,15 @@ declare class StaticTVClient {
1043
1056
  * @internal
1044
1057
  */
1045
1058
  request<T>(endpoint: string, options?: RequestInit): Promise<T>;
1059
+ /**
1060
+ * Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
1061
+ * it to that proven wallet and checks it came from this scene - never a wallet the request names.
1062
+ * @internal
1063
+ */
1064
+ signedRequest<T>(endpoint: string, init?: {
1065
+ method?: string;
1066
+ body?: string;
1067
+ }): Promise<T>;
1046
1068
  /**
1047
1069
  * Log a debug message (only when debug: true)
1048
1070
  * @internal
@@ -1179,6 +1201,12 @@ declare class StaticTVClient {
1179
1201
  * Enables modules based on tier level
1180
1202
  * @internal
1181
1203
  */
1204
+ /**
1205
+ * The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
1206
+ * dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
1207
+ * request came from the scene deployed at that scene's registered location.
1208
+ */
1209
+ getSceneId(): string | undefined;
1182
1210
  _enableFeaturesForTier(tier: SDKTier, keyId?: string | null): void;
1183
1211
  /**
1184
1212
  * @deprecated Use `_enableFeaturesForTier` instead
package/dist/index.d.ts CHANGED
@@ -100,7 +100,7 @@ interface StaticTVConfig {
100
100
  */
101
101
  player?: PlayerData;
102
102
  /**
103
- * Custom boundary check function — overrides the SDK's auto-detected parcel bounds.
103
+ * Custom boundary check function - overrides the SDK's auto-detected parcel bounds.
104
104
  * Use this for L-shaped or irregular estates where the bounding box is too large.
105
105
  * Return true if the player is physically inside your scene, false if nearby but outside.
106
106
  * @example
@@ -185,6 +185,8 @@ interface SessionResponse {
185
185
  */
186
186
  interface HeartbeatResponse {
187
187
  success: boolean;
188
+ /** false when this player's last minute counted under a minute ago (a channel switch) */
189
+ counted?: boolean;
188
190
  channelSlug: string;
189
191
  sceneOwnerChannel: string;
190
192
  version: string;
@@ -555,7 +557,10 @@ declare class SessionModule {
555
557
  /**
556
558
  * Heartbeat module - track video watching metrics
557
559
  *
558
- * Only tracks when player is within scene bounds.
560
+ * Only tracks when player is within scene bounds. Each heartbeat is a DCL signed request (2.6.0):
561
+ * the explorer signs it as the player and thestatic.tv credits the minute - and any Sparks - to
562
+ * that proven wallet. It names no wallet: earlier versions sent one, and the server credited
563
+ * whichever account listed it.
559
564
  */
560
565
 
561
566
  declare class HeartbeatModule {
@@ -575,10 +580,6 @@ declare class HeartbeatModule {
575
580
  * Stop tracking video watching
576
581
  */
577
582
  stopWatching(): void;
578
- /**
579
- * Get player wallet - prioritize config, fallback to runtime detection
580
- */
581
- private getWallet;
582
583
  /**
583
584
  * Send a watching heartbeat (1 heartbeat = 1 minute watched)
584
585
  * Only sends if player is within scene bounds
@@ -596,6 +597,11 @@ declare class HeartbeatModule {
596
597
 
597
598
  /**
598
599
  * Interactions module - like/follow channels from DCL scenes
600
+ *
601
+ * Each is a DCL signed request (2.6.0): the explorer signs it as the player, and thestatic.tv
602
+ * records the like or follow for that proven wallet. It names no wallet: earlier versions sent
603
+ * one, and the server recorded the interaction for whichever wallet was named. Guests cannot
604
+ * like or follow.
599
605
  */
600
606
 
601
607
  declare class InteractionsModule {
@@ -702,7 +708,7 @@ declare class ChatUIModule {
702
708
  private config;
703
709
  private _isVisible;
704
710
  private _unreadCount;
705
- private idToken;
711
+ private authChecked;
706
712
  private isSigningIn;
707
713
  private isRegisteredUser;
708
714
  private currentUsername;
@@ -873,6 +879,13 @@ declare class AdminPanelUIModule {
873
879
  private stopStreamPolling;
874
880
  private startCommandPolling;
875
881
  private stopCommandPolling;
882
+ /**
883
+ * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
884
+ * explorer signs it with the player's identity, and the server checks the signature and that it
885
+ * came from the scene deployed at this scene's registered location. A wallet named in a query or
886
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
887
+ */
888
+ private signedRequest;
876
889
  private pollCommands;
877
890
  private fetchStreamData;
878
891
  private refreshStreamStatus;
@@ -1043,6 +1056,15 @@ declare class StaticTVClient {
1043
1056
  * @internal
1044
1057
  */
1045
1058
  request<T>(endpoint: string, options?: RequestInit): Promise<T>;
1059
+ /**
1060
+ * Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
1061
+ * it to that proven wallet and checks it came from this scene - never a wallet the request names.
1062
+ * @internal
1063
+ */
1064
+ signedRequest<T>(endpoint: string, init?: {
1065
+ method?: string;
1066
+ body?: string;
1067
+ }): Promise<T>;
1046
1068
  /**
1047
1069
  * Log a debug message (only when debug: true)
1048
1070
  * @internal
@@ -1179,6 +1201,12 @@ declare class StaticTVClient {
1179
1201
  * Enables modules based on tier level
1180
1202
  * @internal
1181
1203
  */
1204
+ /**
1205
+ * The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
1206
+ * dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
1207
+ * request came from the scene deployed at that scene's registered location.
1208
+ */
1209
+ getSceneId(): string | undefined;
1182
1210
  _enableFeaturesForTier(tier: SDKTier, keyId?: string | null): void;
1183
1211
  /**
1184
1212
  * @deprecated Use `_enableFeaturesForTier` instead
package/dist/index.js CHANGED
@@ -64,6 +64,9 @@ async function request(url, options = {}) {
64
64
  return response.json();
65
65
  }
66
66
 
67
+ // src/StaticTVClient.ts
68
+ var import_SignedFetch3 = require("~system/SignedFetch");
69
+
67
70
  // src/modules/guide.ts
68
71
  var GuideModule = class {
69
72
  // 30 seconds
@@ -637,13 +640,6 @@ var HeartbeatModule = class {
637
640
  this.currentChannel = null;
638
641
  this.isWatching = false;
639
642
  }
640
- /**
641
- * Get player wallet - prioritize config, fallback to runtime detection
642
- */
643
- getWallet() {
644
- const config = this.client.getConfig();
645
- return config.player?.wallet || getPlayerWallet();
646
- }
647
643
  /**
648
644
  * Send a watching heartbeat (1 heartbeat = 1 minute watched)
649
645
  * Only sends if player is within scene bounds
@@ -655,14 +651,9 @@ var HeartbeatModule = class {
655
651
  return;
656
652
  }
657
653
  try {
658
- const sessionId = this.client.session?.getSessionId();
659
- await this.client.request("/heartbeat", {
654
+ await this.client.signedRequest("/heartbeat", {
660
655
  method: "POST",
661
- body: JSON.stringify({
662
- channelSlug: this.currentChannel,
663
- walletAddress: this.getWallet(),
664
- sessionId
665
- })
656
+ body: JSON.stringify({ channelSlug: this.currentChannel })
666
657
  });
667
658
  this.client.log(`Heartbeat sent for ${this.currentChannel}`);
668
659
  } catch (error) {
@@ -702,13 +693,9 @@ var InteractionsModule = class {
702
693
  return null;
703
694
  }
704
695
  try {
705
- const response = await this.client.request("/interact", {
696
+ const response = await this.client.signedRequest("/interact", {
706
697
  method: "POST",
707
- body: JSON.stringify({
708
- action: "like",
709
- channelSlug,
710
- walletAddress
711
- })
698
+ body: JSON.stringify({ action: "like", channelSlug })
712
699
  });
713
700
  if (response.alreadyExists) {
714
701
  this.client.log(`Already liked ${channelSlug}`);
@@ -735,13 +722,9 @@ var InteractionsModule = class {
735
722
  return null;
736
723
  }
737
724
  try {
738
- const response = await this.client.request("/interact", {
725
+ const response = await this.client.signedRequest("/interact", {
739
726
  method: "POST",
740
- body: JSON.stringify({
741
- action: "follow",
742
- channelSlug,
743
- walletAddress
744
- })
727
+ body: JSON.stringify({ action: "follow", channelSlug })
745
728
  });
746
729
  if (response.alreadyExists) {
747
730
  this.client.log(`Already following ${channelSlug}`);
@@ -1679,7 +1662,6 @@ var import_math4 = require("@dcl/sdk/math");
1679
1662
  var import_SignedFetch = require("~system/SignedFetch");
1680
1663
  var import_players = require("@dcl/sdk/players");
1681
1664
  var import_RestrictedActions2 = require("~system/RestrictedActions");
1682
- var FIREBASE_API_KEY = "AIzaSyCX5jViDWUSagUmAX7S4OXgXyJZ9shaC5Y";
1683
1665
  var POLL_INTERVAL_ACTIVE = 5e3;
1684
1666
  var POLL_INTERVAL_PASSIVE = 3e4;
1685
1667
  var ChatUIModule = class {
@@ -1687,8 +1669,10 @@ var ChatUIModule = class {
1687
1669
  // Visibility state
1688
1670
  this._isVisible = false;
1689
1671
  this._unreadCount = 0;
1690
- // Authentication state
1691
- this.idToken = null;
1672
+ // Authentication state. There is no login token (thestatic.tv STATIC-01, 2026-10-07): the old
1673
+ // flow got a Firebase custom token from /api/auth/dcl, which any scene could ask for on a
1674
+ // visitor's behalf. Status and sends are now DCL signed requests bound to this scene.
1675
+ this.authChecked = false;
1692
1676
  this.isSigningIn = false;
1693
1677
  this.isRegisteredUser = false;
1694
1678
  this.currentUsername = "Guest";
@@ -1848,7 +1832,12 @@ var ChatUIModule = class {
1848
1832
  return baseUrl.replace("/api/v1/dcl", "");
1849
1833
  }
1850
1834
  async performAuth() {
1851
- if (this.isSigningIn || this.idToken) return;
1835
+ if (this.isSigningIn || this.authChecked) return;
1836
+ const sceneId = this.client.getSceneId();
1837
+ if (!sceneId) {
1838
+ this.client.log("Chat: no sceneId - signed chat needs the scene this SDK is registered as");
1839
+ return;
1840
+ }
1852
1841
  this.isSigningIn = true;
1853
1842
  try {
1854
1843
  const baseUrl = this.getBaseUrl();
@@ -1857,29 +1846,18 @@ var ChatUIModule = class {
1857
1846
  init: {
1858
1847
  method: "POST",
1859
1848
  headers: { "Content-Type": "application/json" },
1860
- body: JSON.stringify({})
1849
+ body: JSON.stringify({ sceneId })
1861
1850
  }
1862
1851
  });
1863
- if (!response.ok) throw new Error("Backend refused login");
1852
+ if (!response.ok) throw new Error("Backend refused the signed status check");
1864
1853
  const authData = JSON.parse(response.body);
1865
1854
  if (authData.username) this.currentUsername = authData.username;
1866
1855
  this.isRegisteredUser = !!authData.isRegistered;
1867
- const exchangeRes = await fetch(
1868
- `https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=${FIREBASE_API_KEY}`,
1869
- {
1870
- method: "POST",
1871
- headers: { "Content-Type": "application/json" },
1872
- body: JSON.stringify({ token: authData.token, returnSecureToken: true })
1873
- }
1874
- );
1875
- const exchangeData = await exchangeRes.json();
1876
- if (exchangeData.idToken) {
1877
- this.idToken = exchangeData.idToken;
1878
- if (this.inputText && this.isRegisteredUser) {
1879
- this.handleSend();
1880
- }
1856
+ this.authChecked = true;
1857
+ if (this.inputText && this.isRegisteredUser) {
1858
+ this.handleSend();
1881
1859
  }
1882
- this.client.log("Chat auth successful");
1860
+ this.client.log("Chat status checked");
1883
1861
  } catch (e) {
1884
1862
  this.client.log(`Chat auth failed: ${e}`);
1885
1863
  } finally {
@@ -1948,11 +1926,13 @@ var ChatUIModule = class {
1948
1926
  }
1949
1927
  async handleSend() {
1950
1928
  if (!this.inputText.trim()) return;
1951
- if (!this.idToken) {
1929
+ if (!this.authChecked) {
1952
1930
  await this.performAuth();
1953
1931
  return;
1954
1932
  }
1955
1933
  if (!this.isRegisteredUser) return;
1934
+ const sceneId = this.client.getSceneId();
1935
+ if (!sceneId) return;
1956
1936
  const message = this.inputText.trim();
1957
1937
  this.inputText = "";
1958
1938
  try {
@@ -1961,18 +1941,15 @@ var ChatUIModule = class {
1961
1941
  url: `${baseUrl}/api/chat/send`,
1962
1942
  init: {
1963
1943
  method: "POST",
1964
- headers: {
1965
- "Content-Type": "application/json",
1966
- Authorization: `Bearer ${this.idToken}`
1967
- },
1968
- body: JSON.stringify({ channelId: this.currentChannelId, text: message })
1944
+ headers: { "Content-Type": "application/json" },
1945
+ body: JSON.stringify({ channelId: this.currentChannelId, text: message, sceneId })
1969
1946
  }
1970
1947
  });
1971
1948
  if (response.ok) {
1972
1949
  await this.fetchMessages();
1973
1950
  this.resetChatTimer();
1974
- } else if (response.status === 401) {
1975
- this.idToken = null;
1951
+ } else if (response.status === 401 || response.status === 403) {
1952
+ this.authChecked = false;
1976
1953
  this.performAuth();
1977
1954
  }
1978
1955
  } catch (e) {
@@ -2476,6 +2453,7 @@ var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
2476
2453
  var import_math5 = require("@dcl/sdk/math");
2477
2454
  var import_players2 = require("@dcl/sdk/players");
2478
2455
  var import_RestrictedActions3 = require("~system/RestrictedActions");
2456
+ var import_SignedFetch2 = require("~system/SignedFetch");
2479
2457
 
2480
2458
  // src/ui/ui-renderer.tsx
2481
2459
  var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
@@ -3241,8 +3219,8 @@ var AdminPanelUIModule = class {
3241
3219
  return;
3242
3220
  }
3243
3221
  try {
3244
- const res = await fetch(
3245
- `${this.baseUrl}/scene/${this.config.sceneId}/admin-check?wallet=${player.userId}`
3222
+ const res = await this.signedRequest(
3223
+ `${this.baseUrl}/scene/${this.config.sceneId}/admin-check`
3246
3224
  );
3247
3225
  if (res.ok) {
3248
3226
  const data = await res.json();
@@ -3343,6 +3321,20 @@ var AdminPanelUIModule = class {
3343
3321
  this.log("Command polling stopped");
3344
3322
  }
3345
3323
  }
3324
+ /**
3325
+ * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
3326
+ * explorer signs it with the player's identity, and the server checks the signature and that it
3327
+ * came from the scene deployed at this scene's registered location. A wallet named in a query or
3328
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3329
+ */
3330
+ async signedRequest(url, init = {}) {
3331
+ const res = await (0, import_SignedFetch2.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3332
+ return {
3333
+ ok: res.ok,
3334
+ status: res.status,
3335
+ json: async () => res.body ? JSON.parse(res.body) : {}
3336
+ };
3337
+ }
3346
3338
  async pollCommands() {
3347
3339
  try {
3348
3340
  const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
@@ -3386,8 +3378,8 @@ var AdminPanelUIModule = class {
3386
3378
  async fetchStreamData() {
3387
3379
  if (this.streamFetched || !this.playerWallet) return;
3388
3380
  try {
3389
- const res = await fetch(
3390
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3381
+ const res = await this.signedRequest(
3382
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3391
3383
  );
3392
3384
  if (res.ok) {
3393
3385
  this.streamData = await res.json();
@@ -3401,8 +3393,8 @@ var AdminPanelUIModule = class {
3401
3393
  async refreshStreamStatus() {
3402
3394
  if (!this.playerWallet) return;
3403
3395
  try {
3404
- const res = await fetch(
3405
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3396
+ const res = await this.signedRequest(
3397
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3406
3398
  );
3407
3399
  if (res.ok) {
3408
3400
  this.streamData = await res.json();
@@ -3461,12 +3453,12 @@ var AdminPanelUIModule = class {
3461
3453
  this.channelCreateError = "";
3462
3454
  try {
3463
3455
  this.log("Creating channel for scene...");
3464
- const res = await fetch(
3456
+ const res = await this.signedRequest(
3465
3457
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/create`,
3466
3458
  {
3467
3459
  method: "POST",
3468
3460
  headers: { "Content-Type": "application/json" },
3469
- body: JSON.stringify({ wallet: this.playerWallet })
3461
+ body: JSON.stringify({})
3470
3462
  }
3471
3463
  );
3472
3464
  const data = await res.json();
@@ -3491,12 +3483,12 @@ var AdminPanelUIModule = class {
3491
3483
  this.trialClaimError = "";
3492
3484
  try {
3493
3485
  this.log("Claiming streaming trial...");
3494
- const res = await fetch(
3486
+ const res = await this.signedRequest(
3495
3487
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/claim-trial`,
3496
3488
  {
3497
3489
  method: "POST",
3498
3490
  headers: { "Content-Type": "application/json" },
3499
- body: JSON.stringify({ wallet: this.playerWallet })
3491
+ body: JSON.stringify({})
3500
3492
  }
3501
3493
  );
3502
3494
  const data = await res.json();
@@ -3521,12 +3513,12 @@ var AdminPanelUIModule = class {
3521
3513
  this.channelDeleteError = "";
3522
3514
  try {
3523
3515
  this.log("Deleting channel for scene...");
3524
- const res = await fetch(
3516
+ const res = await this.signedRequest(
3525
3517
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
3526
3518
  {
3527
3519
  method: "POST",
3528
3520
  headers: { "Content-Type": "application/json" },
3529
- body: JSON.stringify({ wallet: this.playerWallet })
3521
+ body: JSON.stringify({})
3530
3522
  }
3531
3523
  );
3532
3524
  const data = await res.json();
@@ -3556,12 +3548,12 @@ var AdminPanelUIModule = class {
3556
3548
  this.streamControlStatus = "";
3557
3549
  try {
3558
3550
  this.log("Starting stream...");
3559
- const res = await fetch(
3551
+ const res = await this.signedRequest(
3560
3552
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3561
3553
  {
3562
3554
  method: "POST",
3563
3555
  headers: { "Content-Type": "application/json" },
3564
- body: JSON.stringify({ action: "start", wallet: this.playerWallet })
3556
+ body: JSON.stringify({ action: "start" })
3565
3557
  }
3566
3558
  );
3567
3559
  const data = await res.json();
@@ -3588,12 +3580,12 @@ var AdminPanelUIModule = class {
3588
3580
  this.streamControlStatus = "";
3589
3581
  try {
3590
3582
  this.log("Stopping stream...");
3591
- const res = await fetch(
3583
+ const res = await this.signedRequest(
3592
3584
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3593
3585
  {
3594
3586
  method: "POST",
3595
3587
  headers: { "Content-Type": "application/json" },
3596
- body: JSON.stringify({ action: "stop", wallet: this.playerWallet })
3588
+ body: JSON.stringify({ action: "stop" })
3597
3589
  }
3598
3590
  );
3599
3591
  const data = await res.json();
@@ -3619,12 +3611,12 @@ var AdminPanelUIModule = class {
3619
3611
  this.keyRotateStatus = "";
3620
3612
  try {
3621
3613
  this.log("Rotating stream key...");
3622
- const res = await fetch(
3614
+ const res = await this.signedRequest(
3623
3615
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3624
3616
  {
3625
3617
  method: "POST",
3626
3618
  headers: { "Content-Type": "application/json" },
3627
- body: JSON.stringify({ action: "rotateKey", wallet: this.playerWallet })
3619
+ body: JSON.stringify({ action: "rotateKey" })
3628
3620
  }
3629
3621
  );
3630
3622
  const data = await res.json();
@@ -3647,8 +3639,8 @@ var AdminPanelUIModule = class {
3647
3639
  if (!this.playerWallet) return;
3648
3640
  this.modStatus = "loading";
3649
3641
  try {
3650
- const res = await fetch(
3651
- `${this.baseUrl}/scene/${this.config.sceneId}/config?wallet=${this.playerWallet}`,
3642
+ const res = await this.signedRequest(
3643
+ `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3652
3644
  { headers: { "Content-Type": "application/json" } }
3653
3645
  );
3654
3646
  if (res.ok) {
@@ -3676,14 +3668,13 @@ var AdminPanelUIModule = class {
3676
3668
  if (this.sceneAdmins.includes(normalized)) return;
3677
3669
  this.modStatus = "loading";
3678
3670
  try {
3679
- const res = await fetch(
3671
+ const res = await this.signedRequest(
3680
3672
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3681
3673
  {
3682
3674
  method: "POST",
3683
3675
  headers: { "Content-Type": "application/json" },
3684
3676
  body: JSON.stringify({
3685
- sceneAdmins: [...this.sceneAdmins, normalized],
3686
- wallet: this.playerWallet
3677
+ sceneAdmins: [...this.sceneAdmins, normalized]
3687
3678
  })
3688
3679
  }
3689
3680
  );
@@ -3704,14 +3695,13 @@ var AdminPanelUIModule = class {
3704
3695
  if (!wallet || !this.playerWallet) return;
3705
3696
  this.modStatus = "loading";
3706
3697
  try {
3707
- const res = await fetch(
3698
+ const res = await this.signedRequest(
3708
3699
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3709
3700
  {
3710
3701
  method: "POST",
3711
3702
  headers: { "Content-Type": "application/json" },
3712
3703
  body: JSON.stringify({
3713
- sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet),
3714
- wallet: this.playerWallet
3704
+ sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
3715
3705
  })
3716
3706
  }
3717
3707
  );
@@ -3737,14 +3727,13 @@ var AdminPanelUIModule = class {
3737
3727
  if (this.bannedWallets.includes(normalized)) return;
3738
3728
  this.modStatus = "loading";
3739
3729
  try {
3740
- const res = await fetch(
3730
+ const res = await this.signedRequest(
3741
3731
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3742
3732
  {
3743
3733
  method: "POST",
3744
3734
  headers: { "Content-Type": "application/json" },
3745
3735
  body: JSON.stringify({
3746
- bannedWallets: [...this.bannedWallets, normalized],
3747
- wallet: this.playerWallet
3736
+ bannedWallets: [...this.bannedWallets, normalized]
3748
3737
  })
3749
3738
  }
3750
3739
  );
@@ -3766,14 +3755,13 @@ var AdminPanelUIModule = class {
3766
3755
  if (!wallet || !this.playerWallet) return;
3767
3756
  this.modStatus = "loading";
3768
3757
  try {
3769
- const res = await fetch(
3758
+ const res = await this.signedRequest(
3770
3759
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3771
3760
  {
3772
3761
  method: "POST",
3773
3762
  headers: { "Content-Type": "application/json" },
3774
3763
  body: JSON.stringify({
3775
- bannedWallets: this.bannedWallets.filter((w) => w !== wallet),
3776
- wallet: this.playerWallet
3764
+ bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
3777
3765
  })
3778
3766
  }
3779
3767
  );
@@ -4103,6 +4091,33 @@ var StaticTVClient = class {
4103
4091
  }
4104
4092
  });
4105
4093
  }
4094
+ /**
4095
+ * Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
4096
+ * it to that proven wallet and checks it came from this scene - never a wallet the request names.
4097
+ * @internal
4098
+ */
4099
+ async signedRequest(endpoint, init = {}) {
4100
+ const response = await (0, import_SignedFetch3.signedFetch)({
4101
+ url: `${this.apiUrl}${endpoint}`,
4102
+ init: {
4103
+ method: init.method || "POST",
4104
+ headers: {
4105
+ "Content-Type": "application/json",
4106
+ "x-dcl-api-key": this.config.apiKey
4107
+ },
4108
+ body: init.body
4109
+ }
4110
+ });
4111
+ let data = {};
4112
+ try {
4113
+ data = response.body ? JSON.parse(response.body) : {};
4114
+ } catch {
4115
+ }
4116
+ if (!response.ok) {
4117
+ throw new Error(data.error || `HTTP ${response.status}`);
4118
+ }
4119
+ return data;
4120
+ }
4106
4121
  /**
4107
4122
  * Log a debug message (only when debug: true)
4108
4123
  * @internal
@@ -4480,6 +4495,14 @@ var StaticTVClient = class {
4480
4495
  * Enables modules based on tier level
4481
4496
  * @internal
4482
4497
  */
4498
+ /**
4499
+ * The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
4500
+ * dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
4501
+ * request came from the scene deployed at that scene's registered location.
4502
+ */
4503
+ getSceneId() {
4504
+ return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4505
+ }
4483
4506
  _enableFeaturesForTier(tier, keyId) {
4484
4507
  this._tier = tier;
4485
4508
  if (keyId) {
package/dist/index.mjs CHANGED
@@ -16,6 +16,9 @@ async function request(url, options = {}) {
16
16
  return response.json();
17
17
  }
18
18
 
19
+ // src/StaticTVClient.ts
20
+ import { signedFetch as signedFetch3 } from "~system/SignedFetch";
21
+
19
22
  // src/modules/guide.ts
20
23
  var GuideModule = class {
21
24
  // 30 seconds
@@ -589,13 +592,6 @@ var HeartbeatModule = class {
589
592
  this.currentChannel = null;
590
593
  this.isWatching = false;
591
594
  }
592
- /**
593
- * Get player wallet - prioritize config, fallback to runtime detection
594
- */
595
- getWallet() {
596
- const config = this.client.getConfig();
597
- return config.player?.wallet || getPlayerWallet();
598
- }
599
595
  /**
600
596
  * Send a watching heartbeat (1 heartbeat = 1 minute watched)
601
597
  * Only sends if player is within scene bounds
@@ -607,14 +603,9 @@ var HeartbeatModule = class {
607
603
  return;
608
604
  }
609
605
  try {
610
- const sessionId = this.client.session?.getSessionId();
611
- await this.client.request("/heartbeat", {
606
+ await this.client.signedRequest("/heartbeat", {
612
607
  method: "POST",
613
- body: JSON.stringify({
614
- channelSlug: this.currentChannel,
615
- walletAddress: this.getWallet(),
616
- sessionId
617
- })
608
+ body: JSON.stringify({ channelSlug: this.currentChannel })
618
609
  });
619
610
  this.client.log(`Heartbeat sent for ${this.currentChannel}`);
620
611
  } catch (error) {
@@ -654,13 +645,9 @@ var InteractionsModule = class {
654
645
  return null;
655
646
  }
656
647
  try {
657
- const response = await this.client.request("/interact", {
648
+ const response = await this.client.signedRequest("/interact", {
658
649
  method: "POST",
659
- body: JSON.stringify({
660
- action: "like",
661
- channelSlug,
662
- walletAddress
663
- })
650
+ body: JSON.stringify({ action: "like", channelSlug })
664
651
  });
665
652
  if (response.alreadyExists) {
666
653
  this.client.log(`Already liked ${channelSlug}`);
@@ -687,13 +674,9 @@ var InteractionsModule = class {
687
674
  return null;
688
675
  }
689
676
  try {
690
- const response = await this.client.request("/interact", {
677
+ const response = await this.client.signedRequest("/interact", {
691
678
  method: "POST",
692
- body: JSON.stringify({
693
- action: "follow",
694
- channelSlug,
695
- walletAddress
696
- })
679
+ body: JSON.stringify({ action: "follow", channelSlug })
697
680
  });
698
681
  if (response.alreadyExists) {
699
682
  this.client.log(`Already following ${channelSlug}`);
@@ -1631,7 +1614,6 @@ import { Color4 as Color44 } from "@dcl/sdk/math";
1631
1614
  import { signedFetch } from "~system/SignedFetch";
1632
1615
  import { getPlayer } from "@dcl/sdk/players";
1633
1616
  import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
1634
- var FIREBASE_API_KEY = "AIzaSyCX5jViDWUSagUmAX7S4OXgXyJZ9shaC5Y";
1635
1617
  var POLL_INTERVAL_ACTIVE = 5e3;
1636
1618
  var POLL_INTERVAL_PASSIVE = 3e4;
1637
1619
  var ChatUIModule = class {
@@ -1639,8 +1621,10 @@ var ChatUIModule = class {
1639
1621
  // Visibility state
1640
1622
  this._isVisible = false;
1641
1623
  this._unreadCount = 0;
1642
- // Authentication state
1643
- this.idToken = null;
1624
+ // Authentication state. There is no login token (thestatic.tv STATIC-01, 2026-10-07): the old
1625
+ // flow got a Firebase custom token from /api/auth/dcl, which any scene could ask for on a
1626
+ // visitor's behalf. Status and sends are now DCL signed requests bound to this scene.
1627
+ this.authChecked = false;
1644
1628
  this.isSigningIn = false;
1645
1629
  this.isRegisteredUser = false;
1646
1630
  this.currentUsername = "Guest";
@@ -1800,7 +1784,12 @@ var ChatUIModule = class {
1800
1784
  return baseUrl.replace("/api/v1/dcl", "");
1801
1785
  }
1802
1786
  async performAuth() {
1803
- if (this.isSigningIn || this.idToken) return;
1787
+ if (this.isSigningIn || this.authChecked) return;
1788
+ const sceneId = this.client.getSceneId();
1789
+ if (!sceneId) {
1790
+ this.client.log("Chat: no sceneId - signed chat needs the scene this SDK is registered as");
1791
+ return;
1792
+ }
1804
1793
  this.isSigningIn = true;
1805
1794
  try {
1806
1795
  const baseUrl = this.getBaseUrl();
@@ -1809,29 +1798,18 @@ var ChatUIModule = class {
1809
1798
  init: {
1810
1799
  method: "POST",
1811
1800
  headers: { "Content-Type": "application/json" },
1812
- body: JSON.stringify({})
1801
+ body: JSON.stringify({ sceneId })
1813
1802
  }
1814
1803
  });
1815
- if (!response.ok) throw new Error("Backend refused login");
1804
+ if (!response.ok) throw new Error("Backend refused the signed status check");
1816
1805
  const authData = JSON.parse(response.body);
1817
1806
  if (authData.username) this.currentUsername = authData.username;
1818
1807
  this.isRegisteredUser = !!authData.isRegistered;
1819
- const exchangeRes = await fetch(
1820
- `https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=${FIREBASE_API_KEY}`,
1821
- {
1822
- method: "POST",
1823
- headers: { "Content-Type": "application/json" },
1824
- body: JSON.stringify({ token: authData.token, returnSecureToken: true })
1825
- }
1826
- );
1827
- const exchangeData = await exchangeRes.json();
1828
- if (exchangeData.idToken) {
1829
- this.idToken = exchangeData.idToken;
1830
- if (this.inputText && this.isRegisteredUser) {
1831
- this.handleSend();
1832
- }
1808
+ this.authChecked = true;
1809
+ if (this.inputText && this.isRegisteredUser) {
1810
+ this.handleSend();
1833
1811
  }
1834
- this.client.log("Chat auth successful");
1812
+ this.client.log("Chat status checked");
1835
1813
  } catch (e) {
1836
1814
  this.client.log(`Chat auth failed: ${e}`);
1837
1815
  } finally {
@@ -1900,11 +1878,13 @@ var ChatUIModule = class {
1900
1878
  }
1901
1879
  async handleSend() {
1902
1880
  if (!this.inputText.trim()) return;
1903
- if (!this.idToken) {
1881
+ if (!this.authChecked) {
1904
1882
  await this.performAuth();
1905
1883
  return;
1906
1884
  }
1907
1885
  if (!this.isRegisteredUser) return;
1886
+ const sceneId = this.client.getSceneId();
1887
+ if (!sceneId) return;
1908
1888
  const message = this.inputText.trim();
1909
1889
  this.inputText = "";
1910
1890
  try {
@@ -1913,18 +1893,15 @@ var ChatUIModule = class {
1913
1893
  url: `${baseUrl}/api/chat/send`,
1914
1894
  init: {
1915
1895
  method: "POST",
1916
- headers: {
1917
- "Content-Type": "application/json",
1918
- Authorization: `Bearer ${this.idToken}`
1919
- },
1920
- body: JSON.stringify({ channelId: this.currentChannelId, text: message })
1896
+ headers: { "Content-Type": "application/json" },
1897
+ body: JSON.stringify({ channelId: this.currentChannelId, text: message, sceneId })
1921
1898
  }
1922
1899
  });
1923
1900
  if (response.ok) {
1924
1901
  await this.fetchMessages();
1925
1902
  this.resetChatTimer();
1926
- } else if (response.status === 401) {
1927
- this.idToken = null;
1903
+ } else if (response.status === 401 || response.status === 403) {
1904
+ this.authChecked = false;
1928
1905
  this.performAuth();
1929
1906
  }
1930
1907
  } catch (e) {
@@ -2428,6 +2405,7 @@ import ReactEcs5, { UiEntity as UiEntity5, Button as Button3, Label as Label5, I
2428
2405
  import { Color4 as Color45, Vector3 } from "@dcl/sdk/math";
2429
2406
  import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
2430
2407
  import { movePlayerTo, openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
2408
+ import { signedFetch as signedFetch2 } from "~system/SignedFetch";
2431
2409
 
2432
2410
  // src/ui/ui-renderer.tsx
2433
2411
  import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
@@ -3193,8 +3171,8 @@ var AdminPanelUIModule = class {
3193
3171
  return;
3194
3172
  }
3195
3173
  try {
3196
- const res = await fetch(
3197
- `${this.baseUrl}/scene/${this.config.sceneId}/admin-check?wallet=${player.userId}`
3174
+ const res = await this.signedRequest(
3175
+ `${this.baseUrl}/scene/${this.config.sceneId}/admin-check`
3198
3176
  );
3199
3177
  if (res.ok) {
3200
3178
  const data = await res.json();
@@ -3295,6 +3273,20 @@ var AdminPanelUIModule = class {
3295
3273
  this.log("Command polling stopped");
3296
3274
  }
3297
3275
  }
3276
+ /**
3277
+ * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
3278
+ * explorer signs it with the player's identity, and the server checks the signature and that it
3279
+ * came from the scene deployed at this scene's registered location. A wallet named in a query or
3280
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3281
+ */
3282
+ async signedRequest(url, init = {}) {
3283
+ const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3284
+ return {
3285
+ ok: res.ok,
3286
+ status: res.status,
3287
+ json: async () => res.body ? JSON.parse(res.body) : {}
3288
+ };
3289
+ }
3298
3290
  async pollCommands() {
3299
3291
  try {
3300
3292
  const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
@@ -3338,8 +3330,8 @@ var AdminPanelUIModule = class {
3338
3330
  async fetchStreamData() {
3339
3331
  if (this.streamFetched || !this.playerWallet) return;
3340
3332
  try {
3341
- const res = await fetch(
3342
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3333
+ const res = await this.signedRequest(
3334
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3343
3335
  );
3344
3336
  if (res.ok) {
3345
3337
  this.streamData = await res.json();
@@ -3353,8 +3345,8 @@ var AdminPanelUIModule = class {
3353
3345
  async refreshStreamStatus() {
3354
3346
  if (!this.playerWallet) return;
3355
3347
  try {
3356
- const res = await fetch(
3357
- `${this.baseUrl}/scene/${this.config.sceneId}/stream?wallet=${this.playerWallet}`
3348
+ const res = await this.signedRequest(
3349
+ `${this.baseUrl}/scene/${this.config.sceneId}/stream`
3358
3350
  );
3359
3351
  if (res.ok) {
3360
3352
  this.streamData = await res.json();
@@ -3413,12 +3405,12 @@ var AdminPanelUIModule = class {
3413
3405
  this.channelCreateError = "";
3414
3406
  try {
3415
3407
  this.log("Creating channel for scene...");
3416
- const res = await fetch(
3408
+ const res = await this.signedRequest(
3417
3409
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/create`,
3418
3410
  {
3419
3411
  method: "POST",
3420
3412
  headers: { "Content-Type": "application/json" },
3421
- body: JSON.stringify({ wallet: this.playerWallet })
3413
+ body: JSON.stringify({})
3422
3414
  }
3423
3415
  );
3424
3416
  const data = await res.json();
@@ -3443,12 +3435,12 @@ var AdminPanelUIModule = class {
3443
3435
  this.trialClaimError = "";
3444
3436
  try {
3445
3437
  this.log("Claiming streaming trial...");
3446
- const res = await fetch(
3438
+ const res = await this.signedRequest(
3447
3439
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/claim-trial`,
3448
3440
  {
3449
3441
  method: "POST",
3450
3442
  headers: { "Content-Type": "application/json" },
3451
- body: JSON.stringify({ wallet: this.playerWallet })
3443
+ body: JSON.stringify({})
3452
3444
  }
3453
3445
  );
3454
3446
  const data = await res.json();
@@ -3473,12 +3465,12 @@ var AdminPanelUIModule = class {
3473
3465
  this.channelDeleteError = "";
3474
3466
  try {
3475
3467
  this.log("Deleting channel for scene...");
3476
- const res = await fetch(
3468
+ const res = await this.signedRequest(
3477
3469
  `${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
3478
3470
  {
3479
3471
  method: "POST",
3480
3472
  headers: { "Content-Type": "application/json" },
3481
- body: JSON.stringify({ wallet: this.playerWallet })
3473
+ body: JSON.stringify({})
3482
3474
  }
3483
3475
  );
3484
3476
  const data = await res.json();
@@ -3508,12 +3500,12 @@ var AdminPanelUIModule = class {
3508
3500
  this.streamControlStatus = "";
3509
3501
  try {
3510
3502
  this.log("Starting stream...");
3511
- const res = await fetch(
3503
+ const res = await this.signedRequest(
3512
3504
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3513
3505
  {
3514
3506
  method: "POST",
3515
3507
  headers: { "Content-Type": "application/json" },
3516
- body: JSON.stringify({ action: "start", wallet: this.playerWallet })
3508
+ body: JSON.stringify({ action: "start" })
3517
3509
  }
3518
3510
  );
3519
3511
  const data = await res.json();
@@ -3540,12 +3532,12 @@ var AdminPanelUIModule = class {
3540
3532
  this.streamControlStatus = "";
3541
3533
  try {
3542
3534
  this.log("Stopping stream...");
3543
- const res = await fetch(
3535
+ const res = await this.signedRequest(
3544
3536
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3545
3537
  {
3546
3538
  method: "POST",
3547
3539
  headers: { "Content-Type": "application/json" },
3548
- body: JSON.stringify({ action: "stop", wallet: this.playerWallet })
3540
+ body: JSON.stringify({ action: "stop" })
3549
3541
  }
3550
3542
  );
3551
3543
  const data = await res.json();
@@ -3571,12 +3563,12 @@ var AdminPanelUIModule = class {
3571
3563
  this.keyRotateStatus = "";
3572
3564
  try {
3573
3565
  this.log("Rotating stream key...");
3574
- const res = await fetch(
3566
+ const res = await this.signedRequest(
3575
3567
  `${this.baseUrl}/scene/${this.config.sceneId}/stream`,
3576
3568
  {
3577
3569
  method: "POST",
3578
3570
  headers: { "Content-Type": "application/json" },
3579
- body: JSON.stringify({ action: "rotateKey", wallet: this.playerWallet })
3571
+ body: JSON.stringify({ action: "rotateKey" })
3580
3572
  }
3581
3573
  );
3582
3574
  const data = await res.json();
@@ -3599,8 +3591,8 @@ var AdminPanelUIModule = class {
3599
3591
  if (!this.playerWallet) return;
3600
3592
  this.modStatus = "loading";
3601
3593
  try {
3602
- const res = await fetch(
3603
- `${this.baseUrl}/scene/${this.config.sceneId}/config?wallet=${this.playerWallet}`,
3594
+ const res = await this.signedRequest(
3595
+ `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3604
3596
  { headers: { "Content-Type": "application/json" } }
3605
3597
  );
3606
3598
  if (res.ok) {
@@ -3628,14 +3620,13 @@ var AdminPanelUIModule = class {
3628
3620
  if (this.sceneAdmins.includes(normalized)) return;
3629
3621
  this.modStatus = "loading";
3630
3622
  try {
3631
- const res = await fetch(
3623
+ const res = await this.signedRequest(
3632
3624
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3633
3625
  {
3634
3626
  method: "POST",
3635
3627
  headers: { "Content-Type": "application/json" },
3636
3628
  body: JSON.stringify({
3637
- sceneAdmins: [...this.sceneAdmins, normalized],
3638
- wallet: this.playerWallet
3629
+ sceneAdmins: [...this.sceneAdmins, normalized]
3639
3630
  })
3640
3631
  }
3641
3632
  );
@@ -3656,14 +3647,13 @@ var AdminPanelUIModule = class {
3656
3647
  if (!wallet || !this.playerWallet) return;
3657
3648
  this.modStatus = "loading";
3658
3649
  try {
3659
- const res = await fetch(
3650
+ const res = await this.signedRequest(
3660
3651
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3661
3652
  {
3662
3653
  method: "POST",
3663
3654
  headers: { "Content-Type": "application/json" },
3664
3655
  body: JSON.stringify({
3665
- sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet),
3666
- wallet: this.playerWallet
3656
+ sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
3667
3657
  })
3668
3658
  }
3669
3659
  );
@@ -3689,14 +3679,13 @@ var AdminPanelUIModule = class {
3689
3679
  if (this.bannedWallets.includes(normalized)) return;
3690
3680
  this.modStatus = "loading";
3691
3681
  try {
3692
- const res = await fetch(
3682
+ const res = await this.signedRequest(
3693
3683
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3694
3684
  {
3695
3685
  method: "POST",
3696
3686
  headers: { "Content-Type": "application/json" },
3697
3687
  body: JSON.stringify({
3698
- bannedWallets: [...this.bannedWallets, normalized],
3699
- wallet: this.playerWallet
3688
+ bannedWallets: [...this.bannedWallets, normalized]
3700
3689
  })
3701
3690
  }
3702
3691
  );
@@ -3718,14 +3707,13 @@ var AdminPanelUIModule = class {
3718
3707
  if (!wallet || !this.playerWallet) return;
3719
3708
  this.modStatus = "loading";
3720
3709
  try {
3721
- const res = await fetch(
3710
+ const res = await this.signedRequest(
3722
3711
  `${this.baseUrl}/scene/${this.config.sceneId}/config`,
3723
3712
  {
3724
3713
  method: "POST",
3725
3714
  headers: { "Content-Type": "application/json" },
3726
3715
  body: JSON.stringify({
3727
- bannedWallets: this.bannedWallets.filter((w) => w !== wallet),
3728
- wallet: this.playerWallet
3716
+ bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
3729
3717
  })
3730
3718
  }
3731
3719
  );
@@ -4055,6 +4043,33 @@ var StaticTVClient = class {
4055
4043
  }
4056
4044
  });
4057
4045
  }
4046
+ /**
4047
+ * Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
4048
+ * it to that proven wallet and checks it came from this scene - never a wallet the request names.
4049
+ * @internal
4050
+ */
4051
+ async signedRequest(endpoint, init = {}) {
4052
+ const response = await signedFetch3({
4053
+ url: `${this.apiUrl}${endpoint}`,
4054
+ init: {
4055
+ method: init.method || "POST",
4056
+ headers: {
4057
+ "Content-Type": "application/json",
4058
+ "x-dcl-api-key": this.config.apiKey
4059
+ },
4060
+ body: init.body
4061
+ }
4062
+ });
4063
+ let data = {};
4064
+ try {
4065
+ data = response.body ? JSON.parse(response.body) : {};
4066
+ } catch {
4067
+ }
4068
+ if (!response.ok) {
4069
+ throw new Error(data.error || `HTTP ${response.status}`);
4070
+ }
4071
+ return data;
4072
+ }
4058
4073
  /**
4059
4074
  * Log a debug message (only when debug: true)
4060
4075
  * @internal
@@ -4432,6 +4447,14 @@ var StaticTVClient = class {
4432
4447
  * Enables modules based on tier level
4433
4448
  * @internal
4434
4449
  */
4450
+ /**
4451
+ * The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
4452
+ * dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
4453
+ * request came from the scene deployed at that scene's registered location.
4454
+ */
4455
+ getSceneId() {
4456
+ return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4457
+ }
4435
4458
  _enableFeaturesForTier(tier, keyId) {
4436
4459
  this._tier = tier;
4437
4460
  if (keyId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.5.29",
3
+ "version": "2.6.0",
4
4
  "description": "Connect your Decentraland scene to thestatic.tv - full channel lineup, metrics tracking, and interactions",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://thestatic.tv",
45
45
  "bugs": {
46
- "url": "https://github.com/thestatic-tv/dcl-sdk/issues"
46
+ "url": "https://thestatic.tv/support"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@dcl-sdk/utils": ">=1.0.0",
@@ -52,9 +52,15 @@
52
52
  "devDependencies": {
53
53
  "@dcl-sdk/utils": "^1.4.0",
54
54
  "@dcl/sdk": "^7.0.0",
55
- "@vitest/coverage-v8": "^4.0.16",
55
+ "@vitest/coverage-v8": "^4.1.11",
56
56
  "tsup": "^8.0.0",
57
57
  "typescript": "^5.0.0",
58
- "vitest": "^4.0.16"
58
+ "vitest": "^4.1.11"
59
+ },
60
+ "overrides": {
61
+ "protobufjs": "^7.6.3",
62
+ "esbuild": "^0.28.1",
63
+ "ts-deepmerge": "^8.0.0",
64
+ "cookie": "^0.7.0"
59
65
  }
60
66
  }