@stable_sea/sdk 0.2.3 → 0.2.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 CHANGED
@@ -182,6 +182,16 @@ and wire transfers use the instructions returned by funding.
182
182
  See [the funding guide](../../docs/api/funding.md) for the complete sequence,
183
183
  permissions and retry behavior.
184
184
 
185
+ ## Statement previews
186
+
187
+ Read the current month's interim document with
188
+ `client.GET("/v1/statements/preview")` and `money:read`. Its display-ready
189
+ balances, transactions and fees use the same native calculation as Terminal.
190
+ Values refresh about once a minute. Check `observed_ts`; missing,
191
+ stale or previous-month previews return 503. Opening balances remain provisional
192
+ until the previous month's statement is issued. Issued documents continue to use
193
+ `GET /v1/statements/{id}`.
194
+
185
195
  ## Contract changes
186
196
 
187
197
  - `GET /v1/balances`: `chain` gains the value `solana`. A USDC balance held on
@@ -596,6 +596,30 @@ export interface paths {
596
596
  patch?: never;
597
597
  trace?: never;
598
598
  };
599
+ "/v1/price_history": {
600
+ parameters: {
601
+ query?: never;
602
+ header?: never;
603
+ path?: never;
604
+ cookie?: never;
605
+ };
606
+ /**
607
+ * Read market price history
608
+ * @description Returns the BTC/USD market-price chart used by Terminal for the last thirty days, ninety days or current UTC year. Prices are decimal strings and do not depend on your holdings. The series contains about fifty samples, carrying forward the latest cached close at or before each sample. The underlying market-data cache retains ninety days, so a year-to-date request can contain a shorter available history.
609
+ *
610
+ * Inspect `source`: `historical` means normalized historical prices, `spot` means a flat two-point line at the current price because history was unavailable, and `unavailable` means no prices were available. A spot fallback does not describe past prices.
611
+ *
612
+ * The worker refreshes this observation about once a minute. `observed_ts` is the calculation start; the reads are not an atomic market snapshot. Missing, failed or older-than-two-minutes observations return HTTP 503. Requires `investments:read`.
613
+ */
614
+ get: operations["price_history.snapshot"];
615
+ put?: never;
616
+ post?: never;
617
+ delete?: never;
618
+ options?: never;
619
+ head?: never;
620
+ patch?: never;
621
+ trace?: never;
622
+ };
599
623
  "/v1/quotes": {
600
624
  parameters: {
601
625
  query?: never;
@@ -678,6 +702,68 @@ export interface paths {
678
702
  patch?: never;
679
703
  trace?: never;
680
704
  };
705
+ "/v1/statement_generations": {
706
+ parameters: {
707
+ query?: never;
708
+ header?: never;
709
+ path?: never;
710
+ cookie?: never;
711
+ };
712
+ get?: never;
713
+ put?: never;
714
+ /**
715
+ * Generate a statement
716
+ * @description Requests the business's official statement for a closed UTC calendar month. Requires `money:statements_write` and an `Idempotency-Key`. Poll the returned generation with `money:read` until it succeeds or fails, then retrieve its `statement`. Existing statements are returned without reissuing them. Current key access, business availability and business statement eligibility are checked before execution. Retrying the same request and key returns its original pending receipt; the generation read reports the current outcome.
717
+ *
718
+ * Idempotency keys are shared by the business within one environment, including across API credentials and rotation. A replay keeps the original submitting credential as the processing authority; it does not replace that credential with the retrying key.
719
+ */
720
+ post: operations["statement_generations.create"];
721
+ delete?: never;
722
+ options?: never;
723
+ head?: never;
724
+ patch?: never;
725
+ trace?: never;
726
+ };
727
+ "/v1/statement_generations/{id}": {
728
+ parameters: {
729
+ query?: never;
730
+ header?: never;
731
+ path?: never;
732
+ cookie?: never;
733
+ };
734
+ /**
735
+ * Retrieve a statement generation
736
+ * @description Returns the current processing outcome for this business and key environment. `pending` means processing or retrying; `succeeded` names the issued statement; `failed` includes a safe `failure_code`. A failed request does not cancel or change an issued statement. Resolve the cause before submitting another request with a new idempotency key.
737
+ */
738
+ get: operations["statement_generations.get"];
739
+ put?: never;
740
+ post?: never;
741
+ delete?: never;
742
+ options?: never;
743
+ head?: never;
744
+ patch?: never;
745
+ trace?: never;
746
+ };
747
+ "/v1/statement_periods": {
748
+ parameters: {
749
+ query?: never;
750
+ header?: never;
751
+ path?: never;
752
+ cookie?: never;
753
+ };
754
+ /**
755
+ * List supported statement periods
756
+ * @description Lists supported statement period types and their earliest UTC month start. Monthly generation also requires a closed month and the business's current business statement eligibility. Use this catalog with the issued statement list to choose a month. A supported calendar period is not a guarantee that a missing earlier statement can be issued after a later period has already been issued. This reference data is the same in Live and Sandbox.
757
+ */
758
+ get: operations["statement_periods.catalog"];
759
+ put?: never;
760
+ post?: never;
761
+ delete?: never;
762
+ options?: never;
763
+ head?: never;
764
+ patch?: never;
765
+ trace?: never;
766
+ };
681
767
  "/v1/statements": {
682
768
  parameters: {
683
769
  query?: never;
@@ -698,6 +784,30 @@ export interface paths {
698
784
  patch?: never;
699
785
  trace?: never;
700
786
  };
787
+ "/v1/statements/preview": {
788
+ parameters: {
789
+ query?: never;
790
+ header?: never;
791
+ path?: never;
792
+ cookie?: never;
793
+ };
794
+ /**
795
+ * Preview the current statement
796
+ * @description Returns the authenticated business's month-to-date statement as display-ready JSON. Requires `money:read` and at least one money account that has not been archived. This read does not issue a statement. The preview refreshes about once a minute; an unavailable or older-than-two-minutes preview returns HTTP 503. At a UTC month boundary, it may be unavailable until the first refresh.
797
+ *
798
+ * Figures update until the month closes. Opening balances remain provisional until the previous month's statement is issued. The period uses UTC and ends at the preview time, normally rounded down to the minute. `observed_ts` is the preview calculation start; the underlying reads are not an atomic snapshot.
799
+ *
800
+ * Transactions exclude pay-ins and payouts, while balances and totals include their effects. Pending movements and movements settled across a period boundary can also prevent transaction amounts from reconciling to the totals. Missing valuations refuse the preview instead of reporting held assets as zero.
801
+ */
802
+ get: operations["statements.preview"];
803
+ put?: never;
804
+ post?: never;
805
+ delete?: never;
806
+ options?: never;
807
+ head?: never;
808
+ patch?: never;
809
+ trace?: never;
810
+ };
701
811
  "/v1/statements/{id}": {
702
812
  parameters: {
703
813
  query?: never;
@@ -1285,7 +1395,7 @@ export interface components {
1285
1395
  object: "list";
1286
1396
  };
1287
1397
  /** @enum {string} */
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";
1398
+ 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" | "statement_generation.updated" | "transaction.created" | "transaction.updated";
1289
1399
  ExternalWallet: {
1290
1400
  /** @description True when a Stable Sea operator registered this wallet for the business; false when the business added it itself. */
1291
1401
  added_by_stable_sea: boolean;
@@ -1481,6 +1591,25 @@ export interface components {
1481
1591
  holder_identifier?: string;
1482
1592
  legal_entity_name: string;
1483
1593
  };
1594
+ MarketPricePoint: {
1595
+ close_usd: string;
1596
+ /** Format: date-time */
1597
+ sampled_ts: string;
1598
+ };
1599
+ MarketPriceSeries: {
1600
+ /** @enum {string} */
1601
+ asset: "BTC";
1602
+ /** @enum {string} */
1603
+ object: "market_price_series";
1604
+ points: components["schemas"]["MarketPricePoint"][];
1605
+ /** @enum {string} */
1606
+ quote_asset: "USD";
1607
+ /**
1608
+ * @description historical is the normalized market series. spot is a flat current-price fallback, not historical observations. unavailable carries no points.
1609
+ * @enum {string}
1610
+ */
1611
+ source: "historical" | "spot" | "unavailable";
1612
+ };
1484
1613
  /** @description Customer metadata. Sensitive data is forbidden. */
1485
1614
  Metadata: {
1486
1615
  [key: string]: string;
@@ -1660,6 +1789,19 @@ export interface components {
1660
1789
  };
1661
1790
  /** @enum {string} */
1662
1791
  PolicyWindowKind: "calendar_day" | "calendar_week" | "rolling_24h" | "rolling_72h";
1792
+ PriceHistorySnapshot: {
1793
+ data: components["schemas"]["MarketPriceSeries"][];
1794
+ /** Format: date-time */
1795
+ end_ts: string;
1796
+ livemode: boolean;
1797
+ /** @enum {string} */
1798
+ object: "price_history";
1799
+ /** Format: date-time */
1800
+ observed_ts: string;
1801
+ /** Format: date-time */
1802
+ start_ts: string;
1803
+ window: components["schemas"]["BalanceHistoryWindow"];
1804
+ };
1663
1805
  Quote: {
1664
1806
  amount_usd: string;
1665
1807
  /** @enum {string} */
@@ -1799,6 +1941,32 @@ export interface components {
1799
1941
  type: "ach_offramp" | "ach_onramp" | "adjustment" | "buy_fund_token" | "buy_fund_token_return" | "buy_fund_token_return_sweep" | "deposit_hold" | "deposit_return" | "deposit_reversal" | "fund_cash_subscription" | "fund_dividend_payout" | "fund_distribution_payout" | "fund_gas_tank" | "fund_xlm_reserve" | "gas_tank_refill" | "gas_wallet_funding" | "go_account_conversion" | "go_account_custodial_transfer" | "go_account_external_send" | "held_deposit_release" | "onchain_deposit" | "onchain_withdrawal" | "ramp_fee_refund" | "reclassification" | "sell_fund_token" | "sell_fund_token_return" | "trade_order" | "treasury_booking" | "treasury_wire_credit" | "wire_offramp" | "wire_onramp";
1800
1942
  withdrawal?: components["schemas"]["StatementWithdrawal"];
1801
1943
  };
1944
+ StatementGeneration: {
1945
+ /** Format: date-time */
1946
+ created_ts: string;
1947
+ /**
1948
+ * @description Reason processing failed. Correct the cause before submitting a new request with a new idempotency key.
1949
+ * @enum {string}
1950
+ */
1951
+ failure_code?: "permission_denied" | "api_key_revoked" | "business_locked" | "terms_acceptance_required" | "api_access_disabled" | "statement_ineligible" | "invalid_statement_month" | "statement_generation_refused" | "statement_processing_unavailable";
1952
+ id: string;
1953
+ livemode: boolean;
1954
+ /** @enum {string} */
1955
+ object: "statement_generation";
1956
+ /** Format: date-time */
1957
+ period_start_ts: string;
1958
+ /** @description The issued statement after processing succeeds. Retrieve it with GET /v1/statements/{id}. */
1959
+ statement?: string;
1960
+ /** @enum {string} */
1961
+ status: "pending" | "succeeded" | "failed";
1962
+ };
1963
+ StatementGenerationInput: {
1964
+ /**
1965
+ * Format: date-time
1966
+ * @description The first instant of a closed calendar month in UTC, for example 2026-09-01T00:00:00Z. Read available_from_ts in the statement-period catalog for the earliest supported period. Business statement eligibility still applies.
1967
+ */
1968
+ period_start_ts: string;
1969
+ };
1802
1970
  StatementLine: {
1803
1971
  ending_native: string;
1804
1972
  ending_usd: string;
@@ -1823,6 +1991,32 @@ export interface components {
1823
1991
  /** Format: date-time */
1824
1992
  start_ts: string;
1825
1993
  };
1994
+ StatementPeriodAvailability: {
1995
+ /** Format: date-time */
1996
+ available_from_ts: string;
1997
+ /** @enum {string} */
1998
+ object: "statement_period";
1999
+ /** @enum {string} */
2000
+ type: "monthly";
2001
+ };
2002
+ StatementPeriodCatalog: {
2003
+ data: components["schemas"]["StatementPeriodAvailability"][];
2004
+ /** @enum {string} */
2005
+ object: "list";
2006
+ };
2007
+ StatementPreview: {
2008
+ balances: components["schemas"]["StatementLine"][];
2009
+ livemode: boolean;
2010
+ /** @enum {string} */
2011
+ object: "statement_preview";
2012
+ /** Format: date-time */
2013
+ observed_ts: string;
2014
+ period: components["schemas"]["StatementPeriod"];
2015
+ ramp_fees?: components["schemas"]["StatementRampFee"][];
2016
+ totals: components["schemas"]["StatementTotals"];
2017
+ /** @description In-scope movements. Pay-ins and payouts are excluded, although balances and totals include their effects. Pending entries can contain provisional amounts. */
2018
+ transactions: components["schemas"]["StatementEntry"][];
2019
+ };
1826
2020
  StatementRampFee: {
1827
2021
  /** Format: date-time */
1828
2022
  assessed_ts: string;
@@ -3310,6 +3504,45 @@ export interface operations {
3310
3504
  };
3311
3505
  };
3312
3506
  };
3507
+ "price_history.snapshot": {
3508
+ parameters: {
3509
+ query?: {
3510
+ /** @description Thirty days, ninety days, or the current UTC year to date. */
3511
+ window?: components["schemas"]["BalanceHistoryWindow"];
3512
+ };
3513
+ header?: never;
3514
+ path?: never;
3515
+ cookie?: never;
3516
+ };
3517
+ requestBody?: never;
3518
+ responses: {
3519
+ /** @description OK */
3520
+ 200: {
3521
+ headers: {
3522
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
3523
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
3524
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
3525
+ [name: string]: unknown;
3526
+ };
3527
+ content: {
3528
+ "application/json": components["schemas"]["PriceHistorySnapshot"];
3529
+ };
3530
+ };
3531
+ 400: components["responses"]["Error400"];
3532
+ 401: components["responses"]["Error401"];
3533
+ 403: components["responses"]["Error403"];
3534
+ 429: components["responses"]["Error429"];
3535
+ /** @description Error response. */
3536
+ default: {
3537
+ headers: {
3538
+ [name: string]: unknown;
3539
+ };
3540
+ content: {
3541
+ "application/json": components["schemas"]["Error"];
3542
+ };
3543
+ };
3544
+ };
3545
+ };
3313
3546
  "quotes.quote": {
3314
3547
  parameters: {
3315
3548
  query: {
@@ -3470,6 +3703,123 @@ export interface operations {
3470
3703
  };
3471
3704
  };
3472
3705
  };
3706
+ "statement_generations.create": {
3707
+ parameters: {
3708
+ query?: never;
3709
+ header: {
3710
+ "Idempotency-Key": components["parameters"]["Idempotency-Key"];
3711
+ };
3712
+ path?: never;
3713
+ cookie?: never;
3714
+ };
3715
+ requestBody?: {
3716
+ content: {
3717
+ "application/json": components["schemas"]["StatementGenerationInput"];
3718
+ };
3719
+ };
3720
+ responses: {
3721
+ /** @description OK */
3722
+ 200: {
3723
+ headers: {
3724
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
3725
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
3726
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
3727
+ [name: string]: unknown;
3728
+ };
3729
+ content: {
3730
+ "application/json": components["schemas"]["StatementGeneration"];
3731
+ };
3732
+ };
3733
+ 400: components["responses"]["Error400"];
3734
+ 401: components["responses"]["Error401"];
3735
+ 403: components["responses"]["Error403"];
3736
+ 409: components["responses"]["Error409"];
3737
+ 429: components["responses"]["Error429"];
3738
+ /** @description Error response. */
3739
+ default: {
3740
+ headers: {
3741
+ [name: string]: unknown;
3742
+ };
3743
+ content: {
3744
+ "application/json": components["schemas"]["Error"];
3745
+ };
3746
+ };
3747
+ };
3748
+ };
3749
+ "statement_generations.get": {
3750
+ parameters: {
3751
+ query?: never;
3752
+ header?: never;
3753
+ path: {
3754
+ id: string;
3755
+ };
3756
+ cookie?: never;
3757
+ };
3758
+ requestBody?: never;
3759
+ responses: {
3760
+ /** @description OK */
3761
+ 200: {
3762
+ headers: {
3763
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
3764
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
3765
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
3766
+ [name: string]: unknown;
3767
+ };
3768
+ content: {
3769
+ "application/json": components["schemas"]["StatementGeneration"];
3770
+ };
3771
+ };
3772
+ 400: components["responses"]["Error400"];
3773
+ 401: components["responses"]["Error401"];
3774
+ 403: components["responses"]["Error403"];
3775
+ 429: components["responses"]["Error429"];
3776
+ /** @description Error response. */
3777
+ default: {
3778
+ headers: {
3779
+ [name: string]: unknown;
3780
+ };
3781
+ content: {
3782
+ "application/json": components["schemas"]["Error"];
3783
+ };
3784
+ };
3785
+ };
3786
+ };
3787
+ "statement_periods.catalog": {
3788
+ parameters: {
3789
+ query?: never;
3790
+ header?: never;
3791
+ path?: never;
3792
+ cookie?: never;
3793
+ };
3794
+ requestBody?: never;
3795
+ responses: {
3796
+ /** @description OK */
3797
+ 200: {
3798
+ headers: {
3799
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
3800
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
3801
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
3802
+ [name: string]: unknown;
3803
+ };
3804
+ content: {
3805
+ "application/json": components["schemas"]["StatementPeriodCatalog"];
3806
+ };
3807
+ };
3808
+ 400: components["responses"]["Error400"];
3809
+ 401: components["responses"]["Error401"];
3810
+ 403: components["responses"]["Error403"];
3811
+ 429: components["responses"]["Error429"];
3812
+ /** @description Error response. */
3813
+ default: {
3814
+ headers: {
3815
+ [name: string]: unknown;
3816
+ };
3817
+ content: {
3818
+ "application/json": components["schemas"]["Error"];
3819
+ };
3820
+ };
3821
+ };
3822
+ };
3473
3823
  "statements.list": {
3474
3824
  parameters: {
3475
3825
  query?: {
@@ -3513,6 +3863,42 @@ export interface operations {
3513
3863
  };
3514
3864
  };
3515
3865
  };
3866
+ "statements.preview": {
3867
+ parameters: {
3868
+ query?: never;
3869
+ header?: never;
3870
+ path?: never;
3871
+ cookie?: never;
3872
+ };
3873
+ requestBody?: never;
3874
+ responses: {
3875
+ /** @description OK */
3876
+ 200: {
3877
+ headers: {
3878
+ "X-RateLimit-Limit": components["headers"]["X-RateLimit-Limit"];
3879
+ "X-RateLimit-Remaining": components["headers"]["X-RateLimit-Remaining"];
3880
+ "X-RateLimit-Reset": components["headers"]["X-RateLimit-Reset"];
3881
+ [name: string]: unknown;
3882
+ };
3883
+ content: {
3884
+ "application/json": components["schemas"]["StatementPreview"];
3885
+ };
3886
+ };
3887
+ 400: components["responses"]["Error400"];
3888
+ 401: components["responses"]["Error401"];
3889
+ 403: components["responses"]["Error403"];
3890
+ 429: components["responses"]["Error429"];
3891
+ /** @description Error response. */
3892
+ default: {
3893
+ headers: {
3894
+ [name: string]: unknown;
3895
+ };
3896
+ content: {
3897
+ "application/json": components["schemas"]["Error"];
3898
+ };
3899
+ };
3900
+ };
3901
+ };
3516
3902
  "statements.retrieve": {
3517
3903
  parameters: {
3518
3904
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stable_sea/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [