@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.
@@ -0,0 +1,588 @@
1
+ import { b as GetV1DashboardUsersQueryParams, a as GetV1DashboardTransactionsQueryParams, G as GetV1DashboardPartnerFeesPayoutsQueryParams, P as PostV1LendingOperationsRedeemAllocatedBuildMutationRequest, c as PostV1LendingOperationsRedeemAllocatedBuildQueryParams, d as PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest } from './PostV1LendingOperationsRedeemAllocatedSubmit-znL3KL6k.cjs';
2
+
3
+ /**
4
+ * Defense-3 mirror — local verification of the fee recipients embedded in
5
+ * the partially-signed transaction returned by `/build`.
6
+ *
7
+ * Catches the (unlikely) case where Vayo's fee math drifted vs. what the
8
+ * partner is expecting in their dashboard, before the partner wastes a
9
+ * Privy/HSM signing call. The cryptographic safety net (witness signature
10
+ * binding the message hash) is still the load-bearing check — this is just
11
+ * a fast-fail surface that gives partners a clear error message.
12
+ */
13
+ interface ExpectedFeeRecipients {
14
+ /** Partner's payout wallet (USDC ATA owner). */
15
+ partnerPayoutAddress: string;
16
+ /** Vayo's treasury wallet. */
17
+ vayoTreasuryAddress: string;
18
+ }
19
+ interface ObservedFeeRecipient {
20
+ address: string;
21
+ amount: string;
22
+ }
23
+ /**
24
+ * Asserts that both the partner payout address AND Vayo treasury address
25
+ * appear among the fee transfers Vayo embedded. Throws a `RangeError` with
26
+ * a clear message listing the missing addresses if either is absent.
27
+ */
28
+ declare function assertFeeRecipientsMatch(observed: readonly ObservedFeeRecipient[], expected: ExpectedFeeRecipients): void;
29
+
30
+ /**
31
+ * Layer 2 — `client.modeS.redeem()` — opinionated Mode S orchestrator.
32
+ *
33
+ * Runs the full build → verify → sign → submit flow that every Mode S
34
+ * partner needs. Built so the only piece partners must implement themselves
35
+ * is the `signTransaction` callback (typically backed by `@privy-io/node`,
36
+ * Squads, an HSM, or any other Solana signer).
37
+ *
38
+ * Sequence:
39
+ * 1. POST /v1/lending-operations/redeem-allocated/build
40
+ * 2. (Optional) Verify embedded fee recipients match the partner's expectation
41
+ * 3. Invoke `signTransaction` with the partially-signed wire bytes (base64)
42
+ * 4. POST /v1/lending-operations/redeem-allocated/submit
43
+ * 5. (Optional) On /submit failure, fall back to broadcasting via the
44
+ * partner's own RPC URL — the witness signature is still load-bearing
45
+ * so the cryptographic guarantee holds either way.
46
+ *
47
+ * The orchestrator is intentionally callback-driven (not coupled to a
48
+ * specific signer) so the same code path works for Privy users, Squads
49
+ * users, partners with custom HSMs, and future signers.
50
+ */
51
+
52
+ /**
53
+ * The signing callback partners provide. Receives the base64-encoded
54
+ * partially-signed transaction (with Vayo's witness signature already
55
+ * attached) and must return the base64-encoded fully-signed transaction
56
+ * with the user-wallet authority signature added.
57
+ *
58
+ * Implementations typically:
59
+ * 1. Decode the base64 → wire bytes
60
+ * 2. Hand to a signer SDK (Privy, Squads, etc.)
61
+ * 3. Re-encode the resulting fully-signed transaction → base64
62
+ *
63
+ * For Privy users, see `@vayolabs/core-sdk/mode-s/privy` which exports a
64
+ * pre-built `createPrivySigner()` adapter.
65
+ */
66
+ type SignTransactionCallback = (serializedTxBase64: string) => Promise<string>;
67
+ interface RedeemModeSInput {
68
+ /** Privy DID of the user (in the partner's Privy app). */
69
+ privyDid: string;
70
+ /** Single market — multi-market not supported in MVP because each redeem is its own tx. */
71
+ marketAddress: string;
72
+ /** Token mint (e.g. USDC). */
73
+ tokenMint: string;
74
+ /**
75
+ * Token base units. Pass `U64_MAX` (from `@vayolabs/core-sdk`) for a full
76
+ * redeem. Defaults to `U64_MAX` if omitted.
77
+ */
78
+ amount?: string;
79
+ /** Optional reserve override (for markets with multiple reserves of the same mint). */
80
+ reserveAddress?: string;
81
+ /** Partner-supplied signer. See `SignTransactionCallback` for the contract. */
82
+ signTransaction: SignTransactionCallback;
83
+ /**
84
+ * Optional Defense-3 mirror. When provided, the orchestrator verifies the
85
+ * embedded fee transfers match these addresses BEFORE invoking
86
+ * `signTransaction`. Strongly recommended.
87
+ */
88
+ expectedFeeRecipients?: ExpectedFeeRecipients;
89
+ /**
90
+ * Optional fallback. When `/submit` fails (e.g. Vayo transient error), the
91
+ * orchestrator broadcasts the signed tx directly to this RPC URL via
92
+ * `sendTransaction`. The reconciliation CRON later picks up the on-chain
93
+ * signature and writes the partner_fee_payouts row.
94
+ */
95
+ fallbackRpcUrl?: string;
96
+ /** Caller-provided idempotency key. Reused across both /build and /submit. */
97
+ idempotencyKey?: string;
98
+ /** AbortSignal — propagated to both /build and /submit. */
99
+ signal?: AbortSignal;
100
+ }
101
+ interface RedeemModeSResult {
102
+ /** Confirmed (or freshly-submitted) transaction signature. */
103
+ signature: string;
104
+ /** The cached pendingRedeemId from /build (useful for log correlation). */
105
+ pendingRedeemId: string;
106
+ /** The fee recipients that were embedded by Vayo and signed off-chain. */
107
+ expectedFeeRecipients: ReadonlyArray<{
108
+ address: string;
109
+ amount: string;
110
+ }>;
111
+ /** Cosigners that were attached at build time. */
112
+ cosignersAttached: ReadonlyArray<"witness" | "kora">;
113
+ /** True when the result came from the direct-RPC fallback path. */
114
+ viaFallbackRpc: boolean;
115
+ }
116
+ interface ModeSHelper {
117
+ /** Run the full Mode S redeem flow. See `RedeemModeSInput` for options. */
118
+ redeem(input: RedeemModeSInput, opts?: CallOptions): Promise<RedeemModeSResult>;
119
+ }
120
+
121
+ /**
122
+ * Layer 2 — `client.modeS.supply()` — Mode S supply orchestrator.
123
+ *
124
+ * Mirrors the Mode S redeem flow for supplies:
125
+ * 1. POST /v1/lending-operations/supply-allocated/build
126
+ * 2. Invoke partner's `signTransaction` with the partially-signed tx
127
+ * 3. POST /v1/lending-operations/supply-allocated/submit
128
+ */
129
+
130
+ interface BuildSupplyResponse {
131
+ serializedTx: string;
132
+ pendingSupplyId: string;
133
+ cosignersAttached: Array<"witness" | "kora">;
134
+ expiresAt: string;
135
+ }
136
+ interface SubmitSignedSupplyResponse {
137
+ signature: string;
138
+ confirmed: boolean;
139
+ }
140
+ interface SupplyModeSInput {
141
+ privyDid: string;
142
+ marketAddress: string;
143
+ tokenMint: string;
144
+ amount: string;
145
+ reserveAddress?: string;
146
+ signTransaction: SignTransactionCallback;
147
+ idempotencyKey?: string;
148
+ signal?: AbortSignal;
149
+ }
150
+ interface SupplyModeSResult {
151
+ signature: string;
152
+ pendingSupplyId: string;
153
+ cosignersAttached: ReadonlyArray<"witness" | "kora">;
154
+ }
155
+ interface ModeSSupplyHelper {
156
+ supply(input: SupplyModeSInput, opts?: CallOptions): Promise<SupplyModeSResult>;
157
+ }
158
+
159
+ /**
160
+ * Response shapes for `client.positions.read()`. Hand-rolled to mirror
161
+ * `apps/api/src/core/domain/entities/lending-reserve.ts` because Elysia's
162
+ * exported swagger types responses as `any`.
163
+ */
164
+ interface PositionRewardEntry {
165
+ rewardMint: string;
166
+ rewardSymbol?: string;
167
+ amount: string;
168
+ usdValue: number;
169
+ }
170
+ interface UserPosition {
171
+ marketAddress: string;
172
+ marketName: string;
173
+ reserveAddress?: string;
174
+ reserveName: string;
175
+ mint?: string;
176
+ decimals: number;
177
+ exchangeRate: number;
178
+ price: number;
179
+ supplyAPY: number;
180
+ suppliedFormatted: string;
181
+ suppliedUsd: number;
182
+ rewards: PositionRewardEntry[];
183
+ /** Net USD deposited into this specific reserve. */
184
+ netDepositedUsd?: number;
185
+ /** Real accumulated yield: `suppliedUsd - netDepositedUsd`. */
186
+ accumulatedYieldUsd?: number;
187
+ }
188
+ interface ReadPositionsResponse {
189
+ positions: UserPosition[];
190
+ totalSuppliedUsd: number;
191
+ netDepositedUsd: number;
192
+ accumulatedYieldUsd: number;
193
+ timestamp: string;
194
+ investedSince: string | null;
195
+ }
196
+
197
+ /**
198
+ * Layer 2 — `client.wallet.withdraw()` — async memo-challenge orchestrator.
199
+ *
200
+ * Withdrawals are gated by the user's embedded-wallet 2FA memo. The
201
+ * orchestrator runs:
202
+ * 1. POST /v1/wallet/withdraw/prepare
203
+ * 2. Invoke partner's `signTransaction` with the unsigned memo skeleton
204
+ * 3. POST /v1/wallet/withdraw/submit
205
+ *
206
+ * Vayo never broadcasts the signed memo — it's a proof-of-possession only.
207
+ * The actual USDC transfer is broadcast by Vayo after verifying the memo.
208
+ */
209
+
210
+ interface PrepareWithdrawalResponse {
211
+ pendingWithdrawalId: string;
212
+ memoChallenge: string;
213
+ serializedMemoTransaction: string;
214
+ userWalletAddress: string;
215
+ expiresAt: string;
216
+ }
217
+ interface SubmitWithdrawalResponse {
218
+ signature: string;
219
+ transactionId: string;
220
+ }
221
+ interface WithdrawInput {
222
+ privyDid: string;
223
+ destinationAddress: string;
224
+ amount: string;
225
+ exactRecipientAmount?: boolean;
226
+ signTransaction: SignTransactionCallback;
227
+ idempotencyKey?: string;
228
+ signal?: AbortSignal;
229
+ }
230
+ interface WithdrawResult {
231
+ signature: string;
232
+ transactionId: string;
233
+ pendingWithdrawalId: string;
234
+ memoChallenge: string;
235
+ }
236
+ interface WalletHelper {
237
+ withdraw(input: WithdrawInput, opts?: CallOptions): Promise<WithdrawResult>;
238
+ }
239
+
240
+ interface WebhookSubscription {
241
+ id: string;
242
+ partnerId: string;
243
+ url: string;
244
+ events: string[];
245
+ description: string | null;
246
+ isActive: boolean;
247
+ createdAt: string;
248
+ updatedAt: string;
249
+ }
250
+ interface CreateWebhookSubscriptionResponse extends WebhookSubscription {
251
+ secret: string;
252
+ }
253
+ interface RotateWebhookSecretResponse {
254
+ id: string;
255
+ secret: string;
256
+ rotatedAt: string;
257
+ }
258
+ interface DispatchWebhookEventResponse {
259
+ eventId: string;
260
+ deliveriesEnqueued: number;
261
+ }
262
+ interface WebhookDelivery {
263
+ id: string;
264
+ eventId: string;
265
+ eventType: string;
266
+ status: "pending" | "delivered" | "retrying" | "permanently_failed";
267
+ attempts: number;
268
+ nextRetryAt: string | null;
269
+ lastAttemptAt: string | null;
270
+ responseStatus: number | null;
271
+ createdAt: string;
272
+ }
273
+ interface ListWebhookDeliveriesResponse {
274
+ items: WebhookDelivery[];
275
+ nextCursor: string | null;
276
+ }
277
+ /**
278
+ * Verify a webhook delivery's HMAC signature.
279
+ *
280
+ * @param secret The signing secret returned at subscription creation (or rotation)
281
+ * @param body The raw request body bytes you received (DO NOT re-stringify)
282
+ * @param signatureHeader Value of the `X-Vayo-Signature` header (e.g. `sha256=abc...`)
283
+ * @returns true when the signature matches; false otherwise
284
+ */
285
+ declare function verifyWebhookSignature(secret: string, body: string, signatureHeader: string | null | undefined): boolean;
286
+
287
+ /**
288
+ * Layer 1 — `createVayoPartnerClient()` — the ergonomic typed client.
289
+ *
290
+ * Wraps the kubb-generated raw client functions in a tag-grouped object so
291
+ * partners get autocomplete that mirrors the OpenAPI tags
292
+ * (`client.lending.markets()`, `client.modeS.buildRedeem()`, etc.). Auth,
293
+ * idempotency-key generation, and structured errors are handled inside the
294
+ * shared `http.ts` wrapper — this file is just plumbing.
295
+ *
296
+ * All partner endpoints authenticate with the `x-api-key` header alone; there
297
+ * are no JWT-guarded routes in the current surface.
298
+ *
299
+ * Per-call options:
300
+ * - `idempotencyKey` — caller-provided idempotency key. Required for safe
301
+ * retries on mutating routes; auto-generated if absent.
302
+ * - `signal` — AbortSignal to cancel in-flight requests.
303
+ */
304
+
305
+ interface VayoPartnerClientOptions {
306
+ /** Vayo API base URL — e.g. `https://api.vayo.finance`. No trailing slash. */
307
+ baseUrl: string;
308
+ /** Partner API key issued via `POST /admin/partners/:id/api-keys`. */
309
+ apiKey: string;
310
+ /** Optional fetch override (Node 18-, edge runtimes, instrumentation). */
311
+ fetch?: typeof fetch;
312
+ /** Optional idempotency-key generator override (default: `crypto.randomUUID`). */
313
+ generateIdempotencyKey?: () => string;
314
+ }
315
+ /** Common per-call options threaded through every method. */
316
+ interface CallOptions {
317
+ /** AbortSignal to cancel the request. */
318
+ signal?: AbortSignal;
319
+ /** Caller-provided idempotency key (mutating routes). Auto-generated if absent. */
320
+ idempotencyKey?: string;
321
+ }
322
+ /** `client.lending.*` — read-only market/reserve data. */
323
+ interface LendingMethods {
324
+ /** List markets allowed by the partner's allowlist. @see GET /v1/lending/markets */
325
+ markets(args?: CallOptions): Promise<unknown>;
326
+ /** Flat reserves across markets, optionally filtered by mints. @see GET /v1/lending/reserves */
327
+ reserves(args?: {
328
+ mints?: string[] | string;
329
+ } & CallOptions): Promise<unknown>;
330
+ }
331
+ /** `client.modeS.*` — build/submit + opinionated `redeem()` and `supply()` orchestrators. */
332
+ interface ModeSMethods extends ModeSHelper, ModeSSupplyHelper {
333
+ /**
334
+ * Build a partially-signed redeem tx with the witness cosignature.
335
+ * @see POST /v1/lending-operations/redeem-allocated/build
336
+ */
337
+ buildRedeem(args: {
338
+ body: PostV1LendingOperationsRedeemAllocatedBuildMutationRequest;
339
+ query?: PostV1LendingOperationsRedeemAllocatedBuildQueryParams;
340
+ } & CallOptions): Promise<BuildRedeemResponse>;
341
+ /**
342
+ * Submit a fully-signed redeem tx (Vayo re-verifies cosigners + relays).
343
+ * @see POST /v1/lending-operations/redeem-allocated/submit
344
+ */
345
+ submitSignedRedeem(args: {
346
+ body: PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest;
347
+ } & CallOptions): Promise<SubmitSignedRedeemResponse>;
348
+ /**
349
+ * Build a partially-signed supply tx with the witness cosignature.
350
+ * @see POST /v1/lending-operations/supply-allocated/build
351
+ */
352
+ buildSupply(args: {
353
+ body: {
354
+ privyDid: string;
355
+ marketAddress: string;
356
+ tokenMint: string;
357
+ amount: string;
358
+ reserveAddress?: string;
359
+ };
360
+ query?: {
361
+ gasless?: "true" | "false";
362
+ };
363
+ } & CallOptions): Promise<BuildSupplyResponse>;
364
+ /**
365
+ * Submit a fully-signed supply tx (Vayo re-verifies cosigners + relays).
366
+ * @see POST /v1/lending-operations/supply-allocated/submit
367
+ */
368
+ submitSignedSupply(args: {
369
+ body: {
370
+ pendingSupplyId: string;
371
+ serializedTx: string;
372
+ };
373
+ } & CallOptions): Promise<SubmitSignedSupplyResponse>;
374
+ /**
375
+ * Confirm a redeem the partner submitted on-chain via their own RPC/signer.
376
+ * Vayo fetches the tx by signature, verifies the witness memo
377
+ * `vayo-witness:<pendingRedeemId>` is present, and marks the pending row
378
+ * confirmed.
379
+ * @see POST /v1/lending-operations/redeem-allocated/confirm
380
+ */
381
+ confirmRedeem(args: {
382
+ body: {
383
+ pendingRedeemId: string;
384
+ signature: string;
385
+ marketAddress: string;
386
+ status?: "confirmed" | "failed";
387
+ errorMessage?: string;
388
+ };
389
+ } & CallOptions): Promise<ConfirmModeSResponse>;
390
+ /**
391
+ * Confirm a supply the partner submitted on-chain via their own RPC/signer.
392
+ * @see POST /v1/lending-operations/supply-allocated/confirm
393
+ */
394
+ confirmSupply(args: {
395
+ body: {
396
+ pendingSupplyId: string;
397
+ signature: string;
398
+ marketAddress: string;
399
+ status?: "confirmed" | "failed";
400
+ errorMessage?: string;
401
+ };
402
+ } & CallOptions): Promise<ConfirmModeSResponse>;
403
+ }
404
+ interface ConfirmModeSResponse {
405
+ accepted: boolean;
406
+ idempotent?: boolean;
407
+ recorded?: "confirmed" | "failed";
408
+ signature?: string;
409
+ reason?: string;
410
+ }
411
+ /** `client.positions.*` — read live Kamino positions for a partner-user. */
412
+ interface PositionsMethods {
413
+ /**
414
+ * Read a user's live Kamino positions (supplied amounts, accumulated yield,
415
+ * per-market breakdown). The user must sign a memo intent of the form
416
+ * `vayo:read-positions:<walletAddress>:<partnerSlug>:<unixSeconds>` with
417
+ * their wallet — the signed transaction is never broadcast on-chain. The
418
+ * memo is partner-bound so a signature authorized for partner A cannot be
419
+ * replayed by partner B.
420
+ *
421
+ * @see POST /v1/positions/read
422
+ */
423
+ read(args: {
424
+ body: {
425
+ /** Solana wallet address (base58) whose positions to read. */
426
+ walletAddress: string;
427
+ /**
428
+ * Base64 V0 transaction with a single Memo instruction signed by
429
+ * the wallet owner.
430
+ */
431
+ signedIntentTransaction: string;
432
+ };
433
+ } & CallOptions): Promise<ReadPositionsResponse>;
434
+ }
435
+ /** `client.wallet.*` — async memo-challenge withdrawal. */
436
+ interface WalletMethods extends WalletHelper {
437
+ /** @see POST /v1/wallet/withdraw/prepare */
438
+ prepareWithdrawal(args: {
439
+ body: {
440
+ privyDid: string;
441
+ destinationAddress: string;
442
+ amount: string;
443
+ exactRecipientAmount?: boolean;
444
+ };
445
+ } & CallOptions): Promise<PrepareWithdrawalResponse>;
446
+ /** @see POST /v1/wallet/withdraw/submit */
447
+ submitWithdrawal(args: {
448
+ body: {
449
+ pendingWithdrawalId: string;
450
+ signedIntentTransaction: string;
451
+ };
452
+ } & CallOptions): Promise<SubmitWithdrawalResponse>;
453
+ }
454
+ /** `client.webhooks.*` — outbound event subscriptions. */
455
+ interface WebhooksMethods {
456
+ /** @see POST /v1/webhooks */
457
+ create(args: {
458
+ body: {
459
+ url: string;
460
+ events: string[];
461
+ description?: string;
462
+ };
463
+ } & CallOptions): Promise<CreateWebhookSubscriptionResponse>;
464
+ /** @see GET /v1/webhooks */
465
+ list(args?: CallOptions): Promise<WebhookSubscription[]>;
466
+ /** @see DELETE /v1/webhooks/:subscriptionId */
467
+ delete(args: {
468
+ subscriptionId: string;
469
+ } & CallOptions): Promise<{
470
+ deleted: true;
471
+ }>;
472
+ /** @see POST /v1/webhooks/:subscriptionId/rotate-secret */
473
+ rotateSecret(args: {
474
+ subscriptionId: string;
475
+ } & CallOptions): Promise<RotateWebhookSecretResponse>;
476
+ /** @see POST /v1/webhooks/:subscriptionId/test */
477
+ test(args: {
478
+ subscriptionId: string;
479
+ } & CallOptions): Promise<DispatchWebhookEventResponse>;
480
+ /** @see GET /v1/webhooks/:subscriptionId/deliveries */
481
+ deliveries(args: {
482
+ subscriptionId: string;
483
+ cursor?: string;
484
+ limit?: number;
485
+ status?: "pending" | "delivered" | "retrying" | "permanently_failed";
486
+ } & CallOptions): Promise<ListWebhookDeliveriesResponse>;
487
+ }
488
+ /** `client.dashboard.*` — partner self-service analytics. */
489
+ interface DashboardMethods {
490
+ /** @see GET /v1/dashboard/overview */
491
+ overview(args?: CallOptions): Promise<unknown>;
492
+ /** @see GET /v1/dashboard/users */
493
+ users(args?: GetV1DashboardUsersQueryParams & CallOptions): Promise<unknown>;
494
+ /** @see GET /v1/dashboard/transactions */
495
+ transactions(args?: GetV1DashboardTransactionsQueryParams & CallOptions): Promise<unknown>;
496
+ /** @see GET /v1/dashboard/consumption */
497
+ consumption(args?: CallOptions): Promise<unknown>;
498
+ /** @see GET /v1/dashboard/investment-performance */
499
+ investmentPerformance(args?: CallOptions): Promise<unknown>;
500
+ /** @deprecated Legacy alias of `partnerFees`. @see GET /v1/dashboard/performance-fees */
501
+ performanceFees(args?: CallOptions): Promise<unknown>;
502
+ /** @see GET /v1/dashboard/partner-fees */
503
+ partnerFees(args?: CallOptions): Promise<unknown>;
504
+ /** @see GET /v1/dashboard/partner-fees/payouts */
505
+ partnerFeesPayouts(args?: GetV1DashboardPartnerFeesPayoutsQueryParams & CallOptions): Promise<unknown>;
506
+ /** @see GET /v1/dashboard/allowlist */
507
+ allowlist(args?: CallOptions): Promise<unknown>;
508
+ /** @see GET /v1/dashboard/api-keys */
509
+ apiKeys(args?: CallOptions): Promise<unknown>;
510
+ }
511
+ /** `client.health.*` — service + signing subsystem health. */
512
+ interface HealthMethods {
513
+ /** Basic liveness probe. @see GET /health */
514
+ liveness(args?: CallOptions): Promise<unknown>;
515
+ /** Readiness probe. @see GET /health/ready */
516
+ ready(args?: CallOptions): Promise<unknown>;
517
+ /** Kora gasless relayer health. @see GET /health/kora */
518
+ kora(args?: CallOptions): Promise<unknown>;
519
+ /** Mode S witness/cosigner health. @see GET /health/mode-s */
520
+ modeS(args?: CallOptions): Promise<unknown>;
521
+ }
522
+ /**
523
+ * Response shape of `POST /v1/lending-operations/redeem-allocated/build`.
524
+ *
525
+ * The OpenAPI spec types this as `any` because Elysia auto-generates schemas
526
+ * from request validators only — response shapes aren't captured in the
527
+ * exported swagger. We type it here so partners get autocomplete on the
528
+ * redeem helper. Source of truth:
529
+ * `apps/api/src/core/use-cases/build-redeem-transaction.ts:58`.
530
+ */
531
+ interface BuildRedeemResponse {
532
+ /** Base64-encoded wire transaction with the witness signature attached. */
533
+ serializedTx: string;
534
+ /** Lookup key for `/submit`. Cached for 5 minutes. */
535
+ pendingRedeemId: string;
536
+ /** Embedded fee transfers — verify before user-signing. */
537
+ expectedFeeRecipients: Array<{
538
+ address: string;
539
+ amount: string;
540
+ }>;
541
+ /** Cosigners attached at build time. Always includes 'witness'. */
542
+ cosignersAttached: Array<"witness" | "kora">;
543
+ expiresAt: string;
544
+ }
545
+ /**
546
+ * Response shape of `POST /v1/lending-operations/redeem-allocated/submit`.
547
+ * Same caveat as `BuildRedeemResponse` — typed by hand because the OpenAPI
548
+ * spec returns `any`. Source: `apps/api/src/core/use-cases/submit-signed-redeem.ts:19`.
549
+ */
550
+ interface SubmitSignedRedeemResponse {
551
+ signature: string;
552
+ confirmed: boolean;
553
+ }
554
+ /** `client.agents.*` — self-provisioning for BYOW agents (no Privy). */
555
+ interface AgentsMethods {
556
+ /**
557
+ * Mint a Vayo identity (`user` + `agent_wallet`) for a wallet the agent
558
+ * controls itself. Idempotent. Returns `{ privyDid, userId, walletAddress,
559
+ * created }` — pass the `privyDid` to subsequent Mode-S calls.
560
+ * @see POST /v1/agents/provision
561
+ */
562
+ provision(args: {
563
+ body: {
564
+ walletAddress: string;
565
+ };
566
+ } & CallOptions): Promise<ProvisionAgentResponse>;
567
+ }
568
+ interface ProvisionAgentResponse {
569
+ privyDid: string;
570
+ userId: string;
571
+ walletAddress: string;
572
+ created: boolean;
573
+ }
574
+ interface VayoPartnerClient {
575
+ lending: LendingMethods;
576
+ modeS: ModeSMethods;
577
+ wallet: WalletMethods;
578
+ positions: PositionsMethods;
579
+ webhooks: WebhooksMethods;
580
+ dashboard: DashboardMethods;
581
+ health: HealthMethods;
582
+ agents: AgentsMethods;
583
+ /** Read-only view of the SDK options the client was constructed with. */
584
+ readonly options: Readonly<VayoPartnerClientOptions>;
585
+ }
586
+ declare function createVayoPartnerClient(options: VayoPartnerClientOptions): VayoPartnerClient;
587
+
588
+ export { type BuildRedeemResponse as B, type CallOptions as C, type DashboardMethods as D, type ExpectedFeeRecipients as E, type HealthMethods as H, type LendingMethods as L, type ModeSHelper as M, type ObservedFeeRecipient as O, type PositionRewardEntry as P, type ReadPositionsResponse as R, type SignTransactionCallback as S, type UserPosition as U, type VayoPartnerClient as V, type WalletHelper as W, type BuildSupplyResponse as a, type CreateWebhookSubscriptionResponse as b, type DispatchWebhookEventResponse as c, type ListWebhookDeliveriesResponse as d, type ModeSMethods as e, type ModeSSupplyHelper as f, type PositionsMethods as g, type PrepareWithdrawalResponse as h, type RedeemModeSInput as i, type RedeemModeSResult as j, type RotateWebhookSecretResponse as k, type SubmitSignedRedeemResponse as l, type SubmitSignedSupplyResponse as m, type SubmitWithdrawalResponse as n, type SupplyModeSInput as o, type SupplyModeSResult as p, type VayoPartnerClientOptions as q, type WalletMethods as r, type WebhookDelivery as s, type WebhookSubscription as t, type WebhooksMethods as u, type WithdrawInput as v, type WithdrawResult as w, assertFeeRecipientsMatch as x, createVayoPartnerClient as y, verifyWebhookSignature as z };