Lending

This guide explains how to lend an NFT and make it listed for rentals.

1. Retrieve Market Contract:

Firstly you need to access to the Market contract:

const contracts = stash.contracts;
const market = contracts.market;

2. Call Lend Function:

All you have to do afterwards is to call lend function from the market itself:

market.lend(
          tokenId,
                amount, // 1 for 721-NFTs
          standard,
          expiry,
          pricePerDay,
          ERC20Address,
          revShareBasisPoints,
          buyPrice,
          (response) => {
            // On success
            console.log('Successful', response);
            // Retrieve rentalId
            const rentalId = response.args.rentalId;
            console.log('Rental ID', rentalId);
            //Transaction has response.transactions[0].txn_hash
          },
          (error) => {
            // On error
            console.log('Failed', error);
          }
        );

📘

Function Parameters

The required parameters for the lend function are explained on Stash Market page.

If any error occurs (e.g. user declines approval request or contract call fails) during the process, the error object error contains respective information about the reason of the failure. You can find more information about the error structure under Error Handling section in Integration docs.

If the lending has been successfully performed, then the success callback is called where the response object has the respective rentalId in its extra args.


Next up

Find out how to rent an NFT out to a renter