@compass-labs/api-sdk 2.2.112-rc.1 → 2.2.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codeSamples_typescript.yaml +1 -1
- package/dist/commonjs/funcs/earnEarnSwapQuote.d.ts +5 -2
- package/dist/commonjs/funcs/earnEarnSwapQuote.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnSwapQuote.js +5 -2
- package/dist/commonjs/funcs/earnEarnSwapQuote.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/earnswapquoteresponse.d.ts +19 -1
- package/dist/commonjs/models/components/earnswapquoteresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnswapquoteresponse.js +12 -1
- package/dist/commonjs/models/components/earnswapquoteresponse.js.map +1 -1
- package/dist/commonjs/models/components/earnswaprequest.d.ts +20 -1
- package/dist/commonjs/models/components/earnswaprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnswaprequest.js +12 -1
- package/dist/commonjs/models/components/earnswaprequest.js.map +1 -1
- package/dist/commonjs/models/components/earnswapresponse.d.ts +23 -1
- package/dist/commonjs/models/components/earnswapresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnswapresponse.js +14 -1
- package/dist/commonjs/models/components/earnswapresponse.js.map +1 -1
- package/dist/commonjs/models/components/v2bundleresponse.d.ts +16 -0
- package/dist/commonjs/models/components/v2bundleresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2bundleresponse.js +12 -1
- package/dist/commonjs/models/components/v2bundleresponse.js.map +1 -1
- package/dist/commonjs/sdk/earn.d.ts +5 -2
- package/dist/commonjs/sdk/earn.d.ts.map +1 -1
- package/dist/commonjs/sdk/earn.js +5 -2
- package/dist/commonjs/sdk/earn.js.map +1 -1
- package/dist/esm/funcs/earnEarnSwapQuote.d.ts +5 -2
- package/dist/esm/funcs/earnEarnSwapQuote.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnSwapQuote.js +5 -2
- package/dist/esm/funcs/earnEarnSwapQuote.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/earnswapquoteresponse.d.ts +19 -1
- package/dist/esm/models/components/earnswapquoteresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earnswapquoteresponse.js +11 -0
- package/dist/esm/models/components/earnswapquoteresponse.js.map +1 -1
- package/dist/esm/models/components/earnswaprequest.d.ts +20 -1
- package/dist/esm/models/components/earnswaprequest.d.ts.map +1 -1
- package/dist/esm/models/components/earnswaprequest.js +11 -0
- package/dist/esm/models/components/earnswaprequest.js.map +1 -1
- package/dist/esm/models/components/earnswapresponse.d.ts +23 -1
- package/dist/esm/models/components/earnswapresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earnswapresponse.js +13 -0
- package/dist/esm/models/components/earnswapresponse.js.map +1 -1
- package/dist/esm/models/components/v2bundleresponse.d.ts +16 -0
- package/dist/esm/models/components/v2bundleresponse.d.ts.map +1 -1
- package/dist/esm/models/components/v2bundleresponse.js +11 -0
- package/dist/esm/models/components/v2bundleresponse.js.map +1 -1
- package/dist/esm/sdk/earn.d.ts +5 -2
- package/dist/esm/sdk/earn.d.ts.map +1 -1
- package/dist/esm/sdk/earn.js +5 -2
- package/dist/esm/sdk/earn.js.map +1 -1
- package/docs/models/components/earnswapquoteresponse.md +7 -5
- package/docs/models/components/earnswapquoteresponseswapprovider.md +17 -0
- package/docs/models/components/earnswaprequest.md +12 -10
- package/docs/models/components/earnswaprequestpricing.md +17 -0
- package/docs/models/components/earnswapresponse.md +8 -5
- package/docs/models/components/earnswapresponseswapprovider.md +17 -0
- package/docs/models/components/v2bundleresponse.md +7 -5
- package/docs/models/components/v2bundleresponseswapprovider.md +15 -0
- package/docs/sdks/earn/README.md +7 -2
- package/openapi_prepped_for_speakeasy.json +79 -5
- package/package.json +1 -1
- package/src/funcs/earnEarnSwapQuote.ts +5 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/earnswapquoteresponse.ts +27 -1
- package/src/models/components/earnswaprequest.ts +25 -1
- package/src/models/components/earnswapresponse.ts +35 -1
- package/src/models/components/v2bundleresponse.ts +29 -0
- package/src/sdk/earn.ts +5 -2
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -16,6 +17,20 @@ import {
|
|
|
16
17
|
UnsignedTransaction$inboundSchema,
|
|
17
18
|
} from "./unsignedtransaction.js";
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* 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 signal, since `pricing` is only what was requested.
|
|
22
|
+
*/
|
|
23
|
+
export const EarnSwapResponseSwapProvider = {
|
|
24
|
+
Market: "market",
|
|
25
|
+
Firm: "firm",
|
|
26
|
+
} as const;
|
|
27
|
+
/**
|
|
28
|
+
* 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 signal, since `pricing` is only what was requested.
|
|
29
|
+
*/
|
|
30
|
+
export type EarnSwapResponseSwapProvider = ClosedEnum<
|
|
31
|
+
typeof EarnSwapResponseSwapProvider
|
|
32
|
+
>;
|
|
33
|
+
|
|
19
34
|
export type EarnSwapResponse = {
|
|
20
35
|
/**
|
|
21
36
|
* Unsigned transaction for direct execution. Present when gas_sponsorship=false.
|
|
@@ -26,11 +41,24 @@ export type EarnSwapResponse = {
|
|
|
26
41
|
*/
|
|
27
42
|
eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
|
|
28
43
|
/**
|
|
29
|
-
* Estimated amount of output token received from the swap.
|
|
44
|
+
* Estimated amount of output token received from the swap. Exact on firm builds (a firm quote fills at this amount or reverts); a quote-time estimate on market builds, where `slippage` sets how far below it the enforced minimum output sits.
|
|
30
45
|
*/
|
|
31
46
|
estimatedAmountOut: string;
|
|
47
|
+
/**
|
|
48
|
+
* 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 signal, since `pricing` is only what was requested.
|
|
49
|
+
*/
|
|
50
|
+
swapProvider?: EarnSwapResponseSwapProvider | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Deadline of the firm swap quote. The transaction (or the sponsor's broadcast of the signed typed data) must be included before it or the swap reverts on-chain; refresh by re-calling this endpoint and discarding the previous payload. Null on market builds.
|
|
53
|
+
*/
|
|
54
|
+
quoteExpiresAt?: Date | null | undefined;
|
|
32
55
|
};
|
|
33
56
|
|
|
57
|
+
/** @internal */
|
|
58
|
+
export const EarnSwapResponseSwapProvider$inboundSchema: z.ZodNativeEnum<
|
|
59
|
+
typeof EarnSwapResponseSwapProvider
|
|
60
|
+
> = z.nativeEnum(EarnSwapResponseSwapProvider);
|
|
61
|
+
|
|
34
62
|
/** @internal */
|
|
35
63
|
export const EarnSwapResponse$inboundSchema: z.ZodType<
|
|
36
64
|
EarnSwapResponse,
|
|
@@ -41,10 +69,16 @@ export const EarnSwapResponse$inboundSchema: z.ZodType<
|
|
|
41
69
|
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
42
70
|
.optional(),
|
|
43
71
|
estimated_amount_out: z.string(),
|
|
72
|
+
swap_provider: EarnSwapResponseSwapProvider$inboundSchema.optional(),
|
|
73
|
+
quote_expires_at: z.nullable(
|
|
74
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
75
|
+
).optional(),
|
|
44
76
|
}).transform((v) => {
|
|
45
77
|
return remap$(v, {
|
|
46
78
|
"eip_712": "eip712",
|
|
47
79
|
"estimated_amount_out": "estimatedAmountOut",
|
|
80
|
+
"swap_provider": "swapProvider",
|
|
81
|
+
"quote_expires_at": "quoteExpiresAt",
|
|
48
82
|
});
|
|
49
83
|
});
|
|
50
84
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -16,6 +17,14 @@ import {
|
|
|
16
17
|
UnsignedTransaction$inboundSchema,
|
|
17
18
|
} from "./unsignedtransaction.js";
|
|
18
19
|
|
|
20
|
+
export const V2BundleResponseSwapProvider = {
|
|
21
|
+
Market: "market",
|
|
22
|
+
Firm: "firm",
|
|
23
|
+
} as const;
|
|
24
|
+
export type V2BundleResponseSwapProvider = ClosedEnum<
|
|
25
|
+
typeof V2BundleResponseSwapProvider
|
|
26
|
+
>;
|
|
27
|
+
|
|
19
28
|
export type V2BundleResponse = {
|
|
20
29
|
/**
|
|
21
30
|
* Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false.
|
|
@@ -29,8 +38,21 @@ export type V2BundleResponse = {
|
|
|
29
38
|
* Number of individual transactions bundled in this execution.
|
|
30
39
|
*/
|
|
31
40
|
actionsCount: number;
|
|
41
|
+
/**
|
|
42
|
+
* Which route priced the bundle's V2_SWAP action(s): 'market' (a DEX aggregator, slippage-bounded) or 'firm' (a zero-slippage quote that fills exactly or reverts; the only route on HyperEVM). Null when the bundle carries no swap.
|
|
43
|
+
*/
|
|
44
|
+
swapProvider?: V2BundleResponseSwapProvider | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Deadline of the firm swap quote inside the bundle. The transaction (or the sponsor's broadcast of the signed typed data) must be included before it or the bundle reverts on-chain; rebuild after it passes. Null unless a swap action was firm-priced.
|
|
47
|
+
*/
|
|
48
|
+
quoteExpiresAt?: Date | null | undefined;
|
|
32
49
|
};
|
|
33
50
|
|
|
51
|
+
/** @internal */
|
|
52
|
+
export const V2BundleResponseSwapProvider$inboundSchema: z.ZodNativeEnum<
|
|
53
|
+
typeof V2BundleResponseSwapProvider
|
|
54
|
+
> = z.nativeEnum(V2BundleResponseSwapProvider);
|
|
55
|
+
|
|
34
56
|
/** @internal */
|
|
35
57
|
export const V2BundleResponse$inboundSchema: z.ZodType<
|
|
36
58
|
V2BundleResponse,
|
|
@@ -41,10 +63,17 @@ export const V2BundleResponse$inboundSchema: z.ZodType<
|
|
|
41
63
|
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
|
|
42
64
|
.optional(),
|
|
43
65
|
actions_count: z.number().int(),
|
|
66
|
+
swap_provider: z.nullable(V2BundleResponseSwapProvider$inboundSchema)
|
|
67
|
+
.optional(),
|
|
68
|
+
quote_expires_at: z.nullable(
|
|
69
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
70
|
+
).optional(),
|
|
44
71
|
}).transform((v) => {
|
|
45
72
|
return remap$(v, {
|
|
46
73
|
"eip_712": "eip712",
|
|
47
74
|
"actions_count": "actionsCount",
|
|
75
|
+
"swap_provider": "swapProvider",
|
|
76
|
+
"quote_expires_at": "quoteExpiresAt",
|
|
48
77
|
});
|
|
49
78
|
});
|
|
50
79
|
|
package/src/sdk/earn.ts
CHANGED
|
@@ -147,8 +147,11 @@ export class Earn extends ClientSDK {
|
|
|
147
147
|
* Estimate the output of a swap without building a transaction.
|
|
148
148
|
*
|
|
149
149
|
* Returns the expected amount of `token_out` received for selling `amount_in`
|
|
150
|
-
* of `token_in
|
|
151
|
-
*
|
|
150
|
+
* of `token_in`. On chains with a market route this is the market rate; on
|
|
151
|
+
* HyperEVM, where swaps are firm-priced, it is an indicative price from the
|
|
152
|
+
* firm provider's live levels (`swap_provider` tells you which). This is
|
|
153
|
+
* read-only: it does not build a transaction, require an account, or check
|
|
154
|
+
* balances.
|
|
152
155
|
*
|
|
153
156
|
* Use it to gauge exit liquidity and price impact for a token before entering
|
|
154
157
|
* a position — for example, to warn when a market's underlying asset cannot be
|