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

@anima_protocol/personhood-sdk-web-component

v0.1.0-rc23

Published

Anima Webcomponent SDK

Downloads

28

Readme

personhood-sdk-web-component

Personhood SDK

Visit anima.io | Read the Anima documentation

enter image description here

Install

In your index html

In your index.html add this in the head:

    <script
      src="https://unpkg.com/@anima_protocol/[email protected]/dist/index.js"
    ></script>

With Yarn

first

yarn add @anima_protocol/personhood-sdk-web-component

after in your index

import  "@anima_protocol/personhood-sdk-web-component"

With NPM

first

npm install @anima_protocol/personhood-sdk-web-component

after in your index

import  "@anima_protocol/personhood-sdk-web-component"

Usage

<anima-personhood
    session-id="SESSION_ID"
    chain-id="CHAIN_ID"
    address="ADDRESS"
/>

Attributes list

| Attribute name | Attribute type | Default | Required | Description | | ------------------ | --------------------------------------------------------------------------------------------------- | ------- | -------- | ----------------------------------------------------------------------------- | | session-id | string | '' | Y | Session can be referred as a customer verification session. More info | | address | string | '' | Y | Your user account Web3 wallet address | | chain-id | string | '1' | N | Your Web3 wallet chain id |

Event

sign

This event is triggered when the user wants to sign their proof to share it or create an anima

document.getElementsByTagName("anima-personhood").addEventListener("sign", async (e) => {
    try {
    const data = await YOUR_WALLET.sign(e.detail.payload);
    e.detail.signSuccess(data);
    } catch (error) {
    e.detail.signError(error);
    }
})
  1. payload: string The data to sign detail.data.
  2. signSuccess: (signature: string) => void If the sign is success you can send the signature to the SDK with this callback When the signing is successful, you can send the signature to the SDK with this callback detail.signSuccess(data).
  3. signError: (signature: unknown) => void When you have an error in the signature, you can send the error to the SDK with this callback detail.signError(error).

shared

document.getElementsByTagName("anima-personhood").addEventListener("shared", async (e) => {
   if(e.detail.verified) {

   } else {

   }
})

This event is triggered when the user has shared their proof. Then you have e.detail.verified: boolean is True when the user is successfull onboarded

Fixing WebComponent lint issues

React

Create index.d.ts in your root project (src) then add this to solve your lint error:

import { DOMAttributes, DetailedHTMLProps, HTMLAttributes } from 'react'

interface SignEvent extends CustomEvent {
    detail: {
        payload: string
        signSuccess: (param: string) => void
        signError: (e: unknown) => void
    }
}
interface SharedEvent extends CustomEvent {
    detail: {
        verified: boolean
    }
}
interface HTMLAnimaPersonhoodEventMap extends HTMLElementEventMap {
    sign: SignEvent
    shared: SharedEvent
}

interface HTMLAnimaPersonhoodElement extends HTMLElement {
    addEventListener<K extends keyof HTMLAnimaPersonhoodEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLAnimaPersonhoodEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
    removeEventListener<K extends keyof HTMLAnimaPersonhoodEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLAnimaPersonhoodEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
}

export interface AnimaPersonhoodHTMLAttributes<T> extends HTMLAttributes<T> {
    address: string
    ['chain-id']?: string
    ['session-id']: string
    ['storj-url']?: string
    ['synaps-url']?: string
}

declare global {
    namespace JSX {
        interface IntrinsicElements {
            ['anima-personhood']: DetailedHTMLProps<AnimaPersonhoodHTMLAttributes<HTMLAnimaPersonhoodElement>, HTMLAnimaPersonhoodElement>;
        }
    }
}

Examples

React

Edit react

License

Apache 2.0 © Anima