Interfaces

This section is a work in progress..

getAliveRentals

getAliveRentals(renter: string, contract: string) => Promise<{renter: string; contract: string; tokenId: number; vault: string; endTime: number;}[]>

Returns unexpired rentals for a given renter and an ERC721 contract address.

Inputs

renter

The address of renter

contract

The address of an ERC721 contract

Outputs

An array of structs, here are the members of the structure.

renter

The address of renter

contract

The address of an ERC721 contract

tokenId

The token's ID

vault

Lender's vault contract which holds the rented token

endTime

A timestamp of the end of the rental

if (endTime < Math.ceil(Date.now() / 1000)) {
    // The rent is expired
} else {
    // allow to login with the tokenID 
}

Usage Example

lend

lend(contract: string, tokenId: number, payment: string, unitFee: number) => Promise< void >

lend an NFT token. Lend can also use this to change the payment method and the unitFee. Just lend again.

contract

The address of an ERC721 contract

tokenId

The token's ID

payment

The address of an ERC20 token to pay the rental fee, address(0) means pay with ether.

unitFee

The price per unit of rental time

Lend Example

rent

rent(contract: string, tokenId: number, amount: number) => Promise< void >

rent an NFT token.

contract

The address of an ERC721 contract

tokenId

The token's ID

amount

The number of rentals for a unit of rental time

Rent Example

cancelLend

cancelLend(contract: string, tokenId: number) => Promise< void >

cancel lend an NFT token, existing alive rentals will not be affected.

contract

The address of an ERC721 contract

tokenId

The token's ID

CancelLend Example

isRented

isRented(contract: string, tokenId: number) => Promise< boolean >

check if a token is rented

contract

The address of an ERC721 contract

tokenId

The token's ID

IsRented Example

Last updated