infinite-games-sdk 0.0.1 → 0.0.3
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 +193 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/history/HistoryClient.d.ts +20 -0
- package/dist/history/HistoryClient.d.ts.map +1 -0
- package/dist/history/HistoryClient.js +96 -0
- package/dist/history/HistoryClient.js.map +1 -0
- package/dist/history/index.d.ts +4 -0
- package/dist/history/index.d.ts.map +1 -0
- package/dist/history/index.js +8 -0
- package/dist/history/index.js.map +1 -0
- package/dist/history/types.d.ts +14 -0
- package/dist/history/types.d.ts.map +1 -0
- package/dist/history/types.js +3 -0
- package/dist/history/types.js.map +1 -0
- package/dist/history/useHistoryClient.d.ts +15 -0
- package/dist/history/useHistoryClient.d.ts.map +1 -0
- package/dist/history/useHistoryClient.js +84 -0
- package/dist/history/useHistoryClient.js.map +1 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -20
- package/dist/index.js.map +1 -0
- package/dist/launcher/index.d.ts +4 -0
- package/dist/launcher/index.d.ts.map +1 -0
- package/dist/launcher/index.js +9 -0
- package/dist/launcher/index.js.map +1 -0
- package/dist/launcher/types.d.ts +59 -0
- package/dist/launcher/types.d.ts.map +1 -0
- package/dist/launcher/types.js +20 -0
- package/dist/launcher/types.js.map +1 -0
- package/dist/launcher/useGameLauncher.d.ts +3 -0
- package/dist/launcher/useGameLauncher.d.ts.map +1 -0
- package/dist/launcher/useGameLauncher.js +137 -0
- package/dist/launcher/useGameLauncher.js.map +1 -0
- package/dist/session/SessionClient.d.ts +38 -0
- package/dist/session/SessionClient.d.ts.map +1 -0
- package/dist/session/SessionClient.js +129 -0
- package/dist/session/SessionClient.js.map +1 -0
- package/dist/session/index.d.ts +4 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +10 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/tokens.d.ts +15 -0
- package/dist/session/tokens.d.ts.map +1 -0
- package/dist/session/tokens.js +55 -0
- package/dist/session/tokens.js.map +1 -0
- package/dist/session/types.d.ts +21 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +3 -0
- package/dist/session/types.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/scale.d.ts +4 -0
- package/dist/utils/scale.d.ts.map +1 -0
- package/dist/utils/scale.js +13 -0
- package/dist/utils/scale.js.map +1 -0
- package/package.json +22 -14
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/index.ts +0 -19
- package/tsconfig.json +0 -17
package/README.md
CHANGED
|
@@ -1 +1,193 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Infinite Games SDK
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add infinite-games-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## SessionClient
|
|
10
|
+
|
|
11
|
+
### Launch a game (from parent site like doubleup-io)
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { SessionClient } from 'infinite-games-sdk';
|
|
15
|
+
|
|
16
|
+
const session = new SessionClient();
|
|
17
|
+
|
|
18
|
+
// Get launch URL with one-time token
|
|
19
|
+
const { launchUrl, origin, token } = await session.getLaunchUrl({
|
|
20
|
+
address: wallet.address,
|
|
21
|
+
signature: await wallet.signMessage('Sign in to Infinite Games'),
|
|
22
|
+
chain: 'sui',
|
|
23
|
+
gameType: 'baccarat',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Load game in iframe
|
|
27
|
+
iframe.src = launchUrl;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Initialize session (from game frontend)
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { SessionClient, AuthError } from 'infinite-games-sdk';
|
|
34
|
+
|
|
35
|
+
const session = new SessionClient();
|
|
36
|
+
const urlToken = new URLSearchParams(window.location.search).get('token');
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const result = await session.initializeSession(urlToken);
|
|
40
|
+
|
|
41
|
+
if (result.tokenType === 'table_id') {
|
|
42
|
+
// Spectator or returning player - load existing table
|
|
43
|
+
loadTable(result.tableId);
|
|
44
|
+
} else if (result.tokenType === 'ott') {
|
|
45
|
+
// New session - create table with session token
|
|
46
|
+
const table = await createTable(result.sessionToken, coinType);
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (error instanceof AuthError) {
|
|
50
|
+
showExpiredLinkError();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Quick token type check (no network call)
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
const tokenType = session.getTokenType(urlToken);
|
|
59
|
+
// 'ott' | 'table_id' | 'expired_jwt' | 'unknown'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## useGameLauncher
|
|
63
|
+
|
|
64
|
+
React hook that handles the complete game launch flow: wallet connection, session creation, URL management, and iframe communication.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { useGameLauncher } from 'infinite-games-sdk';
|
|
68
|
+
import { useSearchParams } from 'react-router-dom';
|
|
69
|
+
import { useAuth } from './hooks/useAuth';
|
|
70
|
+
|
|
71
|
+
function Blackjack() {
|
|
72
|
+
const { wallet, launch } = useAuth();
|
|
73
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
74
|
+
|
|
75
|
+
const {
|
|
76
|
+
iframeSrc,
|
|
77
|
+
iframeHeight,
|
|
78
|
+
error,
|
|
79
|
+
isLoading,
|
|
80
|
+
showConnectPrompt,
|
|
81
|
+
retry,
|
|
82
|
+
} = useGameLauncher(
|
|
83
|
+
{
|
|
84
|
+
gameType: 'blackjack',
|
|
85
|
+
defaultOrigin: 'https://blackjackdev.infiniteedgers.com',
|
|
86
|
+
// Optional: for local development
|
|
87
|
+
localOrigin: 'http://localhost:3001',
|
|
88
|
+
useLocal: false,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
wallet,
|
|
92
|
+
launch,
|
|
93
|
+
getSearchParams: () => searchParams,
|
|
94
|
+
setSearchParams: (params, opts) => setSearchParams(params, opts),
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (iframeSrc) {
|
|
99
|
+
return (
|
|
100
|
+
<iframe
|
|
101
|
+
src={iframeSrc}
|
|
102
|
+
style={{ height: iframeHeight ?? '100vh', width: '100%' }}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (showConnectPrompt) return <div>Connect your wallet to play</div>;
|
|
108
|
+
if (error) return <div>Error: {error} <button onClick={retry}>Retry</button></div>;
|
|
109
|
+
if (isLoading) return <div>Launching...</div>;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The hook automatically:
|
|
114
|
+
- Handles URL tokens for shareable links and spectator mode
|
|
115
|
+
- Launches new sessions when wallet is connected
|
|
116
|
+
- Listens for iframe messages (table creation, height updates)
|
|
117
|
+
- Updates URL params when tables are created
|
|
118
|
+
- Manages loading, error, and retry states
|
|
119
|
+
|
|
120
|
+
## HistoryClient
|
|
121
|
+
|
|
122
|
+
### React hook for game sync and spectating
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { useHistoryClient } from 'infinite-games-sdk';
|
|
126
|
+
|
|
127
|
+
function BaccaratGame({ tableId, coinType, sessionToken }) {
|
|
128
|
+
const isSpectator = !sessionToken;
|
|
129
|
+
|
|
130
|
+
const { isConnected, sendBetUpdate, sendGameReset } = useHistoryClient(
|
|
131
|
+
tableId,
|
|
132
|
+
coinType,
|
|
133
|
+
{
|
|
134
|
+
onGameEvent: (event) => {
|
|
135
|
+
// Game result broadcast - both owner and spectators receive this
|
|
136
|
+
playAnimation(event);
|
|
137
|
+
},
|
|
138
|
+
onBetUpdate: (bets) => {
|
|
139
|
+
// Spectators see owner's bet placement
|
|
140
|
+
if (isSpectator) setSpectatorBets(bets);
|
|
141
|
+
},
|
|
142
|
+
onGameReset: () => {
|
|
143
|
+
// Owner clicked Play Again
|
|
144
|
+
if (isSpectator) resetGame();
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// Owner broadcasts bets to spectators
|
|
150
|
+
const handleBetChange = (bets) => {
|
|
151
|
+
if (!isSpectator) sendBetUpdate(bets);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Vanilla JavaScript
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
import { HistoryClient } from 'infinite-games-sdk';
|
|
160
|
+
|
|
161
|
+
const history = new HistoryClient();
|
|
162
|
+
|
|
163
|
+
history.onMessage = (event) => {
|
|
164
|
+
const msg = JSON.parse(event.data);
|
|
165
|
+
if (msg.channel && msg.data) handleGameEvent(msg.data);
|
|
166
|
+
if (msg.type === 'bet_update') handleBetUpdate(msg);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
history.connect(tableId, 'sui/sui');
|
|
170
|
+
history.send({ type: 'bet_update', playerBet: 100, bankerBet: 0, tieBet: 50 });
|
|
171
|
+
history.disconnect();
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Scale Utilities
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import { toBackendScale, fromBackendScale } from 'infinite-games-sdk';
|
|
178
|
+
|
|
179
|
+
toBackendScale(1.5); // 1500000000
|
|
180
|
+
fromBackendScale(1500000000); // 1.5
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Configuration
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// Dev (default)
|
|
187
|
+
new SessionClient();
|
|
188
|
+
new HistoryClient();
|
|
189
|
+
|
|
190
|
+
// Production
|
|
191
|
+
new SessionClient({ baseUrl: 'https://session.infiniteedgers.com' });
|
|
192
|
+
new HistoryClient({ baseUrl: 'history.infiniteedgers.com' });
|
|
193
|
+
```
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,SAAe;CACpB"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthError = void 0;
|
|
4
|
+
class AuthError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.name = 'AuthError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.AuthError = AuthError;
|
|
11
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAApC;;QACE,SAAI,GAAG,WAAW,CAAC;IACrB,CAAC;CAAA;AAFD,8BAEC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HistoryConfig } from './types';
|
|
2
|
+
export declare class HistoryClient {
|
|
3
|
+
private ws;
|
|
4
|
+
private config;
|
|
5
|
+
private keepAliveInterval;
|
|
6
|
+
private reconnectTimeout;
|
|
7
|
+
private tableId;
|
|
8
|
+
private coinType;
|
|
9
|
+
onMessage: ((event: MessageEvent) => void) | null;
|
|
10
|
+
onConnect: (() => void) | null;
|
|
11
|
+
onDisconnect: (() => void) | null;
|
|
12
|
+
onError: ((error: Event) => void) | null;
|
|
13
|
+
constructor(config?: HistoryConfig);
|
|
14
|
+
connect(tableId: string, coinType: string): void;
|
|
15
|
+
disconnect(): void;
|
|
16
|
+
send(message: object): void;
|
|
17
|
+
private startKeepAlive;
|
|
18
|
+
private cleanup;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=HistoryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryClient.d.ts","sourceRoot":"","sources":["../../src/history/HistoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMxC,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,QAAQ,CAAuB;IAEhC,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IACzD,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;IACtC,YAAY,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;IACzC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;gBAE3C,MAAM,GAAE,aAAkB;IAStC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IA0ChD,UAAU,IAAI,IAAI;IASlB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,OAAO;CAUhB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HistoryClient = void 0;
|
|
4
|
+
const DEFAULT_BASE_URL = 'historydev.infiniteedgers.com';
|
|
5
|
+
const DEFAULT_KEEP_ALIVE_INTERVAL_MS = 30000;
|
|
6
|
+
const DEFAULT_RECONNECT_DELAY_MS = 3000;
|
|
7
|
+
class HistoryClient {
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
this.ws = null;
|
|
10
|
+
this.keepAliveInterval = null;
|
|
11
|
+
this.reconnectTimeout = null;
|
|
12
|
+
this.tableId = null;
|
|
13
|
+
this.coinType = null;
|
|
14
|
+
this.onMessage = null;
|
|
15
|
+
this.onConnect = null;
|
|
16
|
+
this.onDisconnect = null;
|
|
17
|
+
this.onError = null;
|
|
18
|
+
this.config = {
|
|
19
|
+
baseUrl: config.baseUrl || DEFAULT_BASE_URL,
|
|
20
|
+
keepAliveIntervalMs: config.keepAliveIntervalMs || DEFAULT_KEEP_ALIVE_INTERVAL_MS,
|
|
21
|
+
reconnectDelayMs: config.reconnectDelayMs || DEFAULT_RECONNECT_DELAY_MS,
|
|
22
|
+
autoReconnect: config.autoReconnect !== false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
connect(tableId, coinType) {
|
|
26
|
+
this.tableId = tableId;
|
|
27
|
+
this.coinType = coinType;
|
|
28
|
+
// Convert coin_type from "sui/sui" to "sui-sui" for URL
|
|
29
|
+
const coinTypeUrl = coinType.replace('/', '-');
|
|
30
|
+
const url = `wss://${this.config.baseUrl}/api/ws/${encodeURIComponent(tableId)}/${encodeURIComponent(coinTypeUrl)}`;
|
|
31
|
+
this.ws = new WebSocket(url);
|
|
32
|
+
this.ws.onopen = () => {
|
|
33
|
+
this.startKeepAlive();
|
|
34
|
+
if (this.onConnect) {
|
|
35
|
+
this.onConnect();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.ws.onmessage = (event) => {
|
|
39
|
+
if (this.onMessage) {
|
|
40
|
+
this.onMessage(event);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.ws.onclose = () => {
|
|
44
|
+
this.cleanup();
|
|
45
|
+
if (this.onDisconnect) {
|
|
46
|
+
this.onDisconnect();
|
|
47
|
+
}
|
|
48
|
+
if (this.config.autoReconnect && this.tableId && this.coinType) {
|
|
49
|
+
this.reconnectTimeout = window.setTimeout(() => {
|
|
50
|
+
this.connect(this.tableId, this.coinType);
|
|
51
|
+
}, this.config.reconnectDelayMs);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
this.ws.onerror = (error) => {
|
|
55
|
+
if (this.onError) {
|
|
56
|
+
this.onError(error);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
disconnect() {
|
|
61
|
+
this.config.autoReconnect = false;
|
|
62
|
+
this.cleanup();
|
|
63
|
+
if (this.ws) {
|
|
64
|
+
this.ws.close();
|
|
65
|
+
this.ws = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
send(message) {
|
|
69
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
70
|
+
this.ws.send(JSON.stringify(message));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
startKeepAlive() {
|
|
74
|
+
if (this.keepAliveInterval !== null) {
|
|
75
|
+
clearInterval(this.keepAliveInterval);
|
|
76
|
+
}
|
|
77
|
+
this.keepAliveInterval = window.setInterval(() => {
|
|
78
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
79
|
+
// Send plain 'ping' string - history service expects this format
|
|
80
|
+
this.ws.send('ping');
|
|
81
|
+
}
|
|
82
|
+
}, this.config.keepAliveIntervalMs);
|
|
83
|
+
}
|
|
84
|
+
cleanup() {
|
|
85
|
+
if (this.keepAliveInterval !== null) {
|
|
86
|
+
clearInterval(this.keepAliveInterval);
|
|
87
|
+
this.keepAliveInterval = null;
|
|
88
|
+
}
|
|
89
|
+
if (this.reconnectTimeout !== null) {
|
|
90
|
+
clearTimeout(this.reconnectTimeout);
|
|
91
|
+
this.reconnectTimeout = null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.HistoryClient = HistoryClient;
|
|
96
|
+
//# sourceMappingURL=HistoryClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryClient.js","sourceRoot":"","sources":["../../src/history/HistoryClient.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AACzD,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAC7C,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC,MAAa,aAAa;IAaxB,YAAY,SAAwB,EAAE;QAZ9B,OAAE,GAAqB,IAAI,CAAC;QAE5B,sBAAiB,GAAkB,IAAI,CAAC;QACxC,qBAAgB,GAAkB,IAAI,CAAC;QACvC,YAAO,GAAkB,IAAI,CAAC;QAC9B,aAAQ,GAAkB,IAAI,CAAC;QAEhC,cAAS,GAA2C,IAAI,CAAC;QACzD,cAAS,GAAwB,IAAI,CAAC;QACtC,iBAAY,GAAwB,IAAI,CAAC;QACzC,YAAO,GAAoC,IAAI,CAAC;QAGrD,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,gBAAgB;YAC3C,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,IAAI,8BAA8B;YACjF,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,0BAA0B;YACvE,aAAa,EAAE,MAAM,CAAC,aAAa,KAAK,KAAK;SAC9C,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAe,EAAE,QAAgB;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,wDAAwD;QACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,SAAS,IAAI,CAAC,MAAM,C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ACnC,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAtGD,sCAsGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHistoryClient = exports.HistoryClient = void 0;
|
|
4
|
+
var HistoryClient_1 = require("./HistoryClient");
|
|
5
|
+
Object.defineProperty(exports, "HistoryClient", { enumerable: true, get: function () { return HistoryClient_1.HistoryClient; } });
|
|
6
|
+
var useHistoryClient_1 = require("./useHistoryClient");
|
|
7
|
+
Object.defineProperty(exports, "useHistoryClient", { enumerable: true, get: function () { return useHistoryClient_1.useHistoryClient; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface HistoryConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
keepAliveIntervalMs?: number;
|
|
4
|
+
reconnectDelayMs?: number;
|
|
5
|
+
autoReconnect?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface GameEvent {
|
|
8
|
+
type: string;
|
|
9
|
+
data: any;
|
|
10
|
+
}
|
|
11
|
+
export interface BetUpdate {
|
|
12
|
+
[key: string]: number;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GameEvent, BetUpdate, HistoryConfig } from './types';
|
|
2
|
+
interface UseHistoryClientOptions {
|
|
3
|
+
onGameEvent?: (event: GameEvent) => void;
|
|
4
|
+
onBetUpdate?: (update: BetUpdate) => void;
|
|
5
|
+
onGameReset?: () => void;
|
|
6
|
+
config?: HistoryConfig;
|
|
7
|
+
}
|
|
8
|
+
export declare function useHistoryClient(tableId: string | null, coinType: string | null, options?: UseHistoryClientOptions): {
|
|
9
|
+
isConnected: boolean;
|
|
10
|
+
sendBetUpdate: (bets: BetUpdate) => void;
|
|
11
|
+
sendGameReset: () => void;
|
|
12
|
+
disconnect: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useHistoryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHistoryClient.d.ts","sourceRoot":"","sources":["../../src/history/useHistoryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE9D,UAAU,uBAAuB;IAC/B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,OAAO,GAAE,uBAA4B;;0BAkER,SAAS;;;EAwBvC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHistoryClient = useHistoryClient;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const HistoryClient_1 = require("./HistoryClient");
|
|
6
|
+
function useHistoryClient(tableId, coinType, options = {}) {
|
|
7
|
+
const [isConnected, setIsConnected] = (0, react_1.useState)(false);
|
|
8
|
+
const clientRef = (0, react_1.useRef)(null);
|
|
9
|
+
// Use refs for callbacks to avoid stale closures
|
|
10
|
+
const onGameEventRef = (0, react_1.useRef)(options.onGameEvent);
|
|
11
|
+
const onBetUpdateRef = (0, react_1.useRef)(options.onBetUpdate);
|
|
12
|
+
const onGameResetRef = (0, react_1.useRef)(options.onGameReset);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
onGameEventRef.current = options.onGameEvent;
|
|
15
|
+
onBetUpdateRef.current = options.onBetUpdate;
|
|
16
|
+
onGameResetRef.current = options.onGameReset;
|
|
17
|
+
}, [options.onGameEvent, options.onBetUpdate, options.onGameReset]);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
if (!tableId || !coinType) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const client = new HistoryClient_1.HistoryClient(options.config);
|
|
23
|
+
clientRef.current = client;
|
|
24
|
+
client.onConnect = () => {
|
|
25
|
+
setIsConnected(true);
|
|
26
|
+
};
|
|
27
|
+
client.onDisconnect = () => {
|
|
28
|
+
setIsConnected(false);
|
|
29
|
+
};
|
|
30
|
+
client.onMessage = (event) => {
|
|
31
|
+
try {
|
|
32
|
+
const message = JSON.parse(event.data);
|
|
33
|
+
// Wrapped event: {channel, data}
|
|
34
|
+
if (message.channel && message.data) {
|
|
35
|
+
if (onGameEventRef.current) {
|
|
36
|
+
onGameEventRef.current(message.data);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Relay messages: {type, ...}
|
|
40
|
+
else if (message.type === 'bet_update') {
|
|
41
|
+
if (onBetUpdateRef.current) {
|
|
42
|
+
const { type, ...bets } = message;
|
|
43
|
+
onBetUpdateRef.current(bets);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (message.type === 'game_reset') {
|
|
47
|
+
if (onGameResetRef.current) {
|
|
48
|
+
onGameResetRef.current();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error('Failed to parse WebSocket message:', error);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
client.connect(tableId, coinType);
|
|
57
|
+
return () => {
|
|
58
|
+
client.disconnect();
|
|
59
|
+
clientRef.current = null;
|
|
60
|
+
};
|
|
61
|
+
}, [tableId, coinType, options.config]);
|
|
62
|
+
const sendBetUpdate = (bets) => {
|
|
63
|
+
if (clientRef.current) {
|
|
64
|
+
clientRef.current.send({ type: 'bet_update', ...bets });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const sendGameReset = () => {
|
|
68
|
+
if (clientRef.current) {
|
|
69
|
+
clientRef.current.send({ type: 'game_reset' });
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const disconnect = () => {
|
|
73
|
+
if (clientRef.current) {
|
|
74
|
+
clientRef.current.disconnect();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
isConnected,
|
|
79
|
+
sendBetUpdate,
|
|
80
|
+
sendGameReset,
|
|
81
|
+
disconnect,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=useHistoryClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHistoryClient.js","sourceRoot":"","sources":["../../src/history/useHistoryClient.ts"],"names":[],"mappings":";;AAWA,4CA6FC;AAxGD,iCAAoD;AACpD,mDAAgD;AAUhD,SAAgB,gBAAgB,CAC9B,OAAsB,EACtB,QAAuB,EACvB,UAAmC,EAAE;IAErC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAA,cAAM,EAAuB,IAAI,CAAC,CAAC;IAErD,iDAAiD;IACjD,MAAM,cAAc,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;QAC7C,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;QAC7C,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAC/C,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAEpE,IA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EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAElC,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,UAAU,EAAE,CAAC;YACpB,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAExC,MAAM,aAAa,GAAG,CAAC,IAAe,EAAE,EAAE;QACxC,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,WAAW;QACX,aAAa;QACb,aAAa;QACb,UAAU;KACX,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { SessionClient } from './session';
|
|
2
|
+
export { HistoryClient, useHistoryClient } from './history';
|
|
3
|
+
export { useGameLauncher } from './launcher';
|
|
4
|
+
export { looksLikeJwt, isOneTimeToken, isTableId } from './session/tokens';
|
|
5
|
+
export { toBackendScale, fromBackendScale, SCALE_FACTOR } from './utils/scale';
|
|
6
|
+
export { getCompatibleCoinType, VALID_COINS } from './launcher';
|
|
7
|
+
export { AuthError } from './errors';
|
|
8
|
+
export type { SessionConfig, LaunchParams, LaunchResult, TokenType, InitializeResult, } from './session/types';
|
|
9
|
+
export type { HistoryConfig, GameEvent, BetUpdate } from './history/types';
|
|
10
|
+
export type { GameLauncherConfig, UseGameLauncherOptions, GameLauncherState, WalletState, LaunchMutation, } from './launcher';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC3E,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
exports.AuthError = exports.VALID_COINS = exports.getCompatibleCoinType = exports.SCALE_FACTOR = exports.fromBackendScale = exports.toBackendScale = exports.isTableId = exports.isOneTimeToken = exports.looksLikeJwt = exports.useGameLauncher = exports.useHistoryClient = exports.HistoryClient = exports.SessionClient = void 0;
|
|
4
|
+
// Clients
|
|
5
|
+
var session_1 = require("./session");
|
|
6
|
+
Object.defineProperty(exports, "SessionClient", { enumerable: true, get: function () { return session_1.SessionClient; } });
|
|
7
|
+
var history_1 = require("./history");
|
|
8
|
+
Object.defineProperty(exports, "HistoryClient", { enumerable: true, get: function () { return history_1.HistoryClient; } });
|
|
9
|
+
Object.defineProperty(exports, "useHistoryClient", { enumerable: true, get: function () { return history_1.useHistoryClient; } });
|
|
10
|
+
// Hooks
|
|
11
|
+
var launcher_1 = require("./launcher");
|
|
12
|
+
Object.defineProperty(exports, "useGameLauncher", { enumerable: true, get: function () { return launcher_1.useGameLauncher; } });
|
|
13
|
+
// Utilities
|
|
14
|
+
var tokens_1 = require("./session/tokens");
|
|
15
|
+
Object.defineProperty(exports, "looksLikeJwt", { enumerable: true, get: function () { return tokens_1.looksLikeJwt; } });
|
|
16
|
+
Object.defineProperty(exports, "isOneTimeToken", { enumerable: true, get: function () { return tokens_1.isOneTimeToken; } });
|
|
17
|
+
Object.defineProperty(exports, "isTableId", { enumerable: true, get: function () { return tokens_1.isTableId; } });
|
|
18
|
+
var scale_1 = require("./utils/scale");
|
|
19
|
+
Object.defineProperty(exports, "toBackendScale", { enumerable: true, get: function () { return scale_1.toBackendScale; } });
|
|
20
|
+
Object.defineProperty(exports, "fromBackendScale", { enumerable: true, get: function () { return scale_1.fromBackendScale; } });
|
|
21
|
+
Object.defineProperty(exports, "SCALE_FACTOR", { enumerable: true, get: function () { return scale_1.SCALE_FACTOR; } });
|
|
22
|
+
var launcher_2 = require("./launcher");
|
|
23
|
+
Object.defineProperty(exports, "getCompatibleCoinType", { enumerable: true, get: function () { return launcher_2.getCompatibleCoinType; } });
|
|
24
|
+
Object.defineProperty(exports, "VALID_COINS", { enumerable: true, get: function () { return launcher_2.VALID_COINS; } });
|
|
25
|
+
// Errors
|
|
26
|
+
var errors_1 = require("./errors");
|
|
27
|
+
Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return errors_1.AuthError; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,UAAU;AACV,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,qCAA4D;AAAnD,wGAAA,aAAa,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAExC,QAAQ;AACR,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AAExB,YAAY;AACZ,2CAA2E;AAAlE,sGAAA,YAAY,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA;AAChD,uCAA+E;AAAtE,uGAAA,cAAc,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,qGAAA,YAAY,OAAA;AACvD,uCAAgE;AAAvD,iHAAA,qBAAqB,OAAA;AAAE,uGAAA,WAAW,OAAA;AAE3C,SAAS;AACT,mCAAqC;AAA5B,mGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useGameLauncher } from './useGameLauncher';
|
|
2
|
+
export type { GameLauncherConfig, UseGameLauncherOptions, GameLauncherState, WalletState, LaunchMutation, } from './types';
|
|
3
|
+
export { getCompatibleCoinType, VALID_COINS } from './types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/launcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VALID_COINS = exports.getCompatibleCoinType = exports.useGameLauncher = void 0;
|
|
4
|
+
var useGameLauncher_1 = require("./useGameLauncher");
|
|
5
|
+
Object.defineProperty(exports, "useGameLauncher", { enumerable: true, get: function () { return useGameLauncher_1.useGameLauncher; } });
|
|
6
|
+
var types_1 = require("./types");
|
|
7
|
+
Object.defineProperty(exports, "getCompatibleCoinType", { enumerable: true, get: function () { return types_1.getCompatibleCoinType; } });
|
|
8
|
+
Object.defineProperty(exports, "VALID_COINS", { enumerable: true, get: function () { return types_1.VALID_COINS; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/launcher/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AAQxB,iCAA6D;AAApD,8GAAA,qBAAqB,OAAA;AAAE,oGAAA,WAAW,OAAA"}
|