Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nftvillage/marketplace-sdk

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nftvillage/marketplace-sdk

Marketplace Hooks and functions to interect with Nft Village.

  • 0.1.40
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

@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[]
}

FAQs

Package last updated on 25 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc