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

artblocks

v0.1.4

Published

A package for fetching on-chain ArtBlocks data.

Downloads

7

Readme

node-artblocks

npm CircleCI Node.js Package GitHub package.json version

An open source node package for reading on-chain Art Blocks data and recreating generative art projects. By default the package reads data via the ArtBlocks Subgraph. For those using other languages, use this package as a how-to guide for working directly with ArtBlocks on-chain data.

Installation

npm i artblocks

Usage

import ArtBlocks from 'artblocks'

// Ethereum mainnet
let artblocks = new ArtBlocks("thegraph", "mainnet")

// Artist staging projects
// Please refrain from sharing these projects publicly
let artblocks = new ArtBlocks("thegraph", "goerli")

// Flex contracts
let artblocks = new ArtBlocks("thegraph", "goerli", contracts=["<contract_address>"] flex=true)

Methods

Available Projects

const response = artblocks.projects()
Promise {
  [
    { id: 0, name: 'Chromie Squiggle' },
    { id: 1, name: 'Genesis' },
    { id: 2, name: 'Construction Token' },
    { id: 3, name: 'Cryptoblots' },
    { id: 4, name: 'Dynamic Slices' },
    { id: 5, name: 'Variant Plan' },
    { id: 6, name: 'View Card' },
    { id: 7, name: 'Elevated Deconstructions' },
    { id: 8, name: 'Singularity' },
    { id: 9, name: 'Ignition' },
    ...
   ]
}

Project Metadata

const response = artblocks.project_metadata(0)
Promise {
  {
    id: 0,
    name: 'Chromie Squiggle',
    artist: 'Snowfro',
    curation_status: 'curated',
    description: 'Simple and easily identifiable, each squiggle embodies the soul of the Art Blocks platform. Consider each my personal signature as an artist, developer, and tinkerer. Public minting of the Chromie Squiggle is permanently paused. They are now reserved for manual distribution to collectors and community members over a longer period of time. Please visit OpenSea to explore Squiggles available on the secondary market.',
    license: 'NFT License',
    website: 'https://www.twitter.com/artonblockchain',
    paused: true,
    complete: false,
    locked: true,
    currency_symbol: 'ETH',
    price_eth: 0,
    invocations: 9257,
    invocations_max: 10000,
    contract: '0x059edd72cd353df5106d2b9cc5ab83a52287ac3a'
  }
}

Project Script

const response = artblocks.project_script(0)
Promise {
  {
    id: 0,
    name: 'Chromie Squiggle',
    last_updated: '1620363885',
    ependency: 'p5js',
    dependency_version: '1.0.0',
    dependency_url: '"https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"',
    interactive: 'true',
    animation_length_sec: undefined,
    instructions: 'click to animate | space bar changes background color',
    script: 'let numHashes = tokenData.hashes.length;\n' +
      'let hashPairs = [];\n' +
      'for (let i = 0; i < numHashes; i++) {\n' +
      '     for (let j = 0; j < 32; j++) {\n' +
      '          hashPairs.push(tokenData.hashes[i].slice(2 + (j * 2), 4 + (j * 2)));\n' +
      '     }\n' +
      '}\n' +
      ...
  }
}

Token Metadata

const response = artblocks.token_metadata(0)
Promise {
  {
    project_id: 0,
    project_name: 'Chromie Squiggle',
    token_id: 0,
    token_invocation: 0,
    token_hash: '0x722899b10c66da3b72fb60a8e71df442ee1c004547ba2227d76bed357469b4ea'
  }
}

Token Script

const response = artblocks.token_script(0)
Promise {
  {
    token_id: 0,
    token_invocation: 0,
    token_dependencies: {
      dependency: 'p5js',
      dependency_version: '1.0.0',
      dependency_url: '"https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"'
    },
    token_data: 'let tokenData = {"hashes":["0x722899b10c66da3b72fb60a8e71df442ee1c004547ba2227d76bed357469b4ea"], "tokenId":"0"}',
    token_script: 'let numHashes = tokenData.hashes.length;\n' +
      'let hashPairs = [];\n' +
      'for (let i = 0; i < numHashes; i++) {\n' +
      '     for (let j = 0; j < 32; j++) {\n' +
      '          hashPairs.push(tokenData.hashes[i].slice(2 + (j * 2), 4 + (j * 2)));\n' +
      '     }\n' +
      '}\n' +
      ...
  }
}

Token Generator

const response = artblocks.token_generator(0)
Promise {
  '<!DOCTYPE HTML>\n' +
    '<html lang="en">\n' +
    '  <head>\n' +
    '    <meta charset="utf-8">\n' +
    '    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"></script>\n' +
    '    <script>let tokenData = {"hashes":["0x722899b10c66da3b72fb60a8e71df442ee1c004547ba2227d76bed357469b4ea"], "tokenId":"0"}</script>\n' +
    '    <script>let numHashes = tokenData.hashes.length;\n' +
    'let hashPairs = [];\n' +
    'for (let i = 0; i < numHashes; i++) {\n' +
    '     for (let j = 0; j < 32; j++) {\n' +
    '          hashPairs.push(tokenData.hashes[i].slice(2 + (j * 2), 4 + (j * 2)));\n' +
    '     }\n' +
    '}\n' +
    ...
}

Custom Queries

let x = `
{
  projects(
    first: 5,
    orderBy: projectId, 
    orderDirection: desc, 
    where: {curationStatus: "curated"}
  ) 
  {         
    projectId
    name
    artistName
    curationStatus
  }
}
`
const response = artblocks.custom(x)
Promise {
  projects: [
    {
      projectId: '225',
      name: 'Vortex',
      artistName: 'Jen Stark',
      curationStatus: 'curated'
    },
    {
      projectId: '215',
      name: 'Gazers',
      artistName: 'Matt Kane',
      curationStatus: 'curated'
    },
    ...
  ]
}