@compass-labs/api-sdk 1.0.16 → 1.0.18
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 -2
- package/bin/mcp-server.js +115 -120
- package/bin/mcp-server.js.map +14 -14
- package/dist/commonjs/funcs/ethenaEthenaRequest.d.ts +1 -6
- package/dist/commonjs/funcs/ethenaEthenaRequest.d.ts.map +1 -1
- package/dist/commonjs/funcs/ethenaEthenaRequest.js +1 -6
- package/dist/commonjs/funcs/ethenaEthenaRequest.js.map +1 -1
- package/dist/commonjs/funcs/{ethenaEthenaWithdraw.d.ts → ethenaEthenaUnstake.d.ts} +12 -10
- package/dist/commonjs/funcs/ethenaEthenaUnstake.d.ts.map +1 -0
- package/dist/commonjs/funcs/{ethenaEthenaWithdraw.js → ethenaEthenaUnstake.js} +16 -14
- package/dist/commonjs/funcs/{ethenaEthenaWithdraw.js.map → ethenaEthenaUnstake.js.map} +1 -1
- 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.js +3 -3
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/ethenaEthenaRequest.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/ethenaEthenaRequest.js +1 -7
- package/dist/commonjs/mcp-server/tools/ethenaEthenaRequest.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/ethenaEthenaUnstake.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/ethenaEthenaUnstake.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/{ethenaEthenaWithdraw.js → ethenaEthenaUnstake.js} +17 -16
- package/dist/commonjs/mcp-server/tools/ethenaEthenaUnstake.js.map +1 -0
- package/dist/commonjs/models/components/ethenaunstakeparams.d.ts +34 -0
- package/dist/commonjs/models/components/ethenaunstakeparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/{ethenawithdrawparams.js → ethenaunstakeparams.js} +19 -21
- package/dist/commonjs/models/components/ethenaunstakeparams.js.map +1 -0
- package/dist/commonjs/models/components/ethenaunstakerequest.d.ts +64 -0
- package/dist/commonjs/models/components/ethenaunstakerequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/{ethenawithdrawrequest.js → ethenaunstakerequest.js} +31 -33
- package/dist/commonjs/models/components/ethenaunstakerequest.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -2
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -2
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/useroperation.d.ts +9 -9
- package/dist/commonjs/models/components/useroperation.d.ts.map +1 -1
- package/dist/commonjs/models/components/useroperation.js +13 -9
- package/dist/commonjs/models/components/useroperation.js.map +1 -1
- package/dist/commonjs/sdk/ethena.d.ts +21 -24
- package/dist/commonjs/sdk/ethena.d.ts.map +1 -1
- package/dist/commonjs/sdk/ethena.js +24 -27
- package/dist/commonjs/sdk/ethena.js.map +1 -1
- package/dist/esm/funcs/ethenaEthenaRequest.d.ts +1 -6
- package/dist/esm/funcs/ethenaEthenaRequest.d.ts.map +1 -1
- package/dist/esm/funcs/ethenaEthenaRequest.js +1 -6
- package/dist/esm/funcs/ethenaEthenaRequest.js.map +1 -1
- package/dist/esm/funcs/{ethenaEthenaWithdraw.d.ts → ethenaEthenaUnstake.d.ts} +12 -10
- package/dist/esm/funcs/ethenaEthenaUnstake.d.ts.map +1 -0
- package/dist/esm/funcs/{ethenaEthenaWithdraw.js → ethenaEthenaUnstake.js} +15 -13
- package/dist/esm/funcs/{ethenaEthenaWithdraw.js.map → ethenaEthenaUnstake.js.map} +1 -1
- 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.js +3 -3
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/ethenaEthenaRequest.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/ethenaEthenaRequest.js +1 -7
- package/dist/esm/mcp-server/tools/ethenaEthenaRequest.js.map +1 -1
- package/dist/esm/mcp-server/tools/ethenaEthenaUnstake.d.ts +8 -0
- package/dist/esm/mcp-server/tools/ethenaEthenaUnstake.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/ethenaEthenaUnstake.js +41 -0
- package/dist/esm/mcp-server/tools/ethenaEthenaUnstake.js.map +1 -0
- package/dist/esm/models/components/ethenaunstakeparams.d.ts +34 -0
- package/dist/esm/models/components/ethenaunstakeparams.d.ts.map +1 -0
- package/dist/esm/models/components/ethenaunstakeparams.js +42 -0
- package/dist/esm/models/components/ethenaunstakeparams.js.map +1 -0
- package/dist/esm/models/components/ethenaunstakerequest.d.ts +64 -0
- package/dist/esm/models/components/ethenaunstakerequest.d.ts.map +1 -0
- package/dist/esm/models/components/ethenaunstakerequest.js +64 -0
- package/dist/esm/models/components/ethenaunstakerequest.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -2
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -2
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/useroperation.d.ts +9 -9
- package/dist/esm/models/components/useroperation.d.ts.map +1 -1
- package/dist/esm/models/components/useroperation.js +13 -9
- package/dist/esm/models/components/useroperation.js.map +1 -1
- package/dist/esm/sdk/ethena.d.ts +21 -24
- package/dist/esm/sdk/ethena.d.ts.map +1 -1
- package/dist/esm/sdk/ethena.js +24 -27
- package/dist/esm/sdk/ethena.js.map +1 -1
- package/docs/sdks/ethena/README.md +36 -43
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/ethenaEthenaRequest.ts +1 -6
- package/src/funcs/{ethenaEthenaWithdraw.ts → ethenaEthenaUnstake.ts} +16 -14
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -3
- package/src/mcp-server/tools/ethenaEthenaRequest.ts +1 -7
- package/src/mcp-server/tools/{ethenaEthenaWithdraw.ts → ethenaEthenaUnstake.ts} +15 -14
- package/src/models/components/ethenaunstakeparams.ts +82 -0
- package/src/models/components/ethenaunstakerequest.ts +122 -0
- package/src/models/components/index.ts +2 -2
- package/src/models/components/useroperation.ts +33 -33
- package/src/sdk/ethena.ts +30 -33
- package/dist/commonjs/funcs/ethenaEthenaWithdraw.d.ts.map +0 -1
- package/dist/commonjs/mcp-server/tools/ethenaEthenaWithdraw.d.ts +0 -8
- package/dist/commonjs/mcp-server/tools/ethenaEthenaWithdraw.d.ts.map +0 -1
- package/dist/commonjs/mcp-server/tools/ethenaEthenaWithdraw.js.map +0 -1
- package/dist/commonjs/models/components/ethenawithdrawparams.d.ts +0 -39
- package/dist/commonjs/models/components/ethenawithdrawparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/ethenawithdrawparams.js.map +0 -1
- package/dist/commonjs/models/components/ethenawithdrawrequest.d.ts +0 -69
- package/dist/commonjs/models/components/ethenawithdrawrequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/ethenawithdrawrequest.js.map +0 -1
- package/dist/esm/funcs/ethenaEthenaWithdraw.d.ts.map +0 -1
- package/dist/esm/mcp-server/tools/ethenaEthenaWithdraw.d.ts +0 -8
- package/dist/esm/mcp-server/tools/ethenaEthenaWithdraw.d.ts.map +0 -1
- package/dist/esm/mcp-server/tools/ethenaEthenaWithdraw.js +0 -40
- package/dist/esm/mcp-server/tools/ethenaEthenaWithdraw.js.map +0 -1
- package/dist/esm/models/components/ethenawithdrawparams.d.ts +0 -39
- package/dist/esm/models/components/ethenawithdrawparams.d.ts.map +0 -1
- package/dist/esm/models/components/ethenawithdrawparams.js +0 -44
- package/dist/esm/models/components/ethenawithdrawparams.js.map +0 -1
- package/dist/esm/models/components/ethenawithdrawrequest.d.ts +0 -69
- package/dist/esm/models/components/ethenawithdrawrequest.d.ts.map +0 -1
- package/dist/esm/models/components/ethenawithdrawrequest.js +0 -66
- package/dist/esm/models/components/ethenawithdrawrequest.js.map +0 -1
- package/src/models/components/ethenawithdrawparams.ts +0 -89
- package/src/models/components/ethenawithdrawrequest.ts +0 -129
package/dist/esm/sdk/ethena.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ethenaEthenaDeposit } from "../funcs/ethenaEthenaDeposit.js";
|
|
5
5
|
import { ethenaEthenaRequest } from "../funcs/ethenaEthenaRequest.js";
|
|
6
|
+
import { ethenaEthenaUnstake } from "../funcs/ethenaEthenaUnstake.js";
|
|
6
7
|
import { ethenaEthenaVault } from "../funcs/ethenaEthenaVault.js";
|
|
7
|
-
import { ethenaEthenaWithdraw } from "../funcs/ethenaEthenaWithdraw.js";
|
|
8
8
|
import { ClientSDK } from "../lib/sdks.js";
|
|
9
9
|
import { unwrapAsync } from "../types/fp.js";
|
|
10
10
|
export class Ethena extends ClientSDK {
|
|
@@ -39,26 +39,6 @@ export class Ethena extends ClientSDK {
|
|
|
39
39
|
async ethenaDeposit(request, options) {
|
|
40
40
|
return unwrapAsync(ethenaEthenaDeposit(this, request, options));
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Withdraw USDe
|
|
44
|
-
*
|
|
45
|
-
* @remarks
|
|
46
|
-
* Withdraw deposited USDe from Ethena's vault and cease earning passive yield.
|
|
47
|
-
*
|
|
48
|
-
* The passive yield earned on USDe deposits is represented by the increased value of
|
|
49
|
-
* the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
50
|
-
* for the intial USDe deposited and any accrued yield since depositing.
|
|
51
|
-
* <Info>
|
|
52
|
-
* **Required Allowances**
|
|
53
|
-
*
|
|
54
|
-
* In order to make this transaction, token allowances need to be set for the following contracts.
|
|
55
|
-
*
|
|
56
|
-
* - `EthenaVault`
|
|
57
|
-
* </Info>
|
|
58
|
-
*/
|
|
59
|
-
async ethenaWithdraw(request, options) {
|
|
60
|
-
return unwrapAsync(ethenaEthenaWithdraw(this, request, options));
|
|
61
|
-
}
|
|
62
42
|
/**
|
|
63
43
|
* Request to Withdraw USDe
|
|
64
44
|
*
|
|
@@ -73,16 +53,33 @@ export class Ethena extends ClientSDK {
|
|
|
73
53
|
* withdrawing the originally requested amount, the cooldown period restarts.
|
|
74
54
|
*
|
|
75
55
|
* Yield is not earned on USDe while in its cooldown period.
|
|
76
|
-
* <Info>
|
|
77
|
-
* **Required Allowances**
|
|
78
|
-
*
|
|
79
|
-
* In order to make this transaction, token allowances need to be set for the following contracts.
|
|
80
56
|
*
|
|
81
|
-
*
|
|
82
|
-
* </Info>
|
|
57
|
+
* An allowance does not have to be set to initiate the cooldown period.
|
|
83
58
|
*/
|
|
84
59
|
async ethenaRequest(request, options) {
|
|
85
60
|
return unwrapAsync(ethenaEthenaRequest(this, request, options));
|
|
86
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Unstake USDe
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Unstake deposited USDe from Ethena's vault.
|
|
67
|
+
*
|
|
68
|
+
* Verify that the USDe being unstaked has completed its mandatory cooldown period
|
|
69
|
+
* using the Ethena 'Get Vault & User Position' endpoint.
|
|
70
|
+
*
|
|
71
|
+
* This is an all or nothing action. All of the USDe that has completed its cooldown
|
|
72
|
+
* period must be withdrawn.
|
|
73
|
+
*
|
|
74
|
+
* The passive yield earned on USDe deposits is represented by the increased value of
|
|
75
|
+
* the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
76
|
+
* for the intial USDe deposited and any accrued yield since depositing.
|
|
77
|
+
*
|
|
78
|
+
* An allowance does not have to be set to unstake USDe that has completed its cooldown
|
|
79
|
+
* period.
|
|
80
|
+
*/
|
|
81
|
+
async ethenaUnstake(request, options) {
|
|
82
|
+
return unwrapAsync(ethenaEthenaUnstake(this, request, options));
|
|
83
|
+
}
|
|
87
84
|
}
|
|
88
85
|
//# sourceMappingURL=ethena.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethena.js","sourceRoot":"","sources":["../../../src/sdk/ethena.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ethena.js","sourceRoot":"","sources":["../../../src/sdk/ethena.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;;;;;;;;;OASG;IACH,KAAK,CAAC,WAAW,CACf,OAAwC,EACxC,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,aAAa,CACjB,OAAwC,EACxC,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,aAAa,CACjB,OAAkD,EAClD,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,aAAa,CACjB,OAAwC,EACxC,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
* [ethenaVault](#ethenavault) - Get Vault & User Position
|
|
9
9
|
* [ethenaDeposit](#ethenadeposit) - Deposit USDe
|
|
10
|
-
* [ethenaWithdraw](#ethenawithdraw) - Withdraw USDe
|
|
11
10
|
* [ethenaRequest](#ethenarequest) - Request to Withdraw USDe
|
|
11
|
+
* [ethenaUnstake](#ethenaunstake) - Unstake USDe
|
|
12
12
|
|
|
13
13
|
## ethenaVault
|
|
14
14
|
|
|
@@ -172,25 +172,24 @@ run();
|
|
|
172
172
|
| errors.HTTPValidationError | 422 | application/json |
|
|
173
173
|
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
174
174
|
|
|
175
|
-
##
|
|
175
|
+
## ethenaRequest
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
Request to withdraw deposited USDe from Ethena's vault.
|
|
178
178
|
|
|
179
|
-
The
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<Info>
|
|
183
|
-
**Required Allowances**
|
|
179
|
+
The Ethena vault requires a cooldown period. Once a request to withdraw a specified
|
|
180
|
+
amount of USDe has been submitted, the alloted cooldown period must pass before the
|
|
181
|
+
withdraw USDe transaction can be submitted.
|
|
184
182
|
|
|
185
|
-
|
|
183
|
+
If an additional amount of USDe is requested to be withdrawn anytime before
|
|
184
|
+
withdrawing the originally requested amount, the cooldown period restarts.
|
|
186
185
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
Yield is not earned on USDe while in its cooldown period.
|
|
187
|
+
|
|
188
|
+
An allowance does not have to be set to initiate the cooldown period.
|
|
190
189
|
|
|
191
190
|
### Example Usage
|
|
192
191
|
|
|
193
|
-
<!-- UsageSnippet language="typescript" operationID="
|
|
192
|
+
<!-- UsageSnippet language="typescript" operationID="v1_ethena_request" method="post" path="/v1/ethena/request" -->
|
|
194
193
|
```typescript
|
|
195
194
|
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
196
195
|
|
|
@@ -199,7 +198,7 @@ const compassApiSDK = new CompassApiSDK({
|
|
|
199
198
|
});
|
|
200
199
|
|
|
201
200
|
async function run() {
|
|
202
|
-
const result = await compassApiSDK.ethena.
|
|
201
|
+
const result = await compassApiSDK.ethena.ethenaRequest({
|
|
203
202
|
amount: 1.5,
|
|
204
203
|
chain: "ethereum",
|
|
205
204
|
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
@@ -217,7 +216,7 @@ The standalone function version of this method:
|
|
|
217
216
|
|
|
218
217
|
```typescript
|
|
219
218
|
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
220
|
-
import {
|
|
219
|
+
import { ethenaEthenaRequest } from "@compass-labs/api-sdk/funcs/ethenaEthenaRequest.js";
|
|
221
220
|
|
|
222
221
|
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
223
222
|
// You can create one instance of it to use across an application.
|
|
@@ -226,7 +225,7 @@ const compassApiSDK = new CompassApiSDKCore({
|
|
|
226
225
|
});
|
|
227
226
|
|
|
228
227
|
async function run() {
|
|
229
|
-
const res = await
|
|
228
|
+
const res = await ethenaEthenaRequest(compassApiSDK, {
|
|
230
229
|
amount: 1.5,
|
|
231
230
|
chain: "ethereum",
|
|
232
231
|
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
@@ -235,7 +234,7 @@ async function run() {
|
|
|
235
234
|
const { value: result } = res;
|
|
236
235
|
console.log(result);
|
|
237
236
|
} else {
|
|
238
|
-
console.log("
|
|
237
|
+
console.log("ethenaEthenaRequest failed:", res.error);
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
|
|
@@ -246,14 +245,14 @@ run();
|
|
|
246
245
|
|
|
247
246
|
| Parameter | Type | Required | Description |
|
|
248
247
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
249
|
-
| `request` | [components.
|
|
248
|
+
| `request` | [components.EthenaRequestToWithdrawRequest](../../models/components/ethenarequesttowithdrawrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
250
249
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
251
250
|
| `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. |
|
|
252
251
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
253
252
|
|
|
254
253
|
### Response
|
|
255
254
|
|
|
256
|
-
**Promise\<[components.
|
|
255
|
+
**Promise\<[components.EthenaRequestToWithdrawTransactionResponse](../../models/components/ethenarequesttowithdrawtransactionresponse.md)\>**
|
|
257
256
|
|
|
258
257
|
### Errors
|
|
259
258
|
|
|
@@ -262,30 +261,26 @@ run();
|
|
|
262
261
|
| errors.HTTPValidationError | 422 | application/json |
|
|
263
262
|
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
264
263
|
|
|
265
|
-
##
|
|
266
|
-
|
|
267
|
-
Request to withdraw deposited USDe from Ethena's vault.
|
|
264
|
+
## ethenaUnstake
|
|
268
265
|
|
|
269
|
-
|
|
270
|
-
amount of USDe has been submitted, the alloted cooldown period must pass before the
|
|
271
|
-
withdraw USDe transaction can be submitted.
|
|
266
|
+
Unstake deposited USDe from Ethena's vault.
|
|
272
267
|
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
Verify that the USDe being unstaked has completed its mandatory cooldown period
|
|
269
|
+
using the Ethena 'Get Vault & User Position' endpoint.
|
|
275
270
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
**Required Allowances**
|
|
271
|
+
This is an all or nothing action. All of the USDe that has completed its cooldown
|
|
272
|
+
period must be withdrawn.
|
|
279
273
|
|
|
280
|
-
|
|
274
|
+
The passive yield earned on USDe deposits is represented by the increased value of
|
|
275
|
+
the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
276
|
+
for the intial USDe deposited and any accrued yield since depositing.
|
|
281
277
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
An allowance does not have to be set to unstake USDe that has completed its cooldown
|
|
279
|
+
period.
|
|
285
280
|
|
|
286
281
|
### Example Usage
|
|
287
282
|
|
|
288
|
-
<!-- UsageSnippet language="typescript" operationID="
|
|
283
|
+
<!-- UsageSnippet language="typescript" operationID="v1_ethena_unstake" method="post" path="/v1/ethena/unstake" -->
|
|
289
284
|
```typescript
|
|
290
285
|
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
291
286
|
|
|
@@ -294,8 +289,7 @@ const compassApiSDK = new CompassApiSDK({
|
|
|
294
289
|
});
|
|
295
290
|
|
|
296
291
|
async function run() {
|
|
297
|
-
const result = await compassApiSDK.ethena.
|
|
298
|
-
amount: 1.5,
|
|
292
|
+
const result = await compassApiSDK.ethena.ethenaUnstake({
|
|
299
293
|
chain: "ethereum",
|
|
300
294
|
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
301
295
|
});
|
|
@@ -312,7 +306,7 @@ The standalone function version of this method:
|
|
|
312
306
|
|
|
313
307
|
```typescript
|
|
314
308
|
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
315
|
-
import {
|
|
309
|
+
import { ethenaEthenaUnstake } from "@compass-labs/api-sdk/funcs/ethenaEthenaUnstake.js";
|
|
316
310
|
|
|
317
311
|
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
318
312
|
// You can create one instance of it to use across an application.
|
|
@@ -321,8 +315,7 @@ const compassApiSDK = new CompassApiSDKCore({
|
|
|
321
315
|
});
|
|
322
316
|
|
|
323
317
|
async function run() {
|
|
324
|
-
const res = await
|
|
325
|
-
amount: 1.5,
|
|
318
|
+
const res = await ethenaEthenaUnstake(compassApiSDK, {
|
|
326
319
|
chain: "ethereum",
|
|
327
320
|
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
328
321
|
});
|
|
@@ -330,7 +323,7 @@ async function run() {
|
|
|
330
323
|
const { value: result } = res;
|
|
331
324
|
console.log(result);
|
|
332
325
|
} else {
|
|
333
|
-
console.log("
|
|
326
|
+
console.log("ethenaEthenaUnstake failed:", res.error);
|
|
334
327
|
}
|
|
335
328
|
}
|
|
336
329
|
|
|
@@ -341,14 +334,14 @@ run();
|
|
|
341
334
|
|
|
342
335
|
| Parameter | Type | Required | Description |
|
|
343
336
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
344
|
-
| `request` | [components.
|
|
337
|
+
| `request` | [components.EthenaUnstakeRequest](../../models/components/ethenaunstakerequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
345
338
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
346
339
|
| `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. |
|
|
347
340
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
348
341
|
|
|
349
342
|
### Response
|
|
350
343
|
|
|
351
|
-
**Promise\<[components.
|
|
344
|
+
**Promise\<[components.TransactionResponse](../../models/components/transactionresponse.md)\>**
|
|
352
345
|
|
|
353
346
|
### Errors
|
|
354
347
|
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -39,13 +39,8 @@ import { Result } from "../types/fp.js";
|
|
|
39
39
|
* withdrawing the originally requested amount, the cooldown period restarts.
|
|
40
40
|
*
|
|
41
41
|
* Yield is not earned on USDe while in its cooldown period.
|
|
42
|
-
* <Info>
|
|
43
|
-
* **Required Allowances**
|
|
44
42
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* - `EthenaVault`
|
|
48
|
-
* </Info>
|
|
43
|
+
* An allowance does not have to be set to initiate the cooldown period.
|
|
49
44
|
*/
|
|
50
45
|
export function ethenaEthenaRequest(
|
|
51
46
|
client: CompassApiSDKCore,
|
|
@@ -26,25 +26,27 @@ import { APICall, APIPromise } from "../types/async.js";
|
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Unstake USDe
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
*
|
|
32
|
+
* Unstake deposited USDe from Ethena's vault.
|
|
33
|
+
*
|
|
34
|
+
* Verify that the USDe being unstaked has completed its mandatory cooldown period
|
|
35
|
+
* using the Ethena 'Get Vault & User Position' endpoint.
|
|
36
|
+
*
|
|
37
|
+
* This is an all or nothing action. All of the USDe that has completed its cooldown
|
|
38
|
+
* period must be withdrawn.
|
|
33
39
|
*
|
|
34
40
|
* The passive yield earned on USDe deposits is represented by the increased value of
|
|
35
41
|
* the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
36
42
|
* for the intial USDe deposited and any accrued yield since depositing.
|
|
37
|
-
* <Info>
|
|
38
|
-
* **Required Allowances**
|
|
39
|
-
*
|
|
40
|
-
* In order to make this transaction, token allowances need to be set for the following contracts.
|
|
41
43
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
+
* An allowance does not have to be set to unstake USDe that has completed its cooldown
|
|
45
|
+
* period.
|
|
44
46
|
*/
|
|
45
|
-
export function
|
|
47
|
+
export function ethenaEthenaUnstake(
|
|
46
48
|
client: CompassApiSDKCore,
|
|
47
|
-
request: components.
|
|
49
|
+
request: components.EthenaUnstakeRequest,
|
|
48
50
|
options?: RequestOptions,
|
|
49
51
|
): APIPromise<
|
|
50
52
|
Result<
|
|
@@ -69,7 +71,7 @@ export function ethenaEthenaWithdraw(
|
|
|
69
71
|
|
|
70
72
|
async function $do(
|
|
71
73
|
client: CompassApiSDKCore,
|
|
72
|
-
request: components.
|
|
74
|
+
request: components.EthenaUnstakeRequest,
|
|
73
75
|
options?: RequestOptions,
|
|
74
76
|
): Promise<
|
|
75
77
|
[
|
|
@@ -90,7 +92,7 @@ async function $do(
|
|
|
90
92
|
> {
|
|
91
93
|
const parsed = safeParse(
|
|
92
94
|
request,
|
|
93
|
-
(value) => components.
|
|
95
|
+
(value) => components.EthenaUnstakeRequest$outboundSchema.parse(value),
|
|
94
96
|
"Input validation failed",
|
|
95
97
|
);
|
|
96
98
|
if (!parsed.ok) {
|
|
@@ -99,7 +101,7 @@ async function $do(
|
|
|
99
101
|
const payload = parsed.value;
|
|
100
102
|
const body = encodeJSON("body", payload, { explode: true });
|
|
101
103
|
|
|
102
|
-
const path = pathToFunc("/v1/ethena/
|
|
104
|
+
const path = pathToFunc("/v1/ethena/unstake")();
|
|
103
105
|
|
|
104
106
|
const headers = new Headers(compactMap({
|
|
105
107
|
"Content-Type": "application/json",
|
|
@@ -113,7 +115,7 @@ async function $do(
|
|
|
113
115
|
const context = {
|
|
114
116
|
options: client._options,
|
|
115
117
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
-
operationID: "
|
|
118
|
+
operationID: "v1_ethena_unstake",
|
|
117
119
|
oAuth2Scopes: [],
|
|
118
120
|
|
|
119
121
|
resolvedSecurity: requestSecurity,
|
package/src/lib/config.ts
CHANGED
|
@@ -61,8 +61,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
61
61
|
export const SDK_METADATA = {
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
|
-
sdkVersion: "1.0.
|
|
64
|
+
sdkVersion: "1.0.18",
|
|
65
65
|
genVersion: "2.684.0",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 1.0.
|
|
67
|
+
"speakeasy-sdk/typescript 1.0.18 2.684.0 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -39,8 +39,8 @@ import { tool$erc4626VaultsVaultsVault } from "./tools/erc4626VaultsVaultsVault.
|
|
|
39
39
|
import { tool$erc4626VaultsVaultsWithdraw } from "./tools/erc4626VaultsVaultsWithdraw.js";
|
|
40
40
|
import { tool$ethenaEthenaDeposit } from "./tools/ethenaEthenaDeposit.js";
|
|
41
41
|
import { tool$ethenaEthenaRequest } from "./tools/ethenaEthenaRequest.js";
|
|
42
|
+
import { tool$ethenaEthenaUnstake } from "./tools/ethenaEthenaUnstake.js";
|
|
42
43
|
import { tool$ethenaEthenaVault } from "./tools/ethenaEthenaVault.js";
|
|
43
|
-
import { tool$ethenaEthenaWithdraw } from "./tools/ethenaEthenaWithdraw.js";
|
|
44
44
|
import { tool$morphoMorphoBorrow } from "./tools/morphoMorphoBorrow.js";
|
|
45
45
|
import { tool$morphoMorphoDeposit } from "./tools/morphoMorphoDeposit.js";
|
|
46
46
|
import { tool$morphoMorphoMarket } from "./tools/morphoMorphoMarket.js";
|
|
@@ -103,7 +103,7 @@ export function createMCPServer(deps: {
|
|
|
103
103
|
}) {
|
|
104
104
|
const server = new McpServer({
|
|
105
105
|
name: "CompassApiSDK",
|
|
106
|
-
version: "1.0.
|
|
106
|
+
version: "1.0.18",
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
const client = new CompassApiSDKCore({
|
|
@@ -210,8 +210,8 @@ export function createMCPServer(deps: {
|
|
|
210
210
|
tool(tool$erc4626VaultsVaultsWithdraw);
|
|
211
211
|
tool(tool$ethenaEthenaVault);
|
|
212
212
|
tool(tool$ethenaEthenaDeposit);
|
|
213
|
-
tool(tool$ethenaEthenaWithdraw);
|
|
214
213
|
tool(tool$ethenaEthenaRequest);
|
|
214
|
+
tool(tool$ethenaEthenaUnstake);
|
|
215
215
|
|
|
216
216
|
return server;
|
|
217
217
|
}
|
|
@@ -24,14 +24,8 @@ If an additional amount of USDe is requested to be withdrawn anytime before
|
|
|
24
24
|
withdrawing the originally requested amount, the cooldown period restarts.
|
|
25
25
|
|
|
26
26
|
Yield is not earned on USDe while in its cooldown period.
|
|
27
|
-
<Info>
|
|
28
|
-
**Required Allowances**
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- \`EthenaVault\`
|
|
33
|
-
</Info>
|
|
34
|
-
`,
|
|
28
|
+
An allowance does not have to be set to initiate the cooldown period.`,
|
|
35
29
|
args,
|
|
36
30
|
tool: async (client, args, ctx) => {
|
|
37
31
|
const [result, apiCall] = await ethenaEthenaRequest(
|
|
@@ -2,34 +2,35 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { ethenaEthenaUnstake } from "../../funcs/ethenaEthenaUnstake.js";
|
|
6
6
|
import * as components from "../../models/components/index.js";
|
|
7
7
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
8
|
|
|
9
9
|
const args = {
|
|
10
|
-
request: components.
|
|
10
|
+
request: components.EthenaUnstakeRequest$inboundSchema,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const tool$
|
|
14
|
-
name: "ethena-ethena-
|
|
15
|
-
description: `
|
|
13
|
+
export const tool$ethenaEthenaUnstake: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "ethena-ethena-unstake",
|
|
15
|
+
description: `Unstake USDe
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Unstake deposited USDe from Ethena's vault.
|
|
18
|
+
|
|
19
|
+
Verify that the USDe being unstaked has completed its mandatory cooldown period
|
|
20
|
+
using the Ethena 'Get Vault & User Position' endpoint.
|
|
21
|
+
|
|
22
|
+
This is an all or nothing action. All of the USDe that has completed its cooldown
|
|
23
|
+
period must be withdrawn.
|
|
18
24
|
|
|
19
25
|
The passive yield earned on USDe deposits is represented by the increased value of
|
|
20
26
|
the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
21
27
|
for the intial USDe deposited and any accrued yield since depositing.
|
|
22
|
-
<Info>
|
|
23
|
-
**Required Allowances**
|
|
24
|
-
|
|
25
|
-
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`,
|
|
29
|
+
An allowance does not have to be set to unstake USDe that has completed its cooldown
|
|
30
|
+
period.`,
|
|
30
31
|
args,
|
|
31
32
|
tool: async (client, args, ctx) => {
|
|
32
|
-
const [result, apiCall] = await
|
|
33
|
+
const [result, apiCall] = await ethenaEthenaUnstake(
|
|
33
34
|
client,
|
|
34
35
|
args.request,
|
|
35
36
|
{ fetchOptions: { signal: ctx.signal } },
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type EthenaUnstakeParams = {
|
|
12
|
+
actionType?: "ETHENA_UNSTAKE" | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The address which will receive the unstaked USDe. Defaults to the sender.
|
|
15
|
+
*/
|
|
16
|
+
receiver?: string | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const EthenaUnstakeParams$inboundSchema: z.ZodType<
|
|
21
|
+
EthenaUnstakeParams,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
unknown
|
|
24
|
+
> = z.object({
|
|
25
|
+
action_type: z.literal("ETHENA_UNSTAKE").default("ETHENA_UNSTAKE"),
|
|
26
|
+
receiver: z.nullable(z.string()).optional(),
|
|
27
|
+
}).transform((v) => {
|
|
28
|
+
return remap$(v, {
|
|
29
|
+
"action_type": "actionType",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export type EthenaUnstakeParams$Outbound = {
|
|
35
|
+
action_type: "ETHENA_UNSTAKE";
|
|
36
|
+
receiver?: string | null | undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const EthenaUnstakeParams$outboundSchema: z.ZodType<
|
|
41
|
+
EthenaUnstakeParams$Outbound,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
EthenaUnstakeParams
|
|
44
|
+
> = z.object({
|
|
45
|
+
actionType: z.literal("ETHENA_UNSTAKE").default("ETHENA_UNSTAKE" as const),
|
|
46
|
+
receiver: z.nullable(z.string()).optional(),
|
|
47
|
+
}).transform((v) => {
|
|
48
|
+
return remap$(v, {
|
|
49
|
+
actionType: "action_type",
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
56
|
+
*/
|
|
57
|
+
export namespace EthenaUnstakeParams$ {
|
|
58
|
+
/** @deprecated use `EthenaUnstakeParams$inboundSchema` instead. */
|
|
59
|
+
export const inboundSchema = EthenaUnstakeParams$inboundSchema;
|
|
60
|
+
/** @deprecated use `EthenaUnstakeParams$outboundSchema` instead. */
|
|
61
|
+
export const outboundSchema = EthenaUnstakeParams$outboundSchema;
|
|
62
|
+
/** @deprecated use `EthenaUnstakeParams$Outbound` instead. */
|
|
63
|
+
export type Outbound = EthenaUnstakeParams$Outbound;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function ethenaUnstakeParamsToJSON(
|
|
67
|
+
ethenaUnstakeParams: EthenaUnstakeParams,
|
|
68
|
+
): string {
|
|
69
|
+
return JSON.stringify(
|
|
70
|
+
EthenaUnstakeParams$outboundSchema.parse(ethenaUnstakeParams),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function ethenaUnstakeParamsFromJSON(
|
|
75
|
+
jsonString: string,
|
|
76
|
+
): SafeParseResult<EthenaUnstakeParams, SDKValidationError> {
|
|
77
|
+
return safeParse(
|
|
78
|
+
jsonString,
|
|
79
|
+
(x) => EthenaUnstakeParams$inboundSchema.parse(JSON.parse(x)),
|
|
80
|
+
`Failed to parse 'EthenaUnstakeParams' from JSON`,
|
|
81
|
+
);
|
|
82
|
+
}
|