declare module 'bech32' {
  export interface Bech32Result {
    prefix: string;
    words: number[];
  }

  export function decode(str: string, limit?: number): Bech32Result;
  export function encode(prefix: string, words: number[], limit?: number): string;
  export function toWords(bytes: Uint8Array | Buffer): number[];
  export function fromWords(words: number[]): number[];

  export const bech32: {
    decode: typeof decode;
    encode: typeof encode;
    toWords: typeof toWords;
    fromWords: typeof fromWords;
  };

  export const bech32m: {
    decode: typeof decode;
    encode: typeof encode;
    toWords: typeof toWords;
    fromWords: typeof fromWords;
  };
}
