Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@seda-protocol/utils

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seda-protocol/utils

This library contains utility functions that are used throughout SEDA Typescript projects. It's part of the explorer monorepo as this tends to use most of the code which makes testing it a little easier.

  • 1.0.0
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

seda-utils

This library contains utility functions that are used throughout SEDA Typescript projects. It's part of the explorer monorepo as this tends to use most of the code which makes testing it a little easier.

Using the library

There are two main entrypoints to this library:

@seda-protocol/utils

The @seda-protocol/utils entrypoint contains the main library code and types. You can import it into the application code directly and make use of the provided functions.

Example:

import { tryAsync } from "@seda-protocol/utils";

const result = await tryAsync(async () => {
	const response = await fetch("https://api.seda.xyz/v1/health");
	return response.json();
});

if (result.isErr) {
	console.error(result.error);
	return;
}

// Safe to access the value
const data = result.value;

@seda-protocol/utils/testing

The @seda-protocol/utils/testing entrypoint contains custom matchers which can be used in tests. Most likely you will want to create a setup.ts file which will import this library and pass that file to Bun's test runner with the --preload flag.

Example:

// setup.ts
import "@seda-protocol/utils/testing";
bun test --preload=./setup.ts

In addition to the matchers this entrypoint also exports other utilities which might be useful in tests.

Example:

import { unwrapResult } from "@seda-protocol/utils/testing";

const result = doCoolThingWhichMightFail();
// Directly access the value, will fail if the result is an error
const value = unwrapResult(result);

Developing

Assumptions

As we target Bun as the runtime the library directly exposes the TypeScript files and doesn't any build/transpilation step.

Dependencies

This library should list dependencies as peerDependencies. This allows consuming projects to have more control over the dependency versions.

FAQs

Package last updated on 30 Sep 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