Constructors

  • Creates a new instance of the DataNftMarket which can be used to interact with the marketplace smart contract

    Parameters

    • env: string

      'devnet' | 'mainnet' | 'testnet'

    • timeout: number = 10000

      Timeout for the network provider (DEFAULT = 10000ms)

    Returns DataNftMarket

Properties

chainID: string
contract: SmartContract
env: string
networkProvider: ApiNetworkProvider

Methods

  • Creates a acceptOffer transaction with EGLD

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be accepted

    • amount: Value

      the price of the offer for the total amount to be bought (must include the buyer fee)

    • price: Value

      the price of the offer (must include the buyer fee)

    Returns Transaction

  • Creates a acceptOffer transaction with ESDT tokens

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be accepted

    • amount: Value

      the amount of tokens to be bought

    • price: Value

      the price of the offer for the total amount to be bought (must include the buyer fee)

    • paymentTokenIdentifier: string = ...

      the identifier of the payment token (default = ITHEUM token identifier based on the EnvironmentsEnum))

    Returns Transaction

  • Creates a acceptOffer transaction with NFT/SFT tokens

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be accepted

    • amount: Value

      the amount of tokens to be bought

    • tokenIdentifier: string

      the identifier of the token for the payment

    • nonce: number

      the nonce of the token for the payment

    • paymentAmount: Value

      the amount of the token for the payment

    Returns Transaction

  • Creates a acceptOffer without payment token (Free)

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be accepted

    • amount: Value

      the amount of tokens to be bought

    Returns Transaction

  • Creates a addOffer transaction

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • dataNftIdentifier: string

      the identifier of the DATA-NFT

    • dataNftNonce: number

      the nonce of the DATA-NFT

    • dataNftAmount: Value

      the amount of the DATA-NFT

    • paymentTokenIdentifier: string

      the identifier of the payment token sender wants to receive

    • paymentTokenNonce: number

      the nonce of the payment token

    • paymentTokenAmount: Value

      the amount of the payment token

    • minimumPaymentTokenAmount: number = 0

      the minimum amount of which the sender is willing to receive (useful in case where an offer was added and the smart contract fee was changed afterwards)

    • maxQuantity: Value

      the maximum quantity a user can buy (default could be 0 - (no enforced max value) or admin defined value)

    Returns Transaction

  • Creates a cancelOffer transaction

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be cancelled

    • quantity: number

      the quantity of the offer to be cancelled

    • sendFundsBackToOwner: boolean = true

      default true, if false the offer will be cancelled, but the funds will be kept in the contract until withdrawal

    Returns Transaction

  • Creates a changeOfferPrice transaction

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer to be changed

    • newPrice: Value

      the new price of the offer

    • newMinimumPaymentTokenAmount: number = 0

      the new minimum amount of which the sender is willing to receive (useful in case where an offer was added and the smart contract fee was changed afterwards)

    Returns Transaction

  • Retrieves the address of the marketplace smart contract based on the environment

    Returns IAddress

  • Retrieves all cancelled Offer objects for a given address which opted to not withdraw the funds

    Parameters

    • address: IAddress

      Address to query

    Returns Promise<Offer[]>

  • Retrieves all Offer objects listed on the marketplace for a given address

    Parameters

    • address: IAddress

      Address to query

    Returns Promise<Offer[]>

  • Retrieves an array of Offer objects listed on the marketplace for a given address within a specified range.

    Parameters

    • from: number

      The starting index of the desired range of offers.

    • to: number

      The ending index of the desired range of offers.

    • address: IAddress

      The address to query.

    Returns Promise<Offer[]>

  • Returns the total number of offers listed for a given address

    Parameters

    • address: IAddress

      Address to query

    Returns Promise<number>

  • Retrieves if the smart contract is paused or not

    Returns Promise<boolean>

  • Retrieves the last valid offer id in the storage

    Returns Promise<number>

  • Retrieves the smart contract number of offers

    Returns Promise<number>

  • Retrieves an Offer object based on the offer id

    Parameters

    • offerId: number

      The id of the offer to be retrieved

    Returns Promise<Offer>

  • Retrieves an array of Offer objects.

    Parameters

    • offerIds: number[]

    Returns Promise<Offer[]>

  • Retrieves an array of Offer objects in an arbitrary order.

    Parameters

    • from: number

      first index

    • to: number

      last index

    • OptionalsenderAddress: IAddress

      the address of the sender (optional)

    Returns Promise<Offer[]>

  • Creates a withdrawCancelledOffer transaction

    Parameters

    • senderAddress: IAddress

      the address of the sender

    • offerId: number

      the id of the offer from which the funds should be withdrawn

      offerId must be firstly cancelled. cancelOffer

    Returns Transaction