@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.
Files changed (131) hide show
  1. package/dist/commonjs/funcs/earnEarnAaveMarkets.d.ts +4 -7
  2. package/dist/commonjs/funcs/earnEarnAaveMarkets.d.ts.map +1 -1
  3. package/dist/commonjs/funcs/earnEarnAaveMarkets.js +4 -7
  4. package/dist/commonjs/funcs/earnEarnAaveMarkets.js.map +1 -1
  5. package/dist/commonjs/funcs/earnEarnBundle.d.ts +9 -10
  6. package/dist/commonjs/funcs/earnEarnBundle.d.ts.map +1 -1
  7. package/dist/commonjs/funcs/earnEarnBundle.js +9 -10
  8. package/dist/commonjs/funcs/earnEarnBundle.js.map +1 -1
  9. package/dist/commonjs/funcs/earnEarnCreateAccount.d.ts +5 -7
  10. package/dist/commonjs/funcs/earnEarnCreateAccount.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/earnEarnCreateAccount.js +5 -7
  12. package/dist/commonjs/funcs/earnEarnCreateAccount.js.map +1 -1
  13. package/dist/commonjs/funcs/earnEarnManage.d.ts +10 -14
  14. package/dist/commonjs/funcs/earnEarnManage.d.ts.map +1 -1
  15. package/dist/commonjs/funcs/earnEarnManage.js +10 -14
  16. package/dist/commonjs/funcs/earnEarnManage.js.map +1 -1
  17. package/dist/commonjs/funcs/earnEarnPositions.d.ts +8 -1
  18. package/dist/commonjs/funcs/earnEarnPositions.d.ts.map +1 -1
  19. package/dist/commonjs/funcs/earnEarnPositions.js +8 -1
  20. package/dist/commonjs/funcs/earnEarnPositions.js.map +1 -1
  21. package/dist/commonjs/funcs/earnEarnSwap.d.ts +6 -0
  22. package/dist/commonjs/funcs/earnEarnSwap.d.ts.map +1 -1
  23. package/dist/commonjs/funcs/earnEarnSwap.js +6 -0
  24. package/dist/commonjs/funcs/earnEarnSwap.js.map +1 -1
  25. package/dist/commonjs/funcs/earnEarnTransfer.d.ts +14 -5
  26. package/dist/commonjs/funcs/earnEarnTransfer.d.ts.map +1 -1
  27. package/dist/commonjs/funcs/earnEarnTransfer.js +14 -5
  28. package/dist/commonjs/funcs/earnEarnTransfer.js.map +1 -1
  29. package/dist/commonjs/funcs/earnEarnVaults.d.ts +6 -2
  30. package/dist/commonjs/funcs/earnEarnVaults.d.ts.map +1 -1
  31. package/dist/commonjs/funcs/earnEarnVaults.js +6 -2
  32. package/dist/commonjs/funcs/earnEarnVaults.js.map +1 -1
  33. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipApproveTransfer.d.ts +8 -8
  34. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipApproveTransfer.js +8 -8
  35. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts +9 -3
  36. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts.map +1 -1
  37. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.js +9 -3
  38. package/dist/commonjs/funcs/gasSponsorshipGasSponsorshipPrepare.js.map +1 -1
  39. package/dist/commonjs/models/components/approvetransferrequest.d.ts +1 -1
  40. package/dist/commonjs/models/components/batchedsafeoperationsresponseinput.d.ts +2 -2
  41. package/dist/commonjs/models/components/batchedsafeoperationsresponseoutput.d.ts +2 -2
  42. package/dist/commonjs/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.d.ts +3 -3
  43. package/dist/commonjs/models/components/safetxmessage.d.ts +3 -3
  44. package/dist/commonjs/models/components/sponsorgasrequest.d.ts +1 -1
  45. package/dist/commonjs/sdk/earn.d.ts +62 -46
  46. package/dist/commonjs/sdk/earn.d.ts.map +1 -1
  47. package/dist/commonjs/sdk/earn.js +62 -46
  48. package/dist/commonjs/sdk/earn.js.map +1 -1
  49. package/dist/commonjs/sdk/gassponsorship.d.ts +17 -11
  50. package/dist/commonjs/sdk/gassponsorship.d.ts.map +1 -1
  51. package/dist/commonjs/sdk/gassponsorship.js +17 -11
  52. package/dist/commonjs/sdk/gassponsorship.js.map +1 -1
  53. package/dist/esm/funcs/earnEarnAaveMarkets.d.ts +4 -7
  54. package/dist/esm/funcs/earnEarnAaveMarkets.d.ts.map +1 -1
  55. package/dist/esm/funcs/earnEarnAaveMarkets.js +4 -7
  56. package/dist/esm/funcs/earnEarnAaveMarkets.js.map +1 -1
  57. package/dist/esm/funcs/earnEarnBundle.d.ts +9 -10
  58. package/dist/esm/funcs/earnEarnBundle.d.ts.map +1 -1
  59. package/dist/esm/funcs/earnEarnBundle.js +9 -10
  60. package/dist/esm/funcs/earnEarnBundle.js.map +1 -1
  61. package/dist/esm/funcs/earnEarnCreateAccount.d.ts +5 -7
  62. package/dist/esm/funcs/earnEarnCreateAccount.d.ts.map +1 -1
  63. package/dist/esm/funcs/earnEarnCreateAccount.js +5 -7
  64. package/dist/esm/funcs/earnEarnCreateAccount.js.map +1 -1
  65. package/dist/esm/funcs/earnEarnManage.d.ts +10 -14
  66. package/dist/esm/funcs/earnEarnManage.d.ts.map +1 -1
  67. package/dist/esm/funcs/earnEarnManage.js +10 -14
  68. package/dist/esm/funcs/earnEarnManage.js.map +1 -1
  69. package/dist/esm/funcs/earnEarnPositions.d.ts +8 -1
  70. package/dist/esm/funcs/earnEarnPositions.d.ts.map +1 -1
  71. package/dist/esm/funcs/earnEarnPositions.js +8 -1
  72. package/dist/esm/funcs/earnEarnPositions.js.map +1 -1
  73. package/dist/esm/funcs/earnEarnSwap.d.ts +6 -0
  74. package/dist/esm/funcs/earnEarnSwap.d.ts.map +1 -1
  75. package/dist/esm/funcs/earnEarnSwap.js +6 -0
  76. package/dist/esm/funcs/earnEarnSwap.js.map +1 -1
  77. package/dist/esm/funcs/earnEarnTransfer.d.ts +14 -5
  78. package/dist/esm/funcs/earnEarnTransfer.d.ts.map +1 -1
  79. package/dist/esm/funcs/earnEarnTransfer.js +14 -5
  80. package/dist/esm/funcs/earnEarnTransfer.js.map +1 -1
  81. package/dist/esm/funcs/earnEarnVaults.d.ts +6 -2
  82. package/dist/esm/funcs/earnEarnVaults.d.ts.map +1 -1
  83. package/dist/esm/funcs/earnEarnVaults.js +6 -2
  84. package/dist/esm/funcs/earnEarnVaults.js.map +1 -1
  85. package/dist/esm/funcs/gasSponsorshipGasSponsorshipApproveTransfer.d.ts +8 -8
  86. package/dist/esm/funcs/gasSponsorshipGasSponsorshipApproveTransfer.js +8 -8
  87. package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts +9 -3
  88. package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.d.ts.map +1 -1
  89. package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.js +9 -3
  90. package/dist/esm/funcs/gasSponsorshipGasSponsorshipPrepare.js.map +1 -1
  91. package/dist/esm/models/components/approvetransferrequest.d.ts +1 -1
  92. package/dist/esm/models/components/batchedsafeoperationsresponseinput.d.ts +2 -2
  93. package/dist/esm/models/components/batchedsafeoperationsresponseoutput.d.ts +2 -2
  94. package/dist/esm/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.d.ts +3 -3
  95. package/dist/esm/models/components/safetxmessage.d.ts +3 -3
  96. package/dist/esm/models/components/sponsorgasrequest.d.ts +1 -1
  97. package/dist/esm/sdk/earn.d.ts +62 -46
  98. package/dist/esm/sdk/earn.d.ts.map +1 -1
  99. package/dist/esm/sdk/earn.js +62 -46
  100. package/dist/esm/sdk/earn.js.map +1 -1
  101. package/dist/esm/sdk/gassponsorship.d.ts +17 -11
  102. package/dist/esm/sdk/gassponsorship.d.ts.map +1 -1
  103. package/dist/esm/sdk/gassponsorship.js +17 -11
  104. package/dist/esm/sdk/gassponsorship.js.map +1 -1
  105. package/docs/models/components/approvetransferrequest.md +1 -1
  106. package/docs/models/components/batchedsafeoperationsresponseinput.md +2 -2
  107. package/docs/models/components/batchedsafeoperationsresponseoutput.md +2 -2
  108. package/docs/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md +5 -5
  109. package/docs/models/components/safetxmessage.md +3 -3
  110. package/docs/models/components/sponsorgasrequest.md +1 -1
  111. package/docs/sdks/earn/README.md +62 -46
  112. package/docs/sdks/gassponsorship/README.md +17 -11
  113. package/package.json +1 -1
  114. package/src/funcs/earnEarnAaveMarkets.ts +4 -7
  115. package/src/funcs/earnEarnBundle.ts +9 -10
  116. package/src/funcs/earnEarnCreateAccount.ts +5 -7
  117. package/src/funcs/earnEarnManage.ts +10 -14
  118. package/src/funcs/earnEarnPositions.ts +8 -1
  119. package/src/funcs/earnEarnSwap.ts +6 -0
  120. package/src/funcs/earnEarnTransfer.ts +14 -5
  121. package/src/funcs/earnEarnVaults.ts +6 -2
  122. package/src/funcs/gasSponsorshipGasSponsorshipApproveTransfer.ts +8 -8
  123. package/src/funcs/gasSponsorshipGasSponsorshipPrepare.ts +9 -3
  124. package/src/models/components/approvetransferrequest.ts +1 -1
  125. package/src/models/components/batchedsafeoperationsresponseinput.ts +2 -2
  126. package/src/models/components/batchedsafeoperationsresponseoutput.ts +2 -2
  127. package/src/models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.ts +3 -3
  128. package/src/models/components/safetxmessage.ts +3 -3
  129. package/src/models/components/sponsorgasrequest.ts +1 -1
  130. package/src/sdk/earn.ts +62 -46
  131. 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 for Safe transactions.
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 a Safe transaction.
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 for Safe transactions.
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 a Safe transaction.
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 for Safe transactions.
11
+ * The EIP-712 domain separator.
12
12
  */
13
13
  export type CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain =
14
14
  {
15
15
  /**
16
- * Chain ID for the Safe transaction
16
+ * Chain ID
17
17
  */
18
18
  chainId: number;
19
19
  /**
20
- * Address of the Safe contract
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 a Safe transaction.
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 Safe transaction
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
- * Safe transaction nonce
56
+ * Transaction nonce
57
57
  */
58
58
  nonce: string;
59
59
  };
@@ -31,7 +31,7 @@ export type SponsorGasRequestEip712 =
31
31
 
32
32
  export type SponsorGasRequest = {
33
33
  /**
34
- * The owner of the smart account's address.
34
+ * The wallet address that owns the Earn Account.
35
35
  */
36
36
  owner: string;
37
37
  /**
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
- * This endpoint fetches all Compass Earn positions with PnL information.
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 information about 4626 vaults.
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
- * These are earn opportunities for protocols like morpho.
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 all aave markets with their supply and borrow rates.
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
- * Optionally filter by chain.
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 creating Earn positions, the `owner` must create an Earn Account associated with their wallet address.
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
- * Only the `owner` has the authority to sign transactions for this account. This can be done in one of two ways:
97
+ * Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
90
98
  *
91
- * 1) **No gas-sponsorship:** The `owner` signs a transaction and submits it to the network for execution. The `owner` covers the cost of gas in this case.
99
+ * **If owner pays gas:** Set `sender` to the owner's address.
92
100
  *
93
- * 2) **Gas-sponsorship:** The `owner` does an off-chain EIP-712 signature and submits this signature to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`). Here, another wallet address is set as `sender`. This wallet will sign, submit and cover the gas fees of the transaction.
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 to and from an Earn Account.
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
- * If `DEPOSIT`'` is selected, tokens will be transferred from the `owner`'s wallet into their Earn Account.
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
- * If `WITHDRAW` is selected, tokens will be transferred from the `owner`'s Earn Account into their wallet.
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
- * If a gas-sponsored `DEPOSIT` transfer is desired for a given token, a one-time Permit2 allowance must be set before proceeding. This is common practice for many other applications and, for many `owner`s, this one-time allowance will already have been set for the token they would like to transfer.
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
- * Manage an Earn position for a given `owner`'s Earn Account.
151
+ * Deposit into or withdraw from a yield venue.
137
152
  *
138
- * The `owner` is the main wallet address that owns and controls the Earn Account. It is not the Earn Account address itself.
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 Types:
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
- * If `DEPOSIT` is selected for `action`, tokens will be deposited into the selected venue address from the Earn Account associated with the `owner` wallet.
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
- * 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.
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
- * This endpoint allows combining multiple actions (swaps, vault
188
- * deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
189
- * executed via the Earn account).
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 Use Case:** Swap USDC to AUSD, then deposit AUSD into a vault - all in one transaction.
208
+ * **Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
192
209
  *
193
- * Actions are executed in the order they are provided. Each action type has its own parameters:
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
- * - **V2_SWAP**: Swapping tokens within the Earn Account
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
- * The bundled transaction can be gas-sponsored by setting `gas_sponsorship=true`.
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 to be signed and submitted by `sender`.
16
+ * Prepare a gas-sponsored transaction from signed EIP-712 typed data.
17
17
  *
18
- * The `owner` submits their off-chain signature of EIP-712 typed data along with the data itself.
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
- * The `sender` will sign and submit the transaction returned from this endpoint, effectively sponsoring the gas for the transaction on behalf of the `owner`.
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
- * Prepare a one-time permit2 approval transaction for a given token.
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
- * This is only required if the `owner` would like to transfer tokens from their wallet to their Earn Account with gas-sponsorship.
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
- * This approval transaction itself can be submitted with gas-sponsorship.
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,