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

@nftvillage/marketplace-sdk

v0.1.40

Published

Marketplace Hooks and functions to interect with Nft Village.

Downloads

149

Readme

@nftvillage/marketplace-sdk

Marketplace Hooks and functions to interect with Nft Village.

Dependencies

"@react-dapp/utils": "^0.0.20",
"bignumber.js": "^9.0.1",
"ethereum-multicall": "^2.9.0",
"ethers": "^5.5.1",
"react": "^17.0.2",

Collection Hooks

useCreateCollection

  • createCollection this hook takes collection data,interface of collection data
  • Useage this hook is used to create the user collection
CollectionData {
  name?: string
  description?: string
  symbol?: string
  shortUrl?: string
  coverImage?:string
  logoImage?:string
  royalty?: number
  isVerified?: boolean
}
  • Return values this hook returns Api response interface where T is the collection interface
ApiResponse<T> {
 status: boolean
 message: string
 data?: T
}
Collection {
 userAddress: string
 isVerified?: boolean
 address: string
 name?: string
 description?: string
 symbol?: string
 shortUrl?: string
 coverImage?:string
 logoImage?:string
 royalty?: number
 collectionStandard:AssetType
}

useCollectionByShortURL

  • fetchCollection this hook takes shortUrl as string.
shortUrl: string
  • Return values this hook returns collection interface and loading State
Collection {
 userAddress: string
 isVerified?: boolean
 address: string
 name?: string
 description?: string
 symbol?: string
 shortUrl?: string
 coverImage?:string
 logoImage?:string
 royalty?: number
 collectionStandard:AssetType
},
loading:boolean

useCollectionByCollectionAddress

  • fetchCollectionAddress this hook takes collection address as string.
address: string
  • Return values this hook returns collection interface and loading State
Collection {
 userAddress: string
 isVerified?: boolean
 address: string
 name?: string
 description?: string
 symbol?: string
 shortUrl?: string
 coverImage?:string
 logoImage?:string
 royalty?: number
 collectionStandard:AssetType
},
loading:boolean

useAllCollectionsByUserAddress

  • fetchAllCollectionOfUser this hook takes User address as string.
address: string
  • Return values this hook returns Array of collection interface and loading State
[
Collection{
 userAddress: string
 isVerified?: boolean
 address: string
 name?: string
 description?: string
 symbol?: string
 shortUrl?: string
 coverImage?:string
 logoImage?:string
 royalty?: number
 collectionStandard:AssetType
},
],
loading:boolean

useCheckShortUrlAvailability

  • _checkShortUrlAvailability this hook takes User shortUrl as string.
shortUrl: string
  • Return values this hook returns Boolean isURLAvailable and loading State

Token Hooks

useMintERC721

  • mintToken

this hook takes Token interface.

Token {
  address: string
  metadata: MetaData
  fees: Fee[] | []
  minter: string
  owner: string
}

type Fee = {
  recipient: string
  value: number
}
  • Return values this hook returns Api response and tokenId as number where T is the token interface
ApiResponse<T> {
 status: boolean
 message: string
 data?: T
}
Token {
 address: string
 tokenId?: number
 metadata: MetaData
 fees: Fee[] | []
 minter: string
 owner: string
}
tokenId:number

Order Hooks

useSellOrder

this takes asset(it's a collection address) as string

  • create this hook takes Order interface
Order {
  order: OrderData
  metadata: {
    attributes: Attributes[] | []
    image?: string
    background_color?: string
    external_url?: string
    animation_url?: string
    youtube_url?: string
    category?: string
    name?: string
    description?: string
    address: string
    tokenId: number
    collectionName: string
    makerAddress: string
    price: number
  }
}

OrderData  {
      assetId:number,
      assetType:AssetType,
      assetAmount?:number,
      maker:string,
      paymentToken?:string,
      expirationTime?:number,
      basePrice:number,
    }

Attributes = {
  trait_type: string
  value: string | number
  display_type?: string
}

enum AssetType {
  ERC721,
  ERC1155,
}
enum SaleKind {
  BUYNOW = 0,
  ENGLISHAUCTION = 1,
  DUTCHAUCTION = 2,
}
  • Return values this hook returns Api response interface where T is the Order interface
ApiResponse<T> {
 status: boolean
 message: string
 data?: T
}
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}

useCancelOrder

  • cancel this hook takes Order interface
 Order {
  order: OrderData
  orderHash?: string
  referrer?: string
  status?: StatusType
  expirationTime?: number
  signature?: string
  metadata: {
    attributes: Attributes[] | []
    image?: string
    background_color?: string
    external_url?: string
    animation_url?: string
    youtube_url?: string
    category?: string
    name?: string
    description?: string
    address: string
    tokenId: number
    collectionName: string
    makerAddress: string
    price: number
  }
  bids?: Bids[] | []
}
  • Return values this hook returns Delete interface
Delete{
 message:string,
 status:boolean
}

useOrderBid

  • createBidOrder this hook takes Order interface
Order {
  order: OrderData
  metadata: {
    attributes: Attributes[] | []
    image?: string
    background_color?: string
    external_url?: string
    animation_url?: string
    youtube_url?: string
    category?: string
    name?: string
    description?: string
    address: string
    tokenId: number
    collectionName: string
    makerAddress: string
    price: number
  }
}

OrderData {
      asset,
      assetId,
      maker,
      paymentToken,
      side,
      taker,
      expirationTime,
      basePrice
    }

Attributes = {
  trait_type: string
  value: string | number
  display_type?: string
}
OrderSide {
  BUY,
  SELL,
}
SaleKind {
  BUYNOW = 0,
  ENGLISHAUCTION = 1,
  DUTCHAUCTION = 2,
}
  • Return values this hook returns Api response interface where T is the Order interface
ApiResponse<T> {
 status: boolean
 message: string
 data?: T
}
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}

useBuyFixPriceOrder

  • buyFixOrder this hook takes asset: string, assetId: number, maker: string where maker is the buyer of the order

  • approve no params

  • Return values this hook returns txResponse interface

{
   tx: any;
   receipt: any;
   error: any;
   status: boolean;
}

isApproved:boolean

useBuyOrder

  • buy

this hook takes two Orders interface buyOrder , sellOrder

Order {
  order: OrderData
  orderHash?: string
  referrer?: string
  status?: StatusType
  expirationTime?: number
  signature?: string
  metadata: {
    attributes: Attributes[] | []
    image?: string
    background_color?: string
    external_url?: string
    animation_url?: string
    youtube_url?: string
    category?: string
    name?: string
    description?: string
    address: string
    tokenId: number
    collectionName: string
    makerAddress: string
    price: number
  }
  bids?: Bids[] | []
}
  • Return values this hook returns txResponse interface
{
   tx: any;
   receipt: any;
   error: any;
   status: boolean;
}

useOrder

  • singleOrder this hook takes orderAsset
OrderAsset {
  asset: string
  assetId: number
}
  • Return values this hook returns Order and loading as boolean
Order {
  order: OrderData
  orderHash?: string
  referrer?: string
  status?: StatusType
  expirationTime?: number
  signature?: string
  metadata: {
    attributes: Attributes[] | []
    image?: string
    background_color?: string
    external_url?: string
    animation_url?: string
    youtube_url?: string
    category?: string
    name?: string
    description?: string
    address: string
    tokenId: number
    collectionName: string
    makerAddress: string
    price: number
  }
  bids?: Bids[] | []
}

loading:boolean

useOrders

  • fetchOrders this hook takes
saleKind: SaleKind, 
page: number, 
limit: number, 
status: StatusType
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

useOrdersOfCollection

  • fetchOrdersForCollection this hook takes
address: string, 
saleKind: SaleKind
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

useAllListedOrdersForAddress

  • fetchOrdersForAddress

this hooks takes

userAddress: string
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

useOrderHistory

  • fetchOrderHistory

this hooks takes

orderData: OrderAsset, 
page: number, 
limit: number
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

useSpecificOrders

  • fetchSpecificOrders this hook takes specificOrderData interface key is the collection address number array is tokeIds
SpecificOrderData {
  [key: string]: number[]
}
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

Search hooks

useFilterMarketPlace

-filterMarketPlace this hooks takes FilterMarketPlace interface

FilterMarketPlace {
  address?: string
  makerAddress?: string
  name?: string
  collectionName?: string
  category?: string
  minPrice?: number
  maxPrice?: number
  sortBy?: SortBy
}

SortBy = {
  LATEST?: string
  OLDEST?: string
  PRICE_LOW_TO_HIGH?: string
  PRICE_HIGH_TO_LOW?: string
}
  • Return values this hook returns Array of Order and loading as boolean
[
Order {
 order: OrderData
 orderHash?: string
 referrer?: string
 status?: StatusType
 expirationTime?: number
 signature?: string
 metadata: {
   attributes: Attributes[] | []
   image?: string
   background_color?: string
   external_url?: string
   animation_url?: string
   youtube_url?: string
   category?: string
   name?: string
   description?: string
   address: string
   tokenId: number
   collectionName: string
   makerAddress: string
   price: number
 }
 bids?: Bids[] | []
}
],
loading:boolean

useSearchMarketPlace

  • searchMarketPlace

this hooks takes

 query: string
  • Return values this hook returns SearchMarketPlace and loading as boolean

SearchMarketPlace {
 names: string[]
 collectionNames: string[]
}