Socket
Socket
Sign inDemoInstall

@walletconnect/encoding

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/encoding

Byte encoding utils


Version published
Weekly downloads
120K
decreased by-9.55%
Maintainers
1
Weekly downloads
 
Created

What is @walletconnect/encoding?

@walletconnect/encoding is a utility library for encoding and decoding data in various formats. It is commonly used in blockchain and cryptocurrency applications to handle data transformations.

What are @walletconnect/encoding's main functionalities?

Hex Encoding

This feature allows you to convert a hexadecimal string to a byte array and vice versa. It is useful for handling data in hexadecimal format, which is common in blockchain applications.

const { hexToArray, arrayToHex } = require('@walletconnect/encoding');

const hexString = '0x48656c6c6f';
const byteArray = hexToArray(hexString);
console.log(byteArray); // [72, 101, 108, 108, 111]

const newHexString = arrayToHex(byteArray);
console.log(newHexString); // '0x48656c6c6f'

Base64 Encoding

This feature allows you to convert a Base64 string to a byte array and vice versa. Base64 encoding is often used for data serialization and transmission.

const { base64ToArray, arrayToBase64 } = require('@walletconnect/encoding');

const base64String = 'SGVsbG8=';
const byteArray = base64ToArray(base64String);
console.log(byteArray); // [72, 101, 108, 108, 111]

const newBase64String = arrayToBase64(byteArray);
console.log(newBase64String); // 'SGVsbG8='

UTF-8 Encoding

This feature allows you to convert a UTF-8 string to a byte array and vice versa. UTF-8 is a standard encoding for text data.

const { utf8ToArray, arrayToUtf8 } = require('@walletconnect/encoding');

const utf8String = 'Hello';
const byteArray = utf8ToArray(utf8String);
console.log(byteArray); // [72, 101, 108, 108, 111]

const newUtf8String = arrayToUtf8(byteArray);
console.log(newUtf8String); // 'Hello'

Other packages similar to @walletconnect/encoding

Keywords

FAQs

Package last updated on 28 Jul 2021

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