Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.32 KB

File metadata and controls

63 lines (47 loc) · 1.32 KB

install

npm i lbox
yarn add lbox

lbox vs libauth syntax

lbox.Address.toLegacyAddress(
  "bitcoincash:qzm47qz5ue99y9yl4aca7jnz7dwgdenl85jkfx3znl"
);
let decoded;
let type;
if (cashAddress.split(":").length == 2) {
  // decode Address with prefix
  decoded = libauth.decodeCashAddress(cashAddress);
  if (typeof decoded != "object") throw new Error(decoded);
  type = libauth.CashAddressType[decoded.type].toLocaleLowerCase();
} else {
  decoded = libauth.decodeCashAddressFormatWithoutPrefix(cashAddress);
  if (typeof decoded != "object") throw new Error(decoded);
  type = libauth.CashAddressType[decoded.version].toLocaleLowerCase();
}

// check if Address from test net
type = decoded.prefix == "bitcoincash" ? type : type + "-testnet";

libauth.encodeBase58Address(this.instantiateSha256, type, decoded.hash);

support

BCH :

bitcoincash:qqqxpdhdu8umgzr9adzfvypdu65xqtejtq9nssqyww