Action Module
The Action module allows you to perform actions such as borrowing assets and repaying loans.
Last updated
export type Nft = {
collection: string
tokenId: string
}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;
}
*/export type ClientOptions = {
network?: Chain
}
export type Chain = 'mainnet' | 'sepolia' | 'localhost'export const borrow = async (
amount: BigInt,
assets: Array<Nft>,
signature: Signature,
options?: ClientOptions
)const result = await borrow(amount, assets[], signature, options?);export const repay = async (
amount: BigInt,
signature: Signature,
options?: ClientOptions
)const result = await repay(amount, signature, options?);