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

@unique.vc/udm.js

v1.0.1

Published

UDM - Unique Delegation Manager is a simple yet efficient solution allowing to bridge self-custody and user experience, have best from both worlds and potentially extend the reach of the industry.

Downloads

5

Readme

Unique Delegation Manager (UDM) Javascript SDK

Unique Delegation Manager (UDM) is a toolset built for managing a "master-delegate" relationship between 1-to-many wallets. Use UDM SDK to interact with UDM Solana program and accounts.

The main account to interact with is the delegation account. The delegation account is essentialy an on chain statement which confirms that the representative has the authority to execute smart contract actions that are otherwise reserved for the master. This account can also be used by projects to display asset ownership by proxy and give other logical priviledges. The two parties involved in the delegation proccess are master and representative. The master is the one who initiated the delegation account. The representative is the one who was invited to represent the master.

Installation

For use in Node.js or a web application

$ npm install --save @unique.vc/udm.js

Main features

Check if delegation between master and representative exists

checkIfDelegationExists - This SDK function checks if the delegation account for passed master and representative public keys exists and if it is confirmed.

Get delegation address

getDelegationAddress - This SDK function returns address of the delegation PDA for specific master and representative public keys.

Get all masters for specific representative

getMastersForPublicKey - This SDK function returns all delegation accounts with master addresses that are confirmed and related to the passed representative public key.

Get all representatives for specific master

getRepresentativeForPublicKey - This SDK function returns all delegation accounts with representative addresses that are confirmed and related to the passed master public key.

Example

import { useAnchorWallet } from "@solana/wallet-adapter-react";
import { Connection } from "@solana/web3.js";
import { getMastersForPublicKey, IDelegation } from "@unique.vc/udm.js";
import { FC, useEffect, useState } from "react";

export const SOLANA_ENDPOINT = "https://api.devnet.solana.com";
export const RPC_CONNECTION = new Connection(SOLANA_ENDPOINT, "confirmed");

const UdmExample: FC = () => {
  const [allDelegations, setAllDelegations] = useState<IDelegation[]>();
  const wallet = useAnchorWallet();

  useEffect(() => {
    void getAllDelegationsForRepresentative();
  }, [wallet]);

  const getAllDelegationsForRepresentative = async () => {
    if (wallet) {
      const allDelegationsForRepresentativeFromSDK =
        await getMastersForPublicKey(wallet.publicKey, RPC_CONNECTION);
      setAllDelegations(allDelegationsForRepresentativeFromSDK);
    }
  };

  return (
    <div>
      <p>Representative: {wallet?.publicKey.toString()}</p>
      <p>Masters:</p>
      {allDelegations?.map((item) => (
        <div>
          <p>{item.master.toString()}</p>
        </div>
      ))}
    </div>
  );
};

export default UdmExample;

Live demo - UDM dapp

Unique delegation manager Dapp