Files
zeekayandHanzo Dev da299df77d the corporate name is Lux Industries Inc
Lux Partners Limited is not the entity behind this work. Every place the
old name stood — copyright lines, site footers, brand config, legal and
compliance text — now names the company that actually holds it.

lux.fund is the exception and is not renamed to match: that site belongs
to Lux Assets Management LLC, a different company, and it says so.

Two kinds of line were left for a person rather than rewritten. A dated
news item recording that Lux Partners Limited was established in the Isle
of Man is a historical fact, and renaming it would falsify the record. And
a sentence asserting that the company is domiciled in the Isle of Man is a
claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle
of Man company, so swapping the name there would assert something untrue.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-28 13:05:15 -07:00

55 lines
1.3 KiB
Go

// Copyright (C) 2020-2025, Lux Industries Inc All rights reserved.
// See the file LICENSE for licensing terms.
// Package address provides address formatting utilities.
package address
import (
"errors"
"github.com/btcsuite/btcd/btcutil/bech32"
)
var (
errBits5To8 = errors.New("unable to convert address from 5-bit to 8-bit formatting")
errBits8To5 = errors.New("unable to convert address from 8-bit to 5-bit formatting")
)
// FormatBech32 formats a byte slice as a bech32 address with the given HRP
func FormatBech32(hrp string, data []byte) (string, error) {
if hrp == "" {
return "", errors.New("empty HRP")
}
if len(data) == 0 {
return "", errors.New("empty data")
}
// Convert 8-bit bytes to 5-bit groups as required by bech32
fiveBits, err := bech32.ConvertBits(data, 8, 5, true)
if err != nil {
return "", errBits8To5
}
return bech32.Encode(hrp, fiveBits)
}
// ParseBech32 parses a bech32 address and returns the HRP and data
func ParseBech32(addr string) (string, []byte, error) {
if addr == "" {
return "", nil, errors.New("empty address")
}
hrp, decoded, err := bech32.Decode(addr)
if err != nil {
return "", nil, err
}
// Convert 5-bit groups back to 8-bit bytes
addrBytes, err := bech32.ConvertBits(decoded, 5, 8, true)
if err != nil {
return "", nil, errBits5To8
}
return hrp, addrBytes, nil
}