Aave
Sure, here's the documentation for the Aave
class from the @moonup/moon-api
library, including an initialization section and usage examples for all of the functions:
Initialization
To use the Aave
class, you first need to initialize an HttpClient
object with your API base URL and security worker. The security worker is a function that returns the headers to be included in the API requests. In this case, it returns an authorization header with a bearer token.
Methods
borrow(name: string, data: AaveInput, params: RequestParams = {})
borrow(name: string, data: AaveInput, params: RequestParams = {})
Borrows an asset from the Aave protocol.
Parameters:
name
: The name of the account.data
: An object containing theasset
andamount
properties.params
: Optional request parameters.
Returns: A promise that resolves to a
BorrowData
object.Example:
lend(name: string, data: AaveInput, params: RequestParams = {})
lend(name: string, data: AaveInput, params: RequestParams = {})
Lends an asset to the Aave protocol.
Parameters:
name
: The name of the account.data
: An object containing theasset
andamount
properties.params
: Optional request parameters.
Returns: A promise that resolves to a
LendData
object.Example:
repay(name: string, data: AaveInput, params: RequestParams = {})
repay(name: string, data: AaveInput, params: RequestParams = {})
Repays a borrowed asset to the Aave protocol.
Parameters:
name
: The name of the account.data
: An object containing theasset
andamount
properties.params
: Optional request parameters.
Returns: A promise that resolves to a
RepayData
object.Example:
userReserveData(name: string, data: AaveInput, params: RequestParams = {})
userReserveData(name: string, data: AaveInput, params: RequestParams = {})
Retrieves data about a user's reserve in the Aave protocol.
Parameters:
name
: The name of the account.data
: An object containing theasset
property.params
: Optional request parameters.
Returns: A promise that resolves to a
UserReserveDataData
object.Example:
These examples assume that you have already initialized the HttpClient
and Aave
objects as shown in the initialization section. Make sure to replace the placeholders with actual values.
Last updated