Creates a new AlphaLend client instance
Network to connect to ("mainnet", "testnet", or "devnet")
SuiClient instance for blockchain interaction
Borrows tokens from the AlphaLend protocol
Borrow parameters
Parameters for borrowing assets from a lending market
Used with the borrow
method
Address of the user borrowing tokens
Amount to borrow in base units (in mists)
Borrow coin type (e.g., "0x2::sui::SUI")
Market ID to borrow from
Object ID of the position capability object
Coin types of the coins whose price needs to be updated (Will have to pass all market coin types that user has supplied or borrowed in and current market coin type in which user is borrowing)
Transaction object ready for signing and execution
Claims rewards from the AlphaLend protocol
ClaimRewards parameters
Parameters for claiming rewards accrued from lending or borrowing
Used with the claimRewards
method
Address of the user supplying collateral
Optional
claimAll?: booleanWhether to claim and deposit all rewards (except alpha)
Optional
claimAlpha?: booleanWhether to claim and deposit alpha rewards
Optional
claimAndDepositAll?: booleanWhether to deposit all rewards (except alpha)
Optional
claimAndDepositAlpha?: booleanWhether to deposit alpha rewards
Object ID of the position capability object
Transaction object ready for signing and execution
Creates a new position in the protocol
Transaction object for creating a new position
Gets all markets data from the protocol
Promise resolving to an array of Market objects
Gets all markets data from the protocol with cached markets chain data
Promise resolving to an array of MarketData objects
Gets a coin object suitable for a transaction
Transaction to which the coin will be added
Fully qualified coin type to get
Address of the user that owns the coin
Transaction argument representing the coin or undefined if not found
Gets all markets chain data to cache
Promise resolving to an array of Market objects
Gets statistics of the protocol
Promise resolving to a ProtocolStats object
Gets user portfolio data
The user's address for which to fetch portfolio data
Promise resolving to an array of UserPortfolio objects or undefined if not found
Gets user portfolio data for a specific position
The position ID to get portfolio data for
Promise resolving to a UserPortfolio object or undefined if not found
Gets portfolio data from position id with cached markets data
The position id for which to fetch portfolio data
The cached markets data to use for the portfolio
Promise resolving to a UserPortfolio object or undefined if not found
Gets user portfolio data with cached markets data
The user's address for which to fetch portfolio data
The cached markets data to use for the portfolio
Promise resolving to an array of UserPortfolio objects or undefined if not found
Liquidates an unhealthy position
Liquidate parameters - liquidatePositionId, borrowMarketId, withdrawMarketId, repayAmount, borrowCoinType, withdrawCoinType, coinObjectId, priceUpdateCoinTypes
Transaction object ready for signing and execution
Repays borrowed tokens to the AlphaLend protocol
Repay parameters
Parameters for repaying borrowed assets to a lending market
Used with the repay
method
Address of the user repaying the debt
Amount to repay in base units (in mists)
Repay coin type (e.g., "0x2::sui::SUI")
Market ID where the debt exists
Object ID of the position capability object
Transaction object ready for signing and execution
Supplies token collateral to the AlphaLend protocol
Supply parameters
Parameters for supplying assets as collateral to a lending market
Used with the supply
method
Address of the user supplying collateral
Amount to supply as collateral in base units (in mists)
Supply coin type (e.g., "0x2::sui::SUI")
Market ID where collateral is being added
Optional
positionCapId?: stringObject ID of the position capability object
Transaction object ready for signing and execution
Updates price information for assets from Pyth oracle
This method:
Transaction object to add price update calls to
Array of fully qualified coin types (e.g., "0x2::sui::SUI")
Transaction object with price update calls
Withdraws token collateral from the AlphaLend protocol
Withdraw parameters
Parameters for withdrawing collateral from a lending market
Used with the withdraw
method
Address of the user withdrawing collateral
Amount to withdraw (in mists, use MAX_U64 constant to withdraw all)
Withdraw coin type (e.g., "0x2::sui::SUI")
Market ID from which to withdraw
Object ID of the position capability object
Coin types of the coins whose price needs to be updated (Will have to pass all market coin types that user has supplied or borrowed in and current market coin type in which user is withdrawing)
Transaction object ready for signing and execution
AlphaLend Client
The main entry point for interacting with the AlphaLend protocol: