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);

Last updated