@stable_sea/sdk 0.1.4 → 0.1.6
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 +80 -13
- package/dist/gen/schema.d.ts +1675 -183
- 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,76 @@ 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
|
+
|
|
109
|
+
## Manage bank accounts
|
|
110
|
+
|
|
111
|
+
Select **Manage bank accounts** and **Read financial data** when creating the key
|
|
112
|
+
in Terminal. Submit registration with `POST /v1/bank_accounts`, poll the returned
|
|
113
|
+
`baop_` ID at `GET /v1/bank_account_operations/{id}`, then read the resulting
|
|
114
|
+
`bacc_` account. Registration preserves Terminal's screening rules and does not
|
|
115
|
+
enable funding or payouts. Remove an account with
|
|
116
|
+
`POST /v1/bank_accounts/{id}/remove`; pending transactions prevent removal.
|
|
117
|
+
|
|
118
|
+
See [the bank account guide](../../docs/api/bank-accounts.md) for examples and retry behavior.
|
|
119
|
+
|
|
120
|
+
## Read saved bank accounts
|
|
121
|
+
|
|
122
|
+
Use a key with `money:read`:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
const banks = await client.GET("/v1/bank_accounts");
|
|
126
|
+
if (banks.error) throw new Error(banks.error.error.message);
|
|
127
|
+
console.log(banks.data.data);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Account numbers and holder identity are masked by default. For complete values,
|
|
131
|
+
select **Read full bank details** alongside **Read financial data** when creating
|
|
132
|
+
or rotating the key in Terminal. Existing keys keep their permissions.
|
|
133
|
+
|
|
134
|
+
Use the returned `bacc_` ID with `GET /v1/bank_accounts/{id}`. Removed and
|
|
135
|
+
cross-business accounts return not found. Newly added or changed details can
|
|
136
|
+
briefly return 503; retry the read. Test keys read only their isolated sandbox
|
|
137
|
+
bank accounts.
|
|
138
|
+
|
|
139
|
+
## Funding and deposits
|
|
140
|
+
|
|
141
|
+
Select **Read financial data** and **Create deposits** in Terminal. Read
|
|
142
|
+
`GET /v1/funding` for current ACH limits, wire instructions and on-chain
|
|
143
|
+
addresses. For ACH, create a quote with `POST /v1/deposit_quotes`, poll its
|
|
144
|
+
`qt_` ID until ready, then review and acknowledge its bank authorization before
|
|
145
|
+
submitting `POST /v1/deposits`. Poll the `depo_` resource and its transaction for
|
|
146
|
+
the actual outcome. A quote expires five minutes after creation and can fund
|
|
147
|
+
one deposit. Keep the same mutation object and body for retries.
|
|
148
|
+
|
|
149
|
+
Authorization text is redacted on ordinary reads. To retrieve and review it,
|
|
150
|
+
select **Read full bank details** (`money:bank_accounts_sensitive_read`)
|
|
151
|
+
for the reading key, or obtain authorization through Terminal.
|
|
152
|
+
|
|
153
|
+
Declare an on-chain source address with `POST /v1/source_wallet_declarations`.
|
|
154
|
+
Poll its `swdec_` ID, check `cleared`, then read funding again. A declaration
|
|
155
|
+
does not send funds; replay does not renew clearance. Wire quotes estimate fees,
|
|
156
|
+
and wire transfers use the instructions returned by funding.
|
|
157
|
+
|
|
158
|
+
See [the funding guide](../../docs/api/funding.md) for the complete sequence,
|
|
159
|
+
permissions and retry behavior.
|
|
160
|
+
|
|
94
161
|
## Contract changes
|
|
95
162
|
|
|
96
163
|
- `GET /v1/balances`: `chain` gains the value `solana`. A USDC balance held on
|