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

@ashkuc/solidity-interfaces

v0.64.0

Published

Solidity smart contracts and ethers.js/web3 wrappings for Unique network technologies

Downloads

101

Readme

Unique Solidity interfaces

Usage

import {ethers} from 'ethers'
import {Address} from '@unique-nft/utils'
import {
  CollectionHelpersFactory,
  UniqueNFTFactory,
} from '@unique-nft/solidity-interfaces'

const provider = new ethers.providers.JsonRpcProvider('https://rpc-opal.unique.network')
const wallet = new ethers.Wallet('<Private key>', provider)

// or, with browser extension:
// const provider = new ethers.providers.Web3Provider(window.ethereum)
// const wallet = provider.getSigner()

const collectionHelpers = await CollectionHelpersFactory(wallet, ethers) // ethers parameter is optional
//when ethers not provided, it's been asynchronously loaded on demand to reduce package size and TTFP

const txCreateCollection = await (await collectionHelpers.createNFTCollection(
  'My Collection', // collection name
  'Fancy collection description', // collection description
  'MYCL', // token prefix - short, up to 4 letters string
  {value: await collectionHelpers.collectionCreationFee()}
)).wait()

const collectionAddress = txCreateCollection.events?.[0].args?.collectionId as string

// make collection ERC721Metadata compatible, to create necessary properties and activate
// corresponding supportsInterface and enable mintWithTokenURI and tokenURI methods 
//
// Actually it's optional but if we want to make it compatible with 
// common ethereum-world NFT collections, it's better to enable this compatibility.
// anyway, it just improves the collection and doesn't brake or mangle anything. 
const txMakeCompatible = await (await collectionHelpers.makeCollectionERC721MetadataCompatible(
  collectionAddress,
  '' // baseURI
)).wait()
console.log(`Collection #${collectionId} (address ${collectionAddress}) is now ERC721Compatible`)

const collection = await UniqueNFTFactory(collectionAddress, wallet, ethers)

const txMintToken = await (await collection.mintWithTokenURI(
  wallet.address,
  'ipfs://QmZ8Syn28bEhZJKYeZCxUTM5Ut74ccKKDbQCqk5AuYsEnp'
)).wait()

// this .toNumber() type casting is safe because tokenId upper boundary is 2**32
const tokenId = txMintToken.events?.[0].args?.tokenId.toNumber()
const tokenUri = await collection.tokenURI(tokenId)

console.log(`Successfully minted token #${tokenId}, it's URI is: ${tokenUri}`)

Exports

Solidity interfaces and smart contracts and ABI:

import {...} from '@unique-nft/solidity-interfaces/contracts'

import {...} from '@unique-nft/solidity-interfaces/abi'

Unique interfaces and smart contracts solidity sources:

  • CollectionHelpers.sol / .json
  • ContractHelpers.sol / .json
  • UniqueFungible.sol / .json
  • UniqueNFT.sol / .json
  • UniqueRefungible.sol / .json
  • UniqueRefungibleToken.sol / .json

Ethers ready-to-use factories and typescript types

import {
  CollectionHelpers__factory,
  ContractHelpers__factory,
  UniqueFungible__factory,
  UniqueNFT__factory,
  UniqueRefungible__factory,
  UniqueRefungibleToken__factory,
  //typescript types:
  CollectionHelpers,
  ContractHelpers,
  UniqueNFT,
  UniqueFungible,
  UniqueRefungible,
  UniqueRefungibleToken,
} from '@unique-nft/solidity-interfaces/ethers'

Web3.js typescript types

import {
  CollectionHelpers,
  ContractHelpers,
  UniqueNFT,
  UniqueFungible,
  UniqueRefungible,
  UniqueRefungibleToken,
} from '@unique-nft/solidity-interfaces/web3'

note: it requires web3.js installed on your own, web3.js is a peer dependency for this project

Static addresses for Helpers interfaces:

|Interface|Address| |---|---| |collectionHelpers|0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F| |contractHelpers|0x842899ECF380553E8a4de75bF534cdf6fBF64049|

import {constants} from '@unique-nft/solidity-interfaces'

console.log(constants.STATIC_ADDRESSES.collectionHelpers)
console.log(constants.STATIC_ADDRESSES.contractHelpers)