@cardanowall/sdk-ts 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4663,13 +4663,13 @@ function readVarint(bytes, start) {
4663
4663
  function decodeMultibase(prefix, body) {
4664
4664
  switch (prefix) {
4665
4665
  case "b":
4666
- return decodeBase32(body.toLowerCase(), "rfc4648-lower");
4666
+ return decodeBase32(body, "rfc4648-lower");
4667
4667
  case "B":
4668
- return decodeBase32(body.toUpperCase(), "rfc4648-upper");
4668
+ return decodeBase32(body, "rfc4648-upper");
4669
4669
  case "f":
4670
- return decodeBase16(body.toLowerCase());
4670
+ return decodeBase16(body, "lower");
4671
4671
  case "F":
4672
- return decodeBase16(body.toUpperCase());
4672
+ return decodeBase16(body, "upper");
4673
4673
  case "z":
4674
4674
  return decodeBase58btc(body);
4675
4675
  default:
@@ -4678,10 +4678,10 @@ function decodeMultibase(prefix, body) {
4678
4678
  }
4679
4679
  var BASE16_LOWER = "0123456789abcdef";
4680
4680
  var BASE16_UPPER = "0123456789ABCDEF";
4681
- function decodeBase16(s) {
4681
+ function decodeBase16(s, variant) {
4682
4682
  if (s.length % 2 !== 0) throw new Error("base16: odd-length");
4683
+ const alphabet = variant === "lower" ? BASE16_LOWER : BASE16_UPPER;
4683
4684
  const out = new Uint8Array(s.length / 2);
4684
- const alphabet = s === s.toLowerCase() ? BASE16_LOWER : BASE16_UPPER;
4685
4685
  for (let i = 0; i < out.length; i++) {
4686
4686
  const hi = alphabet.indexOf(s[i * 2]);
4687
4687
  const lo = alphabet.indexOf(s[i * 2 + 1]);