@compass-labs/api-sdk 2.1.34 → 2.1.35-rc.0
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/dist/commonjs/funcs/earnEarnAaveMarkets.d.ts +4 -7
- package/dist/commonjs/funcs/earnEarnAaveMarkets.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnAaveMarkets.js +4 -7
- package/dist/commonjs/funcs/earnEarnAaveMarkets.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnBundle.d.ts +9 -10
- package/dist/commonjs/funcs/earnEarnBundle.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnBundle.js +9 -10
- package/dist/commonjs/funcs/earnEarnBundle.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnCreateAccount.d.ts +5 -7
- package/dist/commonjs/funcs/earnEarnCreateAccount.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnCreateAccount.js +5 -7
- package/dist/commonjs/funcs/earnEarnCreateAccount.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnManage.d.ts +10 -14
- package/dist/commonjs/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnManage.js +10 -14
- package/dist/commonjs/funcs/earnEarnManage.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.d.ts +8 -1
- package/dist/commonjs/funcs/earnEarnPositions.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.js +8 -1
- package/dist/commonjs/funcs/earnEarnPositions.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnSwap.d.ts +6 -0
- package/dist/commonjs/funcs/earnEarnSwap.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnSwap.js +6 -0
- package/dist/commonjs/funcs/earnEarnSwap.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnTransfer.d.ts +14 -5
- package/dist/commonjs/funcs/earnEarnTransfer.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnTransfer.js +14 -5
- package/dist/commonjs/funcs/earnEarnTransfer.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnVaults.d.ts +6 -2
- package/dist/commonjs/funcs/earnEarnVaults.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnVaults.js +6 -2
- package/dist/commonjs/funcs/earnEarnVaults.js.map +1 -1
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipApproveTransfer.d.ts +8 -8
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipApproveTransfer.js +8 -8
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts +9 -3
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts.map +1 -1
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.js +9 -3
- package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.js.map +1 -1
- package/dist/commonjs/models/components/approvetransferrequest.d.ts +1 -1
- package/dist/commonjs/models/components/batchedsafeoperationsresponseinput.d.ts +2 -2
- package/dist/commonjs/models/components/batchedsafeoperationsresponseoutput.d.ts +2 -2
- package/dist/commonjs/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.d.ts +3 -3
- package/dist/commonjs/models/components/safetxmessage.d.ts +3 -3
- package/dist/commonjs/models/components/sponsorgasrequest.d.ts +1 -1
- package/dist/commonjs/sdk/earn.d.ts +62 -46
- package/dist/commonjs/sdk/earn.d.ts.map +1 -1
- package/dist/commonjs/sdk/earn.js +62 -46
- package/dist/commonjs/sdk/earn.js.map +1 -1
- package/dist/commonjs/sdk/gassponsorship.d.ts +17 -11
- package/dist/commonjs/sdk/gassponsorship.d.ts.map +1 -1
- package/dist/commonjs/sdk/gassponsorship.js +17 -11
- package/dist/commonjs/sdk/gassponsorship.js.map +1 -1
- package/dist/esm/funcs/earnEarnAaveMarkets.d.ts +4 -7
- package/dist/esm/funcs/earnEarnAaveMarkets.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnAaveMarkets.js +4 -7
- package/dist/esm/funcs/earnEarnAaveMarkets.js.map +1 -1
- package/dist/esm/funcs/earnEarnBundle.d.ts +9 -10
- package/dist/esm/funcs/earnEarnBundle.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnBundle.js +9 -10
- package/dist/esm/funcs/earnEarnBundle.js.map +1 -1
- package/dist/esm/funcs/earnEarnCreateAccount.d.ts +5 -7
- package/dist/esm/funcs/earnEarnCreateAccount.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnCreateAccount.js +5 -7
- package/dist/esm/funcs/earnEarnCreateAccount.js.map +1 -1
- package/dist/esm/funcs/earnEarnManage.d.ts +10 -14
- package/dist/esm/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnManage.js +10 -14
- package/dist/esm/funcs/earnEarnManage.js.map +1 -1
- package/dist/esm/funcs/earnEarnPositions.d.ts +8 -1
- package/dist/esm/funcs/earnEarnPositions.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnPositions.js +8 -1
- package/dist/esm/funcs/earnEarnPositions.js.map +1 -1
- package/dist/esm/funcs/earnEarnSwap.d.ts +6 -0
- package/dist/esm/funcs/earnEarnSwap.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnSwap.js +6 -0
- package/dist/esm/funcs/earnEarnSwap.js.map +1 -1
- package/dist/esm/funcs/earnEarnTransfer.d.ts +14 -5
- package/dist/esm/funcs/earnEarnTransfer.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnTransfer.js +14 -5
- package/dist/esm/funcs/earnEarnTransfer.js.map +1 -1
- package/dist/esm/funcs/earnEarnVaults.d.ts +6 -2
- package/dist/esm/funcs/earnEarnVaults.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnVaults.js +6 -2
- package/dist/esm/funcs/earnEarnVaults.js.map +1 -1
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipApproveTransfer.d.ts +8 -8
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipApproveTransfer.js +8 -8
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts +9 -3
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts.map +1 -1
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.js +9 -3
- package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.js.map +1 -1
- package/dist/esm/models/components/approvetransferrequest.d.ts +1 -1
- package/dist/esm/models/components/batchedsafeoperationsresponseinput.d.ts +2 -2
- package/dist/esm/models/components/batchedsafeoperationsresponseoutput.d.ts +2 -2
- package/dist/esm/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.d.ts +3 -3
- package/dist/esm/models/components/safetxmessage.d.ts +3 -3
- package/dist/esm/models/components/sponsorgasrequest.d.ts +1 -1
- package/dist/esm/sdk/earn.d.ts +62 -46
- package/dist/esm/sdk/earn.d.ts.map +1 -1
- package/dist/esm/sdk/earn.js +62 -46
- package/dist/esm/sdk/earn.js.map +1 -1
- package/dist/esm/sdk/gassponsorship.d.ts +17 -11
- package/dist/esm/sdk/gassponsorship.d.ts.map +1 -1
- package/dist/esm/sdk/gassponsorship.js +17 -11
- package/dist/esm/sdk/gassponsorship.js.map +1 -1
- package/docs/models/components/approvetransferrequest.md +1 -1
- package/docs/models/components/batchedsafeoperationsresponseinput.md +2 -2
- package/docs/models/components/batchedsafeoperationsresponseoutput.md +2 -2
- package/docs/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md +5 -5
- package/docs/models/components/safetxmessage.md +3 -3
- package/docs/models/components/sponsorgasrequest.md +1 -1
- package/docs/sdks/earn/README.md +62 -46
- package/docs/sdks/gassponsorship/README.md +17 -11
- package/package.json +1 -1
- package/src/funcs/earnEarnAaveMarkets.ts +4 -7
- package/src/funcs/earnEarnBundle.ts +9 -10
- package/src/funcs/earnEarnCreateAccount.ts +5 -7
- package/src/funcs/earnEarnManage.ts +10 -14
- package/src/funcs/earnEarnPositions.ts +8 -1
- package/src/funcs/earnEarnSwap.ts +6 -0
- package/src/funcs/earnEarnTransfer.ts +14 -5
- package/src/funcs/earnEarnVaults.ts +6 -2
- package/src/funcs/gasSponsorshipGasSponsorshipApproveTransfer.ts +8 -8
- package/src/funcs/gasSponsorshipGasSponsorshipPrepare.ts +9 -3
- package/src/models/components/approvetransferrequest.ts +1 -1
- package/src/models/components/batchedsafeoperationsresponseinput.ts +2 -2
- package/src/models/components/batchedsafeoperationsresponseoutput.ts +2 -2
- package/src/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.ts +3 -3
- package/src/models/components/safetxmessage.ts +3 -3
- package/src/models/components/sponsorgasrequest.ts +1 -1
- package/src/sdk/earn.ts +62 -46
- package/src/sdk/gassponsorship.ts +17 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SafeTxMessage
|
|
2
2
|
|
|
3
|
-
The message data for
|
|
3
|
+
The message data for the transaction.
|
|
4
4
|
|
|
5
5
|
## Example Usage
|
|
6
6
|
|
|
@@ -29,9 +29,9 @@ let value: SafeTxMessage = {
|
|
|
29
29
|
| `value` | *string* | :heavy_check_mark: | Value in wei as a string |
|
|
30
30
|
| `data` | *string* | :heavy_check_mark: | Transaction data as hex string |
|
|
31
31
|
| `operation` | [components.OperationType](../../models/components/operationtype.md) | :heavy_check_mark: | Safe operation types. |
|
|
32
|
-
| `safeTxGas` | *string* | :heavy_check_mark: | Gas for the
|
|
32
|
+
| `safeTxGas` | *string* | :heavy_check_mark: | Gas for the transaction |
|
|
33
33
|
| `baseGas` | *string* | :heavy_check_mark: | Base gas costs |
|
|
34
34
|
| `gasPrice` | *string* | :heavy_check_mark: | Gas price |
|
|
35
35
|
| `gasToken` | *string* | :heavy_check_mark: | Token address for gas payment |
|
|
36
36
|
| `refundReceiver` | *string* | :heavy_check_mark: | Address to receive gas refund |
|
|
37
|
-
| `nonce` | *string* | :heavy_check_mark: |
|
|
37
|
+
| `nonce` | *string* | :heavy_check_mark: | Transaction nonce |
|
|
@@ -77,7 +77,7 @@ let value: SponsorGasRequest = {
|
|
|
77
77
|
|
|
78
78
|
| Field | Type | Required | Description | Example |
|
|
79
79
|
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
-
| `owner` | *string* | :heavy_check_mark: | The
|
|
80
|
+
| `owner` | *string* | :heavy_check_mark: | The wallet address that owns the Earn Account. | 0xCE1A77F0abff993d6d3D04d44b70831c6924fb40 |
|
|
81
81
|
| `chain` | [components.Chain](../../models/components/chain.md) | :heavy_check_mark: | The chain to use. | |
|
|
82
82
|
| `eip712` | *components.SponsorGasRequestEip712* | :heavy_check_mark: | The EIP-712 typed data that was signed. | {<br/>"domain": {<br/>"chainId": 42161,<br/>"name": "USD Coin",<br/>"verifyingContract": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",<br/>"version": "2"<br/>},<br/>"message": {<br/>"deadline": "1762269774",<br/>"nonce": "0",<br/>"owner": "0xCE1A77F0abff993d6d3D04d44b70831c6924fb40",<br/>"spender": "0x000000000022D473030F116dDEE9F6B43aC78BA3",<br/>"value": "115792089237316195423570985008687907853269984665640564039457584007913129639935"<br/>},<br/>"primaryType": "Permit",<br/>"types": {<br/>"EIP712Domain": [<br/>{<br/>"name": "name",<br/>"type": "string"<br/>},<br/>{<br/>"name": "version",<br/>"type": "string"<br/>},<br/>{<br/>"name": "chainId",<br/>"type": "uint256"<br/>},<br/>{<br/>"name": "verifyingContract",<br/>"type": "address"<br/>}<br/>],<br/>"Permit": [<br/>{<br/>"name": "owner",<br/>"type": "address"<br/>},<br/>{<br/>"name": "spender",<br/>"type": "address"<br/>},<br/>{<br/>"name": "value",<br/>"type": "uint256"<br/>},<br/>{<br/>"name": "nonce",<br/>"type": "uint256"<br/>},<br/>{<br/>"name": "deadline",<br/>"type": "uint256"<br/>}<br/>]<br/>}<br/>} |
|
|
83
83
|
| `signature` | *string* | :heavy_check_mark: | The EIP-712 signed typed data signature. | 0x160d2709ae195f591daa33ad6ab1fb18b8762a39d8c4466c4cbe95cf6881fc3d54d469710ef0e7fd64ecff47c1ba5741d7254903bfaebdacea5aa8289f81ba9a1c |
|
package/docs/sdks/earn/README.md
CHANGED
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
## earnPositions
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
List all Earn positions for a given owner with PnL tracking.
|
|
19
|
+
|
|
20
|
+
Returns position data including current balance, cost basis, and profit and loss.
|
|
21
|
+
Use this endpoint to display portfolio performance, track yields over time, or build
|
|
22
|
+
position management interfaces.
|
|
23
|
+
|
|
24
|
+
Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
25
|
+
position includes the venue address, deposited amount, and performance metrics.
|
|
19
26
|
|
|
20
27
|
### Example Usage
|
|
21
28
|
|
|
@@ -95,9 +102,13 @@ run();
|
|
|
95
102
|
|
|
96
103
|
## earnVaults
|
|
97
104
|
|
|
98
|
-
List
|
|
105
|
+
List ERC-4626 yield vaults across DeFi venues.
|
|
106
|
+
|
|
107
|
+
Returns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.
|
|
108
|
+
|
|
109
|
+
Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
101
112
|
|
|
102
113
|
### Example Usage
|
|
103
114
|
|
|
@@ -177,16 +188,13 @@ run();
|
|
|
177
188
|
|
|
178
189
|
## earnAaveMarkets
|
|
179
190
|
|
|
180
|
-
List
|
|
191
|
+
List Aave lending markets with supply and borrow rates.
|
|
181
192
|
|
|
182
|
-
Returns rates organized by token symbol, with chain-specific data for each token.
|
|
183
|
-
Each token includes rates for all chains where it's available, plus information
|
|
184
|
-
about which chain offers the highest supply APY.
|
|
193
|
+
Returns rates organized by token symbol, with chain-specific data for each token. Each token includes rates for all chains where it's available, plus information about which chain offers the highest supply APY.
|
|
185
194
|
|
|
186
|
-
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
187
|
-
zero APY on both supply and borrow are excluded.
|
|
195
|
+
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with zero APY on both supply and borrow are excluded.
|
|
188
196
|
|
|
189
|
-
|
|
197
|
+
To deposit into an Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=AAVE`.
|
|
190
198
|
|
|
191
199
|
### Example Usage
|
|
192
200
|
|
|
@@ -256,17 +264,15 @@ run();
|
|
|
256
264
|
|
|
257
265
|
## earnCreateAccount
|
|
258
266
|
|
|
259
|
-
Create an Earn Account.
|
|
267
|
+
Create an Earn Account for a wallet address.
|
|
260
268
|
|
|
261
|
-
Before
|
|
269
|
+
Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
262
270
|
|
|
263
|
-
|
|
271
|
+
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
264
272
|
|
|
265
|
-
|
|
273
|
+
**If owner pays gas:** Set `sender` to the owner's address.
|
|
266
274
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
The creation of an Earn Account itself can be a gas-sponsored transaction by setting the `sender` to the wallet which will sign and send the transaction.
|
|
275
|
+
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
270
276
|
|
|
271
277
|
### Example Usage
|
|
272
278
|
|
|
@@ -344,14 +350,23 @@ run();
|
|
|
344
350
|
|
|
345
351
|
## earnTransfer
|
|
346
352
|
|
|
347
|
-
Transfer tokens
|
|
353
|
+
Transfer tokens between an owner's wallet and their Earn Account.
|
|
354
|
+
|
|
355
|
+
Use `DEPOSIT` to move tokens from the owner's wallet into their Earn Account. Use `WITHDRAW` to move tokens from the Earn Account back to the owner's wallet.
|
|
356
|
+
|
|
357
|
+
**Gas-sponsored deposits** require two steps:
|
|
348
358
|
|
|
349
|
-
|
|
359
|
+
**Step 1 (once per token):** Set up Permit2 allowance
|
|
360
|
+
1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
361
|
+
2. Owner signs the typed data
|
|
362
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
350
363
|
|
|
351
|
-
|
|
364
|
+
**Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
365
|
+
1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
366
|
+
2. Owner signs the typed data
|
|
367
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
352
368
|
|
|
353
|
-
|
|
354
|
-
Once the one-time allowance is set for a given token and `gas_sponsorship` is set to 'true', EIP-712 typed data will be returned and can be signed off-chain by the user. This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where a `sender` can be set for the transaction.
|
|
369
|
+
**Note:** This endpoint moves tokens to/from the Earn Account itself—not into yield venues. To deposit into a vault or Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position).
|
|
355
370
|
|
|
356
371
|
### Example Usage
|
|
357
372
|
|
|
@@ -433,24 +448,20 @@ run();
|
|
|
433
448
|
|
|
434
449
|
## earnManage
|
|
435
450
|
|
|
436
|
-
|
|
451
|
+
Deposit into or withdraw from a yield venue.
|
|
437
452
|
|
|
438
|
-
|
|
453
|
+
Use `DEPOSIT` to move tokens from the Earn Account into a vault or Aave market. Use `WITHDRAW` to move tokens back from a venue into the Earn Account.
|
|
439
454
|
|
|
440
|
-
Venue
|
|
441
|
-
- VAULTS
|
|
442
|
-
- AAVE
|
|
455
|
+
**Venue types:**
|
|
456
|
+
- `VAULTS`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
457
|
+
- `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
443
458
|
|
|
444
|
-
|
|
459
|
+
**Fees:** A fee can be configured and deducted from the transaction amount:
|
|
460
|
+
- `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
461
|
+
- `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
462
|
+
- `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
445
463
|
|
|
446
|
-
|
|
447
|
-
|
|
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.
|
|
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.
|
|
464
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
454
465
|
|
|
455
466
|
### Example Usage
|
|
456
467
|
|
|
@@ -542,6 +553,12 @@ run();
|
|
|
542
553
|
|
|
543
554
|
Swap tokens within an Earn Account.
|
|
544
555
|
|
|
556
|
+
Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
557
|
+
|
|
558
|
+
The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
|
|
559
|
+
|
|
560
|
+
Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
|
|
561
|
+
|
|
545
562
|
### Example Usage
|
|
546
563
|
|
|
547
564
|
<!-- UsageSnippet language="typescript" operationID="v2_earn_swap" method="post" path="/v2/earn/swap" -->
|
|
@@ -626,20 +643,19 @@ run();
|
|
|
626
643
|
|
|
627
644
|
## earnBundle
|
|
628
645
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
executed
|
|
646
|
+
Combine multiple actions into a single atomic transaction.
|
|
647
|
+
|
|
648
|
+
Bundle swaps and venue deposits/withdrawals into one transaction executed through the Earn Account. This saves gas compared to executing actions separately and ensures all actions succeed or fail together.
|
|
632
649
|
|
|
633
|
-
**Example
|
|
650
|
+
**Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
634
651
|
|
|
635
|
-
|
|
652
|
+
**Action types:**
|
|
653
|
+
- `V2_SWAP`: Swap tokens within the Earn Account
|
|
654
|
+
- `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
636
655
|
|
|
637
|
-
|
|
638
|
-
- **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
656
|
+
Actions execute in the order provided.
|
|
639
657
|
|
|
640
|
-
|
|
641
|
-
This returns EIP-712 typed data that the owner must sign and submit to
|
|
642
|
-
`/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
658
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
643
659
|
|
|
644
660
|
### Example Usage
|
|
645
661
|
|
|
@@ -9,11 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
## gasSponsorshipPrepare
|
|
11
11
|
|
|
12
|
-
Prepare a gas-sponsored transaction
|
|
12
|
+
Prepare a gas-sponsored transaction from signed EIP-712 typed data.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Submit the `owner`'s off-chain signature along with the EIP-712 typed data that was signed. Returns an unsigned transaction for the `sender` to sign and broadcast.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
**How gas sponsorship works:**
|
|
17
|
+
1. Call an endpoint with `gas_sponsorship=true` (e.g., [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account), [/earn/manage](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position)) to get EIP-712 typed data
|
|
18
|
+
2. Owner signs the typed data off-chain
|
|
19
|
+
3. Submit signature + typed data to this endpoint
|
|
20
|
+
4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
|
|
21
|
+
|
|
22
|
+
**Note:** For gas-sponsored deposits via [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account), the owner must first set up a Permit2 allowance using [/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) (once per token).
|
|
17
23
|
|
|
18
24
|
### Example Usage
|
|
19
25
|
|
|
@@ -209,16 +215,16 @@ run();
|
|
|
209
215
|
|
|
210
216
|
## gasSponsorshipApproveTransfer
|
|
211
217
|
|
|
212
|
-
|
|
218
|
+
Set up a one-time Permit2 allowance for gas-sponsored token transfers.
|
|
219
|
+
|
|
220
|
+
Only required when using [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account) with `gas_sponsorship=true`. This allowance only needs to be set up once per token.
|
|
213
221
|
|
|
214
|
-
|
|
222
|
+
**With gas sponsorship (`gas_sponsorship=true`):**
|
|
223
|
+
- Returns EIP-712 typed data for the owner to sign off-chain
|
|
224
|
+
- Submit signature + typed data to [/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
225
|
+
- Only works for tokens that support EIP-2612 permit (e.g., USDC)
|
|
215
226
|
|
|
216
|
-
|
|
217
|
-
In this case, EIP-712 typed data will be returned and should be signed by the `owner` off-chain.
|
|
218
|
-
This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
219
|
-
Gas-sponsored approvals can only be achieved by ERC-20 tokens that support permit (EIP-2612).
|
|
220
|
-
Some tokens, like USDT and WETH, do not allow for this behavior.
|
|
221
|
-
In the case of non-permit tokens, the one-time approval transaction can be submitted in the conventional manner where the `owner` must sign, submit and pay gas for the transaction.
|
|
227
|
+
Some tokens, like USDT and WETH, do not support EIP-2612 permit. For these tokens, set `gas_sponsorship=false` to receive an unsigned transaction that the owner must sign, submit, and pay gas for.
|
|
222
228
|
|
|
223
229
|
### Example Usage
|
|
224
230
|
|
package/package.json
CHANGED
|
@@ -30,16 +30,13 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* List aave markets
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* List
|
|
33
|
+
* List Aave lending markets with supply and borrow rates.
|
|
34
34
|
*
|
|
35
|
-
* Returns rates organized by token symbol, with chain-specific data for each token.
|
|
36
|
-
* Each token includes rates for all chains where it's available, plus information
|
|
37
|
-
* about which chain offers the highest supply APY.
|
|
35
|
+
* Returns rates organized by token symbol, with chain-specific data for each token. Each token includes rates for all chains where it's available, plus information about which chain offers the highest supply APY.
|
|
38
36
|
*
|
|
39
|
-
* APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
40
|
-
* zero APY on both supply and borrow are excluded.
|
|
37
|
+
* APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with zero APY on both supply and borrow are excluded.
|
|
41
38
|
*
|
|
42
|
-
*
|
|
39
|
+
* To deposit into an Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=AAVE`.
|
|
43
40
|
*/
|
|
44
41
|
export function earnEarnAaveMarkets(
|
|
45
42
|
client: CompassApiSDKCore,
|
|
@@ -29,20 +29,19 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Execute multiple earn actions
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
*
|
|
33
|
-
* deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
|
|
34
|
-
* executed via the Earn account).
|
|
32
|
+
* Combine multiple actions into a single atomic transaction.
|
|
35
33
|
*
|
|
36
|
-
*
|
|
34
|
+
* Bundle swaps and venue deposits/withdrawals into one transaction executed through the Earn Account. This saves gas compared to executing actions separately and ensures all actions succeed or fail together.
|
|
37
35
|
*
|
|
38
|
-
*
|
|
36
|
+
* **Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
39
37
|
*
|
|
40
|
-
*
|
|
41
|
-
* -
|
|
38
|
+
* **Action types:**
|
|
39
|
+
* - `V2_SWAP`: Swap tokens within the Earn Account
|
|
40
|
+
* - `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
42
41
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* Actions execute in the order provided.
|
|
43
|
+
*
|
|
44
|
+
* **Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
46
45
|
*/
|
|
47
46
|
export function earnEarnBundle(
|
|
48
47
|
client: CompassApiSDKCore,
|
|
@@ -29,17 +29,15 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Create earn account
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Create an Earn Account.
|
|
32
|
+
* Create an Earn Account for a wallet address.
|
|
33
33
|
*
|
|
34
|
-
* Before
|
|
34
|
+
* Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* **If owner pays gas:** Set `sender` to the owner's address.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* The creation of an Earn Account itself can be a gas-sponsored transaction by setting the `sender` to the wallet which will sign and send the transaction.
|
|
40
|
+
* **If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
43
41
|
*/
|
|
44
42
|
export function earnEarnCreateAccount(
|
|
45
43
|
client: CompassApiSDKCore,
|
|
@@ -29,24 +29,20 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Manage earn position
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
*
|
|
32
|
+
* Deposit into or withdraw from a yield venue.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Use `DEPOSIT` to move tokens from the Earn Account into a vault or Aave market. Use `WITHDRAW` to move tokens back from a venue into the Earn Account.
|
|
35
35
|
*
|
|
36
|
-
* Venue
|
|
37
|
-
* - VAULTS
|
|
38
|
-
* - AAVE
|
|
36
|
+
* **Venue types:**
|
|
37
|
+
* - `VAULTS`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
38
|
+
* - `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* **Fees:** A fee can be configured and deducted from the transaction amount:
|
|
41
|
+
* - `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
42
|
+
* - `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
43
|
+
* - `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
41
44
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
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.
|
|
48
|
-
*
|
|
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.
|
|
45
|
+
* **Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
50
46
|
*/
|
|
51
47
|
export function earnEarnManage(
|
|
52
48
|
client: CompassApiSDKCore,
|
|
@@ -30,7 +30,14 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* List earn positions
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
*
|
|
33
|
+
* List all Earn positions for a given owner with PnL tracking.
|
|
34
|
+
*
|
|
35
|
+
* Returns position data including current balance, cost basis, and profit and loss.
|
|
36
|
+
* Use this endpoint to display portfolio performance, track yields over time, or build
|
|
37
|
+
* position management interfaces.
|
|
38
|
+
*
|
|
39
|
+
* Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
40
|
+
* position includes the venue address, deposited amount, and performance metrics.
|
|
34
41
|
*/
|
|
35
42
|
export function earnEarnPositions(
|
|
36
43
|
client: CompassApiSDKCore,
|
|
@@ -30,6 +30,12 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Swap tokens within an Earn Account.
|
|
33
|
+
*
|
|
34
|
+
* Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
35
|
+
*
|
|
36
|
+
* The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
|
|
37
|
+
*
|
|
38
|
+
* Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
|
|
33
39
|
*/
|
|
34
40
|
export function earnEarnSwap(
|
|
35
41
|
client: CompassApiSDKCore,
|
|
@@ -29,14 +29,23 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Transfer tokens to/from account
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Transfer tokens
|
|
32
|
+
* Transfer tokens between an owner's wallet and their Earn Account.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Use `DEPOSIT` to move tokens from the owner's wallet into their Earn Account. Use `WITHDRAW` to move tokens from the Earn Account back to the owner's wallet.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* **Gas-sponsored deposits** require two steps:
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* **Step 1 (once per token):** Set up Permit2 allowance
|
|
39
|
+
* 1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
40
|
+
* 2. Owner signs the typed data
|
|
41
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
42
|
+
*
|
|
43
|
+
* **Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
44
|
+
* 1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
45
|
+
* 2. Owner signs the typed data
|
|
46
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
47
|
+
*
|
|
48
|
+
* **Note:** This endpoint moves tokens to/from the Earn Account itself—not into yield venues. To deposit into a vault or Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position).
|
|
40
49
|
*/
|
|
41
50
|
export function earnEarnTransfer(
|
|
42
51
|
client: CompassApiSDKCore,
|
|
@@ -30,9 +30,13 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* List vaults
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* List
|
|
33
|
+
* List ERC-4626 yield vaults across DeFi venues.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* Returns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.
|
|
36
|
+
*
|
|
37
|
+
* Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
38
|
+
*
|
|
39
|
+
* To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
36
40
|
*/
|
|
37
41
|
export function earnEarnVaults(
|
|
38
42
|
client: CompassApiSDKCore,
|
|
@@ -29,16 +29,16 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Approve token transfer
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
*
|
|
32
|
+
* Set up a one-time Permit2 allowance for gas-sponsored token transfers.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Only required when using [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account) with `gas_sponsorship=true`. This allowance only needs to be set up once per token.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
36
|
+
* **With gas sponsorship (`gas_sponsorship=true`):**
|
|
37
|
+
* - Returns EIP-712 typed data for the owner to sign off-chain
|
|
38
|
+
* - Submit signature + typed data to [/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
39
|
+
* - Only works for tokens that support EIP-2612 permit (e.g., USDC)
|
|
40
|
+
*
|
|
41
|
+
* Some tokens, like USDT and WETH, do not support EIP-2612 permit. For these tokens, set `gas_sponsorship=false` to receive an unsigned transaction that the owner must sign, submit, and pay gas for.
|
|
42
42
|
*/
|
|
43
43
|
export function gasSponsorshipGasSponsorshipApproveTransfer(
|
|
44
44
|
client: CompassApiSDKCore,
|
|
@@ -29,11 +29,17 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Prepare gas-sponsored transaction
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Prepare a gas-sponsored transaction
|
|
32
|
+
* Prepare a gas-sponsored transaction from signed EIP-712 typed data.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Submit the `owner`'s off-chain signature along with the EIP-712 typed data that was signed. Returns an unsigned transaction for the `sender` to sign and broadcast.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* **How gas sponsorship works:**
|
|
37
|
+
* 1. Call an endpoint with `gas_sponsorship=true` (e.g., [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account), [/earn/manage](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position)) to get EIP-712 typed data
|
|
38
|
+
* 2. Owner signs the typed data off-chain
|
|
39
|
+
* 3. Submit signature + typed data to this endpoint
|
|
40
|
+
* 4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
|
|
41
|
+
*
|
|
42
|
+
* **Note:** For gas-sponsored deposits via [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account), the owner must first set up a Permit2 allowance using [/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) (once per token).
|
|
37
43
|
*/
|
|
38
44
|
export function gasSponsorshipGasSponsorshipPrepare(
|
|
39
45
|
client: CompassApiSDKCore,
|