Page cover

Galactic Marketplace

Decentralized MMO-style trading

Introduction

Mainnet Key Label
Program Address

Program ID

traderDnaR5w6Tcoi3NFm53i48FTDNbGjBSZwWXDRrg

The Galactic Marketplace is a decentralized trading protocol on the Solana blockchain that provides an MMO Auction House experience as a public utility.

At a glance:

  • Fast and responsive data

  • Fully decentralized peer-to-peer trading through an MMO auction house-style experience

  • Easy integration with decentralized applications and protocols

As a user, here are some of the things you're able to do with the Galactic Marketplace:

  • Create your own buy and sell orders for any Solana token

    • Query, view, and cancel your existing orders

  • Buy from and sell into other people's orders

Technical Overview

import { BN } from 'bn.js';

class Order {
  id: string;
  orderMint: string;
  currencyMint: string;
  currencyDecimals: number;
  orderOriginationQty: number;
  orderQtyRemaining: number;
  orderType: OrderSide;
  owner: string;
  ownerAssetTokenAccount: string;
  ownerCurrencyTokenAccount: string;
  price: BN;
  uiPrice: number;
};

What items can be traded on the Galactic Marketplace?

Any arbitrary itemMint can be transacted permissionlessly. This can be any tokenized asset including SFTs and NFTs.

What currency pairs are valid on the Galactic Marketplace?

There are a limited number of valid currencyMint options:

Token Symbol
Mainnet Address

ATLAS

ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx

USDC

EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

Services and Examples

GmClientService

What is it?

The GmClientService is used to:

  • Construct Solana transactions to interact with the Galactic Marketplace

    • Creating orders

    • Canceling orders

    • Filling orders

  • Fetch metadata about registered currencies

  • Fetch lists of open orders for combinations of:

    • Specific mints

    • User PublicKeys

    • Specific currencies

See the TypeDocs for a full list of GmClientService methods

Fetch a list of supported currencies

Because the currency information is unlikely to change often this result will be cached for the lifecycle of GmClientService to reduce the total number of RPC calls made. If you wish to forcefully refetch this information pass true as an optional argument into getRegisteredCurrencies().

Fetch all open orders

Retrieve a list of all open orders for all currencies and items in the Galactic Marketplace.

Create an order

Create an order for itemMint - use orderSide to specify the direction of the trade.

When creating a Sell order, the orderCreator must deposit their itemMint into escrow and likewise when creating a Buy order they must deposit their quoteMint into escrow.

Fill an order

Note that orders can be partially filled. For example, if a player has an order to buy 10 Pearce X4s a seller can fill 4 out of those 10 while leaving the order open for other users to interact with.

getCreateExchangeTransaction() will work for both selling into a Buy order and buying from a Sell order.

Cancel an order

Orders can be canceled as long as they are still open, whether they have been partially filled or not. If a partially filled order is canceled, the unfilled portion of the order is returned to the order creator.

GmOrderbookService

What is it?

The GmOrderbookService is a read-only data caching layer which maintains a real-time list of all of the open orders on the Galactic Marketplace.

See the TypeDocs for a full list of methods

Start the service

Get a list of all mints being transacted on the marketplace

Get orders for a user

Get orders for an item mint

Registering marketplace event callbacks

Class instances which implement GmOrderbookService can register event handlers when the marketplace state changes.

If you just need raw event callbacks without maintaining a snapshot of the on-chain marketplace state consider implementing GmEventService instead

Example

GmEventService

What is it?

The GmEventService can be used to trigger an onEvent callback any time an order is created, modified, or canceled on the Galactic Marketplace.

The GmEventService is implemented by the GmOrderbookService and is how its internal state of the marketplace orderbooks is kept up-to-date

Example

Last updated

Was this helpful?