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

@dfinity/utils

Package Overview
Dependencies
Maintainers
10
Versions
887
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/utils

A collection of utilities and constants for NNS/SNS projects.

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5K
decreased by-7.97%
Maintainers
10
Weekly downloads
 
Created
Source

utils-js

A collection of utilities and constants for NNS/SNS projects.

npm version GitHub license

Table of contents

Installation

You can use utils-js by installing it in your project.

npm i @dfinity/utils

The bundle needs peer dependencies, be sure that following resources are available in your project as well.

npm i @dfinity/agent @dfinity/candid @dfinity/principal

Features

utils-js implements following features:

:toolbox: Functions

:gear: defaultAgent
FunctionType
defaultAgent() => Agent
:gear: createServices
FunctionType
createServices<T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, }, idlFactory, certifiedIdlFactory, }: { options: RequiredCanisterOptions<T>; idlFactory: InterfaceFactory; certifiedIdlFactory: InterfaceFactory; }) => { ...; }
:gear: uint8ArrayToBigInt
FunctionType
uint8ArrayToBigInt(array: Uint8Array) => bigint
:gear: arrayBufferToUint8Array
FunctionType
arrayBufferToUint8Array(buffer: ArrayBuffer) => Uint8Array
:gear: uint8ArrayToArrayOfNumber
FunctionType
uint8ArrayToArrayOfNumber(array: Uint8Array) => number[]
:gear: arrayOfNumberToUint8Array
FunctionType
arrayOfNumberToUint8Array(numbers: number[]) => Uint8Array
:gear: asciiStringToByteArray
FunctionType
asciiStringToByteArray(text: string) => number[]
:gear: assertNonNullish
FunctionType
assertNonNullish<T>(value: T, message?: string) => asserts value is NonNullable<T>
:gear: toNullable
FunctionType
toNullable<T>(value?: T) => [] or [T]
:gear: fromNullable
FunctionType
fromNullable<T>(value: [] or [T]) => T
:gear: fromDefinedNullable
FunctionType
fromDefinedNullable<T>(value: [] or [T]) => T

:factory: NullishError

Constructors

public

Parameters:

  • message

Keywords

FAQs

Package last updated on 26 Sep 2022

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