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

@merokudao/storekit-sdk

v1.27.0

Published

SDK for MerokudAO StoreKit

Downloads

245

Readme

@merokudao/storekit-sdk

This is the NodeJS Typescript SDK for API described at https://github.com/merokudao/storekit/blob/main/apps/docs/public/api-specs/meroku-server.yml and hosted at https://docs.meroku.store.

This package is generated using Swagger CodeGen. More details on that follows the usage section.

The versioning of this package is consistent with the API spec version. So if you are using OpenAPI Spec v 1.21, then the package should be 1.21.

T O C

Install

npm install @merokudao/storekit-sdk

or

yarn add @merokudao/storekit-sdk

Registry Use


import {
  DAppRegistryApi,
  Dapp,
  DappAvailableOnPlatformEnum,
  StoreRegistryApi,
  DappCategoryEnum,
  DappWithDevCreds,
  DeveloperProfilesApi,
} from '@merokudao/storekit-sdk';

const baseURL = process.env.STOREKIT_API_URL as string | 'https://api.meroku.store';

// Configure the API and instantiate
const dAppRegistryAPI = new DAppRegistryApi(
  {
    basePath: baseURL
  },
  undefined,
  undefined
);

// Get the dApps list
const dApps: Dapp[] = await dAppRegistryAPI.searchDapps();

Analytics

There are URLs that support visit to an app's webapp or download the build for an app. These methods should be used instead of raw linking, because these store details about visits, downloads, installs and uninstalls. These metrics are used to prepare trending dapps.

Getting a dapp will always send it's global metrics.

Visit a dApp's Home Page

The URL to visit a dapp's home page should be constructed as below. The return value of getViewURL should be shown on the UI. When user clicks on it, they will be redirected to the dapp home page.



const basePath = process.env.STOREKIT_API_URL as string | 'https://api.meroku.store';

const dappId = "example.app";

const getViewURL = (base_path: string,
  dappId: string,
  userId: string | undefined,
  userAddress: string | undefined) => {
    if (!userId && !userAddress) {
      throw Error("One of userId or userAddress must be defined");
    }

    if (userId) {
      return `${base_path}/api/v1/o/view/${dappId}?userId=${userId}`;
    } else if (userAddress) {
      return `${base_path}/api/v1/o/view/${dappId}?userAddress=${userAddress}`;
    }
}

Download a dApp's Build


AnalyticsApi.new()

const getDownloadURL = (base_path: string,
  dappId: string,
  userId: string | undefined,
  userAddress: string | undefined) => {
    if (!userId && !userAddress) {
      throw Error("One of userId or userAddress must be defined");
    }

    if (userId) {
      return `${base_path}/api/v1/o/download/${dappId}?userId=${userId}`;
    } else if (userAddress) {
      return `${base_path}/api/v1/o/download/${dappId}?userAddress=${userAddress}`;
    }
}

In the UI the return value of getDownloadURL should be shown. When user clicks on it, they will be redirected to the download URL and the file will be automatically downloaded.

Post a rating for dapp by user


const analyticsApi = new AnalyticsApi({
    basePath: baseURL
});

const body: DappRating = {
  dappId: 'test_example.app',
  rating: 4,
  comment: 'comment from user',
  userId: 12
};
const response: DappRating = await analyticsApi.apiV1DappRatePost(body)

Get a rating for dapp by user


const dappId = 'test_example.dapp';
const userId = 2;
const userAddress = undefined;
const response: DappRating = await analyticsApi.apiV1DappRateGet(dappId, userId, userAddress);

Featured Section

Initialise the API as below.

const featuredApi = new FeaturedSectionApi({
	    basePath: baseURL
	});

Get Featured Sections and the dapps in them.

const featuredSections: Array<FeaturedSection> = await featuredApi.getFeaturedDAppsV1()

This should be iterated and shown on ui.

Get Store Title

Gets the title of the registry

const title: string = await featuredApi.getStoreTitleV1()

AppStores

  const storeApi = new StoreRegistryApi()

APis to interact with appStore's

Get/Search appStore's

const stores = await storeApi.searchStores()

Search store by storeId/key

const stores = await storeApi.searchStoresByStoreId('kailash')

Get appStore's by owner address

const stores = await storeApi.searchStoresByOwnerAddress('0xA0B867319e3fBb15181D118097b1069C6380222E')

Search for Autocomplete appStore's search

const stores = await storeApi.autocompleteStores('unstoppable')

Developers

  const developerApi = new DeveloperProfilesApi()

APis to interact with developer's

Get/Search developer's

const developers = await developerApi.searchDeveloperProfile()

Search store by storeId/key

const developers = await developerApi.searchDeveloperByDevId('kai.dev')

Get developer's by owner address

const developers = await developerApi.searchDeveloperByOwnerAddress('0xA0B867319e3fBb15181D118097b1069C6380222E')

Search for Autocomplete developer's search

const developers = await developerApi.autocompleteDeveloper('kai')