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

droplabmods

v0.1.32

Published

Collection of bits that DropLab use on the reg

Downloads

6

Readme

    ────────╔═══╗───────╔╗───╔╗
    ────────╚╗╔╗║───────║║───║║
    ─────────║║║╠═╦══╦══╣║╔══╣╚═╗
    ─────────║║║║╔╣╔╗║╔╗║║║╔╗║╔╗║
            ╔╝╚╝║║║╚╝║╚╝║╚╣╔╗║╚╝║
            ╚═══╩╝╚══╣╔═╩═╩╝╚╩══╝
    ─────────────────║║   www.thedroplab.com
    ─────────────────╚╝   droplab.eth

DropLab Mods

Selection of components, contracts and scripts to make life easy

  • onChain contracts & deplyment
  • general JS utility scripts
  • ethereum interaction helpers
  • website generic components, helpers and APIs

npm GitHub top language

Installing

#  node.js
npm install droplabmods

#   Then use
#   javascript
import {...} from 'droplabmods';
#   solidity
import 'droplabmods/onChain/contracts/[file/folder...]

Dependencies

  • ethers
  • erc721a
  • @openzepplin/contracts
  • typescript
  • keccak256
  • merkletree.js
  • dotenv

onChain

Deployment

#  Start new deployment from scratch:
truffle migrate --network {network} --reset
#  Continue migration from last deployment:
truffle migrate --network {network}

Replace {network} with network name ie rinkeby

  • Available Networks:
  • homestead ID:1 (Ethereum Mainnet)
  • rinkeby ID:4 (Ethereum testNetwork)
  • kovan ID:42 (Ethereum testNetwork)
  • local ID: 420 (Ethereum localNetwork)
  • polygon ID: 137 (Polygon Mainnet)
  • mumbai ID: 80001 (Polygon testNetwork)

Deployer Wallet: [ethereum address] Deployed On: Rinkeby Test Network (ID: 4)

ABI's are available from import build from './build/contracts/[contractName].json' use the ABI with build.abi

contracts/ERC721/ERC721A-Model.sol

 //Using
import "contracts/ERC721/ERC721A-Model.sol"

//Constructure
ERC721AModel(_startingID, BaseURI)
      
// A contract to sit ontop ERC721A deployments to allow easier modification and managment for tokenURIs
// Also adding a var for startingId.  Meaning no editing of the `erc721a` contract is needed.
//  Hold the base URI
string private BaseURI_;
//  Hold the starting token ID
uint256 private startingID_;
        /**
     *  @dev    Overrights the base function in ERC721A
     */
    function _startTokenId() internal view override returns (uint256) {
        return startingID_;
    }

    /**
     * @dev Base URI for computing {tokenURI}. Overrights the base function in ERC721A
     */
    function _baseURI()
        internal
        view
        override
        returns (string memory)
    {
        return BaseURI_;
    }

    function _setBaseURI(string memory _BaseURI) internal {
        BaseURI_ = _BaseURI;
    }

    /**
     * @dev Returns URI with json extention
     */
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721A)
        returns (string memory)
    {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length != 0
                ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json"))
                : "";
    }
        

contracts/ERC721/spesific_functions/prereviealURI.sol

 //Using
import "contracts/ERC721/spesific_functions/prereviealURI.sol"
      
// Used to triggar URI reveal onchain
 bool public URI_REVEALED = false;
    string private preURI_;

    /**
     * @dev     -   See {IERC721Metadata-tokenURI}
     * @notice  -   Retuns the token metadata URL.  If imageReveald_ == false
     *              it will return the holding URL
     * @param -tokenId {uint256}
     */
    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {

        return
            URI_REVEALED
                ? super.tokenURI(_tokenId)
                : preURI_;
    }

    

    function setPreURI(string memory _newURI)public onlyOwner {
            preURI_ = _newURI;
    }        

File Structure

.
├── README.md
├── index.js
├── isThisWorking.js
├── bin
│   ├── ABIs
│       └── [contractType]-ABI.js
│   └── index.js
├── onChain
│   ├── index.js
│   ├── contracts
│       ├── collectionWrapping
│       ├── ERC20
│       ├── ERC721
│       ├── ERC1155
│       ├── govenance
│       ├── migrations
│       ├── motherContracts
│       ├── sales
│       ├── staking
│       └── utilities
│   └── migrations
├── scripts
│   ├── index.js
│   ├── web3
│   └── helpers
├── types
│   └── index.js
├── web
│   ├── index.js
│   ├── API
│   ├── components
│   ├── helpers
│       └── API
│           └── ethereum
│               ├── contractInteraction
│               ├── getters
│               └── helpers
│   └── hooks