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

@mpaucot/react-sdk

v1.0.2

Published

<p align="center"> <a href="" rel="noopener"> <img width=200px height=200px src="https://i.imgur.com/6wj0hh6.jpg" alt="kanji logo"></a> </p>

Downloads

5

Readme

Status GitHub Issues GitHub Pull Requests License


🧐 About

With Kanji, you can create and customize your NFTs collections and monitor them in the long. This nom package is meant to enable your developers to integrate the sale of your collection directly on your own website. It is written in Typescript, so is usable in any Javascript front end format. This is only a V1, much more to come next, enjoy!

🏁 Getting Started

Prerequisites

You will need start to install nodeJs and npm library.

Installing

The installation of the npm package is very simple, just open a terminal window in the root of your project and copy-paste the following lines:

npm i @kanjiwolrd/react-sdk
//or
yarn add @kanjiworld/react-sdk

🎈 Usage

To use our package, your first need to import the kanji library:

import { KanjiSDK } from '@kanji/react-sdk';

Pour utiliser notre package directement sans passé par nos composants react, instancier le SDK de la manière suivante : As the first you need to instantiate the SDK by using following line:

///@dev instanciate kanjiSDK
const kanjiSDK = KanjiSDK.getInstance();

To communicate and load revelant datas for your customer, please provide your API KEY (no critical or private datas are loaded, you can use this API key in your front end code):

///@dev set your api key for return good collection and call API
kanjiSDK.setApiKey(api_key);

CONNECTION


connectToKanjiAccount

To connect your customers to the blockchain you need to use WEB3 modal, this will enable your customer to connect throw the wallet of their choice:

  • metamask
  • torus
  • portis
  • walletConnect
  • ledger

To open the modal and perform connection please use the following line of code:

//if getNewSignature == true your provider (metamask or other) gonna request a signature and if false it gonna search if signature is stored and valid
kanjiSDK.connectWeb3(getNewSignature = true):jwt;

To disconnect your customer, use :

//@dev disconnect user
kanjiSDK.disconnectWeb3();

WEB2 CALLS

The following methods can be called, once you a mentioned your API key, in kanjiSDK.setApiKey(api_key) and grants you access to your releavant collections datas

CLAIMCONDITIONS

The follow method enables you to get all the sell phases (AKA claimConditions) that you created on Kanji platform to enable your customers to claim tokens of given collection for a certain price and conditions.

///@dev return an array of object claim condition
async kanjiSDK.getClaimCondition(collection: collectionInterface):Promise<ClaimConditionInterface>

COLLECTIONS

To get all of yours created collections you can use the following method:

///@dev Return all collections of brand api_key
async kanjiSDK.getCollections():Promise<Array<CollectionInterface>>

WEB3 CALLS

The follow methods all require your customers to be connected to the blockchain, because they are meant to communicate with it

CLAIMCONDITIONS

To get the next active (or already active) claim condition, you can use the following web3 method:

async kanjiSDK.getActiveClaimCondition(collection: collectionInterface)

CLAIM

For your customer to be able to claim an nft of a specific collection, you can use the following web3 method:

/// @dev Enable a customer to buy a quantity of nft of a specific collection and return the hash of the performed transaction on the blockchain
async kanjiSDK.claim(
  collection: CollectionInterface,//must be collection interface from which the customer want to claim
  quantity: number,//must be the quantity of nfts the customer want to buy
):Promise<string>

INTERFACES

//interface type of collection required to call some function
import {
  CollectionInterface,
  NftInterface,
  ClaimCondition,
} from '@kanji/react-sdk';

export interface ClaimCondition {
  startTimestamp: number;
  endTimestamp: number;
  maxClaimableSupply: number;
  supplyClaimed: number;
  quantityLimitPerTransaction: number;
  waitTimeInSecondsBetweenClaims: number;
  merkleRoot: string;
  pricePerToken: string;
  currency: string;
}

export interface CollectionInterface {
  _id?: string;
  name: string;
  symbol: string;
  description: string;
  thumbnail: string;
  maxMint: number;
  contract?: Contract;
  claimConditions: Array<ClaimCondition>;
}

export interface NftInterface {
  name: string;
  description: string;
  thumbnail: string;
  attributes: Array<Attribute>;
  tokenId: number;
}