Skip to content

P2P Market

Sampli edited this page Jul 13, 2021 · 7 revisions

For more specifics on listings, visit the Listings Page

Getters

marketValue

  • Returns total value of the Skincrib marketplace.
  • Note: This method only works if reconnect is set to true.

marketMax

  • Returns the price of the most expensive item on the Skincrib marketplace.
  • Note: This method only works if reconnect is set to true.

getAllListingsFromMemory

  • Returns an array of all listings from memory.
  • Note: If reconnect is set to false, this method will always return a [].

Methods

getClientDeposits(steamid)

  • Returns all active deposits of one client.
  • Note: This method only works if reconnect is set to true.

getClientWithdraws(steamid)

  • Returns all active withdraws of one client.
  • Note: This method only works if reconnect is set to true.

getAllListingsFromServer()

  • Fetch all listings currently on skincrib market from the server.
  • This route only needs to be called once if reconnect is set to true.
  • Note: If reconnect is set to true, this event will log the array received to memory.

getClientDeposits(steamid)

  • Fetch all active deposits of one client.
  • steamid - Required.
  • Note: If reconnect is set to false, this method will always return null.

getClientWithdraws(steamid)

  • Fetch all active withdraws of one client.
  • steamid - Required.
  • Note: If reconnect is set to false, this method will always return null.

createListings(options)

  • options - Required.
    • steamid - Client's SteamID64.
    • apiKey - Client's Steam API-Key.
    • tradeUrl - Client's Steam TradeURL.
    • items - Array of item objects
  • Note: Because this method allows multiple items to be listed at once, the method will always return an object of errors (Formatted {'assetid': 'message'}) and an array of successfully listen items.
  • An array of items will create a separate listing for each item, Skincrib does not support "bundles" of items.

Example:

market.createListings({steamid: '', apiKey: '', tradeUrl: '', items: [{
 assetid: "22668188708",
 price: 21666,
 percentIncrease: 0
}, ...])
.then((errors, listed)=>{
  if(Object.keys(errors).length > 0){
    Object.keys(errors).forEach(assetid => console.log(`Error: ${assetid}-${errors[assetid]}`));
  }
  if(listed.length > 0){
   console.log(listed);
  }
}, (error)=>{ //single error message is received if the whole function call errors
 console.error(error);
});

cancelListings(options)

  • options - Required.
  • steamid - Client's SteamID64.
  • ids - An array of listing IDs to cancel.
  • Note: Because this method allows multiple items to be listed at once, the method will always return an object of errors (Formatted {'assetid': 'message'}) and an array of successfully listen items.

Example:

market.cancelListings({steamid: '', ids: ['1ad12692-60d8-4968-b2d4-7b29bbf98dfa', ...]})
.then((errors, cancelled)=>{
  if(Object.keys(errors).length > 0){
    Object.keys(errors).forEach(assetid => console.log(`Error: ${assetid}-${errors[assetid]}`));
  }
  if(cancelled.length > 0){
   console.log(cancelled);
  }
}, (error)=>{ //single error message is received if the whole function call errors
 console.error(error);
});

confirmListing

  • options - Required.
  • steamid - Client's SteamID64.
  • id - Listing ID to confirm.

Example

market.confirmListing({steamid: '', id: '1ad12692-60d8-4968-b2d4-7b29bbf98dfa'})
.then((data)=>{
  console.log(data);
}, (err)=>{
  console.error(err);
});