Socket
Socket
Sign inDemoInstall

@walletconnect/utils

Package Overview
Dependencies
1
Maintainers
1
Versions
582
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @walletconnect/utils

Utility Library for WalletConnect


Version published
Weekly downloads
521K
decreased by-1.35%
Maintainers
1
Created
Weekly downloads
 

Package description

What is @walletconnect/utils?

@walletconnect/utils is a utility library for WalletConnect, providing various helper functions to facilitate the development of WalletConnect integrations. It includes utilities for encoding, decoding, and other common operations needed when working with WalletConnect.

What are @walletconnect/utils's main functionalities?

Encoding and Decoding

This feature allows you to encode and decode data, which is useful for transmitting data securely between clients and servers.

const { encode, decode } = require('@walletconnect/utils');

const data = 'Hello, WalletConnect!';
const encodedData = encode(data);
const decodedData = decode(encodedData);

console.log(encodedData); // Encoded data
console.log(decodedData); // 'Hello, WalletConnect!'

Hex Conversion

This feature provides functions to convert numbers to hexadecimal strings and vice versa, which is often needed in blockchain and cryptographic applications.

const { toHex, fromHex } = require('@walletconnect/utils');

const number = 255;
const hexString = toHex(number);
const numberFromHex = fromHex(hexString);

console.log(hexString); // '0xff'
console.log(numberFromHex); // 255

Random Bytes Generation

This feature allows you to generate random bytes, which can be used for creating secure keys or nonces.

const { generateRandomBytes } = require('@walletconnect/utils');

const randomBytes = generateRandomBytes(16);

console.log(randomBytes); // Random 16 bytes

Other packages similar to @walletconnect/utils

Readme

Source

WalletConnect Utils

Utility Library for WalletConnect

API


// ArrayBuffer
function convertArrayBufferToBuffer (arrayBuffer: ArrayBuffer): Buffer
function convertArrayBufferToUtf8 (arrayBuffer: ArrayBuffer): string
function convertArrayBufferToHex (arrayBuffer: ArrayBuffer): string
function concatArrayBuffers (...args: ArrayBuffer[]): ArrayBuffer

// Buffer
function convertBufferToArrayBuffer (buffer: Buffer): ArrayBuffer
function convertBufferToUtf8 (buffer: Buffer): string
function convertBufferToHex (buffer: Buffer): string
function concatBuffers (...args: Buffer[]): Buffer

// Utf-8
function convertUtf8ToArrayBuffer (utf8: string): ArrayBuffer
function convertUtf8ToBuffer (utf8: string): Buffer

// Hex
function convertHexToBuffer (hex: string): Buffer
function convertHexToArrayBuffer (hex: string): ArrayBuffer

// Misc
function payloadId (): number
function uuid (): string
function getMeta (): IClientMeta | null
function parseWalletConnectUri (str: string): IParseURIResult

Keywords

FAQs

Last updated on 27 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc