@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 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/generated/clients/getHealthModeS.ts","../src/generated/clients/getV1DashboardAllowlist.ts","../src/generated/clients/getV1DashboardApiKeys.ts","../src/generated/clients/getV1DashboardConsumption.ts","../src/generated/clients/getV1DashboardInvestmentPerformance.ts","../src/generated/clients/getV1DashboardOverview.ts","../src/generated/clients/getV1DashboardPartnerFees.ts","../src/generated/clients/getV1DashboardPartnerFeesPayouts.ts","../src/generated/clients/getV1DashboardPerformanceFees.ts","../src/generated/clients/getV1DashboardTransactions.ts","../src/generated/clients/getV1DashboardUsers.ts","../src/generated/clients/getV1LendingMarkets.ts","../src/generated/clients/getV1LendingReserves.ts","../src/generated/clients/postV1LendingOperationsRedeemAllocatedBuild.ts","../src/generated/clients/postV1LendingOperationsRedeemAllocatedSubmit.ts","../src/mode-s/verify-fee-recipients.ts","../src/mode-s/redeem.ts","../src/mode-s/supply.ts","../src/wallet/withdraw.ts","../src/client.ts","../src/constants.ts","../src/webhooks/index.ts"],"names":["U64_MAX"],"mappings":";;;AAmBO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EAGvC,YAEU,UAAA,EAET,OAAA,EAES,IAAA,GAAsB,IAAA,EAEtB,gBAA+B,IAAA,EACvC;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AARJ,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAIA,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAEA,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA;AAIT,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,aAAA,CAAa,SAAS,CAAA;AAAA,EACnD;AAAA,EAXU,UAAA;AAAA,EAIA,IAAA;AAAA,EAEA,aAAA;AAAA,EAVQ,I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G,MAAA,CAAO,IAAA,CAAK,QAAQ,CAAC,CAAA;AAAA,EACpE,CAAA,CAAA,MAAQ;AACP,IAAA,OAAO,KAAA;AAAA,EACR;AACD","file":"index.js","sourcesContent":["// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Structured error thrown by the SDK on any non-2xx response. Partners can\n * `catch (err) { if (err instanceof VayoApiError) ... }` to discriminate from\n * arbitrary network/runtime failures.\n *\n * Mirrors the error envelope returned by the Vayo API's central\n * `errorHandler` middleware: `{ statusCode, message, code?, correlationId? }`.\n */\n\nexport interface VayoErrorBody {\n\tstatusCode?: number;\n\tmessage?: string;\n\tcode?: string | null;\n\tcorrelationId?: string | null;\n}\n\nexport class VayoApiError extends Error {\n\toverride readonly name = \"VayoApiError\";\n\n\tconstructor(\n\t\t/** HTTP status code from the response. */\n\t\treadonly statusCode: number,\n\t\t/** Server-provided message, or a fallback HTTP status text. */\n\t\tmessage: string,\n\t\t/** Server-provided error code (e.g. `INVALID_API_KEY`), if present. */\n\t\treadonly code: string | null = null,\n\t\t/** Server-side correlation id for grepping logs. */\n\t\treadonly correlationId: string | null = null,\n\t) {\n\t\tsuper(message);\n\t\t// Ensure `instanceof VayoApiError` works after transpilation.\n\t\tObject.setPrototypeOf(this, VayoApiError.prototype);\n\t}\n\n\t/**\n\t * Factory used by the internal HTTP wrapper. Tolerant of malformed bodies —\n\t * if the server returns HTML or empty content, we still construct a useful\n\t * error from the status alone.\n\t */\n\tstatic fromBody(\n\t\tstatusCode: number,\n\t\tstatusText: string,\n\t\tbody: VayoErrorBody | null,\n\t): VayoApiError {\n\t\t// Treat empty strings as missing — `??` only handles null/undefined.\n\t\tconst message =\n\t\t\t(body?.message && body.message.length > 0 ? body.message : null) ??\n\t\t\t(statusText && statusText.length > 0 ? statusText : null) ??\n\t\t\t`HTTP ${statusCode}`;\n\t\treturn new VayoApiError(\n\t\t\tstatusCode,\n\t\t\tmessage,\n\t\t\tbody?.code ?? null,\n\t\t\tbody?.correlationId ?? null,\n\t\t);\n\t}\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Internal fetch wrapper consumed by the kubb-generated client functions in\n * `src/generated/clients/`. The shape (`client`, `Client`, `RequestConfig`,\n * `ResponseConfig`, `ResponseErrorConfig`) is dictated by the kubb plugin —\n * generated files import these exact names.\n *\n * Adapted from `apps/web/src/shared/api/kubb-client.ts`. Differences:\n * - Parameterized over a `ClientContext` (baseUrl + apiKey + custom fetch +\n * idempotency-key generator) supplied by `createVayoPartnerClient()`.\n * The context is threaded through `RequestConfig.context`.\n * - Injects `x-api-key` instead of `Authorization: Bearer` for partner auth\n * - Auto-generates `Idempotency-Key` for mutating routes when not provided\n * - Throws a structured `VayoApiError` instead of the raw response body\n *\n * This module is NOT a public export — partners interact with the high-level\n * `createVayoPartnerClient()` from `src/client.ts`.\n */\n\nimport { VayoApiError, type VayoErrorBody } from \"./errors\";\n\nconst MUTATING_METHODS = new Set([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"]);\nconst NO_BODY_STATUSES = new Set([204, 205, 304]);\n\n/**\n * Per-request context injected by `createVayoPartnerClient()` into every\n * generated client call via `RequestConfig.context`. Holds connection\n * details, auth, and fetch overrides.\n */\nexport interface ClientContext {\n\tbaseUrl: string;\n\tapiKey: string;\n\t/** Per-call idempotency key. Auto-generated for mutating routes if absent. */\n\tidempotencyKey?: string;\n\t/** Custom fetch (e.g. for Node 18-, edge runtimes, instrumentation). */\n\tfetch?: typeof fetch;\n\t/** Override the default UUID v4 generator (useful for deterministic tests). */\n\tgenerateIdempotencyKey?: () => string;\n}\n\nexport type RequestConfig<TData = unknown> = {\n\tbaseURL?: string;\n\turl?: string;\n\tmethod?: \"GET\" | \"PUT\" | \"PATCH\" | \"POST\" | \"DELETE\" | \"OPTIONS\" | \"HEAD\";\n\tparams?: unknown;\n\tdata?: TData | FormData;\n\tresponseType?:\n\t\t| \"arraybuffer\"\n\t\t| \"blob\"\n\t\t| \"document\"\n\t\t| \"json\"\n\t\t| \"text\"\n\t\t| \"stream\";\n\tsignal?: AbortSignal;\n\theaders?: [string, string][] | Record<string, string>;\n\tcredentials?: RequestCredentials;\n\t/**\n\t * Per-call SDK context. Injected by `createVayoPartnerClient()` — not part\n\t * of the kubb-generated function signatures, partners never set this\n\t * directly.\n\t */\n\tcontext?: ClientContext;\n};\n\nexport type ResponseConfig<TData = unknown> = {\n\tdata: TData;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Headers;\n};\n\nexport type ResponseErrorConfig<TError = unknown> = TError;\n\nfunction buildUrl(baseURL: string, url?: string, params?: unknown): string {\n\tconst fullUrl = [baseURL, url].filter(Boolean).join(\"\");\n\tif (!params || typeof params !== \"object\") return fullUrl;\n\tconst searchParams = new URLSearchParams();\n\tfor (const [key, value] of Object.entries(\n\t\tparams as Record<string, unknown>,\n\t)) {\n\t\tif (value === undefined || value === null) continue;\n\t\tif (Array.isArray(value)) {\n\t\t\t// Comma-join arrays — matches the spec's `?mints=a,b,c` style.\n\t\t\tsearchParams.append(key, value.join(\",\"));\n\t\t} else {\n\t\t\tsearchParams.append(key, String(value));\n\t\t}\n\t}\n\tconst queryString = searchParams.toString();\n\treturn queryString ? `${fullUrl}?${queryString}` : fullUrl;\n}\n\nfunction normalizeHeaders(\n\theaders?: [string, string][] | Record<string, string>,\n): Record<string, string> {\n\tif (!headers) return {};\n\tif (Array.isArray(headers)) return Object.fromEntries(headers);\n\treturn { ...headers };\n}\n\nfunction defaultIdempotencyKey(): string {\n\t// Browsers and Node 19+ expose `crypto.randomUUID`. Fall back to a\n\t// pseudo-random value for older Node — partners can override via\n\t// `generateIdempotencyKey` in `createVayoPartnerClient` options.\n\tif (\n\t\ttypeof crypto !== \"undefined\" &&\n\t\ttypeof crypto.randomUUID === \"function\"\n\t) {\n\t\treturn crypto.randomUUID();\n\t}\n\treturn `idem-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;\n}\n\nexport async function client<\n\tTResponseData,\n\t_TError = unknown,\n\tTRequestData = unknown,\n>(config: RequestConfig<TRequestData>): Promise<ResponseConfig<TResponseData>> {\n\tconst ctx = config.context;\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t\"[vayo/core-sdk] internal: RequestConfig.context is missing. \" +\n\t\t\t\t\"Generated clients must be invoked through createVayoPartnerClient().\",\n\t\t);\n\t}\n\n\tconst baseURL = config.baseURL ?? ctx.baseUrl;\n\tconst url = buildUrl(baseURL, config.url, config.params);\n\tconst headers = normalizeHeaders(config.headers);\n\tconst method = (config.method ?? \"GET\").toUpperCase();\n\n\t// Always inject the partner API key.\n\theaders[\"x-api-key\"] = ctx.apiKey;\n\n\t// Idempotency-Key — required by the partner v1 mutating routes. Honor an\n\t// explicit caller-provided value (so retries can replay), otherwise auto-\n\t// generate one for mutating methods only (reads never need it).\n\tif (MUTATING_METHODS.has(method) && !headers[\"Idempotency-Key\"]) {\n\t\theaders[\"Idempotency-Key\"] =\n\t\t\tctx.idempotencyKey ??\n\t\t\t(ctx.generateIdempotencyKey ?? defaultIdempotencyKey)();\n\t}\n\n\tif (!headers[\"Content-Type\"] && !(config.data instanceof FormData)) {\n\t\theaders[\"Content-Type\"] = \"application/json\";\n\t}\n\n\tlet body: BodyInit | undefined;\n\tif (config.data instanceof FormData) {\n\t\tbody = config.data;\n\t} else if (config.data !== undefined) {\n\t\tbody = JSON.stringify(config.data);\n\t}\n\n\tconst fetchImpl = ctx.fetch ?? fetch;\n\tconst response = await fetchImpl(url, {\n\t\tmethod,\n\t\theaders,\n\t\tbody,\n\t\tsignal: config.signal,\n\t\t// Default to 'omit' (not 'include') because partners never share cookies\n\t\t// cross-origin with Vayo. The webapp uses 'include' for first-party flows\n\t\t// — partners use header auth.\n\t\tcredentials: config.credentials ?? \"omit\",\n\t});\n\n\tlet data: unknown;\n\tif (NO_BODY_STATUSES.has(response.status)) {\n\t\tdata = {};\n\t} else {\n\t\tdata = await response.json().catch(() => ({}));\n\t}\n\n\tif (!response.ok) {\n\t\tthrow VayoApiError.fromBody(\n\t\t\tresponse.status,\n\t\t\tresponse.statusText,\n\t\t\tdata as VayoErrorBody | null,\n\t\t);\n\t}\n\n\treturn {\n\t\tdata: data as TResponseData,\n\t\tstatus: response.status,\n\t\tstatusText: response.statusText,\n\t\theaders: response.headers,\n\t};\n}\n\nexport type Client = typeof client;\n\nexport default client;\n","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetHealthModeSQueryResponse } from \"../types/GetHealthModeS.ts\";\n\nfunction getGetHealthModeSUrl() {\n const res = { method: 'GET', url: `/health/mode-s` as const }\n return res\n}\n\n/**\n * {@link /health/mode-s}\n */\nexport async function getHealthModeS(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetHealthModeSQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetHealthModeSUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardAllowlistQueryResponse } from \"../types/GetV1DashboardAllowlist.ts\";\n\nfunction getGetV1DashboardAllowlistUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/allowlist` as const }\n return res\n}\n\n/**\n * @summary Read-only view of the partner's effective market/reserve allowlist\n * {@link /v1/dashboard/allowlist}\n */\nexport async function getV1DashboardAllowlist(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardAllowlistQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardAllowlistUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardApiKeysQueryResponse } from \"../types/GetV1DashboardApiKeys.ts\";\n\nfunction getGetV1DashboardApiKeysUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/api-keys` as const }\n return res\n}\n\n/**\n * @summary Partner's own API keys (prefix + metadata only, never plaintext)\n * {@link /v1/dashboard/api-keys}\n */\nexport async function getV1DashboardApiKeys(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardApiKeysQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardApiKeysUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardConsumptionQueryResponse } from \"../types/GetV1DashboardConsumption.ts\";\n\nfunction getGetV1DashboardConsumptionUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/consumption` as const }\n return res\n}\n\n/**\n * @summary API consumption metrics (requests 24h/7d/30d, rate limit config, recent logs)\n * {@link /v1/dashboard/consumption}\n */\nexport async function getV1DashboardConsumption(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardConsumptionQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardConsumptionUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardInvestmentPerformanceQueryResponse } from \"../types/GetV1DashboardInvestmentPerformance.ts\";\n\nfunction getGetV1DashboardInvestmentPerformanceUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/investment-performance` as const }\n return res\n}\n\n/**\n * @summary Aggregated investment performance — total yield, volume, user count across windows (NOT performance fees)\n * {@link /v1/dashboard/investment-performance}\n */\nexport async function getV1DashboardInvestmentPerformance(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardInvestmentPerformanceQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardInvestmentPerformanceUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardOverviewQueryResponse } from \"../types/GetV1DashboardOverview.ts\";\n\nfunction getGetV1DashboardOverviewUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/overview` as const }\n return res\n}\n\n/**\n * @summary Partner dashboard home — users, volume, fees, consumption at a glance\n * {@link /v1/dashboard/overview}\n */\nexport async function getV1DashboardOverview(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardOverviewQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardOverviewUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardPartnerFeesQueryResponse } from \"../types/GetV1DashboardPartnerFees.ts\";\n\nfunction getGetV1DashboardPartnerFeesUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/partner-fees` as const }\n return res\n}\n\n/**\n * @summary Partner's earned fee share (NOT investment performance) — current model, bps, totals across windows\n * {@link /v1/dashboard/partner-fees}\n */\nexport async function getV1DashboardPartnerFees(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardPartnerFeesQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardPartnerFeesUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardPartnerFeesPayoutsQueryResponse, GetV1DashboardPartnerFeesPayoutsQueryParams } from \"../types/GetV1DashboardPartnerFeesPayouts.ts\";\n\nfunction getGetV1DashboardPartnerFeesPayoutsUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/partner-fees/payouts` as const }\n return res\n}\n\n/**\n * @summary Paginated partner fee payout history (row-level detail)\n * {@link /v1/dashboard/partner-fees/payouts}\n */\nexport async function getV1DashboardPartnerFeesPayouts(params?: GetV1DashboardPartnerFeesPayoutsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardPartnerFeesPayoutsQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardPartnerFeesPayoutsUrl().url.toString(), params, ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardPerformanceFeesQueryResponse } from \"../types/GetV1DashboardPerformanceFees.ts\";\n\nfunction getGetV1DashboardPerformanceFeesUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/performance-fees` as const }\n return res\n}\n\n/**\n * @summary Legacy alias of /partner-fees — performance fees collected from the partner's users\n * {@link /v1/dashboard/performance-fees}\n */\nexport async function getV1DashboardPerformanceFees(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardPerformanceFeesQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardPerformanceFeesUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardTransactionsQueryResponse, GetV1DashboardTransactionsQueryParams } from \"../types/GetV1DashboardTransactions.ts\";\n\nfunction getGetV1DashboardTransactionsUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/transactions` as const }\n return res\n}\n\n/**\n * @summary Paginated transactions across the partner's user base (filter by type/status)\n * {@link /v1/dashboard/transactions}\n */\nexport async function getV1DashboardTransactions(params?: GetV1DashboardTransactionsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardTransactionsQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardTransactionsUrl().url.toString(), params, ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1DashboardUsersQueryResponse, GetV1DashboardUsersQueryParams } from \"../types/GetV1DashboardUsers.ts\";\n\nfunction getGetV1DashboardUsersUrl() {\n const res = { method: 'GET', url: `/v1/dashboard/users` as const }\n return res\n}\n\n/**\n * @summary Paginated list of the partner's users\n * {@link /v1/dashboard/users}\n */\nexport async function getV1DashboardUsers(params?: GetV1DashboardUsersQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1DashboardUsersQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1DashboardUsersUrl().url.toString(), params, ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1LendingMarketsQueryResponse } from \"../types/GetV1LendingMarkets.ts\";\n\nfunction getGetV1LendingMarketsUrl() {\n const res = { method: 'GET', url: `/v1/lending/markets` as const }\n return res\n}\n\n/**\n * @summary List lending markets — filtered by the partner's allowlist (intersection with global)\n * {@link /v1/lending/markets}\n */\nexport async function getV1LendingMarkets(config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1LendingMarketsQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1LendingMarketsUrl().url.toString(), ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { GetV1LendingReservesQueryResponse, GetV1LendingReservesQueryParams } from \"../types/GetV1LendingReserves.ts\";\n\nfunction getGetV1LendingReservesUrl() {\n const res = { method: 'GET', url: `/v1/lending/reserves` as const }\n return res\n}\n\n/**\n * @summary Flat list of reserves across markets — filtered by partner allowlist\n * {@link /v1/lending/reserves}\n */\nexport async function getV1LendingReserves(params?: GetV1LendingReservesQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n\n\n const res = await request<GetV1LendingReservesQueryResponse, ResponseErrorConfig<Error>, unknown>({ method : \"GET\", url : getGetV1LendingReservesUrl().url.toString(), params, ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { PostV1LendingOperationsRedeemAllocatedBuildMutationRequest, PostV1LendingOperationsRedeemAllocatedBuildMutationResponse, PostV1LendingOperationsRedeemAllocatedBuildQueryParams } from \"../types/PostV1LendingOperationsRedeemAllocatedBuild.ts\";\n\nfunction getPostV1LendingOperationsRedeemAllocatedBuildUrl() {\n const res = { method: 'POST', url: `/v1/lending-operations/redeem-allocated/build` as const }\n return res\n}\n\n/**\n * @description Builds a Kamino redeem transaction with the witness cosignature attached. The partner deserializes, adds the user wallet authority signature via their own Privy SDK, and submits via /submit (or directly to their own RPC).\n * @summary Mode S — build a partially-signed redeem tx\n * {@link /v1/lending-operations/redeem-allocated/build}\n */\nexport async function postV1LendingOperationsRedeemAllocatedBuild(data: PostV1LendingOperationsRedeemAllocatedBuildMutationRequest, params?: PostV1LendingOperationsRedeemAllocatedBuildQueryParams, config: Partial<RequestConfig<PostV1LendingOperationsRedeemAllocatedBuildMutationRequest>> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n const requestData = data\n\n const res = await request<PostV1LendingOperationsRedeemAllocatedBuildMutationResponse, ResponseErrorConfig<Error>, PostV1LendingOperationsRedeemAllocatedBuildMutationRequest>({ method : \"POST\", url : getPostV1LendingOperationsRedeemAllocatedBuildUrl().url.toString(), params, data : requestData, ... requestConfig })\n return res.data\n}","/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/\n\nimport fetch from \"../../http\";\nimport type { Client, RequestConfig, ResponseErrorConfig } from \"../../http\";\nimport type { PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest, PostV1LendingOperationsRedeemAllocatedSubmitMutationResponse } from \"../types/PostV1LendingOperationsRedeemAllocatedSubmit.ts\";\n\nfunction getPostV1LendingOperationsRedeemAllocatedSubmitUrl() {\n const res = { method: 'POST', url: `/v1/lending-operations/redeem-allocated/submit` as const }\n return res\n}\n\n/**\n * @description Verifies the witness/Kora cosignatures are still intact (Defense 2b — message hash re-verification) and submits to RPC. Optional: partners may submit directly to their own RPC instead and skip this endpoint entirely. The cryptographic anti-bypass guarantee holds either way.\n * @summary Mode S — submit a fully-signed redeem tx (optional)\n * {@link /v1/lending-operations/redeem-allocated/submit}\n */\nexport async function postV1LendingOperationsRedeemAllocatedSubmit(data: PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest, config: Partial<RequestConfig<PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest>> & { client?: Client } = {}) {\n const { client: request = fetch, ...requestConfig } = config\n\n const requestData = data\n\n const res = await request<PostV1LendingOperationsRedeemAllocatedSubmitMutationResponse, ResponseErrorConfig<Error>, PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest>({ method : \"POST\", url : getPostV1LendingOperationsRedeemAllocatedSubmitUrl().url.toString(), data : requestData, ... requestConfig })\n return res.data\n}","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Defense-3 mirror — local verification of the fee recipients embedded in\n * the partially-signed transaction returned by `/build`.\n *\n * Catches the (unlikely) case where Vayo's fee math drifted vs. what the\n * partner is expecting in their dashboard, before the partner wastes a\n * Privy/HSM signing call. The cryptographic safety net (witness signature\n * binding the message hash) is still the load-bearing check — this is just\n * a fast-fail surface that gives partners a clear error message.\n */\n\nexport interface ExpectedFeeRecipients {\n\t/** Partner's payout wallet (USDC ATA owner). */\n\tpartnerPayoutAddress: string;\n\t/** Vayo's treasury wallet. */\n\tvayoTreasuryAddress: string;\n}\n\nexport interface ObservedFeeRecipient {\n\taddress: string;\n\tamount: string;\n}\n\n/**\n * Asserts that both the partner payout address AND Vayo treasury address\n * appear among the fee transfers Vayo embedded. Throws a `RangeError` with\n * a clear message listing the missing addresses if either is absent.\n */\nexport function assertFeeRecipientsMatch(\n\tobserved: readonly ObservedFeeRecipient[],\n\texpected: ExpectedFeeRecipients,\n): void {\n\tconst observedAddresses = new Set(observed.map((r) => r.address));\n\tconst missing: string[] = [];\n\tif (!observedAddresses.has(expected.partnerPayoutAddress)) {\n\t\tmissing.push(`partner payout (${expected.partnerPayoutAddress})`);\n\t}\n\tif (!observedAddresses.has(expected.vayoTreasuryAddress)) {\n\t\tmissing.push(`Vayo treasury (${expected.vayoTreasuryAddress})`);\n\t}\n\tif (missing.length > 0) {\n\t\tthrow new RangeError(\n\t\t\t`[vayo/core-sdk] /build response is missing expected fee recipients: ${missing.join(\n\t\t\t\t\", \",\n\t\t\t)}. Refusing to sign — contact partners@vayo.finance.`,\n\t\t);\n\t}\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Layer 2 — `client.modeS.redeem()` — opinionated Mode S orchestrator.\n *\n * Runs the full build → verify → sign → submit flow that every Mode S\n * partner needs. Built so the only piece partners must implement themselves\n * is the `signTransaction` callback (typically backed by `@privy-io/node`,\n * Squads, an HSM, or any other Solana signer).\n *\n * Sequence:\n * 1. POST /v1/lending-operations/redeem-allocated/build\n * 2. (Optional) Verify embedded fee recipients match the partner's expectation\n * 3. Invoke `signTransaction` with the partially-signed wire bytes (base64)\n * 4. POST /v1/lending-operations/redeem-allocated/submit\n * 5. (Optional) On /submit failure, fall back to broadcasting via the\n * partner's own RPC URL — the witness signature is still load-bearing\n * so the cryptographic guarantee holds either way.\n *\n * The orchestrator is intentionally callback-driven (not coupled to a\n * specific signer) so the same code path works for Privy users, Squads\n * users, partners with custom HSMs, and future signers.\n */\n\nimport type { CallOptions } from \"../client\";\nimport {\n\tassertFeeRecipientsMatch,\n\ttype ExpectedFeeRecipients,\n} from \"./verify-fee-recipients\";\n\n/**\n * The signing callback partners provide. Receives the base64-encoded\n * partially-signed transaction (with Vayo's witness signature already\n * attached) and must return the base64-encoded fully-signed transaction\n * with the user-wallet authority signature added.\n *\n * Implementations typically:\n * 1. Decode the base64 → wire bytes\n * 2. Hand to a signer SDK (Privy, Squads, etc.)\n * 3. Re-encode the resulting fully-signed transaction → base64\n *\n * For Privy users, see `@vayolabs/core-sdk/mode-s/privy` which exports a\n * pre-built `createPrivySigner()` adapter.\n */\nexport type SignTransactionCallback = (\n\tserializedTxBase64: string,\n) => Promise<string>;\n\n/** Lazily-loaded fetch — for the optional direct-RPC fallback. */\ntype FetchLike = typeof fetch;\n\nexport interface RedeemModeSInput {\n\t/** Privy DID of the user (in the partner's Privy app). */\n\tprivyDid: string;\n\t/** Single market — multi-market not supported in MVP because each redeem is its own tx. */\n\tmarketAddress: string;\n\t/** Token mint (e.g. USDC). */\n\ttokenMint: string;\n\t/**\n\t * Token base units. Pass `U64_MAX` (from `@vayolabs/core-sdk`) for a full\n\t * redeem. Defaults to `U64_MAX` if omitted.\n\t */\n\tamount?: string;\n\t/** Optional reserve override (for markets with multiple reserves of the same mint). */\n\treserveAddress?: string;\n\n\t/** Partner-supplied signer. See `SignTransactionCallback` for the contract. */\n\tsignTransaction: SignTransactionCallback;\n\n\t/**\n\t * Optional Defense-3 mirror. When provided, the orchestrator verifies the\n\t * embedded fee transfers match these addresses BEFORE invoking\n\t * `signTransaction`. Strongly recommended.\n\t */\n\texpectedFeeRecipients?: ExpectedFeeRecipients;\n\n\t/**\n\t * Optional fallback. When `/submit` fails (e.g. Vayo transient error), the\n\t * orchestrator broadcasts the signed tx directly to this RPC URL via\n\t * `sendTransaction`. The reconciliation CRON later picks up the on-chain\n\t * signature and writes the partner_fee_payouts row.\n\t */\n\tfallbackRpcUrl?: string;\n\n\t/** Caller-provided idempotency key. Reused across both /build and /submit. */\n\tidempotencyKey?: string;\n\n\t/** AbortSignal — propagated to both /build and /submit. */\n\tsignal?: AbortSignal;\n}\n\nexport interface RedeemModeSResult {\n\t/** Confirmed (or freshly-submitted) transaction signature. */\n\tsignature: string;\n\t/** The cached pendingRedeemId from /build (useful for log correlation). */\n\tpendingRedeemId: string;\n\t/** The fee recipients that were embedded by Vayo and signed off-chain. */\n\texpectedFeeRecipients: ReadonlyArray<{ address: string; amount: string }>;\n\t/** Cosigners that were attached at build time. */\n\tcosignersAttached: ReadonlyArray<\"witness\" | \"kora\">;\n\t/** True when the result came from the direct-RPC fallback path. */\n\tviaFallbackRpc: boolean;\n}\n\n/**\n * The shape of the build/submit functions the orchestrator depends on.\n * Defining it as an interface (not just `typeof client.modeS.buildRedeem`)\n * keeps the orchestrator unit-testable with mocked dependencies.\n */\nexport interface ModeSDependencies {\n\tbuildRedeem(args: {\n\t\tbody: {\n\t\t\tprivyDid: string;\n\t\t\tmarketAddress: string;\n\t\t\ttokenMint: string;\n\t\t\tamount: string;\n\t\t\treserveAddress?: string;\n\t\t};\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<{\n\t\tserializedTx: string;\n\t\tpendingRedeemId: string;\n\t\texpectedFeeRecipients: Array<{ address: string; amount: string }>;\n\t\tcosignersAttached: Array<\"witness\" | \"kora\">;\n\t\texpiresAt: string;\n\t}>;\n\tsubmitSignedRedeem(args: {\n\t\tbody: { pendingRedeemId: string; serializedTx: string };\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<{ signature: string; confirmed: boolean }>;\n}\n\nexport interface ModeSHelper {\n\t/** Run the full Mode S redeem flow. See `RedeemModeSInput` for options. */\n\tredeem(\n\t\tinput: RedeemModeSInput,\n\t\topts?: CallOptions,\n\t): Promise<RedeemModeSResult>;\n}\n\nconst U64_MAX = \"18446744073709551615\";\n\n/**\n * Internal factory used by `createVayoPartnerClient()`. Partners shouldn't\n * call this directly — they get a pre-wired `client.modeS.redeem` from the\n * top-level client.\n */\nexport function createModeSHelper(deps: ModeSDependencies): ModeSHelper {\n\treturn {\n\t\tasync redeem(input) {\n\t\t\t// Step 1 — POST /build\n\t\t\tconst built = await deps.buildRedeem({\n\t\t\t\tbody: {\n\t\t\t\t\tprivyDid: input.privyDid,\n\t\t\t\t\tmarketAddress: input.marketAddress,\n\t\t\t\t\ttokenMint: input.tokenMint,\n\t\t\t\t\tamount: input.amount ?? U64_MAX,\n\t\t\t\t\treserveAddress: input.reserveAddress,\n\t\t\t\t},\n\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\tsignal: input.signal,\n\t\t\t});\n\n\t\t\t// Step 2 — Defense-3 mirror (optional)\n\t\t\tif (input.expectedFeeRecipients) {\n\t\t\t\tassertFeeRecipientsMatch(\n\t\t\t\t\tbuilt.expectedFeeRecipients,\n\t\t\t\t\tinput.expectedFeeRecipients,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Step 3 — partner-supplied signing callback\n\t\t\tconst signedTx = await input.signTransaction(built.serializedTx);\n\t\t\tif (typeof signedTx !== \"string\" || signedTx.length === 0) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\"[vayo/core-sdk] signTransaction must return a non-empty base64 string\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Step 4 — POST /submit\n\t\t\ttry {\n\t\t\t\tconst submitted = await deps.submitSignedRedeem({\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tpendingRedeemId: built.pendingRedeemId,\n\t\t\t\t\t\tserializedTx: signedTx,\n\t\t\t\t\t},\n\t\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\t\tsignal: input.signal,\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tsignature: submitted.signature,\n\t\t\t\t\tpendingRedeemId: built.pendingRedeemId,\n\t\t\t\t\texpectedFeeRecipients: built.expectedFeeRecipients,\n\t\t\t\t\tcosignersAttached: built.cosignersAttached,\n\t\t\t\t\tviaFallbackRpc: false,\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\t// Step 5 — fallback to direct RPC if configured. The witness signature\n\t\t\t\t// is still binding so the on-chain transfers are safe; the only thing\n\t\t\t\t// we lose by skipping /submit is the fail-fast 2b verification.\n\t\t\t\tif (!input.fallbackRpcUrl) throw err;\n\t\t\t\tconst signature = await broadcastViaRpc(\n\t\t\t\t\tinput.fallbackRpcUrl,\n\t\t\t\t\tsignedTx,\n\t\t\t\t\tinput.signal,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tsignature,\n\t\t\t\t\tpendingRedeemId: built.pendingRedeemId,\n\t\t\t\t\texpectedFeeRecipients: built.expectedFeeRecipients,\n\t\t\t\t\tcosignersAttached: built.cosignersAttached,\n\t\t\t\t\tviaFallbackRpc: true,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Bare-bones Solana JSON-RPC `sendTransaction` call. We deliberately do NOT\n * import `@solana/kit` here — that would force the dependency on every Mode S\n * partner. The fallback path is rarely hit and uses the JSON-RPC wire format\n * directly so it works in any runtime with `fetch`.\n */\nasync function broadcastViaRpc(\n\trpcUrl: string,\n\tserializedTxBase64: string,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tconst fetchImpl: FetchLike = fetch;\n\tconst res = await fetchImpl(rpcUrl, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tbody: JSON.stringify({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tid: 1,\n\t\t\tmethod: \"sendTransaction\",\n\t\t\tparams: [\n\t\t\t\tserializedTxBase64,\n\t\t\t\t{ encoding: \"base64\", skipPreflight: false },\n\t\t\t],\n\t\t}),\n\t\tsignal,\n\t});\n\tif (!res.ok) {\n\t\tthrow new Error(\n\t\t\t`[vayo/core-sdk] direct RPC fallback failed: ${res.status} ${res.statusText}`,\n\t\t);\n\t}\n\tconst body = (await res.json()) as {\n\t\tresult?: string;\n\t\terror?: { code: number; message: string };\n\t};\n\tif (body.error) {\n\t\tthrow new Error(\n\t\t\t`[vayo/core-sdk] direct RPC sendTransaction error: ${body.error.message}`,\n\t\t);\n\t}\n\tif (!body.result) {\n\t\tthrow new Error(\"[vayo/core-sdk] direct RPC returned empty result\");\n\t}\n\treturn body.result;\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Layer 2 — `client.modeS.supply()` — Mode S supply orchestrator.\n *\n * Mirrors the Mode S redeem flow for supplies:\n * 1. POST /v1/lending-operations/supply-allocated/build\n * 2. Invoke partner's `signTransaction` with the partially-signed tx\n * 3. POST /v1/lending-operations/supply-allocated/submit\n */\n\nimport type { CallOptions } from \"../client\";\nimport type { SignTransactionCallback } from \"./redeem\";\n\nexport interface BuildSupplyResponse {\n\tserializedTx: string;\n\tpendingSupplyId: string;\n\tcosignersAttached: Array<\"witness\" | \"kora\">;\n\texpiresAt: string;\n}\n\nexport interface SubmitSignedSupplyResponse {\n\tsignature: string;\n\tconfirmed: boolean;\n}\n\nexport interface SupplyModeSInput {\n\tprivyDid: string;\n\tmarketAddress: string;\n\ttokenMint: string;\n\tamount: string;\n\treserveAddress?: string;\n\tsignTransaction: SignTransactionCallback;\n\tidempotencyKey?: string;\n\tsignal?: AbortSignal;\n}\n\nexport interface SupplyModeSResult {\n\tsignature: string;\n\tpendingSupplyId: string;\n\tcosignersAttached: ReadonlyArray<\"witness\" | \"kora\">;\n}\n\nexport interface ModeSSupplyDependencies {\n\tbuildSupply(args: {\n\t\tbody: {\n\t\t\tprivyDid: string;\n\t\t\tmarketAddress: string;\n\t\t\ttokenMint: string;\n\t\t\tamount: string;\n\t\t\treserveAddress?: string;\n\t\t};\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<BuildSupplyResponse>;\n\tsubmitSignedSupply(args: {\n\t\tbody: { pendingSupplyId: string; serializedTx: string };\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<SubmitSignedSupplyResponse>;\n}\n\nexport interface ModeSSupplyHelper {\n\tsupply(\n\t\tinput: SupplyModeSInput,\n\t\topts?: CallOptions,\n\t): Promise<SupplyModeSResult>;\n}\n\nexport function createModeSSupplyHelper(\n\tdeps: ModeSSupplyDependencies,\n): ModeSSupplyHelper {\n\treturn {\n\t\tasync supply(input) {\n\t\t\tconst built = await deps.buildSupply({\n\t\t\t\tbody: {\n\t\t\t\t\tprivyDid: input.privyDid,\n\t\t\t\t\tmarketAddress: input.marketAddress,\n\t\t\t\t\ttokenMint: input.tokenMint,\n\t\t\t\t\tamount: input.amount,\n\t\t\t\t\treserveAddress: input.reserveAddress,\n\t\t\t\t},\n\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\tsignal: input.signal,\n\t\t\t});\n\n\t\t\tconst signedTx = await input.signTransaction(built.serializedTx);\n\t\t\tif (typeof signedTx !== \"string\" || signedTx.length === 0) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\"[vayo/core-sdk] signTransaction must return a non-empty base64 string\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst submitted = await deps.submitSignedSupply({\n\t\t\t\tbody: {\n\t\t\t\t\tpendingSupplyId: built.pendingSupplyId,\n\t\t\t\t\tserializedTx: signedTx,\n\t\t\t\t},\n\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\tsignal: input.signal,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tsignature: submitted.signature,\n\t\t\t\tpendingSupplyId: built.pendingSupplyId,\n\t\t\t\tcosignersAttached: built.cosignersAttached,\n\t\t\t};\n\t\t},\n\t};\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: BUSL-1.1\n\n/**\n * Layer 2 — `client.wallet.withdraw()` — async memo-challenge orchestrator.\n *\n * Withdrawals are gated by the user's embedded-wallet 2FA memo. The\n * orchestrator runs:\n * 1. POST /v1/wallet/withdraw/prepare\n * 2. Invoke partner's `signTransaction` with the unsigned memo skeleton\n * 3. POST /v1/wallet/withdraw/submit\n *\n * Vayo never broadcasts the signed memo — it's a proof-of-possession only.\n * The actual USDC transfer is broadcast by Vayo after verifying the memo.\n */\n\nimport type { CallOptions } from \"../client\";\nimport type { SignTransactionCallback } from \"../mode-s/redeem\";\n\nexport interface PrepareWithdrawalResponse {\n\tpendingWithdrawalId: string;\n\tmemoChallenge: string;\n\tserializedMemoTransaction: string;\n\tuserWalletAddress: string;\n\texpiresAt: string;\n}\n\nexport interface SubmitWithdrawalResponse {\n\tsignature: string;\n\ttransactionId: string;\n}\n\nexport interface WithdrawInput {\n\tprivyDid: string;\n\tdestinationAddress: string;\n\tamount: string;\n\texactRecipientAmount?: boolean;\n\tsignTransaction: SignTransactionCallback;\n\tidempotencyKey?: string;\n\tsignal?: AbortSignal;\n}\n\nexport interface WithdrawResult {\n\tsignature: string;\n\ttransactionId: string;\n\tpendingWithdrawalId: string;\n\tmemoChallenge: string;\n}\n\nexport interface WalletDependencies {\n\tprepareWithdrawal(args: {\n\t\tbody: {\n\t\t\tprivyDid: string;\n\t\t\tdestinationAddress: string;\n\t\t\tamount: string;\n\t\t\texactRecipientAmount?: boolean;\n\t\t};\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<PrepareWithdrawalResponse>;\n\tsubmitWithdrawal(args: {\n\t\tbody: { pendingWithdrawalId: string; signedIntentTransaction: string };\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t}): Promise<SubmitWithdrawalResponse>;\n}\n\nexport interface WalletHelper {\n\twithdraw(input: WithdrawInput, opts?: CallOptions): Promise<WithdrawResult>;\n}\n\nexport function createWalletHelper(deps: WalletDependencies): WalletHelper {\n\treturn {\n\t\tasync withdraw(input) {\n\t\t\tconst prepared = await deps.prepareWithdrawal({\n\t\t\t\tbody: {\n\t\t\t\t\tprivyDid: input.privyDid,\n\t\t\t\t\tdestinationAddress: input.destinationAddress,\n\t\t\t\t\tamount: input.amount,\n\t\t\t\t\texactRecipientAmount: input.exactRecipientAmount,\n\t\t\t\t},\n\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\tsignal: input.signal,\n\t\t\t});\n\n\t\t\tconst signedMemoTx = await input.signTransaction(\n\t\t\t\tprepared.serializedMemoTransaction,\n\t\t\t);\n\t\t\tif (typeof signedMemoTx !== \"string\" || signedMemoTx.length === 0) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\"[vayo/core-sdk] signTransaction must return a non-empty base64 string\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst submitted = await deps.submitWithdrawal({\n\t\t\t\tbody: {\n\t\t\t\t\tpendingWithdrawalId: prepared.pendingWithdrawalId,\n\t\t\t\t\tsignedIntentTransaction: signedMemoTx,\n\t\t\t\t},\n\t\t\t\tidempotencyKey: input.idempotencyKey,\n\t\t\t\tsignal: input.signal,\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tsignature: submitted.signature,\n\t\t\t\ttransactionId: submitted.transactionId,\n\t\t\t\tpendingWithdrawalId: prepared.pendingWithdrawalId,\n\t\t\t\tmemoChallenge: prepared.memoChallenge,\n\t\t\t};\n\t\t},\n\t};\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Layer 1 — `createVayoPartnerClient()` — the ergonomic typed client.\n *\n * Wraps the kubb-generated raw client functions in a tag-grouped object so\n * partners get autocomplete that mirrors the OpenAPI tags\n * (`client.lending.markets()`, `client.modeS.buildRedeem()`, etc.). Auth,\n * idempotency-key generation, and structured errors are handled inside the\n * shared `http.ts` wrapper — this file is just plumbing.\n *\n * All partner endpoints authenticate with the `x-api-key` header alone; there\n * are no JWT-guarded routes in the current surface.\n *\n * Per-call options:\n * - `idempotencyKey` — caller-provided idempotency key. Required for safe\n * retries on mutating routes; auto-generated if absent.\n * - `signal` — AbortSignal to cancel in-flight requests.\n */\n\nimport type {\n\tGetV1DashboardPartnerFeesPayoutsQueryParams,\n\tGetV1DashboardTransactionsQueryParams,\n\tGetV1DashboardUsersQueryParams,\n\tGetV1LendingReservesQueryParams,\n\tPostV1LendingOperationsRedeemAllocatedBuildMutationRequest,\n\tPostV1LendingOperationsRedeemAllocatedBuildQueryParams,\n\tPostV1LendingOperationsRedeemAllocatedSubmitMutationRequest,\n} from \"./generated\";\n\nimport {\n\tgetHealthModeS,\n\tgetV1DashboardAllowlist,\n\tgetV1DashboardApiKeys,\n\tgetV1DashboardConsumption,\n\tgetV1DashboardInvestmentPerformance,\n\tgetV1DashboardOverview,\n\tgetV1DashboardPartnerFees,\n\tgetV1DashboardPartnerFeesPayouts,\n\tgetV1DashboardPerformanceFees,\n\tgetV1DashboardTransactions,\n\tgetV1DashboardUsers,\n\tgetV1LendingMarkets,\n\tgetV1LendingReserves,\n\tpostV1LendingOperationsRedeemAllocatedBuild,\n\tpostV1LendingOperationsRedeemAllocatedSubmit,\n} from \"./generated\";\nimport type { ClientContext, RequestConfig } from \"./http\";\nimport { client as rawHttpClient } from \"./http\";\nimport { createModeSHelper, type ModeSHelper } from \"./mode-s/redeem\";\nimport {\n\ttype BuildSupplyResponse,\n\tcreateModeSSupplyHelper,\n\ttype ModeSSupplyHelper,\n\ttype SubmitSignedSupplyResponse,\n} from \"./mode-s/supply\";\nimport type { ReadPositionsResponse } from \"./positions/read\";\nimport {\n\tcreateWalletHelper,\n\ttype PrepareWithdrawalResponse,\n\ttype SubmitWithdrawalResponse,\n\ttype WalletHelper,\n} from \"./wallet/withdraw\";\nimport type {\n\tCreateWebhookSubscriptionResponse,\n\tDispatchWebhookEventResponse,\n\tListWebhookDeliveriesResponse,\n\tRotateWebhookSecretResponse,\n\tWebhookSubscription,\n} from \"./webhooks\";\n\n// ─── Public options ────────────────────────────────────────────────────\n\nexport interface VayoPartnerClientOptions {\n\t/** Vayo API base URL — e.g. `https://api.vayo.finance`. No trailing slash. */\n\tbaseUrl: string;\n\t/** Partner API key issued via `POST /admin/partners/:id/api-keys`. */\n\tapiKey: string;\n\t/** Optional fetch override (Node 18-, edge runtimes, instrumentation). */\n\tfetch?: typeof fetch;\n\t/** Optional idempotency-key generator override (default: `crypto.randomUUID`). */\n\tgenerateIdempotencyKey?: () => string;\n}\n\n/** Common per-call options threaded through every method. */\nexport interface CallOptions {\n\t/** AbortSignal to cancel the request. */\n\tsignal?: AbortSignal;\n\t/** Caller-provided idempotency key (mutating routes). Auto-generated if absent. */\n\tidempotencyKey?: string;\n}\n\n// ─── Helpers ───────────────────────────────────────────────────────────\n\nfunction buildRequestConfig<TData = unknown>(\n\tctxBase: Omit<ClientContext, \"idempotencyKey\">,\n\topts: { idempotencyKey?: string; signal?: AbortSignal },\n): Partial<RequestConfig<TData>> {\n\treturn {\n\t\tsignal: opts.signal,\n\t\tcontext: {\n\t\t\t...ctxBase,\n\t\t\tidempotencyKey: opts.idempotencyKey,\n\t\t},\n\t};\n}\n\n// ─── Method groups ─────────────────────────────────────────────────────\n\n/** `client.lending.*` — read-only market/reserve data. */\nexport interface LendingMethods {\n\t/** List markets allowed by the partner's allowlist. @see GET /v1/lending/markets */\n\tmarkets(args?: CallOptions): Promise<unknown>;\n\t/** Flat reserves across markets, optionally filtered by mints. @see GET /v1/lending/reserves */\n\treserves(\n\t\targs?: { mints?: string[] | string } & CallOptions,\n\t): Promise<unknown>;\n}\n\n/** `client.modeS.*` — build/submit + opinionated `redeem()` and `supply()` orchestrators. */\nexport interface ModeSMethods extends ModeSHelper, ModeSSupplyHelper {\n\t/**\n\t * Build a partially-signed redeem tx with the witness cosignature.\n\t * @see POST /v1/lending-operations/redeem-allocated/build\n\t */\n\tbuildRedeem(\n\t\targs: {\n\t\t\tbody: PostV1LendingOperationsRedeemAllocatedBuildMutationRequest;\n\t\t\tquery?: PostV1LendingOperationsRedeemAllocatedBuildQueryParams;\n\t\t} & CallOptions,\n\t): Promise<BuildRedeemResponse>;\n\t/**\n\t * Submit a fully-signed redeem tx (Vayo re-verifies cosigners + relays).\n\t * @see POST /v1/lending-operations/redeem-allocated/submit\n\t */\n\tsubmitSignedRedeem(\n\t\targs: {\n\t\t\tbody: PostV1LendingOperationsRedeemAllocatedSubmitMutationRequest;\n\t\t} & CallOptions,\n\t): Promise<SubmitSignedRedeemResponse>;\n\t/**\n\t * Build a partially-signed supply tx with the witness cosignature.\n\t * @see POST /v1/lending-operations/supply-allocated/build\n\t */\n\tbuildSupply(\n\t\targs: {\n\t\t\tbody: {\n\t\t\t\tprivyDid: string;\n\t\t\t\tmarketAddress: string;\n\t\t\t\ttokenMint: string;\n\t\t\t\tamount: string;\n\t\t\t\treserveAddress?: string;\n\t\t\t};\n\t\t\tquery?: { gasless?: \"true\" | \"false\" };\n\t\t} & CallOptions,\n\t): Promise<BuildSupplyResponse>;\n\t/**\n\t * Submit a fully-signed supply tx (Vayo re-verifies cosigners + relays).\n\t * @see POST /v1/lending-operations/supply-allocated/submit\n\t */\n\tsubmitSignedSupply(\n\t\targs: {\n\t\t\tbody: { pendingSupplyId: string; serializedTx: string };\n\t\t} & CallOptions,\n\t): Promise<SubmitSignedSupplyResponse>;\n\t/**\n\t * Confirm a redeem the partner submitted on-chain via their own RPC/signer.\n\t * Vayo fetches the tx by signature, verifies the witness memo\n\t * `vayo-witness:<pendingRedeemId>` is present, and marks the pending row\n\t * confirmed.\n\t * @see POST /v1/lending-operations/redeem-allocated/confirm\n\t */\n\tconfirmRedeem(\n\t\targs: {\n\t\t\tbody: {\n\t\t\t\tpendingRedeemId: string;\n\t\t\t\tsignature: string;\n\t\t\t\tmarketAddress: string;\n\t\t\t\tstatus?: \"confirmed\" | \"failed\";\n\t\t\t\terrorMessage?: string;\n\t\t\t};\n\t\t} & CallOptions,\n\t): Promise<ConfirmModeSResponse>;\n\t/**\n\t * Confirm a supply the partner submitted on-chain via their own RPC/signer.\n\t * @see POST /v1/lending-operations/supply-allocated/confirm\n\t */\n\tconfirmSupply(\n\t\targs: {\n\t\t\tbody: {\n\t\t\t\tpendingSupplyId: string;\n\t\t\t\tsignature: string;\n\t\t\t\tmarketAddress: string;\n\t\t\t\tstatus?: \"confirmed\" | \"failed\";\n\t\t\t\terrorMessage?: string;\n\t\t\t};\n\t\t} & CallOptions,\n\t): Promise<ConfirmModeSResponse>;\n}\n\nexport interface ConfirmModeSResponse {\n\taccepted: boolean;\n\tidempotent?: boolean;\n\trecorded?: \"confirmed\" | \"failed\";\n\tsignature?: string;\n\treason?: string;\n}\n\n/** `client.positions.*` — read live Kamino positions for a partner-user. */\nexport interface PositionsMethods {\n\t/**\n\t * Read a user's live Kamino positions (supplied amounts, accumulated yield,\n\t * per-market breakdown). The user must sign a memo intent of the form\n\t * `vayo:read-positions:<walletAddress>:<partnerSlug>:<unixSeconds>` with\n\t * their wallet — the signed transaction is never broadcast on-chain. The\n\t * memo is partner-bound so a signature authorized for partner A cannot be\n\t * replayed by partner B.\n\t *\n\t * @see POST /v1/positions/read\n\t */\n\tread(\n\t\targs: {\n\t\t\tbody: {\n\t\t\t\t/** Solana wallet address (base58) whose positions to read. */\n\t\t\t\twalletAddress: string;\n\t\t\t\t/**\n\t\t\t\t * Base64 V0 transaction with a single Memo instruction signed by\n\t\t\t\t * the wallet owner.\n\t\t\t\t */\n\t\t\t\tsignedIntentTransaction: string;\n\t\t\t};\n\t\t} & CallOptions,\n\t): Promise<ReadPositionsResponse>;\n}\n\n/** `client.wallet.*` — async memo-challenge withdrawal. */\nexport interface WalletMethods extends WalletHelper {\n\t/** @see POST /v1/wallet/withdraw/prepare */\n\tprepareWithdrawal(\n\t\targs: {\n\t\t\tbody: {\n\t\t\t\tprivyDid: string;\n\t\t\t\tdestinationAddress: string;\n\t\t\t\tamount: string;\n\t\t\t\texactRecipientAmount?: boolean;\n\t\t\t};\n\t\t} & CallOptions,\n\t): Promise<PrepareWithdrawalResponse>;\n\t/** @see POST /v1/wallet/withdraw/submit */\n\tsubmitWithdrawal(\n\t\targs: {\n\t\t\tbody: { pendingWithdrawalId: string; signedIntentTransaction: string };\n\t\t} & CallOptions,\n\t): Promise<SubmitWithdrawalResponse>;\n}\n\n/** `client.webhooks.*` — outbound event subscriptions. */\nexport interface WebhooksMethods {\n\t/** @see POST /v1/webhooks */\n\tcreate(\n\t\targs: {\n\t\t\tbody: { url: string; events: string[]; description?: string };\n\t\t} & CallOptions,\n\t): Promise<CreateWebhookSubscriptionResponse>;\n\t/** @see GET /v1/webhooks */\n\tlist(args?: CallOptions): Promise<WebhookSubscription[]>;\n\t/** @see DELETE /v1/webhooks/:subscriptionId */\n\tdelete(\n\t\targs: { subscriptionId: string } & CallOptions,\n\t): Promise<{ deleted: true }>;\n\t/** @see POST /v1/webhooks/:subscriptionId/rotate-secret */\n\trotateSecret(\n\t\targs: { subscriptionId: string } & CallOptions,\n\t): Promise<RotateWebhookSecretResponse>;\n\t/** @see POST /v1/webhooks/:subscriptionId/test */\n\ttest(\n\t\targs: { subscriptionId: string } & CallOptions,\n\t): Promise<DispatchWebhookEventResponse>;\n\t/** @see GET /v1/webhooks/:subscriptionId/deliveries */\n\tdeliveries(\n\t\targs: {\n\t\t\tsubscriptionId: string;\n\t\t\tcursor?: string;\n\t\t\tlimit?: number;\n\t\t\tstatus?: \"pending\" | \"delivered\" | \"retrying\" | \"permanently_failed\";\n\t\t} & CallOptions,\n\t): Promise<ListWebhookDeliveriesResponse>;\n}\n\n/** `client.dashboard.*` — partner self-service analytics. */\nexport interface DashboardMethods {\n\t/** @see GET /v1/dashboard/overview */\n\toverview(args?: CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/users */\n\tusers(args?: GetV1DashboardUsersQueryParams & CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/transactions */\n\ttransactions(\n\t\targs?: GetV1DashboardTransactionsQueryParams & CallOptions,\n\t): Promise<unknown>;\n\t/** @see GET /v1/dashboard/consumption */\n\tconsumption(args?: CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/investment-performance */\n\tinvestmentPerformance(args?: CallOptions): Promise<unknown>;\n\t/** @deprecated Legacy alias of `partnerFees`. @see GET /v1/dashboard/performance-fees */\n\tperformanceFees(args?: CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/partner-fees */\n\tpartnerFees(args?: CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/partner-fees/payouts */\n\tpartnerFeesPayouts(\n\t\targs?: GetV1DashboardPartnerFeesPayoutsQueryParams & CallOptions,\n\t): Promise<unknown>;\n\t/** @see GET /v1/dashboard/allowlist */\n\tallowlist(args?: CallOptions): Promise<unknown>;\n\t/** @see GET /v1/dashboard/api-keys */\n\tapiKeys(args?: CallOptions): Promise<unknown>;\n}\n\n/** `client.health.*` — service + signing subsystem health. */\nexport interface HealthMethods {\n\t/** Basic liveness probe. @see GET /health */\n\tliveness(args?: CallOptions): Promise<unknown>;\n\t/** Readiness probe. @see GET /health/ready */\n\tready(args?: CallOptions): Promise<unknown>;\n\t/** Kora gasless relayer health. @see GET /health/kora */\n\tkora(args?: CallOptions): Promise<unknown>;\n\t/** Mode S witness/cosigner health. @see GET /health/mode-s */\n\tmodeS(args?: CallOptions): Promise<unknown>;\n}\n\n// ─── Response shapes for Mode S (typed by hand because the spec has them as `any`) ───\n\n/**\n * Response shape of `POST /v1/lending-operations/redeem-allocated/build`.\n *\n * The OpenAPI spec types this as `any` because Elysia auto-generates schemas\n * from request validators only — response shapes aren't captured in the\n * exported swagger. We type it here so partners get autocomplete on the\n * redeem helper. Source of truth:\n * `apps/api/src/core/use-cases/build-redeem-transaction.ts:58`.\n */\nexport interface BuildRedeemResponse {\n\t/** Base64-encoded wire transaction with the witness signature attached. */\n\tserializedTx: string;\n\t/** Lookup key for `/submit`. Cached for 5 minutes. */\n\tpendingRedeemId: string;\n\t/** Embedded fee transfers — verify before user-signing. */\n\texpectedFeeRecipients: Array<{ address: string; amount: string }>;\n\t/** Cosigners attached at build time. Always includes 'witness'. */\n\tcosignersAttached: Array<\"witness\" | \"kora\">;\n\texpiresAt: string;\n}\n\n/**\n * Response shape of `POST /v1/lending-operations/redeem-allocated/submit`.\n * Same caveat as `BuildRedeemResponse` — typed by hand because the OpenAPI\n * spec returns `any`. Source: `apps/api/src/core/use-cases/submit-signed-redeem.ts:19`.\n */\nexport interface SubmitSignedRedeemResponse {\n\tsignature: string;\n\tconfirmed: boolean;\n}\n\n// ─── Top-level client interface ────────────────────────────────────────\n\n/** `client.agents.*` — self-provisioning for BYOW agents (no Privy). */\nexport interface AgentsMethods {\n\t/**\n\t * Mint a Vayo identity (`user` + `agent_wallet`) for a wallet the agent\n\t * controls itself. Idempotent. Returns `{ privyDid, userId, walletAddress,\n\t * created }` — pass the `privyDid` to subsequent Mode-S calls.\n\t * @see POST /v1/agents/provision\n\t */\n\tprovision(\n\t\targs: {\n\t\t\tbody: { walletAddress: string };\n\t\t} & CallOptions,\n\t): Promise<ProvisionAgentResponse>;\n}\n\nexport interface ProvisionAgentResponse {\n\tprivyDid: string;\n\tuserId: string;\n\twalletAddress: string;\n\tcreated: boolean;\n}\n\nexport interface VayoPartnerClient {\n\tlending: LendingMethods;\n\tmodeS: ModeSMethods;\n\twallet: WalletMethods;\n\tpositions: PositionsMethods;\n\twebhooks: WebhooksMethods;\n\tdashboard: DashboardMethods;\n\thealth: HealthMethods;\n\tagents: AgentsMethods;\n\t/** Read-only view of the SDK options the client was constructed with. */\n\treadonly options: Readonly<VayoPartnerClientOptions>;\n}\n\n// ─── Factory ───────────────────────────────────────────────────────────\n\nexport function createVayoPartnerClient(\n\toptions: VayoPartnerClientOptions,\n): VayoPartnerClient {\n\tif (!options.baseUrl) {\n\t\tthrow new Error(\n\t\t\t\"[vayo/core-sdk] createVayoPartnerClient: baseUrl is required\",\n\t\t);\n\t}\n\tif (!options.apiKey) {\n\t\tthrow new Error(\n\t\t\t\"[vayo/core-sdk] createVayoPartnerClient: apiKey is required\",\n\t\t);\n\t}\n\n\t// Strip trailing slash so route paths concatenate cleanly.\n\tconst baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n\tconst ctxBase: Omit<ClientContext, \"idempotencyKey\"> = {\n\t\tbaseUrl,\n\t\tapiKey: options.apiKey,\n\t\tfetch: options.fetch,\n\t\tgenerateIdempotencyKey: options.generateIdempotencyKey,\n\t};\n\n\t// Helper that builds the per-call config consistently for every method.\n\tconst cfg = <T>(opts: { idempotencyKey?: string; signal?: AbortSignal }) =>\n\t\tbuildRequestConfig<T>(ctxBase, opts);\n\n\tconst lending: LendingMethods = {\n\t\tmarkets: (args) => getV1LendingMarkets(cfg({ signal: args?.signal })),\n\t\treserves: (args) => {\n\t\t\tconst { mints, signal } = args ?? {};\n\t\t\tconst params: GetV1LendingReservesQueryParams | undefined = mints\n\t\t\t\t? { mints: Array.isArray(mints) ? mints.join(\",\") : mints }\n\t\t\t\t: undefined;\n\t\t\treturn getV1LendingReserves(params, cfg({ signal }));\n\t\t},\n\t};\n\n\tconst buildRedeem: ModeSMethods[\"buildRedeem\"] = ({\n\t\tbody,\n\t\tquery,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\tpostV1LendingOperationsRedeemAllocatedBuild(\n\t\t\tbody,\n\t\t\tquery,\n\t\t\tcfg({ idempotencyKey, signal }),\n\t\t) as Promise<BuildRedeemResponse>;\n\n\tconst submitSignedRedeem: ModeSMethods[\"submitSignedRedeem\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\tpostV1LendingOperationsRedeemAllocatedSubmit(\n\t\t\tbody,\n\t\t\tcfg({ idempotencyKey, signal }),\n\t\t) as Promise<SubmitSignedRedeemResponse>;\n\n\tconst modeSHelper = createModeSHelper({ buildRedeem, submitSignedRedeem });\n\n\tconst rawCall = async <TResp>(\n\t\tmethod: \"GET\" | \"POST\" | \"DELETE\",\n\t\turl: string,\n\t\topts: {\n\t\t\tbody?: unknown;\n\t\t\tidempotencyKey?: string;\n\t\t\tsignal?: AbortSignal;\n\t\t} = {},\n\t): Promise<TResp> => {\n\t\tconst res = await rawHttpClient<TResp>({\n\t\t\tmethod,\n\t\t\turl,\n\t\t\tdata: opts.body as never,\n\t\t\tsignal: opts.signal,\n\t\t\tcontext: { ...ctxBase, idempotencyKey: opts.idempotencyKey },\n\t\t});\n\t\treturn res.data;\n\t};\n\n\tconst buildSupply: ModeSMethods[\"buildSupply\"] = ({\n\t\tbody,\n\t\tquery,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) => {\n\t\tconst qs = query?.gasless ? `?gasless=${query.gasless}` : \"\";\n\t\treturn rawCall<BuildSupplyResponse>(\n\t\t\t\"POST\",\n\t\t\t`/v1/lending-operations/supply-allocated/build${qs}`,\n\t\t\t{ body, idempotencyKey, signal },\n\t\t);\n\t};\n\n\tconst submitSignedSupply: ModeSMethods[\"submitSignedSupply\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\trawCall<SubmitSignedSupplyResponse>(\n\t\t\t\"POST\",\n\t\t\t\"/v1/lending-operations/supply-allocated/submit\",\n\t\t\t{ body, idempotencyKey, signal },\n\t\t);\n\n\tconst confirmRedeem: ModeSMethods[\"confirmRedeem\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\trawCall<ConfirmModeSResponse>(\n\t\t\t\"POST\",\n\t\t\t\"/v1/lending-operations/redeem-allocated/confirm\",\n\t\t\t{ body, idempotencyKey, signal },\n\t\t);\n\n\tconst confirmSupply: ModeSMethods[\"confirmSupply\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\trawCall<ConfirmModeSResponse>(\n\t\t\t\"POST\",\n\t\t\t\"/v1/lending-operations/supply-allocated/confirm\",\n\t\t\t{ body, idempotencyKey, signal },\n\t\t);\n\n\tconst modeSSupplyHelper = createModeSSupplyHelper({\n\t\tbuildSupply,\n\t\tsubmitSignedSupply,\n\t});\n\n\tconst modeS: ModeSMethods = {\n\t\tbuildRedeem,\n\t\tsubmitSignedRedeem,\n\t\tredeem: modeSHelper.redeem,\n\t\tbuildSupply,\n\t\tsubmitSignedSupply,\n\t\tsupply: modeSSupplyHelper.supply,\n\t\tconfirmRedeem,\n\t\tconfirmSupply,\n\t};\n\n\tconst prepareWithdrawal: WalletMethods[\"prepareWithdrawal\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\trawCall<PrepareWithdrawalResponse>(\"POST\", \"/v1/wallet/withdraw/prepare\", {\n\t\t\tbody,\n\t\t\tidempotencyKey,\n\t\t\tsignal,\n\t\t});\n\n\tconst submitWithdrawal: WalletMethods[\"submitWithdrawal\"] = ({\n\t\tbody,\n\t\tidempotencyKey,\n\t\tsignal,\n\t}) =>\n\t\trawCall<SubmitWithdrawalResponse>(\"POST\", \"/v1/wallet/withdraw/submit\", {\n\t\t\tbody,\n\t\t\tidempotencyKey,\n\t\t\tsignal,\n\t\t});\n\n\tconst walletHelper = createWalletHelper({\n\t\tprepareWithdrawal,\n\t\tsubmitWithdrawal,\n\t});\n\n\tconst wallet: WalletMethods = {\n\t\tprepareWithdrawal,\n\t\tsubmitWithdrawal,\n\t\twithdraw: walletHelper.withdraw,\n\t};\n\n\tconst positions: PositionsMethods = {\n\t\tread: ({ body, idempotencyKey, signal }) =>\n\t\t\trawCall<ReadPositionsResponse>(\"POST\", \"/v1/positions/read\", {\n\t\t\t\tbody,\n\t\t\t\tidempotencyKey,\n\t\t\t\tsignal,\n\t\t\t}),\n\t};\n\n\tconst webhooks: WebhooksMethods = {\n\t\tcreate: ({ body, idempotencyKey, signal }) =>\n\t\t\trawCall<CreateWebhookSubscriptionResponse>(\"POST\", \"/v1/webhooks\", {\n\t\t\t\tbody,\n\t\t\t\tidempotencyKey,\n\t\t\t\tsignal,\n\t\t\t}),\n\t\tlist: (args) =>\n\t\t\trawCall<WebhookSubscription[]>(\"GET\", \"/v1/webhooks\", {\n\t\t\t\tsignal: args?.signal,\n\t\t\t}),\n\t\tdelete: ({ subscriptionId, idempotencyKey, signal }) =>\n\t\t\trawCall<{ deleted: true }>(\"DELETE\", `/v1/webhooks/${subscriptionId}`, {\n\t\t\t\tidempotencyKey,\n\t\t\t\tsignal,\n\t\t\t}),\n\t\trotateSecret: ({ subscriptionId, idempotencyKey, signal }) =>\n\t\t\trawCall<RotateWebhookSecretResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/v1/webhooks/${subscriptionId}/rotate-secret`,\n\t\t\t\t{ idempotencyKey, signal },\n\t\t\t),\n\t\ttest: ({ subscriptionId, idempotencyKey, signal }) =>\n\t\t\trawCall<DispatchWebhookEventResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/v1/webhooks/${subscriptionId}/test`,\n\t\t\t\t{ idempotencyKey, signal },\n\t\t\t),\n\t\tdeliveries: ({ subscriptionId, cursor, limit, status, signal }) => {\n\t\t\tconst params = new URLSearchParams();\n\t\t\tif (cursor) params.set(\"cursor\", cursor);\n\t\t\tif (limit !== undefined) params.set(\"limit\", String(limit));\n\t\t\tif (status) params.set(\"status\", status);\n\t\t\tconst qs = params.toString();\n\t\t\treturn rawCall<ListWebhookDeliveriesResponse>(\n\t\t\t\t\"GET\",\n\t\t\t\t`/v1/webhooks/${subscriptionId}/deliveries${qs ? `?${qs}` : \"\"}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t},\n\t};\n\n\tconst dashboard: DashboardMethods = {\n\t\toverview: (args) => getV1DashboardOverview(cfg({ signal: args?.signal })),\n\t\tusers: (args) => {\n\t\t\tconst { signal, limit, offset, activeOnly } = args ?? {};\n\t\t\tconst params: GetV1DashboardUsersQueryParams | undefined =\n\t\t\t\tlimit !== undefined || offset !== undefined || activeOnly !== undefined\n\t\t\t\t\t? { limit, offset, activeOnly }\n\t\t\t\t\t: undefined;\n\t\t\treturn getV1DashboardUsers(params, cfg({ signal }));\n\t\t},\n\t\ttransactions: (args) => {\n\t\t\tconst { signal, type, status, limit, offset } = args ?? {};\n\t\t\tconst params: GetV1DashboardTransactionsQueryParams | undefined =\n\t\t\t\ttype !== undefined ||\n\t\t\t\tstatus !== undefined ||\n\t\t\t\tlimit !== undefined ||\n\t\t\t\toffset !== undefined\n\t\t\t\t\t? { type, status, limit, offset }\n\t\t\t\t\t: undefined;\n\t\t\treturn getV1DashboardTransactions(params, cfg({ signal }));\n\t\t},\n\t\tconsumption: (args) =>\n\t\t\tgetV1DashboardConsumption(cfg({ signal: args?.signal })),\n\t\tinvestmentPerformance: (args) =>\n\t\t\tgetV1DashboardInvestmentPerformance(cfg({ signal: args?.signal })),\n\t\tperformanceFees: (args) =>\n\t\t\tgetV1DashboardPerformanceFees(cfg({ signal: args?.signal })),\n\t\tpartnerFees: (args) =>\n\t\t\tgetV1DashboardPartnerFees(cfg({ signal: args?.signal })),\n\t\tpartnerFeesPayouts: (args) => {\n\t\t\tconst { signal, limit, offset } = args ?? {};\n\t\t\tconst params: GetV1DashboardPartnerFeesPayoutsQueryParams | undefined =\n\t\t\t\tlimit !== undefined || offset !== undefined\n\t\t\t\t\t? { limit, offset }\n\t\t\t\t\t: undefined;\n\t\t\treturn getV1DashboardPartnerFeesPayouts(params, cfg({ signal }));\n\t\t},\n\t\tallowlist: (args) => getV1DashboardAllowlist(cfg({ signal: args?.signal })),\n\t\tapiKeys: (args) => getV1DashboardApiKeys(cfg({ signal: args?.signal })),\n\t};\n\n\t// Health subprobes outside `/health/mode-s` are not in the OpenAPI spec, so\n\t// they're not kubb-generated — call the raw http client directly.\n\tconst healthGet = async (url: string, signal?: AbortSignal) => {\n\t\tconst res = await rawHttpClient<unknown>({\n\t\t\tmethod: \"GET\",\n\t\t\turl,\n\t\t\tsignal,\n\t\t\tcontext: { ...ctxBase, idempotencyKey: undefined },\n\t\t});\n\t\treturn res.data;\n\t};\n\n\tconst health: HealthMethods = {\n\t\tliveness: (args) => healthGet(\"/health\", args?.signal),\n\t\tready: (args) => healthGet(\"/health/ready\", args?.signal),\n\t\tkora: (args) => healthGet(\"/health/kora\", args?.signal),\n\t\tmodeS: (args) => getHealthModeS(cfg({ signal: args?.signal })),\n\t};\n\n\tconst agents: AgentsMethods = {\n\t\tprovision: ({ body, idempotencyKey, signal }) =>\n\t\t\trawCall<ProvisionAgentResponse>(\"POST\", \"/v1/agents/provision\", {\n\t\t\t\tbody,\n\t\t\t\tidempotencyKey,\n\t\t\t\tsignal,\n\t\t\t}),\n\t};\n\n\treturn {\n\t\tlending,\n\t\tmodeS,\n\t\twallet,\n\t\tpositions,\n\t\twebhooks,\n\t\tdashboard,\n\t\thealth,\n\t\tagents,\n\t\toptions: Object.freeze({ ...options }),\n\t};\n}\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/** u64 max — pass as `amount` for a full Mode S redeem. */\nexport const U64_MAX = \"18446744073709551615\";\n\n/** USDC mint on Solana mainnet. */\nexport const USDC_MINT = \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\";\n","// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Webhook receiver helpers.\n *\n * Partners receive POSTs from Vayo with the body signed via HMAC-SHA256. Use\n * `verifyWebhookSignature()` on every inbound delivery to reject forgeries\n * before processing the payload.\n *\n * Canonical body shape (alphabetically-sorted top-level keys):\n * { eventId, eventType, partnerId, payload }\n */\n\nimport { createHmac, timingSafeEqual } from \"node:crypto\";\n\nexport interface WebhookSubscription {\n\tid: string;\n\tpartnerId: string;\n\turl: string;\n\tevents: string[];\n\tdescription: string | null;\n\tisActive: boolean;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface CreateWebhookSubscriptionResponse extends WebhookSubscription {\n\tsecret: string;\n}\n\nexport interface RotateWebhookSecretResponse {\n\tid: string;\n\tsecret: string;\n\trotatedAt: string;\n}\n\nexport interface DispatchWebhookEventResponse {\n\teventId: string;\n\tdeliveriesEnqueued: number;\n}\n\nexport interface WebhookDelivery {\n\tid: string;\n\teventId: string;\n\teventType: string;\n\tstatus: \"pending\" | \"delivered\" | \"retrying\" | \"permanently_failed\";\n\tattempts: number;\n\tnextRetryAt: string | null;\n\tlastAttemptAt: string | null;\n\tresponseStatus: number | null;\n\tcreatedAt: string;\n}\n\nexport interface ListWebhookDeliveriesResponse {\n\titems: WebhookDelivery[];\n\tnextCursor: string | null;\n}\n\n/**\n * Verify a webhook delivery's HMAC signature.\n *\n * @param secret The signing secret returned at subscription creation (or rotation)\n * @param body The raw request body bytes you received (DO NOT re-stringify)\n * @param signatureHeader Value of the `X-Vayo-Signature` header (e.g. `sha256=abc...`)\n * @returns true when the signature matches; false otherwise\n */\nexport function verifyWebhookSignature(\n\tsecret: string,\n\tbody: string,\n\tsignatureHeader: string | null | undefined,\n): boolean {\n\tif (!signatureHeader) return false;\n\tconst prefix = \"sha256=\";\n\tif (!signatureHeader.startsWith(prefix)) return false;\n\tconst expected = signatureHeader.slice(prefix.length);\n\tconst computed = createHmac(\"sha256\", secret).update(body).digest(\"hex\");\n\tif (expected.length !== computed.length) return false;\n\ttry {\n\t\treturn timingSafeEqual(Buffer.from(expected), Buffer.from(computed));\n\t} catch {\n\t\treturn false;\n\t}\n}\n"]}
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ // src/mode-s/privy.ts
4
+ function createPrivySigner(privy, options) {
5
+ if (!options.walletId) {
6
+ throw new Error(
7
+ "[vayo/core-sdk/mode-s/privy] createPrivySigner: walletId is required"
8
+ );
9
+ }
10
+ const authorizationContext = options.authorizationPrivateKeys?.length ? {
11
+ authorization_private_keys: [...options.authorizationPrivateKeys]
12
+ } : void 0;
13
+ return async (serializedTxBase64) => {
14
+ const response = await privy.wallets().solana().signTransaction(options.walletId, {
15
+ transaction: serializedTxBase64,
16
+ encoding: "base64",
17
+ ...authorizationContext ? { authorization_context: authorizationContext } : {}
18
+ });
19
+ if (!response?.signed_transaction) {
20
+ throw new Error(
21
+ "[vayo/core-sdk/mode-s/privy] Privy returned an empty signed_transaction"
22
+ );
23
+ }
24
+ return response.signed_transaction;
25
+ };
26
+ }
27
+
28
+ exports.createPrivySigner = createPrivySigner;
29
+ //# sourceMappingURL=privy.cjs.map
30
+ //# sourceMappingURL=privy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mode-s/privy.ts"],"names":[],"mappings":";;;AA8DO,SAAS,iBAAA,CACf,OACA,OAAA,EAC0B;AAC1B,EAAA,IAAI,CAAC,QAAQ,QAAA,EAAU;AACtB,IAAA,MAAM,IAAI,KAAA;AAAA,MACT;AAAA,KACD;AAAA,EACD;AAEA,EAAA,MAAM,oBAAA,GAAuB,OAAA,CAAQ,wBAAA,EAA0B,MAAA,GAC5D;AAAA,IACA,0BAAA,EAA4B,CAAC,GAAG,OAAA,CAAQ,wBAAwB;AAAA,GACjE,GACC,MAAA;AAEH,EAAA,OAAO,OAAO,kBAAA,KAAuB;AACpC,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CACrB,OAAA,GACA,MAAA,EAAO,CACP,eAAA,CAAgB,OAAA,CAAQ,QAAA,EAAU;AAAA,MAClC,WAAA,EAAa,kBAAA;AAAA,MACb,QAAA,EAAU,QAAA;AAAA,MACV,GAAI,oBAAA,GACD,EAAE,qBAAA,EAAuB,oBAAA,KACzB;AAAC,KAKD,CAAA;AAEL,IAAA,IAAI,CAAC,UAAU,kBAAA,EAAoB;AAClC,MAAA,MAAM,IAAI,KAAA;AAAA,QACT;AAAA,OACD;AAAA,IACD;AACA,IAAA,OAAO,QAAA,CAAS,kBAAA;AAAA,EACjB,CAAA;AACD","file":"privy.cjs","sourcesContent":["// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Optional Privy signer adapter — `@vayolabs/core-sdk/mode-s/privy`.\n *\n * Bridges `@privy-io/node` to the SDK's `SignTransactionCallback` so Privy\n * partners can plug their wallet into `client.modeS.redeem()` in one line:\n *\n * ```ts\n * import { createVayoPartnerClient, U64_MAX } from '@vayolabs/core-sdk'\n * import { createPrivySigner } from '@vayolabs/core-sdk/mode-s/privy'\n * import { PrivyClient } from '@privy-io/node'\n *\n * const privy = new PrivyClient({ appId: '...', appSecret: '...' })\n * const sign = createPrivySigner(privy, { walletId: 'cl...' })\n *\n * const result = await client.modeS.redeem({\n * privyDid: 'did:privy:...',\n * marketAddress: '...',\n * tokenMint: USDC_MINT,\n * amount: U64_MAX,\n * signTransaction: sign,\n * expectedFeeRecipients: { partnerPayoutAddress, vayoTreasuryAddress },\n * })\n * ```\n *\n * **This is the only file in the SDK that imports `@privy-io/node`.** The\n * package is declared as an OPTIONAL peer dep — non-Privy partners that\n * never import this sub-export pay zero install cost. Bundlers/tsup mark\n * `@privy-io/node` as external so the main SDK bundle stays lean.\n *\n * Authorization keys: when the partner's wallet has a delegation/policy\n * requiring signature authorization (the typical Vayo Mode S setup), pass\n * `authorizationPrivateKeys` to construct an authorization context. The\n * adapter forwards it to `privy.wallets().solana().signTransaction()`.\n */\n\nimport type { PrivyClient } from \"@privy-io/node\";\n\nimport type { SignTransactionCallback } from \"./redeem\";\n\nexport interface CreatePrivySignerOptions {\n\t/**\n\t * Privy walletId of the user's Solana wallet (the value Privy returns at\n\t * wallet creation, e.g. `cl0abc...`).\n\t */\n\twalletId: string;\n\t/**\n\t * Optional authorization private keys. Pass when the wallet's policy\n\t * requires authorization signatures (the standard Vayo Mode S setup).\n\t * Each key is a Privy-formatted authorization key string —\n\t * `wallet-auth:...` or PEM, depending on how the partner generated it.\n\t */\n\tauthorizationPrivateKeys?: readonly string[];\n}\n\n/**\n * Builds a `SignTransactionCallback` backed by Privy's\n * `wallets().solana().signTransaction()` RPC. Pass the returned function\n * directly as the `signTransaction` field of `client.modeS.redeem()`.\n */\nexport function createPrivySigner(\n\tprivy: PrivyClient,\n\toptions: CreatePrivySignerOptions,\n): SignTransactionCallback {\n\tif (!options.walletId) {\n\t\tthrow new Error(\n\t\t\t\"[vayo/core-sdk/mode-s/privy] createPrivySigner: walletId is required\",\n\t\t);\n\t}\n\n\tconst authorizationContext = options.authorizationPrivateKeys?.length\n\t\t? {\n\t\t\t\tauthorization_private_keys: [...options.authorizationPrivateKeys],\n\t\t\t}\n\t\t: undefined;\n\n\treturn async (serializedTxBase64) => {\n\t\tconst response = await privy\n\t\t\t.wallets()\n\t\t\t.solana()\n\t\t\t.signTransaction(options.walletId, {\n\t\t\t\ttransaction: serializedTxBase64,\n\t\t\t\tencoding: \"base64\",\n\t\t\t\t...(authorizationContext\n\t\t\t\t\t? { authorization_context: authorizationContext }\n\t\t\t\t\t: {}),\n\t\t\t} as Parameters<\n\t\t\t\tReturnType<\n\t\t\t\t\tReturnType<PrivyClient[\"wallets\"]>[\"solana\"]\n\t\t\t\t>[\"signTransaction\"]\n\t\t\t>[1]);\n\n\t\tif (!response?.signed_transaction) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[vayo/core-sdk/mode-s/privy] Privy returned an empty signed_transaction\",\n\t\t\t);\n\t\t}\n\t\treturn response.signed_transaction;\n\t};\n}\n"]}
@@ -0,0 +1,61 @@
1
+ import { PrivyClient } from '@privy-io/node';
2
+ import { S as SignTransactionCallback } from '../client-BdGPlaqU.cjs';
3
+ import '../PostV1LendingOperationsRedeemAllocatedSubmit-znL3KL6k.cjs';
4
+
5
+ /**
6
+ * Optional Privy signer adapter — `@vayolabs/core-sdk/mode-s/privy`.
7
+ *
8
+ * Bridges `@privy-io/node` to the SDK's `SignTransactionCallback` so Privy
9
+ * partners can plug their wallet into `client.modeS.redeem()` in one line:
10
+ *
11
+ * ```ts
12
+ * import { createVayoPartnerClient, U64_MAX } from '@vayolabs/core-sdk'
13
+ * import { createPrivySigner } from '@vayolabs/core-sdk/mode-s/privy'
14
+ * import { PrivyClient } from '@privy-io/node'
15
+ *
16
+ * const privy = new PrivyClient({ appId: '...', appSecret: '...' })
17
+ * const sign = createPrivySigner(privy, { walletId: 'cl...' })
18
+ *
19
+ * const result = await client.modeS.redeem({
20
+ * privyDid: 'did:privy:...',
21
+ * marketAddress: '...',
22
+ * tokenMint: USDC_MINT,
23
+ * amount: U64_MAX,
24
+ * signTransaction: sign,
25
+ * expectedFeeRecipients: { partnerPayoutAddress, vayoTreasuryAddress },
26
+ * })
27
+ * ```
28
+ *
29
+ * **This is the only file in the SDK that imports `@privy-io/node`.** The
30
+ * package is declared as an OPTIONAL peer dep — non-Privy partners that
31
+ * never import this sub-export pay zero install cost. Bundlers/tsup mark
32
+ * `@privy-io/node` as external so the main SDK bundle stays lean.
33
+ *
34
+ * Authorization keys: when the partner's wallet has a delegation/policy
35
+ * requiring signature authorization (the typical Vayo Mode S setup), pass
36
+ * `authorizationPrivateKeys` to construct an authorization context. The
37
+ * adapter forwards it to `privy.wallets().solana().signTransaction()`.
38
+ */
39
+
40
+ interface CreatePrivySignerOptions {
41
+ /**
42
+ * Privy walletId of the user's Solana wallet (the value Privy returns at
43
+ * wallet creation, e.g. `cl0abc...`).
44
+ */
45
+ walletId: string;
46
+ /**
47
+ * Optional authorization private keys. Pass when the wallet's policy
48
+ * requires authorization signatures (the standard Vayo Mode S setup).
49
+ * Each key is a Privy-formatted authorization key string —
50
+ * `wallet-auth:...` or PEM, depending on how the partner generated it.
51
+ */
52
+ authorizationPrivateKeys?: readonly string[];
53
+ }
54
+ /**
55
+ * Builds a `SignTransactionCallback` backed by Privy's
56
+ * `wallets().solana().signTransaction()` RPC. Pass the returned function
57
+ * directly as the `signTransaction` field of `client.modeS.redeem()`.
58
+ */
59
+ declare function createPrivySigner(privy: PrivyClient, options: CreatePrivySignerOptions): SignTransactionCallback;
60
+
61
+ export { type CreatePrivySignerOptions, createPrivySigner };
@@ -0,0 +1,61 @@
1
+ import { PrivyClient } from '@privy-io/node';
2
+ import { S as SignTransactionCallback } from '../client-gLM58XPq.js';
3
+ import '../PostV1LendingOperationsRedeemAllocatedSubmit-znL3KL6k.js';
4
+
5
+ /**
6
+ * Optional Privy signer adapter — `@vayolabs/core-sdk/mode-s/privy`.
7
+ *
8
+ * Bridges `@privy-io/node` to the SDK's `SignTransactionCallback` so Privy
9
+ * partners can plug their wallet into `client.modeS.redeem()` in one line:
10
+ *
11
+ * ```ts
12
+ * import { createVayoPartnerClient, U64_MAX } from '@vayolabs/core-sdk'
13
+ * import { createPrivySigner } from '@vayolabs/core-sdk/mode-s/privy'
14
+ * import { PrivyClient } from '@privy-io/node'
15
+ *
16
+ * const privy = new PrivyClient({ appId: '...', appSecret: '...' })
17
+ * const sign = createPrivySigner(privy, { walletId: 'cl...' })
18
+ *
19
+ * const result = await client.modeS.redeem({
20
+ * privyDid: 'did:privy:...',
21
+ * marketAddress: '...',
22
+ * tokenMint: USDC_MINT,
23
+ * amount: U64_MAX,
24
+ * signTransaction: sign,
25
+ * expectedFeeRecipients: { partnerPayoutAddress, vayoTreasuryAddress },
26
+ * })
27
+ * ```
28
+ *
29
+ * **This is the only file in the SDK that imports `@privy-io/node`.** The
30
+ * package is declared as an OPTIONAL peer dep — non-Privy partners that
31
+ * never import this sub-export pay zero install cost. Bundlers/tsup mark
32
+ * `@privy-io/node` as external so the main SDK bundle stays lean.
33
+ *
34
+ * Authorization keys: when the partner's wallet has a delegation/policy
35
+ * requiring signature authorization (the typical Vayo Mode S setup), pass
36
+ * `authorizationPrivateKeys` to construct an authorization context. The
37
+ * adapter forwards it to `privy.wallets().solana().signTransaction()`.
38
+ */
39
+
40
+ interface CreatePrivySignerOptions {
41
+ /**
42
+ * Privy walletId of the user's Solana wallet (the value Privy returns at
43
+ * wallet creation, e.g. `cl0abc...`).
44
+ */
45
+ walletId: string;
46
+ /**
47
+ * Optional authorization private keys. Pass when the wallet's policy
48
+ * requires authorization signatures (the standard Vayo Mode S setup).
49
+ * Each key is a Privy-formatted authorization key string —
50
+ * `wallet-auth:...` or PEM, depending on how the partner generated it.
51
+ */
52
+ authorizationPrivateKeys?: readonly string[];
53
+ }
54
+ /**
55
+ * Builds a `SignTransactionCallback` backed by Privy's
56
+ * `wallets().solana().signTransaction()` RPC. Pass the returned function
57
+ * directly as the `signTransaction` field of `client.modeS.redeem()`.
58
+ */
59
+ declare function createPrivySigner(privy: PrivyClient, options: CreatePrivySignerOptions): SignTransactionCallback;
60
+
61
+ export { type CreatePrivySignerOptions, createPrivySigner };
@@ -0,0 +1,28 @@
1
+ // src/mode-s/privy.ts
2
+ function createPrivySigner(privy, options) {
3
+ if (!options.walletId) {
4
+ throw new Error(
5
+ "[vayo/core-sdk/mode-s/privy] createPrivySigner: walletId is required"
6
+ );
7
+ }
8
+ const authorizationContext = options.authorizationPrivateKeys?.length ? {
9
+ authorization_private_keys: [...options.authorizationPrivateKeys]
10
+ } : void 0;
11
+ return async (serializedTxBase64) => {
12
+ const response = await privy.wallets().solana().signTransaction(options.walletId, {
13
+ transaction: serializedTxBase64,
14
+ encoding: "base64",
15
+ ...authorizationContext ? { authorization_context: authorizationContext } : {}
16
+ });
17
+ if (!response?.signed_transaction) {
18
+ throw new Error(
19
+ "[vayo/core-sdk/mode-s/privy] Privy returned an empty signed_transaction"
20
+ );
21
+ }
22
+ return response.signed_transaction;
23
+ };
24
+ }
25
+
26
+ export { createPrivySigner };
27
+ //# sourceMappingURL=privy.js.map
28
+ //# sourceMappingURL=privy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mode-s/privy.ts"],"names":[],"mappings":";AA8DO,SAAS,iBAAA,CACf,OACA,OAAA,EAC0B;AAC1B,EAAA,IAAI,CAAC,QAAQ,QAAA,EAAU;AACtB,IAAA,MAAM,IAAI,KAAA;AAAA,MACT;AAAA,KACD;AAAA,EACD;AAEA,EAAA,MAAM,oBAAA,GAAuB,OAAA,CAAQ,wBAAA,EAA0B,MAAA,GAC5D;AAAA,IACA,0BAAA,EAA4B,CAAC,GAAG,OAAA,CAAQ,wBAAwB;AAAA,GACjE,GACC,MAAA;AAEH,EAAA,OAAO,OAAO,kBAAA,KAAuB;AACpC,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CACrB,OAAA,GACA,MAAA,EAAO,CACP,eAAA,CAAgB,OAAA,CAAQ,QAAA,EAAU;AAAA,MAClC,WAAA,EAAa,kBAAA;AAAA,MACb,QAAA,EAAU,QAAA;AAAA,MACV,GAAI,oBAAA,GACD,EAAE,qBAAA,EAAuB,oBAAA,KACzB;AAAC,KAKD,CAAA;AAEL,IAAA,IAAI,CAAC,UAAU,kBAAA,EAAoB;AAClC,MAAA,MAAM,IAAI,KAAA;AAAA,QACT;AAAA,OACD;AAAA,IACD;AACA,IAAA,OAAO,QAAA,CAAS,kBAAA;AAAA,EACjB,CAAA;AACD","file":"privy.js","sourcesContent":["// Copyright 2026 Vayo Finance Labs\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Optional Privy signer adapter — `@vayolabs/core-sdk/mode-s/privy`.\n *\n * Bridges `@privy-io/node` to the SDK's `SignTransactionCallback` so Privy\n * partners can plug their wallet into `client.modeS.redeem()` in one line:\n *\n * ```ts\n * import { createVayoPartnerClient, U64_MAX } from '@vayolabs/core-sdk'\n * import { createPrivySigner } from '@vayolabs/core-sdk/mode-s/privy'\n * import { PrivyClient } from '@privy-io/node'\n *\n * const privy = new PrivyClient({ appId: '...', appSecret: '...' })\n * const sign = createPrivySigner(privy, { walletId: 'cl...' })\n *\n * const result = await client.modeS.redeem({\n * privyDid: 'did:privy:...',\n * marketAddress: '...',\n * tokenMint: USDC_MINT,\n * amount: U64_MAX,\n * signTransaction: sign,\n * expectedFeeRecipients: { partnerPayoutAddress, vayoTreasuryAddress },\n * })\n * ```\n *\n * **This is the only file in the SDK that imports `@privy-io/node`.** The\n * package is declared as an OPTIONAL peer dep — non-Privy partners that\n * never import this sub-export pay zero install cost. Bundlers/tsup mark\n * `@privy-io/node` as external so the main SDK bundle stays lean.\n *\n * Authorization keys: when the partner's wallet has a delegation/policy\n * requiring signature authorization (the typical Vayo Mode S setup), pass\n * `authorizationPrivateKeys` to construct an authorization context. The\n * adapter forwards it to `privy.wallets().solana().signTransaction()`.\n */\n\nimport type { PrivyClient } from \"@privy-io/node\";\n\nimport type { SignTransactionCallback } from \"./redeem\";\n\nexport interface CreatePrivySignerOptions {\n\t/**\n\t * Privy walletId of the user's Solana wallet (the value Privy returns at\n\t * wallet creation, e.g. `cl0abc...`).\n\t */\n\twalletId: string;\n\t/**\n\t * Optional authorization private keys. Pass when the wallet's policy\n\t * requires authorization signatures (the standard Vayo Mode S setup).\n\t * Each key is a Privy-formatted authorization key string —\n\t * `wallet-auth:...` or PEM, depending on how the partner generated it.\n\t */\n\tauthorizationPrivateKeys?: readonly string[];\n}\n\n/**\n * Builds a `SignTransactionCallback` backed by Privy's\n * `wallets().solana().signTransaction()` RPC. Pass the returned function\n * directly as the `signTransaction` field of `client.modeS.redeem()`.\n */\nexport function createPrivySigner(\n\tprivy: PrivyClient,\n\toptions: CreatePrivySignerOptions,\n): SignTransactionCallback {\n\tif (!options.walletId) {\n\t\tthrow new Error(\n\t\t\t\"[vayo/core-sdk/mode-s/privy] createPrivySigner: walletId is required\",\n\t\t);\n\t}\n\n\tconst authorizationContext = options.authorizationPrivateKeys?.length\n\t\t? {\n\t\t\t\tauthorization_private_keys: [...options.authorizationPrivateKeys],\n\t\t\t}\n\t\t: undefined;\n\n\treturn async (serializedTxBase64) => {\n\t\tconst response = await privy\n\t\t\t.wallets()\n\t\t\t.solana()\n\t\t\t.signTransaction(options.walletId, {\n\t\t\t\ttransaction: serializedTxBase64,\n\t\t\t\tencoding: \"base64\",\n\t\t\t\t...(authorizationContext\n\t\t\t\t\t? { authorization_context: authorizationContext }\n\t\t\t\t\t: {}),\n\t\t\t} as Parameters<\n\t\t\t\tReturnType<\n\t\t\t\t\tReturnType<PrivyClient[\"wallets\"]>[\"solana\"]\n\t\t\t\t>[\"signTransaction\"]\n\t\t\t>[1]);\n\n\t\tif (!response?.signed_transaction) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[vayo/core-sdk/mode-s/privy] Privy returned an empty signed_transaction\",\n\t\t\t);\n\t\t}\n\t\treturn response.signed_transaction;\n\t};\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@vayolabs/core-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript SDK for the Vayo Finance Partner API — Mode S lending operations on Solana with partner-signed transactions.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./mode-s/privy": {
16
+ "types": "./dist/mode-s/privy.d.ts",
17
+ "import": "./dist/mode-s/privy.js",
18
+ "require": "./dist/mode-s/privy.cjs"
19
+ },
20
+ "./generated": {
21
+ "types": "./dist/generated/index.d.ts",
22
+ "import": "./dist/generated/index.js",
23
+ "require": "./dist/generated/index.cjs"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "CHANGELOG.md",
30
+ "LICENSE",
31
+ "NOTICE"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "registry": "https://registry.npmjs.org/"
36
+ },
37
+ "sideEffects": false,
38
+ "scripts": {
39
+ "gen": "kubb generate",
40
+ "build": "bun run gen && tsup",
41
+ "dev": "tsup --watch",
42
+ "test": "bun test",
43
+ "typecheck": "tsc --noEmit",
44
+ "lint": "biome check src",
45
+ "lint:fix": "biome check --write src",
46
+ "clean": "rm -rf dist node_modules .turbo src/generated",
47
+ "prepublishOnly": "bun run build && bun test"
48
+ },
49
+ "peerDependencies": {
50
+ "@privy-io/node": ">=0.10.0",
51
+ "@solana/kit": ">=6.0.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@privy-io/node": {
55
+ "optional": true
56
+ },
57
+ "@solana/kit": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "@kubb/cli": "4.37.2",
63
+ "@kubb/core": "4.37.2",
64
+ "@kubb/plugin-client": "4.37.2",
65
+ "@kubb/plugin-oas": "4.37.2",
66
+ "@kubb/plugin-ts": "4.37.2",
67
+ "@privy-io/node": "^0.14.0",
68
+ "@solana/kit": "^6.1.0",
69
+ "@vayo/typescript-config": "0.0.0",
70
+ "bun-types": "latest",
71
+ "tsup": "^8.3.5",
72
+ "typescript": "^5.9.3"
73
+ },
74
+ "keywords": [
75
+ "vayo",
76
+ "solana",
77
+ "lending",
78
+ "kamino",
79
+ "defi",
80
+ "yield",
81
+ "sdk",
82
+ "partner"
83
+ ],
84
+ "repository": {
85
+ "type": "git",
86
+ "url": "https://github.com/vayo-finance-labs/vayo-finance"
87
+ },
88
+ "homepage": "https://vayo.finance",
89
+ "license": "Apache-2.0"
90
+ }