Renfter Protocol
  • Welcome
    • Welcome to Renfter Docs
    • Supported Chains
    • Whitelabel Renting Solution
    • Renfter Marketplace
    • Protocol Fees
    • RENFTER Token
  • Renfter Features
    • Uncollateralized NFT Renting
    • Custom Functionality Execution
    • Rewards & Airdrop Sharing
  • Developers
    • Developer Documentation
    • Technical Overview
      • Under the hood
    • Integration
      • API
      • SDKs
        • JavaScript SDK
        • Unity SDK
      • Smart Contracts
        • Functionality-specific details
          • Token rental status check
          • Token offed for rent check
          • Method whitelisting
          • Original NFT method call
        • Documentation
Powered by GitBook
On this page
  • Installation
  • Usage
  • Offer for NFT for lending
  • Rent NFT
  • Get lender (original owner)
  • Get lender (original owner) by wrapped token ID
  • Get borrower
  • Get borrower by wrapped data
  • Get original contract address
  • Get wrapped contract address
  • Get original token data
  • Get token whitelisted methods
  • Check if method is whitelisted
  • Set token whitelisted methods
  • Execute token's functionality
  • Get all tokens for address
  • Get all tokens available for renting for address
  • Get all rented tokens tokens for address
  1. Developers
  2. Integration
  3. SDKs

JavaScript SDK

Welcome to the Renfter Protocol JavaScript SDK. To begin, we recommend looking at the examples below, for deeper reference see the JavaScript SDK Github repo.

Installation

npm i @renfter/js-sdk
// or
yarn add @renfter/js-sdk

Usage

First you have to import Renfter and pass the ethers Signer.

import { Renfter } from "@renfter/js-sdk";

const renfter = new Renfter({
    signer,
    [originContractAddress]
});

Offer for NFT for lending

renfter.offerForRent({
    tokenId,
    [tokenContractAddress],
    rentingPrice,
    maxRentDuration,
    [whitelistedFunctionality[]]
});

Rent NFT

renfter.rent({
    tokenId,
    duration
});

Get lender (original owner)

renter.getLender({
    tokenId,
    [tokenContractAddress]
});

Get lender (original owner) by wrapped token ID

renter.getLender({
    tokenId,
    [tokenContractAddress]
});

Get borrower

renter.getBorrower({
    tokenId,
    [tokenContractAddress]
});

Get borrower by wrapped data

renter.getBorrowerByWrappedData({
    wTokenId,
    [wContractAddress],
});

Get original contract address

renter.getOriginalContractAddress(wContractAddress);

Get wrapped contract address

renter.getWrappedContractAddress(contractAddress);

Get original token data

renter.getOriginalTokenData({
    tokenId,
    [wContractAddress]
});

Get token whitelisted methods

renter.getWhitelistedMethodForTokenId(tokenId);

Check if method is whitelisted

renter.checkMethodForTokenId({
    tokenId,
    functionSignature
});

Set token whitelisted methods

renter.setWhitelistedMethodForTokenId({
    tokenId,
    functonSignature[],
    whitelisted[]
});

Execute token's functionality

renter.executeCustomFunctionality({
    tokenId,
    functionSignature,
    {functionArguments}
});

Get all tokens for address

renter.getTokens(address);

Get all tokens available for renting for address

renter.getAvailableTokens(address);

Get all rented tokens tokens for address

renter.getRentedTokens(address);
PreviousSDKsNextUnity SDK

Last updated 2 years ago