@flayerlabs/gamemode-gate 0.5.6 → 0.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.
Files changed (45) hide show
  1. package/DEPLOY.md +25 -3
  2. package/README.md +4 -1
  3. package/dist/chain/chains.d.ts +14 -6
  4. package/dist/chain/chains.d.ts.map +1 -1
  5. package/dist/chain/chains.js +8 -4
  6. package/dist/chain/chains.js.map +1 -1
  7. package/dist/chain/discover.d.ts +61 -3
  8. package/dist/chain/discover.d.ts.map +1 -1
  9. package/dist/chain/discover.js +181 -21
  10. package/dist/chain/discover.js.map +1 -1
  11. package/dist/chain/secure.d.ts +28 -0
  12. package/dist/chain/secure.d.ts.map +1 -1
  13. package/dist/chain/secure.js +55 -20
  14. package/dist/chain/secure.js.map +1 -1
  15. package/dist/index.d.ts +5 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/main.d.ts +4 -2
  20. package/dist/main.d.ts.map +1 -1
  21. package/dist/main.js +11 -6
  22. package/dist/main.js.map +1 -1
  23. package/dist/room.d.ts +7 -0
  24. package/dist/room.d.ts.map +1 -1
  25. package/dist/room.js +15 -6
  26. package/dist/room.js.map +1 -1
  27. package/dist/server.d.ts +13 -0
  28. package/dist/server.d.ts.map +1 -1
  29. package/dist/server.js +3 -0
  30. package/dist/server.js.map +1 -1
  31. package/dist/store.d.ts +1 -1
  32. package/dist/store.d.ts.map +1 -1
  33. package/dist/store.js +6 -0
  34. package/dist/store.js.map +1 -1
  35. package/dist/version.js +2 -2
  36. package/package.json +2 -2
  37. package/src/chain/chains.ts +14 -6
  38. package/src/chain/discover.ts +212 -21
  39. package/src/chain/secure.ts +75 -31
  40. package/src/index.ts +5 -4
  41. package/src/main.ts +11 -6
  42. package/src/room.ts +14 -3
  43. package/src/server.ts +19 -0
  44. package/src/store.ts +6 -0
  45. package/src/version.ts +2 -2
package/src/server.ts CHANGED
@@ -148,6 +148,12 @@ export interface GameServerGateOptions extends GateBaseOptions {
148
148
  gameServerOrigins?: readonly string[];
149
149
  }
150
150
 
151
+ /**
152
+ * How a gate decides which PositionManagers it adopts coins from. One value today; the type exists
153
+ * so a client can compare rather than test for presence, and so a later policy has a name.
154
+ */
155
+ export type PositionManagerPolicy = 'wired-to-calculator';
156
+
151
157
  /**
152
158
  * The gate's public identity, in the exact shape the flaunch frontend's `GateServerConfig` already
153
159
  * parses — served this way so the page that builds launches needs no second config type.
@@ -169,7 +175,15 @@ export interface GateAnnouncement {
169
175
  roundDurationMs: number;
170
176
  minLobbyLeadMs: number;
171
177
  gateEndsAtGraceS: number;
178
+ /** The generation of the PRIMARY manager in `contracts.positionManager`; not a limit on adoption. */
172
179
  flaunchVariant: FlaunchVariant;
180
+ /**
181
+ * How this gate decides which PositionManagers it adopts coins from. `'wired-to-calculator'`
182
+ * means any manager whose fee wiring routes to `contracts.spendGatedCalculator`, derived from the
183
+ * coin itself at adoption; `contracts.positionManager` is then the primary manager, not the only
184
+ * one. A gate that omits the field (below 0.6.0) adopts coins on `contracts.positionManager` only.
185
+ */
186
+ positionManagerPolicy?: PositionManagerPolicy;
173
187
  /**
174
188
  * The non-ETH paired tokens this gate will run rounds on, each with the cap a launch on it should
175
189
  * write. Absent or empty means ETH pairings only. Launch tooling refuses a pairing that is not
@@ -512,12 +526,17 @@ function createGateRuntime<Config, State, Event, Action, PublicView, PlayerView>
512
526
  name: launch.name,
513
527
  symbol: launch.symbol,
514
528
  imageUrl: launch.imageUrl ?? null,
529
+ positionManager: launch.positionManager ?? null,
515
530
  },
516
531
  });
517
532
  } catch (error) {
518
533
  app.log.error(error);
519
534
  return { ok: false, status: 503, message: 'this game is still being prepared' };
520
535
  }
536
+ app.log.info(
537
+ `${launch.coinAddress}: adopted ${launch.symbol || 'coin'} on position manager ` +
538
+ `${launch.positionManager ?? 'primary'} (pool ${launch.poolId}, ${spendToken.symbol})`,
539
+ );
521
540
  rooms.set(launch.poolId, room);
522
541
  return { ok: true, room, created: true };
523
542
  }
package/src/store.ts CHANGED
@@ -89,6 +89,12 @@ alter table rounds
89
89
  alter table rounds
90
90
  add column if not exists usd_per_spend_token double precision check (usd_per_spend_token > 0);
91
91
 
92
+ -- Any wired PositionManager (0.6.0). The manager a round's coin was launched on, as the gate
93
+ -- resolved it from the coin at adoption. Null on rounds adopted before the gate recorded it, and on
94
+ -- demo and mock rounds; nothing reads it back for gameplay, it is provenance for the operator.
95
+ alter table rounds
96
+ add column if not exists position_manager text check (position_manager <> '');
97
+
92
98
  create table if not exists balances (
93
99
  round_id text not null references rounds(id) on delete cascade,
94
100
  player text not null,
package/src/version.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Generated by scripts/write-version.mjs from package.json at build time. Do not edit.
2
2
  /** The published version of @flayerlabs/gamemode-gate, as a literal so it survives any bundler. */
3
- export const GATE_VERSION: string = "0.5.6";
3
+ export const GATE_VERSION: string = "0.6.0";
4
4
  /** `@flayerlabs/gamemode-gate@<version>`: the text a build of this package can be searched for. */
5
- export const GATE_MARKER: string = "@flayerlabs/gamemode-gate@0.5.6";
5
+ export const GATE_MARKER: string = "@flayerlabs/gamemode-gate@0.6.0";