@stable_sea/sdk 0.1.4 → 0.1.5
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 +28 -13
- package/dist/gen/schema.d.ts +584 -86
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,13 +8,12 @@ https://docs.stablesea.com/api/.
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npm install @stable_sea/sdk
|
|
11
|
+
npm install @stable_sea/sdk
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
create a client:
|
|
14
|
+
These examples use the latest published SDK. The dated API contract is
|
|
15
|
+
independent of the npm package version. Set `version` to pin the dated contract;
|
|
16
|
+
omitting it uses the server default:
|
|
18
17
|
|
|
19
18
|
```ts
|
|
20
19
|
import { createStableSeaClient } from "@stable_sea/sdk";
|
|
@@ -31,10 +30,10 @@ Ask your Stable Sea contact to enable API access, then create a named `sk_live_
|
|
|
31
30
|
credential in Stable Sea Terminal. The credential identifies one business and
|
|
32
31
|
carries fixed scopes, so do not send a `Stable-Sea-Account` header.
|
|
33
32
|
|
|
34
|
-
|
|
|
33
|
+
| Environment | Base URL | Key |
|
|
35
34
|
|---|---|---|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
35
|
+
| Production | `https://api.stablesea.com` | `sk_live_…` |
|
|
36
|
+
| Sandbox | `https://sandbox-api.stablesea.com` | `sk_test_…` |
|
|
38
37
|
|
|
39
38
|
API access enables both Live and Sandbox. In Terminal, open **API keys** and
|
|
40
39
|
create a key under **Test keys**. Set `baseUrl` to
|
|
@@ -51,10 +50,8 @@ two-factor code; Test keys do not. The first
|
|
|
51
50
|
Test key prepares isolated balances of 100,000 USDC and 50,000 WTGXX; additional
|
|
52
51
|
keys and rotations reuse that data.
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
unsupported instant order must produce the normal refusal rather than simulated
|
|
57
|
-
liquidity that would not exist in production.
|
|
53
|
+
WTGXX supports standard and instant settlement. FLTTX supports standard
|
|
54
|
+
settlement; instant orders are refused in both production and sandbox.
|
|
58
55
|
|
|
59
56
|
## Idempotent writes
|
|
60
57
|
|
|
@@ -80,7 +77,7 @@ requires a different window.
|
|
|
80
77
|
```ts
|
|
81
78
|
import { verifyWebhookSignature } from "@stable_sea/sdk";
|
|
82
79
|
|
|
83
|
-
const valid =
|
|
80
|
+
const valid = verifyWebhookSignature(
|
|
84
81
|
rawBody,
|
|
85
82
|
request.headers.get("Stable-Sea-Signature") ?? "",
|
|
86
83
|
process.env.STABLE_SEA_WEBHOOK_SECRET!,
|
|
@@ -91,6 +88,24 @@ API request, response, pagination, and error types are generated from
|
|
|
91
88
|
`services/backend/api/openapi.public.json` and exported as `paths`, `operations`,
|
|
92
89
|
and `components`.
|
|
93
90
|
|
|
91
|
+
## Money controls and rate limits
|
|
92
|
+
|
|
93
|
+
Read `GET /v1/policies` with a key that has `money:read`.
|
|
94
|
+
These are current observations, not a guarantee that a later order is permitted.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const policies = await client.GET("/v1/policies");
|
|
98
|
+
if (policies.error) throw new Error(policies.error.error.message);
|
|
99
|
+
console.log(policies.data.data);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Responses after credential rate limiting include `X-RateLimit-Limit`,
|
|
103
|
+
`X-RateLimit-Remaining`, and `X-RateLimit-Reset` (Unix seconds). They describe
|
|
104
|
+
the key’s budget on the server instance handling the request, not a fleet-wide
|
|
105
|
+
quota. Authentication and IP/edge refusals omit them; outer timeout, cancellation,
|
|
106
|
+
and response-size failures may also omit them. On HTTP 429, wait at least
|
|
107
|
+
`Retry-After` seconds. For mutation retries, reuse the same idempotency key.
|
|
108
|
+
|
|
94
109
|
## Contract changes
|
|
95
110
|
|
|
96
111
|
- `GET /v1/balances`: `chain` gains the value `solana`. A USDC balance held on
|