View Source Hyperliquid.Api.Exchange.BorrowLend (hyperliquid v0.3.1)
Borrow or lend tokens in the Hyperliquid borrow/lend protocol.
Operations:
"supply"— lend tokens into the protocol"withdraw"— withdraw a previously supplied position"repay"— repay an outstanding borrow"borrow"— borrow tokens from the protocol
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint
Usage
# Supply 20 units of token 0
{:ok, result} = BorrowLend.request("supply", 0, "20")
# Borrow, using nil to borrow the full available amount
{:ok, result} = BorrowLend.request("borrow", 0, nil)
# Repay full balance
{:ok, result} = BorrowLend.request("repay", 0, nil)
Summary
Functions
Execute a borrow/lend operation.
Functions
Execute a borrow/lend operation.
Parameters
operation: One of"supply","withdraw","repay","borrow"token: Integer token IDamount: Amount as a decimal string, ornilfor the full balanceopts: Optional parameters
Options
:private_key— Private key for signing (falls back to config):vault_address— Act on behalf of a vault
Returns
{:ok, response}— Result{:error, term()}— Error details