@vayolabs/core-sdk 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@vayolabs/core-sdk` are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.1.0] — 2026-04-10
8
+
9
+ Initial public release.
10
+
11
+ ### Added
12
+
13
+ - **`createVayoPartnerClient(options)`** — ergonomic typed client grouped by
14
+ OpenAPI tag. Auto-injects `x-api-key` and `Idempotency-Key` headers,
15
+ forwards `Authorization: Bearer <jwt>` per call where required, throws
16
+ structured `VayoApiError` on non-2xx.
17
+ - **20 routes covered** across 7 method groups:
18
+ `auth.callback`, `auth.me`, `wallets.me`, `lending.markets`,
19
+ `lending.reserves`, `lendingOperations.supplyAllocated`,
20
+ `lendingOperations.redeemAllocated`, `modeS.buildRedeem`,
21
+ `modeS.submitSignedRedeem`, `dashboard.{overview, users, transactions,
22
+ consumption, investmentPerformance, performanceFees, partnerFees,
23
+ partnerFeesPayouts, allowlist, apiKeys}`, `health.modeS`.
24
+ - **`client.modeS.redeem()`** — opinionated Mode S orchestrator that runs
25
+ the full `/build → verify-fee-recipients → sign → /submit` flow with a
26
+ pluggable `signTransaction` callback. Optional direct-RPC fallback when
27
+ `/submit` fails.
28
+ - **`assertFeeRecipientsMatch()`** — exported Defense-3 mirror so partners
29
+ can verify fee recipients independently of the orchestrator.
30
+ - **`@vayolabs/core-sdk/mode-s/privy`** sub-export with
31
+ `createPrivySigner(privy, { walletId, authorizationPrivateKeys? })` for
32
+ Privy users. `@privy-io/node` is an **optional peer dep** — non-Privy
33
+ partners pay zero install cost.
34
+ - **`@vayolabs/core-sdk/generated`** sub-export exposing the raw kubb
35
+ client functions for advanced users who want lower-level access.
36
+ - **`VayoApiError`** with `statusCode`, `code`, `correlationId` for log
37
+ grepping.
38
+ - **Custom `fetch` override** in `createVayoPartnerClient` for
39
+ instrumentation, edge runtimes, and Node < 18 polyfills.
40
+ - **`U64_MAX`** and **`USDC_MINT`** constants for Mode S full redeems and
41
+ the canonical Solana USDC mint.
42
+ - **22 unit tests** covering happy paths, error envelope parsing, fee
43
+ recipient verification (including missing-partner / missing-treasury /
44
+ attacker-injection cases), Mode S orchestrator (build → sign → submit),
45
+ and the direct-RPC fallback path. All tests run via `bun test` with no
46
+ network, no DB, no Privy.
47
+ - **Dual ESM + CJS build** via tsup with `.d.ts` and source maps for both
48
+ formats. ESM bundle ~21 KB, CJS ~21 KB.
49
+ - **Zero runtime dependencies** in the main bundle.
50
+
51
+ ### Coverage notes
52
+
53
+ - Spec is generated from
54
+ `apps/api/src/scripts/export-partner-openapi.ts` → `docs/core-sdk/openapi.json`.
55
+ Re-run `bun run gen` from `packages/core-sdk` to refresh after API changes.
56
+ - Response shapes for `modeS.buildRedeem` and `modeS.submitSignedRedeem`
57
+ are typed by hand (`BuildRedeemResponse`, `SubmitSignedRedeemResponse`)
58
+ because Elysia's auto-generated swagger doesn't capture response schemas.
59
+ All other response types fall back to `unknown` until the API adds
60
+ TypeBox response validators.
61
+ - Mode S `?gasless=true` (Kora cosigning) is **not** yet supported — the
62
+ API returns `501 Not Implemented` for that flag.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for accepting support, warranty, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However, in
169
+ accepting such obligations, You may act only on Your own behalf
170
+ and on Your sole responsibility, not on behalf of any other
171
+ Contributor, and only if You agree to indemnify, defend, and hold
172
+ each Contributor harmless for any liability incurred by, or claims
173
+ asserted against, such Contributor by reason of your accepting any
174
+ such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Vayo Finance Labs
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ Vayo Finance Partner SDK
2
+ Copyright 2026 Vayo Finance Labs
3
+
4
+ This product includes software developed at Vayo Finance Labs
5
+ (https://vayo.finance).
6
+
7
+ Licensed under the Apache License, Version 2.0. You may obtain a copy of
8
+ the License at http://www.apache.org/licenses/LICENSE-2.0.
package/README.md ADDED
@@ -0,0 +1,273 @@
1
+ # @vayolabs/core-sdk
2
+
3
+ Official TypeScript SDK for the [Vayo Finance](https://vayo.finance) Partner
4
+ API. Lets partners deposit, redeem, and manage USDC lending positions on
5
+ Solana via Vayo's hardened multi-tenant platform. Partners sign every
6
+ redeem locally with their own signer; Vayo attaches a witness cosignature
7
+ that cryptographically binds the fee instructions so on-chain partner-fee
8
+ splitting is guaranteed.
9
+
10
+ > **Status:** 0.1.0 — Initial release. Partner v1 routes covered. Redeem
11
+ > `/build` + `/submit` are GA. The `?gasless=true` flag on redeem is not
12
+ > yet supported (returns `501`).
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ bun add @vayolabs/core-sdk
18
+ # or
19
+ npm install @vayolabs/core-sdk
20
+ # or
21
+ pnpm add @vayolabs/core-sdk
22
+ ```
23
+
24
+ The SDK has **zero runtime dependencies**. The optional Privy signing
25
+ adapter (`@vayolabs/core-sdk/mode-s/privy`) is the only path that needs
26
+ `@privy-io/node` — and even there, the partner constructs the
27
+ `PrivyClient` themselves and passes it in, so the SDK only consumes Privy
28
+ *types*. Partners using other signers (Squads, Phantom, custom HSMs) pay
29
+ zero install cost.
30
+
31
+ ## 60-second quickstart
32
+
33
+ ```ts
34
+ import { createVayoPartnerClient } from '@vayolabs/core-sdk'
35
+
36
+ const vayo = createVayoPartnerClient({
37
+ baseUrl: 'https://api.vayo.finance',
38
+ apiKey: process.env.VAYO_API_KEY!, // issued via POST /admin/partners/:id/api-keys
39
+ })
40
+
41
+ // Read-only endpoints — no JWT required
42
+ const overview = await vayo.dashboard.overview()
43
+ const markets = await vayo.lending.markets()
44
+ const fees = await vayo.dashboard.partnerFees()
45
+ ```
46
+
47
+ ## Redeem — partners sign locally
48
+
49
+ Partner runs their own signer (Privy, Squads, Phantom, HSM, anything).
50
+ Vayo provides a witness cosignature that cryptographically binds the fee
51
+ instructions; the partner adds the user-wallet authority signature locally
52
+ and submits.
53
+
54
+ The `client.modeS.redeem()` orchestrator runs the full
55
+ `/build → verify → sign → /submit` flow. The signing step is a callback you
56
+ provide — works with any signer.
57
+
58
+ ```ts
59
+ import { createVayoPartnerClient, U64_MAX, USDC_MINT } from '@vayolabs/core-sdk'
60
+
61
+ const vayo = createVayoPartnerClient({
62
+ baseUrl: 'https://api.vayo.finance',
63
+ apiKey: process.env.VAYO_API_KEY!,
64
+ })
65
+
66
+ const result = await vayo.modeS.redeem({
67
+ privyDid: 'did:privy:cm...',
68
+ marketAddress: 'H6rMUYR8XSUxsZWtpsAJSqQ4rk2pGMLFp4xJqFE9YjV1',
69
+ tokenMint: USDC_MINT,
70
+ amount: U64_MAX,
71
+
72
+ // Defense-3 mirror — aborts before signing if recipients drift.
73
+ // Strongly recommended.
74
+ expectedFeeRecipients: {
75
+ partnerPayoutAddress: 'YourPartnerPayoutWallet...',
76
+ vayoTreasuryAddress: 'VayoTreasuryWallet...',
77
+ },
78
+
79
+ // Plug in any signer. Receives the partially-signed wire bytes (base64)
80
+ // with Vayo's witness signature already attached, must return the
81
+ // fully-signed wire bytes (base64) with the user authority added.
82
+ signTransaction: async (serializedTxBase64) => {
83
+ return await mySigner(serializedTxBase64)
84
+ },
85
+ })
86
+
87
+ console.log(result.signature) // confirmed Solana signature
88
+ ```
89
+
90
+ ## Privy signer (one-liner)
91
+
92
+ For partners using Privy, the SDK ships an opt-in adapter at
93
+ `@vayolabs/core-sdk/mode-s/privy`. It bridges `@privy-io/node` to the
94
+ `signTransaction` callback so you don't have to write any signing code:
95
+
96
+ ```ts
97
+ import { createVayoPartnerClient, U64_MAX, USDC_MINT } from '@vayolabs/core-sdk'
98
+ import { createPrivySigner } from '@vayolabs/core-sdk/mode-s/privy'
99
+ import { PrivyClient } from '@privy-io/node'
100
+
101
+ const vayo = createVayoPartnerClient({
102
+ baseUrl: 'https://api.vayo.finance',
103
+ apiKey: process.env.VAYO_API_KEY!,
104
+ })
105
+
106
+ const privy = new PrivyClient({
107
+ appId: process.env.PRIVY_APP_ID!,
108
+ appSecret: process.env.PRIVY_APP_SECRET!,
109
+ })
110
+
111
+ const sign = createPrivySigner(privy, {
112
+ walletId: userWalletId, // the user's Privy wallet id
113
+ authorizationPrivateKeys: [process.env.PRIVY_AUTHORIZATION_PRIVATE_KEY!],
114
+ })
115
+
116
+ const result = await vayo.modeS.redeem({
117
+ privyDid: 'did:privy:cm...',
118
+ marketAddress: 'H6...',
119
+ tokenMint: USDC_MINT,
120
+ amount: U64_MAX,
121
+ signTransaction: sign,
122
+ expectedFeeRecipients: {
123
+ partnerPayoutAddress: 'YourPartnerPayoutWallet...',
124
+ vayoTreasuryAddress: 'VayoTreasuryWallet...',
125
+ },
126
+ })
127
+ ```
128
+
129
+ `@privy-io/node` is declared as an **optional peer dependency** — install
130
+ it yourself only if you need the Privy adapter.
131
+
132
+ ## Idempotency & retries
133
+
134
+ Every mutating partner v1 route requires an `Idempotency-Key` header. The
135
+ SDK auto-generates one (UUID v4) on each call by default. For safe retries,
136
+ pass your own stable key per logical operation:
137
+
138
+ ```ts
139
+ const idemKey = crypto.randomUUID()
140
+ try {
141
+ return await vayo.modeS.submitSignedRedeem({
142
+ idempotencyKey: idemKey,
143
+ body: { /* ... */ },
144
+ })
145
+ } catch (networkError) {
146
+ // Safe retry — Vayo replays the cached response if the original
147
+ // call already succeeded server-side.
148
+ return await vayo.modeS.submitSignedRedeem({
149
+ idempotencyKey: idemKey,
150
+ body: { /* ... */ },
151
+ })
152
+ }
153
+ ```
154
+
155
+ ## Error handling
156
+
157
+ Non-2xx responses throw a structured `VayoApiError` with the API's
158
+ correlation id for log grepping:
159
+
160
+ ```ts
161
+ import { VayoApiError } from '@vayolabs/core-sdk'
162
+
163
+ try {
164
+ await vayo.modeS.submitSignedRedeem({ body })
165
+ } catch (err) {
166
+ if (err instanceof VayoApiError) {
167
+ console.error(`[vayo:${err.statusCode}] ${err.message} (${err.correlationId})`)
168
+ if (err.statusCode === 403) {
169
+ // market not in partner allowlist, JWT for wrong partner, etc.
170
+ }
171
+ if (err.statusCode === 429) {
172
+ // rate limit — back off
173
+ }
174
+ }
175
+ throw err
176
+ }
177
+ ```
178
+
179
+ ## Method reference
180
+
181
+ | Method | Route | Auth |
182
+ |---|---|---|
183
+ | `vayo.lending.markets()` | `GET /v1/lending/markets` | API key |
184
+ | `vayo.lending.reserves({ mints? })` | `GET /v1/lending/reserves` | API key |
185
+ | `vayo.modeS.buildRedeem({ body })` | `POST /v1/lending-operations/redeem-allocated/build` | API key |
186
+ | `vayo.modeS.submitSignedRedeem({ body })` | `POST /v1/lending-operations/redeem-allocated/submit` | API key |
187
+ | `vayo.modeS.redeem({ ... })` | (orchestrator) | API key |
188
+ | `vayo.payments.createOnramp({ body })` | `POST /onramp/` | API key |
189
+ | `vayo.payments.createOfframp({ body })` | `POST /offramp/` | API key |
190
+ | `vayo.payments.getOfframpStatus({ end2end })` | `GET /offramp/status/:end2end` | API key |
191
+ | `vayo.payments.paymentEvents({ type?, status?, limit?, offset? })` | `GET /payment-events/` | API key |
192
+ | `vayo.payments.transactions({ type?, status?, limit?, offset? })` | `GET /transactions/` | API key |
193
+ | `vayo.payments.prepareDeposit()` | `POST /transactions/prepare-deposit` | API key |
194
+ | `vayo.dashboard.overview()` | `GET /v1/dashboard/overview` | API key |
195
+ | `vayo.dashboard.users({ limit?, offset?, activeOnly? })` | `GET /v1/dashboard/users` | API key |
196
+ | `vayo.dashboard.transactions({ type?, status?, limit?, offset? })` | `GET /v1/dashboard/transactions` | API key |
197
+ | `vayo.dashboard.consumption()` | `GET /v1/dashboard/consumption` | API key |
198
+ | `vayo.dashboard.investmentPerformance()` | `GET /v1/dashboard/investment-performance` | API key |
199
+ | `vayo.dashboard.partnerFees()` | `GET /v1/dashboard/partner-fees` | API key |
200
+ | `vayo.dashboard.partnerFeesPayouts({ limit?, offset? })` | `GET /v1/dashboard/partner-fees/payouts` | API key |
201
+ | `vayo.dashboard.allowlist()` | `GET /v1/dashboard/allowlist` | API key |
202
+ | `vayo.dashboard.apiKeys()` | `GET /v1/dashboard/api-keys` | API key |
203
+ | `vayo.health.liveness()` | `GET /health` | (none) |
204
+ | `vayo.health.kora()` | `GET /health/kora` | (none) |
205
+ | `vayo.health.modeS()` | `GET /health/mode-s` | (none) |
206
+ | `vayo.health.ready()` | `GET /health/ready` | (none) |
207
+
208
+ ## Custom fetch & runtime support
209
+
210
+ Works in Node 18+, Bun, Deno, Cloudflare Workers, Vercel Edge, and
211
+ browsers. Provide a custom `fetch` for instrumentation or older runtimes:
212
+
213
+ ```ts
214
+ const vayo = createVayoPartnerClient({
215
+ baseUrl: 'https://api.vayo.finance',
216
+ apiKey: process.env.VAYO_API_KEY!,
217
+ fetch: async (input, init) => {
218
+ const start = Date.now()
219
+ try {
220
+ return await fetch(input, init)
221
+ } finally {
222
+ metrics.histogram('vayo.api.duration_ms', Date.now() - start)
223
+ }
224
+ },
225
+ })
226
+ ```
227
+
228
+ ## Going to production
229
+
230
+ Before flipping the switch:
231
+
232
+ - [ ] API key stored in your secrets manager (Vayo cannot recover it)
233
+ - [ ] `payoutWalletAddress` has an existing USDC ATA (validated at activation)
234
+ - [ ] You verified at least one redeem flow on staging end-to-end and inspected the on-chain `transferChecked` recipients
235
+ - [ ] `Idempotency-Key` is wired into your retry layer
236
+ - [ ] You catch `VayoApiError` and surface `correlationId` in your logs
237
+
238
+ ## Optional: auto-rebalance proxy
239
+
240
+ Partners that want to authorize each rebalance redeem themselves (rather
241
+ than letting Vayo execute with cached credentials) can onboard a signing
242
+ proxy. Vayo HMAC-signs outbound requests to the partner's `rebalanceProxyUrl`,
243
+ the partner signs the wire bytes and submits on-chain, then reports the
244
+ result back via `POST /v1/rebalance/operations/:pendingOperationId/confirm`
245
+ authenticated with a scoped partner API key (`rebalance:operation:confirm`). See
246
+ [`docs-partners/guides/signing-modes.md`](../../docs-partners/guides/signing-modes.md)
247
+ and [`docs-partners/sdk/examples/rebalance-proxy.md`](../../docs-partners/sdk/examples/rebalance-proxy.md)
248
+ for the full contract. Partners without this configured have auto-rebalance
249
+ handled by Vayo directly.
250
+
251
+ ## More documentation
252
+
253
+ - **Long-form quickstart** with curl examples: [`docs/quickstart.md`](./docs/quickstart.md)
254
+ - **Full OpenAPI 3.x spec** (regenerated from the live route definitions): [`openapi.json`](./openapi.json)
255
+ - **Postman collection** (mirrors the spec): [`docs/postman-collection.json`](./docs/postman-collection.json)
256
+ - **Mode S example** (uses this SDK): [`docs/examples/mode-s-redeem.ts`](./docs/examples/mode-s-redeem.ts)
257
+
258
+ ## For AI coding assistants
259
+
260
+ This package ships two LLM-discovery files so AI coding assistants can integrate with Vayo without you copy-pasting docs into the chat:
261
+
262
+ - **[`SKILL.md`](./SKILL.md)** — A [Claude Code skill](https://docs.claude.com/en/docs/claude-code/skills) that teaches Claude how to integrate with the Vayo Partner API/SDK end-to-end. Includes the method-group routing table, idempotency + error handling patterns, and the going-to-prod checklist. Drop the package into a Claude Code project and the skill auto-loads.
263
+ - **[`docs/llms.txt`](./docs/llms.txt)** — An [llmstxt.org](https://llmstxt.org/)-formatted index of every doc, example, and source file in the partner platform. Compatible with Cursor, Claude Code, ChatGPT, Cody, and any other AI assistant that understands the spec.
264
+
265
+ ## License
266
+
267
+ [Apache License 2.0](./LICENSE) © Vayo Finance Labs.
268
+
269
+ Apache 2.0 includes an explicit patent grant (Section 3) — relevant for a
270
+ DeFi SDK where contributors and upstream projects may hold patents on
271
+ lending math, on-chain primitives, or SPL token flows. See
272
+ [`NOTICE`](./NOTICE) for the attribution notice that must accompany
273
+ redistributions.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ type GetV1LendingReservesQueryParams = {
6
+ /**
7
+ * @type string | undefined
8
+ */
9
+ mints?: string;
10
+ };
11
+ type GetV1LendingReserves200 = any;
12
+ type GetV1LendingReservesQueryResponse = GetV1LendingReserves200;
13
+ type GetV1LendingReservesQuery = {
14
+ Response: GetV1LendingReserves200;
15
+ QueryParams: GetV1LendingReservesQueryParams;
16
+ Errors: any;
17
+ };
18
+
19
+ export type { GetV1LendingReservesQueryParams as G, GetV1LendingReserves200 as a, GetV1LendingReservesQuery as b, GetV1LendingReservesQueryResponse as c };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ type GetV1LendingReservesQueryParams = {
6
+ /**
7
+ * @type string | undefined
8
+ */
9
+ mints?: string;
10
+ };
11
+ type GetV1LendingReserves200 = any;
12
+ type GetV1LendingReservesQueryResponse = GetV1LendingReserves200;
13
+ type GetV1LendingReservesQuery = {
14
+ Response: GetV1LendingReserves200;
15
+ QueryParams: GetV1LendingReservesQueryParams;
16
+ Errors: any;
17
+ };
18
+
19
+ export type { GetV1LendingReservesQueryParams as G, GetV1LendingReserves200 as a, GetV1LendingReservesQuery as b, GetV1LendingReservesQueryResponse as c };