@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
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
*/
|
|
25
25
|
export type BatchedSafeOperationsResponseInput = {
|
|
26
26
|
/**
|
|
27
|
-
* The EIP-712 domain separator
|
|
27
|
+
* The EIP-712 domain separator.
|
|
28
28
|
*/
|
|
29
29
|
domain:
|
|
30
30
|
CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain;
|
|
@@ -38,7 +38,7 @@ export type BatchedSafeOperationsResponseInput = {
|
|
|
38
38
|
*/
|
|
39
39
|
primaryType: "SafeTx";
|
|
40
40
|
/**
|
|
41
|
-
* The message data for
|
|
41
|
+
* The message data for the transaction.
|
|
42
42
|
*/
|
|
43
43
|
message: SafeTxMessage;
|
|
44
44
|
};
|
|
@@ -21,7 +21,7 @@ import { SafeTxMessage, SafeTxMessage$inboundSchema } from "./safetxmessage.js";
|
|
|
21
21
|
*/
|
|
22
22
|
export type BatchedSafeOperationsResponseOutput = {
|
|
23
23
|
/**
|
|
24
|
-
* The EIP-712 domain separator
|
|
24
|
+
* The EIP-712 domain separator.
|
|
25
25
|
*/
|
|
26
26
|
domain:
|
|
27
27
|
CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain;
|
|
@@ -35,7 +35,7 @@ export type BatchedSafeOperationsResponseOutput = {
|
|
|
35
35
|
*/
|
|
36
36
|
primaryType: "SafeTx";
|
|
37
37
|
/**
|
|
38
|
-
* The message data for
|
|
38
|
+
* The message data for the transaction.
|
|
39
39
|
*/
|
|
40
40
|
message: SafeTxMessage;
|
|
41
41
|
};
|
|
@@ -8,16 +8,16 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The EIP-712 domain separator
|
|
11
|
+
* The EIP-712 domain separator.
|
|
12
12
|
*/
|
|
13
13
|
export type CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain =
|
|
14
14
|
{
|
|
15
15
|
/**
|
|
16
|
-
* Chain ID
|
|
16
|
+
* Chain ID
|
|
17
17
|
*/
|
|
18
18
|
chainId: number;
|
|
19
19
|
/**
|
|
20
|
-
* Address of the
|
|
20
|
+
* Address of the Product Account
|
|
21
21
|
*/
|
|
22
22
|
verifyingContract: string;
|
|
23
23
|
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./operationtype.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The message data for
|
|
16
|
+
* The message data for the transaction.
|
|
17
17
|
*/
|
|
18
18
|
export type SafeTxMessage = {
|
|
19
19
|
/**
|
|
@@ -33,7 +33,7 @@ export type SafeTxMessage = {
|
|
|
33
33
|
*/
|
|
34
34
|
operation: OperationType;
|
|
35
35
|
/**
|
|
36
|
-
* Gas for the
|
|
36
|
+
* Gas for the transaction
|
|
37
37
|
*/
|
|
38
38
|
safeTxGas: string;
|
|
39
39
|
/**
|
|
@@ -53,7 +53,7 @@ export type SafeTxMessage = {
|
|
|
53
53
|
*/
|
|
54
54
|
refundReceiver: string;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Transaction nonce
|
|
57
57
|
*/
|
|
58
58
|
nonce: string;
|
|
59
59
|
};
|
package/src/sdk/earn.ts
CHANGED
|
@@ -20,7 +20,14 @@ export class Earn extends ClientSDK {
|
|
|
20
20
|
* List earn positions
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
|
-
*
|
|
23
|
+
* List all Earn positions for a given owner with PnL tracking.
|
|
24
|
+
*
|
|
25
|
+
* Returns position data including current balance, cost basis, and profit and loss.
|
|
26
|
+
* Use this endpoint to display portfolio performance, track yields over time, or build
|
|
27
|
+
* position management interfaces.
|
|
28
|
+
*
|
|
29
|
+
* Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
30
|
+
* position includes the venue address, deposited amount, and performance metrics.
|
|
24
31
|
*/
|
|
25
32
|
async earnPositions(
|
|
26
33
|
request: operations.V2EarnPositionsRequest,
|
|
@@ -37,9 +44,13 @@ export class Earn extends ClientSDK {
|
|
|
37
44
|
* List vaults
|
|
38
45
|
*
|
|
39
46
|
* @remarks
|
|
40
|
-
* List
|
|
47
|
+
* List ERC-4626 yield vaults across DeFi venues.
|
|
48
|
+
*
|
|
49
|
+
* 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.
|
|
50
|
+
*
|
|
51
|
+
* Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
41
52
|
*
|
|
42
|
-
*
|
|
53
|
+
* To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
43
54
|
*/
|
|
44
55
|
async earnVaults(
|
|
45
56
|
request: operations.V2EarnVaultsRequest,
|
|
@@ -56,16 +67,13 @@ export class Earn extends ClientSDK {
|
|
|
56
67
|
* List aave markets
|
|
57
68
|
*
|
|
58
69
|
* @remarks
|
|
59
|
-
* List
|
|
70
|
+
* List Aave lending markets with supply and borrow rates.
|
|
60
71
|
*
|
|
61
|
-
* Returns rates organized by token symbol, with chain-specific data for each token.
|
|
62
|
-
* Each token includes rates for all chains where it's available, plus information
|
|
63
|
-
* about which chain offers the highest supply APY.
|
|
72
|
+
* 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.
|
|
64
73
|
*
|
|
65
|
-
* APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
66
|
-
* zero APY on both supply and borrow are excluded.
|
|
74
|
+
* 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.
|
|
67
75
|
*
|
|
68
|
-
*
|
|
76
|
+
* 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`.
|
|
69
77
|
*/
|
|
70
78
|
async earnAaveMarkets(
|
|
71
79
|
request: operations.V2EarnAaveMarketsRequest,
|
|
@@ -82,17 +90,15 @@ export class Earn extends ClientSDK {
|
|
|
82
90
|
* Create earn account
|
|
83
91
|
*
|
|
84
92
|
* @remarks
|
|
85
|
-
* Create an Earn Account.
|
|
93
|
+
* Create an Earn Account for a wallet address.
|
|
86
94
|
*
|
|
87
|
-
* Before
|
|
95
|
+
* Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
88
96
|
*
|
|
89
|
-
*
|
|
97
|
+
* Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
90
98
|
*
|
|
91
|
-
*
|
|
99
|
+
* **If owner pays gas:** Set `sender` to the owner's address.
|
|
92
100
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* 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.
|
|
101
|
+
* **If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
96
102
|
*/
|
|
97
103
|
async earnCreateAccount(
|
|
98
104
|
request: components.CreateAccountRequest,
|
|
@@ -109,14 +115,23 @@ export class Earn extends ClientSDK {
|
|
|
109
115
|
* Transfer tokens to/from account
|
|
110
116
|
*
|
|
111
117
|
* @remarks
|
|
112
|
-
* Transfer tokens
|
|
118
|
+
* Transfer tokens between an owner's wallet and their Earn Account.
|
|
119
|
+
*
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* **Gas-sponsored deposits** require two steps:
|
|
113
123
|
*
|
|
114
|
-
*
|
|
124
|
+
* **Step 1 (once per token):** Set up Permit2 allowance
|
|
125
|
+
* 1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
126
|
+
* 2. Owner signs the typed data
|
|
127
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
115
128
|
*
|
|
116
|
-
*
|
|
129
|
+
* **Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
130
|
+
* 1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
131
|
+
* 2. Owner signs the typed data
|
|
132
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
117
133
|
*
|
|
118
|
-
*
|
|
119
|
-
* 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.
|
|
134
|
+
* **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).
|
|
120
135
|
*/
|
|
121
136
|
async earnTransfer(
|
|
122
137
|
request: components.EarnTransferRequest,
|
|
@@ -133,24 +148,20 @@ export class Earn extends ClientSDK {
|
|
|
133
148
|
* Manage earn position
|
|
134
149
|
*
|
|
135
150
|
* @remarks
|
|
136
|
-
*
|
|
151
|
+
* Deposit into or withdraw from a yield venue.
|
|
137
152
|
*
|
|
138
|
-
*
|
|
153
|
+
* 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.
|
|
139
154
|
*
|
|
140
|
-
* Venue
|
|
141
|
-
* - VAULTS
|
|
142
|
-
* - AAVE
|
|
155
|
+
* **Venue types:**
|
|
156
|
+
* - `VAULTS`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
157
|
+
* - `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
143
158
|
*
|
|
144
|
-
*
|
|
159
|
+
* **Fees:** A fee can be configured and deducted from the transaction amount:
|
|
160
|
+
* - `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
161
|
+
* - `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
162
|
+
* - `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
145
163
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
|
|
149
|
-
* - `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
150
|
-
* - `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
|
|
151
|
-
* - `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
|
|
152
|
-
*
|
|
153
|
-
* 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.
|
|
164
|
+
* **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).
|
|
154
165
|
*/
|
|
155
166
|
async earnManage(
|
|
156
167
|
request: components.EarnManageRequest,
|
|
@@ -168,6 +179,12 @@ export class Earn extends ClientSDK {
|
|
|
168
179
|
*
|
|
169
180
|
* @remarks
|
|
170
181
|
* Swap tokens within an Earn Account.
|
|
182
|
+
*
|
|
183
|
+
* Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
184
|
+
*
|
|
185
|
+
* 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.
|
|
186
|
+
*
|
|
187
|
+
* 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`.
|
|
171
188
|
*/
|
|
172
189
|
async earnSwap(
|
|
173
190
|
request: components.EarnSwapRequest,
|
|
@@ -184,20 +201,19 @@ export class Earn extends ClientSDK {
|
|
|
184
201
|
* Execute multiple earn actions
|
|
185
202
|
*
|
|
186
203
|
* @remarks
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* executed
|
|
204
|
+
* Combine multiple actions into a single atomic transaction.
|
|
205
|
+
*
|
|
206
|
+
* 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.
|
|
190
207
|
*
|
|
191
|
-
* **Example
|
|
208
|
+
* **Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
192
209
|
*
|
|
193
|
-
*
|
|
210
|
+
* **Action types:**
|
|
211
|
+
* - `V2_SWAP`: Swap tokens within the Earn Account
|
|
212
|
+
* - `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
194
213
|
*
|
|
195
|
-
*
|
|
196
|
-
* - **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
214
|
+
* Actions execute in the order provided.
|
|
197
215
|
*
|
|
198
|
-
*
|
|
199
|
-
* This returns EIP-712 typed data that the owner must sign and submit to
|
|
200
|
-
* `/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
216
|
+
* **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).
|
|
201
217
|
*/
|
|
202
218
|
async earnBundle(
|
|
203
219
|
request: components.V2BundleRequest,
|
|
@@ -13,11 +13,17 @@ export class GasSponsorship extends ClientSDK {
|
|
|
13
13
|
* Prepare gas-sponsored transaction
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Prepare a gas-sponsored transaction
|
|
16
|
+
* Prepare a gas-sponsored transaction from signed EIP-712 typed data.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* 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.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* **How gas sponsorship works:**
|
|
21
|
+
* 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
|
|
22
|
+
* 2. Owner signs the typed data off-chain
|
|
23
|
+
* 3. Submit signature + typed data to this endpoint
|
|
24
|
+
* 4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
|
|
25
|
+
*
|
|
26
|
+
* **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).
|
|
21
27
|
*/
|
|
22
28
|
async gasSponsorshipPrepare(
|
|
23
29
|
request: components.SponsorGasRequest,
|
|
@@ -34,16 +40,16 @@ export class GasSponsorship extends ClientSDK {
|
|
|
34
40
|
* Approve token transfer
|
|
35
41
|
*
|
|
36
42
|
* @remarks
|
|
37
|
-
*
|
|
43
|
+
* Set up a one-time Permit2 allowance for gas-sponsored token transfers.
|
|
44
|
+
*
|
|
45
|
+
* 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.
|
|
38
46
|
*
|
|
39
|
-
*
|
|
47
|
+
* **With gas sponsorship (`gas_sponsorship=true`):**
|
|
48
|
+
* - Returns EIP-712 typed data for the owner to sign off-chain
|
|
49
|
+
* - Submit signature + typed data to [/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
50
|
+
* - Only works for tokens that support EIP-2612 permit (e.g., USDC)
|
|
40
51
|
*
|
|
41
|
-
*
|
|
42
|
-
* In this case, EIP-712 typed data will be returned and should be signed by the `owner` off-chain.
|
|
43
|
-
* This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
44
|
-
* Gas-sponsored approvals can only be achieved by ERC-20 tokens that support permit (EIP-2612).
|
|
45
|
-
* Some tokens, like USDT and WETH, do not allow for this behavior.
|
|
46
|
-
* 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.
|
|
52
|
+
* 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.
|
|
47
53
|
*/
|
|
48
54
|
async gasSponsorshipApproveTransfer(
|
|
49
55
|
request: components.ApproveTransferRequest,
|