NAV Navbar
Node

Welcome to the Stardust API

Our API makes it easy to your game's player experience and increase revenues - all backed by the transparency of the blockchain.

Stardust's APIs enable a variety of capabilites; from simply gathering data, to building something that is truly revolutionary

Capabilities:

Core Concepts

API requests

To send a valid API request, combine the below components appropriately:

Component Description
The HTTP method
  • GET. Requests data from server.
  • POST. Sends data to the server.
The URL to the API server
  • Sandbox: https://api.sandbox.stardust.com
  • Live: https://api.stardust.com
The URL to the API resource The resource to interact with. For example: v1/games
A JSON request body Required for most HTTP calls.

HTTP Request Headers

The commonly used HTTP request headers are:

Headers Description
Accept Required for operations with a response body. Specifies the response format.
The syntax is: Accept: application/<format>.
When using the Stardust API, <format> is to be replaced with json.
Authorization ?
Content-Type Required for operations with a request body. Specifies the request format.
The syntax is: Content-Type: application/<format>.
When using the Stardust API, <format> is to be replaced with json.

API Responses

The Stardust API returns HTTP status codes and response bodies in JSON format, which contains information about the call or to which resource the call was made.

HTTP success status codes

HTTP Status Code Description
200 OK The request was successful.
201 Created A resource was successfully created.
202 Accepted The request was accepted.

HTTP error status codes

HTTP Status Code Description
400 Bad Request Your request is invalid.
401 Unauthorized Your API key is wrong.
403 Forbidden The resource requested is hidden for use of administrators only.
404 Not Found The specified resource could not be found.
405 Method Not Allowed You tried to access a resource with an invalid method.
406 Not Acceptable You requested a format that isn't JSON.
410 Gone The resource requested has been removed from our servers.
429 Too Many Requests You're requesting too many resources! Slow down!
500 Internal Server Error We had a problem with our server. Please try again later.
503 Service Unavailable We're temporarily offline for maintenance. Please try again later.

Validation errors

A response with a status code of 400 Bad Request will be returned if a request does not pass the validation check.

Parameter Type Description

Wallet

Wallet

A wallet consists of a public address and a private key. These are used to interact with the API.

The wallet address is used to publically identify you, think of it as a personal ID you share with other users.

The private key is personal and should NOT be shared with anyone. You use the private key to sign transactions, think of it as a pin number to your bank card.

Think of a hypothetical scenario where you are to trade an in-game item. The person you are to trade with is to receive your wallet address (your public ID). For the trade to be completed it is required that both parties sign the transaction with their private key (your pin number).

Create Wallet

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');
const [walletAddress, privateKey] = stardust.createWallet();

Example Response:

{
    "address": "0x863D36cE307F69AdCC896E762C646732a698ae6E",
    "privateKey": "0xac48f69cb79149b4fcfa7adc63fc85cd93c61009f9640f9e9317a2921ac05f4f"
}

Generate Wallet

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';
const gameAddr = '0x...';
const from = '0x...';

const response = await API.setters.user.generate({gameAddr, from}, privateKey)

Success Response:

{
    "gameAddr": "0x5E60C5005A388Bb28660d52996CE933D86cC720C",
    "userAddr": "0x23F25435Bc0b2BFed6c85CD7a05bc4B494f2D158" 
}

POST /user/generate

This endpoint generates an address for a user that is managed by the game owner. This address will hold all the users ingame items.

HTTP Request

POST http://api.sandbox.stardust.com/user/generate

Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.

Games

abc

POST Create Game

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    from: '0x0...',
    name: 'Name to use',
    desc: 'Description to use',
    symbol: 'SYM',
    image: 'Image to use',
    rarityNames: ['Common', 'Rare', 'Super Rare', 'Limited Edition', 'Unique'],
    rarityPercs: [80, 15, 4, 0.85, 0.15],
    timestamp: Date.now()
};

const response = await API.setters.game.deploy(data, privateKey);

Example Response:

{
    "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95"
}

POST /games

This endpoint creates a new game.

HTTP Request

POST http://api.sandbox.stardust.com/games

Request Arguments

Attribute Type Description
from string Address of caller.
name string Name of...
desc string Description of...
image string Image of...
rarityNames string array Names of the rarity tiers of the items. (e.g. "Common", "Rare").
rarityPercs number array Percentages for the rarity tiers (e.g. "80, 20").
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Transfer Game Ownership

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    to: '0x0...',
    timestamp: Date.now(),
};

const response = await API.setters.game.transfer(data, privateKey);

Example Response:

{
    "message": "Successfully transferred ownership of game 0x027A0EF9D8FF5D6e34aDf5a08CC48eb597eB8287.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "from": "0x71057C0777F76e8b4D0b69EA119E6b6360AED909",
        "to": "0xbA418a52A50c7169dbf7296D64B45a82DFa093Ce"
    }
}

POST /games/transfer

This endpoint transfers the game ownership to the receiving player's address.

HTTP Request

POST http://api.sandbox.stardust.com/games/transfer

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
to string Address of receiver.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Games

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const response = await API.getters.game.games({});

Example Response:

{
    "data": [
        {
            "desc": "Game Desc",
            "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
            "gameOwner": "0x71057C0777F76e8b4D0b69EA119E6b6360AED909",
            "image": "Game Image",
            "name": "Game Name",
            "rarityNames": [Array],
            "rarityPercs": [Array],
            "symbol": "GAME",
            "totalSupply": 0
        }
    ]
}

GET /games

This endpoint retrieves all existing games.

HTTP Request

GET http://api.sandbox.stardust.com/games

GET Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.game.game({gameAddr});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "gameOwner": "0x33a22C0B3Fb29B0991573c8F46bCE2a203afe203",
        "name": "Game Name",
        "symbol": "GAME",
        "desc": "Game Description",
        "image": "Game Image",
        "rarityNames": [ "Common", "Rare", "Super Rare", "Limited Edition", "Unique" ],
        "rarityPercs": [ 80, 15, 4, 0.85, 0.15 ],
        "totalSupply": 0
    },
    "message": "Details of game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /game

This endpoint retrieves a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/game

Request Arguments

Attribute Type Description
gameAddr string Address of game.

Tokens

Use the Tokens API to create new tokens, transfer a token, or query existing tokens.

Tokens are in-game item (for example a piece of gear) which the player has explicit control over. Tokens exist only in the game they are created in.

Tokens can be traded, loaned, bought, or added to a box.

To be able to use the Tokens API, you will first need to create both a wallet and a game.

POST Create Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    name: 'Name to use',
    desc: 'Description to use',
    image: 'Image to use',
    rarity: 1,
    cap: 0,
    val: 100,
    timestamp: Date.now()
};

const response = await API.setters.token.add(data, privateKey);

Example Response:

{
    "id": 0,
    "message": "Successfully added token in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /tokens

This endpoint creates a new token.

HTTP Request

POST http://api.sandbox.stardust.com/tokens

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
name string Name of...
desc string Description of...
image string Image of...
rarity number Rarity of the token.
cap number Maximum amount that can be minted. 0 for uncapped.
val number Market value of the token.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Mint Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    to: '0x0...',
    id: 0,
    amount: 1,
    timestamp: Date.now()
};

const response = await API.setters.token.mint(data, privateKey);

Example Response:

{
    "message": "Successfully minted token 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "data": {
        "id": 0,
        "to": "0x971D4F914E63df873cbcE6FF0F21F57CFDd908f8",
        "amount": 1,
        "timestamp": 1546345294756,
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95"
    }
}

POST /tokens/mint

This endpoint mints a token. For a token to be minted, it first has to be created.

HTTP Request

POST http://api.sandbox.stardust.com/tokens/mint

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
to string Address of receiver.
id number ID of token.
amount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Transfer Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    to: '0x0...',
    id: 0,
    amount: 1,
    timestamp: Date.now()
};

const response = await API.setters.token.transfer(data, privateKey);

Example Response:

{
    "message": "Successfully traded token 0 in game 0xc114cB5446d0D506dDAE14691e4a96692cdA1C36.",
    "data": {
        "from": "0x5aDDB1cD06cEbFeC12f3149e3c077cF2de84E909",
        "to": "0xbA418a52A50c7169dbf7296D64B45a82DFa093Ce",
        "id": 0,
        "amount": 1
    }
}

POST /tokens/trade

This endpoint sends a token to the receiving player.

HTTP Request

POST http://api.sandbox.stardust.com/tokens/trade

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
to string Address of receiver.
id number ID of token.
amount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Burn Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    amount: 1,
    timestamp: Date.now()
};

const response = await API.setters.token.burn(data, privateKey);

Example Response:

POST /tokens/burn

This endpoint burns (removes) a token.

HTTP Request

POST http://api.sandbox.stardust.com/tokens/burn

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of token.
amount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Player Balance In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.token.userBalanceInGame({gameAddr, userAddr});

Example Response:

"success"

GET /games/balance

This endpoint retrieves a specific player's balance in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/games/balance

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

GET Free Balance Of

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';
const id = 0;

const response = await API.getters.token.userFreeBalanceInGame({gameAddr, userAddr, id});

Example Response:

"success"

GET /loans/free-balance-of

This endpoint retrieves a user's available balance of a specific token.

HTTP Request

GET http://api.sandbox.stardust.com/loans/free-balance-of

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.
id number ID of token.

GET Loaned Balance Of

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';
const id = 0;

const response = await API.getters.token.userLoanedBalanceInGame({gameAddr, userAddr, id});

Example Response:

"success"

GET /loans/loaned-balance-of

This endpoint retrieves a user's loaned balance of a specific token.

HTTP Request

GET http://api.sandbox.stardust.com/loans/loaned-balance-of

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.
id number ID of token.

GET Game Tokens

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.token.gameTokens({gameAddr});

Example Response:

{
    "data": [
        {
            "id": 0,
            "cap": 0,
            "desc": "Token Description",
            "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
            "image": "Token Image",
            "name": "Token Name",
            "owners": ["0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D94", "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D93", "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D92"],
            "rarity": 1,
            "totalSupply": 100,
            "val": 1
        }
    ]
}

GET /tokens

This endpoint retrieves all tokens in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/tokens

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const id = 0;

const response = await API.getters.token.gameToken({gameAddr, id});

Example Response:

{
    "data": {
        "id": 0,
        "cap": 0,
        "desc": "Token Description",
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "image": "Token Image",
        "name": "Token Name",
        "owners": [ "0x2b95e086A4a561Fd767E630D3b056Fc25e4B545F" ],
        "rarity": 1,
        "totalSupply": 0,
        "val": 100
    },
    "message": "Details of token 0 in 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /tokens

This endpoint retrieves a specific token from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/tokens

Request Arguments

Attribute Type Description
gameAddr string Address of game.
id number ID of token.

GET User Tokens

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const userAddr = '0x...';

const response = await API.getters.token.userTokens({userAddr});

Example Response:

{
    "message": "Tokens of user 0xadE4c5D687e9B95E89BCe807ff195D114133BDf4.",
    "data": {
        "0x4Fe890225fdB5A0bFAdaaE9F8F5F4D4b402F282A": {
            "0": 100
        }
    }
}

GET /allTokensOf

This endpoint retrieves all tokens a user owns across all games.

HTTP Request

GET http://api.sandbox.stardust.com/allTokensOf

Request Arguments

Attribute Type Description
userAddr string Address of user.

GET User Tokens In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.token.userTokensInGame({gameAddr, userAddr});

Example Response:

{
    "message": "Tokens of user 0xF10e4d9698F08B314C876c67c7627E4e48AdAf61 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "data": { "0": 1 }
}

GET /tokensOf

This endpoint retrieves all tokens owned by a specific user in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/tokensOf

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

Boxes

Use the Boxes API to create a box containing tokens.

POST Create Box

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    name: 'Name to use',
    desc: 'Description to use',
    image: 'Image to use',
    tokens: [0],
    timestamp: Date.now()
};

const response = await API.setters.box.add(data, privateKey);

Example Response:

{
    "id": 0,
    "message": "Successfully added box in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /boxes

This endpoint creates a new box.

HTTP Request

POST http://api.sandbox.stardust.com/boxes

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
name string Name of...
desc string Description of...
image string Image of...
tokens number array Array of token IDs.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Buy Box

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
};

const response = await API.setters.box.buy(data, privateKey);

Example Response:

{
    "message": "Successfully bought box 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0
    }
}

POST /boxes/buy

This endpoint allows a user to buy a box.

HTTP Request

POST http://api.sandbox.stardust.com/boxes/buy

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of box.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Update Box

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    name: 'Name to use',
    desc: 'Description to use',
    image: 'Image to use',
    tokens: [0],
    timestamp: Date.now()
};

const response = await API.setters.box.update(data, privateKey);

Example Response:

{
    "message": "Successfully updated box 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "name": "New Box Name",
        "desc": "New Box Description",
        "image": "New Box Image",
        "tokens": [ 0 ],
        "timestamp": 1546346648587
    }
}

POST /boxes/update

This endpoint updates a box.

HTTP Request

POST http://api.sandbox.stardust.com/boxes/update

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of box.
name string Name of...
desc string Description of...
image string Image of...
tokens number array Array of token IDs.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Game Boxes

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.box.gameBoxes({gameAddr});

Example Response:

{
    "data": [
        {
            "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
            "id": 0,
            "isValid": true,
            "name": "Box Name",
            "desc": "Box Description",
            "image": "Box Image",
            "tokens": [Array]
        }
    ],
    "message": "Boxes of game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /boxes

This endpoint retrieves all boxes in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/boxes

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Box

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const id = 0;

const response = await API.getters.box.gameBox({gameAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "isValid": true,
        "name": "Box Name",
        "desc": "Box Description",
        "image": "Box Image",
        "tokens": [ 0 ]
    },
    "message": "Details of box 0 in 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /boxes

This endpoint retrieves a specific box from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/box

Request Arguments

Attribute Type Description
gameAddr string Address of game.
id number ID of box.

Trades

Trades

Use the Trades API to exchange items between two specific players, offer it publicly, accept/deny an offer, or to query the various trades that have been made.

POST Offer Private Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    to: '0x0...',
    offeredId: 0,
    offeredAmount: 1,
    wantedId: 1,
    wantedAmount: 1,
    timestamp: Date.now()
};

const response = await API.setters.trade.offerPrivate(data, privateKey);

Example Response:

{
    "message": "Successfully offered private trade in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /trades/offer-private

This endpoint offers a private trade.

HTTP Request

POST http://api.sandbox.stardust.com/trades/offer-private

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
to string Address of receiver.
offeredId number ID of the offered token.
offeredAmount number Amount of the offered token.
wantedId number ID of the wanted token.
wantedAmount number Amount of the wanted token.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Offer Public Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    offeredId: 0,
    offeredAmount: 1,
    wantedId: 1,
    wantedAmount: 1,
    timestamp: Date.now()
};

const response = await API.setters.trade.offerPublic(data, privateKey);

Example Response:

{ 
    "message": "Successfully offered public trade in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /trades/offer-public

This endpoint offers a public trade.

HTTP Request

POST http://api.sandbox.stardust.com/trades/offer-public

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
offeredId number ID of the offered token.
offeredAmount number Amount of the offered token.
wantedId number ID of the wanted token.
wantedAmount number Amount of the wanted token.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Take Private Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
};

const response = await API.setters.trade.takePrivate(data, privateKey);

Example Response:

{ 
    "message": "Successfully accepted private trade 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /trades/take-private

This endpoint accepts a private trade.

HTTP Request

POST http://api.sandbox.stardust.com/trades/take-private

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of trade.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Take Public Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
}

const response = await API.setters.trade.takePublic(data, privateKey);

Example Response:

{
    "message": "Successfully accepted public trade 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /trades/take-public

This endpoint accepts a public trade.

HTTP Request

POST http://api.sandbox.stardust.com/trades/take-public

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of trade.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Remove Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
};

const response = await API.setters.trade.remove(data, privateKey);

Example Response:

{ 
    "message": "Successfully removed trade 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

POST /trades/remove

This endpoint removes a trade.

HTTP Request

POST http://api.sandbox.stardust.com/trades/remove

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of trade.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Trades

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const response = await API.getters.trade.getAll({});

Example Response:

{
    "message": "All trades.",
    "data": {
        "0x0AE1747Aa4c34DCB56587d4340a2d982715C5B7a": [
            {
                "gameAddr": "0x0AE1747Aa4c34DCB56587d4340a2d982715C5B7a",
                "offeredId": 0,
                "trader": "0x29c17fCB80DFF458614161D8Ab92343B4B8439A7",
                "taker": "0x73e6Ab611B1b7cb202ea17210394C77c5c558400",
                "wantedAmount": 1,
                "wantedId": 1,
                "offeredAmount": 1,
                "createdOn": 1546373351,
                "state": 0
            }
        ]
    }
}

GET /trades

This endpoint retrieves all trades.

HTTP Request

GET http://api.sandbox.stardust.com/trades

GET Game Closed Trade Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.trade.gameClosedCount({gameAddr});

Example Response:

GET /trades/game/closed-count

This endpoint retrieves the number of closed trades in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/closed-count

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Open Trade Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.trade.gameOpenCount({gameAddr});

Example Response:

GET /trades/game/open-count

This endpoint retrieves the number of open trades in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/open-count

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Trade

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const id = 0;

const response = await API.getters.trade.gameTrade({gameAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "offeredId": 0,
        "trader": "0x29c17fCB80DFF458614161D8Ab92343B4B8439A7",
        "taker": "0x73e6Ab611B1b7cb202ea17210394C77c5c558400",
        "wantedAmount": 1,
        "wantedId": 1,
        "offeredAmount": 1,
        "createdOn": 1546373351,
        "state": 0
    },
    "message": "Details of trade 0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95"
}

GET /trades

This endpoint retrieves a specific trade from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game

Request Arguments

Attribute Type Description
gameAddr string Address of game.
id number ID of trade.

GET Game Trades

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.trade.gameTrades({gameAddr});

Example Response:

{
    "message": "All trades of game 0x0AE1747Aa4c34DCB56587d4340a2d982715C5B7a.",
    "data": [
        {
            "gameAddr": "0x0AE1747Aa4c34DCB56587d4340a2d982715C5B7a",
            "offeredId": 0,
            "trader": "0x29c17fCB80DFF458614161D8Ab92343B4B8439A7",
            "taker": "0x73e6Ab611B1b7cb202ea17210394C77c5c558400",
            "wantedAmount": 1,
            "wantedId": 1,
            "offeredAmount": 1,
            "createdOn": 1546373351,
            "state": 0
        }
    ]
}

GET /trades/game

This endpoint retrieves all trades in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET User Trade Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const userAddr = '0x...';

const response = await API.getters.trade.userTradeCount({userAddr});

Example Response:

{
    "count": 1,
    "message": "Total trade count for 0x6DBcb3f00a4bC19eb969956a1F6BEE3b390f69a2"
}

GET /trades/game/user/count

This endpoint retrieves a user's trade count across all games.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/user/count

Request Arguments

Attribute Type Description
userAddr string Address of user.

GET User Trade Count In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.trade.userTradeCountInGame({gameAddr, userAddr});

Example Response:

{
    "count": 1,
    "message": "Total trade count for 0x6DBcb3f00a4bC19eb969956a1F6BEE3b390f69a2 in game 0xa3D396E3E7F09C1D61388C71ebc2bC729F0996aB"
}

GET /trades/game/user/count

This endpoint retrieves the number of trades a user has made in a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/user/count

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

GET User Trade Ids

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const userAddr = '0x...';

const response = await API.getters.trade.userTradeIds({userAddr});

Example Response:

{
    "data": {
        "0x34A81Fc2659b0B88E8154E14d293a4BB51Dd7B9d": [ 0 ]
    },
    "message": "Trade indexes for user 0x9d6e19d07bACC46f1F726D1587C7cef0d1580E66."
}

GET /trades/user/all-trade-ids

This endpoint retrieves all trade ids made by a user.

HTTP Request

GET http://api.sandbox.stardust.com/trades/user/all-trade-ids

Request Arguments

Attribute Type Description
userAddr string Address of user.

GET User Trade Ids In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.trade.userTradeIdsInGame({gameAddr, userAddr});

Example Response:

{
    "data": [ 0 ],
    "message": "Trade indexes for user 0x7510840a2C8232aC8b00A52Ebb684C7a54782bb0 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /trades/game/user/all-trade-ids

This endpoint retrieves all trade ids made by a user from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/user/all-trade-ids

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

GET User Trades

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const userAddr = '0x...';

const response = await API.getters.trade.userTrades({userAddr});

Example Response:

{
    "data": {
        "0x93f6dF65B4893D2845e3F5f7f09f49cAfDA2994B": [
            {
                "gameAddr": "0x93f6dF65B4893D2845e3F5f7f09f49cAfDA2994B",
                "offeredId": 0,
                "trader": "0x6d5e74C73d5d82D07c738aDD12216A06408DfAce",
                "taker": "0x73e6Ab611B1b7cb202ea17210394C77c5c558400",
                "wantedAmount": 1,
                "wantedId": 1,
                "offeredAmount": 1,
                "createdOn": 1546373351,
                "state": 0
            }
        ]
    },
    "message": "All trades of user 0x6d5e74C73d5d82D07c738aDD12216A06408DfAce"
}

GET /trades/user

This endpoint retrieves all user trades.

HTTP Request

GET http://api.sandbox.stardust.com/trades/user

Request Arguments

Attribute Type Description
userAddr string Address of user.

GET User Trade In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';
const id = 0;

const response = await API.getters.trade.userTradeInGame({gameAddr, userAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "offeredId": 0,
        "trader": "0x2e5C4998030b016A6EC38580c892B6E06812e7f1",
        "taker": "0x24feE1004ebD8d9513a1C9802b1a44287dFE266C",
        "wantedAmount": 1,
        "wantedId": 1,
        "offeredAmount": 1,
        "createdOn": 1546373496,
        "state": 0
    },
    "message": "Details of trade 0 for user 0x2e5C4998030b016A6EC38580c892B6E06812e7f1 in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95"
}

GET /trades/game/user/id

This endpoint retrieves a user's trade from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/user/id

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.
id number ID of trade.

GET User Trades In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.trade.userTradesInGame({gameAddr, userAddr});

Example Response:

{
    "data": [
        {
            "offeredId": 0,
            "trader": "0xeC9567568fF2310dF99F16CEb350908a962e556b",
            "taker": "0xcb13bc625b81523d30235dD46914802142AA1733",
            "wantedAmount": 1,
            "wantedId": 1,
            "offeredAmount": 1,
            "createdOn": 1547986454,
            "state": 0
        }
    ],
    "message": "All user trades in game 0x68D36F180c45A87F6fCC08bbCa438912fA18Ad24."
}

GET /trades/game/user

This endpoint retrieves all user trades from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/trades/game/user

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

Loans

Use the Loans API to loan out items to a specific player, offer it publicly, accept/deny an offer, or to query the various loans that have been made.

POST Offer Private Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    to: '0x0...',
    id: 0,
    amount: 1,
    length: (20 * 24 * 60 * 60),
    timestamp: Date.now(),
};

const response = await API.setters.loan.offerPrivate(data, privateKey);

Example Response:

{
    "message": "Loan successfully offered.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "from": "0xaFf8855CfB1A84f353ac398680f0bc417805f0F6",
        "to": "0xbA418a52A50c7169dbf7296D64B45a82DFa093Ce",
        "id": 0,
        "amount": 1,
        "length": 172800,
        "timestamp": 1546371326313
    }
}

POST /loans/offer-private

This endpoint offers a private loan.

HTTP Request

POST http://api.sandbox.stardust.com/loans/offer-private

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
to string Address of receiver.
id number ID of token.
amount number Amount.
length number Length in seconds.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Offer Public Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    amount: 1,
    length: (20 * 24 * 60 * 60),
    timestamp: Date.now(),
};

const response = await API.setters.loan.offerPublic(data, privateKey);

Example Response:

{
    "message": "Loan successfully offered.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "from": "0x1BC625A87F51B1B9FDB88fF0eC6Acc976C9E6cB8",
        "id": 0,
        "amount": 1,
        "length": 172800,
        "timestamp": 1546371472562
    }
}

POST /loans/offer-public

This endpoint offers a public loan.

HTTP Request

POST http://api.sandbox.stardust.com/loans/offer-public

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of token.
amount number Amount.
length number Length in seconds.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Handle Private Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    decision: true,
    timestamp: Date.now()
};

const response = await API.setters.loan.handlePrivate(data, privateKey);

Example Response:

{
    "message": "Loan successfully handled.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "decision": true,
        "timestamp": 1546371077822
    }
}

POST /loans/handle-private

This endpoint handles a private loan.

HTTP Request

POST http://api.sandbox.stardust.com/loans/handle-private

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of loan.
decision boolean Whether to accept or decline.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Handle Public Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
};

const response = await API.setters.loan.handlePrivate(data, privateKey);

Example Response:

{
    "message": "Loan successfully handled.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "timestamp": 1546371218410
    }
}

POST /loans/handle-public

This endpoint handles a public loan.

HTTP Request

POST http://api.sandbox.stardust.com/loans/handle-public

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of loan.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Finish Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    timestamp: Date.now()
};

const response = await API.setters.loan.finish(data, privateKey);

Example Response:

{
    "message": "Loan successfully finished.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "timestamp": 1546346948597
    }
}

POST /loans/finish

This endpoint finishes (ends) a loan.

HTTP Request

POST http://api.sandbox.stardust.com/loans/finish

Request Arguments

Attribute Type Description
gameAddr string Address of game.
id number ID of loan.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Game Loan

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const id = 0;

const response = await API.getters.loan.gameLoan({gameAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "id": 0,
        "amount": 1,
        "start": 1546370926,
        "length": 172800,
        "isActive": false,
        "lender": "0x12A195cB439A54834e677a59912c96e1B8740630",
        "borrower": "0xD0635Bea71F04ec87F9a574Bf1aea974d7a08C57"
    },
    "message": "Details of loan 0 in 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95."
}

GET /loans

This endpoint retrieves a specific token from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/loans

Request Arguments

Attribute Type Description
gameAddr string Address of game.
id number ID of loan.

GET Game Created Loans Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.loan.gameCreatedCount({gameAddr});

Example Response:

{
    "message": "Total amount of loans created in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "createdCount": 1
}

GET /loans/created-loans-count

This endpoint retrieves a game's created loans count.

HTTP Request

GET http://api.sandbox.stardust.com/loans/created-loans-count

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Deleted Loans Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.getters.loan.gameDeletedCount({gameAddr});

Example Response:

{
    "message": "Total amount of loans deleted in game 0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95.",
    "deletedCount": 1
}

GET /loans/deleted-loans-count

This endpoint retrieves a game's deleted loans count.

HTTP Request

GET http://api.sandbox.stardust.com/loans/deleted-loans-count

Request Arguments

Attribute Type Description
gameAddr string Address of game.

Shop

Use the Shop API to exchange in-game cash for tokens, tokens for in-game cash, or trade in a token for another.

POST Token To Cash

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    amount: 1,
    timestamp: Date.now(),
};

const response = await API.setters.shop.tokenToCash(data, privateKey);

Example Response:

{
    "message": "Successfully created order.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 1
    }
}

POST /shop/token-to-cash

This endpoint converts a token into in-game cash.

HTTP Request

POST http://api.sandbox.stardust.com/shop/token-to-cash

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of token.
amount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Cash To Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    id: 0,
    amount: 1,
    timestamp: Date.now(),
};

const response = await API.setters.shop.cashToToken(data, privateKey);

Example Response:

{
    "message": "Successfully created order.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0
    }
}

POST /shop/cash-to-token

This endpoint converts in-game cash into a token.

HTTP Request

POST http://api.sandbox.stardust.com/shop/cash-to-token

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
id number ID of token.
amount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

POST Token To Token

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const privateKey = '0x...';

const data = {
    gameAddr: '0x0...',
    from: '0x0...',
    fromId: 0,
    fromAmount: 1,
    toId: 1,
    toAmount: 1,
    timestamp: Date.now()
};

const response = await API.setters.shop.tokenToToken(data, privateKey);

Example Response:

{
    "message": "Successfully created order.",
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0
    }
}

POST /shop/token-to-token

This endpoint exchanges tokens of one type for another.

HTTP Request

POST http://api.sandbox.stardust.com/shop/token-to-token

Request Arguments

Attribute Type Description
gameAddr string Address of game.
from string Address of caller.
fromId number ID of the token you want to exchange from.
fromAmount number Amount.
toId number ID of the token you want to exchange to.
toAmount number Amount.
timestamp number Timestamp for the data, used to verify the signature is valid.

GET Game Order

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const id = 0;

const response = await API.getters.shop.gameOrder({gameAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "id": 0,
        "id": 0,
        "amount": 1,
        "created": 1546371937,
        "caller": "0xB02617958D49C65ed592BE6119d3122010048A80"
    },
    "message": "Details of order 0."
}

GET /shop/orders

This endpoint retrieves a specific order from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/shop/orders

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET Game Order Count

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';

const response = await API.setters.shop.gameOrderCount({gameAddr});

Example Response:

{
    "count": 1,
    "message": "Total amount of loans created."
}

GET /shop/game-orders

This endpoint retrieves a game's order count.

HTTP Request

GET http://api.sandbox.stardust.com/shop/game-orders

Request Arguments

Attribute Type Description
gameAddr string Address of game.

GET User Order In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';
const id = 0;

const response = await API.getters.shop.userOrderInGame({gameAddr, userAddr, id});

Example Response:

{
    "data": {
        "gameAddr": "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95",
        "caller": "0xCF24bf74A8beC208f70bB7adC2F68420e19Ed23F",
        "amount": 1,
        "id": 0,
        "id": 0,
        "created": 1546372302
    },
    "message": "Details of user 0xCF24bf74A8beC208f70bB7adC2F68420e19Ed23F, order 0."
}

GET /shop/game-orders

This endpoint retrieves a user's specific order from a specific game.

HTTP Request

GET http://api.sandbox.stardust.com/shop/orders

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

GET User Orders In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.shop.userOrdersInGame({gameAddr, userAddr});

Example Response:

{
    "data": {
        "ids": [ 0 ],
        "tokenIds": [ 0 ],
        "amounts": [ 1 ],
        "createds": [ 1546372132 ],
        "gameAddrs": [ "0xa509a89479B08F734Bd4bD16A762eDcE7Ba44D95" ],
        "callers": [ "0xE92785317137B8566CE78098b6CddB1BBF4813a7" ]
    },
    "message": "Orders of user 0xE92785317137B8566CE78098b6CddB1BBF4813a7."
}

GET /shop/game-orders

This endpoint retrieves all orders made by a specific user.

HTTP Request

GET http://api.sandbox.stardust.com/shop/game-orders

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.

GET User Order Count In Game

Example Request:

import {stardustAPI} from 'stardust-api';
const API = stardustAPI('EXAMPLE_IP');

const gameAddr = '0x...';
const userAddr = '0x...';

const response = await API.getters.shop.userOrderCountInGame({gameAddr, userAddr});

Example Response:

{
    "count": 1,
    "message": "Total amount of loans created."
}

GET /shop/orders/count

This endpoint retrieves a user's order count.

HTTP Request

GET http://api.sandbox.stardust.com/shop/orders/count

Request Arguments

Attribute Type Description
gameAddr string Address of game.
userAddr string Address of user.