@stable_sea/sdk 0.2.0 → 0.2.2

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 CHANGED
@@ -88,6 +88,28 @@ API request, response, pagination, and error types are generated from
88
88
  `services/backend/api/openapi.public.json` and exported as `paths`, `operations`,
89
89
  and `components`.
90
90
 
91
+ ## Balance history
92
+
93
+ Read daily balance history with `money:read`:
94
+
95
+ ```ts
96
+ const history = await client.GET("/v1/balance_history", {
97
+ params: { query: { window: "30d" } },
98
+ });
99
+ if (history.error) throw new Error(history.error.error.message);
100
+ console.log(history.data.data);
101
+ ```
102
+
103
+ Windows are `30d`, `90d` and `ytd`. Pending amounts include unfinished internal
104
+ movements only. ACH, wire and on-chain deposits and withdrawals appear after
105
+ settlement. Completed legs enter settled history while other legs can remain
106
+ pending, so these amounts can differ from `/v1/balances`.
107
+
108
+ USD amounts are null when unavailable;
109
+ `aggregated` includes only priced settled balances. Check `unpriced_assets` for
110
+ valuation gaps. History follows current account membership; use issued
111
+ statements for immutable reporting.
112
+
91
113
  ## Money controls and rate limits
92
114
 
93
115
  Read `GET /v1/policies` with a key that has `money:read`.
@@ -64,6 +64,32 @@ export interface paths {
64
64
  patch?: never;
65
65
  trace?: never;
66
66
  };
67
+ "/v1/balance_history": {
68
+ parameters: {
69
+ query?: never;
70
+ header?: never;
71
+ path?: never;
72
+ cookie?: never;
73
+ };
74
+ /**
75
+ * Read balance history
76
+ * @description Returns daily settled and pending balances for the authenticated business, grouped by asset, for the last 30 days, 90 days, or the current UTC year. Each series contains at most 367 samples.
77
+ *
78
+ * Pending amounts include unfinished internal movements only. ACH, wire and on-chain deposits and withdrawals appear after settlement. Completed legs enter settled history even while other legs remain pending, so these amounts can differ from `/v1/balances`.
79
+ *
80
+ * Amounts are decimal strings. A null USD amount means no valuation was available. Totals include priced settled balances; inspect `unpriced_assets` before treating them as a complete valuation.
81
+ *
82
+ * This dashboard history uses the business's current account membership. Archived accounts are excluded, including from past samples. Use issued statements for immutable period reporting. Aggregate balances can include the effects of Payments, while individual Payments records remain excluded from the API.
83
+ */
84
+ get: operations["balance_history.snapshot"];
85
+ put?: never;
86
+ post?: never;
87
+ delete?: never;
88
+ options?: never;
89
+ head?: never;
90
+ patch?: never;
91
+ trace?: never;
92
+ };
67
93
  "/v1/balances": {
68
94
  parameters: {
69
95
  query?: never;
@@ -975,7 +1001,7 @@ export interface components {
975
1001
  pending_incoming_native: string;
976
1002
  /** @description pending_incoming_native valued in USD. Omitted when no rate is available at created_ts. */
977
1003
  pending_incoming_usd?: string;
978
- /** @description Value outgoing from this balance and not yet settled, in the asset's own units. Never netted against pending_incoming_native. A single movement's pass-through legs are netted inside this figure: an account credited and debited within one movement counts once, not twice in both directions. */
1004
+ /** @description Value reserved for outgoing movements or confirmed bank-return recovery, in the asset's own units. Never netted against pending_incoming_native. A single movement's pass-through legs are netted inside this figure: an account credited and debited within one movement counts once, not twice in both directions. */
979
1005
  pending_outgoing_native: string;
980
1006
  /** @description pending_outgoing_native valued in USD. Omitted when no rate is available at created_ts. */
981
1007
  pending_outgoing_usd?: string;
@@ -987,6 +1013,45 @@ export interface components {
987
1013
  */
988
1014
  source: "custody";
989
1015
  };
1016
+ BalanceHistoryPoint: {
1017
+ balance_native: string;
1018
+ balance_usd: string | null;
1019
+ pending_incoming_native: string;
1020
+ pending_incoming_usd: string | null;
1021
+ pending_outgoing_native: string;
1022
+ pending_outgoing_usd: string | null;
1023
+ /** Format: date-time */
1024
+ sampled_ts: string;
1025
+ };
1026
+ BalanceHistorySeries: {
1027
+ asset: string;
1028
+ /** @enum {string} */
1029
+ object: "balance_series";
1030
+ points: components["schemas"]["BalanceHistoryPoint"][];
1031
+ };
1032
+ BalanceHistorySnapshot: {
1033
+ aggregated: components["schemas"]["BalanceHistoryTotal"][];
1034
+ data: components["schemas"]["BalanceHistorySeries"][];
1035
+ /** Format: date-time */
1036
+ end_ts: string;
1037
+ livemode: boolean;
1038
+ /** @enum {string} */
1039
+ object: "balance_history";
1040
+ /** Format: date-time */
1041
+ observed_ts: string;
1042
+ /** Format: date-time */
1043
+ start_ts: string;
1044
+ /** @description Assets with a nonzero native balance and no USD valuation in at least one sample. Their native balances remain available. */
1045
+ unpriced_assets: string[];
1046
+ };
1047
+ BalanceHistoryTotal: {
1048
+ /** @description Sum of the priced settled balances at this timestamp. Inspect unpriced_assets before treating it as a complete valuation. */
1049
+ balance_usd: string;
1050
+ /** Format: date-time */
1051
+ sampled_ts: string;
1052
+ };
1053
+ /** @enum {string} */
1054
+ BalanceHistoryWindow: "30d" | "90d" | "ytd";
990
1055
  BalanceList: {
991
1056
  data: components["schemas"]["Balance"][];
992
1057
  has_more: boolean;
@@ -1222,11 +1287,13 @@ export interface components {
1222
1287
  /** @enum {string} */
1223
1288
  EventTypeName: "bank_account.created" | "bank_account.removed" | "bank_account_operation.updated" | "deposit.updated" | "deposit_quote.updated" | "external_wallet.created" | "external_wallet.updated" | "external_wallet_operation.updated" | "notification.created" | "order.updated" | "source_wallet_declaration.updated" | "transaction.created" | "transaction.updated";
1224
1289
  ExternalWallet: {
1225
- /** @description The wallet's on-chain address, exactly as the business connected it. */
1290
+ /** @description True when a Stable Sea operator registered this wallet for the business; false when the business added it itself. */
1291
+ added_by_stable_sea: boolean;
1292
+ /** @description The wallet's on-chain address, exactly as it was registered. */
1226
1293
  address: string;
1227
1294
  /**
1228
1295
  * Format: date-time
1229
- * @description When the wallet was connected. The list is ordered and paged on this instant.
1296
+ * @description When the wallet was added, by the business or by Stable Sea. The list is ordered and paged on this instant.
1230
1297
  */
1231
1298
  created_ts: string;
1232
1299
  /**
@@ -1252,7 +1319,7 @@ export interface components {
1252
1319
  livemode: boolean;
1253
1320
  /** @description Optional Stellar memo identifying this withdrawal destination. Address-level holdings are not reported when a memo is present. */
1254
1321
  memo?: string;
1255
- /** @description The name your business assigned to this wallet. */
1322
+ /** @description The wallet's name, as set when it was registered or last renamed. */
1256
1323
  name?: string;
1257
1324
  /** @enum {string} */
1258
1325
  object: "external_wallet";
@@ -2149,6 +2216,45 @@ export interface operations {
2149
2216
  };
2150
2217
  };
2151
2218
  };
2219
+ "balance_history.snapshot": {
2220
+ parameters: {
2221
+ query?: {
2222
+ /** @description Thirty days, ninety days, or the current UTC year to date. */
2223
+ window?: components["schemas"]["BalanceHistoryWindow"];
2224
+ };
2225
+ header?: never;
2226
+ path?: never;
2227
+ cookie?: never;
2228
+ };
2229
+ requestBody?: never;
2230
+ responses: {
2231
+ /** @description OK */
2232
+ 200: {
2233
+ headers: {
2234
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
2235
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
2236
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
2237
+ [name: string]: unknown;
2238
+ };
2239
+ content: {
2240
+ "application/json": components["schemas"]["BalanceHistorySnapshot"];
2241
+ };
2242
+ };
2243
+ 400: components["responses"]["Error400"];
2244
+ 401: components["responses"]["Error401"];
2245
+ 403: components["responses"]["Error403"];
2246
+ 429: components["responses"]["Error429"];
2247
+ /** @description Error response. */
2248
+ default: {
2249
+ headers: {
2250
+ [name: string]: unknown;
2251
+ };
2252
+ content: {
2253
+ "application/json": components["schemas"]["Error"];
2254
+ };
2255
+ };
2256
+ };
2257
+ };
2152
2258
  "balances.list": {
2153
2259
  parameters: {
2154
2260
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stable_sea/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [