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

@areatechnology/shields-api

v0.1.0

Published

The Shields API contract makes it simple to work with the Shields design system on-chain.

Downloads

15

Readme

Shields API

The Shields API contract makes it simple to work with the Shields design system on-chain.

Installation

To install with Foundry:

forge install areatechnology/shields-api

To install with Hardhat or Truffle:

npm install @areatechnology/shields-api

Usage

Import the ShieldsAPIConsumer contract and inherit it to access ShieldsAPI and all its methods.


import "@areatechnology/shields-api/contracts/ShieldsAPIConsumer.sol";

contract MyContract is ShieldsAPIConsumer {

  function myFunction() public {
    // Any methods in the ShieldsAPI contract can be accessed this way
    string memory svg = ShieldsAPI.getShieldSVG(1);
  }

}

Shields

getShield(uint256 shieldId)

Returns complete information about a Shield in the Shields collection.

function getShield(uint256 shieldId) external view returns (IShields.Shield memory);

getShieldSVG(uint256 shieldId)

Returns an svg string for a Shield in the Shields collection. If unbuilt, the SVG will be of a Shield Badge.

function getShieldSVG(uint256 shieldId) external view returns (string memory);

getShieldSVG(uint16 field, uint24[4] memory colors, uint16 hardware, uint16 frame)

Returns an svg string for a Shield with the specified configuration.

function getShieldSVG(uint16 field, uint24[4] memory colors, uint16 hardware, uint16 frame) external view returns (string memory);

getShieldSVG(uint16 field, uint24[4] memory colors, uint16 hardware, uint16 frame)

Returns an svg string for a Shield with the specified configuration.

function getShieldSVG(uint16 field, uint24[4] memory colors, uint16 hardware, uint16 frame) external view returns (string memory);

isShieldBuilt(uint256 shieldId)

Returns true if the Shield with the specified id has been built in the Shields collection.

function isShieldBuilt(uint256 shieldId) external view returns (bool);

Fields

getField(uint16 field, uint24[4] memory colors)

Returns complete information about a Field.

function getField(uint16 field, uint24[4] memory colors) external view returns (IFieldGenerator.FieldData memory);

getFieldTitle(uint16 field, uint24[4] memory colors)

Returns the title for a Field.

function getFieldTitle(uint16 field, uint24[4] memory colors) external view returns (string memory);

getFieldSVG(uint16 field, uint24[4] memory colors)

Returns an svg string for a Field with the specified id and colors.

function getFieldSVG(uint16 field, uint24[4] memory colors) external view returns (string memory);

Hardware

getHardware(uint16 hardware)

Returns complete information about a Hardware.

function getHardware(uint16 hardware) external view returns (IHardwareGenerator.HardwareData memory);

getHardwareTitle(uint16 hardware)

Returns the title for a Hardware.

function getHardwareTitle(uint16 hardware) external view returns (string memory);

getHardwareSVG(uint16 hardware)

Returns an svg string for a Hardware with the specified id.

function getHardwareSVG(uint16 hardware) external view returns (string memory);

Frames

getFrame(uint16 frame)

Returns complete information about a Frame.

function getFrame(uint16 frame) external view returns (IFrameGenerator.FrameData memory);

getFrameTitle(uint16 frame)

Returns the title for a Frame.

function getFrameTitle(uint16 frame) external view returns (string memory);

getFrameSVG(uint16 frame)

Returns an svg string for a Frame with the specified id.

function getFrameSVG(uint16 frame) external view returns (string memory);