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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@renft/sdk

v7.0.3

Published

**ReNFT** is a multi-chain highly gas-optimised NFT rental protocol and platform that can be whitelabel integrated into any project to enable collateral-free in-house renting, lending, and reward share (scholarship automation).

Downloads

402

Readme

ReNFT is a multi-chain highly gas-optimised NFT rental protocol and platform that can be whitelabel integrated into any project to enable collateral-free in-house renting, lending, and reward share (scholarship automation).

Install

yarn add @renft/sdk

Usage

Our SDK comes in two flavors. One tuned to use with ethers and one tuned to use with viem.

The below is a simple example of lending an ERC721, note that the amount is ignored, you will always lend 1 unit of ERC721 token.

If you are having any issues with the below code, go here and ensure your dependencies for ethersproject are the same as ours (in package.json).

You might be wondering what 'AZRAEL' refers to in the below import. If so, go to our docs here. Azrael, Sylvester and Whoopi are our naming conventions to refer to different flavors of our contracts.

@renft/sdk/viem

import {
  AzraelV0SDK,
  DEPLOYMENT_AZRAEL_ETHEREUM_MAINNET_V0,
  PaymentToken,
} from '@renft/sdk';
import { createPublicClient, createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { mainnet } from 'viem/chains';

const account = privateKeyToAccount(/* private key */);
const publicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
});
const walletClient = createWalletClient({
  chain: mainnet,
  transport: http(),
});

const sdk = new AzraelV0SDK({
  account,
  deployment: DEPLOYMENT_AZRAEL_ETHEREUM_MAINNET_V0,
  publicClient,
  walletClient,
});

const nftAddress = ['0xCDf60B46Fa88e74DE7e1e613325E386BFe8609ad'];
const tokenId = ['3'];
const lendAmount = [1]; // for ERC721, this is ignored
const maxRentDuration = [1]; // in days (can be returned earlier)
const dailyRentPrice = [1.1]; // this will automatically scale
const nftPrice = [2.2]; // this will automatically scale
const paymentToken = [PaymentToken.WETH];

const lend = async () => {
  const txnHash = await sdk.lend(
    nftAddress,
    tokenId,
    lendAmount,
    maxRentDuration,
    dailyRentPrice,
    nftPrice,
    paymentToken
  );

  return txnHash;
};

lend()
  .then(console.log)
  .catch(console.error);

@renft/sdk/ethers

import { JsonRpcProvider } from '@ethersproject/providers';
import { Wallet } from '@ethersproject/wallet';
import {
  DEPLOYMENT_AZRAEL_ETHEREUM_MAINNET_V0,
  PaymentToken,
} from '@renft/sdk/core';
import { getRenftContract } from '@renft/sdk/ethers';

// const walletMnemonic = Wallet.fromMnemonic(`<your mnemonic>`);
const provider = new JsonRpcProvider('<your provider uri>');
const privKey = '<privateKey>';
let wallet = new Wallet(privKey);
wallet = wallet.connect(provider);

const main = async () => {
  const renft = getRenftContract({
    deployment: DEPLOYMENT_AZRAEL_ETHEREUM_MAINNET_V0,
    signer: wallet,
  });

  const nftAddress = ['0xCDf60B46Fa88e74DE7e1e613325E386BFe8609ad'];
  const tokenId = ['3'];
  const lendAmount = [1]; // for ERC721, this is ignored
  const maxRentDuration = [1]; // in days (can be returned earlier)
  const dailyRentPrice = [1.1]; // this will automatically scale
  const nftPrice = [2.2]; // this will automatically scale
  const paymentToken = [PaymentToken.WETH];

  const txn = await renft.lend(
    nftAddress,
    tokenId,
    lendAmount,
    maxRentDuration,
    dailyRentPrice,
    nftPrice,
    paymentToken
  );

  const receipt = await txn.wait();
  return receipt;
};

main()
  .then(receipt => {
    console.log(receipt);
  })
  .catch(e => {
    console.warn(e);
  });

For more usage examples, see test and examples folders on our github repo.

Please, also take the time to familiarise yourself with our docs.

Deploying New SDK versions

Make sure the CHANGELOG.md is updated accordingly!

Create a utility shell scripts for deploys locally like the one below:

#!/bin/bash
set -e
yarn build
yarn publish

make sure to make it executable:

chmod +x deploy.sh