@voxary/valorant-client 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +122 -3
- package/dist/index.cjs +2625 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11856 -0
- package/dist/index.d.ts +11856 -0
- package/dist/index.js +2569 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 valorant-client contributors
|
|
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
CHANGED
|
@@ -1,3 +1,122 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# valorant-client
|
|
2
|
+
|
|
3
|
+
Typed TypeScript client for the unofficial Valorant API.
|
|
4
|
+
|
|
5
|
+
- **176 endpoints** in 15 groups: PVP, party, store, pre-game, current game, contracts, local client, local chat, local voice,
|
|
6
|
+
Premier, esports, restrictions, account extras, Riot auth, and a static data catalog. Plus a live event stream for the local client.
|
|
7
|
+
- **One context object** for everything that rarely changes (shard, region, tokens, client version, cookies, local port).
|
|
8
|
+
Replace or update it at any moment and the next request uses it.
|
|
9
|
+
- **Typed end to end**: path parameters, query, body and results are inferred. Wrong calls fail at compile time.
|
|
10
|
+
- **Validated responses** with the schemas of [`valorant-api-types`](https://github.com/techchrism/valorant-api-docs), in a mode that
|
|
11
|
+
survives game updates.
|
|
12
|
+
- **Retries, rate limit handling and automatic token refresh.**
|
|
13
|
+
- **Verified against a live client.** See [what was checked](docs/compatibility.md).
|
|
14
|
+
|
|
15
|
+
> These endpoints are not officially supported by Riot and can change without notice. Use your own account only.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @voxary/valorant-client
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Node 20.3+. ESM and CommonJS. Add `ws` for the local event stream.
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import {ValorantClient} from '@voxary/valorant-client'
|
|
29
|
+
|
|
30
|
+
const client = new ValorantClient()
|
|
31
|
+
|
|
32
|
+
// Riot Client running: fills tokens, puuid, region, shard and client version
|
|
33
|
+
await client.local.connect()
|
|
34
|
+
|
|
35
|
+
const mmr = await client.pvp.playerMmr()
|
|
36
|
+
const history = await client.pvp.matchHistory({query: {startIndex: 0, endIndex: 10}})
|
|
37
|
+
const store = await client.store.storefrontV3()
|
|
38
|
+
const agents = await client.catalog.agents({query: {isPlayableCharacter: true}})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
No local client? Provide the values or reauthenticate from saved cookies:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const client = new ValorantClient({
|
|
45
|
+
context: {shard: 'eu', region: 'eu', puuid, accessToken, entitlementToken, clientVersion},
|
|
46
|
+
refreshTokens: client => client.auth.reauthenticate()
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## The context
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
client.context.set('accessToken', token)
|
|
54
|
+
client.context.update({shard: 'na', region: 'latam'})
|
|
55
|
+
client.context.replace(otherAccountState) // switch account
|
|
56
|
+
client.context.applyAffinity('latam') // region latam, shard na
|
|
57
|
+
client.context.subscribe((state, changed) => save(state))
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See [The context](docs/context.md).
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
| | |
|
|
65
|
+
|-|-|
|
|
66
|
+
| [Getting started](docs/getting-started.md) | Install, connect, first calls |
|
|
67
|
+
| [The context](docs/context.md) | Shared state, persistence, switching accounts |
|
|
68
|
+
| [Authentication](docs/authentication.md) | Local client, cookies, tokens, credentials |
|
|
69
|
+
| [Calling endpoints](docs/calling-endpoints.md) | Parameters, query, body, results, validation |
|
|
70
|
+
| [Errors and retries](docs/errors-and-retries.md) | Error classes, retries, token refresh |
|
|
71
|
+
| [Local client](docs/local-client.md) | Lockfile, friends, chat, live events |
|
|
72
|
+
| [Static data](docs/static-data.md) | Agents, skins, maps and ranks by UUID |
|
|
73
|
+
| [Recipes](docs/recipes.md) | Rank, daily store, match recap, wallet |
|
|
74
|
+
| [Testing and custom transports](docs/testing.md) | Mocks, proxies, other HTTP stacks |
|
|
75
|
+
| [Compatibility](docs/compatibility.md) | Verified endpoints, known schema drift |
|
|
76
|
+
| [API reference](docs/api/README.md) | Every endpoint, generated from the code |
|
|
77
|
+
|
|
78
|
+
## Endpoint groups
|
|
79
|
+
|
|
80
|
+
| Accessor | Endpoints | Notes |
|
|
81
|
+
|----------|-----------|-------|
|
|
82
|
+
| `client.pvp` | 13 | MMR, history, match details, loadout, XP, penalties, leaderboard |
|
|
83
|
+
| `client.party` | 22 | Parties, queue, custom games, invite codes |
|
|
84
|
+
| `client.store` | 7 | Wallet, storefront v3, entitlements, agent store |
|
|
85
|
+
| `client.pregame` | 6 | Agent select |
|
|
86
|
+
| `client.currentGame` | 4 | Match in progress |
|
|
87
|
+
| `client.contracts` | 4 | Contracts, item upgrades, recruitment event |
|
|
88
|
+
| `client.local` | 23 | Riot Client API, plus `connect()` and `events()` |
|
|
89
|
+
| `client.chat` | 9 | Local chat |
|
|
90
|
+
| `client.voice` | 3 | Local audio devices and levels |
|
|
91
|
+
| `client.premier` | 7 | Premier seasons, conferences, eligibility, rosters |
|
|
92
|
+
| `client.esports` | 3 | Esports schedule and pickem |
|
|
93
|
+
| `client.restrictions` | 2 | Avoid list, active interventions |
|
|
94
|
+
| `client.account` | 7 | Daily ticket, favorites, goldstars |
|
|
95
|
+
| `client.auth` | 9 | Riot auth, plus `login()`, `reauthenticate()`, `establishSession()` |
|
|
96
|
+
| `client.catalog` | 57 | Static data from valorant-api.com |
|
|
97
|
+
|
|
98
|
+
## Validation modes
|
|
99
|
+
|
|
100
|
+
`validation` is `loose` (default: report schema drift, return raw data), `strict` (throw) or `off`. The schemas are community-made,
|
|
101
|
+
so `loose` keeps your program running when the game changes. Details in [Calling endpoints](docs/calling-endpoints.md#validation-modes).
|
|
102
|
+
|
|
103
|
+
## Not covered
|
|
104
|
+
|
|
105
|
+
The XMPP chat connection (raw TCP).
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm run typecheck # source, tests and documented recipes
|
|
111
|
+
npm test # unit tests, no network
|
|
112
|
+
npm run build # ESM + CJS + types
|
|
113
|
+
npm run docs:api # regenerate docs/api
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
117
|
+
|
|
118
|
+
## Credits and license
|
|
119
|
+
|
|
120
|
+
MIT. Endpoint knowledge and schemas come from the community project
|
|
121
|
+
[techchrism/valorant-api-docs](https://github.com/techchrism/valorant-api-docs) (MIT), and static data from
|
|
122
|
+
[valorant-api.com](https://valorant-api.com). This project is not affiliated with Riot Games.
|