Action Module
The Action module allows you to perform actions such as borrowing assets and repaying loans.
Flow

Types
Assets
export type Nft = {
collection: string
tokenId: string
}Signature
export type Signature = {
data: object
signature: { v: number; r: string; s: string; deadline: number }
}
/* data object
interface SignAction {
loan: SignLoanConfig;
assets: string[];
underlyingAsset: string;
nonce: BigInt;
deadline: BigInt;
}
interface SignLoanConfig {
loanId: string;
aggLoanPrice: BigInt;
aggLtv: BigInt;
aggLiquidationThreshold: BigInt;
totalAssets: BigInt;
nonce: BigInt;
deadline: BigInt;
}
*/ClientOptions
export type ClientOptions = {
network?: Chain
}
export type Chain = 'mainnet' | 'sepolia' | 'localhost'Functions
Borrowing Assets
To borrow assets using the SDK, use the borrow function from the action module:
export const borrow = async (
amount: BigInt,
assets: Array<Nft>,
signature: Signature,
options?: ClientOptions
)const result = await borrow(amount, assets[], signature, options?);Repaying Loans
To repay a borrowed loan, use the repay function from the action module:
export const repay = async (
amount: BigInt,
signature: Signature,
options?: ClientOptions
)const result = await repay(amount, signature, options?);Refer to the Action Module documentation for more details on the borrow and repay functions.
Last updated