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

deployless-view

v1.1.1

Published

* package name: deployless-view * build: `yarn build`

Downloads

518

Readme

deployless-view

  • package name: deployless-view
  • build: yarn build

Install

npm i deployless-view

Usage

batchGetAllTokensByOwner

Specific use case for multicall.

The method batchGetAllTokensByOwner is just a wrapper for method multicall which calls DeploylessNFTViewer with easy interface.

nftType

1: ERC721Enumerable

2: CryptoPunks

3: ERC721 without ERC721Enumerable(rare case)

const { DeploylessViewerClient } = require('deployless-view')
const { ethers } = require("ethers");

const rpc = "https://mainnet.infura.io/v3/<YOUR_API_KEY>"

async function main () {
  const provider = new ethers.providers.JsonRpcProvider(rpc);
  let d = new DeploylessViewerClient(provider)
  let ret = await d.batchGetAllTokensByOwner('0x7a9fe22691c811ea339d9b73150e6911a5343dca', [
    {
      nftType: 2,
      nft: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb'
    }, {
      nftType: 1,
      nft: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'
    }])
  console.log(`ret:`, ret)
}

main()

getTokensByOwnerInRange

Get the id owned by the user in the specified token id range.

const { DeploylessViewerClient } = require('deployless-view')
const { ethers } = require("ethers");

const rpc = "https://mainnet.infura.io/v3/<YOUR_API_KEY>"

async function main () {
  const provider = new ethers.providers.JsonRpcProvider(rpc);
  let d = new DeploylessViewerClient(provider)
  let ret = await d.getTokensByOwnerInRange(
    '0x7a9fe22691c811ea339d9b73150e6911a5343dca',   // owner
    "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb",   // nft address
    2,                                              // nftType
    1000,                                           // start id
    2000                                            // count or step (excluded)
  )
  console.log(`ret:`, ret)
}

main()

getAllTokensByOwner

const { DeploylessViewerClient } = require('deployless-view')
const { ethers } = require("ethers");

const rpc = "https://mainnet.infura.io/v3/<YOUR_API_KEY>"

async function main () {
  const provider = new ethers.providers.JsonRpcProvider(rpc);
  let d = new DeploylessViewerClient(provider)
  let ret = await d.getAllTokensByOwner(
    '0x7a9fe22691c811ea339d9b73150e6911a5343dca',   // owner
    "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb",   // nft address
    2,                                              // nftType
    2000                                            // step
  )
  console.log(`ret:`, ret)
}

main()

getUserTimeLocks

const { DeploylessViewerClient } = require('deployless-view')
const { ethers } = require("ethers");

const rpc = "https://mainnet.infura.io/v3/<YOUR_API_KEY>"

async function main () {
  const provider = new ethers.providers.JsonRpcProvider(rpc);
  let d = new DeploylessViewerClient(provider)
  let ret = await d.getUserTimeLocks(
    'timelock address',   // timelock contract address
    "user address",       // user address
    50,                   // The maximum number of requests in a single request. default and max:50
    2000                  // The minimum timelock agreement start id
  )
  console.log(`ret:`, ret)
}

main()

multicall

Accept an array of calls and call them all at once.

If 0x0 is passed as address to call, DeploylessNFTViewer will be called instead.

const {
  DeploylessViewerClient,
  NFTEnumerable__factory,
} = require('deployless-view')
const { ethers } = require('ethers')

const rpc = 'https://mainnet.infura.io/v3/af88d7776e3f4e1888ac935b9b16effd'

async function main () {
  const provider = new ethers.providers.JsonRpcProvider(rpc)
  let d = new DeploylessViewerClient(provider)
  let ret = await d.multicall([
    {
      target: ethers.constants.AddressZero,
      callData: d.deploylessNFTViewer.interface.encodeFunctionData('batchGetAllTokensByOwner', [
        '0x7a9fe22691c811ea339d9b73150e6911a5343dca', [
          {
            nftType: 2,
            nft: '0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb',
          }, {
            nftType: 1,
            nft: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
          }]]),
    },
    {
      target: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
      callData: NFTEnumerable__factory.createInterface()
        .encodeFunctionData('tokenURI', [999]),
    },
  ])
  let { blockNumber, resultsArray: [ret1, ret2] } = ret
  let ret1Value = d.deploylessNFTViewer.interface.decodeFunctionResult('batchGetAllTokensByOwner', ret1)
  let ret2Value = NFTEnumerable__factory.createInterface()
    .decodeFunctionResult('tokenURI', ret2)
  console.log(`ret1Value:`, ret1Value)
  console.log(`ret2Value:`, ret2Value)
}

main()