@stable_sea/sdk 0.1.3 → 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 +52 -8
- package/dist/gen/schema.d.ts +914 -76
- package/package.json +6 -5
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,9 +30,28 @@ 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
|
-
|
|
|
35
|
+
| Production | `https://api.stablesea.com` | `sk_live_…` |
|
|
36
|
+
| Sandbox | `https://sandbox-api.stablesea.com` | `sk_test_…` |
|
|
37
|
+
|
|
38
|
+
API access enables both Live and Sandbox. In Terminal, open **API keys** and
|
|
39
|
+
create a key under **Test keys**. Set `baseUrl` to
|
|
40
|
+
`https://sandbox-api.stablesea.com` and use that `sk_test_…` key. The same client,
|
|
41
|
+
contract and idempotency rules apply.
|
|
42
|
+
See the [sandbox quickstart](https://docs.stablesea.com/api/#sandbox) for simple
|
|
43
|
+
instructions and the downloadable SDK test project.
|
|
44
|
+
|
|
45
|
+
Sandbox uses synthetic balances and simulated financial partners; it cannot move
|
|
46
|
+
real money. Production refuses Test credentials, and the stable sandbox refuses
|
|
47
|
+
Live credentials. Create, rotate and revoke both kinds of keys in the same
|
|
48
|
+
Terminal pane with the same business permissions. Live keys require a fresh
|
|
49
|
+
two-factor code; Test keys do not. The first
|
|
50
|
+
Test key prepares isolated balances of 100,000 USDC and 50,000 WTGXX; additional
|
|
51
|
+
keys and rotations reuse that data.
|
|
52
|
+
|
|
53
|
+
WTGXX supports standard and instant settlement. FLTTX supports standard
|
|
54
|
+
settlement; instant orders are refused in both production and sandbox.
|
|
37
55
|
|
|
38
56
|
## Idempotent writes
|
|
39
57
|
|
|
@@ -59,7 +77,7 @@ requires a different window.
|
|
|
59
77
|
```ts
|
|
60
78
|
import { verifyWebhookSignature } from "@stable_sea/sdk";
|
|
61
79
|
|
|
62
|
-
const valid =
|
|
80
|
+
const valid = verifyWebhookSignature(
|
|
63
81
|
rawBody,
|
|
64
82
|
request.headers.get("Stable-Sea-Signature") ?? "",
|
|
65
83
|
process.env.STABLE_SEA_WEBHOOK_SECRET!,
|
|
@@ -69,3 +87,29 @@ const valid = await verifyWebhookSignature(
|
|
|
69
87
|
API request, response, pagination, and error types are generated from
|
|
70
88
|
`services/backend/api/openapi.public.json` and exported as `paths`, `operations`,
|
|
71
89
|
and `components`.
|
|
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
|
+
|
|
109
|
+
## Contract changes
|
|
110
|
+
|
|
111
|
+
- `GET /v1/balances`: `chain` gains the value `solana`. A USDC balance held on
|
|
112
|
+
Solana (`segregated_rail: onchain_solana`) now reports `chain: "solana"`;
|
|
113
|
+
before this it reported `chain: "unknown"`. Code that switches on `chain`
|
|
114
|
+
should accept the new value, and code that keyed a Solana balance by its
|
|
115
|
+
`unknown` row should expect the `solana` row instead.
|