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

@bethelnet/utils

v1.0.3

Published

Bethel node connection library

Downloads

11

Readme

How to Use the @bethel/utils Package

The @bethel/utils package simplifies interactions with Ink! nodes, making tasks like wallet creation, connecting to smart contracts, and more seamless.


Installation

Install the package via npm:

npm install @bethel/utils

Features

The @bethel/utils package provides multiple functionalities to interact with Ink! nodes, including:

  • Wallet creation
  • Connecting to smart contracts
  • Fetching wallet balances
  • Transferring funds between wallets

Usage

1. Connect to an Ink! Node

To connect to an Ink! node, you need to establish a WebSocket connection. Follow these steps:

Import the Bethel library:

import { bethel } from "@bethel/utils";

Create an instance for API connection:

const bethelNode = new bethel("your-websocket-url");

Connect to the API:

const connectApi = bethelNode.connect();

This method creates an API connection to the Ink! node and returns a success or failure message.


2. Create a Wallet

You can create a wallet using the following method:

Syntax:

const wallet = bethelNode.createWallet("Wallet Name");
  • Parameters: Pass the wallet name as a string.
  • Returns: The method returns the wallet's public key, private key, and additional wallet information.

3. Get Wallet Balance

Retrieve the balance of your wallet:

Syntax:

const balance = bethelNode.getBalance();
  • Returns: The method fetches and returns the wallet balance.

4. Wallet Transfers

Transfer funds between wallets using the following method:

Syntax:

const txHash = bethelNode.makeTransfer(recipientAddress, amount);
  • Parameters:
    • recipientAddress: The address of the recipient wallet.
    • amount: The amount to transfer.
  • Returns: The method returns the transaction hash.

5. Connect to Smart Contracts

To interact with a smart contract, you need the contract's metadata and address:

Syntax:

const contract = bethelNode.connectToContract(metaData, address);
  • Parameters:
    • metaData: The metadata of the smart contract.
    • address: The address of the smart contract.
  • Returns: The method returns the contract instance for further interactions.

Example Workflow

Below is an example workflow demonstrating key functionalities:

import { bethel } from "@bethel/utils";

// Step 1: Create an instance and connect to the node
const bethelNode = new bethel("wss://example-node-url");
const connectApi = bethelNode.connect();

if (connectApi.success) {
  console.log("Connected to the node successfully!");

  // Step 2: Create a wallet
  const wallet = bethelNode.createWallet("MyWallet");
  console.log("Wallet created:", wallet);

  // Step 3: Get wallet balance
  const balance = bethelNode.getBalance();
  console.log("Wallet balance:", balance);

  // Step 4: Transfer funds
  const txHash = bethelNode.makeTransfer("recipient-address", 1000);
  console.log("Transaction hash:", txHash);

  // Step 5: Connect to a smart contract
  const contract = bethelNode.connectToContract(metaData, "contract-address");
  console.log("Connected to contract:", contract);
} else {
  console.error("Failed to connect to the node:", connectApi.error);
}

Notes

  • Ensure you use a valid WebSocket URL for the Ink! node.
  • Handle errors gracefully by checking the return values of each method.
  • For more detailed documentation, refer to the official library documentation.

Start leveraging the power of the @bethel/utils package to simplify your blockchain interactio