@compass-labs/api-sdk 0.3.0 → 0.3.2
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 +8 -0
- package/bin/mcp-server.js +1044 -308
- package/bin/mcp-server.js.map +25 -9
- package/dist/commonjs/funcs/pendleBuyPt.d.ts +17 -0
- package/dist/commonjs/funcs/pendleBuyPt.d.ts.map +1 -0
- package/dist/commonjs/funcs/pendleBuyPt.js +118 -0
- package/dist/commonjs/funcs/pendleBuyPt.js.map +1 -0
- package/dist/commonjs/funcs/pendleBuyYt.d.ts +17 -0
- package/dist/commonjs/funcs/pendleBuyYt.d.ts.map +1 -0
- package/dist/commonjs/funcs/pendleBuyYt.js +118 -0
- package/dist/commonjs/funcs/pendleBuyYt.js.map +1 -0
- package/dist/commonjs/funcs/pendleSellPt.d.ts +17 -0
- package/dist/commonjs/funcs/pendleSellPt.d.ts.map +1 -0
- package/dist/commonjs/funcs/pendleSellPt.js +118 -0
- package/dist/commonjs/funcs/pendleSellPt.js.map +1 -0
- package/dist/commonjs/funcs/pendleSellYt.d.ts +17 -0
- package/dist/commonjs/funcs/pendleSellYt.d.ts.map +1 -0
- package/dist/commonjs/funcs/pendleSellYt.js +118 -0
- package/dist/commonjs/funcs/pendleSellYt.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- 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 +9 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/pendleBuyPt.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyPt.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyPt.js +64 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyPt.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyYt.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyYt.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyYt.js +64 -0
- package/dist/commonjs/mcp-server/tools/pendleBuyYt.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleSellPt.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/pendleSellPt.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleSellPt.js +64 -0
- package/dist/commonjs/mcp-server/tools/pendleSellPt.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleSellYt.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/pendleSellYt.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/pendleSellYt.js +64 -0
- package/dist/commonjs/mcp-server/tools/pendleSellYt.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +8 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +8 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/multicallactiontype.d.ts +12 -0
- package/dist/commonjs/models/components/multicallactiontype.d.ts.map +1 -1
- package/dist/commonjs/models/components/multicallactiontype.js +4 -0
- package/dist/commonjs/models/components/multicallactiontype.js.map +1 -1
- package/dist/commonjs/models/components/pendlebuyptparams.d.ts +61 -0
- package/dist/commonjs/models/components/pendlebuyptparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlebuyptparams.js +103 -0
- package/dist/commonjs/models/components/pendlebuyptparams.js.map +1 -0
- package/dist/commonjs/models/components/pendlebuyptrequest.d.ts +72 -0
- package/dist/commonjs/models/components/pendlebuyptrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlebuyptrequest.js +108 -0
- package/dist/commonjs/models/components/pendlebuyptrequest.js.map +1 -0
- package/dist/commonjs/models/components/pendlebuyytparams.d.ts +61 -0
- package/dist/commonjs/models/components/pendlebuyytparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlebuyytparams.js +103 -0
- package/dist/commonjs/models/components/pendlebuyytparams.js.map +1 -0
- package/dist/commonjs/models/components/pendlebuyytrequest.d.ts +72 -0
- package/dist/commonjs/models/components/pendlebuyytrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlebuyytrequest.js +108 -0
- package/dist/commonjs/models/components/pendlebuyytrequest.js.map +1 -0
- package/dist/commonjs/models/components/pendlesellptparams.d.ts +61 -0
- package/dist/commonjs/models/components/pendlesellptparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlesellptparams.js +103 -0
- package/dist/commonjs/models/components/pendlesellptparams.js.map +1 -0
- package/dist/commonjs/models/components/pendlesellptrequest.d.ts +72 -0
- package/dist/commonjs/models/components/pendlesellptrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlesellptrequest.js +108 -0
- package/dist/commonjs/models/components/pendlesellptrequest.js.map +1 -0
- package/dist/commonjs/models/components/pendlesellytparams.d.ts +61 -0
- package/dist/commonjs/models/components/pendlesellytparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlesellytparams.js +103 -0
- package/dist/commonjs/models/components/pendlesellytparams.js.map +1 -0
- package/dist/commonjs/models/components/pendlesellytrequest.d.ts +72 -0
- package/dist/commonjs/models/components/pendlesellytrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/pendlesellytrequest.js +108 -0
- package/dist/commonjs/models/components/pendlesellytrequest.js.map +1 -0
- package/dist/commonjs/models/components/useroperation.d.ts +8 -4
- package/dist/commonjs/models/components/useroperation.d.ts.map +1 -1
- package/dist/commonjs/models/components/useroperation.js +20 -0
- package/dist/commonjs/models/components/useroperation.js.map +1 -1
- package/dist/commonjs/sdk/pendle.d.ts +28 -0
- package/dist/commonjs/sdk/pendle.d.ts.map +1 -1
- package/dist/commonjs/sdk/pendle.js +40 -0
- package/dist/commonjs/sdk/pendle.js.map +1 -1
- package/dist/esm/funcs/pendleBuyPt.d.ts +17 -0
- package/dist/esm/funcs/pendleBuyPt.d.ts.map +1 -0
- package/dist/esm/funcs/pendleBuyPt.js +82 -0
- package/dist/esm/funcs/pendleBuyPt.js.map +1 -0
- package/dist/esm/funcs/pendleBuyYt.d.ts +17 -0
- package/dist/esm/funcs/pendleBuyYt.d.ts.map +1 -0
- package/dist/esm/funcs/pendleBuyYt.js +82 -0
- package/dist/esm/funcs/pendleBuyYt.js.map +1 -0
- package/dist/esm/funcs/pendleSellPt.d.ts +17 -0
- package/dist/esm/funcs/pendleSellPt.d.ts.map +1 -0
- package/dist/esm/funcs/pendleSellPt.js +82 -0
- package/dist/esm/funcs/pendleSellPt.js.map +1 -0
- package/dist/esm/funcs/pendleSellYt.d.ts +17 -0
- package/dist/esm/funcs/pendleSellYt.d.ts.map +1 -0
- package/dist/esm/funcs/pendleSellYt.js +82 -0
- package/dist/esm/funcs/pendleSellYt.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- 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 +9 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/pendleBuyPt.d.ts +8 -0
- package/dist/esm/mcp-server/tools/pendleBuyPt.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/pendleBuyPt.js +28 -0
- package/dist/esm/mcp-server/tools/pendleBuyPt.js.map +1 -0
- package/dist/esm/mcp-server/tools/pendleBuyYt.d.ts +8 -0
- package/dist/esm/mcp-server/tools/pendleBuyYt.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/pendleBuyYt.js +28 -0
- package/dist/esm/mcp-server/tools/pendleBuyYt.js.map +1 -0
- package/dist/esm/mcp-server/tools/pendleSellPt.d.ts +8 -0
- package/dist/esm/mcp-server/tools/pendleSellPt.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/pendleSellPt.js +28 -0
- package/dist/esm/mcp-server/tools/pendleSellPt.js.map +1 -0
- package/dist/esm/mcp-server/tools/pendleSellYt.d.ts +8 -0
- package/dist/esm/mcp-server/tools/pendleSellYt.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/pendleSellYt.js +28 -0
- package/dist/esm/mcp-server/tools/pendleSellYt.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +8 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +8 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/multicallactiontype.d.ts +12 -0
- package/dist/esm/models/components/multicallactiontype.d.ts.map +1 -1
- package/dist/esm/models/components/multicallactiontype.js +4 -0
- package/dist/esm/models/components/multicallactiontype.js.map +1 -1
- package/dist/esm/models/components/pendlebuyptparams.d.ts +61 -0
- package/dist/esm/models/components/pendlebuyptparams.d.ts.map +1 -0
- package/dist/esm/models/components/pendlebuyptparams.js +63 -0
- package/dist/esm/models/components/pendlebuyptparams.js.map +1 -0
- package/dist/esm/models/components/pendlebuyptrequest.d.ts +72 -0
- package/dist/esm/models/components/pendlebuyptrequest.d.ts.map +1 -0
- package/dist/esm/models/components/pendlebuyptrequest.js +68 -0
- package/dist/esm/models/components/pendlebuyptrequest.js.map +1 -0
- package/dist/esm/models/components/pendlebuyytparams.d.ts +61 -0
- package/dist/esm/models/components/pendlebuyytparams.d.ts.map +1 -0
- package/dist/esm/models/components/pendlebuyytparams.js +63 -0
- package/dist/esm/models/components/pendlebuyytparams.js.map +1 -0
- package/dist/esm/models/components/pendlebuyytrequest.d.ts +72 -0
- package/dist/esm/models/components/pendlebuyytrequest.d.ts.map +1 -0
- package/dist/esm/models/components/pendlebuyytrequest.js +68 -0
- package/dist/esm/models/components/pendlebuyytrequest.js.map +1 -0
- package/dist/esm/models/components/pendlesellptparams.d.ts +61 -0
- package/dist/esm/models/components/pendlesellptparams.d.ts.map +1 -0
- package/dist/esm/models/components/pendlesellptparams.js +63 -0
- package/dist/esm/models/components/pendlesellptparams.js.map +1 -0
- package/dist/esm/models/components/pendlesellptrequest.d.ts +72 -0
- package/dist/esm/models/components/pendlesellptrequest.d.ts.map +1 -0
- package/dist/esm/models/components/pendlesellptrequest.js +68 -0
- package/dist/esm/models/components/pendlesellptrequest.js.map +1 -0
- package/dist/esm/models/components/pendlesellytparams.d.ts +61 -0
- package/dist/esm/models/components/pendlesellytparams.d.ts.map +1 -0
- package/dist/esm/models/components/pendlesellytparams.js +63 -0
- package/dist/esm/models/components/pendlesellytparams.js.map +1 -0
- package/dist/esm/models/components/pendlesellytrequest.d.ts +72 -0
- package/dist/esm/models/components/pendlesellytrequest.d.ts.map +1 -0
- package/dist/esm/models/components/pendlesellytrequest.js +68 -0
- package/dist/esm/models/components/pendlesellytrequest.js.map +1 -0
- package/dist/esm/models/components/useroperation.d.ts +8 -4
- package/dist/esm/models/components/useroperation.d.ts.map +1 -1
- package/dist/esm/models/components/useroperation.js +20 -0
- package/dist/esm/models/components/useroperation.js.map +1 -1
- package/dist/esm/sdk/pendle.d.ts +28 -0
- package/dist/esm/sdk/pendle.d.ts.map +1 -1
- package/dist/esm/sdk/pendle.js +40 -0
- package/dist/esm/sdk/pendle.js.map +1 -1
- package/docs/sdks/pendle/README.md +336 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/pendleBuyPt.ts +165 -0
- package/src/funcs/pendleBuyYt.ts +165 -0
- package/src/funcs/pendleSellPt.ts +165 -0
- package/src/funcs/pendleSellYt.ts +165 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +9 -1
- package/src/mcp-server/tools/pendleBuyPt.ts +37 -0
- package/src/mcp-server/tools/pendleBuyYt.ts +37 -0
- package/src/mcp-server/tools/pendleSellPt.ts +37 -0
- package/src/mcp-server/tools/pendleSellYt.ts +37 -0
- package/src/models/components/index.ts +8 -0
- package/src/models/components/multicallactiontype.ts +4 -0
- package/src/models/components/pendlebuyptparams.ts +138 -0
- package/src/models/components/pendlebuyptrequest.ts +153 -0
- package/src/models/components/pendlebuyytparams.ts +138 -0
- package/src/models/components/pendlebuyytrequest.ts +153 -0
- package/src/models/components/pendlesellptparams.ts +138 -0
- package/src/models/components/pendlesellptrequest.ts +153 -0
- package/src/models/components/pendlesellytparams.ts +138 -0
- package/src/models/components/pendlesellytrequest.ts +153 -0
- package/src/models/components/useroperation.ts +56 -0
- package/src/sdk/pendle.ts +72 -0
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* [positions](#positions) - List User's Market Positions
|
|
10
10
|
* [markets](#markets) - List Market Data
|
|
11
11
|
* [market](#market) - Get Market Data
|
|
12
|
+
* [buyPt](#buypt) - Buy Princpal Token (PT)
|
|
13
|
+
* [sellPt](#sellpt) - Sell Princpal Token (PT)
|
|
14
|
+
* [buyYt](#buyyt) - Buy Yield Token (YT)
|
|
15
|
+
* [sellYt](#sellyt) - Sell Yield Token (YT)
|
|
12
16
|
|
|
13
17
|
## position
|
|
14
18
|
|
|
@@ -321,6 +325,338 @@ run();
|
|
|
321
325
|
|
|
322
326
|
### Errors
|
|
323
327
|
|
|
328
|
+
| Error Type | Status Code | Content Type |
|
|
329
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
330
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
331
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
332
|
+
|
|
333
|
+
## buyPt
|
|
334
|
+
|
|
335
|
+
Buy Principal Token (PT) with market's Underlying Token.
|
|
336
|
+
|
|
337
|
+
### Example Usage
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
341
|
+
|
|
342
|
+
const compassApiSDK = new CompassApiSDK({
|
|
343
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
async function run() {
|
|
347
|
+
const result = await compassApiSDK.pendle.buyPt({
|
|
348
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
349
|
+
amount: 1.5,
|
|
350
|
+
chain: "arbitrum:mainnet",
|
|
351
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// Handle the result
|
|
355
|
+
console.log(result);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
run();
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Standalone function
|
|
362
|
+
|
|
363
|
+
The standalone function version of this method:
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
367
|
+
import { pendleBuyPt } from "@compass-labs/api-sdk/funcs/pendleBuyPt.js";
|
|
368
|
+
|
|
369
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
370
|
+
// You can create one instance of it to use across an application.
|
|
371
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
372
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
async function run() {
|
|
376
|
+
const res = await pendleBuyPt(compassApiSDK, {
|
|
377
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
378
|
+
amount: 1.5,
|
|
379
|
+
chain: "arbitrum:mainnet",
|
|
380
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
if (!res.ok) {
|
|
384
|
+
throw res.error;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const { value: result } = res;
|
|
388
|
+
|
|
389
|
+
// Handle the result
|
|
390
|
+
console.log(result);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
run();
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Parameters
|
|
397
|
+
|
|
398
|
+
| Parameter | Type | Required | Description |
|
|
399
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
400
|
+
| `request` | [components.PendleBuyPtRequest](../../models/components/pendlebuyptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
401
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
402
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
403
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
404
|
+
|
|
405
|
+
### Response
|
|
406
|
+
|
|
407
|
+
**Promise\<[components.TxResponse](../../models/components/txresponse.md)\>**
|
|
408
|
+
|
|
409
|
+
### Errors
|
|
410
|
+
|
|
411
|
+
| Error Type | Status Code | Content Type |
|
|
412
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
413
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
414
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
415
|
+
|
|
416
|
+
## sellPt
|
|
417
|
+
|
|
418
|
+
Sell Principal Token (PT) for the market's Underlying Token.
|
|
419
|
+
|
|
420
|
+
### Example Usage
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
424
|
+
|
|
425
|
+
const compassApiSDK = new CompassApiSDK({
|
|
426
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
async function run() {
|
|
430
|
+
const result = await compassApiSDK.pendle.sellPt({
|
|
431
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
432
|
+
amount: 1.5,
|
|
433
|
+
chain: "base:mainnet",
|
|
434
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// Handle the result
|
|
438
|
+
console.log(result);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
run();
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Standalone function
|
|
445
|
+
|
|
446
|
+
The standalone function version of this method:
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
450
|
+
import { pendleSellPt } from "@compass-labs/api-sdk/funcs/pendleSellPt.js";
|
|
451
|
+
|
|
452
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
453
|
+
// You can create one instance of it to use across an application.
|
|
454
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
455
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
async function run() {
|
|
459
|
+
const res = await pendleSellPt(compassApiSDK, {
|
|
460
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
461
|
+
amount: 1.5,
|
|
462
|
+
chain: "base:mainnet",
|
|
463
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
if (!res.ok) {
|
|
467
|
+
throw res.error;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const { value: result } = res;
|
|
471
|
+
|
|
472
|
+
// Handle the result
|
|
473
|
+
console.log(result);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
run();
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Parameters
|
|
480
|
+
|
|
481
|
+
| Parameter | Type | Required | Description |
|
|
482
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
483
|
+
| `request` | [components.PendleSellPtRequest](../../models/components/pendlesellptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
484
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
485
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
486
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
487
|
+
|
|
488
|
+
### Response
|
|
489
|
+
|
|
490
|
+
**Promise\<[components.TxResponse](../../models/components/txresponse.md)\>**
|
|
491
|
+
|
|
492
|
+
### Errors
|
|
493
|
+
|
|
494
|
+
| Error Type | Status Code | Content Type |
|
|
495
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
496
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
497
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
498
|
+
|
|
499
|
+
## buyYt
|
|
500
|
+
|
|
501
|
+
Buy Yield Token (YT) with market's Underlying Token.
|
|
502
|
+
|
|
503
|
+
### Example Usage
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
507
|
+
|
|
508
|
+
const compassApiSDK = new CompassApiSDK({
|
|
509
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
async function run() {
|
|
513
|
+
const result = await compassApiSDK.pendle.buyYt({
|
|
514
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
515
|
+
amount: 1.5,
|
|
516
|
+
chain: "arbitrum:mainnet",
|
|
517
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Handle the result
|
|
521
|
+
console.log(result);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
run();
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Standalone function
|
|
528
|
+
|
|
529
|
+
The standalone function version of this method:
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
533
|
+
import { pendleBuyYt } from "@compass-labs/api-sdk/funcs/pendleBuyYt.js";
|
|
534
|
+
|
|
535
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
536
|
+
// You can create one instance of it to use across an application.
|
|
537
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
538
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
async function run() {
|
|
542
|
+
const res = await pendleBuyYt(compassApiSDK, {
|
|
543
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
544
|
+
amount: 1.5,
|
|
545
|
+
chain: "arbitrum:mainnet",
|
|
546
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
if (!res.ok) {
|
|
550
|
+
throw res.error;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const { value: result } = res;
|
|
554
|
+
|
|
555
|
+
// Handle the result
|
|
556
|
+
console.log(result);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
run();
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Parameters
|
|
563
|
+
|
|
564
|
+
| Parameter | Type | Required | Description |
|
|
565
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
566
|
+
| `request` | [components.PendleBuyYtRequest](../../models/components/pendlebuyytrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
567
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
568
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
569
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
570
|
+
|
|
571
|
+
### Response
|
|
572
|
+
|
|
573
|
+
**Promise\<[components.TxResponse](../../models/components/txresponse.md)\>**
|
|
574
|
+
|
|
575
|
+
### Errors
|
|
576
|
+
|
|
577
|
+
| Error Type | Status Code | Content Type |
|
|
578
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
579
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
580
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
581
|
+
|
|
582
|
+
## sellYt
|
|
583
|
+
|
|
584
|
+
Sell Yield Token (YT) for the market's Underlying Token.
|
|
585
|
+
|
|
586
|
+
### Example Usage
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
590
|
+
|
|
591
|
+
const compassApiSDK = new CompassApiSDK({
|
|
592
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
async function run() {
|
|
596
|
+
const result = await compassApiSDK.pendle.sellYt({
|
|
597
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
598
|
+
amount: 1.5,
|
|
599
|
+
chain: "arbitrum:mainnet",
|
|
600
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
// Handle the result
|
|
604
|
+
console.log(result);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
run();
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Standalone function
|
|
611
|
+
|
|
612
|
+
The standalone function version of this method:
|
|
613
|
+
|
|
614
|
+
```typescript
|
|
615
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
616
|
+
import { pendleSellYt } from "@compass-labs/api-sdk/funcs/pendleSellYt.js";
|
|
617
|
+
|
|
618
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
619
|
+
// You can create one instance of it to use across an application.
|
|
620
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
621
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
async function run() {
|
|
625
|
+
const res = await pendleSellYt(compassApiSDK, {
|
|
626
|
+
marketAddress: "0x08a152834de126d2ef83d612ff36e4523fd0017f",
|
|
627
|
+
amount: 1.5,
|
|
628
|
+
chain: "arbitrum:mainnet",
|
|
629
|
+
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
if (!res.ok) {
|
|
633
|
+
throw res.error;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const { value: result } = res;
|
|
637
|
+
|
|
638
|
+
// Handle the result
|
|
639
|
+
console.log(result);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
run();
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### Parameters
|
|
646
|
+
|
|
647
|
+
| Parameter | Type | Required | Description |
|
|
648
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
649
|
+
| `request` | [components.PendleSellYtRequest](../../models/components/pendlesellytrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
650
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
651
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
652
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
653
|
+
|
|
654
|
+
### Response
|
|
655
|
+
|
|
656
|
+
**Promise\<[components.TxResponse](../../models/components/txresponse.md)\>**
|
|
657
|
+
|
|
658
|
+
### Errors
|
|
659
|
+
|
|
324
660
|
| Error Type | Status Code | Content Type |
|
|
325
661
|
| -------------------------- | -------------------------- | -------------------------- |
|
|
326
662
|
| errors.HTTPValidationError | 422 | application/json |
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,165 @@
|
|
|
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 * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Buy Princpal Token (PT)
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Buy Principal Token (PT) with market's Underlying Token.
|
|
32
|
+
*/
|
|
33
|
+
export function pendleBuyPt(
|
|
34
|
+
client: CompassApiSDKCore,
|
|
35
|
+
request: components.PendleBuyPtRequest,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
components.TxResponse,
|
|
40
|
+
| errors.HTTPValidationError
|
|
41
|
+
| APIError
|
|
42
|
+
| SDKValidationError
|
|
43
|
+
| UnexpectedClientError
|
|
44
|
+
| InvalidRequestError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: CompassApiSDKCore,
|
|
59
|
+
request: components.PendleBuyPtRequest,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
components.TxResponse,
|
|
65
|
+
| errors.HTTPValidationError
|
|
66
|
+
| APIError
|
|
67
|
+
| SDKValidationError
|
|
68
|
+
| UnexpectedClientError
|
|
69
|
+
| InvalidRequestError
|
|
70
|
+
| RequestAbortedError
|
|
71
|
+
| RequestTimeoutError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const parsed = safeParse(
|
|
78
|
+
request,
|
|
79
|
+
(value) => components.PendleBuyPtRequest$outboundSchema.parse(value),
|
|
80
|
+
"Input validation failed",
|
|
81
|
+
);
|
|
82
|
+
if (!parsed.ok) {
|
|
83
|
+
return [parsed, { status: "invalid" }];
|
|
84
|
+
}
|
|
85
|
+
const payload = parsed.value;
|
|
86
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
87
|
+
|
|
88
|
+
const path = pathToFunc("/v0/pendle/buy_pt")();
|
|
89
|
+
|
|
90
|
+
const headers = new Headers(compactMap({
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
Accept: "application/json",
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
96
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
97
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
98
|
+
|
|
99
|
+
const context = {
|
|
100
|
+
options: client._options,
|
|
101
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
102
|
+
operationID: "pendle_buy_pt",
|
|
103
|
+
oAuth2Scopes: [],
|
|
104
|
+
|
|
105
|
+
resolvedSecurity: requestSecurity,
|
|
106
|
+
|
|
107
|
+
securitySource: client._options.apiKeyAuth,
|
|
108
|
+
retryConfig: options?.retries
|
|
109
|
+
|| client._options.retryConfig
|
|
110
|
+
|| { strategy: "none" },
|
|
111
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const requestRes = client._createRequest(context, {
|
|
115
|
+
security: requestSecurity,
|
|
116
|
+
method: "POST",
|
|
117
|
+
baseURL: options?.serverURL,
|
|
118
|
+
path: path,
|
|
119
|
+
headers: headers,
|
|
120
|
+
body: body,
|
|
121
|
+
userAgent: client._options.userAgent,
|
|
122
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
123
|
+
}, options);
|
|
124
|
+
if (!requestRes.ok) {
|
|
125
|
+
return [requestRes, { status: "invalid" }];
|
|
126
|
+
}
|
|
127
|
+
const req = requestRes.value;
|
|
128
|
+
|
|
129
|
+
const doResult = await client._do(req, {
|
|
130
|
+
context,
|
|
131
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
132
|
+
retryConfig: context.retryConfig,
|
|
133
|
+
retryCodes: context.retryCodes,
|
|
134
|
+
});
|
|
135
|
+
if (!doResult.ok) {
|
|
136
|
+
return [doResult, { status: "request-error", request: req }];
|
|
137
|
+
}
|
|
138
|
+
const response = doResult.value;
|
|
139
|
+
|
|
140
|
+
const responseFields = {
|
|
141
|
+
HttpMeta: { Response: response, Request: req },
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const [result] = await M.match<
|
|
145
|
+
components.TxResponse,
|
|
146
|
+
| errors.HTTPValidationError
|
|
147
|
+
| APIError
|
|
148
|
+
| SDKValidationError
|
|
149
|
+
| UnexpectedClientError
|
|
150
|
+
| InvalidRequestError
|
|
151
|
+
| RequestAbortedError
|
|
152
|
+
| RequestTimeoutError
|
|
153
|
+
| ConnectionError
|
|
154
|
+
>(
|
|
155
|
+
M.json(200, components.TxResponse$inboundSchema),
|
|
156
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
157
|
+
M.fail("4XX"),
|
|
158
|
+
M.fail("5XX"),
|
|
159
|
+
)(response, { extraFields: responseFields });
|
|
160
|
+
if (!result.ok) {
|
|
161
|
+
return [result, { status: "complete", request: req, response }];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return [result, { status: "complete", request: req, response }];
|
|
165
|
+
}
|