Market

A perpetual market.

Types

class Bid {
    constructor(
        public amount: u128,
        public bidder: AccountId,
        public recipient: AccountId,
        public sell_on_share: u16,
        public currency: CurrencyId = 'near'
    ) {}
}
class BidShares {
    constructor(
        public prev_owner: u16,
        public creator: u16,
        public owner: u16
    ) {}
}
class Ask {
    amount: u128 // Amount asked
    currency: CurrencyId = 'near' // currency of ask, default is NEAR
    sell_on_share: u16 // % to pay to previous owner on this sale
    constructor() {}
}

Methods

Get Bids

GET [market-contract].get_bids(token_id)

Retrieve all bids for a certain token.

Path Parameters

{
  "ysn.testnet": {
    "amount": "100000000000000000000000",
    "bidder": "ysn.testnet",
    "recipient": "berrytest.testnet",
    "sell_on_share": 1000,
    "currency": "near"
  },
  "ys24.testnet": {
    "amount": "10000000000000000000000",
    "bidder": "ys24.testnet",
    "recipient": "berrytest.testnet",
    "sell_on_share": 1900,
    "currency": "near"
  }
}

Get Bidders Bids

GET [market-contract].get_bidders_bids(account_id)

Retrieve all bids placed by an account.

Path Parameters

{
  "ysn57031827": {
    "amount": "40000000000000000000000",
    "bidder": "ys24.testnet",
    "recipient": "ysn.testnet",
    "sell_on_share": 2000,
    "currency": "near"
  },
  "yyyyy": {
    "amount": "10000000000000000000000",
    "bidder": "ys24.testnet",
    "recipient": "berrytest.testnet",
    "sell_on_share": 1900,
    "currency": "near"
  }
}

Set Bid Shares

POST [market-contract].set_bid_shares(token_id, prev_owner, creator, owner)

Set or update the split shares for a certain token.

Request Body

void

Set Bid

POST [market-contract].set_bid(token_id, amount, bidder, recipient, sell_on_share, currency)

Places a bid on a token.

Request Body

void

Remove Bid

DELETE [market-contract].remove_bid(token_id, bidder)

Remove a bid for token.

Request Body

void

Burn

GET [market-contract].burn(token_id)

Removes bid shares, asks, and bids for a token while returing bid amounts.

Request Body

void

Accept Bid

PATCH [market-contract].accept_bid(token_id, bidder, creator, owner, prev_owner)

Pays off the bid shares, updates to new shares, and removes only this bid.

Request Body

void

Last updated