@compass-labs/api-sdk 2.1.26-rc.0 → 2.1.26-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codeSamples_typescript.yaml +1 -1
- package/dist/commonjs/funcs/earnEarnManage.d.ts +4 -1
- package/dist/commonjs/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnManage.js +4 -1
- package/dist/commonjs/funcs/earnEarnManage.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.d.ts +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.js +1 -2
- package/dist/commonjs/funcs/earnEarnPositions.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/components/aaveposition.d.ts +5 -4
- package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/aaveposition.js +2 -1
- package/dist/commonjs/models/components/aaveposition.js.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/commonjs/models/components/depositevent.d.ts +32 -0
- package/dist/commonjs/models/components/depositevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/depositevent.js +63 -0
- package/dist/commonjs/models/components/depositevent.js.map +1 -0
- package/dist/commonjs/models/components/fee.d.ts +6 -5
- package/dist/commonjs/models/components/fee.d.ts.map +1 -1
- package/dist/commonjs/models/components/fee.js +2 -1
- package/dist/commonjs/models/components/fee.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +3 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +3 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/positionpnl.d.ts +50 -0
- package/dist/commonjs/models/components/positionpnl.d.ts.map +1 -0
- package/dist/commonjs/models/components/positionpnl.js +71 -0
- package/dist/commonjs/models/components/positionpnl.js.map +1 -0
- package/dist/commonjs/models/components/withdrawalevent.d.ts +40 -0
- package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/withdrawalevent.js +67 -0
- package/dist/commonjs/models/components/withdrawalevent.js.map +1 -0
- package/dist/commonjs/models/operations/v2earnpositions.d.ts +0 -5
- package/dist/commonjs/models/operations/v2earnpositions.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnpositions.js +0 -1
- package/dist/commonjs/models/operations/v2earnpositions.js.map +1 -1
- package/dist/commonjs/sdk/earn.d.ts +5 -2
- package/dist/commonjs/sdk/earn.d.ts.map +1 -1
- package/dist/commonjs/sdk/earn.js +5 -2
- package/dist/commonjs/sdk/earn.js.map +1 -1
- package/dist/esm/funcs/earnEarnManage.d.ts +4 -1
- package/dist/esm/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnManage.js +4 -1
- package/dist/esm/funcs/earnEarnManage.js.map +1 -1
- package/dist/esm/funcs/earnEarnPositions.d.ts +1 -1
- package/dist/esm/funcs/earnEarnPositions.js +1 -2
- package/dist/esm/funcs/earnEarnPositions.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/components/aaveposition.d.ts +5 -4
- package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
- package/dist/esm/models/components/aaveposition.js +2 -1
- package/dist/esm/models/components/aaveposition.js.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/esm/models/components/depositevent.d.ts +32 -0
- package/dist/esm/models/components/depositevent.d.ts.map +1 -0
- package/dist/esm/models/components/depositevent.js +26 -0
- package/dist/esm/models/components/depositevent.js.map +1 -0
- package/dist/esm/models/components/fee.d.ts +6 -5
- package/dist/esm/models/components/fee.d.ts.map +1 -1
- package/dist/esm/models/components/fee.js +2 -1
- package/dist/esm/models/components/fee.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +3 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +3 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/positionpnl.d.ts +50 -0
- package/dist/esm/models/components/positionpnl.d.ts.map +1 -0
- package/dist/esm/models/components/positionpnl.js +34 -0
- package/dist/esm/models/components/positionpnl.js.map +1 -0
- package/dist/esm/models/components/withdrawalevent.d.ts +40 -0
- package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/esm/models/components/withdrawalevent.js +30 -0
- package/dist/esm/models/components/withdrawalevent.js.map +1 -0
- package/dist/esm/models/operations/v2earnpositions.d.ts +0 -5
- package/dist/esm/models/operations/v2earnpositions.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnpositions.js +0 -1
- package/dist/esm/models/operations/v2earnpositions.js.map +1 -1
- package/dist/esm/sdk/earn.d.ts +5 -2
- package/dist/esm/sdk/earn.d.ts.map +1 -1
- package/dist/esm/sdk/earn.js +5 -2
- package/dist/esm/sdk/earn.js.map +1 -1
- package/docs/models/components/aaveliquiditychangeresponse.md +2 -2
- package/docs/models/components/aaveposition.md +8 -9
- package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +8 -9
- package/docs/models/components/cooldownend.md +1 -1
- package/docs/models/components/cooldownposition.md +1 -1
- package/docs/models/components/denomination.md +2 -2
- package/docs/models/components/depositevent.md +27 -0
- package/docs/models/components/fee.md +5 -5
- package/docs/models/components/feeamount.md +1 -1
- package/docs/models/components/pendlegetmarketresponse.md +1 -1
- package/docs/models/components/pendlelistmarketsresponse.md +2 -2
- package/docs/models/components/pendlelistuserpositionsresponse.md +1 -1
- package/docs/models/components/pendlemarket.md +2 -2
- package/docs/models/components/position.md +1 -1
- package/docs/models/components/positionpnl.md +33 -0
- package/docs/models/components/userposition.md +0 -2
- package/docs/models/components/withdrawalevent.md +31 -0
- package/docs/models/operations/v2earnpositionsrequest.md +1 -3
- package/docs/sdks/earn/README.md +5 -4
- package/package.json +1 -1
- package/src/funcs/earnEarnManage.ts +4 -1
- package/src/funcs/earnEarnPositions.ts +1 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/aaveposition.ts +6 -5
- package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +6 -5
- package/src/models/components/depositevent.ts +66 -0
- package/src/models/components/fee.ts +6 -5
- package/src/models/components/index.ts +3 -0
- package/src/models/components/positionpnl.ts +93 -0
- package/src/models/components/withdrawalevent.ts +78 -0
- package/src/models/operations/v2earnpositions.ts +0 -6
- package/src/sdk/earn.ts +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Denomination
|
|
2
2
|
|
|
3
|
-
The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount)
|
|
3
|
+
The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).
|
|
4
4
|
|
|
5
5
|
## Example Usage
|
|
6
6
|
|
|
@@ -13,5 +13,5 @@ let value: Denomination = "PERCENTAGE";
|
|
|
13
13
|
## Values
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
"PERCENTAGE" | "FIXED"
|
|
16
|
+
"PERCENTAGE" | "FIXED" | "PERFORMANCE"
|
|
17
17
|
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# DepositEvent
|
|
2
|
+
|
|
3
|
+
Historical deposit event for position transparency.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DepositEvent } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: DepositEvent = {
|
|
11
|
+
blockNumber: 328246,
|
|
12
|
+
transactionHash: "<value>",
|
|
13
|
+
assetsDeposited: "<value>",
|
|
14
|
+
unitsReceived: "<value>",
|
|
15
|
+
costPerUnit: "<value>",
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Fields
|
|
20
|
+
|
|
21
|
+
| Field | Type | Required | Description |
|
|
22
|
+
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
|
23
|
+
| `blockNumber` | *number* | :heavy_check_mark: | Block number when deposit occurred |
|
|
24
|
+
| `transactionHash` | *string* | :heavy_check_mark: | Transaction hash of the deposit |
|
|
25
|
+
| `assetsDeposited` | *string* | :heavy_check_mark: | Amount of underlying asset deposited |
|
|
26
|
+
| `unitsReceived` | *string* | :heavy_check_mark: | Shares (vault) or aTokens (Aave) received |
|
|
27
|
+
| `costPerUnit` | *string* | :heavy_check_mark: | Cost basis per unit at time of deposit |
|
|
@@ -14,8 +14,8 @@ let value: Fee = {
|
|
|
14
14
|
|
|
15
15
|
## Fields
|
|
16
16
|
|
|
17
|
-
| Field
|
|
18
|
-
|
|
|
19
|
-
| `recipient`
|
|
20
|
-
| `amount`
|
|
21
|
-
| `denomination`
|
|
17
|
+
| Field | Type | Required | Description | Example |
|
|
18
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
19
|
+
| `recipient` | *string* | :heavy_check_mark: | The wallet address that will receive the fee. | |
|
|
20
|
+
| `amount` | *components.FeeAmount* | :heavy_check_mark: | The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit). | |
|
|
21
|
+
| `denomination` | [components.Denomination](../../models/components/denomination.md) | :heavy_minus_sign: | The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit). | PERCENTAGE |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FeeAmount
|
|
2
2
|
|
|
3
|
-
The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens).
|
|
3
|
+
The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Supported Types
|
|
@@ -8,7 +8,7 @@ import { PendleGetMarketResponse } from "@compass-labs/api-sdk/models/components
|
|
|
8
8
|
let value: PendleGetMarketResponse = {
|
|
9
9
|
marketAddress: "<value>",
|
|
10
10
|
impliedApy: "<value>",
|
|
11
|
-
maturityDate: new Date("
|
|
11
|
+
maturityDate: new Date("2024-10-17T22:09:52.103Z"),
|
|
12
12
|
tokens: {
|
|
13
13
|
underlyingToken: {
|
|
14
14
|
address: "46793 Schneider Mount",
|
|
@@ -10,7 +10,7 @@ let value: PendleListMarketsResponse = {
|
|
|
10
10
|
{
|
|
11
11
|
name: "<value>",
|
|
12
12
|
address: "9178 Rebeca Burgs",
|
|
13
|
-
expiry: new Date("
|
|
13
|
+
expiry: new Date("2026-11-13T22:39:31.641Z"),
|
|
14
14
|
pt: "<value>",
|
|
15
15
|
yt: "<value>",
|
|
16
16
|
sy: "<value>",
|
|
@@ -29,7 +29,7 @@ let value: PendleListMarketsResponse = {
|
|
|
29
29
|
},
|
|
30
30
|
isNew: true,
|
|
31
31
|
isPrime: false,
|
|
32
|
-
timestamp: new Date("
|
|
32
|
+
timestamp: new Date("2025-03-28T12:44:40.088Z"),
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
35
|
};
|
|
@@ -8,7 +8,7 @@ import { PendleMarket } from "@compass-labs/api-sdk/models/components";
|
|
|
8
8
|
let value: PendleMarket = {
|
|
9
9
|
name: "<value>",
|
|
10
10
|
address: "22458 Abshire Plains",
|
|
11
|
-
expiry: new Date("
|
|
11
|
+
expiry: new Date("2024-04-17T01:20:41.264Z"),
|
|
12
12
|
pt: "<value>",
|
|
13
13
|
yt: "<value>",
|
|
14
14
|
sy: "<value>",
|
|
@@ -27,7 +27,7 @@ let value: PendleMarket = {
|
|
|
27
27
|
},
|
|
28
28
|
isNew: true,
|
|
29
29
|
isPrime: false,
|
|
30
|
-
timestamp: new Date("
|
|
30
|
+
timestamp: new Date("2026-09-13T17:20:16.991Z"),
|
|
31
31
|
};
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# PositionPnL
|
|
2
|
+
|
|
3
|
+
PnL breakdown for a position.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { PositionPnL } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: PositionPnL = {
|
|
11
|
+
totalDeposited: "<value>",
|
|
12
|
+
totalWithdrawn: "<value>",
|
|
13
|
+
costBasis: "<value>",
|
|
14
|
+
unrealizedPnl: "<value>",
|
|
15
|
+
realizedPnl: "<value>",
|
|
16
|
+
totalYield: "<value>",
|
|
17
|
+
totalFeesPaid: "<id>",
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Fields
|
|
22
|
+
|
|
23
|
+
| Field | Type | Required | Description |
|
|
24
|
+
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
25
|
+
| `totalDeposited` | *string* | :heavy_check_mark: | Total assets deposited over all time |
|
|
26
|
+
| `totalWithdrawn` | *string* | :heavy_check_mark: | Total assets withdrawn over all time |
|
|
27
|
+
| `costBasis` | *string* | :heavy_check_mark: | FIFO cost basis of remaining position |
|
|
28
|
+
| `unrealizedPnl` | *string* | :heavy_check_mark: | current_value - cost_basis |
|
|
29
|
+
| `realizedPnl` | *string* | :heavy_check_mark: | Sum of profits/losses from all withdrawals |
|
|
30
|
+
| `totalYield` | *string* | :heavy_check_mark: | unrealized_pnl + realized_pnl |
|
|
31
|
+
| `totalFeesPaid` | *string* | :heavy_check_mark: | Sum of performance fees paid |
|
|
32
|
+
| `deposits` | [components.DepositEvent](../../models/components/depositevent.md)[] | :heavy_minus_sign: | All deposit events for this position |
|
|
33
|
+
| `withdrawals` | [components.WithdrawalEvent](../../models/components/withdrawalevent.md)[] | :heavy_minus_sign: | All withdrawal events for this position |
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
```typescript
|
|
9
9
|
const value: components.AavePosition = {
|
|
10
10
|
type: "AAVE",
|
|
11
|
-
id: "<id>",
|
|
12
11
|
amountInUnderlyingToken: "<value>",
|
|
13
12
|
tokenName: "<value>",
|
|
14
13
|
};
|
|
@@ -20,7 +19,6 @@ const value: components.AavePosition = {
|
|
|
20
19
|
const value:
|
|
21
20
|
components.CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
22
21
|
type: "VAULT",
|
|
23
|
-
id: "<id>",
|
|
24
22
|
vaultAddress: "<value>",
|
|
25
23
|
amountInUnderlyingToken: "<value>",
|
|
26
24
|
tokenName: "<value>",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# WithdrawalEvent
|
|
2
|
+
|
|
3
|
+
Historical withdrawal event with realized PnL.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { WithdrawalEvent } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: WithdrawalEvent = {
|
|
11
|
+
blockNumber: 460436,
|
|
12
|
+
transactionHash: "<value>",
|
|
13
|
+
assetsReceived: "<value>",
|
|
14
|
+
unitsWithdrawn: "<value>",
|
|
15
|
+
costBasisConsumed: "<value>",
|
|
16
|
+
realizedPnl: "<value>",
|
|
17
|
+
feeCharged: "<value>",
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Fields
|
|
22
|
+
|
|
23
|
+
| Field | Type | Required | Description |
|
|
24
|
+
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
|
25
|
+
| `blockNumber` | *number* | :heavy_check_mark: | Block number when withdrawal occurred |
|
|
26
|
+
| `transactionHash` | *string* | :heavy_check_mark: | Transaction hash of the withdrawal |
|
|
27
|
+
| `assetsReceived` | *string* | :heavy_check_mark: | Amount of underlying asset received |
|
|
28
|
+
| `unitsWithdrawn` | *string* | :heavy_check_mark: | Shares (vault) or aTokens (Aave) burned |
|
|
29
|
+
| `costBasisConsumed` | *string* | :heavy_check_mark: | FIFO cost basis of units withdrawn |
|
|
30
|
+
| `realizedPnl` | *string* | :heavy_check_mark: | Profit/loss: assets_received - cost_basis_consumed |
|
|
31
|
+
| `feeCharged` | *string* | :heavy_check_mark: | Performance fee charged on this withdrawal |
|
|
@@ -10,7 +10,6 @@ let value: V2EarnPositionsRequest = {
|
|
|
10
10
|
limit: 100,
|
|
11
11
|
chain: "base",
|
|
12
12
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
13
|
-
days: 30,
|
|
14
13
|
};
|
|
15
14
|
```
|
|
16
15
|
|
|
@@ -21,5 +20,4 @@ let value: V2EarnPositionsRequest = {
|
|
|
21
20
|
| `offset` | *number* | :heavy_minus_sign: | The offset of the first item to return. | 0 |
|
|
22
21
|
| `limit` | *number* | :heavy_minus_sign: | The number of items to return. | 100 |
|
|
23
22
|
| `chain` | [operations.V2EarnPositionsChain](../../models/operations/v2earnpositionschain.md) | :heavy_check_mark: | N/A | base |
|
|
24
|
-
| `userAddress` | *string* | :heavy_check_mark: | The address of the user to get vault positions for. | 0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c |
|
|
25
|
-
| `days` | *number* | :heavy_minus_sign: | How many days back from the current time to include in the blockchain scan. | 30 |
|
|
23
|
+
| `userAddress` | *string* | :heavy_check_mark: | The address of the user to get vault positions for. | 0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c |
|
package/docs/sdks/earn/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## earnPositions
|
|
17
17
|
|
|
18
|
-
This endpoint fetches all Compass Earn positions.
|
|
18
|
+
This endpoint fetches all Compass Earn positions with PnL information.
|
|
19
19
|
|
|
20
20
|
### Example Usage
|
|
21
21
|
|
|
@@ -33,7 +33,6 @@ async function run() {
|
|
|
33
33
|
limit: 100,
|
|
34
34
|
chain: "base",
|
|
35
35
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
36
|
-
days: 30,
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
console.log(result);
|
|
@@ -62,7 +61,6 @@ async function run() {
|
|
|
62
61
|
limit: 100,
|
|
63
62
|
chain: "base",
|
|
64
63
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
65
|
-
days: 30,
|
|
66
64
|
});
|
|
67
65
|
if (res.ok) {
|
|
68
66
|
const { value: result } = res;
|
|
@@ -447,7 +445,10 @@ If `DEPOSIT` is selected for `action`, tokens will be deposited into the selecte
|
|
|
447
445
|
|
|
448
446
|
If `WITHDRAW` is selected for `action`, tokens will be withdrawn from the selected venue address back into the Earn Account associated with the `owner` wallet.
|
|
449
447
|
|
|
450
|
-
A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as
|
|
448
|
+
A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
|
|
449
|
+
- `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
450
|
+
- `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
|
|
451
|
+
- `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
|
|
451
452
|
|
|
452
453
|
The transaction can be gas-sponsored by an arbitrary wallet address which will sign, submit and pay the required gas for the transaction. If `gas_sponsorship` is set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where the `sender` of the transaction can be set.
|
|
453
454
|
|
package/package.json
CHANGED
|
@@ -41,7 +41,10 @@ import { Result } from "../types/fp.js";
|
|
|
41
41
|
*
|
|
42
42
|
* If `WITHDRAW` is selected for `action`, tokens will be withdrawn from the selected venue address back into the Earn Account associated with the `owner` wallet.
|
|
43
43
|
*
|
|
44
|
-
* A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as
|
|
44
|
+
* A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
|
|
45
|
+
* - `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
46
|
+
* - `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
|
|
47
|
+
* - `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
|
|
45
48
|
*
|
|
46
49
|
* The transaction can be gas-sponsored by an arbitrary wallet address which will sign, submit and pay the required gas for the transaction. If `gas_sponsorship` is set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where the `sender` of the transaction can be set.
|
|
47
50
|
*/
|
|
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* List earn positions
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* This endpoint fetches all Compass Earn positions.
|
|
33
|
+
* This endpoint fetches all Compass Earn positions with PnL information.
|
|
34
34
|
*/
|
|
35
35
|
export function earnEarnPositions(
|
|
36
36
|
client: CompassApiSDKCore,
|
|
@@ -93,7 +93,6 @@ async function $do(
|
|
|
93
93
|
|
|
94
94
|
const query = encodeFormQuery({
|
|
95
95
|
"chain": payload.chain,
|
|
96
|
-
"days": payload.days,
|
|
97
96
|
"limit": payload.limit,
|
|
98
97
|
"offset": payload.offset,
|
|
99
98
|
"user_address": payload.user_address,
|
package/src/lib/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
|
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
64
|
sdkVersion: "2.0.0",
|
|
65
|
-
genVersion: "2.788.
|
|
65
|
+
genVersion: "2.788.15",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.788.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.788.15 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -7,16 +7,13 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
|
|
10
11
|
|
|
11
12
|
export type AavePosition = {
|
|
12
13
|
/**
|
|
13
14
|
* The market type discriminator.
|
|
14
15
|
*/
|
|
15
16
|
type: "AAVE";
|
|
16
|
-
/**
|
|
17
|
-
* Base64-encoded position identifier.
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
17
|
vaultAddress?: "None" | undefined;
|
|
21
18
|
/**
|
|
22
19
|
* The user's position value denominated in the supplied asset.
|
|
@@ -27,6 +24,10 @@ export type AavePosition = {
|
|
|
27
24
|
*/
|
|
28
25
|
tokenName: string;
|
|
29
26
|
vaultName?: "None" | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* PnL breakdown with full deposit/withdrawal history.
|
|
29
|
+
*/
|
|
30
|
+
pnl?: PositionPnL | null | undefined;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
/** @internal */
|
|
@@ -36,11 +37,11 @@ export const AavePosition$inboundSchema: z.ZodType<
|
|
|
36
37
|
unknown
|
|
37
38
|
> = z.object({
|
|
38
39
|
type: z.literal("AAVE"),
|
|
39
|
-
id: z.string(),
|
|
40
40
|
vault_address: z.literal("None").optional(),
|
|
41
41
|
amount_in_underlying_token: z.string(),
|
|
42
42
|
token_name: z.string(),
|
|
43
43
|
vault_name: z.literal("None").optional(),
|
|
44
|
+
pnl: z.nullable(PositionPnL$inboundSchema).optional(),
|
|
44
45
|
}).transform((v) => {
|
|
45
46
|
return remap$(v, {
|
|
46
47
|
"vault_address": "vaultAddress",
|
package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts
CHANGED
|
@@ -7,16 +7,13 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
|
|
10
11
|
|
|
11
12
|
export type CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
12
13
|
/**
|
|
13
14
|
* The market type discriminator.
|
|
14
15
|
*/
|
|
15
16
|
type: "VAULT";
|
|
16
|
-
/**
|
|
17
|
-
* Base64-encoded position identifier.
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
17
|
/**
|
|
21
18
|
* The vault address you are depositing to.
|
|
22
19
|
*/
|
|
@@ -33,6 +30,10 @@ export type CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
|
33
30
|
* Name of the vault token (share token).
|
|
34
31
|
*/
|
|
35
32
|
vaultName: string;
|
|
33
|
+
/**
|
|
34
|
+
* PnL breakdown with full deposit/withdrawal history.
|
|
35
|
+
*/
|
|
36
|
+
pnl?: PositionPnL | null | undefined;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
/** @internal */
|
|
@@ -43,11 +44,11 @@ export const CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inb
|
|
|
43
44
|
unknown
|
|
44
45
|
> = z.object({
|
|
45
46
|
type: z.literal("VAULT"),
|
|
46
|
-
id: z.string(),
|
|
47
47
|
vault_address: z.string(),
|
|
48
48
|
amount_in_underlying_token: z.string(),
|
|
49
49
|
token_name: z.string(),
|
|
50
50
|
vault_name: z.string(),
|
|
51
|
+
pnl: z.nullable(PositionPnL$inboundSchema).optional(),
|
|
51
52
|
}).transform((v) => {
|
|
52
53
|
return remap$(v, {
|
|
53
54
|
"vault_address": "vaultAddress",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
/**
|
|
12
|
+
* Historical deposit event for position transparency.
|
|
13
|
+
*/
|
|
14
|
+
export type DepositEvent = {
|
|
15
|
+
/**
|
|
16
|
+
* Block number when deposit occurred
|
|
17
|
+
*/
|
|
18
|
+
blockNumber: number;
|
|
19
|
+
/**
|
|
20
|
+
* Transaction hash of the deposit
|
|
21
|
+
*/
|
|
22
|
+
transactionHash: string;
|
|
23
|
+
/**
|
|
24
|
+
* Amount of underlying asset deposited
|
|
25
|
+
*/
|
|
26
|
+
assetsDeposited: string;
|
|
27
|
+
/**
|
|
28
|
+
* Shares (vault) or aTokens (Aave) received
|
|
29
|
+
*/
|
|
30
|
+
unitsReceived: string;
|
|
31
|
+
/**
|
|
32
|
+
* Cost basis per unit at time of deposit
|
|
33
|
+
*/
|
|
34
|
+
costPerUnit: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const DepositEvent$inboundSchema: z.ZodType<
|
|
39
|
+
DepositEvent,
|
|
40
|
+
z.ZodTypeDef,
|
|
41
|
+
unknown
|
|
42
|
+
> = z.object({
|
|
43
|
+
block_number: z.number().int(),
|
|
44
|
+
transaction_hash: z.string(),
|
|
45
|
+
assets_deposited: z.string(),
|
|
46
|
+
units_received: z.string(),
|
|
47
|
+
cost_per_unit: z.string(),
|
|
48
|
+
}).transform((v) => {
|
|
49
|
+
return remap$(v, {
|
|
50
|
+
"block_number": "blockNumber",
|
|
51
|
+
"transaction_hash": "transactionHash",
|
|
52
|
+
"assets_deposited": "assetsDeposited",
|
|
53
|
+
"units_received": "unitsReceived",
|
|
54
|
+
"cost_per_unit": "costPerUnit",
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export function depositEventFromJSON(
|
|
59
|
+
jsonString: string,
|
|
60
|
+
): SafeParseResult<DepositEvent, SDKValidationError> {
|
|
61
|
+
return safeParse(
|
|
62
|
+
jsonString,
|
|
63
|
+
(x) => DepositEvent$inboundSchema.parse(JSON.parse(x)),
|
|
64
|
+
`Failed to parse 'DepositEvent' from JSON`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -6,19 +6,20 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { ClosedEnum } from "../../types/enums.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens).
|
|
9
|
+
* The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
|
|
10
10
|
*/
|
|
11
11
|
export type FeeAmount = number | string;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount)
|
|
14
|
+
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).
|
|
15
15
|
*/
|
|
16
16
|
export const Denomination = {
|
|
17
17
|
Percentage: "PERCENTAGE",
|
|
18
18
|
Fixed: "FIXED",
|
|
19
|
+
Performance: "PERFORMANCE",
|
|
19
20
|
} as const;
|
|
20
21
|
/**
|
|
21
|
-
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount)
|
|
22
|
+
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).
|
|
22
23
|
*/
|
|
23
24
|
export type Denomination = ClosedEnum<typeof Denomination>;
|
|
24
25
|
|
|
@@ -28,11 +29,11 @@ export type Fee = {
|
|
|
28
29
|
*/
|
|
29
30
|
recipient: string;
|
|
30
31
|
/**
|
|
31
|
-
* The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens).
|
|
32
|
+
* The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
|
|
32
33
|
*/
|
|
33
34
|
amount: number | string;
|
|
34
35
|
/**
|
|
35
|
-
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount)
|
|
36
|
+
* The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).
|
|
36
37
|
*/
|
|
37
38
|
denomination?: Denomination | undefined;
|
|
38
39
|
};
|
|
@@ -79,6 +79,7 @@ export * from "./compassapibackendv2modelssafetransactresponsebatchedsafeoperati
|
|
|
79
79
|
export * from "./cooldownposition.js";
|
|
80
80
|
export * from "./createaccountrequest.js";
|
|
81
81
|
export * from "./createaccountresponse.js";
|
|
82
|
+
export * from "./depositevent.js";
|
|
82
83
|
export * from "./depositforburnrequest.js";
|
|
83
84
|
export * from "./depositforburnresponse.js";
|
|
84
85
|
export * from "./details.js";
|
|
@@ -168,6 +169,7 @@ export * from "./permittypeddataresponseinput.js";
|
|
|
168
169
|
export * from "./permittypeddataresponseoutput.js";
|
|
169
170
|
export * from "./portfolio.js";
|
|
170
171
|
export * from "./position.js";
|
|
172
|
+
export * from "./positionpnl.js";
|
|
171
173
|
export * from "./protocol.js";
|
|
172
174
|
export * from "./repay.js";
|
|
173
175
|
export * from "./reserve.js";
|
|
@@ -246,6 +248,7 @@ export * from "./vaultwithdrawrequest.js";
|
|
|
246
248
|
export * from "./weeklyapys.js";
|
|
247
249
|
export * from "./wildcatgetmarketresponse.js";
|
|
248
250
|
export * from "./withdraw.js";
|
|
251
|
+
export * from "./withdrawalevent.js";
|
|
249
252
|
export * from "./wrapethparams.js";
|
|
250
253
|
export * from "./wrapethrequest.js";
|
|
251
254
|
export * from "./yieldrange.js";
|