MCPcopy Create free account
hub / github.com/wevm/viem / bytesToNumber

Function bytesToNumber

src/utils/encoding/fromBytes.ts:184–191  ·  view source on GitHub ↗
(
  bytes: ByteArray,
  opts: BytesToNumberOpts = {},
)

Source from the content-addressed store, hash-verified

182 * // 420
183 */
184export function bytesToNumber(
185 bytes: ByteArray,
186 opts: BytesToNumberOpts = {},
187): number {
188 if (typeof opts.size !== 'undefined') assertSize(bytes, { size: opts.size })
189 const hex = bytesToHex(bytes)
190 return hexToNumber(hex, opts)
191}
192
193export type BytesToStringOpts = {
194 /** Size of the bytes. */

Callers 7

fromBytesFunction · 0.85
fromBytes.test.tsFile · 0.85
decodeArrayFunction · 0.85
decodeBytesFunction · 0.85
decodeNumberFunction · 0.85
decodeTupleFunction · 0.85
decodeStringFunction · 0.85

Calls 3

assertSizeFunction · 0.85
bytesToHexFunction · 0.85
hexToNumberFunction · 0.85

Tested by

no test coverage detected