Skip to content

Bech32m.decode

Decodes a bech32m string (BIP-350) into a human-readable part and data bytes.

Imports

Named
import { Bech32m } from 'ox'

Examples

import { Bech32m } from 'ox'
 
const { hrp, data } = Bech32m.decode('tempo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwa7xtm')
{ hrp: 'tempo', data: Uint8Array(20) }

Definition

function decode(
  str: string,
  options?: decode.Options,
): decode.ReturnType

Source: src/core/Bech32m.ts

Parameters

str

  • Type: string

The bech32m-encoded string to decode.

options

  • Type: decode.Options
  • Optional

options.limit

  • Type: number
  • Optional

Maximum length of the encoded string.

Return Type

The decoded HRP and data bytes.

decode.ReturnType