Function fromBech32

  • decode address with bech32 specification, return address version、address prefix and address data if valid *

    Parameters

    • address: string

    Returns Bech32Result

    Case

    // You can test it here and find more case in test/address.spec.ts

    const actual = address.fromBech32('tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy')

    console.log(actual.version) // 0

    console.log(actual.prefix) // tb

    console.log(actual.data.toString('hex')) // 000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433