@compass-labs/api-sdk 2.2.3 → 2.2.4
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/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/earntransferfromeoaparams.d.ts +64 -0
- package/dist/commonjs/models/components/earntransferfromeoaparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/earntransferfromeoaparams.js +68 -0
- package/dist/commonjs/models/components/earntransferfromeoaparams.js.map +1 -0
- package/dist/commonjs/models/components/earntransferrequest.d.ts +1 -1
- package/dist/commonjs/models/components/earntransfertoeoaparams.d.ts +36 -0
- package/dist/commonjs/models/components/earntransfertoeoaparams.d.ts.map +1 -0
- package/dist/commonjs/models/components/earntransfertoeoaparams.js +56 -0
- package/dist/commonjs/models/components/earntransfertoeoaparams.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/v2bundlerequest.d.ts +41 -0
- package/dist/commonjs/models/components/v2bundlerequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2bundlerequest.js.map +1 -1
- package/dist/commonjs/models/components/v2useroperation.d.ts +6 -4
- package/dist/commonjs/models/components/v2useroperation.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2useroperation.js +10 -1
- package/dist/commonjs/models/components/v2useroperation.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/earntransferfromeoaparams.d.ts +64 -0
- package/dist/esm/models/components/earntransferfromeoaparams.d.ts.map +1 -0
- package/dist/esm/models/components/earntransferfromeoaparams.js +30 -0
- package/dist/esm/models/components/earntransferfromeoaparams.js.map +1 -0
- package/dist/esm/models/components/earntransferrequest.d.ts +1 -1
- package/dist/esm/models/components/earntransfertoeoaparams.d.ts +36 -0
- package/dist/esm/models/components/earntransfertoeoaparams.d.ts.map +1 -0
- package/dist/esm/models/components/earntransfertoeoaparams.js +19 -0
- package/dist/esm/models/components/earntransfertoeoaparams.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/v2bundlerequest.d.ts +41 -0
- package/dist/esm/models/components/v2bundlerequest.d.ts.map +1 -1
- package/dist/esm/models/components/v2bundlerequest.js.map +1 -1
- package/dist/esm/models/components/v2useroperation.d.ts +6 -4
- package/dist/esm/models/components/v2useroperation.d.ts.map +1 -1
- package/dist/esm/models/components/v2useroperation.js +10 -1
- package/dist/esm/models/components/v2useroperation.js.map +1 -1
- package/docs/models/components/aaveborrowrequestamount.md +1 -1
- package/docs/models/components/aaverepayrequestamount.md +1 -1
- package/docs/models/components/aavesupplyrequestamount.md +1 -1
- package/docs/models/components/aavewithdrawrequestamount.md +1 -1
- package/docs/models/components/aerodromeslipstreambuyexactlyrequestamountinmaximum.md +1 -1
- package/docs/models/components/aerodromeslipstreambuyexactlyrequestamountout.md +1 -1
- package/docs/models/components/aerodromeslipstreamincreaseliquidityprovisionrequestamount0desired.md +1 -1
- package/docs/models/components/aerodromeslipstreamincreaseliquidityprovisionrequestamount0min.md +1 -1
- package/docs/models/components/aerodromeslipstreamincreaseliquidityprovisionrequestamount1desired.md +1 -1
- package/docs/models/components/aerodromeslipstreamincreaseliquidityprovisionrequestamount1min.md +1 -1
- package/docs/models/components/aerodromeslipstreammintliquidityprovisionrequestamount0desired.md +1 -1
- package/docs/models/components/aerodromeslipstreammintliquidityprovisionrequestamount0min.md +1 -1
- package/docs/models/components/aerodromeslipstreammintliquidityprovisionrequestamount1desired.md +1 -1
- package/docs/models/components/aerodromeslipstreammintliquidityprovisionrequestamount1min.md +1 -1
- package/docs/models/components/aerodromeslipstreamsellexactlyparamsamountoutminimum.md +1 -1
- package/docs/models/components/aerodromeslipstreamsellexactlyrequestamountin.md +1 -1
- package/docs/models/components/aerodromeslipstreamsellexactlyrequestamountoutminimum.md +1 -1
- package/docs/models/components/aerodromeslipstreamwithdrawliquidityprovisionrequestpercentageforwithdrawal.md +1 -1
- package/docs/models/components/depositforburnrequestamount.md +1 -1
- package/docs/models/components/earnswapparamsslippage.md +1 -1
- package/docs/models/components/earnswaprequestamountin.md +1 -1
- package/docs/models/components/earnswaprequestslippage.md +1 -1
- package/docs/models/components/earntransferfromeoaparams.md +39 -0
- package/docs/models/components/earntransferfromeoaparamsamount.md +19 -0
- package/docs/models/components/earntransferrequest.md +9 -9
- package/docs/models/components/earntransferrequestamount.md +1 -1
- package/docs/models/components/earntransfertoeoaparams.md +29 -0
- package/docs/models/components/ethenadepositrequestamount.md +1 -1
- package/docs/models/components/initialcollateralamount.md +1 -1
- package/docs/models/components/loantovalue.md +1 -1
- package/docs/models/components/maxslippagepercent.md +1 -1
- package/docs/models/components/morphoborrowrequestamount.md +1 -1
- package/docs/models/components/morphodepositrequestamount.md +1 -1
- package/docs/models/components/morphosupplycollateralrequestamount.md +1 -1
- package/docs/models/components/morphowithdrawcollateralrequestamount.md +1 -1
- package/docs/models/components/multiplier.md +1 -1
- package/docs/models/components/odosswaprequestamountin.md +1 -1
- package/docs/models/components/pendlemanageliquidityrequestamountin.md +1 -1
- package/docs/models/components/pendletradeptrequestamountin.md +1 -1
- package/docs/models/components/pendletradeytrequestamountin.md +1 -1
- package/docs/models/components/setallowancerequestamount.md +1 -1
- package/docs/models/components/skybuyrequestamount.md +1 -1
- package/docs/models/components/skydepositrequestamount.md +1 -1
- package/docs/models/components/skysellrequestamount.md +1 -1
- package/docs/models/components/tokentransferrequestamount.md +1 -1
- package/docs/models/components/uniswapbuyexactlyrequestamountout.md +1 -1
- package/docs/models/components/uniswapincreaseliquidityprovisionrequestamount0desired.md +1 -1
- package/docs/models/components/uniswapincreaseliquidityprovisionrequestamount0min.md +1 -1
- package/docs/models/components/uniswapincreaseliquidityprovisionrequestamount1desired.md +1 -1
- package/docs/models/components/uniswapincreaseliquidityprovisionrequestamount1min.md +1 -1
- package/docs/models/components/uniswapmintliquidityprovisionrequestamount0desired.md +1 -1
- package/docs/models/components/uniswapmintliquidityprovisionrequestamount0min.md +1 -1
- package/docs/models/components/uniswapmintliquidityprovisionrequestamount1desired.md +1 -1
- package/docs/models/components/uniswapmintliquidityprovisionrequestamount1min.md +1 -1
- package/docs/models/components/uniswapsellexactlyrequestamountin.md +1 -1
- package/docs/models/components/uniswapwithdrawliquidityprovisionrequestpercentageforwithdrawal.md +1 -1
- package/docs/models/components/unwrapwethrequestamount.md +1 -1
- package/docs/models/components/v2bundlerequest.md +54 -6
- package/docs/models/components/v2useroperationbody.md +23 -0
- package/docs/models/components/vaultdepositrequestamount.md +1 -1
- package/docs/models/components/wrapethrequestamount.md +1 -1
- package/docs/models/operations/amountin.md +1 -1
- package/docs/models/operations/amountout.md +1 -1
- package/docs/sdks/earn/README.md +20 -0
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/earntransferfromeoaparams.ts +112 -0
- package/src/models/components/earntransferrequest.ts +1 -1
- package/src/models/components/earntransfertoeoaparams.ts +62 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/v2bundlerequest.ts +41 -0
- package/src/models/components/v2useroperation.ts +36 -5
|
@@ -16,12 +16,12 @@ let value: EarnTransferRequest = {
|
|
|
16
16
|
|
|
17
17
|
## Fields
|
|
18
18
|
|
|
19
|
-
| Field
|
|
20
|
-
|
|
|
21
|
-
| `owner`
|
|
22
|
-
| `chain`
|
|
23
|
-
| `token`
|
|
24
|
-
| `amount`
|
|
25
|
-
| `action`
|
|
26
|
-
| `gasSponsorship`
|
|
27
|
-
| `spender`
|
|
19
|
+
| Field | Type | Required | Description | Example |
|
|
20
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `owner` | *string* | :heavy_check_mark: | The owner's wallet address. | 0x01E62835dd7F52173546A325294762143eE4a882 |
|
|
22
|
+
| `chain` | [components.Chain](../../models/components/chain.md) | :heavy_check_mark: | The chain to use. | |
|
|
23
|
+
| `token` | *string* | :heavy_check_mark: | The token you would like to transfer. | USDC |
|
|
24
|
+
| `amount` | *components.EarnTransferRequestAmount* | :heavy_check_mark: | The amount of 'token' to transfer. | 0.01 |
|
|
25
|
+
| `action` | [components.EarnTransferRequestAction](../../models/components/earntransferrequestaction.md) | :heavy_check_mark: | Whether you are depositing to or withdrawing from your earn account. | DEPOSIT |
|
|
26
|
+
| `gasSponsorship` | *boolean* | :heavy_minus_sign: | Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint. | false |
|
|
27
|
+
| `spender` | *string* | :heavy_minus_sign: | The address that will call Permit2's permitTransferFrom to execute the transfer. When `action` is 'DEPOSIT' and `gas_sponsorship` is `true`: - If provided, the signature will authorize this address (typically a gas sponsor) to pull tokens. - If not provided, defaults to the Earn Account (Safe) address, allowing the transfer to be included in a bundle transaction where the Safe pulls the tokens itself. | |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# EarnTransferToEOAParams
|
|
2
|
+
|
|
3
|
+
Parameters for transferring tokens from Earn Account to EOA (withdrawal).
|
|
4
|
+
|
|
5
|
+
Used by multicall/bundle endpoint to send tokens from the Earn Account (Safe) back
|
|
6
|
+
to the owner's EOA as part of an atomic bundle transaction.
|
|
7
|
+
|
|
8
|
+
No signature is required for this action since the Safe already owns the tokens and
|
|
9
|
+
is executing the transfer as part of its own transaction.
|
|
10
|
+
|
|
11
|
+
## Example Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { EarnTransferToEOAParams } from "@compass-labs/api-sdk/models/components";
|
|
15
|
+
|
|
16
|
+
let value: EarnTransferToEOAParams = {
|
|
17
|
+
actionType: "V2_TRANSFER_TO_EOA",
|
|
18
|
+
token: "<value>",
|
|
19
|
+
amount: 692.89,
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Fields
|
|
24
|
+
|
|
25
|
+
| Field | Type | Required | Description | Example |
|
|
26
|
+
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `actionType` | *"V2_TRANSFER_TO_EOA"* | :heavy_check_mark: | Action type identifier for Earn-Account-to-EOA transfer operations. | V2_TRANSFER_TO_EOA |
|
|
28
|
+
| `token` | *string* | :heavy_check_mark: | The token to transfer from Earn Account to EOA. | |
|
|
29
|
+
| `amount` | *any* | :heavy_check_mark: | The amount of tokens to transfer (in token units, not wei), or 'ALL' to transfer the entire balance. | |
|
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# V2BundleRequest
|
|
2
2
|
|
|
3
|
+
Request to execute multiple earn actions in a single atomic transaction.
|
|
4
|
+
|
|
5
|
+
## Supported Action Types
|
|
6
|
+
|
|
7
|
+
- **V2_TRANSFER_FROM_EOA**: Transfer tokens from the owner's EOA to the Earn Account
|
|
8
|
+
using Permit2. Requires a signed Permit2 message.
|
|
9
|
+
- **V2_TRANSFER_TO_EOA**: Transfer tokens from the Earn Account back to the owner's EOA.
|
|
10
|
+
No signature required (Safe owns the tokens).
|
|
11
|
+
- **V2_SWAP**: Swap tokens within the Earn Account using 1inch aggregator.
|
|
12
|
+
- **V2_MANAGE**: Deposit or withdraw from DeFi venues (Aave, Morpho, Vaults, etc.)
|
|
13
|
+
|
|
14
|
+
## Using V2_TRANSFER_FROM_EOA (Deposit to Earn Account)
|
|
15
|
+
|
|
16
|
+
To include a transfer from EOA in your bundle, follow these steps:
|
|
17
|
+
|
|
18
|
+
1. **One-time setup**: Approve Permit2 to spend the token by calling
|
|
19
|
+
`POST /v2/gas_sponsorship/approve_transfer` and executing the returned transaction.
|
|
20
|
+
|
|
21
|
+
2. **Get Permit2 signature**: Call `POST /v2/earn/transfer` with:
|
|
22
|
+
- `action`: "DEPOSIT"
|
|
23
|
+
- `gas_sponsorship`: true
|
|
24
|
+
- `spender`: omit this field (defaults to Safe address for bundle use)
|
|
25
|
+
|
|
26
|
+
This returns EIP-712 typed data. Sign it with the owner's wallet.
|
|
27
|
+
|
|
28
|
+
3. **Include in bundle**: Add a V2_TRANSFER_FROM_EOA action with the signature
|
|
29
|
+
and nonce/deadline from the typed data.
|
|
30
|
+
|
|
31
|
+
The bundle will atomically: pull tokens from EOA → execute subsequent actions.
|
|
32
|
+
|
|
33
|
+
## Using V2_TRANSFER_TO_EOA (Withdraw to EOA)
|
|
34
|
+
|
|
35
|
+
To transfer tokens from the Earn Account back to the owner's EOA, simply add
|
|
36
|
+
a V2_TRANSFER_TO_EOA action to your bundle. No signature is required since
|
|
37
|
+
the Safe already owns the tokens.
|
|
38
|
+
|
|
39
|
+
Use `amount: "ALL"` to transfer the entire token balance.
|
|
40
|
+
|
|
3
41
|
## Example Usage
|
|
4
42
|
|
|
5
43
|
```typescript
|
|
@@ -9,6 +47,16 @@ let value: V2BundleRequest = {
|
|
|
9
47
|
owner: "0x01E62835dd7F52173546A325294762143eE4a882",
|
|
10
48
|
chain: "ethereum",
|
|
11
49
|
actions: [
|
|
50
|
+
{
|
|
51
|
+
body: {
|
|
52
|
+
actionType: "V2_TRANSFER_FROM_EOA",
|
|
53
|
+
token: "USDC",
|
|
54
|
+
amount: "100",
|
|
55
|
+
permit2Signature: "0x...",
|
|
56
|
+
permit2Nonce: 1706000000,
|
|
57
|
+
permit2Deadline: 1706001800,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
12
60
|
{
|
|
13
61
|
body: {
|
|
14
62
|
actionType: "V2_SWAP",
|
|
@@ -36,9 +84,9 @@ let value: V2BundleRequest = {
|
|
|
36
84
|
|
|
37
85
|
## Fields
|
|
38
86
|
|
|
39
|
-
| Field
|
|
40
|
-
|
|
|
41
|
-
| `owner`
|
|
42
|
-
| `chain`
|
|
43
|
-
| `actions`
|
|
44
|
-
| `gasSponsorship`
|
|
87
|
+
| Field | Type | Required | Description | Example |
|
|
88
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `owner` | *string* | :heavy_check_mark: | The owner's wallet address that controls the Earn Account. | 0x01E62835dd7F52173546A325294762143eE4a882 |
|
|
90
|
+
| `chain` | [components.Chain](../../models/components/chain.md) | :heavy_check_mark: | The chain to use. | |
|
|
91
|
+
| `actions` | [components.V2UserOperation](../../models/components/v2useroperation.md)[] | :heavy_check_mark: | List of actions to bundle. Actions are executed in order. | [<br/>{<br/>"body": {<br/>"action_type": "V2_TRANSFER_FROM_EOA",<br/>"amount": "100",<br/>"permit2_deadline": 1706001800,<br/>"permit2_nonce": 1706000000,<br/>"permit2_signature": "0x...",<br/>"token": "USDC"<br/>}<br/>},<br/>{<br/>"body": {<br/>"action_type": "V2_SWAP",<br/>"amount_in": "100",<br/>"slippage": "0.5",<br/>"token_in": "USDC",<br/>"token_out": "AUSD"<br/>}<br/>},<br/>{<br/>"body": {<br/>"action": "DEPOSIT",<br/>"action_type": "V2_MANAGE",<br/>"amount": "ALL",<br/>"venue": {<br/>"type": "VAULT",<br/>"vault_address": "0x1B4cd53a1A8e5F50aB6320EF34E5fB4D3df7B6f6"<br/>}<br/>}<br/>}<br/>] |
|
|
92
|
+
| `gasSponsorship` | *boolean* | :heavy_minus_sign: | If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare. | false |
|
|
@@ -29,3 +29,26 @@ const value: components.EarnSwapParams = {
|
|
|
29
29
|
};
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
### `components.EarnTransferFromEOAParams`
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const value: components.EarnTransferFromEOAParams = {
|
|
36
|
+
actionType: "V2_TRANSFER_FROM_EOA",
|
|
37
|
+
token: "<value>",
|
|
38
|
+
amount: 4305.68,
|
|
39
|
+
permit2Signature: "<value>",
|
|
40
|
+
permit2Nonce: 649287,
|
|
41
|
+
permit2Deadline: 645376,
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `components.EarnTransferToEOAParams`
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const value: components.EarnTransferToEOAParams = {
|
|
49
|
+
actionType: "V2_TRANSFER_TO_EOA",
|
|
50
|
+
token: "<value>",
|
|
51
|
+
amount: 692.89,
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|