UNPKG

@handcash/handcash-connect

Version:
61 lines (60 loc) 2.52 kB
import HandCashConnectService from '../api/handcash_connect_service'; import { GetItemsFilter, ItemTransferResult, Item, TransferItemParameters } from '../types/items'; export default class Items { handCashConnectService: HandCashConnectService; constructor(handCashConnectService: HandCashConnectService); /** * Get the items available in the user's inventory. * See {@link https://docs.handcash.io/docs/user-inventory} for more information. * * @param {GetItemsFilter} getItemsParameters Defines the parameters to filter items * * @returns {Promise<Item[]>} A promise that resolves with a list of ordinals from the user inventory. */ getItemsInventory(getItemsParameters: GetItemsFilter): Promise<Item[]>; /** * Get the items listed for sale by the user. * See {@link https://docs.handcash.io/docs/user-listings} for more information. * * @param {GetItemsFilter} getItemsParameters Defines the parameters to filter items * * @returns {Promise<Item[]>} A promise that resolves with a list of ordinals listed by the user. */ getItemListings(getItemsParameters: GetItemsFilter): Promise<Item[]>; /** * Transfer one or many items to one or many destinations. * See {@link https://docs.handcash.io/docs/user-listings} for more information. * * @param {GetItemsFilter} params Defines the item origins and destinations * * @returns {Promise<ItemTransferResult>} A promise that resolves with the result of the transfer. */ transfer(params: TransferItemParameters): Promise<ItemTransferResult>; /** * Get Item by origin * @param {string} origin The origin of the item * @returns {Promise<Item>} A promise that resolves with the item. */ getItemByOrigin(origin: string): Promise<Item>; /** * Get all locked items * @returns {Promise<Item[]>} A promise that resolves with the locked items. */ getLockedItems(params: { from?: number; to?: number; fetchAttributes?: boolean; }): Promise<Item[]>; /** * Lock items * @param {string} origin The origin of the item * @returns {Promise<void>} A promise that resolves with the void. */ lockItems(origin: string): Promise<void>; /** * Unlock items * @param {string} origin The origin of the item * @returns {Promise<void>} A promise that resolves with the void. */ unlockItems(origin: string): Promise<void>; }