@compass-labs/api-sdk 2.2.105 → 2.2.107

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.
Files changed (164) hide show
  1. package/README.md +6 -4
  2. package/codeSamples_typescript.yaml +7 -1
  3. package/dist/commonjs/funcs/creditCreditSwap.d.ts +23 -0
  4. package/dist/commonjs/funcs/creditCreditSwap.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/creditCreditSwap.js +124 -0
  6. package/dist/commonjs/funcs/creditCreditSwap.js.map +1 -0
  7. package/dist/commonjs/funcs/earnEarnSwap.d.ts +7 -7
  8. package/dist/commonjs/funcs/earnEarnSwap.js +7 -7
  9. package/dist/commonjs/lib/config.d.ts +2 -2
  10. package/dist/commonjs/lib/config.js +2 -2
  11. package/dist/commonjs/lib/config.js.map +1 -1
  12. package/dist/commonjs/models/components/chain.d.ts +1 -0
  13. package/dist/commonjs/models/components/chain.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/chain.js +1 -0
  15. package/dist/commonjs/models/components/chain.js.map +1 -1
  16. package/dist/commonjs/models/components/creditswaprequest.d.ts +112 -0
  17. package/dist/commonjs/models/components/creditswaprequest.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/creditswaprequest.js +101 -0
  19. package/dist/commonjs/models/components/creditswaprequest.js.map +1 -0
  20. package/dist/commonjs/models/components/creditswapresponse.d.ts +51 -0
  21. package/dist/commonjs/models/components/creditswapresponse.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/creditswapresponse.js +74 -0
  23. package/dist/commonjs/models/components/creditswapresponse.js.map +1 -0
  24. package/dist/commonjs/models/components/earnswaprequest.d.ts +2 -3
  25. package/dist/commonjs/models/components/earnswaprequest.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/earnswaprequest.js.map +1 -1
  27. package/dist/commonjs/models/components/eulermarket.d.ts +12 -0
  28. package/dist/commonjs/models/components/eulermarket.d.ts.map +1 -1
  29. package/dist/commonjs/models/components/eulermarket.js +6 -0
  30. package/dist/commonjs/models/components/eulermarket.js.map +1 -1
  31. package/dist/commonjs/models/components/eulermarketcollateral.d.ts +4 -0
  32. package/dist/commonjs/models/components/eulermarketcollateral.d.ts.map +1 -1
  33. package/dist/commonjs/models/components/eulermarketcollateral.js +2 -0
  34. package/dist/commonjs/models/components/eulermarketcollateral.js.map +1 -1
  35. package/dist/commonjs/models/components/index.d.ts +2 -0
  36. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  37. package/dist/commonjs/models/components/index.js +2 -0
  38. package/dist/commonjs/models/components/index.js.map +1 -1
  39. package/dist/commonjs/models/operations/v2earnswapquote.d.ts +1 -0
  40. package/dist/commonjs/models/operations/v2earnswapquote.d.ts.map +1 -1
  41. package/dist/commonjs/models/operations/v2earnswapquote.js +1 -0
  42. package/dist/commonjs/models/operations/v2earnswapquote.js.map +1 -1
  43. package/dist/commonjs/models/operations/v2tokenizedassetsbalances.d.ts +1 -0
  44. package/dist/commonjs/models/operations/v2tokenizedassetsbalances.d.ts.map +1 -1
  45. package/dist/commonjs/models/operations/v2tokenizedassetsbalances.js +1 -0
  46. package/dist/commonjs/models/operations/v2tokenizedassetsbalances.js.map +1 -1
  47. package/dist/commonjs/models/operations/v2tokenizedassetsmarketssymbol.d.ts +1 -0
  48. package/dist/commonjs/models/operations/v2tokenizedassetsmarketssymbol.d.ts.map +1 -1
  49. package/dist/commonjs/models/operations/v2tokenizedassetsmarketssymbol.js +1 -0
  50. package/dist/commonjs/models/operations/v2tokenizedassetsmarketssymbol.js.map +1 -1
  51. package/dist/commonjs/models/operations/v2tokenizedassetspositions.d.ts +1 -0
  52. package/dist/commonjs/models/operations/v2tokenizedassetspositions.d.ts.map +1 -1
  53. package/dist/commonjs/models/operations/v2tokenizedassetspositions.js +1 -0
  54. package/dist/commonjs/models/operations/v2tokenizedassetspositions.js.map +1 -1
  55. package/dist/commonjs/models/operations/v2tokenizedassetsredemptions.d.ts +1 -0
  56. package/dist/commonjs/models/operations/v2tokenizedassetsredemptions.d.ts.map +1 -1
  57. package/dist/commonjs/models/operations/v2tokenizedassetsredemptions.js +1 -0
  58. package/dist/commonjs/models/operations/v2tokenizedassetsredemptions.js.map +1 -1
  59. package/dist/commonjs/sdk/credit.d.ts +12 -0
  60. package/dist/commonjs/sdk/credit.d.ts.map +1 -1
  61. package/dist/commonjs/sdk/credit.js +15 -0
  62. package/dist/commonjs/sdk/credit.js.map +1 -1
  63. package/dist/commonjs/sdk/earn.d.ts +7 -7
  64. package/dist/commonjs/sdk/earn.js +7 -7
  65. package/dist/esm/funcs/creditCreditSwap.d.ts +23 -0
  66. package/dist/esm/funcs/creditCreditSwap.d.ts.map +1 -0
  67. package/dist/esm/funcs/creditCreditSwap.js +88 -0
  68. package/dist/esm/funcs/creditCreditSwap.js.map +1 -0
  69. package/dist/esm/funcs/earnEarnSwap.d.ts +7 -7
  70. package/dist/esm/funcs/earnEarnSwap.js +7 -7
  71. package/dist/esm/lib/config.d.ts +2 -2
  72. package/dist/esm/lib/config.js +2 -2
  73. package/dist/esm/lib/config.js.map +1 -1
  74. package/dist/esm/models/components/chain.d.ts +1 -0
  75. package/dist/esm/models/components/chain.d.ts.map +1 -1
  76. package/dist/esm/models/components/chain.js +1 -0
  77. package/dist/esm/models/components/chain.js.map +1 -1
  78. package/dist/esm/models/components/creditswaprequest.d.ts +112 -0
  79. package/dist/esm/models/components/creditswaprequest.d.ts.map +1 -0
  80. package/dist/esm/models/components/creditswaprequest.js +62 -0
  81. package/dist/esm/models/components/creditswaprequest.js.map +1 -0
  82. package/dist/esm/models/components/creditswapresponse.d.ts +51 -0
  83. package/dist/esm/models/components/creditswapresponse.d.ts.map +1 -0
  84. package/dist/esm/models/components/creditswapresponse.js +37 -0
  85. package/dist/esm/models/components/creditswapresponse.js.map +1 -0
  86. package/dist/esm/models/components/earnswaprequest.d.ts +2 -3
  87. package/dist/esm/models/components/earnswaprequest.d.ts.map +1 -1
  88. package/dist/esm/models/components/earnswaprequest.js.map +1 -1
  89. package/dist/esm/models/components/eulermarket.d.ts +12 -0
  90. package/dist/esm/models/components/eulermarket.d.ts.map +1 -1
  91. package/dist/esm/models/components/eulermarket.js +6 -0
  92. package/dist/esm/models/components/eulermarket.js.map +1 -1
  93. package/dist/esm/models/components/eulermarketcollateral.d.ts +4 -0
  94. package/dist/esm/models/components/eulermarketcollateral.d.ts.map +1 -1
  95. package/dist/esm/models/components/eulermarketcollateral.js +2 -0
  96. package/dist/esm/models/components/eulermarketcollateral.js.map +1 -1
  97. package/dist/esm/models/components/index.d.ts +2 -0
  98. package/dist/esm/models/components/index.d.ts.map +1 -1
  99. package/dist/esm/models/components/index.js +2 -0
  100. package/dist/esm/models/components/index.js.map +1 -1
  101. package/dist/esm/models/operations/v2earnswapquote.d.ts +1 -0
  102. package/dist/esm/models/operations/v2earnswapquote.d.ts.map +1 -1
  103. package/dist/esm/models/operations/v2earnswapquote.js +1 -0
  104. package/dist/esm/models/operations/v2earnswapquote.js.map +1 -1
  105. package/dist/esm/models/operations/v2tokenizedassetsbalances.d.ts +1 -0
  106. package/dist/esm/models/operations/v2tokenizedassetsbalances.d.ts.map +1 -1
  107. package/dist/esm/models/operations/v2tokenizedassetsbalances.js +1 -0
  108. package/dist/esm/models/operations/v2tokenizedassetsbalances.js.map +1 -1
  109. package/dist/esm/models/operations/v2tokenizedassetsmarketssymbol.d.ts +1 -0
  110. package/dist/esm/models/operations/v2tokenizedassetsmarketssymbol.d.ts.map +1 -1
  111. package/dist/esm/models/operations/v2tokenizedassetsmarketssymbol.js +1 -0
  112. package/dist/esm/models/operations/v2tokenizedassetsmarketssymbol.js.map +1 -1
  113. package/dist/esm/models/operations/v2tokenizedassetspositions.d.ts +1 -0
  114. package/dist/esm/models/operations/v2tokenizedassetspositions.d.ts.map +1 -1
  115. package/dist/esm/models/operations/v2tokenizedassetspositions.js +1 -0
  116. package/dist/esm/models/operations/v2tokenizedassetspositions.js.map +1 -1
  117. package/dist/esm/models/operations/v2tokenizedassetsredemptions.d.ts +1 -0
  118. package/dist/esm/models/operations/v2tokenizedassetsredemptions.d.ts.map +1 -1
  119. package/dist/esm/models/operations/v2tokenizedassetsredemptions.js +1 -0
  120. package/dist/esm/models/operations/v2tokenizedassetsredemptions.js.map +1 -1
  121. package/dist/esm/sdk/credit.d.ts +12 -0
  122. package/dist/esm/sdk/credit.d.ts.map +1 -1
  123. package/dist/esm/sdk/credit.js +15 -0
  124. package/dist/esm/sdk/credit.js.map +1 -1
  125. package/dist/esm/sdk/earn.d.ts +7 -7
  126. package/dist/esm/sdk/earn.js +7 -7
  127. package/docs/models/components/chain.md +1 -1
  128. package/docs/models/components/creditswaprequest.md +36 -0
  129. package/docs/models/components/creditswaprequestamountin.md +19 -0
  130. package/docs/models/components/creditswaprequestchain.md +17 -0
  131. package/docs/models/components/creditswaprequestpricing.md +17 -0
  132. package/docs/models/components/creditswaprequestslippage.md +19 -0
  133. package/docs/models/components/creditswapresponse.md +25 -0
  134. package/docs/models/components/creditswapresponseswapprovider.md +17 -0
  135. package/docs/models/components/earnswaprequest.md +2 -3
  136. package/docs/models/components/eulermarket.md +21 -18
  137. package/docs/models/components/eulermarketcollateral.md +11 -10
  138. package/docs/models/operations/v2earnswapquotechain.md +1 -1
  139. package/docs/models/operations/v2tokenizedassetsbalanceschain.md +2 -2
  140. package/docs/models/operations/v2tokenizedassetsmarketssymbolchain.md +2 -2
  141. package/docs/models/operations/v2tokenizedassetspositionschain.md +1 -1
  142. package/docs/models/operations/v2tokenizedassetsredemptionschain.md +1 -1
  143. package/docs/sdks/credit/README.md +94 -0
  144. package/docs/sdks/earn/README.md +7 -7
  145. package/docs/sdks/tokenizedassets/README.md +2 -2
  146. package/openapi_prepped_for_speakeasy.json +272 -3
  147. package/package.json +1 -1
  148. package/src/funcs/creditCreditSwap.ts +176 -0
  149. package/src/funcs/earnEarnSwap.ts +7 -7
  150. package/src/lib/config.ts +2 -2
  151. package/src/models/components/chain.ts +1 -0
  152. package/src/models/components/creditswaprequest.ts +186 -0
  153. package/src/models/components/creditswapresponse.ts +99 -0
  154. package/src/models/components/earnswaprequest.ts +2 -3
  155. package/src/models/components/eulermarket.ts +18 -0
  156. package/src/models/components/eulermarketcollateral.ts +6 -0
  157. package/src/models/components/index.ts +2 -0
  158. package/src/models/operations/v2earnswapquote.ts +1 -0
  159. package/src/models/operations/v2tokenizedassetsbalances.ts +1 -0
  160. package/src/models/operations/v2tokenizedassetsmarketssymbol.ts +1 -0
  161. package/src/models/operations/v2tokenizedassetspositions.ts +1 -0
  162. package/src/models/operations/v2tokenizedassetsredemptions.ts +1 -0
  163. package/src/sdk/credit.ts +23 -0
  164. package/src/sdk/earn.ts +7 -7
@@ -0,0 +1,176 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CompassApiSDKCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Swap tokens
31
+ *
32
+ * @remarks
33
+ * Swap one token for another inside a Credit Account.
34
+ *
35
+ * Exchanges tokens the Credit Account already holds in a single atomic
36
+ * transaction, so idle or borrowed balances can be converted without moving
37
+ * funds out first. Returns an unsigned transaction to sign, the expected
38
+ * output amount, and which route priced the swap.
39
+ */
40
+ export function creditCreditSwap(
41
+ client: CompassApiSDKCore,
42
+ request: components.CreditSwapRequest,
43
+ options?: RequestOptions,
44
+ ): APIPromise<
45
+ Result<
46
+ components.CreditSwapResponse,
47
+ | errors.HTTPValidationError
48
+ | CompassAPISDKError
49
+ | ResponseValidationError
50
+ | ConnectionError
51
+ | RequestAbortedError
52
+ | RequestTimeoutError
53
+ | InvalidRequestError
54
+ | UnexpectedClientError
55
+ | SDKValidationError
56
+ >
57
+ > {
58
+ return new APIPromise($do(
59
+ client,
60
+ request,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: CompassApiSDKCore,
67
+ request: components.CreditSwapRequest,
68
+ options?: RequestOptions,
69
+ ): Promise<
70
+ [
71
+ Result<
72
+ components.CreditSwapResponse,
73
+ | errors.HTTPValidationError
74
+ | CompassAPISDKError
75
+ | ResponseValidationError
76
+ | ConnectionError
77
+ | RequestAbortedError
78
+ | RequestTimeoutError
79
+ | InvalidRequestError
80
+ | UnexpectedClientError
81
+ | SDKValidationError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const parsed = safeParse(
87
+ request,
88
+ (value) => components.CreditSwapRequest$outboundSchema.parse(value),
89
+ "Input validation failed",
90
+ );
91
+ if (!parsed.ok) {
92
+ return [parsed, { status: "invalid" }];
93
+ }
94
+ const payload = parsed.value;
95
+ const body = encodeJSON("body", payload, { explode: true });
96
+
97
+ const path = pathToFunc("/v2/credit/swap")();
98
+
99
+ const headers = new Headers(compactMap({
100
+ "Content-Type": "application/json",
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
105
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "v2_credit_swap",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.apiKeyAuth,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "POST",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ body: body,
130
+ userAgent: client._options.userAgent,
131
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
132
+ }, options);
133
+ if (!requestRes.ok) {
134
+ return [requestRes, { status: "invalid" }];
135
+ }
136
+ const req = requestRes.value;
137
+
138
+ const doResult = await client._do(req, {
139
+ context,
140
+ isErrorStatusCode: (statusCode: number) =>
141
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const responseFields = {
151
+ HttpMeta: { Response: response, Request: req },
152
+ };
153
+
154
+ const [result] = await M.match<
155
+ components.CreditSwapResponse,
156
+ | errors.HTTPValidationError
157
+ | CompassAPISDKError
158
+ | ResponseValidationError
159
+ | ConnectionError
160
+ | RequestAbortedError
161
+ | RequestTimeoutError
162
+ | InvalidRequestError
163
+ | UnexpectedClientError
164
+ | SDKValidationError
165
+ >(
166
+ M.json(200, components.CreditSwapResponse$inboundSchema),
167
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
168
+ M.fail("4XX"),
169
+ M.fail("5XX"),
170
+ )(response, req, { extraFields: responseFields });
171
+ if (!result.ok) {
172
+ return [result, { status: "complete", request: req, response }];
173
+ }
174
+
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
@@ -27,16 +27,16 @@ import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
28
 
29
29
  /**
30
- * Swap tokens within Earn Account
30
+ * Swap tokens
31
31
  *
32
32
  * @remarks
33
- * Swap tokens within an Earn Account.
33
+ * Swap one token for another inside an Earn Account.
34
34
  *
35
- * Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
36
- *
37
- * The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
38
- *
39
- * Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
35
+ * Exchanges tokens the Earn Account already holds in a single atomic
36
+ * transaction, so funds never leave it, and can be chained with other actions
37
+ * through the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions)
38
+ * (for example, swap ETH to USDC and deposit the USDC into a vault at once).
39
+ * Returns an unsigned transaction to sign and the expected output amount.
40
40
  */
41
41
  export function earnEarnSwap(
42
42
  client: CompassApiSDKCore,
package/src/lib/config.ts CHANGED
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "0.0.1",
64
64
  sdkVersion: "2.0.0",
65
- genVersion: "2.935.1",
65
+ genVersion: "2.937.18",
66
66
  userAgent:
67
- "speakeasy-sdk/typescript 2.0.0 2.935.1 0.0.1 @compass-labs/api-sdk",
67
+ "speakeasy-sdk/typescript 2.0.0 2.937.18 0.0.1 @compass-labs/api-sdk",
68
68
  } as const;
@@ -15,6 +15,7 @@ export const Chain = {
15
15
  Hyperevm: "hyperevm",
16
16
  Tempo: "tempo",
17
17
  Bsc: "bsc",
18
+ Robinhood: "robinhood",
18
19
  EthereumSepolia: "ethereum_sepolia",
19
20
  } as const;
20
21
  /**
@@ -0,0 +1,186 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+
9
+ /**
10
+ * Human-readable amount of `token_in` to swap (token units, not wei).
11
+ */
12
+ export type CreditSwapRequestAmountIn = number | string;
13
+
14
+ /**
15
+ * Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Bounds the market route only; a firm quote fills exactly and ignores it.
16
+ */
17
+ export type CreditSwapRequestSlippage = number | string;
18
+
19
+ /**
20
+ * Target blockchain network where the swap will execute.
21
+ */
22
+ export const CreditSwapRequestChain = {
23
+ Arbitrum: "arbitrum",
24
+ Base: "base",
25
+ Bsc: "bsc",
26
+ Ethereum: "ethereum",
27
+ Hyperevm: "hyperevm",
28
+ Tempo: "tempo",
29
+ } as const;
30
+ /**
31
+ * Target blockchain network where the swap will execute.
32
+ */
33
+ export type CreditSwapRequestChain = ClosedEnum<typeof CreditSwapRequestChain>;
34
+
35
+ /**
36
+ * Swap routing policy. 'auto': a firm zero-slippage quote when a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route; an uncovered pair fails with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; the swap is priced by the aggregator and bounded by `slippage` (which firm fills ignore). 'firm' is incompatible with gas_sponsorship (sponsored swaps force market routing).
37
+ */
38
+ export const CreditSwapRequestPricing = {
39
+ Auto: "auto",
40
+ Firm: "firm",
41
+ Market: "market",
42
+ } as const;
43
+ /**
44
+ * Swap routing policy. 'auto': a firm zero-slippage quote when a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route; an uncovered pair fails with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; the swap is priced by the aggregator and bounded by `slippage` (which firm fills ignore). 'firm' is incompatible with gas_sponsorship (sponsored swaps force market routing).
45
+ */
46
+ export type CreditSwapRequestPricing = ClosedEnum<
47
+ typeof CreditSwapRequestPricing
48
+ >;
49
+
50
+ /**
51
+ * Swap one token held in the Credit Account for another, in a single
52
+ *
53
+ * @remarks
54
+ * atomic transaction, at a firm quote where one covers the pair and at market
55
+ * rate otherwise.
56
+ */
57
+ export type CreditSwapRequest = {
58
+ /**
59
+ * Action type identifier for swap operations.
60
+ */
61
+ actionType?: "V2_SWAP" | undefined;
62
+ /**
63
+ * Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
64
+ */
65
+ tokenIn: string;
66
+ /**
67
+ * Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
68
+ */
69
+ tokenOut: string;
70
+ /**
71
+ * Human-readable amount of `token_in` to swap (token units, not wei).
72
+ */
73
+ amountIn: number | string;
74
+ /**
75
+ * Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Bounds the market route only; a firm quote fills exactly and ignores it.
76
+ */
77
+ slippage?: number | string | undefined;
78
+ /**
79
+ * The owner's wallet address. Their Credit Account must already exist (create it with `/v2/credit/create_account`) and hold `token_in` (deposit with `/v2/credit/transfer`).
80
+ */
81
+ owner: string;
82
+ /**
83
+ * Target blockchain network where the swap will execute.
84
+ */
85
+ chain: CreditSwapRequestChain;
86
+ /**
87
+ * Optionally request gas sponsorship. If `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`). Gas-sponsored builds always execute at market rate.
88
+ */
89
+ gasSponsorship?: boolean | undefined;
90
+ /**
91
+ * Swap routing policy. 'auto': a firm zero-slippage quote when a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route; an uncovered pair fails with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; the swap is priced by the aggregator and bounded by `slippage` (which firm fills ignore). 'firm' is incompatible with gas_sponsorship (sponsored swaps force market routing).
92
+ */
93
+ pricing?: CreditSwapRequestPricing | undefined;
94
+ };
95
+
96
+ /** @internal */
97
+ export type CreditSwapRequestAmountIn$Outbound = number | string;
98
+
99
+ /** @internal */
100
+ export const CreditSwapRequestAmountIn$outboundSchema: z.ZodType<
101
+ CreditSwapRequestAmountIn$Outbound,
102
+ z.ZodTypeDef,
103
+ CreditSwapRequestAmountIn
104
+ > = z.union([z.number(), z.string()]);
105
+
106
+ export function creditSwapRequestAmountInToJSON(
107
+ creditSwapRequestAmountIn: CreditSwapRequestAmountIn,
108
+ ): string {
109
+ return JSON.stringify(
110
+ CreditSwapRequestAmountIn$outboundSchema.parse(creditSwapRequestAmountIn),
111
+ );
112
+ }
113
+
114
+ /** @internal */
115
+ export type CreditSwapRequestSlippage$Outbound = number | string;
116
+
117
+ /** @internal */
118
+ export const CreditSwapRequestSlippage$outboundSchema: z.ZodType<
119
+ CreditSwapRequestSlippage$Outbound,
120
+ z.ZodTypeDef,
121
+ CreditSwapRequestSlippage
122
+ > = z.union([z.number(), z.string()]);
123
+
124
+ export function creditSwapRequestSlippageToJSON(
125
+ creditSwapRequestSlippage: CreditSwapRequestSlippage,
126
+ ): string {
127
+ return JSON.stringify(
128
+ CreditSwapRequestSlippage$outboundSchema.parse(creditSwapRequestSlippage),
129
+ );
130
+ }
131
+
132
+ /** @internal */
133
+ export const CreditSwapRequestChain$outboundSchema: z.ZodNativeEnum<
134
+ typeof CreditSwapRequestChain
135
+ > = z.nativeEnum(CreditSwapRequestChain);
136
+
137
+ /** @internal */
138
+ export const CreditSwapRequestPricing$outboundSchema: z.ZodNativeEnum<
139
+ typeof CreditSwapRequestPricing
140
+ > = z.nativeEnum(CreditSwapRequestPricing);
141
+
142
+ /** @internal */
143
+ export type CreditSwapRequest$Outbound = {
144
+ action_type?: "V2_SWAP" | undefined;
145
+ token_in: string;
146
+ token_out: string;
147
+ amount_in: number | string;
148
+ slippage?: number | string | undefined;
149
+ owner: string;
150
+ chain: string;
151
+ gas_sponsorship?: boolean | undefined;
152
+ pricing?: string | undefined;
153
+ };
154
+
155
+ /** @internal */
156
+ export const CreditSwapRequest$outboundSchema: z.ZodType<
157
+ CreditSwapRequest$Outbound,
158
+ z.ZodTypeDef,
159
+ CreditSwapRequest
160
+ > = z.object({
161
+ actionType: z.literal("V2_SWAP").optional(),
162
+ tokenIn: z.string(),
163
+ tokenOut: z.string(),
164
+ amountIn: z.union([z.number(), z.string()]),
165
+ slippage: z.union([z.number(), z.string()]).optional(),
166
+ owner: z.string(),
167
+ chain: CreditSwapRequestChain$outboundSchema,
168
+ gasSponsorship: z.boolean().optional(),
169
+ pricing: CreditSwapRequestPricing$outboundSchema.optional(),
170
+ }).transform((v) => {
171
+ return remap$(v, {
172
+ actionType: "action_type",
173
+ tokenIn: "token_in",
174
+ tokenOut: "token_out",
175
+ amountIn: "amount_in",
176
+ gasSponsorship: "gas_sponsorship",
177
+ });
178
+ });
179
+
180
+ export function creditSwapRequestToJSON(
181
+ creditSwapRequest: CreditSwapRequest,
182
+ ): string {
183
+ return JSON.stringify(
184
+ CreditSwapRequest$outboundSchema.parse(creditSwapRequest),
185
+ );
186
+ }
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ BatchedSafeOperationsResponseOutput,
13
+ BatchedSafeOperationsResponseOutput$inboundSchema,
14
+ } from "./batchedsafeoperationsresponseoutput.js";
15
+ import {
16
+ UnsignedTransaction,
17
+ UnsignedTransaction$inboundSchema,
18
+ } from "./unsignedtransaction.js";
19
+
20
+ /**
21
+ * Identifies which route priced the swap. 'market': a DEX aggregator, slippage-bounded. 'firm': a zero-slippage quote that fills exactly or reverts. Always present. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED, and under 'auto' a firm build can fall back to market transparently.
22
+ */
23
+ export const CreditSwapResponseSwapProvider = {
24
+ Market: "market",
25
+ Firm: "firm",
26
+ } as const;
27
+ /**
28
+ * Identifies which route priced the swap. 'market': a DEX aggregator, slippage-bounded. 'firm': a zero-slippage quote that fills exactly or reverts. Always present. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED, and under 'auto' a firm build can fall back to market transparently.
29
+ */
30
+ export type CreditSwapResponseSwapProvider = ClosedEnum<
31
+ typeof CreditSwapResponseSwapProvider
32
+ >;
33
+
34
+ /**
35
+ * The swap transaction to sign, plus which route priced it and how long
36
+ *
37
+ * @remarks
38
+ * that price holds.
39
+ */
40
+ export type CreditSwapResponse = {
41
+ /**
42
+ * Unsigned transaction for direct execution. Present when gas_sponsorship=false.
43
+ */
44
+ transaction?: UnsignedTransaction | null | undefined;
45
+ /**
46
+ * EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
47
+ */
48
+ eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
49
+ /**
50
+ * Estimated amount of output token received from the swap. Exact on firm builds (a firm quote fills at this amount or reverts). On market builds it is a quote-time estimate, and `slippage` sets how far below it the transaction's enforced minimum output sits.
51
+ */
52
+ estimatedAmountOut: string;
53
+ /**
54
+ * Identifies which route priced the swap. 'market': a DEX aggregator, slippage-bounded. 'firm': a zero-slippage quote that fills exactly or reverts. Always present. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED, and under 'auto' a firm build can fall back to market transparently.
55
+ */
56
+ swapProvider?: CreditSwapResponseSwapProvider | undefined;
57
+ /**
58
+ * Deadline of the firm swap quote. Sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Null on market builds.
59
+ */
60
+ quoteExpiresAt?: Date | null | undefined;
61
+ };
62
+
63
+ /** @internal */
64
+ export const CreditSwapResponseSwapProvider$inboundSchema: z.ZodNativeEnum<
65
+ typeof CreditSwapResponseSwapProvider
66
+ > = z.nativeEnum(CreditSwapResponseSwapProvider);
67
+
68
+ /** @internal */
69
+ export const CreditSwapResponse$inboundSchema: z.ZodType<
70
+ CreditSwapResponse,
71
+ z.ZodTypeDef,
72
+ unknown
73
+ > = z.object({
74
+ transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
75
+ eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
76
+ .optional(),
77
+ estimated_amount_out: z.string(),
78
+ swap_provider: CreditSwapResponseSwapProvider$inboundSchema.optional(),
79
+ quote_expires_at: z.nullable(
80
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
81
+ ).optional(),
82
+ }).transform((v) => {
83
+ return remap$(v, {
84
+ "eip_712": "eip712",
85
+ "estimated_amount_out": "estimatedAmountOut",
86
+ "swap_provider": "swapProvider",
87
+ "quote_expires_at": "quoteExpiresAt",
88
+ });
89
+ });
90
+
91
+ export function creditSwapResponseFromJSON(
92
+ jsonString: string,
93
+ ): SafeParseResult<CreditSwapResponse, SDKValidationError> {
94
+ return safeParse(
95
+ jsonString,
96
+ (x) => CreditSwapResponse$inboundSchema.parse(JSON.parse(x)),
97
+ `Failed to parse 'CreditSwapResponse' from JSON`,
98
+ );
99
+ }
@@ -17,11 +17,10 @@ export type EarnSwapRequestAmountIn = number | string;
17
17
  export type EarnSwapRequestSlippage = number | string;
18
18
 
19
19
  /**
20
- * Request model for swap endpoint.
20
+ * Swap one token held in the Earn Account for another, in a single atomic
21
21
  *
22
22
  * @remarks
23
- *
24
- * Inherits swap params and adds context fields (owner, chain, gas_sponsorship).
23
+ * transaction.
25
24
  */
26
25
  export type EarnSwapRequest = {
27
26
  /**
@@ -52,6 +52,10 @@ export type EulerMarket = {
52
52
  * Current supply APY for this market (yield for supplying the asset), in percentage (e.g. 3.45 means 3.45%). Null if the rate is unavailable.
53
53
  */
54
54
  supplyApy?: string | null | undefined;
55
+ /**
56
+ * What the borrowable asset earns inside its own price, in percentage, trailing 7 days. Debt owed in such a token grows by this on top of borrow_apy — a borrower's true cost is their sum. Null means unmeasured, NOT zero.
57
+ */
58
+ intrinsicApy?: string | null | undefined;
55
59
  /**
56
60
  * Asset available to borrow right now (vault cash), in token units. A borrow larger than this reverts even if the account is healthy.
57
61
  */
@@ -68,6 +72,14 @@ export type EulerMarket = {
68
72
  * Borrowed share of supplied assets, in percentage 0-100.
69
73
  */
70
74
  utilization: string;
75
+ /**
76
+ * Total asset supplied to this market in USD (total_supply_assets priced by the shared request-time feed). Null when the price feed can't quote the asset — size in token units instead.
77
+ */
78
+ tvlUsd?: string | null | undefined;
79
+ /**
80
+ * Asset available to borrow right now in USD (available_liquidity priced by the shared request-time feed; vault cash equals supplied minus borrowed). Null when the price feed can't quote the asset.
81
+ */
82
+ liquidityUsd?: string | null | undefined;
71
83
  /**
72
84
  * Maximum total supply allowed, in token units. Null when the market is uncapped.
73
85
  */
@@ -97,10 +109,13 @@ export const EulerMarket$inboundSchema: z.ZodType<
97
109
  unit_of_account_symbol: z.nullable(z.string()).optional(),
98
110
  borrow_apy: z.nullable(z.string()).optional(),
99
111
  supply_apy: z.nullable(z.string()).optional(),
112
+ intrinsic_apy: z.nullable(z.string()).optional(),
100
113
  available_liquidity: z.string(),
101
114
  total_supply_assets: z.string(),
102
115
  total_borrow_assets: z.string(),
103
116
  utilization: z.string(),
117
+ tvl_usd: z.nullable(z.string()).optional(),
118
+ liquidity_usd: z.nullable(z.string()).optional(),
104
119
  supply_cap: z.nullable(z.string()).optional(),
105
120
  borrow_cap: z.nullable(z.string()).optional(),
106
121
  collaterals: z.array(EulerMarketCollateral$inboundSchema).optional(),
@@ -113,9 +128,12 @@ export const EulerMarket$inboundSchema: z.ZodType<
113
128
  "unit_of_account_symbol": "unitOfAccountSymbol",
114
129
  "borrow_apy": "borrowApy",
115
130
  "supply_apy": "supplyApy",
131
+ "intrinsic_apy": "intrinsicApy",
116
132
  "available_liquidity": "availableLiquidity",
117
133
  "total_supply_assets": "totalSupplyAssets",
118
134
  "total_borrow_assets": "totalBorrowAssets",
135
+ "tvl_usd": "tvlUsd",
136
+ "liquidity_usd": "liquidityUsd",
119
137
  "supply_cap": "supplyCap",
120
138
  "borrow_cap": "borrowCap",
121
139
  });
@@ -44,6 +44,10 @@ export type EulerMarketCollateral = {
44
44
  * Current supply APY earned on this collateral while it backs a loan, in percentage (e.g. 3.5 means 3.5%). Null if the rate is unavailable.
45
45
  */
46
46
  supplyApy?: string | null | undefined;
47
+ /**
48
+ * What the collateral token earns inside its own price, in percentage: an ERC-4626 share's vault yield, a staking token's rewards, or an RWA token's NAV accrual, trailing 7 days. Earned on top of supply_apy — the collateral leg's whole yield is their sum. Null means unmeasured, NOT zero: a plain token (USDC, cbBTC) earns nothing and a yield-bearing one may simply not be indexed yet.
49
+ */
50
+ intrinsicApy?: string | null | undefined;
47
51
  };
48
52
 
49
53
  /** @internal */
@@ -60,6 +64,7 @@ export const EulerMarketCollateral$inboundSchema: z.ZodType<
60
64
  borrow_ltv: z.string(),
61
65
  liquidation_ltv: z.string(),
62
66
  supply_apy: z.nullable(z.string()).optional(),
67
+ intrinsic_apy: z.nullable(z.string()).optional(),
63
68
  }).transform((v) => {
64
69
  return remap$(v, {
65
70
  "asset_symbol": "assetSymbol",
@@ -68,6 +73,7 @@ export const EulerMarketCollateral$inboundSchema: z.ZodType<
68
73
  "borrow_ltv": "borrowLtv",
69
74
  "liquidation_ltv": "liquidationLtv",
70
75
  "supply_apy": "supplyApy",
76
+ "intrinsic_apy": "intrinsicApy",
71
77
  });
72
78
  });
73
79
 
@@ -115,6 +115,8 @@ export * from "./creditrepayparams.js";
115
115
  export * from "./creditrepayrequest.js";
116
116
  export * from "./creditrepayresponse.js";
117
117
  export * from "./creditsupplyparams.js";
118
+ export * from "./creditswaprequest.js";
119
+ export * from "./creditswapresponse.js";
118
120
  export * from "./credittransferrequest.js";
119
121
  export * from "./credittransferresponse.js";
120
122
  export * from "./credittransfertoaddressparams.js";
@@ -16,6 +16,7 @@ export const V2EarnSwapQuoteChain = {
16
16
  Hyperevm: "hyperevm",
17
17
  Tempo: "tempo",
18
18
  Bsc: "bsc",
19
+ Robinhood: "robinhood",
19
20
  EthereumSepolia: "ethereum_sepolia",
20
21
  } as const;
21
22
  /**
@@ -15,6 +15,7 @@ export const V2TokenizedAssetsBalancesChain = {
15
15
  Hyperevm: "hyperevm",
16
16
  Tempo: "tempo",
17
17
  Bsc: "bsc",
18
+ Robinhood: "robinhood",
18
19
  EthereumSepolia: "ethereum_sepolia",
19
20
  } as const;
20
21
  /**
@@ -16,6 +16,7 @@ export const V2TokenizedAssetsMarketsSymbolChain = {
16
16
  Hyperevm: "hyperevm",
17
17
  Tempo: "tempo",
18
18
  Bsc: "bsc",
19
+ Robinhood: "robinhood",
19
20
  EthereumSepolia: "ethereum_sepolia",
20
21
  } as const;
21
22
  /**
@@ -15,6 +15,7 @@ export const V2TokenizedAssetsPositionsChain = {
15
15
  Hyperevm: "hyperevm",
16
16
  Tempo: "tempo",
17
17
  Bsc: "bsc",
18
+ Robinhood: "robinhood",
18
19
  EthereumSepolia: "ethereum_sepolia",
19
20
  } as const;
20
21
  /**
@@ -15,6 +15,7 @@ export const V2TokenizedAssetsRedemptionsChain = {
15
15
  Hyperevm: "hyperevm",
16
16
  Tempo: "tempo",
17
17
  Bsc: "bsc",
18
+ Robinhood: "robinhood",
18
19
  EthereumSepolia: "ethereum_sepolia",
19
20
  } as const;
20
21
  /**