UNPKG

interchain-token-sdk

Version:

SDK for deploying and managing interchain tokens across multiple chains using Axelar network

21 lines (20 loc) 618 B
// src/utils/randomBytes.ts export function randomBytes(length) { if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) { // Browser const arr = new Uint8Array(length); window.crypto.getRandomValues(arr); return arr; } else { // Node.js // eslint-disable-next-line @typescript-eslint/no-var-requires const { randomBytes } = require("crypto"); return randomBytes(length); } } export function toHex(uint8) { return Array.from(uint8) .map(b => b.toString(16).padStart(2, "0")) .join(""); }