New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bandada/utils

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bandada/utils

General Bandada utility functions.

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-51.16%
Maintainers
3
Weekly downloads
 
Created
Source

Bandada utils

General Bandada utility functions.

Github license NPM version Downloads Linter eslint Code style prettier

👥 Contributing   |   🤝 Code of conduct   |   🔎 Issues   |   🗣️ Chat & Support
This package provides simple utility functions that can be used by Bandada itself or externals.

🛠 Install

npm or yarn

Install the @bandada/utils package with npm:

npm i @bandada/utils

or yarn:

yarn add @bandada/utils

📜 Usage

# request(url: string, config?: AxiosRequestConfig): Promise<any>

Makes a request using Axios.

import { request } from "@bandada/utils"

const url = "https://api.bandada.pse.dev/groups"
const config = {
    headers: {
        "Content-Type": "application/json"
    },
    baseURL: "https://api.bandada.pse.dev"
}
const group = await request(url, config)

# shortenAddress(address: string, chars: number): string

Returns a shorter address.

import { shortenAddress } from "@bandada/utils"

const address = shortenAddress("0x1234567890123456789012345678901234567890")

# getProvider(network: Network, apiKey?: string): JsonRpcProvider

Returns the provider to communicate with the blockchain.

import { getProvider } from "@bandada/utils"

const provider = getProvider("localhost")

# getContract(contractName: ContractName, network: Network, privateKeyOrSigner?: string | Signer, apiKey?: string): Contract

Returns an Ethers contract.

import { getContract } from "@bandada/utils"

const contractName = "Semaphore"
const network = "localhost"
const contract = getContract(contractName, network)

# getSemaphoreContract(network: Network, privateKeyOrSigner?: string | Signer, apiKey?: string): SemaphoreContract

Returns a new instance of the SemaphoreContract class.

import { getSemaphoreContract } from "@bandada/utils"

const semaphore = getSemaphoreContract("localhost")

# getBandadaContract(network: Network, privateKeyOrSigner?: string | Signer, apiKey?: string): BandadaContract

Returns a new instance of the BandadaContract class.

import { getBandadaContract } from "@bandada/utils"

const bandada = getBandadaContract("localhost")

# getWallet(privateKey: string, network?: Network, apiKey?: string): JsonRpcProvider

Returns an Ethers wallet.

import { getWallet } from "@bandada/utils"

const privateKey =
    "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
const wallet = getWallet(privateKey)

# getContractAddresses(networkName: Network): { Bandada: string, Semaphore: string, BandadaSemaphore: string }

Returns the contract addresses for the Bandada, Semaphore and BandadaSemaphore smart contracts.

import { getContractAddresses } from "@bandada/utils"

const addresses = getContractAddresses("sepolia")

FAQs

Package last updated on 18 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc