npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@creatief/suisdk

v1.0.3

Published

Marketplace SDK for product management and transactions

Downloads

228

Readme

Project Overview

Core Backend

Backend Project: https://github.com/Creatief-AI-Innovations/SuiMarketplaceSDK-Backend

SDK & Plugins

JavaScript SDK

Repository: https://github.com/Creatief-AI-Innovations/sui-marketplace-js

Published NPM Package: https://www.npmjs.com/package/@creatief/suisdk

Unreal Engine Plugin

Repository: https://github.com/Creatief-AI-Innovations/sui-marketplace-ue-plugin

Demo Projects

JavaScript Sample

Repository: https://github.com/Creatief-AI-Innovations/sui-marketplace-js-sample

Unreal Engine Sample

Repository: https://github.com/Creatief-AI-Innovations/SuiMarketplaceSDK-Unreal


SuiMarketplaceSDK Documentation

This documentation provides an overview of how to use the SuiMarketplaceSDK instance created using the MarketplaceSDK from the @creatief/suisdk package.

Initialization The marketplaceApi is initialized with the following configuration:

import MarketplaceSDK from '@creatief/suisdk';

export const marketplaceApi = new MarketplaceSDK({
  baseURL: 'https://e129-117-219-40-241.ngrok-free.app/api',
  apiKey: 'akesp8i-jk34lk-demo-823wry'
});

Usage The marketplaceApi provides various methods to interact with the marketplace, including authentication, product management, and transactions.

Authentication

  1. Login
const credentials = { username: 'user', password: 'pass' };
const authResponse = await marketplaceApi.auth.login(credentials);
console.log(authResponse.token);
  1. Logout
marketplaceApi.auth.logout();

Product Management

  1. Get All Products
const collectionId = 'your-collection-id';
const products = await marketplaceApi.products.getAllProducts(collectionId);
console.log(products);
  1. Get Products Owned
const ownedProducts = await marketplaceApi.products.getOwned();
console.log(ownedProducts);

Transactions

  1. Buy Product
const productId = 'product-id';
const transactionResult = await marketplaceApi.transactions.buyProduct(productId);
console.log(transactionResult);
  1. Unlist Product
const productId = 'product-id';
const transactionResult = await marketplaceApi.transactions.unlistProduct(productId);
console.log(transactionResult);
  1. List Product
const productId = 'product-id';
const price = 200;
const transactionResult = await marketplaceApi.transactions.listProduct(productId, price);
console.log(transactionResult);

Types

The suisdk package provides various types to ensure type safety:

Auth Types

import { LoginCredentials, AuthResponse } from '@creatief/suisdk';

Product Types

import { Product, ProductsResponse, TransactionResult } from '@creatief/suisdk';

Example Here is a complete example of using the marketplaceApi:

import { marketplaceApi } from './path/to/marketplaceApi';

async function main() {
  // Login
  const credentials = { username: 'user', password: 'pass' };
  const authResponse = await marketplaceApi.auth.login(credentials);
  console.log('Logged in:', authResponse.token);

  // Get all products
  const collectionId = 'your-collection-id';
  const products = await marketplaceApi.products.getAllProducts(collectionId);
  console.log('All products:', products);

  // Buy a product
  const productId = 'product-id';
  const transactionResult = await marketplaceApi.transactions.buyProduct(productId);
  console.log('Transaction result:', transactionResult);

  // Logout
  marketplaceApi.auth.logout();
  console.log('Logged out');
}

main().catch(console.error);