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

dotbit-sdk-allin

v0.4.19

Published

A complete .bit SDK and utilities in TypeScript

Downloads

192

Readme

NPM npm

This is the new version of .bit (previously known as DAS) JavaScript SDK. If you are looking for the source code of the deprecated npm package das-sdk, please visit the das-sdk branch on GitHub.

Table of Contents

Features

  • Query .bit account info (e.g. owner, manager, status, etc.)
  • Query .bit account records (e.g. addresses, profiles, dwebs and custom data.)
  • Enable .bit SubDID for a specific account.
  • Mint a SubDID of a .bit main account.
  • Query all the SubDIDs of a .bit main account.
  • Manage the ownership of a .bit account(SubDID included).
  • Manage the records of a .bit account(SubDID included).
  • Register a .bit account with CKB.

Getting Started

First, you need to install Dotbit.js using npm

npm install dotbit --save

or yarn.

yarn add dotbit

Then, you need to import Dotbit.js SDK in your code and create an instance before interacting with it:

// For CommonJS
const { createInstance } = require('dotbit')
const dotbit = createInstance()
// For ES Module
import { createInstance } from 'dotbit'
const dotbit = createInstance()

Now you could perform various operations using Dotbit.js SDK. Here is a simple example:

// Get the account info of a .bit account
dotbit.accountInfo("imac.bit").then(console.log)

A sample result would be like:

{
  account: 'imac.bit',
  account_alias: 'imac.bit',
  account_id_hex: '0x5728088435fb8788472a9ca601fbc0b9cbea8be3',
  next_account_id_hex: '0x57280ab92f213d74c7a185e9b9d26d0a795108de',
  create_at_unix: 1671164348,
  expired_at_unix: 1702700348,
  status: 0,
  das_lock_arg_hex: '0x05b2be2887a26f44555835eeacc47d65b88b6b42c205b2be2887a26f44555835eeacc47d65b88b6b42c2',
  owner_algorithm_id: 5,
  owner_key: '0xb2be2887a26f44555835eeacc47d65b88b6b42c2',
  manager_algorithm_id: 5,
  manager_key: '0xb2be2887a26f44555835eeacc47d65b88b6b42c2'
}

For more details about each API, you could refer to our API Documentation. We also provide code examples here: For browser, For Node.js.

CHANGELOG

CHANGELOG

API Documentation

Plugins

.bit has partnerships with the greatest teams & projects in the ecosystems. Dotbit.js offers a simple and powerful plugin system that allows us to add advanced features to this library.

Usage

Basically, you can install and use a plugin like the codes below.

import { PluginXXX } from 'dotbit-plugin-xxx'
import { createInstance } from 'dotbit'

const dotbit = createInstance()
dotbit.installPlugin(new PluginXXX())
dotbit.methodAddedByXXX()

For detailed usage, please follow the instructions in the specific plugin's README.

List of plugins

Write your own plugin

Write a plugin for .bit is easy!

If you want to write a plugin for your or other projects, please follow the same structure of plugin template.

FAQ

What is coin_type?

coin_type is a way to distinguish between different coins or blockchain networks using the Coin Types defined in SLIP 44. For example, the coin_type for ETH is 60, the coin_type for BTC is 0, and the coin_type for BNB is 714, etc.

Which coin_type does .bit support?

.bit uses coin_type in a few different ways:

  • .bit uses coin_type to identify each chain or coin in .bit records. In this case, .bit supports all coin_type values defined in SLIP 44.
  • .bit uses coin_type to identify different types of owner/manager key information. For example, you can use an ETH address (coin_type: 60) as your .bit owner and a TRON address (coin_type: 195) as your manager.

For a complete list of coin_type values that .bit supports in key_info, please see const.ts.

Get Help

If you have questions or need help with Dotbit.js, there are several ways to get assistance:

Contribute

We welcome contributions to Dotbit.js! If you are interested in helping to improve the project, there are several ways you can contribute:

  • Report bugs or suggest improvements by opening an issue on the GitHub repository.
  • Submit a pull request with your changes to the code.

Please note that Dotbit.js SDK is still under development, so any contribution (including pull requests) is welcome.

License

Dotbit.js (including all dependencies) is protected under the MIT License. This means that you are free to use, modify, and distribute the software as long as you include the original copyright and license notice. Please refer to the license for the full terms.