gameon-sdk 1.0.0 → 1.0.1
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 +21 -0
- package/README.md +94 -0
- package/package.json +21 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gameonworld.ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# gameon-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript client for the GameOn roulette backend REST API. Fully typed, ESM, uses the built-in `fetch` (Node 18+ and browsers).
|
|
4
|
+
|
|
5
|
+
The client is generated from [`specs/openapi.yaml`](specs/openapi.yaml). Live round updates (`roundState`, `livePlayer`, `settle`) are sent over socket.io and are not part of this SDK.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install gameon-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Configuration, DefaultApi, ResponseError } from "gameon-sdk";
|
|
17
|
+
|
|
18
|
+
const api = new DefaultApi(
|
|
19
|
+
new Configuration({ basePath: "https://your-backend.example.com" })
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const health = await api.getHealth();
|
|
24
|
+
const config = await api.getGameConfig();
|
|
25
|
+
const state = await api.getGameState();
|
|
26
|
+
const balance = await api.getUserWalletBalance({ userUuid: "USER_UUID" });
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err instanceof ResponseError) {
|
|
29
|
+
console.error(err.response.status, await err.response.text());
|
|
30
|
+
} else {
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Admin endpoints
|
|
37
|
+
|
|
38
|
+
Admin endpoints use the `x-admin-key` header:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const admin = new DefaultApi(
|
|
42
|
+
new Configuration({
|
|
43
|
+
basePath: "https://your-backend.example.com",
|
|
44
|
+
apiKey: (name) => (name === "x-admin-key" ? process.env.ADMIN_KEY! : ""),
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const pool = await admin.getAdminHousePool();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
All methods are on `DefaultApi`. Each one also has a `...Raw()` variant that returns the full HTTP response.
|
|
54
|
+
|
|
55
|
+
| Method | Description |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `getHealth()` | Health check |
|
|
58
|
+
| `getGameConfig()` | Game configuration (currencies, limits) |
|
|
59
|
+
| `getFxRate()` | Current FX rate |
|
|
60
|
+
| `getGameState()` | Current round state |
|
|
61
|
+
| `getGameRounds({ ... })` | Recent rounds |
|
|
62
|
+
| `getGameHistory({ ... })` | Recent winning numbers |
|
|
63
|
+
| `getGameMyBets({ ... })` | A player's bets |
|
|
64
|
+
| `getGameMyHistory({ ... })` | A player's game history |
|
|
65
|
+
| `placeGameBet({ placeBetRequest })` | Place a bet |
|
|
66
|
+
| `getUserRecord({ uuid })` | User record (cached balance, profile) |
|
|
67
|
+
| `getUserWalletBalance({ userUuid })` | Wallet balance |
|
|
68
|
+
| `getUserHistory({ ... })` | User history |
|
|
69
|
+
| `createRoomV2({ ... })` | Join the game, sync balance, return a play link |
|
|
70
|
+
| `exchangeLaunchTicket({ ... })` | Exchange a launch ticket |
|
|
71
|
+
| `getAdminHousePool()` | House pool stats (admin) |
|
|
72
|
+
| `getAdminTopWinners({ ... })` | Top winners (admin) |
|
|
73
|
+
|
|
74
|
+
All request and response types (for example `PlaceBetRequest`, `RoundState` and `WalletBalanceResponse`) are exported from the package root.
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install
|
|
80
|
+
npm run generate # regenerate src/ from specs/openapi.yaml
|
|
81
|
+
npm run build # compile to dist/
|
|
82
|
+
npm test
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Release:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm version patch # or minor / major
|
|
89
|
+
npm publish
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gameon-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TypeScript client for the roulette backend, generated from specs/openapi.yaml",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,13 @@
|
|
|
21
21
|
"test": "tsx tests/test-all.ts",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
|
-
"keywords": [
|
|
24
|
+
"keywords": [
|
|
25
|
+
"gameon",
|
|
26
|
+
"sdk",
|
|
27
|
+
"roulette",
|
|
28
|
+
"typescript",
|
|
29
|
+
"api-client"
|
|
30
|
+
],
|
|
25
31
|
"devDependencies": {
|
|
26
32
|
"@openapitools/openapi-generator-cli": "^2.41.0",
|
|
27
33
|
"ts-node": "^10.9.2",
|
|
@@ -30,5 +36,18 @@
|
|
|
30
36
|
},
|
|
31
37
|
"directories": {
|
|
32
38
|
"test": "tests"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"author": "Gameonworld.ai",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/Gameonworld-ai/game-idk.git"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/Gameonworld-ai/game-idk#readme",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/Gameonworld-ai/game-idk/issues"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18"
|
|
33
52
|
}
|
|
34
53
|
}
|