@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
package/dist/esm/sdk/earn.d.ts
CHANGED
|
@@ -6,87 +6,98 @@ export declare class Earn extends ClientSDK {
|
|
|
6
6
|
* List earn positions
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
*
|
|
9
|
+
* List all Earn positions for a given owner with PnL tracking.
|
|
10
|
+
*
|
|
11
|
+
* Returns position data including current balance, cost basis, and profit and loss.
|
|
12
|
+
* Use this endpoint to display portfolio performance, track yields over time, or build
|
|
13
|
+
* position management interfaces.
|
|
14
|
+
*
|
|
15
|
+
* Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
16
|
+
* position includes the venue address, deposited amount, and performance metrics.
|
|
10
17
|
*/
|
|
11
18
|
earnPositions(request: operations.V2EarnPositionsRequest, options?: RequestOptions): Promise<components.EarnPositionsResponse>;
|
|
12
19
|
/**
|
|
13
20
|
* List vaults
|
|
14
21
|
*
|
|
15
22
|
* @remarks
|
|
16
|
-
* List
|
|
23
|
+
* List ERC-4626 yield vaults across DeFi venues.
|
|
24
|
+
*
|
|
25
|
+
* 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.
|
|
26
|
+
*
|
|
27
|
+
* Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
17
28
|
*
|
|
18
|
-
*
|
|
29
|
+
* To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
19
30
|
*/
|
|
20
31
|
earnVaults(request: operations.V2EarnVaultsRequest, options?: RequestOptions): Promise<components.VaultsResponse>;
|
|
21
32
|
/**
|
|
22
33
|
* List aave markets
|
|
23
34
|
*
|
|
24
35
|
* @remarks
|
|
25
|
-
* List
|
|
36
|
+
* List Aave lending markets with supply and borrow rates.
|
|
26
37
|
*
|
|
27
|
-
* Returns rates organized by token symbol, with chain-specific data for each token.
|
|
28
|
-
* Each token includes rates for all chains where it's available, plus information
|
|
29
|
-
* about which chain offers the highest supply APY.
|
|
38
|
+
* 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.
|
|
30
39
|
*
|
|
31
|
-
* APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
32
|
-
* zero APY on both supply and borrow are excluded.
|
|
40
|
+
* 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.
|
|
33
41
|
*
|
|
34
|
-
*
|
|
42
|
+
* 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`.
|
|
35
43
|
*/
|
|
36
44
|
earnAaveMarkets(request: operations.V2EarnAaveMarketsRequest, options?: RequestOptions): Promise<components.ListAaveMarketsResponse>;
|
|
37
45
|
/**
|
|
38
46
|
* Create earn account
|
|
39
47
|
*
|
|
40
48
|
* @remarks
|
|
41
|
-
* Create an Earn Account.
|
|
49
|
+
* Create an Earn Account for a wallet address.
|
|
42
50
|
*
|
|
43
|
-
* Before
|
|
51
|
+
* Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
44
52
|
*
|
|
45
|
-
*
|
|
53
|
+
* Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
46
54
|
*
|
|
47
|
-
*
|
|
55
|
+
* **If owner pays gas:** Set `sender` to the owner's address.
|
|
48
56
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* 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.
|
|
57
|
+
* **If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
52
58
|
*/
|
|
53
59
|
earnCreateAccount(request: components.CreateAccountRequest, options?: RequestOptions): Promise<components.CreateAccountResponse>;
|
|
54
60
|
/**
|
|
55
61
|
* Transfer tokens to/from account
|
|
56
62
|
*
|
|
57
63
|
* @remarks
|
|
58
|
-
* Transfer tokens
|
|
64
|
+
* Transfer tokens between an owner's wallet and their Earn Account.
|
|
65
|
+
*
|
|
66
|
+
* 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.
|
|
67
|
+
*
|
|
68
|
+
* **Gas-sponsored deposits** require two steps:
|
|
59
69
|
*
|
|
60
|
-
*
|
|
70
|
+
* **Step 1 (once per token):** Set up Permit2 allowance
|
|
71
|
+
* 1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
72
|
+
* 2. Owner signs the typed data
|
|
73
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
61
74
|
*
|
|
62
|
-
*
|
|
75
|
+
* **Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
76
|
+
* 1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
77
|
+
* 2. Owner signs the typed data
|
|
78
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
63
79
|
*
|
|
64
|
-
*
|
|
65
|
-
* 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.
|
|
80
|
+
* **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).
|
|
66
81
|
*/
|
|
67
82
|
earnTransfer(request: components.EarnTransferRequest, options?: RequestOptions): Promise<components.EarnTransferResponse>;
|
|
68
83
|
/**
|
|
69
84
|
* Manage earn position
|
|
70
85
|
*
|
|
71
86
|
* @remarks
|
|
72
|
-
*
|
|
87
|
+
* Deposit into or withdraw from a yield venue.
|
|
73
88
|
*
|
|
74
|
-
*
|
|
89
|
+
* 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.
|
|
75
90
|
*
|
|
76
|
-
* Venue
|
|
77
|
-
* - VAULTS
|
|
78
|
-
* - AAVE
|
|
91
|
+
* **Venue types:**
|
|
92
|
+
* - `VAULTS`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
93
|
+
* - `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
79
94
|
*
|
|
80
|
-
*
|
|
95
|
+
* **Fees:** A fee can be configured and deducted from the transaction amount:
|
|
96
|
+
* - `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
97
|
+
* - `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
98
|
+
* - `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
81
99
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
|
|
85
|
-
* - `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
86
|
-
* - `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
|
|
87
|
-
* - `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
|
|
88
|
-
*
|
|
89
|
-
* 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.
|
|
100
|
+
* **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).
|
|
90
101
|
*/
|
|
91
102
|
earnManage(request: components.EarnManageRequest, options?: RequestOptions): Promise<components.EarnManageResponse>;
|
|
92
103
|
/**
|
|
@@ -94,26 +105,31 @@ export declare class Earn extends ClientSDK {
|
|
|
94
105
|
*
|
|
95
106
|
* @remarks
|
|
96
107
|
* Swap tokens within an Earn Account.
|
|
108
|
+
*
|
|
109
|
+
* Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
110
|
+
*
|
|
111
|
+
* 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.
|
|
112
|
+
*
|
|
113
|
+
* 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`.
|
|
97
114
|
*/
|
|
98
115
|
earnSwap(request: components.EarnSwapRequest, options?: RequestOptions): Promise<components.EarnSwapResponse>;
|
|
99
116
|
/**
|
|
100
117
|
* Execute multiple earn actions
|
|
101
118
|
*
|
|
102
119
|
* @remarks
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* executed
|
|
120
|
+
* Combine multiple actions into a single atomic transaction.
|
|
121
|
+
*
|
|
122
|
+
* 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.
|
|
106
123
|
*
|
|
107
|
-
* **Example
|
|
124
|
+
* **Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
108
125
|
*
|
|
109
|
-
*
|
|
126
|
+
* **Action types:**
|
|
127
|
+
* - `V2_SWAP`: Swap tokens within the Earn Account
|
|
128
|
+
* - `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
110
129
|
*
|
|
111
|
-
*
|
|
112
|
-
* - **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
130
|
+
* Actions execute in the order provided.
|
|
113
131
|
*
|
|
114
|
-
*
|
|
115
|
-
* This returns EIP-712 typed data that the owner must sign and submit to
|
|
116
|
-
* `/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
132
|
+
* **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).
|
|
117
133
|
*/
|
|
118
134
|
earnBundle(request: components.V2BundleRequest, options?: RequestOptions): Promise<components.V2BundleResponse>;
|
|
119
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"earn.d.ts","sourceRoot":"","sources":["../../../src/sdk/earn.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,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EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC;IAQzC;;;;;;;;;;;OAWG;IACG,QAAQ,CACZ,OAAO,EAAE,UAAU,CAAC,eAAe,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC;IAQvC;;;;;;;;;;;;;;;;;OAiBG;IACG,UAAU,CACd,OAAO,EAAE,UAAU,CAAC,eAAe,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC;CAOxC"}
|
package/dist/esm/sdk/earn.js
CHANGED
|
@@ -16,7 +16,14 @@ export class Earn extends ClientSDK {
|
|
|
16
16
|
* List earn positions
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
*
|
|
19
|
+
* List all Earn positions for a given owner with PnL tracking.
|
|
20
|
+
*
|
|
21
|
+
* Returns position data including current balance, cost basis, and profit and loss.
|
|
22
|
+
* Use this endpoint to display portfolio performance, track yields over time, or build
|
|
23
|
+
* position management interfaces.
|
|
24
|
+
*
|
|
25
|
+
* Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
26
|
+
* position includes the venue address, deposited amount, and performance metrics.
|
|
20
27
|
*/
|
|
21
28
|
async earnPositions(request, options) {
|
|
22
29
|
return unwrapAsync(earnEarnPositions(this, request, options));
|
|
@@ -25,9 +32,13 @@ export class Earn extends ClientSDK {
|
|
|
25
32
|
* List vaults
|
|
26
33
|
*
|
|
27
34
|
* @remarks
|
|
28
|
-
* List
|
|
35
|
+
* List ERC-4626 yield vaults across DeFi venues.
|
|
36
|
+
*
|
|
37
|
+
* 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.
|
|
38
|
+
*
|
|
39
|
+
* Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
29
40
|
*
|
|
30
|
-
*
|
|
41
|
+
* To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
31
42
|
*/
|
|
32
43
|
async earnVaults(request, options) {
|
|
33
44
|
return unwrapAsync(earnEarnVaults(this, request, options));
|
|
@@ -36,16 +47,13 @@ export class Earn extends ClientSDK {
|
|
|
36
47
|
* List aave markets
|
|
37
48
|
*
|
|
38
49
|
* @remarks
|
|
39
|
-
* List
|
|
50
|
+
* List Aave lending markets with supply and borrow rates.
|
|
40
51
|
*
|
|
41
|
-
* Returns rates organized by token symbol, with chain-specific data for each token.
|
|
42
|
-
* Each token includes rates for all chains where it's available, plus information
|
|
43
|
-
* about which chain offers the highest supply APY.
|
|
52
|
+
* 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.
|
|
44
53
|
*
|
|
45
|
-
* APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
46
|
-
* zero APY on both supply and borrow are excluded.
|
|
54
|
+
* 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.
|
|
47
55
|
*
|
|
48
|
-
*
|
|
56
|
+
* 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`.
|
|
49
57
|
*/
|
|
50
58
|
async earnAaveMarkets(request, options) {
|
|
51
59
|
return unwrapAsync(earnEarnAaveMarkets(this, request, options));
|
|
@@ -54,17 +62,15 @@ export class Earn extends ClientSDK {
|
|
|
54
62
|
* Create earn account
|
|
55
63
|
*
|
|
56
64
|
* @remarks
|
|
57
|
-
* Create an Earn Account.
|
|
65
|
+
* Create an Earn Account for a wallet address.
|
|
58
66
|
*
|
|
59
|
-
* Before
|
|
67
|
+
* Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
60
68
|
*
|
|
61
|
-
*
|
|
69
|
+
* Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
62
70
|
*
|
|
63
|
-
*
|
|
71
|
+
* **If owner pays gas:** Set `sender` to the owner's address.
|
|
64
72
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* 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.
|
|
73
|
+
* **If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
68
74
|
*/
|
|
69
75
|
async earnCreateAccount(request, options) {
|
|
70
76
|
return unwrapAsync(earnEarnCreateAccount(this, request, options));
|
|
@@ -73,14 +79,23 @@ export class Earn extends ClientSDK {
|
|
|
73
79
|
* Transfer tokens to/from account
|
|
74
80
|
*
|
|
75
81
|
* @remarks
|
|
76
|
-
* Transfer tokens
|
|
82
|
+
* Transfer tokens between an owner's wallet and their Earn Account.
|
|
83
|
+
*
|
|
84
|
+
* 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.
|
|
85
|
+
*
|
|
86
|
+
* **Gas-sponsored deposits** require two steps:
|
|
77
87
|
*
|
|
78
|
-
*
|
|
88
|
+
* **Step 1 (once per token):** Set up Permit2 allowance
|
|
89
|
+
* 1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
90
|
+
* 2. Owner signs the typed data
|
|
91
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
79
92
|
*
|
|
80
|
-
*
|
|
93
|
+
* **Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
94
|
+
* 1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
95
|
+
* 2. Owner signs the typed data
|
|
96
|
+
* 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
81
97
|
*
|
|
82
|
-
*
|
|
83
|
-
* 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.
|
|
98
|
+
* **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).
|
|
84
99
|
*/
|
|
85
100
|
async earnTransfer(request, options) {
|
|
86
101
|
return unwrapAsync(earnEarnTransfer(this, request, options));
|
|
@@ -89,24 +104,20 @@ export class Earn extends ClientSDK {
|
|
|
89
104
|
* Manage earn position
|
|
90
105
|
*
|
|
91
106
|
* @remarks
|
|
92
|
-
*
|
|
107
|
+
* Deposit into or withdraw from a yield venue.
|
|
93
108
|
*
|
|
94
|
-
*
|
|
109
|
+
* 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.
|
|
95
110
|
*
|
|
96
|
-
* Venue
|
|
97
|
-
* - VAULTS
|
|
98
|
-
* - AAVE
|
|
111
|
+
* **Venue types:**
|
|
112
|
+
* - `VAULTS`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
113
|
+
* - `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
99
114
|
*
|
|
100
|
-
*
|
|
115
|
+
* **Fees:** A fee can be configured and deducted from the transaction amount:
|
|
116
|
+
* - `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
117
|
+
* - `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
118
|
+
* - `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
101
119
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
|
|
105
|
-
* - `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
106
|
-
* - `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
|
|
107
|
-
* - `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
|
|
108
|
-
*
|
|
109
|
-
* 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.
|
|
120
|
+
* **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).
|
|
110
121
|
*/
|
|
111
122
|
async earnManage(request, options) {
|
|
112
123
|
return unwrapAsync(earnEarnManage(this, request, options));
|
|
@@ -116,6 +127,12 @@ export class Earn extends ClientSDK {
|
|
|
116
127
|
*
|
|
117
128
|
* @remarks
|
|
118
129
|
* Swap tokens within an Earn Account.
|
|
130
|
+
*
|
|
131
|
+
* Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
132
|
+
*
|
|
133
|
+
* 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.
|
|
134
|
+
*
|
|
135
|
+
* 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`.
|
|
119
136
|
*/
|
|
120
137
|
async earnSwap(request, options) {
|
|
121
138
|
return unwrapAsync(earnEarnSwap(this, request, options));
|
|
@@ -124,20 +141,19 @@ export class Earn extends ClientSDK {
|
|
|
124
141
|
* Execute multiple earn actions
|
|
125
142
|
*
|
|
126
143
|
* @remarks
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* executed
|
|
144
|
+
* Combine multiple actions into a single atomic transaction.
|
|
145
|
+
*
|
|
146
|
+
* 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.
|
|
130
147
|
*
|
|
131
|
-
* **Example
|
|
148
|
+
* **Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
132
149
|
*
|
|
133
|
-
*
|
|
150
|
+
* **Action types:**
|
|
151
|
+
* - `V2_SWAP`: Swap tokens within the Earn Account
|
|
152
|
+
* - `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
134
153
|
*
|
|
135
|
-
*
|
|
136
|
-
* - **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
154
|
+
* Actions execute in the order provided.
|
|
137
155
|
*
|
|
138
|
-
*
|
|
139
|
-
* This returns EIP-712 typed data that the owner must sign and submit to
|
|
140
|
-
* `/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
156
|
+
* **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).
|
|
141
157
|
*/
|
|
142
158
|
async earnBundle(request, options) {
|
|
143
159
|
return unwrapAsync(earnEarnBundle(this, request, options));
|
package/dist/esm/sdk/earn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"earn.js","sourceRoot":"","sources":["../../../src/sdk/earn.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OA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ACd,OAAmC,EACnC,OAAwB;QAExB,OAAO,WAAW,CAAC,cAAc,CAC/B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -5,27 +5,33 @@ export declare class GasSponsorship extends ClientSDK {
|
|
|
5
5
|
* Prepare gas-sponsored transaction
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* Prepare a gas-sponsored transaction
|
|
8
|
+
* Prepare a gas-sponsored transaction from signed EIP-712 typed data.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* 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.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* **How gas sponsorship works:**
|
|
13
|
+
* 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
|
|
14
|
+
* 2. Owner signs the typed data off-chain
|
|
15
|
+
* 3. Submit signature + typed data to this endpoint
|
|
16
|
+
* 4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
|
|
17
|
+
*
|
|
18
|
+
* **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).
|
|
13
19
|
*/
|
|
14
20
|
gasSponsorshipPrepare(request: components.SponsorGasRequest, options?: RequestOptions): Promise<components.SponsorGasResponse>;
|
|
15
21
|
/**
|
|
16
22
|
* Approve token transfer
|
|
17
23
|
*
|
|
18
24
|
* @remarks
|
|
19
|
-
*
|
|
25
|
+
* Set up a one-time Permit2 allowance for gas-sponsored token transfers.
|
|
26
|
+
*
|
|
27
|
+
* 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.
|
|
20
28
|
*
|
|
21
|
-
*
|
|
29
|
+
* **With gas sponsorship (`gas_sponsorship=true`):**
|
|
30
|
+
* - Returns EIP-712 typed data for the owner to sign off-chain
|
|
31
|
+
* - Submit signature + typed data to [/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
32
|
+
* - Only works for tokens that support EIP-2612 permit (e.g., USDC)
|
|
22
33
|
*
|
|
23
|
-
*
|
|
24
|
-
* In this case, EIP-712 typed data will be returned and should be signed by the `owner` off-chain.
|
|
25
|
-
* This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
26
|
-
* Gas-sponsored approvals can only be achieved by ERC-20 tokens that support permit (EIP-2612).
|
|
27
|
-
* Some tokens, like USDT and WETH, do not allow for this behavior.
|
|
28
|
-
* 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.
|
|
34
|
+
* 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.
|
|
29
35
|
*/
|
|
30
36
|
gasSponsorshipApproveTransfer(request: components.ApproveTransferRequest, options?: RequestOptions): Promise<components.ApproveTransferResponse>;
|
|
31
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gassponsorship.d.ts","sourceRoot":"","sources":["../../../src/sdk/gassponsorship.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,cAAe,SAAQ,SAAS;IAC3C
|
|
1
|
+
{"version":3,"file":"gassponsorship.d.ts","sourceRoot":"","sources":["../../../src/sdk/gassponsorship.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,cAAe,SAAQ,SAAS;IAC3C;;;;;;;;;;;;;;;OAeG;IACG,qBAAqB,CACzB,OAAO,EAAE,UAAU,CAAC,iBAAiB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC;IAQzC;;;;;;;;;;;;;;OAcG;IACG,6BAA6B,CACjC,OAAO,EAAE,UAAU,CAAC,sBAAsB,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;CAO/C"}
|
|
@@ -10,11 +10,17 @@ export class GasSponsorship extends ClientSDK {
|
|
|
10
10
|
* Prepare gas-sponsored transaction
|
|
11
11
|
*
|
|
12
12
|
* @remarks
|
|
13
|
-
* Prepare a gas-sponsored transaction
|
|
13
|
+
* Prepare a gas-sponsored transaction from signed EIP-712 typed data.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* 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.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* **How gas sponsorship works:**
|
|
18
|
+
* 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
|
|
19
|
+
* 2. Owner signs the typed data off-chain
|
|
20
|
+
* 3. Submit signature + typed data to this endpoint
|
|
21
|
+
* 4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
|
|
22
|
+
*
|
|
23
|
+
* **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).
|
|
18
24
|
*/
|
|
19
25
|
async gasSponsorshipPrepare(request, options) {
|
|
20
26
|
return unwrapAsync(gasSponsorshipGasSponsorshipPrepare(this, request, options));
|
|
@@ -23,16 +29,16 @@ export class GasSponsorship extends ClientSDK {
|
|
|
23
29
|
* Approve token transfer
|
|
24
30
|
*
|
|
25
31
|
* @remarks
|
|
26
|
-
*
|
|
32
|
+
* Set up a one-time Permit2 allowance for gas-sponsored token transfers.
|
|
33
|
+
*
|
|
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.
|
|
27
35
|
*
|
|
28
|
-
*
|
|
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)
|
|
29
40
|
*
|
|
30
|
-
*
|
|
31
|
-
* In this case, EIP-712 typed data will be returned and should be signed by the `owner` off-chain.
|
|
32
|
-
* This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
33
|
-
* Gas-sponsored approvals can only be achieved by ERC-20 tokens that support permit (EIP-2612).
|
|
34
|
-
* Some tokens, like USDT and WETH, do not allow for this behavior.
|
|
35
|
-
* 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.
|
|
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.
|
|
36
42
|
*/
|
|
37
43
|
async gasSponsorshipApproveTransfer(request, options) {
|
|
38
44
|
return unwrapAsync(gasSponsorshipGasSponsorshipApproveTransfer(this, request, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gassponsorship.js","sourceRoot":"","sources":["../../../src/sdk/gassponsorship.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2CAA2C,EAAE,MAAM,yDAAyD,CAAC;AACtH,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C
|
|
1
|
+
{"version":3,"file":"gassponsorship.js","sourceRoot":"","sources":["../../../src/sdk/gassponsorship.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2CAA2C,EAAE,MAAM,yDAAyD,CAAC;AACtH,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,qBAAqB,CACzB,OAAqC,EACrC,OAAwB;QAExB,OAAO,WAAW,CAAC,mCAAmC,CACpD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,6BAA6B,CACjC,OAA0C,EAC1C,OAAwB;QAExB,OAAO,WAAW,CAAC,2CAA2C,CAC5D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -16,7 +16,7 @@ let value: ApproveTransferRequest = {
|
|
|
16
16
|
|
|
17
17
|
| Field | Type | Required | Description | Example |
|
|
18
18
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
19
|
-
| `owner` | *string* | :heavy_check_mark: | The
|
|
19
|
+
| `owner` | *string* | :heavy_check_mark: | The wallet address that owns the Earn Account. | 0x01E62835dd7F52173546A325294762143eE4a882 |
|
|
20
20
|
| `chain` | [components.Chain](../../models/components/chain.md) | :heavy_check_mark: | The chain to use. | |
|
|
21
21
|
| `token` | *string* | :heavy_check_mark: | The token you would like to transfer with gas sponsorship. | USDT |
|
|
22
22
|
| `gasSponsorship` | *boolean* | :heavy_minus_sign: | Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint. | false |
|
|
@@ -54,7 +54,7 @@ let value: BatchedSafeOperationsResponseInput = {
|
|
|
54
54
|
|
|
55
55
|
| Field | Type | Required | Description |
|
|
56
56
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
57
|
-
| `domain` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md) | :heavy_check_mark: | The EIP-712 domain separator
|
|
57
|
+
| `domain` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md) | :heavy_check_mark: | The EIP-712 domain separator. |
|
|
58
58
|
| `types` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712types.md) | :heavy_check_mark: | The type definitions for EIP-712 structured data. |
|
|
59
59
|
| `primaryType` | *"SafeTx"* | :heavy_check_mark: | Primary type for the structured data |
|
|
60
|
-
| `message` | [components.SafeTxMessage](../../models/components/safetxmessage.md) | :heavy_check_mark: | The message data for
|
|
60
|
+
| `message` | [components.SafeTxMessage](../../models/components/safetxmessage.md) | :heavy_check_mark: | The message data for the transaction. |
|
|
@@ -36,7 +36,7 @@ let value: BatchedSafeOperationsResponseOutput = {
|
|
|
36
36
|
|
|
37
37
|
| Field | Type | Required | Description |
|
|
38
38
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
39
|
-
| `domain` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md) | :heavy_check_mark: | The EIP-712 domain separator
|
|
39
|
+
| `domain` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712domain.md) | :heavy_check_mark: | The EIP-712 domain separator. |
|
|
40
40
|
| `types` | [components.CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types](../../models/components/compassapibackendv2modelssafetransactresponsebatchedsafeoperationseip712types.md) | :heavy_check_mark: | The type definitions for EIP-712 structured data. |
|
|
41
41
|
| `primaryType` | *"SafeTx"* | :heavy_check_mark: | Primary type for the structured data |
|
|
42
|
-
| `message` | [components.SafeTxMessage](../../models/components/safetxmessage.md) | :heavy_check_mark: | The message data for
|
|
42
|
+
| `message` | [components.SafeTxMessage](../../models/components/safetxmessage.md) | :heavy_check_mark: | The message data for the transaction. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CompassApiBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain
|
|
2
2
|
|
|
3
|
-
The EIP-712 domain separator
|
|
3
|
+
The EIP-712 domain separator.
|
|
4
4
|
|
|
5
5
|
## Example Usage
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ let value:
|
|
|
17
17
|
|
|
18
18
|
## Fields
|
|
19
19
|
|
|
20
|
-
| Field
|
|
21
|
-
|
|
|
22
|
-
| `chainId`
|
|
23
|
-
| `verifyingContract`
|
|
20
|
+
| Field | Type | Required | Description |
|
|
21
|
+
| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ |
|
|
22
|
+
| `chainId` | *number* | :heavy_check_mark: | Chain ID |
|
|
23
|
+
| `verifyingContract` | *string* | :heavy_check_mark: | Address of the Product Account |
|