0.9.2 • Published 8 months ago

@nervina-labs/cota-sdk v0.9.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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

0.9.2

8 months ago

0.9.1

12 months ago

0.9.0

1 year ago

0.8.0

1 year ago

0.6.6

2 years ago

0.7.1

2 years ago

0.6.5

2 years ago

0.6.3

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.8

2 years ago

0.5.4

2 years ago

0.4.5

2 years ago

0.5.3

2 years ago

0.5.6

2 years ago

0.4.7

2 years ago

0.5.5

2 years ago

0.4.6

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.3.0

2 years ago

0.4.4

2 years ago

0.2.6

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.3

2 years ago

0.2.5

2 years ago

0.4.2

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.7

2 years ago

0.2.3

2 years ago

0.1.4

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.2.4

2 years ago

0.1.5

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago