@trinaryex/sdk 3.3.0 → 3.4.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/README.md +35 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -236,14 +236,48 @@ slots) from the **fullnode**, head-current. Prefer ids returned from writes
|
|
|
236
236
|
|
|
237
237
|
```bash
|
|
238
238
|
npm install
|
|
239
|
-
npm run tscheck && npm test #
|
|
239
|
+
npm run tscheck && npm test # unit tests, including the gateway gate
|
|
240
240
|
npm run build
|
|
241
241
|
|
|
242
|
+
# Contract checks (no API key needed — /swagger.json is public):
|
|
243
|
+
npm run check:gateway # against the vendored contract
|
|
244
|
+
npm run check:gateway -- --live # against api.trinary.exchange right now
|
|
245
|
+
npm run refresh:gateway # update the vendored copy
|
|
246
|
+
|
|
242
247
|
# Live verification (needs .env — see .env.sample):
|
|
243
248
|
node --env-file=.env scripts/smoke.mjs # read surface vs the live gateway
|
|
244
249
|
node --env-file=.env scripts/integration.mjs # write paths on testnet (uses gas)
|
|
245
250
|
```
|
|
246
251
|
|
|
252
|
+
### Lock-step with the gateway
|
|
253
|
+
|
|
254
|
+
Every request this SDK issues is checked against the gateway's **published
|
|
255
|
+
OpenAPI document**, not against a hand-maintained list.
|
|
256
|
+
`scripts/gateway-surface.mjs` reads the contract on one side and parses
|
|
257
|
+
`src/queries.ts` with the TypeScript compiler on the other, then compares them.
|
|
258
|
+
Because call sites are read statically, the check needs no API key, no network
|
|
259
|
+
and no live account — it runs inside the unit-test budget.
|
|
260
|
+
|
|
261
|
+
Drift comes in two shapes, and only one announces itself:
|
|
262
|
+
|
|
263
|
+
- **A moved endpoint** 404s on the first real call. Loud, easy.
|
|
264
|
+
- **A renamed query parameter** does not. A gateway ignores keys it does not
|
|
265
|
+
recognise rather than rejecting them, so the request still returns `200` with
|
|
266
|
+
a full body — a filter that stopped filtering is indistinguishable from a
|
|
267
|
+
filter that matched everything, and every layer above believes it asked a
|
|
268
|
+
narrower question than it did.
|
|
269
|
+
|
|
270
|
+
The gate reports four things: endpoints the contract does not publish, query
|
|
271
|
+
parameters the endpoint does not declare, required parameters the SDK never
|
|
272
|
+
sends, and call sites too dynamic to read statically — that last one counts as
|
|
273
|
+
a gap in coverage rather than a pass.
|
|
274
|
+
|
|
275
|
+
`test/gateway.test.ts` runs it against a vendored copy of the contract, so PR
|
|
276
|
+
CI stays hermetic and deterministic, and drives the comparison with doctored
|
|
277
|
+
inputs to prove the gate fails when it should. A vendored copy cannot see the
|
|
278
|
+
gateway moving underneath us, so a scheduled job runs the same check against
|
|
279
|
+
the live document — see `.github/workflows/gateway_drift.yml`.
|
|
280
|
+
|
|
247
281
|
## Links
|
|
248
282
|
|
|
249
283
|
- [Trinary Exchange](https://trinary.exchange/) — the EVE Frontier
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trinaryex/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Trading SDK for Trinary Exchange — market data, order books, and on-chain trading (Sui) for bots, analytics tools, and CLIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"build": "vite build",
|
|
21
21
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
22
22
|
"test:cov": "node --experimental-vm-modules node_modules/.bin/jest --ci --coverage",
|
|
23
|
+
"check:gateway": "node scripts/check-gateway.mjs",
|
|
24
|
+
"refresh:gateway": "node scripts/check-gateway.mjs --refresh",
|
|
23
25
|
"prettier": "prettier --write '{src,test}/**/*.ts'",
|
|
24
26
|
"prettier:check": "prettier --check '{src,test}/**/*.ts'",
|
|
25
27
|
"lint": "eslint --cache '{src,test}/**/*.ts'",
|