Market
A player lists tradable items at a price; any other player buys them at once, and the seller is paid when the sale happens. A lot that nobody buys can be taken back by the seller. The platform keeps a fee on every sale. Requires Inventory.
const sale = await rudder.market.sell({ item: 'iron-sword', price: { asset: 'gold', amount: 120 },});
await rudder.market.buy({ lot: sale.lot });Settings
Section titled “Settings”Develop → Modules → Market → Settings, one row for the project.
| Field | Meaning |
|---|---|
fee | The percent of the price the platform keeps, 0 to 100, 5 by default. |
The buyer pays the price in full; the seller receives the price minus the fee of the moment of the sale.
Functions
Section titled “Functions”| Function | Kind | Caller | Arguments | Result |
|---|---|---|---|---|
sell | mutation | client | {item, count?, id?, price} | The sale, with its lot |
buy | mutation | client | {lot} | What the buyer received: {item, count, ids} |
cancel | mutation | client | {lot} | What the seller took back |
view | query | client | {lot} | The lot |
browse | query | client | none | {lots}, at most 50 unsold lots |
sell takes the goods out of the seller’s inventory and holds them for the lot. count is how
many of a stackable item (1 by default); id names one unique piece instead of item; price
is the amount and asset the buyer pays.
A lot has lot (its id), seller, goods, price and sold. It carries no buyer: a sale is
finished for the buyer the moment buy answers, and the seller collects on their side.
How a sale runs
Section titled “How a sale runs”- The buyer pays as the sale happens and receives the goods in the same answer.
- Once a lot is sold it cannot be cancelled; the seller collects the money.
cancelreturns the goods to the seller’s inventory.- A lot never expires: it stays on the shelf until a player buys it or the seller cancels it.
- If the buyer’s inventory is full the whole purchase is refused and the lot stays on the shelf; the buyer frees room and buys again.
- Two players cannot both buy one lot: the second call answers
sold.
Errors
Section titled “Errors”| Code | Meaning |
|---|---|
no_lot | There is no such lot. |
sold | The lot is already sold. |
own_lot | The seller does not buy their own lot. |
not_seller | Only the seller cancels a lot. |
invalid_price | The price must be positive. |
insufficient | The buyer does not hold the price. |
unknown_item, not_tradable, invalid_count, not_enough, stack_full | From Inventory: the goods of sell, the buyer’s room or the seller’s room on cancel. |
Events
Section titled “Events”| Event | Payload | When |
|---|---|---|
sold | {lot} | A buyer takes a lot; the money of the seller is on its way to the wallet. |
In the Dashboard
Section titled “In the Dashboard”- Develop → Modules → Market → Settings: the fee.
- Activity: every
sell,buyandcancel, with its arguments and how it ended. - A player card shows the inventory and the wallet the goods and the money pass through.
Limits
Section titled “Limits”- No auction and no bidding: one price, first buyer wins.
- No per-player limit on how many lots one seller opens, and no maximum price.
browsereturns at most 50 unsold lots, the newest listings first. Older lots stay open and a known id still opens them withview, but a player browsing may not see them.- The goods of a lot sit outside the inventory until the sale or the cancel. A lot whose seller is deleted keeps its goods.