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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@samudai_xyz/web3-sdk

v0.0.60

Published

## All in one web3 integrations for Samudai

Downloads

297

Readme

web3-sdk-samudai

All in one web3 integrations for Samudai

Current Integrations on SDK

SDK currently has the following for the web3 integrations

  • Gnosis - Gnosis for onchain payments
  • Lit Protocol - For token gating
  • NFT-PPFs - Fetching of NFT profile photos for users
  • SIWE - Sign in with ethereum
  • Snapshot - Snapshot for proposals

Installation

Dillinger requires Node.js.

npm i web3-sdk-samudai

Usage

The SDK has the following components and the below table provides an overview to initialize them.

| Plugin | README | | ------------ | --------------------------------------------------------------------------------------------- | | Gnosis | const gnosis = new Gnosis(provider: Web3Provider, chaindId: number) | | Lit Protocol | const litProtocol = new LitProtocol() | | NFT PPFs | const nftPPfs = new NFTProfile() | | SIWE | const siwe = new Siwe(provider: Web3Provider) | | Snapshot | const snapshot = new Snapshot(spaceId: string, networkType: number, provider: Web3Provider) |

Gnosis APIs

Gnosis APis are used to create transactions on the multisig and fetch transactions.

To use Gnosis

Initialize gnosis:

const gnosis = new Gnosis(provider: Web3Provider, chaindId: number)

To create a single gnosis transaction

const result = await gnosis.createSingleGnosisTx(receiverAddress: string, value: string,
safeAddress: string, senderAddress: string)

Param 1: safeAddress Gnosis safe address. Param 2: receiverAddress Wallet address of the user whom the funds is being sent. Param 3: value ETH value in wei. Param 4: senderAddress Waller address of the sender

To create a batch gnosis transaction

const result = await gnosis.createBatchGnosisTx(safeAddress: string, receiverAddresses: string[],
value: string, senderAddress: string)

Param 1: safeAddress Gnosis safe address. Param 2: receiverAddresses Wallet addresses of the users whom the funds is being sent. Param 3: value ETH value in wei. Param 4: senderAddress Waller address of the sender

To get pending transactions for a safe

const result = await gnosis.getPendingTransactions(safeAddress: string)

Param 1: safeAddress Gnosis safe address.

Example

const result = await gnosis.getPendingTransactions("0xE666431e8Ba10B17D296aB16A4FF8d9A552eb488")

To get past / executed transactions for a safe

const result = await gnosis.getExecutedTransactions(safeAddress: string)

Param 1: safeAddress Gnosis safe address.

Example

const result = await gnosis.getExecutedTransactions("0xE666431e8Ba10B17D296aB16A4FF8d9A552eb488")

To get transactions details, status of a transactions for a safe transaction hash

const result = await gnosis.getTransactionDetails(safeTxHash: string)

Param 1: safeTxHash Transaction hash of a particular safe transaction.

Example

const result = await gnosis.getTransactionDetails("0x4a429ae97dd5bac92e9eef8e28fba94cf8813474c485228e58d81f04c332c399")

To connect a gnosis safe

const result = await gnosis.connectGnosis(userAddress: string)

Param 1: userAddress User address

This will return the safes for which user is an owner and also list of all other owners for a safe

Example

const result = await gnosis.gnosisConnect("0x4a429ae97dd5bac92e9eef8e28fba94cf8813474c485228e58d81f04c332c399")

NFT Profile APIs

NFT Profile APIs are used to fetch the NFTs owned by the user on ETH and Polygon which can later be set as profile photos

Initialize NFT Profile Photos:

const nftProfile = new NFTProfile()

To get ETH based NFTs

const ethNFTs = await nftProfile.getEthProfilePPs(ethUserAddress: string)

Param 1: ethUserAddress Wallet Address of the user.

Example

const ethNFTs = await nftProfile.getEthProfilePPs(0xB1BFB38a527D05442D48068ca9798FD3E5d6ce0F)

To get Polygon based NFTs

const polygonNFTs = await nftProfile.getMaticProfilePPs(maticUserAddress: string)

Param 1: maticUserAddress Wallet Address of the user.


Lit Protocol APIs

Lit Protocol APIs are used to for token gating

To use Lit Protocol

Initialize Lit Protocol:

const litProtocol = new LitProtocol()

To create a Lit protocol gating

const tokenGating = await litProtocol.init(
    chain: string,
    contractAddress: string,
    typeOfGating: TokenGatingType,
    baseUrl: string,
    path: string,
    memberId: string,
    tokenId?: string
)

Param 1: chain The chain on which the Token Gating will be created. Refer the list of chains below the example. Param 2: contractAddress Contract Address of the Token. Param 3: typeOfGating Enum value of which type of Gating. Refer the enum list below the example. Param 4: baseUrl Url of the url of frontend. Param 5: path The Path that requires the token gating. Param 6: memberId Member UUID that is being authenticated. Param 7: tokenId Token ID of a NFT for verification.

Returns: jwt JWT token can be set on cookies or anything on the frontend and needs to be sent to SDK for verification

Example

const tokenGating = await litProtocol.init(
    chain: "rinkeby",
    contractAddress: "0xB1BFB38a527D05442D48068ca9798FD3E5d6ce0F",
    typeOfGating: 0,
    baseUrl: "http://samudai.xyz",
    path: '/dao/f298865a-c3a3-46e1-8ff6-ffd63ec23257',
    memberId: aaaff17d-c166-430d-9afc-82c88394c7b8,
)

List of chains | chain | | ------ | | ethereum | | rinkeby | | polygon | | goerli | | mumbai |

For further chain supports based on EVM use the following list https://developer.litprotocol.com/supportedChains

Enum for TokenGatingType

enum TokenGatingType = {
  ERC20,
  ERC721,
  ERC1155,
}

ERC20 = 0
ERC721 = 1
ERC1155 = 2

To verify the user

const result = await litProtocol.verifyLit(jwt: string, memberId: string)

Param 1: jwt JWT generated by the init functionality. Param 2: memberId Member UUID

Returns: verifyLit returns true / false based on the access conditions


SIWE

SIWE is used for Sign in with ethereum

To use SIWE

Initialize SIWE:

const siwe = new Siwe(provider: Web3Provider)

To sign in user, you need to ask the user to sign a message and push the users to required screen after successful signing

const result = siwe.walletSignIn(domain: string)

Param 1: domain URL of the frontend

Example

const result = siwe.walletSignIn("https://samudai.xyz")

Snapshot

Snapshot is used for fetching proposals and voting for them.

To use snapshot

Initialize Snapshot:

const snapshot = new Snapshot(spaceId: string, networkType: number, provider: Web3Provider)

Param 1: spaceId Space ID in Snapshot Param 2: networkType 0 for Ethereum, 1 for testnets Param 3: provider Web3Provider

Example

const snapshot = new Snapshot("biryani.eth", 1, provider)

To get information about a Space

const result = snapshot.getSpace()

To get active proposals

const result = snapshot.getActiveProposals()

To get Recent proposals

const result = snapshot.getRecentProposals()

To cast a vote

const result = snapshot.castVote(proposalId: string, choice: number,account: any)