(aaveV3)
- aaveAaveSupportedTokens - Aave Supported Tokens
- aaveRate - Interest Rates
- aaveAvgRate - Interest Rates: Time Average
- aaveStdRate - Interest Rates: Standard Deviation
- aaveReserveOverview - Reserve Overview
- aaveTokenPrice - Token Prices
- aaveLiquidityChange - Liquidity Index
- aaveUserPositionSummary - Positions - Total
- aaveUserPositionPerToken - Positions - per Token
- aaveHistoricalTransactions - Historical Transactions
- aaveSupply - Supply/Lend
- aaveBorrow - Borrow
- aaveRepay - Repay Loans
- aaveWithdraw - Unstake
Returns the list of supported tokens on Aave for the specified network, along with key metadata.
For each token, the response includes:
- The symbol and contract address.
- Whether the token is currently enabled for supplying (depositing).
- Whether it is enabled for borrowing.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveAaveSupportedTokens({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveAaveSupportedTokens } from "@compass-labs/api-sdk/funcs/aaveV3AaveAaveSupportedTokens.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveAaveSupportedTokens(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveAaveSupportedTokens failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveAaveSupportedTokensRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveSupportedTokensResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Returns the latest APY and APR rates for a specified token on Aave, for both deposits and loans.
Annual percentage yield (APY) is the yearly return/cost after continuous compounding of the per-second rate stored on-chain. This value is the same value as seen the on app.aave.com but more up-to-date as it is taken directly from the blockchain every time this endpoint is called.
Annual percentage rate (APR) is the yearly simple interest rate (no compounding).
For APY/APR on loans Aave offers both stable and fixed rates on certain tokens.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveRate({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveRate } from "@compass-labs/api-sdk/funcs/aaveV3AaveRate.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveRate(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveRate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveRateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveRateResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Provides time-weighted averages of deposit and borrow rates for Aave reserves.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveAvgRate({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveAvgRate } from "@compass-labs/api-sdk/funcs/aaveV3AaveAvgRate.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveAvgRate(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveAvgRate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveAvgRateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveAvgRateResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Returns the historical standard deviation of lending and borrowing rates for Aave reserves, illustrating market volatility.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveStdRate({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveStdRate } from "@compass-labs/api-sdk/funcs/aaveV3AaveStdRate.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveStdRate(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveStdRate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveStdRateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveSTDRateResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Returns key metrics for Aave Reserves:
- Total Supplied (TVL) in USD
- Total Borrowed in USD
- Utilization Ratio
See below for more info:
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveReserveOverview({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveReserveOverview } from "@compass-labs/api-sdk/funcs/aaveV3AaveReserveOverview.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveReserveOverview(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveReserveOverview failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveReserveOverviewRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveReserveOverviewResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint retrieves the current price of a specified token in USD as determined by the Aave protocol.
It utilizes the Aave V3 Oracle to fetch the token price, ensuring accurate and up- to-date information. The request requires the token identifier and the blockchain network (chain) on which the token resides. The response provides the token price in a standardized format, converted from Wei to the base currency decimals defined by Aave.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveTokenPrice({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveTokenPrice } from "@compass-labs/api-sdk/funcs/aaveV3AaveTokenPrice.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveTokenPrice(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveTokenPrice failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveTokenPriceRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveTokenPriceResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint retrieves the change in the reserve liquidity index between two provided blocks.
This is then converted to a percentage change. The liquidity index represents the change in debt and interest accrual over each block. Aave does not store individual user balances directly. Instead, it keeps a scaled balance and uses the liquidity index to compute real balances dynamically. If a user was to have deposited tokens at the start block, a positive liquidity index change will represent accrued interest and a profit. If tokens were borrowed at the start block, this debt will increase, compound on itself and represent large debt. The reverse in both cases is true if the liquidity index is negative.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveLiquidityChange({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveLiquidityChange } from "@compass-labs/api-sdk/funcs/aaveV3AaveLiquidityChange.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveLiquidityChange(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveLiquidityChange failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveLiquidityChangeRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveLiquidityChangeResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint retrieves a comprehensive summary of a user's position on the AAVE platform.
It provides key financial metrics including the total collateral deposited, total debt accrued, available borrowing capacity, liquidation threshold, maximum loan-to- value ratio, and the health factor of the user's account. These metrics are calculated by aggregating data across all open positions held by the user, offering a holistic view of their financial standing within the AAVE ecosystem.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveUserPositionSummary({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveUserPositionSummary } from "@compass-labs/api-sdk/funcs/aaveV3AaveUserPositionSummary.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveUserPositionSummary(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveUserPositionSummary failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveUserPositionSummaryRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveUserPositionSummaryResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint retrieves the user's position for a specific token on the AAVE platform.
It provides key financial metrics including the current aToken balance, current stable debt, current variable debt, principal stable debt, principal variable debt, stable borrow rate, stable borrow rate for new loans, variable borrow rate, and liquidity rate. These metrics are calculated by aggregating data across all open positions held by the user for the specified token, offering a detailed view of their financial standing within the AAVE ecosystem.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveUserPositionPerToken({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveUserPositionPerToken } from "@compass-labs/api-sdk/funcs/aaveV3AaveUserPositionPerToken.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveUserPositionPerToken(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveUserPositionPerToken failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveUserPositionPerTokenRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveUserPositionPerTokenResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint retrieves historical transactions for a user on the AAVE platform.
It returns a list of transactions including deposits, withdrawals, borrows, and repayments. Each transaction includes details such as the token, amount, timestamp, and transaction type. This provides a comprehensive view of the user's historical activity within the AAVE protocol.
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveHistoricalTransactions({});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveHistoricalTransactions } from "@compass-labs/api-sdk/funcs/aaveV3AaveHistoricalTransactions.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveHistoricalTransactions(compassApiSDK, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveHistoricalTransactions failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.V1AaveHistoricalTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.AaveHistoricalTransactionsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
By supplying assets, users can earn interest on their deposits.
The supplied collateral can be used as a basis for borrowing other assets, allowing users to leverage their positions. In combination with a trading protocol, this can create leverage.
Overall, this endpoint is a critical component for users looking to maximize their asset utility within the AAVEv3 ecosystem, providing both earning potential and borrowing flexibility. Required Allowances
In order to make this transaction, token allowances need to be set for the following contracts.
- `AaveV3Pool`
</Info>
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveSupply({
token: "WETH",
amount: 1.5,
chain: "base",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveSupply } from "@compass-labs/api-sdk/funcs/aaveV3AaveSupply.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveSupply(compassApiSDK, {
token: "WETH",
amount: 1.5,
chain: "base",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveSupply failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.AaveSupplyRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.TransactionResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
You will pay interest for your borrows.
Price changes in the assets may lead to some or all of your collateral being liquidated, if the borrow position becomes unhealthy. Required Allowances
In order to make this transaction, token allowances need to be set for the following contracts.
- `AaveV3Pool`
</Info>
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveBorrow({
token: "WETH",
amount: 150.5,
interestRateMode: "stable",
chain: "ethereum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveBorrow } from "@compass-labs/api-sdk/funcs/aaveV3AaveBorrow.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveBorrow(compassApiSDK, {
token: "WETH",
amount: 150.5,
interestRateMode: "stable",
chain: "ethereum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveBorrow failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.AaveBorrowRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.TransactionResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint allows users to repay a portion or the entirety of their borrowed tokens on the Aave platform.
By repaying borrowed amounts, users can improve their health factor, which is a measure of the safety of their loan position. A higher health factor reduces the risk of liquidation, ensuring a more secure borrowing experience. The endpoint requires specifying the chain and the details of the repayment transaction, including the amount and the asset to be repaid. Required Allowances
In order to make this transaction, token allowances need to be set for the following contracts.
- `AaveV3Pool`
</Info>
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveRepay({
token: "WETH",
amount: 150.5,
interestRateMode: "stable",
chain: "arbitrum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveRepay } from "@compass-labs/api-sdk/funcs/aaveV3AaveRepay.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveRepay(compassApiSDK, {
token: "WETH",
amount: 150.5,
interestRateMode: "stable",
chain: "arbitrum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveRepay failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.AaveRepayRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.TransactionResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
This endpoint facilitates the withdrawal of collateral from the Aave protocol.
Users can withdraw a portion or all of their collateral, which may increase the risk of liquidation if there are outstanding borrows. The withdrawal process also includes the collection of any interest earned on the collateral. It is important for users to carefully consider their outstanding debts and the potential impact on their liquidation threshold before proceeding with a withdrawal. This endpoint is designed to provide a seamless and efficient way to manage your collateral within the Aave ecosystem. Required Allowances
In order to make this transaction, token allowances need to be set for the following contracts.
- `AaveV3Pool`
</Info>
import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.aaveV3.aaveWithdraw({
token: "WETH",
amount: 1.5,
recipient: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
chain: "ethereum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
console.log(result);
}
run();The standalone function version of this method:
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
import { aaveV3AaveWithdraw } from "@compass-labs/api-sdk/funcs/aaveV3AaveWithdraw.js";
// Use `CompassApiSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const compassApiSDK = new CompassApiSDKCore({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await aaveV3AaveWithdraw(compassApiSDK, {
token: "WETH",
amount: 1.5,
recipient: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
chain: "ethereum",
sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("aaveV3AaveWithdraw failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.AaveWithdrawRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.TransactionResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |