Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IItems

Hierarchy

  • IItems

Index

Properties

buy

buy: function

Type declaration

    • (itemId: string, price: Price, amount: number, seed: string): Intent<IOrder>
    • Parameters

      • itemId: string
      • price: Price
      • amount: number
      • seed: string

      Returns Intent<IOrder>

cancel

cancel: function

Type declaration

changeAmount

changeAmount: function

Changes created item amount in case it was not previously freezed.

Usage

const { Items } = require('@waves/waves-games')
const { changeAmount } = Items(ChainId.Testnet)

const items = Items(ChainId.Testnet)
const intent = changeAmount('itemId', 200, false, 'creatorSeed')
await intent.execute()

Type declaration

    • (itemId: string, by: number, freeze: boolean, seed: string): Intent<boolean>
    • Parameters

      • itemId: string
      • by: number
      • freeze: boolean
      • seed: string

      Returns Intent<boolean>

create

create: function

Creates an item.

Usage

const { Items } = require('@waves/waves-games')
const { create } = Items(ChainId.Testnet)

const items = Items(ChainId.Testnet)
const intent = create(100, true, { version: 1, main: { name: 'The sword of pain', img: 'img_url' }, misc: {} }, 'creatorSeed')
const item = await intent.execute()

Type declaration

getItem

getItem: function

Returns an item info from the blockchain.

Usage

const { Items } = require('@waves/waves-games')
const { getItem } = Items(ChainId.Testnet)

getItem(itemId).then(item => {
   console.log(item)
})

Type declaration

    • (id: string, includeDistribution: boolean): Promise<Item>
    • Parameters

      • id: string
      • includeDistribution: boolean

      Returns Promise<Item>

getItemList

getItemList: function

Returns an item list issued by particular game creator.

Usage

const { Items } = require('@waves/waves-games')
const { getItemList } = Items(ChainId.Testnet)

getItemList('creatorAddress').then(items => {
   console.log(items)
})

Type declaration

    • (creatorAddress: string): Promise<Item[]>
    • Parameters

      • creatorAddress: string

      Returns Promise<Item[]>

sell

sell: function

Changes created item amount in case it was not previously freezed.

Usage

const { Items } = require('@waves/waves-games')
const { sell } = Items(ChainId.Testnet)

const items = Items(ChainId.Testnet)
const intent = sell('itemId', waves(2.0), 1, 'sellerSeed')
const order = await intent.execute()

Type declaration

    • (itemId: string, price: Price, amount: number, seed: string): Intent<IOrder>
    • Parameters

      • itemId: string
      • price: Price
      • amount: number
      • seed: string

      Returns Intent<IOrder>

Methods

getItemSuply

  • getItemSuply(itemId: string, currency: Currency): Promise<Record<number, number>>
  • Returns an item available on market.

    Usage

    const { Items } = require('@waves/waves-games')
    const { getItemSuply } = Items(ChainId.Testnet)
    
    //getting all orders for sale for BTC
    getItemSuply('itemId', 'BTC').then(items => {
       console.log(items)
    })
    

    Parameters

    Returns Promise<Record<number, number>>

Generated using TypeDoc