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
  • Types
  • Signature
  • ClientOptions
  • Functions
  • Buying an Asset
Export as PDF
  1. Getting Started
  2. SDK Modules

Buy Now Module

The Buy Now module allows you to buy assets instantly at a fixed price.

PreviousMarket ModuleNextSell Now Module

Last updated 12 months ago

Types

Signature

export type Signature = {
  data: object
  signature: { v: number; r: string; s: string; deadline: number }
}

/* data object
interface SignBuyNow {
  asset: SignAsset;
  assetLtv: BigInt;
  assetLiquidationThreshold: BigInt;
  from: string;
  to: string;
  data: string;
  value: BigInt;
  marketAdapter: string;
  marketApproval: string;
  marketPrice: BigInt;
  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

Buying an Asset

To buy an asset instantly, use the buy function from the buyNow module:

export const buy = async (
        amount: string, 
        signature: Signature, 
        options?: ClientOptions
    )
const result = await buy(amount, signature, options?);

Refer to the Buy Now Module documentation for more details on the buy function.

BuyNow flow