npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@infy-protocol/sdk

v0.0.5

Published

Lend and rent any ERC721s and ERC1155s on supported mainnet and testnet.

Downloads

10

Readme

Welcome to Infy SDK

Lend and rent any ERC721s and ERC1155s on supported mainnet and testnet.

Infy SDK allows you to lend and rent ERC 721 and ERC 1155 NFTs in collateralized and collateral free way.

Install

yarn add @infy-protocol/sdk or Add "@infy-protocol/sdk": "latest-version" to your package.json

How to access:

import-module in your in page import { SupportedChainIds, ContractType, GetNetworkDetailsByChainId, CONTRACT_TYPE_LIST,SupportedChainIds, ALL_SUPPORTED_CHAIN_IDS ....} from "@infy-protocol/sdk"

Get Contract and Network details:

SDK provider the "NetworkConfig" JSON to get the Contract addresses, Subgraph URL, Chain information, and the Blockchain supporting utils
NetworkConfig = { chainid: { name: string, chainId: number, shortName: string, chain: string, networkId: number, nativeCurrency: {}, rpc: string[], faucets: string[], explorers: { name: string, url: string, standard: string }, infoURL: string, logoURL: string, collateralizedContractAddresses: string[], collateralFreeContractAddresses: string[], revenueSharedNFTRentalsContractAddresses: string[]; revenueSharedConfiguratorContractAddresses: string[]; e721ContractAddresses: string[], // Testnet e721BContractAddresses: string[], // Testnet e1155ContractAddresses: string[], // Testnet e1155BContractAddresses: string[], // Testnet wETHContractAddresses: string[], daiContractAddresses: string[], usdcContractAddresses: string[], usdtContractAddresses: string[], tUSDContractAddresses: string[], utilsContractAddresses: string[], subgraphs: { collateralized: string, collateralFree: string, revenueSharedNFTRentals: string; e721: string, // Testnet and Moralis unsupported chains e1155: string // Testnet and Moralis unsupported chains }, moralisDetails: { isSupported: boolean, lookupValue: string }, chainApiId: string, isSupported: boolean, isTestnet: boolean } }

How to use:

  • import sdk import { NetworkConfig, SupportedChainIds, ContractType, GetNetworkDetailsByChainId } from "@infy-protocol/sdk";

  • Now you can use it

const GetNetworkDetailsByChainId = (networkId: SupportedChainIds): TypeNetworkDetails => { return NetworkConfig[networkId] } const polygonContactDetails = GetNetworkDetailsByChainId(137) Or const polygonContactDetails = NetworkConfig[137]

  1. polygonContactDetails.collateralizedContractAddresses[0]
  2. polygonContactDetails.collateralFreeContractAddresses[0]
  3. polygonContactDetails.revenueSharedNFTRentalsContractAddresses[0] .... To get subgraph endpoint
  4. polygonContactDetails.subgraphs.collateralized
  5. polygonContactDetails.subgraphs.collateralFree
  6. polygonContactDetails.subgraphs.revenueSharedNFTRentals ....

Supported Chains:

The "SupportedChainIds" enum is available in SDK to help you

Supported Payment Tokens:

The "getPaymentOption" method of "RevenueShared contract will return token address by passing index. Note: index is starting from 1 and it will return ZERO_ADDRESS(0x0000000000000000000000000000000000000000) for unlisted index;

Supporting NFT Standard:

The "NFTStandard" enum avaialble in sdk

Create Infy contract object :

The "ContractType" enum which is already present in SDK will help you to get the specific type of contract.

  1. Collateralized Contract: const object = new CollateralizedNFTRentals(signer, Number(chainId));
  2. Collateral Free Contract: const object = new CollateralFreeNFTRentals(signer, Number(chainId));
  3. Revenue share Contract: const object = new RevenueSharedNFTRentals(signer, Number(chainId));

Call to contract methods:

Collateralized and CollateralFree Contract

  • Here, in arguments all individual elements should be in the form of List
  1. object.lend( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendAmounts: BigNumber[], maxRentDurations: number[], minRentDurations: number[], dailyRentPrices: string[], paymentOptions: number[], collateralPrices: string[], allowedRenters: string[][][] );

  2. object.stopLending( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[] );

  3. object.rent( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], rentDurations: number[], rentAmounts: BigNumber[] );

  4. object.stopRenting( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], rentingIds: BigNumber[] );

  5. object.claimRentOrCollateral( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], rentingIds: BigNumber[] );

Let"s see how sdk format data and some data types

  • Later SDK will use "prepareBatch" methods of SDK"s utils file to convert it into formatted value

  • Let"s see for lend call how SDK converts data into formatted data by using "prepareBatch" method

    lend( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendAmounts: BigNumber[], maxRentDurations: number[], minRentDurations: number[], dailyRentPrices: BigNumber[], paymentOptions: number[], collateralPrices: BigNumber[], allowedRenters: string[][][] ): Promise { const args = prepareBatch({ nftStandards: nftStandards.map(nft => Number(nft)), nftAddresses: nftAddresses.map(nft => String(nft).toLowerCase()), tokenIds: tokenIds.map(id => BigNumber.from(id)), lendAmounts: lendAmounts.map(amt => BigNumber.from(amt)), maxRentDurations: maxRentDurations.map(x => Number(x)), minRentDurations: minRentDurations.map(x => Number(x)), dailyRentPrices: dailyRentPrices.map(value => BigNumber.from(value)), paymentOptions, collateralPrices: collateralPrices.map(value => BigNumber.from(BigNumber.from(value)) ), allowedRenters: allowedRenters, });

    return await this.contract.lend( args.nftStandards, args.nftAddresses, args.tokenIds, args.lendAmounts, args.maxRentDurations, args.minRentDurations, args.dailyRentPrices, args.paymentOptions, args.collateralPrices, args.allowedRenters ); }

Example:

User entred value: dailyRentPrices = 6 WETH , collateralPrices = 20 WETH , and decimal =18

dailyRentPrices = bigNumberToWei(6, 18); // output: 6000000000000000000 collateralPrices = bigNumberToWei(20, 18) // output: 20000000000000000000

dailyRentPrices =bigNumberToEther(6000000000000000000, 18); // output: 6 collateralPrices = bigNumberToEther(20000000000000000000, 18) // output: 20

Note: dailyRentPrices & collateralPrices must be passed to sdk method in WEI according to selected payment token decimal.

Revenue Shared Contract

  1. object.lend( nftStandard: NFTStandard[], nftAddress: string[], tokenId: BigNumber[], lendAmount: BigNumber[], upfrontFee: BigNumber[], maxRentDuration: number[], revenueShareInfo: [string[], number[]][], allowedRenter: string[][][], paymentOption: number[] );

  2. object.rent( nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], rentDurations: number[], rentAmounts: BigNumber[] );

  3. object.stopRenting( nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], rentingIds: BigNumber[] );

  4. object.stopLending( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[] );

  5. object.shareRevenue( nftAddresses: string[], tokenIds: BigNumber[], lendingIds: BigNumber[], revenueAmounts: BigNumber[], renters: string[], revenueTokenAddress: string[] );

Let"s see how sdk format data and some data types

lend( nftStandards: NFTStandard[], nftAddresses: string[], tokenIds: BigNumber[], lendAmounts: BigNumber[], upfrontFees: BigNumber[], maxRentDurations: number[], revenueShareInfos: [string[], number[]][], allowedRenters: string[][][], paymentOptions: number[] ): Promise {

const args = prepareRevenueShareBatch({ nftStandards: nftStandards.map(nft => Number(nft)), nftAddresses: nftAddresses.map(nft => String(nft).toLowerCase()), tokenIds: tokenIds.map(id => BigNumber.from(id)), lendAmounts: lendAmounts.map(amt => BigNumber.from(amt)), upfrontFees: upfrontFees.map(value => BigNumber.from(value)), maxRentDurations: maxRentDurations.map(x => Number(x)), revenueShareInfos, allowedRenters, paymentOptions, });

const tupleFomattedData = args.nftAddresses.map((address, index) => [
  args.nftStandards?.[index],
  address,
  args.tokenIds[index],
  args.lendAmounts?.[index],
  args.upfrontFees?.[index],
  args.maxRentDurations?.[index],
  args.revenueShareInfos?.[index],
  args.allowedRenters?.[index],
  args.paymentOptions?.[index],
]);
return await this.contract.lend(tupleFomattedData);

}

Example:

User entred value: upfrontFees = 6 WETH, decimal =18

upfrontFees = bigNumberToWei(6,18); // output: 6000000000000000000 upfrontFees =bigNumberToEther(6000000000000000000,18); // output: 6

Note: upfrontFees must be passed to the SDK method in WEI according to the selected payment token decimal.

Note: Good to have below validation

  1. the "nftStandards" should be one of the available in "NFTStandard" type of SDK. For instance, NFTStandard.E721 and NFTStandard.E1155
  2. The "maxRentDurations" must be grater than "minRentDurations".
  3. The "paymentOptions" need to pass the index as a number
  4. The "collateralPrices" value should be ZERO for the CollateralFree contract.
  5. The "allowedRenters" should be empty array for allowing all the user to rent.

POLYGON_MAINNET:

CollateralizedContractAddresses: ["0xCf311a6606c909Cc5E048FE1f3FF1e63dEec6a26"], CollateralFreeContractAddresses: ["0x4fF4C17F24d03Faf9d5097D7E71310AeF71a0f70"], RevenueSharedNFTRentalsContractAddresses: ["0x9C5dA47ED0281aF302ED1E77a1B961ed980d5385"], RevenueSharedConfiguratorContractAddresses: ["0x4a1BDD3a5BBAb4312432b1b507d67Bce6baC8B22"], subgraphs: { collateralized: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-collateralized-polygon", collateralFree: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-collateral-free-polygon", revenueSharedNFTRentals: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-revenue-share-polygon", }

POLYGON_TESTNET:

CollateralizedContractAddresses: ["0xDA0b94C237b435cbeA5Dd5aD44cc6F235aaE5855"], CollateralFreeContractAddresses: ["0x8f5138FDe08Be9061612086f4bCA472a563544c4"], RevenueSharedNFTRentalsContractAddresses: ["0x9352a6007F186c11FBC1daBc9fFFFA62Ea9eb9f3"], RevenueSharedConfiguratorContractAddresses: ["0x418258c4412bC13b3C877374BCE70890d456Cc1e"], subgraphs: { collateralized: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-collateralized-mumbai", collateralFree: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-collateral-free-mumbai", revenueSharedNFTRentals: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-revenue-share-mumbai", }

BINANCE_MAINNET:

CollateralizedContractAddresses: ["0x4dA60d2646a8ed5461457012f5cd7b87905E9e55"], CollateralFreeContractAddresses: ["0x858feeb9D751A07aF2D7b5ad7fa996B30261a891"], RevenueSharedNFTRentalsContractAddresses: ["0xEc12AB0306A3bbDa93aACC2BE931F8A8343bCEA3"], RevenueSharedConfiguratorContractAddresses: ["0x8F975d55b8b20D6e53264A4730998C14fE5b8C25"], subgraphs: { collateralized: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-collateralized-bsc", collateralFree: "https://thegraph.com/explorer/subgraph/dudhatparesh/infy-collateral-free-bsc", revenueSharedNFTRentals: "https://api.thegraph.com/subgraphs/name/dudhatparesh/infy-revenue-share-bsc", }