@flayerlabs/gamemode-client 0.1.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/LICENSE +9 -0
- package/README.md +93 -0
- package/dist/embed.d.ts +45 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +329 -0
- package/dist/embed.js.map +1 -0
- package/dist/identity.d.ts +13 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +49 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/live.d.ts +59 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +526 -0
- package/dist/live.js.map +1 -0
- package/dist/mock.d.ts +55 -0
- package/dist/mock.d.ts.map +1 -0
- package/dist/mock.js +216 -0
- package/dist/mock.js.map +1 -0
- package/dist/replay-market.d.ts +61 -0
- package/dist/replay-market.d.ts.map +1 -0
- package/dist/replay-market.js +99 -0
- package/dist/replay-market.js.map +1 -0
- package/dist/signal.d.ts +11 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/signal.js +27 -0
- package/dist/signal.js.map +1 -0
- package/package.json +53 -0
- package/src/embed.ts +395 -0
- package/src/identity.ts +51 -0
- package/src/index.ts +172 -0
- package/src/live.ts +609 -0
- package/src/mock.ts +249 -0
- package/src/replay-market.ts +150 -0
- package/src/signal.ts +26 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { GameModule, PlayerId } from '@flayerlabs/gamemode-spec';
|
|
2
|
+
import type { BuyFailure, ConnectionState, EconomyBalance, LaunchContext, MarketState, PlayerIdentity, PresenceState, Reaction } from '@flayerlabs/gamemode-spec/live';
|
|
3
|
+
export type { BuyFailure, ConnectionState, EconomyBalance, LaunchContext, MarketPrice, MarketState, MarketTrade, PlayerIdentity, PresenceState, Reaction, } from '@flayerlabs/gamemode-spec/live';
|
|
4
|
+
export { joinRoom, NoWallet } from './live.js';
|
|
5
|
+
export { connectEmbeddedGame, serveEmbeddedGame } from './embed.js';
|
|
6
|
+
export type { ConnectEmbeddedGameOptions, EmbeddedGameConnection, ServeEmbeddedGameOptions, } from './embed.js';
|
|
7
|
+
export { BUSY_LAUNCH, replayMarket } from './replay-market.js';
|
|
8
|
+
export type { MarketFixture, ReplayMarket } from './replay-market.js';
|
|
9
|
+
export type { Authorisation, Host, HostBuyProgress, LiveOptions } from './live.js';
|
|
10
|
+
/**
|
|
11
|
+
* What a game talks to. Gameplay stays small; reusable platform concerns live in named capabilities.
|
|
12
|
+
*
|
|
13
|
+
* A game never sees a socket, a wallet, a chain or a key. Everything it can do is here, which is
|
|
14
|
+
* why a bug in a game cannot lose anyone money: it has no way to express the transaction that
|
|
15
|
+
* would.
|
|
16
|
+
*/
|
|
17
|
+
export interface Room<PublicView, PlayerView, Action> {
|
|
18
|
+
/** Called with the current view immediately, then whenever it changes. Returns an unsubscribe. */
|
|
19
|
+
subscribe(listener: (snapshot: Snapshot<PublicView, PlayerView>) => void): () => void;
|
|
20
|
+
/** Propose an action. Points exist only if the rules, running on the server, award them. */
|
|
21
|
+
send(action: Action): Promise<SendResult>;
|
|
22
|
+
/**
|
|
23
|
+
* The only clock a game may trust.
|
|
24
|
+
*
|
|
25
|
+
* Corrected against the server, so every player counts down to the same instant regardless of
|
|
26
|
+
* how wrong their own device's clock is. `Date.now()` in a game is a bug: two players in
|
|
27
|
+
* different timezones, or one with a drifting clock, see different games.
|
|
28
|
+
*/
|
|
29
|
+
now(): number;
|
|
30
|
+
/** Fixed launch facts. Live rooms do not resolve until these have arrived. */
|
|
31
|
+
readonly launch: Readable<LaunchContext>;
|
|
32
|
+
readonly connection: Readable<ConnectionState>;
|
|
33
|
+
readonly economy: Economy;
|
|
34
|
+
readonly market: Readable<MarketState>;
|
|
35
|
+
readonly identity: IdentityResolver;
|
|
36
|
+
readonly presence: Presence;
|
|
37
|
+
readonly social: Social;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
40
|
+
/** An observable value whose subscriber always receives the current value immediately. */
|
|
41
|
+
export interface Readable<T> {
|
|
42
|
+
current(): T;
|
|
43
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
44
|
+
}
|
|
45
|
+
export interface Snapshot<PublicView, PlayerView> {
|
|
46
|
+
/** What everyone sees. */
|
|
47
|
+
publicView: PublicView;
|
|
48
|
+
/** What this player sees. Null until they have joined. */
|
|
49
|
+
playerView: PlayerView | null;
|
|
50
|
+
}
|
|
51
|
+
export type SendResult = {
|
|
52
|
+
accepted: true;
|
|
53
|
+
} | {
|
|
54
|
+
accepted: false;
|
|
55
|
+
refuse: string;
|
|
56
|
+
};
|
|
57
|
+
export interface Economy extends Readable<EconomyState> {
|
|
58
|
+
/** What this player could spend right now, in wei. */
|
|
59
|
+
available(): bigint;
|
|
60
|
+
/**
|
|
61
|
+
* Spend up to `maxSpendWei` on the coin.
|
|
62
|
+
*
|
|
63
|
+
* The game does not build this transaction and cannot: the page it is embedded in constructs it
|
|
64
|
+
* from the server's authorisation and asks the player to approve it.
|
|
65
|
+
*/
|
|
66
|
+
buy(maxSpendWei: bigint): Promise<BuyResult>;
|
|
67
|
+
}
|
|
68
|
+
export interface EconomyState extends EconomyBalance {
|
|
69
|
+
buy: BuyProgress | null;
|
|
70
|
+
}
|
|
71
|
+
export type BuyProgress = {
|
|
72
|
+
state: 'signing';
|
|
73
|
+
spendWei: bigint;
|
|
74
|
+
} | {
|
|
75
|
+
state: 'pending';
|
|
76
|
+
spendWei: bigint;
|
|
77
|
+
transactionHash?: string;
|
|
78
|
+
} | {
|
|
79
|
+
state: 'confirmed';
|
|
80
|
+
spentWei: bigint;
|
|
81
|
+
transactionHash?: string;
|
|
82
|
+
} | {
|
|
83
|
+
state: 'failed';
|
|
84
|
+
reason: BuyFailure;
|
|
85
|
+
};
|
|
86
|
+
export type BuyResult = {
|
|
87
|
+
bought: true;
|
|
88
|
+
spentWei: bigint;
|
|
89
|
+
} | {
|
|
90
|
+
bought: false;
|
|
91
|
+
reason: BuyFailure;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Why a buy did not happen, in terms a player can be told about.
|
|
95
|
+
*
|
|
96
|
+
* Deliberately a short list of plain outcomes rather than anything from the chain. A game should
|
|
97
|
+
* never render a revert string or an error code at a player: the client maps each of these to its
|
|
98
|
+
* own copy, and the copy is free to change without the meaning moving.
|
|
99
|
+
*/
|
|
100
|
+
export interface Social {
|
|
101
|
+
react(id: string): void;
|
|
102
|
+
onReaction(listener: (reaction: Reaction) => void): () => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Who is connected. Read-only, because readiness is a game's rule and not the platform's.
|
|
106
|
+
*
|
|
107
|
+
* A game that needs a ready-up lobby defines a ready Action, sends it with {@link Room.send}, and
|
|
108
|
+
* counts it in its own state — where `decide()` can actually see it and act on it.
|
|
109
|
+
*/
|
|
110
|
+
export type Presence = Readable<PresenceState>;
|
|
111
|
+
export interface IdentityResolver {
|
|
112
|
+
resolve(players: readonly PlayerId[]): Promise<readonly PlayerIdentity[]>;
|
|
113
|
+
}
|
|
114
|
+
/** Trusted, normalized platform data supplied by the embedding integration. */
|
|
115
|
+
export interface ClientPlatform {
|
|
116
|
+
market?: Readable<MarketState>;
|
|
117
|
+
identity?: IdentityResolver;
|
|
118
|
+
}
|
|
119
|
+
export interface MockOptions<Config> {
|
|
120
|
+
config: Config;
|
|
121
|
+
/** Pins the round so a reload is the same round. Any number. */
|
|
122
|
+
seed?: number;
|
|
123
|
+
/** How long until the round opens. Short, because this is for building against. */
|
|
124
|
+
lobbyMs?: number;
|
|
125
|
+
roundMs?: number;
|
|
126
|
+
/** Who you are. A made-up address unless you say otherwise. */
|
|
127
|
+
player?: PlayerId;
|
|
128
|
+
/** Points-to-wei, only so the buy button has something to show. */
|
|
129
|
+
weiPerPoint?: bigint;
|
|
130
|
+
launch?: LaunchContext;
|
|
131
|
+
platform?: ClientPlatform;
|
|
132
|
+
/** The same cosmetic catalogue as live. Omitted disables reactions. */
|
|
133
|
+
reactionIds?: readonly string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A room with nothing behind it.
|
|
137
|
+
*
|
|
138
|
+
* This is what `pnpm dev` runs, and it is not a stand-in: it drives the game's REAL rules module,
|
|
139
|
+
* the same one the server runs. So a game cannot pass locally and fail live through a difference
|
|
140
|
+
* in the rules — there is no second implementation to disagree with. What is faked is only the
|
|
141
|
+
* things a laptop has no way to provide: the network, the wallet and the money.
|
|
142
|
+
*/
|
|
143
|
+
export declare function createMockRoom<Config, State, Event, Action, PublicView, PlayerView>(game: GameModule<Config, State, Event, Action, PublicView, PlayerView>, options: MockOptions<Config>): Room<PublicView, PlayerView, Action>;
|
|
144
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,EACT,MAAM,gCAAgC,CAAC;AAGxC,YAAY,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,GACT,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpE,YAAY,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,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live.js';
|
|
3
|
+
export { connectEmbeddedGame, serveEmbeddedGame } from './embed.js';
|
|
4
|
+
export { BUSY_LAUNCH, replayMarket } from './replay-market.js';
|
|
5
|
+
/**
|
|
6
|
+
* A room with nothing behind it.
|
|
7
|
+
*
|
|
8
|
+
* This is what `pnpm dev` runs, and it is not a stand-in: it drives the game's REAL rules module,
|
|
9
|
+
* the same one the server runs. So a game cannot pass locally and fail live through a difference
|
|
10
|
+
* in the rules — there is no second implementation to disagree with. What is faked is only the
|
|
11
|
+
* things a laptop has no way to provide: the network, the wallet and the money.
|
|
12
|
+
*/
|
|
13
|
+
export function createMockRoom(game, options) {
|
|
14
|
+
return new MockRoom(game, options);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAerC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAMpE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA6H/D;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAsE,EACtE,OAA4B;IAE5B,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/live.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BuyResult, ClientPlatform, Room } from './index.js';
|
|
2
|
+
import type { SpendAuthorisation } from '@flayerlabs/gamemode-spec/embed';
|
|
3
|
+
import { type LaunchContext, type MarketState } from '@flayerlabs/gamemode-spec/live';
|
|
4
|
+
/**
|
|
5
|
+
* The page the game is embedded in, as far as the game is concerned.
|
|
6
|
+
*
|
|
7
|
+
* This is the whole wallet surface, and it is two verbs rather than a pipe. The game cannot ask
|
|
8
|
+
* for a transaction to be sent, because there is no way to say it: `buy` names an authorisation
|
|
9
|
+
* the gate already signed, and the page builds the transaction from that itself.
|
|
10
|
+
*
|
|
11
|
+
* The version this replaces forwarded `eth_sendTransaction` with parameters from the frame, which
|
|
12
|
+
* meant a game could ask for any transaction at all and have it appear in the trusted context of
|
|
13
|
+
* the page. That is fine for a game you wrote and wrong for one you did not.
|
|
14
|
+
*/
|
|
15
|
+
export interface Host {
|
|
16
|
+
/**
|
|
17
|
+
* Which wallet is connected to the page, or null if none is.
|
|
18
|
+
*
|
|
19
|
+
* Null is an answer, not a failure: a game can tell a player to connect. The version this
|
|
20
|
+
* replaces stayed silent instead, so the game waited out an eight-second timeout and then fell
|
|
21
|
+
* back to whatever extension the browser happened to have — which is how someone ended up signed
|
|
22
|
+
* in as one wallet while the page showed another.
|
|
23
|
+
*/
|
|
24
|
+
address(signal?: AbortSignal): Promise<string | null>;
|
|
25
|
+
/** Ask the player to prove that wallet is theirs. Honour abort when the trusted embed closes. */
|
|
26
|
+
signIn(message: string, signal?: AbortSignal): Promise<`0x${string}`>;
|
|
27
|
+
/** Fresh, single-use admission evidence. Honour abort when the trusted embed closes. */
|
|
28
|
+
sessionEvidence?(signal?: AbortSignal): Promise<unknown>;
|
|
29
|
+
/** Spend an authorisation the gate issued. The page builds and submits the transaction. */
|
|
30
|
+
buy(authorisation: Authorisation, progress?: (event: HostBuyProgress) => void, signal?: AbortSignal): Promise<{
|
|
31
|
+
spentWei: bigint;
|
|
32
|
+
} | {
|
|
33
|
+
failed: BuyResult;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/** The host reports only what it uniquely knows; LiveRoom owns the terminal result. */
|
|
37
|
+
export type HostBuyProgress = {
|
|
38
|
+
state: 'pending';
|
|
39
|
+
transactionHash?: string;
|
|
40
|
+
};
|
|
41
|
+
/** Exactly what the gate signed. Everything is a string because bigints do not survive JSON. */
|
|
42
|
+
export type Authorisation = SpendAuthorisation;
|
|
43
|
+
export interface LiveOptions {
|
|
44
|
+
/** The gate's origin. The one place this game is allowed to talk to. */
|
|
45
|
+
gateUrl: string;
|
|
46
|
+
roundId: string;
|
|
47
|
+
host: Host;
|
|
48
|
+
/** May be supplied by the parent immediately; a new gate also sends it in its first snapshot. */
|
|
49
|
+
launch?: LaunchContext;
|
|
50
|
+
platform?: ClientPlatform;
|
|
51
|
+
}
|
|
52
|
+
export declare function joinRoom<PublicView, PlayerView, Action>(options: LiveOptions): Promise<Room<PublicView, PlayerView, Action>>;
|
|
53
|
+
export declare function marketFrom(input: unknown): MarketState | null;
|
|
54
|
+
export declare function immutableLaunch(launch: LaunchContext): LaunchContext;
|
|
55
|
+
/** No wallet is connected to the page. A game should ask the player to connect one. */
|
|
56
|
+
export declare class NoWallet extends Error {
|
|
57
|
+
constructor();
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,SAAS,EACT,cAAc,EAGd,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,WAAW,EAKjB,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,IAAI;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEtD,iGAAiG;IACjG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IACtE,wFAAwF;IACxF,eAAe,CAAC,CA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