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

@nervina-labs/cota-sdk

v0.9.2

Published

The SDK of CoTA

Downloads

87

Readme

cota-sdk-js

License CI NPM

JavaScript SDK for CoTA.

CoTA Docs

Installation

$ npm i @nervina-labs/cota-sdk
# or
$ yarn add @nervina-labs/cota-sdk

Prerequisites

CoTA SDK needs to run the services as blow:

  • CKB Node: Nervos CKB Node
  • CKB Indexer: Fetch live cells and transactions with filters
  • CoTA Syncer: Parse CoTA witness SMT data from CKB blockchain history transactions and save it to the mysql database
  • CoTA Registry Aggregator: Generate SMT info using the data from the database for registry and provide RPC APIs
  • CoTA Aggregator: Generate SMT info using the data from the database for CoTA NFT actions and provide RPC APIs

The above services are valid only when synced to the latest block and we strongly suggest to run the services in mainnet by yourself.

Public ckb node url and ckb indexer url as blow can be used to develop and test

# mainnet:
https://mainnet.ckbapp.dev/rpc       --->  ckb mainnet node rpc
https://mainnet.ckbapp.dev/indexer   --->  ckb mainnet indexer rpc

# testnet:
https://testnet.ckbapp.dev/rpc       --->  ckb testnet node rpc
https://testnet.ckbapp.dev/indexer   --->  ckb testnet indexer rpc

Public aggregator rpc url as blow can be used to develop and test

# mainnet:
https://cota.nervina.dev/mainnet-aggregator            --->  cota aggregator rpc
https://cota.nervina.dev/mainnet-registry-aggregator   --->  cota registry aggregator rpc

# testnet:
https://cota.nervina.dev/aggregator                    --->  cota aggregator rpc
https://cota.nervina.dev/registry-aggregator           --->  cota registry aggregator rpc

CoTA NFT Flow

                     Register CoTA cell firstly
1. Alice & Bob & Tom ----------------------------------> Alice CoTA cell & Bob CoTA cell & Tom CoTA cell

          Define CoTA NFT               Mint CoTA NFT A to receivers
2. Alice -----------------------> NFT A -----------------------------------> Receivers (Bob)

                    Claim NFT A                                  Withdraw NFT A to Tom
       Action1 |-------------------------> Bob hold NFT A now ----------------------------------> Bob doesn't hold NFT A now
      |             Transfer NFT A to Tom
3. Bob Action2 |-----------------------------------> Bob doesn't hold NFT A now
      |           Update CoTA NFT A information
       Action3 |-----------------------------------> Bob hold CoTA NFT A with new information

                    Claim NFT A                                 Withdraw NFT A to other receivers
        Action1 |-------------------------> Tom hold NFT A now ----------------------------------> Tom doesn't hold NFT A now
4. Tom |         Transfer NFT A to other receivers
        Action2 |-----------------------------------> Tom doesn't hold NFT A now
  • Registry: Every address should be registered firstly
  • Define: The issuer can define a collection NFTs with total/name/description/image etc.
  • Mint: The issuer mint the defined NFTs to the receivers (withdraw to the receivers actually)
  • Claim: The receiver can claim the NFT from the mint, and now the receiver hold the NFT
  • Update: The holder of NFT can update the information (characteristic/state etc.)
  • Withdraw: The holder of NFT can withdraw the NFT to any other CKB address
  • Transfer: To simplify, transfer combines the claim and withdraw into one operation. The receiver can claim the NFT from the mint and withdraw the same NFT to others in a transaction.

Examples