LogoLogo
  • About
    • Introduction
    • Unlockd SDK
    • Partners & Revenue Sharing
  • Getting Started
    • Installation
    • SDK Modules
      • Action Module
      • Auction Module
      • Market Module
      • Buy Now Module
      • Sell Now Module
      • Wallet Module
      • NFT Batch Transfer Module
    • Code Examples
      • Borrowing Assets
      • Fetch prices
      • Login
      • Borrow Signature
      • Minimum Repay
      • Liquidation Price
      • Health Factor
      • Available to borrow
    • UI Snippets
    • Reservoir Integration
  • USE CASES (code examples)
    • Borrow against RWAs
    • 'Buy Now, Pay Later' financing
  • Resources
    • npmJS Package
    • Best Practices
    • Changelog
    • Support & Contact
    • Unlockd V2
    • Product Documentation
    • Protocol Documentation
    • Risk Documentation
    • External Audits
    • Website
    • X (Twitter)
    • Discord
    • Other links
Powered by GitBook
On this page
  • Flow
  • Types
  • Assets
  • Signature
  • ClientOptions
  • Functions
  • Borrowing Assets
  • Repaying Loans
Export as PDF
  1. Getting Started
  2. SDK Modules

Action Module

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

PreviousSDK ModulesNextAuction Module

Last updated 12 months ago

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.

Action Flow