@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
|
@@ -16,18 +16,20 @@ let value: EarnSwapRequest = {
|
|
|
16
16
|
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
|
|
17
17
|
chain: "base",
|
|
18
18
|
gasSponsorship: false,
|
|
19
|
+
pricing: "auto",
|
|
19
20
|
};
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
## Fields
|
|
23
24
|
|
|
24
|
-
| Field
|
|
25
|
-
|
|
|
26
|
-
| `actionType`
|
|
27
|
-
| `tokenIn`
|
|
28
|
-
| `tokenOut`
|
|
29
|
-
| `amountIn`
|
|
30
|
-
| `slippage`
|
|
31
|
-
| `owner`
|
|
32
|
-
| `chain`
|
|
33
|
-
| `gasSponsorship`
|
|
25
|
+
| Field | Type | Required | Description | Example |
|
|
26
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `actionType` | *"V2_SWAP"* | :heavy_minus_sign: | Action type identifier for swap operations. | V2_SWAP |
|
|
28
|
+
| `tokenIn` | *string* | :heavy_check_mark: | Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address. | USDC |
|
|
29
|
+
| `tokenOut` | *string* | :heavy_check_mark: | Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address. | USDT |
|
|
30
|
+
| `amountIn` | *components.EarnSwapRequestAmountIn* | :heavy_check_mark: | Human-readable amount of `token_in` to swap (token units, not wei). | 0.01 |
|
|
31
|
+
| `slippage` | *components.EarnSwapRequestSlippage* | :heavy_minus_sign: | Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). | 0.5 |
|
|
32
|
+
| `owner` | *string* | :heavy_check_mark: | The owner's wallet address. | 0x06A9aF046187895AcFc7258450B15397CAc67400 |
|
|
33
|
+
| `chain` | [components.EarnSwapRequestChain](../../models/components/earnswaprequestchain.md) | :heavy_check_mark: | Target blockchain network where the swap will execute. | base |
|
|
34
|
+
| `gasSponsorship` | *boolean* | :heavy_minus_sign: | 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`). Firm-priced builds may be sponsored: the sponsor must broadcast before `quote_expires_at`. | false |
|
|
35
|
+
| `pricing` | [components.EarnSwapRequestPricing](../../models/components/earnswaprequestpricing.md) | :heavy_minus_sign: | Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline. | auto |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# EarnSwapRequestPricing
|
|
2
|
+
|
|
3
|
+
Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { EarnSwapRequestPricing } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: EarnSwapRequestPricing = "auto";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Values
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
"auto" | "firm" | "market"
|
|
17
|
+
```
|
|
@@ -7,13 +7,16 @@ import { EarnSwapResponse } from "@compass-labs/api-sdk/models/components";
|
|
|
7
7
|
|
|
8
8
|
let value: EarnSwapResponse = {
|
|
9
9
|
estimatedAmountOut: "<value>",
|
|
10
|
+
swapProvider: "market",
|
|
10
11
|
};
|
|
11
12
|
```
|
|
12
13
|
|
|
13
14
|
## Fields
|
|
14
15
|
|
|
15
|
-
| Field
|
|
16
|
-
|
|
|
17
|
-
| `transaction`
|
|
18
|
-
| `eip712`
|
|
19
|
-
| `estimatedAmountOut`
|
|
16
|
+
| Field | Type | Required | Description | Example |
|
|
17
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution. Present when gas_sponsorship=false. | |
|
|
19
|
+
| `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. | |
|
|
20
|
+
| `estimatedAmountOut` | *string* | :heavy_check_mark: | 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. | |
|
|
21
|
+
| `swapProvider` | [components.EarnSwapResponseSwapProvider](../../models/components/earnswapresponseswapprovider.md) | :heavy_minus_sign: | 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. | market |
|
|
22
|
+
| `quoteExpiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | 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. | |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# EarnSwapResponseSwapProvider
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { EarnSwapResponseSwapProvider } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: EarnSwapResponseSwapProvider = "market";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Values
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
"market" | "firm"
|
|
17
|
+
```
|
|
@@ -12,8 +12,10 @@ let value: V2BundleResponse = {
|
|
|
12
12
|
|
|
13
13
|
## Fields
|
|
14
14
|
|
|
15
|
-
| Field
|
|
16
|
-
|
|
|
17
|
-
| `transaction`
|
|
18
|
-
| `eip712`
|
|
19
|
-
| `actionsCount`
|
|
15
|
+
| Field | Type | Required | Description |
|
|
16
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false. |
|
|
18
|
+
| `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare. |
|
|
19
|
+
| `actionsCount` | *number* | :heavy_check_mark: | Number of individual transactions bundled in this execution. |
|
|
20
|
+
| `swapProvider` | [components.V2BundleResponseSwapProvider](../../models/components/v2bundleresponseswapprovider.md) | :heavy_minus_sign: | 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. |
|
|
21
|
+
| `quoteExpiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | 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. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# V2BundleResponseSwapProvider
|
|
2
|
+
|
|
3
|
+
## Example Usage
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { V2BundleResponseSwapProvider } from "@compass-labs/api-sdk/models/components";
|
|
7
|
+
|
|
8
|
+
let value: V2BundleResponseSwapProvider = "firm";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Values
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
"market" | "firm"
|
|
15
|
+
```
|
package/docs/sdks/earn/README.md
CHANGED
|
@@ -441,8 +441,11 @@ run();
|
|
|
441
441
|
Estimate the output of a swap without building a transaction.
|
|
442
442
|
|
|
443
443
|
Returns the expected amount of `token_out` received for selling `amount_in`
|
|
444
|
-
of `token_in
|
|
445
|
-
|
|
444
|
+
of `token_in`. On chains with a market route this is the market rate; on
|
|
445
|
+
HyperEVM, where swaps are firm-priced, it is an indicative price from the
|
|
446
|
+
firm provider's live levels (`swap_provider` tells you which). This is
|
|
447
|
+
read-only: it does not build a transaction, require an account, or check
|
|
448
|
+
balances.
|
|
446
449
|
|
|
447
450
|
Use it to gauge exit liquidity and price impact for a token before entering
|
|
448
451
|
a position — for example, to warn when a market's underlying asset cannot be
|
|
@@ -926,6 +929,7 @@ async function run() {
|
|
|
926
929
|
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
|
|
927
930
|
chain: "base",
|
|
928
931
|
gasSponsorship: false,
|
|
932
|
+
pricing: "auto",
|
|
929
933
|
});
|
|
930
934
|
|
|
931
935
|
console.log(result);
|
|
@@ -957,6 +961,7 @@ async function run() {
|
|
|
957
961
|
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
|
|
958
962
|
chain: "base",
|
|
959
963
|
gasSponsorship: false,
|
|
964
|
+
pricing: "auto",
|
|
960
965
|
});
|
|
961
966
|
if (res.ok) {
|
|
962
967
|
const { value: result } = res;
|
|
@@ -5359,7 +5359,7 @@
|
|
|
5359
5359
|
"Earn"
|
|
5360
5360
|
],
|
|
5361
5361
|
"summary": "Quote a swap",
|
|
5362
|
-
"description": "Estimate the output of a swap without building a transaction.\n\nReturns the expected amount of `token_out` received for selling `amount_in`\nof `token_in
|
|
5362
|
+
"description": "Estimate the output of a swap without building a transaction.\n\nReturns the expected amount of `token_out` received for selling `amount_in`\nof `token_in`. On chains with a market route this is the market rate; on\nHyperEVM, where swaps are firm-priced, it is an indicative price from the\nfirm provider's live levels (`swap_provider` tells you which). This is\nread-only: it does not build a transaction, require an account, or check\nbalances.\n\nUse it to gauge exit liquidity and price impact for a token before entering\na position \u2014 for example, to warn when a market's underlying asset cannot be\nswapped back to a stablecoin without large slippage.",
|
|
5363
5363
|
"operationId": "v2_earn_swap_quote",
|
|
5364
5364
|
"parameters": [
|
|
5365
5365
|
{
|
|
@@ -15628,7 +15628,7 @@
|
|
|
15628
15628
|
"amount_out": {
|
|
15629
15629
|
"type": "string",
|
|
15630
15630
|
"title": "Amount Out",
|
|
15631
|
-
"description": "Estimated amount of `token_out` received, in human-readable units.
|
|
15631
|
+
"description": "Estimated amount of `token_out` received, in human-readable units. On the market route, zero when no route / insufficient liquidity exists for the pair (a definitive answer). On the firm route (HyperEVM) a missing or short price book is a 409 instead, never a zero: unlike a missing route it is transient, so retry."
|
|
15632
15632
|
},
|
|
15633
15633
|
"token_in": {
|
|
15634
15634
|
"type": "string",
|
|
@@ -15639,6 +15639,16 @@
|
|
|
15639
15639
|
"type": "string",
|
|
15640
15640
|
"title": "Token Out",
|
|
15641
15641
|
"description": "The token address quoted as output \u2014 what `amount_out` is denominated in (the resolved `token_out` from the request)."
|
|
15642
|
+
},
|
|
15643
|
+
"swap_provider": {
|
|
15644
|
+
"type": "string",
|
|
15645
|
+
"enum": [
|
|
15646
|
+
"market",
|
|
15647
|
+
"firm"
|
|
15648
|
+
],
|
|
15649
|
+
"title": "Swap Provider",
|
|
15650
|
+
"description": "Which route priced the estimate. 'market': the market aggregator's price-only quote. 'firm': an INDICATIVE price from the firm provider's live levels (HyperEVM), computed without spending a quote; the executable build fetches the firm quote itself. When those levels cannot price `amount_in` the endpoint answers 409 rather than a zero `amount_out`.",
|
|
15651
|
+
"example": "market"
|
|
15642
15652
|
}
|
|
15643
15653
|
},
|
|
15644
15654
|
"type": "object",
|
|
@@ -15723,8 +15733,19 @@
|
|
|
15723
15733
|
"gas_sponsorship": {
|
|
15724
15734
|
"type": "boolean",
|
|
15725
15735
|
"title": "Gas Sponsorship",
|
|
15726
|
-
"description": "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`).",
|
|
15736
|
+
"description": "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`). Firm-priced builds may be sponsored: the sponsor must broadcast before `quote_expires_at`.",
|
|
15727
15737
|
"example": false
|
|
15738
|
+
},
|
|
15739
|
+
"pricing": {
|
|
15740
|
+
"type": "string",
|
|
15741
|
+
"enum": [
|
|
15742
|
+
"auto",
|
|
15743
|
+
"firm",
|
|
15744
|
+
"market"
|
|
15745
|
+
],
|
|
15746
|
+
"title": "Pricing",
|
|
15747
|
+
"description": "Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline.",
|
|
15748
|
+
"example": "auto"
|
|
15728
15749
|
}
|
|
15729
15750
|
},
|
|
15730
15751
|
"type": "object",
|
|
@@ -15744,7 +15765,8 @@
|
|
|
15744
15765
|
"token_out": "USDT",
|
|
15745
15766
|
"amount_in": "0.01",
|
|
15746
15767
|
"slippage": "0.5",
|
|
15747
|
-
"gas_sponsorship": false
|
|
15768
|
+
"gas_sponsorship": false,
|
|
15769
|
+
"pricing": "auto"
|
|
15748
15770
|
}
|
|
15749
15771
|
},
|
|
15750
15772
|
"EarnSwapResponse": {
|
|
@@ -15775,7 +15797,30 @@
|
|
|
15775
15797
|
"type": "string",
|
|
15776
15798
|
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
|
|
15777
15799
|
"title": "Estimated Amount Out",
|
|
15778
|
-
"description": "Estimated amount of output token received from the swap."
|
|
15800
|
+
"description": "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."
|
|
15801
|
+
},
|
|
15802
|
+
"swap_provider": {
|
|
15803
|
+
"type": "string",
|
|
15804
|
+
"enum": [
|
|
15805
|
+
"market",
|
|
15806
|
+
"firm"
|
|
15807
|
+
],
|
|
15808
|
+
"title": "Swap Provider",
|
|
15809
|
+
"description": "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.",
|
|
15810
|
+
"example": "market"
|
|
15811
|
+
},
|
|
15812
|
+
"quote_expires_at": {
|
|
15813
|
+
"anyOf": [
|
|
15814
|
+
{
|
|
15815
|
+
"type": "string",
|
|
15816
|
+
"format": "date-time"
|
|
15817
|
+
},
|
|
15818
|
+
{
|
|
15819
|
+
"type": "null"
|
|
15820
|
+
}
|
|
15821
|
+
],
|
|
15822
|
+
"title": "Quote Expires At",
|
|
15823
|
+
"description": "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."
|
|
15779
15824
|
}
|
|
15780
15825
|
},
|
|
15781
15826
|
"type": "object",
|
|
@@ -28484,6 +28529,35 @@
|
|
|
28484
28529
|
"type": "integer",
|
|
28485
28530
|
"title": "Actions Count",
|
|
28486
28531
|
"description": "Number of individual transactions bundled in this execution."
|
|
28532
|
+
},
|
|
28533
|
+
"swap_provider": {
|
|
28534
|
+
"anyOf": [
|
|
28535
|
+
{
|
|
28536
|
+
"type": "string",
|
|
28537
|
+
"enum": [
|
|
28538
|
+
"market",
|
|
28539
|
+
"firm"
|
|
28540
|
+
]
|
|
28541
|
+
},
|
|
28542
|
+
{
|
|
28543
|
+
"type": "null"
|
|
28544
|
+
}
|
|
28545
|
+
],
|
|
28546
|
+
"title": "Swap Provider",
|
|
28547
|
+
"description": "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."
|
|
28548
|
+
},
|
|
28549
|
+
"quote_expires_at": {
|
|
28550
|
+
"anyOf": [
|
|
28551
|
+
{
|
|
28552
|
+
"type": "string",
|
|
28553
|
+
"format": "date-time"
|
|
28554
|
+
},
|
|
28555
|
+
{
|
|
28556
|
+
"type": "null"
|
|
28557
|
+
}
|
|
28558
|
+
],
|
|
28559
|
+
"title": "Quote Expires At",
|
|
28560
|
+
"description": "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."
|
|
28487
28561
|
}
|
|
28488
28562
|
},
|
|
28489
28563
|
"type": "object",
|
package/package.json
CHANGED
|
@@ -34,8 +34,11 @@ import { Result } from "../types/fp.js";
|
|
|
34
34
|
* Estimate the output of a swap without building a transaction.
|
|
35
35
|
*
|
|
36
36
|
* Returns the expected amount of `token_out` received for selling `amount_in`
|
|
37
|
-
* of `token_in
|
|
38
|
-
*
|
|
37
|
+
* of `token_in`. On chains with a market route this is the market rate; on
|
|
38
|
+
* HyperEVM, where swaps are firm-priced, it is an indicative price from the
|
|
39
|
+
* firm provider's live levels (`swap_provider` tells you which). This is
|
|
40
|
+
* read-only: it does not build a transaction, require an account, or check
|
|
41
|
+
* balances.
|
|
39
42
|
*
|
|
40
43
|
* Use it to gauge exit liquidity and price impact for a token before entering
|
|
41
44
|
* a position — for example, to warn when a market's underlying asset cannot be
|
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.
|
|
65
|
+
genVersion: "2.941.0",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.941.0 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -5,15 +5,30 @@
|
|
|
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
|
|
|
12
|
+
/**
|
|
13
|
+
* Which route priced the estimate. 'market': the market aggregator's price-only quote. 'firm': an INDICATIVE price from the firm provider's live levels (HyperEVM), computed without spending a quote; the executable build fetches the firm quote itself. When those levels cannot price `amount_in` the endpoint answers 409 rather than a zero `amount_out`.
|
|
14
|
+
*/
|
|
15
|
+
export const EarnSwapQuoteResponseSwapProvider = {
|
|
16
|
+
Market: "market",
|
|
17
|
+
Firm: "firm",
|
|
18
|
+
} as const;
|
|
19
|
+
/**
|
|
20
|
+
* Which route priced the estimate. 'market': the market aggregator's price-only quote. 'firm': an INDICATIVE price from the firm provider's live levels (HyperEVM), computed without spending a quote; the executable build fetches the firm quote itself. When those levels cannot price `amount_in` the endpoint answers 409 rather than a zero `amount_out`.
|
|
21
|
+
*/
|
|
22
|
+
export type EarnSwapQuoteResponseSwapProvider = ClosedEnum<
|
|
23
|
+
typeof EarnSwapQuoteResponseSwapProvider
|
|
24
|
+
>;
|
|
25
|
+
|
|
11
26
|
/**
|
|
12
27
|
* Estimated output of a read-only swap quote.
|
|
13
28
|
*/
|
|
14
29
|
export type EarnSwapQuoteResponse = {
|
|
15
30
|
/**
|
|
16
|
-
* Estimated amount of `token_out` received, in human-readable units.
|
|
31
|
+
* Estimated amount of `token_out` received, in human-readable units. On the market route, zero when no route / insufficient liquidity exists for the pair (a definitive answer). On the firm route (HyperEVM) a missing or short price book is a 409 instead, never a zero: unlike a missing route it is transient, so retry.
|
|
17
32
|
*/
|
|
18
33
|
amountOut: string;
|
|
19
34
|
/**
|
|
@@ -24,8 +39,17 @@ export type EarnSwapQuoteResponse = {
|
|
|
24
39
|
* The token address quoted as output — what `amount_out` is denominated in (the resolved `token_out` from the request).
|
|
25
40
|
*/
|
|
26
41
|
tokenOut: string;
|
|
42
|
+
/**
|
|
43
|
+
* Which route priced the estimate. 'market': the market aggregator's price-only quote. 'firm': an INDICATIVE price from the firm provider's live levels (HyperEVM), computed without spending a quote; the executable build fetches the firm quote itself. When those levels cannot price `amount_in` the endpoint answers 409 rather than a zero `amount_out`.
|
|
44
|
+
*/
|
|
45
|
+
swapProvider?: EarnSwapQuoteResponseSwapProvider | undefined;
|
|
27
46
|
};
|
|
28
47
|
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const EarnSwapQuoteResponseSwapProvider$inboundSchema: z.ZodNativeEnum<
|
|
50
|
+
typeof EarnSwapQuoteResponseSwapProvider
|
|
51
|
+
> = z.nativeEnum(EarnSwapQuoteResponseSwapProvider);
|
|
52
|
+
|
|
29
53
|
/** @internal */
|
|
30
54
|
export const EarnSwapQuoteResponse$inboundSchema: z.ZodType<
|
|
31
55
|
EarnSwapQuoteResponse,
|
|
@@ -35,11 +59,13 @@ export const EarnSwapQuoteResponse$inboundSchema: z.ZodType<
|
|
|
35
59
|
amount_out: z.string(),
|
|
36
60
|
token_in: z.string(),
|
|
37
61
|
token_out: z.string(),
|
|
62
|
+
swap_provider: EarnSwapQuoteResponseSwapProvider$inboundSchema.optional(),
|
|
38
63
|
}).transform((v) => {
|
|
39
64
|
return remap$(v, {
|
|
40
65
|
"amount_out": "amountOut",
|
|
41
66
|
"token_in": "tokenIn",
|
|
42
67
|
"token_out": "tokenOut",
|
|
68
|
+
"swap_provider": "swapProvider",
|
|
43
69
|
});
|
|
44
70
|
});
|
|
45
71
|
|
|
@@ -32,6 +32,19 @@ export const EarnSwapRequestChain = {
|
|
|
32
32
|
*/
|
|
33
33
|
export type EarnSwapRequestChain = ClosedEnum<typeof EarnSwapRequestChain>;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline.
|
|
37
|
+
*/
|
|
38
|
+
export const EarnSwapRequestPricing = {
|
|
39
|
+
Auto: "auto",
|
|
40
|
+
Firm: "firm",
|
|
41
|
+
Market: "market",
|
|
42
|
+
} as const;
|
|
43
|
+
/**
|
|
44
|
+
* Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline.
|
|
45
|
+
*/
|
|
46
|
+
export type EarnSwapRequestPricing = ClosedEnum<typeof EarnSwapRequestPricing>;
|
|
47
|
+
|
|
35
48
|
/**
|
|
36
49
|
* Swap one token held in the Earn Account for another, in a single atomic
|
|
37
50
|
*
|
|
@@ -68,9 +81,13 @@ export type EarnSwapRequest = {
|
|
|
68
81
|
*/
|
|
69
82
|
chain: EarnSwapRequestChain;
|
|
70
83
|
/**
|
|
71
|
-
* 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`).
|
|
84
|
+
* 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`). Firm-priced builds may be sponsored: the sponsor must broadcast before `quote_expires_at`.
|
|
72
85
|
*/
|
|
73
86
|
gasSponsorship?: boolean | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Swap routing policy. 'auto': on chains with a market route the swap is priced by the market aggregator and bounded by `slippage` (the default behaviour); on HyperEVM, where only firm pricing is available, it is a firm zero-slippage quote that fills exactly or reverts. 'firm': always a firm quote; refused with a typed 409 when no firm quote covers the pair right now, never silently priced at market. 'market': always the market route; refused with 422 on HyperEVM. Read `swap_provider` on the response for the route that actually priced the build, and `quote_expires_at` for a firm quote's deadline.
|
|
89
|
+
*/
|
|
90
|
+
pricing?: EarnSwapRequestPricing | undefined;
|
|
74
91
|
};
|
|
75
92
|
|
|
76
93
|
/** @internal */
|
|
@@ -114,6 +131,11 @@ export const EarnSwapRequestChain$outboundSchema: z.ZodNativeEnum<
|
|
|
114
131
|
typeof EarnSwapRequestChain
|
|
115
132
|
> = z.nativeEnum(EarnSwapRequestChain);
|
|
116
133
|
|
|
134
|
+
/** @internal */
|
|
135
|
+
export const EarnSwapRequestPricing$outboundSchema: z.ZodNativeEnum<
|
|
136
|
+
typeof EarnSwapRequestPricing
|
|
137
|
+
> = z.nativeEnum(EarnSwapRequestPricing);
|
|
138
|
+
|
|
117
139
|
/** @internal */
|
|
118
140
|
export type EarnSwapRequest$Outbound = {
|
|
119
141
|
action_type?: "V2_SWAP" | undefined;
|
|
@@ -124,6 +146,7 @@ export type EarnSwapRequest$Outbound = {
|
|
|
124
146
|
owner: string;
|
|
125
147
|
chain: string;
|
|
126
148
|
gas_sponsorship?: boolean | undefined;
|
|
149
|
+
pricing?: string | undefined;
|
|
127
150
|
};
|
|
128
151
|
|
|
129
152
|
/** @internal */
|
|
@@ -140,6 +163,7 @@ export const EarnSwapRequest$outboundSchema: z.ZodType<
|
|
|
140
163
|
owner: z.string(),
|
|
141
164
|
chain: EarnSwapRequestChain$outboundSchema,
|
|
142
165
|
gasSponsorship: z.boolean().optional(),
|
|
166
|
+
pricing: EarnSwapRequestPricing$outboundSchema.optional(),
|
|
143
167
|
}).transform((v) => {
|
|
144
168
|
return remap$(v, {
|
|
145
169
|
actionType: "action_type",
|