Socket
Socket
Sign inDemoInstall

@walletconnect/utils

Package Overview
Dependencies
Maintainers
1
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/utils - npm Package Compare versions

Comparing version 1.0.0-beta.93 to 1.0.0-beta.94

45

dist/cjs/encoding.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
const encUtils = tslib_1.__importStar(require("enc-utils"));
const misc_1 = require("./misc");
function convertArrayBufferToBuffer(arrBuf) {
return encUtils.arrayBufferToBuffer(arrBuf);
return encUtils.arrayToBuffer(new Uint8Array(arrBuf));
}
exports.convertArrayBufferToBuffer = convertArrayBufferToBuffer;
function convertArrayBufferToUtf8(arrBuf) {
return encUtils.arrayBufferToUtf8(arrBuf);
return encUtils.arrayToUtf8(new Uint8Array(arrBuf));
}
exports.convertArrayBufferToUtf8 = convertArrayBufferToUtf8;
function convertArrayBufferToHex(arrBuf, noPrefix) {
return encUtils.arrayBufferToHex(arrBuf, !noPrefix);
return encUtils.arrayToHex(new Uint8Array(arrBuf), !noPrefix);
}

@@ -21,12 +19,12 @@ exports.convertArrayBufferToHex = convertArrayBufferToHex;

const hex = convertArrayBufferToHex(arrBuf);
const num = convertHexToNumber(hex);
return num;
return convertHexToNumber(hex);
}
exports.convertArrayBufferToNumber = convertArrayBufferToNumber;
function concatArrayBuffers(...args) {
return encUtils.concatArrayBuffers(...args);
const hex = args.map(b => encUtils.arrayToHex(new Uint8Array(b))).join("");
return encUtils.hexToArray(hex).buffer;
}
exports.concatArrayBuffers = concatArrayBuffers;
function convertBufferToArrayBuffer(buf) {
return encUtils.bufferToArrayBuffer(buf);
return encUtils.bufferToArray(buf).buffer;
}

@@ -44,4 +42,3 @@ exports.convertBufferToArrayBuffer = convertBufferToArrayBuffer;

const hex = convertBufferToHex(buf);
const num = convertHexToNumber(hex);
return num;
return convertHexToNumber(hex);
}

@@ -54,3 +51,3 @@ exports.convertBufferToNumber = convertBufferToNumber;

function convertUtf8ToArrayBuffer(utf8) {
return encUtils.utf8ToArrayBuffer(utf8);
return encUtils.utf8ToArray(utf8).buffer;
}

@@ -67,4 +64,3 @@ exports.convertUtf8ToArrayBuffer = convertUtf8ToArrayBuffer;

function convertUtf8ToNumber(utf8) {
const num = new bn_js_1.default(utf8).toNumber();
return num;
return encUtils.utf8ToNumber(utf8);
}

@@ -77,3 +73,3 @@ exports.convertUtf8ToNumber = convertUtf8ToNumber;

function convertHexToArrayBuffer(hex) {
return encUtils.hexToArrayBuffer(hex);
return encUtils.hexToArray(hex).buffer;
}

@@ -86,4 +82,3 @@ exports.convertHexToArrayBuffer = convertHexToArrayBuffer;

function convertHexToNumber(hex) {
const num = new bn_js_1.default(misc_1.removeHexPrefix(hex), "hex").toNumber();
return num;
return encUtils.hexToNumber(hex);
}

@@ -93,4 +88,3 @@ exports.convertHexToNumber = convertHexToNumber;

const hex = convertNumberToHex(num);
const buf = convertHexToBuffer(hex);
return buf;
return convertHexToBuffer(hex);
}

@@ -100,20 +94,13 @@ exports.convertNumberToBuffer = convertNumberToBuffer;

const hex = convertNumberToHex(num);
const arrBuf = convertHexToArrayBuffer(hex);
return arrBuf;
return convertHexToArrayBuffer(hex);
}
exports.convertNumberToArrayBuffer = convertNumberToArrayBuffer;
function convertNumberToUtf8(num) {
const utf8 = new bn_js_1.default(num).toString();
return utf8;
return encUtils.numberToUtf8(num);
}
exports.convertNumberToUtf8 = convertNumberToUtf8;
function convertNumberToHex(num, noPrefix) {
let hex = new bn_js_1.default(num).toString(16);
hex = misc_1.sanitizeHex(hex);
if (noPrefix) {
hex = misc_1.removeHexPrefix(hex);
}
return hex;
return encUtils.numberToHex(num, !noPrefix);
}
exports.convertNumberToHex = convertNumberToHex;
//# sourceMappingURL=encoding.js.map
import { IJsonRpcSubscription, IJsonRpcRequest, IJsonRpcResponseSuccess, IJsonRpcResponseError, IInternalEvent } from "@walletconnect/types";
export declare function isEmptyString(value: string): boolean;
export declare function isEmptyArray(array: any[]): boolean;
export declare function isBuffer(val: any): boolean;
export declare function isTypedArray(val: any): boolean;
export declare function isArrayBuffer(val: any): any;
export declare function isType(val: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "buffer" | "array" | "typed-array" | "array-buffer";
export declare function isArrayBuffer(val: any): boolean;
export declare function getType(val: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "buffer" | "array" | "typed-array" | "array-buffer";
export declare function getEncoding(val: any): "hex" | "utf8";
export declare function isHexString(value: any, length?: number): boolean;

@@ -8,0 +10,0 @@ export declare function isJsonRpcSubscription(object: any): object is IJsonRpcSubscription;

@@ -14,28 +14,22 @@ "use strict";

exports.isEmptyArray = isEmptyArray;
function isBuffer(val) {
return encUtils.isBuffer(val);
}
exports.isBuffer = isBuffer;
function isTypedArray(val) {
return !!val.buffer && !Buffer.isBuffer(val);
return encUtils.isTypedArray(val);
}
exports.isTypedArray = isTypedArray;
function isArrayBuffer(val) {
return !val.buffer && !Buffer.isBuffer(val) && val.length;
return encUtils.isArrayBuffer(val);
}
exports.isArrayBuffer = isArrayBuffer;
function isType(val) {
if (Buffer.isBuffer(val)) {
return "buffer";
}
else if (Array.isArray(val)) {
return "array";
}
else if (isTypedArray(val)) {
return "typed-array";
}
else if (isArrayBuffer(val)) {
return "array-buffer";
}
else {
return typeof val;
}
function getType(val) {
return encUtils.getType(val);
}
exports.isType = isType;
exports.getType = getType;
function getEncoding(val) {
return encUtils.getEncoding(val);
}
exports.getEncoding = getEncoding;
function isHexString(value, length) {

@@ -42,0 +36,0 @@ return encUtils.isHexString(value, length);

{
"name": "@walletconnect/utils",
"version": "1.0.0-beta.93",
"version": "1.0.0-beta.94",
"description": "Utility Library for WalletConnect",

@@ -59,8 +59,7 @@ "scripts": {

"@ethersproject/address": "5.0.0-beta.134",
"@walletconnect/types": "^1.0.0-beta.93",
"bn.js": "4.11.8",
"@walletconnect/types": "^1.0.0-beta.94",
"detect-browser": "5.1.0",
"enc-utils": "1.3.0"
"enc-utils": "2.0.0"
},
"gitHead": "165f7993c2acc907c653c02847fb02721052c6e7"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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