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

avatarid-js

v1.0.5

Published

AvatarID is a decentralized set of custom avatar protocols provided by Lifeform, and it allows users to customize their unique WEB3 avatars by holding NFTs (either 721 or 1155).

Downloads

4

Readme

Brief Introduction

AvatarID is a decentralized set of custom avatar protocols provided by Lifeform, and it allows users to customize their unique WEB3 avatars by holding NFTs (either 721 or 1155).

Contract Address

BSC Testnet

0xA4fC79e00BdD38722A7fA236d766B4f3f671bF09

BSC Mainnet

0x905De1Ac381b330c2C187cea0f1685E85a844390

Interface Descriptions

Set user-defined avatar

/**
  * set AvatarId
  * @collect avatar's contract address
  * @tokenId avatar id
  * @addr owner address
  * */
async setAvatar(collect, tokenId, addr)

Use case

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)
// collect address ,default is ''
AvatarIdSDK.setAvatar('',token_id,owner_address)

Reset user-defined avatar

/**
  * reset AvatarId
  * @addr owner address
  * @collect avatar's contract address
  * */
async resetAvatar(addr, collect)

Use case

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)
// collect address ,default is ''
AvatarIdSDK.resetAvatar(owner_address,'')

Get the user-defined avatar

/**
  * get the avatar nft list held by users
  * @collect avatar's contract address
  * @addr owner address
  * @page select a page, start at 0
  * @size page size
  * */
async getAvatarList(collect, addr, page, size)

Use case

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)
// collect address ,default is ''
AvatarIdSDK.getAvatarList('',owner_address,page_num,page_size)

Return case

[
  {
    image:'xxx',  //the avatar image url
    token_id:'xxx'//if user has not set the avatar, token id is -1
  },
  {
    image:'xxx',
    token_id:'xxx'
  }
]

Get the user-defined avatar

/**
  * get AvatarId details
  * @collect avatar's contract address
  * @addr owner address
  * */
async getStakeAvatarDetails(collect, addr)

Use case

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)
// collect address ,default is ''
AvatarIdSDK.getStakeAvatarDetails('',owner_address)

Return case

{
  image:'xxx',   //the avatar image url
  token_id:'xxx' //if user has not set the avatar, token id is -1
}

Approve avatar asset authorites

/**
  * approve avatar
  * @collect avatar's contract address
  * @addr owner address
  * @type collect type
  * */
async approve(collect, addr, type)

Use casae

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)
// collect address ,default is ''
AvatarIdSDK.approve('',owner_address,collect_type)

How to Integration

install sdk

npm i avatarid-js

import api

import AvatarId from 'avatarid-js'

To initialize the API, you need to create the provider first, and then construct the avatarid instance.

const web3 = new Web3(ethereum)
const AvatarIdSDK = new AvatarId(web3)

TIPS

1.From getStakeAvatarDetails, you can check the details of the current custom avatar, if the user has not set it, there will be a default avatar.

2.If it needs to support user-defined avatars, the approved interface of the asset contract is required for authorization operations. After the authorization is passed, set the avatar by calling setAvatar, or guide the user to the setting page of the Lifeform official website. https://www.lifeform.cc/avatarid

3.For the case where the user wants to cancel this function, it needs to execute the resetAvatar interface to complete it and return the assets staked by the user.

4.If any project needs support to use their own NFT as a custom avatar, please send an email to: [email protected]