@areatechnology/shields-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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);

Readme

Keywords

none

Package Sidebar

Install

npm i @areatechnology/shields-api

Weekly Downloads

3

Version

0.1.0

License

none

Unpacked Size

96.1 kB

Total Files

19

Last publish

Collaborators

  • shahruz
  • jcpalmer