@stable_sea/sdk 0.2.41 → 0.2.42
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 +43 -0
- package/dist/gen/schema.d.ts +730 -0
- package/dist/gen/session-schema.d.ts +648 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,6 +188,12 @@ Test-key Sandbox does not serve member sessions. Test approval review and
|
|
|
188
188
|
business-rule management use this same business client and session. Your existing
|
|
189
189
|
member permissions apply.
|
|
190
190
|
|
|
191
|
+
The member client also reads `GET /money/maintenance` using the signed-in
|
|
192
|
+
business session. Its customer response contains `paused`, the custody `revision`
|
|
193
|
+
and optional `updated_ts`, excluding operator reasons or actors. Pause new money
|
|
194
|
+
actions and withhold cached deposit instructions while paused or when this
|
|
195
|
+
authority cannot be read; scope instruction caches by business and revision.
|
|
196
|
+
|
|
191
197
|
```ts
|
|
192
198
|
import { createStableSeaSessionClient } from "@stable_sea/sdk";
|
|
193
199
|
|
|
@@ -744,3 +750,40 @@ a queued fee refund is separate from both principal recovery and a settled refun
|
|
|
744
750
|
The [Sandbox test project](consumer-test/README.md#test-a-withdrawal) includes
|
|
745
751
|
`npm run test:withdrawal` for a saved Test destination. It preserves request keys
|
|
746
752
|
and receipts so an interrupted run can resume without creating a new withdrawal.
|
|
753
|
+
|
|
754
|
+
## Swap stablecoins
|
|
755
|
+
|
|
756
|
+
Swaps between USDC and USDT on Ethereum run in your Go Account once Stable Sea
|
|
757
|
+
enables them for your business. Create a key with **Swap stablecoins**
|
|
758
|
+
(`money:swaps_write`) and **Read financial data** (`money:read`). The permission
|
|
759
|
+
appears only while swaps are enabled.
|
|
760
|
+
|
|
761
|
+
Read `GET /v1/swap_routes` for whether swaps are enabled, each route's limits,
|
|
762
|
+
your swap fee rate and the available balance of each asset. Estimates, quotes and
|
|
763
|
+
swaps are processed in the background: poll each until `status` leaves `pending`.
|
|
764
|
+
|
|
765
|
+
```ts
|
|
766
|
+
const quoting = client.mutation();
|
|
767
|
+
const { data: quote } = await quoting.POST("/v1/swap_quotes", {
|
|
768
|
+
body: { route: "ethereum_usdc_usdt", from_asset: "USDC", to_asset: "USDT", amount: "1000" },
|
|
769
|
+
});
|
|
770
|
+
// Retrieve GET /v1/swap_quotes/{id} until status is ready, then review terms.
|
|
771
|
+
const swapping = client.mutation();
|
|
772
|
+
const { data: swap } = await swapping.POST("/v1/swaps", { body: { quote_id: quote!.id } });
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
`POST /v1/swap_estimates` prices a swap without a binding quote; its `result`
|
|
776
|
+
names the first check a quote would fail in `refusal_reason`. A firm quote lives
|
|
777
|
+
for at most a minute, so submit it promptly; a swap that starts after
|
|
778
|
+
`expires_ts` fails with `quote_expired`. Each quote executes once. A refused
|
|
779
|
+
estimate, quote or swap reports why in `failure_code`.
|
|
780
|
+
|
|
781
|
+
Follow `GET /v1/swaps/{id}` to `completed` or `failed`. Once booked,
|
|
782
|
+
`transaction_id` names the transaction whose legs carry the amounts actually sent,
|
|
783
|
+
received and charged. After a lost response, resend the same body with the same
|
|
784
|
+
`Idempotency-Key`, or find the swap with `GET /v1/swap_submissions?idempotency_key=…`.
|
|
785
|
+
Never submit the quote again under a new key.
|
|
786
|
+
|
|
787
|
+
Signed-in members use the member client's `/money/swap_routes`,
|
|
788
|
+
`/money/swap_estimate`, `/money/swap_quotes`, `/money/swaps` and
|
|
789
|
+
`/money/swap_submissions`, with their own buy or sell permission.
|