svgnft

0.1.1 • Public • Published

svgnft

A helper library for generating fully on-chain NFTs (ERC721) on Ethereum.

Being on-chain is fun!

Example

See example/. Override tokenUri with something like:

  function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
    string memory name = string(abi.encodePacked("MyToken #", tokenId.toString()));
    string memory description = "An example SVG-based, fully on-chain NFT";
    string memory svg = '<svg viewBox="0 0 1000 1000"><circle cx={500} cy={500} r={400} fill="papayawhip" /></svg>';

    return SVG721.svgMetadata(name, description, svg);
  }

That's it!

Install

Using hardhat.

npm install --save-dev svgnft
# or
yarn add --dev svgnft

In your contract

import "../contracts/SVG721.sol";

License

MIT

Base64.sol by Brecht Devos.

Dependencies (0)

    Dev Dependencies (9)

    Package Sidebar

    Install

    npm i svgnft

    Weekly Downloads

    0

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    3.77 kB

    Total Files

    6

    Last publish

    Collaborators

    • mikker