@compass-labs/api-sdk 0.5.39 → 0.5.41
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/README.md +2 -0
- package/bin/mcp-server.js +467 -253
- package/bin/mcp-server.js.map +13 -9
- package/dist/commonjs/funcs/pendleQuote.d.ts +24 -0
- package/dist/commonjs/funcs/pendleQuote.d.ts.map +1 -0
- package/dist/commonjs/funcs/pendleQuote.js +132 -0
- package/dist/commonjs/funcs/pendleQuote.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/pendleQuote.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/pendleQuote.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleQuote.js +69 -0
- package/dist/commonjs/mcp-server/tools/pendleQuote.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/pendlegetquoteresponse.d.ts +32 -0
- package/dist/commonjs/models/components/pendlegetquoteresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlegetquoteresponse.js +69 -0
- package/dist/commonjs/models/components/pendlegetquoteresponse.js.map +1 -0
- package/dist/commonjs/models/components/vaultgetvaultresponse.d.ts +2 -2
- package/dist/commonjs/models/components/vaultgetvaultresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/vaultgetvaultresponse.js +2 -2
- package/dist/commonjs/models/components/vaultgetvaultresponse.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/pendlequote.d.ts +181 -0
- package/dist/commonjs/models/operations/pendlequote.d.ts.map +1 -0
- package/dist/commonjs/models/operations/pendlequote.js +186 -0
- package/dist/commonjs/models/operations/pendlequote.js.map +1 -0
- package/dist/commonjs/sdk/pendle.d.ts +12 -0
- package/dist/commonjs/sdk/pendle.d.ts.map +1 -1
- package/dist/commonjs/sdk/pendle.js +15 -0
- package/dist/commonjs/sdk/pendle.js.map +1 -1
- package/dist/esm/funcs/pendleQuote.d.ts +24 -0
- package/dist/esm/funcs/pendleQuote.d.ts.map +1 -0
- package/dist/esm/funcs/pendleQuote.js +96 -0
- package/dist/esm/funcs/pendleQuote.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/pendleQuote.d.ts +8 -0
- package/dist/esm/mcp-server/tools/pendleQuote.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/pendleQuote.js +33 -0
- package/dist/esm/mcp-server/tools/pendleQuote.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/pendlegetquoteresponse.d.ts +32 -0
- package/dist/esm/models/components/pendlegetquoteresponse.d.ts.map +1 -0
- package/dist/esm/models/components/pendlegetquoteresponse.js +31 -0
- package/dist/esm/models/components/pendlegetquoteresponse.js.map +1 -0
- package/dist/esm/models/components/vaultgetvaultresponse.d.ts +2 -2
- package/dist/esm/models/components/vaultgetvaultresponse.d.ts.map +1 -1
- package/dist/esm/models/components/vaultgetvaultresponse.js +2 -2
- package/dist/esm/models/components/vaultgetvaultresponse.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/pendlequote.d.ts +181 -0
- package/dist/esm/models/operations/pendlequote.d.ts.map +1 -0
- package/dist/esm/models/operations/pendlequote.js +146 -0
- package/dist/esm/models/operations/pendlequote.js.map +1 -0
- package/dist/esm/sdk/pendle.d.ts +12 -0
- package/dist/esm/sdk/pendle.d.ts.map +1 -1
- package/dist/esm/sdk/pendle.js +15 -0
- package/dist/esm/sdk/pendle.js.map +1 -1
- package/docs/sdks/pendle/README.md +79 -0
- package/docs/sdks/smartaccount/README.md +2 -0
- package/docs/sdks/transactionbundler/README.md +2 -0
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/funcs/pendleQuote.ts +184 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/pendleQuote.ts +42 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/components/pendlegetquoteresponse.ts +69 -0
- package/src/models/components/vaultgetvaultresponse.ts +4 -4
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/pendlequote.ts +265 -0
- package/src/sdk/pendle.ts +23 -0
|
@@ -96,6 +96,7 @@ export * from "./pendlebuyptrequest.js";
|
|
|
96
96
|
export * from "./pendlebuyytparams.js";
|
|
97
97
|
export * from "./pendlebuyytrequest.js";
|
|
98
98
|
export * from "./pendlegetmarketresponse.js";
|
|
99
|
+
export * from "./pendlegetquoteresponse.js";
|
|
99
100
|
export * from "./pendlegetuserpositionresponse.js";
|
|
100
101
|
export * from "./pendlelistmarketsresponse.js";
|
|
101
102
|
export * from "./pendlelistuserpositionsresponse.js";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type PendleGetQuoteResponse = {
|
|
11
|
+
/**
|
|
12
|
+
* A quote for the specified trade, detailing the expected amount of tokens received based on the `trade_type` and `token_type`.
|
|
13
|
+
*/
|
|
14
|
+
quote: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const PendleGetQuoteResponse$inboundSchema: z.ZodType<
|
|
19
|
+
PendleGetQuoteResponse,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z.object({
|
|
23
|
+
quote: z.string(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type PendleGetQuoteResponse$Outbound = {
|
|
28
|
+
quote: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const PendleGetQuoteResponse$outboundSchema: z.ZodType<
|
|
33
|
+
PendleGetQuoteResponse$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
PendleGetQuoteResponse
|
|
36
|
+
> = z.object({
|
|
37
|
+
quote: z.string(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
+
*/
|
|
44
|
+
export namespace PendleGetQuoteResponse$ {
|
|
45
|
+
/** @deprecated use `PendleGetQuoteResponse$inboundSchema` instead. */
|
|
46
|
+
export const inboundSchema = PendleGetQuoteResponse$inboundSchema;
|
|
47
|
+
/** @deprecated use `PendleGetQuoteResponse$outboundSchema` instead. */
|
|
48
|
+
export const outboundSchema = PendleGetQuoteResponse$outboundSchema;
|
|
49
|
+
/** @deprecated use `PendleGetQuoteResponse$Outbound` instead. */
|
|
50
|
+
export type Outbound = PendleGetQuoteResponse$Outbound;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function pendleGetQuoteResponseToJSON(
|
|
54
|
+
pendleGetQuoteResponse: PendleGetQuoteResponse,
|
|
55
|
+
): string {
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
PendleGetQuoteResponse$outboundSchema.parse(pendleGetQuoteResponse),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function pendleGetQuoteResponseFromJSON(
|
|
62
|
+
jsonString: string,
|
|
63
|
+
): SafeParseResult<PendleGetQuoteResponse, SDKValidationError> {
|
|
64
|
+
return safeParse(
|
|
65
|
+
jsonString,
|
|
66
|
+
(x) => PendleGetQuoteResponse$inboundSchema.parse(JSON.parse(x)),
|
|
67
|
+
`Failed to parse 'PendleGetQuoteResponse' from JSON`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -56,7 +56,7 @@ export type VaultGetVaultResponse = {
|
|
|
56
56
|
/**
|
|
57
57
|
* The user's position in the vault.
|
|
58
58
|
*/
|
|
59
|
-
userPosition
|
|
59
|
+
userPosition?: UserPosition | null | undefined;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
/** @internal */
|
|
@@ -73,7 +73,7 @@ export const VaultGetVaultResponse$inboundSchema: z.ZodType<
|
|
|
73
73
|
share_price: z.string(),
|
|
74
74
|
asset: CompassApiBackendModelsVaultsReadResponseVaultAsset$inboundSchema,
|
|
75
75
|
apy: Apy$inboundSchema,
|
|
76
|
-
user_position: z.nullable(UserPosition$inboundSchema),
|
|
76
|
+
user_position: z.nullable(UserPosition$inboundSchema).optional(),
|
|
77
77
|
}).transform((v) => {
|
|
78
78
|
return remap$(v, {
|
|
79
79
|
"total_assets": "totalAssets",
|
|
@@ -93,7 +93,7 @@ export type VaultGetVaultResponse$Outbound = {
|
|
|
93
93
|
share_price: string;
|
|
94
94
|
asset: CompassApiBackendModelsVaultsReadResponseVaultAsset$Outbound;
|
|
95
95
|
apy: Apy$Outbound;
|
|
96
|
-
user_position
|
|
96
|
+
user_position?: UserPosition$Outbound | null | undefined;
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
/** @internal */
|
|
@@ -110,7 +110,7 @@ export const VaultGetVaultResponse$outboundSchema: z.ZodType<
|
|
|
110
110
|
sharePrice: z.string(),
|
|
111
111
|
asset: CompassApiBackendModelsVaultsReadResponseVaultAsset$outboundSchema,
|
|
112
112
|
apy: Apy$outboundSchema,
|
|
113
|
-
userPosition: z.nullable(UserPosition$outboundSchema),
|
|
113
|
+
userPosition: z.nullable(UserPosition$outboundSchema).optional(),
|
|
114
114
|
}).transform((v) => {
|
|
115
115
|
return remap$(v, {
|
|
116
116
|
totalAssets: "total_assets",
|
|
@@ -28,6 +28,7 @@ export * from "./pendlemarket.js";
|
|
|
28
28
|
export * from "./pendlemarkets.js";
|
|
29
29
|
export * from "./pendleposition.js";
|
|
30
30
|
export * from "./pendlepositions.js";
|
|
31
|
+
export * from "./pendlequote.js";
|
|
31
32
|
export * from "./skyposition.js";
|
|
32
33
|
export * from "./tokenaddress.js";
|
|
33
34
|
export * from "./tokenbalance.js";
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
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
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The chain to use.
|
|
14
|
+
*/
|
|
15
|
+
export const PendleQuoteChain = {
|
|
16
|
+
BaseMainnet: "base:mainnet",
|
|
17
|
+
EthereumMainnet: "ethereum:mainnet",
|
|
18
|
+
ArbitrumMainnet: "arbitrum:mainnet",
|
|
19
|
+
} as const;
|
|
20
|
+
/**
|
|
21
|
+
* The chain to use.
|
|
22
|
+
*/
|
|
23
|
+
export type PendleQuoteChain = ClosedEnum<typeof PendleQuoteChain>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The quantity to trade.
|
|
27
|
+
*/
|
|
28
|
+
export type Amount = number | string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
32
|
+
*/
|
|
33
|
+
export const TokenType = {
|
|
34
|
+
Pt: "PT",
|
|
35
|
+
Yt: "YT",
|
|
36
|
+
Lp: "LP",
|
|
37
|
+
} as const;
|
|
38
|
+
/**
|
|
39
|
+
* Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
40
|
+
*/
|
|
41
|
+
export type TokenType = ClosedEnum<typeof TokenType>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the trade direction (`BUY` or `SELL`)
|
|
45
|
+
*/
|
|
46
|
+
export const TradeType = {
|
|
47
|
+
Buy: "BUY",
|
|
48
|
+
Sell: "SELL",
|
|
49
|
+
} as const;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the trade direction (`BUY` or `SELL`)
|
|
52
|
+
*/
|
|
53
|
+
export type TradeType = ClosedEnum<typeof TradeType>;
|
|
54
|
+
|
|
55
|
+
export type PendleQuoteRequest = {
|
|
56
|
+
/**
|
|
57
|
+
* The chain to use.
|
|
58
|
+
*/
|
|
59
|
+
chain?: PendleQuoteChain | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Optional block number (defaults to latest).
|
|
62
|
+
*/
|
|
63
|
+
block?: number | null | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The market address of the desired position.
|
|
66
|
+
*/
|
|
67
|
+
marketAddress?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* The quantity to trade.
|
|
70
|
+
*/
|
|
71
|
+
amount: number | string;
|
|
72
|
+
/**
|
|
73
|
+
* Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
74
|
+
*/
|
|
75
|
+
tokenType?: TokenType | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Specifies the trade direction (`BUY` or `SELL`)
|
|
78
|
+
*/
|
|
79
|
+
tradeType?: TradeType | undefined;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const PendleQuoteChain$inboundSchema: z.ZodNativeEnum<
|
|
84
|
+
typeof PendleQuoteChain
|
|
85
|
+
> = z.nativeEnum(PendleQuoteChain);
|
|
86
|
+
|
|
87
|
+
/** @internal */
|
|
88
|
+
export const PendleQuoteChain$outboundSchema: z.ZodNativeEnum<
|
|
89
|
+
typeof PendleQuoteChain
|
|
90
|
+
> = PendleQuoteChain$inboundSchema;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
95
|
+
*/
|
|
96
|
+
export namespace PendleQuoteChain$ {
|
|
97
|
+
/** @deprecated use `PendleQuoteChain$inboundSchema` instead. */
|
|
98
|
+
export const inboundSchema = PendleQuoteChain$inboundSchema;
|
|
99
|
+
/** @deprecated use `PendleQuoteChain$outboundSchema` instead. */
|
|
100
|
+
export const outboundSchema = PendleQuoteChain$outboundSchema;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** @internal */
|
|
104
|
+
export const Amount$inboundSchema: z.ZodType<Amount, z.ZodTypeDef, unknown> = z
|
|
105
|
+
.union([z.number(), z.string()]);
|
|
106
|
+
|
|
107
|
+
/** @internal */
|
|
108
|
+
export type Amount$Outbound = number | string;
|
|
109
|
+
|
|
110
|
+
/** @internal */
|
|
111
|
+
export const Amount$outboundSchema: z.ZodType<
|
|
112
|
+
Amount$Outbound,
|
|
113
|
+
z.ZodTypeDef,
|
|
114
|
+
Amount
|
|
115
|
+
> = z.union([z.number(), z.string()]);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
120
|
+
*/
|
|
121
|
+
export namespace Amount$ {
|
|
122
|
+
/** @deprecated use `Amount$inboundSchema` instead. */
|
|
123
|
+
export const inboundSchema = Amount$inboundSchema;
|
|
124
|
+
/** @deprecated use `Amount$outboundSchema` instead. */
|
|
125
|
+
export const outboundSchema = Amount$outboundSchema;
|
|
126
|
+
/** @deprecated use `Amount$Outbound` instead. */
|
|
127
|
+
export type Outbound = Amount$Outbound;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function amountToJSON(amount: Amount): string {
|
|
131
|
+
return JSON.stringify(Amount$outboundSchema.parse(amount));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function amountFromJSON(
|
|
135
|
+
jsonString: string,
|
|
136
|
+
): SafeParseResult<Amount, SDKValidationError> {
|
|
137
|
+
return safeParse(
|
|
138
|
+
jsonString,
|
|
139
|
+
(x) => Amount$inboundSchema.parse(JSON.parse(x)),
|
|
140
|
+
`Failed to parse 'Amount' from JSON`,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** @internal */
|
|
145
|
+
export const TokenType$inboundSchema: z.ZodNativeEnum<typeof TokenType> = z
|
|
146
|
+
.nativeEnum(TokenType);
|
|
147
|
+
|
|
148
|
+
/** @internal */
|
|
149
|
+
export const TokenType$outboundSchema: z.ZodNativeEnum<typeof TokenType> =
|
|
150
|
+
TokenType$inboundSchema;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
155
|
+
*/
|
|
156
|
+
export namespace TokenType$ {
|
|
157
|
+
/** @deprecated use `TokenType$inboundSchema` instead. */
|
|
158
|
+
export const inboundSchema = TokenType$inboundSchema;
|
|
159
|
+
/** @deprecated use `TokenType$outboundSchema` instead. */
|
|
160
|
+
export const outboundSchema = TokenType$outboundSchema;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** @internal */
|
|
164
|
+
export const TradeType$inboundSchema: z.ZodNativeEnum<typeof TradeType> = z
|
|
165
|
+
.nativeEnum(TradeType);
|
|
166
|
+
|
|
167
|
+
/** @internal */
|
|
168
|
+
export const TradeType$outboundSchema: z.ZodNativeEnum<typeof TradeType> =
|
|
169
|
+
TradeType$inboundSchema;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
174
|
+
*/
|
|
175
|
+
export namespace TradeType$ {
|
|
176
|
+
/** @deprecated use `TradeType$inboundSchema` instead. */
|
|
177
|
+
export const inboundSchema = TradeType$inboundSchema;
|
|
178
|
+
/** @deprecated use `TradeType$outboundSchema` instead. */
|
|
179
|
+
export const outboundSchema = TradeType$outboundSchema;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** @internal */
|
|
183
|
+
export const PendleQuoteRequest$inboundSchema: z.ZodType<
|
|
184
|
+
PendleQuoteRequest,
|
|
185
|
+
z.ZodTypeDef,
|
|
186
|
+
unknown
|
|
187
|
+
> = z.object({
|
|
188
|
+
chain: PendleQuoteChain$inboundSchema.default("arbitrum:mainnet"),
|
|
189
|
+
block: z.nullable(z.number().int()).optional(),
|
|
190
|
+
market_address: z.string().default(
|
|
191
|
+
"0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
192
|
+
),
|
|
193
|
+
amount: z.union([z.number(), z.string()]),
|
|
194
|
+
token_type: TokenType$inboundSchema.default("PT"),
|
|
195
|
+
trade_type: TradeType$inboundSchema.default("BUY"),
|
|
196
|
+
}).transform((v) => {
|
|
197
|
+
return remap$(v, {
|
|
198
|
+
"market_address": "marketAddress",
|
|
199
|
+
"token_type": "tokenType",
|
|
200
|
+
"trade_type": "tradeType",
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
/** @internal */
|
|
205
|
+
export type PendleQuoteRequest$Outbound = {
|
|
206
|
+
chain: string;
|
|
207
|
+
block?: number | null | undefined;
|
|
208
|
+
market_address: string;
|
|
209
|
+
amount: number | string;
|
|
210
|
+
token_type: string;
|
|
211
|
+
trade_type: string;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/** @internal */
|
|
215
|
+
export const PendleQuoteRequest$outboundSchema: z.ZodType<
|
|
216
|
+
PendleQuoteRequest$Outbound,
|
|
217
|
+
z.ZodTypeDef,
|
|
218
|
+
PendleQuoteRequest
|
|
219
|
+
> = z.object({
|
|
220
|
+
chain: PendleQuoteChain$outboundSchema.default("arbitrum:mainnet"),
|
|
221
|
+
block: z.nullable(z.number().int()).optional(),
|
|
222
|
+
marketAddress: z.string().default(
|
|
223
|
+
"0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
224
|
+
),
|
|
225
|
+
amount: z.union([z.number(), z.string()]),
|
|
226
|
+
tokenType: TokenType$outboundSchema.default("PT"),
|
|
227
|
+
tradeType: TradeType$outboundSchema.default("BUY"),
|
|
228
|
+
}).transform((v) => {
|
|
229
|
+
return remap$(v, {
|
|
230
|
+
marketAddress: "market_address",
|
|
231
|
+
tokenType: "token_type",
|
|
232
|
+
tradeType: "trade_type",
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @internal
|
|
238
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
239
|
+
*/
|
|
240
|
+
export namespace PendleQuoteRequest$ {
|
|
241
|
+
/** @deprecated use `PendleQuoteRequest$inboundSchema` instead. */
|
|
242
|
+
export const inboundSchema = PendleQuoteRequest$inboundSchema;
|
|
243
|
+
/** @deprecated use `PendleQuoteRequest$outboundSchema` instead. */
|
|
244
|
+
export const outboundSchema = PendleQuoteRequest$outboundSchema;
|
|
245
|
+
/** @deprecated use `PendleQuoteRequest$Outbound` instead. */
|
|
246
|
+
export type Outbound = PendleQuoteRequest$Outbound;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function pendleQuoteRequestToJSON(
|
|
250
|
+
pendleQuoteRequest: PendleQuoteRequest,
|
|
251
|
+
): string {
|
|
252
|
+
return JSON.stringify(
|
|
253
|
+
PendleQuoteRequest$outboundSchema.parse(pendleQuoteRequest),
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function pendleQuoteRequestFromJSON(
|
|
258
|
+
jsonString: string,
|
|
259
|
+
): SafeParseResult<PendleQuoteRequest, SDKValidationError> {
|
|
260
|
+
return safeParse(
|
|
261
|
+
jsonString,
|
|
262
|
+
(x) => PendleQuoteRequest$inboundSchema.parse(JSON.parse(x)),
|
|
263
|
+
`Failed to parse 'PendleQuoteRequest' from JSON`,
|
|
264
|
+
);
|
|
265
|
+
}
|
package/src/sdk/pendle.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { pendleMarket } from "../funcs/pendleMarket.js";
|
|
|
9
9
|
import { pendleMarkets } from "../funcs/pendleMarkets.js";
|
|
10
10
|
import { pendlePosition } from "../funcs/pendlePosition.js";
|
|
11
11
|
import { pendlePositions } from "../funcs/pendlePositions.js";
|
|
12
|
+
import { pendleQuote } from "../funcs/pendleQuote.js";
|
|
12
13
|
import { pendleRedeemYield } from "../funcs/pendleRedeemYield.js";
|
|
13
14
|
import { pendleRemoveLiquidity } from "../funcs/pendleRemoveLiquidity.js";
|
|
14
15
|
import { pendleSellPt } from "../funcs/pendleSellPt.js";
|
|
@@ -87,6 +88,28 @@ export class Pendle extends ClientSDK {
|
|
|
87
88
|
));
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Get Quote
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Retrieve a quote for trading Principal Token (PT), Yield Token (YT), or Liquidity
|
|
96
|
+
* Provider Token (LP) on Pendle.
|
|
97
|
+
*
|
|
98
|
+
* For `BUY`, `amount` is the quantity of the Underlying Token to spend, and the quote returns the amount of `token_type` received.
|
|
99
|
+
*
|
|
100
|
+
* For `SELL`, `amount` is the quantity of `token_type` to sell, and the quote returns the amount of Underlying Token received.
|
|
101
|
+
*/
|
|
102
|
+
async quote(
|
|
103
|
+
request: operations.PendleQuoteRequest,
|
|
104
|
+
options?: RequestOptions,
|
|
105
|
+
): Promise<components.PendleGetQuoteResponse> {
|
|
106
|
+
return unwrapAsync(pendleQuote(
|
|
107
|
+
this,
|
|
108
|
+
request,
|
|
109
|
+
options,
|
|
110
|
+
));
|
|
111
|
+
}
|
|
112
|
+
|
|
90
113
|
/**
|
|
91
114
|
* Buy Principal Token (PT)
|
|
92
115
|
*
|