@lightsparkdev/core 1.0.21 → 1.0.22

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.
@@ -50,7 +50,6 @@ __export(utils_exports, {
50
50
  getLocalStorageConfigItem: () => getLocalStorageConfigItem,
51
51
  hexToBytes: () => hexToBytes,
52
52
  isBrowser: () => isBrowser,
53
- isCurrencyAmount: () => isCurrencyAmount,
54
53
  isCurrencyAmountObj: () => isCurrencyAmountObj,
55
54
  isCurrencyMap: () => isCurrencyMap,
56
55
  isError: () => isError,
@@ -58,6 +57,7 @@ __export(utils_exports, {
58
57
  isErrorWithMessage: () => isErrorWithMessage,
59
58
  isNode: () => isNode,
60
59
  isNumber: () => isNumber,
60
+ isSDKCurrencyAmount: () => isSDKCurrencyAmount,
61
61
  isTest: () => isTest,
62
62
  isType: () => isType,
63
63
  isUint8Array: () => isUint8Array,
@@ -470,102 +470,108 @@ function isNumber(value) {
470
470
 
471
471
  // src/utils/currency.ts
472
472
  var defaultCurrencyCode = "USD";
473
- var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
474
- CurrencyUnit2["FUTURE_VALUE"] = "FUTURE_VALUE";
475
- CurrencyUnit2["BITCOIN"] = "BITCOIN";
476
- CurrencyUnit2["SATOSHI"] = "SATOSHI";
477
- CurrencyUnit2["MILLISATOSHI"] = "MILLISATOSHI";
478
- CurrencyUnit2["USD"] = "USD";
479
- CurrencyUnit2["NANOBITCOIN"] = "NANOBITCOIN";
480
- CurrencyUnit2["MICROBITCOIN"] = "MICROBITCOIN";
481
- CurrencyUnit2["MILLIBITCOIN"] = "MILLIBITCOIN";
482
- return CurrencyUnit2;
483
- })(CurrencyUnit || {});
473
+ var CurrencyUnit = {
474
+ FUTURE_VALUE: "FUTURE_VALUE",
475
+ BITCOIN: "BITCOIN",
476
+ SATOSHI: "SATOSHI",
477
+ MILLISATOSHI: "MILLISATOSHI",
478
+ USD: "USD",
479
+ NANOBITCOIN: "NANOBITCOIN",
480
+ MICROBITCOIN: "MICROBITCOIN",
481
+ MILLIBITCOIN: "MILLIBITCOIN",
482
+ Bitcoin: "BITCOIN",
483
+ Microbitcoin: "MICROBITCOIN",
484
+ Millibitcoin: "MILLIBITCOIN",
485
+ Millisatoshi: "MILLISATOSHI",
486
+ Nanobitcoin: "NANOBITCOIN",
487
+ Satoshi: "SATOSHI",
488
+ Usd: "USD"
489
+ };
484
490
  var CONVERSION_MAP = {
485
- ["BITCOIN" /* BITCOIN */]: {
486
- ["BITCOIN" /* BITCOIN */]: (v) => v,
487
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v * 1e6,
488
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v * 1e3,
489
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e11,
490
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e9,
491
- ["SATOSHI" /* SATOSHI */]: (v) => v * 1e8,
492
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
491
+ [CurrencyUnit.BITCOIN]: {
492
+ [CurrencyUnit.BITCOIN]: (v) => v,
493
+ [CurrencyUnit.MICROBITCOIN]: (v) => v * 1e6,
494
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v * 1e3,
495
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e11,
496
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
497
+ [CurrencyUnit.SATOSHI]: (v) => v * 1e8,
498
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
493
499
  /* Round without decimals since we're returning cents: */
494
500
  round(v * centsPerBtc, 2)
495
501
  )
496
502
  },
497
- ["MICROBITCOIN" /* MICROBITCOIN */]: {
498
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e6,
499
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v,
500
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e3,
501
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e5,
502
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e3,
503
- ["SATOSHI" /* SATOSHI */]: (v) => v * 100,
504
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
503
+ [CurrencyUnit.MICROBITCOIN]: {
504
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e6,
505
+ [CurrencyUnit.MICROBITCOIN]: (v) => v,
506
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e3,
507
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e5,
508
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
509
+ [CurrencyUnit.SATOSHI]: (v) => v * 100,
510
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
505
511
  /* Round without decimals since we're returning cents: */
506
512
  round(v / 1e6 * centsPerBtc)
507
513
  )
508
514
  },
509
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: {
510
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e3,
511
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v * 1e3,
512
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v,
513
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e8,
514
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e6,
515
- ["SATOSHI" /* SATOSHI */]: (v) => v * 1e5,
516
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
515
+ [CurrencyUnit.MILLIBITCOIN]: {
516
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e3,
517
+ [CurrencyUnit.MICROBITCOIN]: (v) => v * 1e3,
518
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v,
519
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e8,
520
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
521
+ [CurrencyUnit.SATOSHI]: (v) => v * 1e5,
522
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
517
523
  /* Round without decimals since we're returning cents: */
518
524
  round(v / 1e3 * centsPerBtc)
519
525
  )
520
526
  },
521
- ["MILLISATOSHI" /* MILLISATOSHI */]: {
522
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e11,
523
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 1e5,
524
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e8,
525
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v,
526
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v / 100,
527
- ["SATOSHI" /* SATOSHI */]: (v) => v / 1e3,
528
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
527
+ [CurrencyUnit.MILLISATOSHI]: {
528
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e11,
529
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 1e5,
530
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e8,
531
+ [CurrencyUnit.MILLISATOSHI]: (v) => v,
532
+ [CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
533
+ [CurrencyUnit.SATOSHI]: (v) => v / 1e3,
534
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
529
535
  /* Round without decimals since we're returning cents: */
530
536
  round(v / 1e11 * centsPerBtc)
531
537
  )
532
538
  },
533
- ["NANOBITCOIN" /* NANOBITCOIN */]: {
534
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e9,
535
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 1e3,
536
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e6,
537
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 100,
538
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v,
539
- ["SATOSHI" /* SATOSHI */]: (v) => v / 10,
540
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
539
+ [CurrencyUnit.NANOBITCOIN]: {
540
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e9,
541
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 1e3,
542
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e6,
543
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 100,
544
+ [CurrencyUnit.NANOBITCOIN]: (v) => v,
545
+ [CurrencyUnit.SATOSHI]: (v) => v / 10,
546
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
541
547
  /* Round without decimals since we're returning cents: */
542
548
  round(v / 1e9 * centsPerBtc)
543
549
  )
544
550
  },
545
- ["SATOSHI" /* SATOSHI */]: {
546
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e8,
547
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 100,
548
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e5,
549
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e3,
550
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 10,
551
- ["SATOSHI" /* SATOSHI */]: (v) => v,
552
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
551
+ [CurrencyUnit.SATOSHI]: {
552
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e8,
553
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 100,
554
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e5,
555
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e3,
556
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
557
+ [CurrencyUnit.SATOSHI]: (v) => v,
558
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
553
559
  /* Round without decimals since we're returning cents: */
554
560
  round(v / 1e8 * centsPerBtc)
555
561
  )
556
562
  },
557
- ["USD" /* USD */]: {
558
- ["BITCOIN" /* BITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc,
559
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
560
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
561
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
562
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
563
- ["SATOSHI" /* SATOSHI */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
564
- ["USD" /* USD */]: (v) => v
563
+ [CurrencyUnit.USD]: {
564
+ [CurrencyUnit.BITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc,
565
+ [CurrencyUnit.MICROBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
566
+ [CurrencyUnit.MILLIBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
567
+ [CurrencyUnit.MILLISATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
568
+ [CurrencyUnit.NANOBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
569
+ [CurrencyUnit.SATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
570
+ [CurrencyUnit.USD]: (v) => v
565
571
  }
566
572
  };
567
573
  function convertCurrencyAmountValue(fromUnit, toUnit, amount, centsPerBtc = 1) {
568
- if (fromUnit === "FUTURE_VALUE" /* FUTURE_VALUE */ || toUnit === "FUTURE_VALUE" /* FUTURE_VALUE */) {
574
+ if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
569
575
  throw new LightsparkException_default("CurrencyError", `Unsupported CurrencyUnit.`);
570
576
  }
571
577
  if (fromUnit === toUnit) {
@@ -596,8 +602,9 @@ var convertCurrencyAmount = (from, toUnit) => {
596
602
  function isCurrencyAmountObj(arg) {
597
603
  return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
598
604
  }
599
- function isCurrencyAmount(arg) {
600
- return typeof arg === "object" && arg !== null && "originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
605
+ function isSDKCurrencyAmount(arg) {
606
+ return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
607
+ "originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
601
608
  }
602
609
  function asNumber(value) {
603
610
  if (typeof value === "string") {
@@ -608,67 +615,67 @@ function asNumber(value) {
608
615
  function getCurrencyAmount(currencyAmountArg) {
609
616
  let value = 0;
610
617
  let unit = void 0;
611
- if (isCurrencyAmountObj(currencyAmountArg)) {
612
- value = asNumber(currencyAmountArg.value);
613
- unit = currencyAmountArg.unit;
614
- } else if (isCurrencyAmount(currencyAmountArg)) {
618
+ if (isSDKCurrencyAmount(currencyAmountArg)) {
615
619
  value = currencyAmountArg.originalValue;
616
620
  unit = currencyAmountArg.originalUnit;
621
+ } else if (isCurrencyAmountObj(currencyAmountArg)) {
622
+ value = asNumber(currencyAmountArg.value);
623
+ unit = currencyAmountArg.unit;
617
624
  }
618
625
  return {
619
626
  value: asNumber(value),
620
- unit: unit || "SATOSHI" /* SATOSHI */
627
+ unit: unit || CurrencyUnit.SATOSHI
621
628
  };
622
629
  }
623
630
  function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
624
631
  const { value, unit } = getCurrencyAmount(currencyAmountArg);
625
632
  const convert = convertCurrencyAmountValue;
626
- const sats = convert(unit, "SATOSHI" /* SATOSHI */, value, centsPerBtc);
627
- const btc = convert(unit, "BITCOIN" /* BITCOIN */, value, centsPerBtc);
628
- const msats = convert(unit, "MILLISATOSHI" /* MILLISATOSHI */, value, centsPerBtc);
629
- const usd = convert(unit, "USD" /* USD */, value, centsPerBtc);
630
- const mibtc = convert(unit, "MICROBITCOIN" /* MICROBITCOIN */, value, centsPerBtc);
631
- const mlbtc = convert(unit, "MILLIBITCOIN" /* MILLIBITCOIN */, value, centsPerBtc);
632
- const nbtc = convert(unit, "NANOBITCOIN" /* NANOBITCOIN */, value, centsPerBtc);
633
+ const sats = convert(unit, CurrencyUnit.SATOSHI, value, centsPerBtc);
634
+ const btc = convert(unit, CurrencyUnit.BITCOIN, value, centsPerBtc);
635
+ const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, centsPerBtc);
636
+ const usd = convert(unit, CurrencyUnit.USD, value, centsPerBtc);
637
+ const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, centsPerBtc);
638
+ const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, centsPerBtc);
639
+ const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, centsPerBtc);
633
640
  const mapWithCurrencyUnits = {
634
- ["BITCOIN" /* BITCOIN */]: btc,
635
- ["SATOSHI" /* SATOSHI */]: sats,
636
- ["MILLISATOSHI" /* MILLISATOSHI */]: msats,
637
- ["USD" /* USD */]: usd,
638
- ["MICROBITCOIN" /* MICROBITCOIN */]: mibtc,
639
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: mlbtc,
640
- ["NANOBITCOIN" /* NANOBITCOIN */]: nbtc,
641
- ["FUTURE_VALUE" /* FUTURE_VALUE */]: NaN,
641
+ [CurrencyUnit.BITCOIN]: btc,
642
+ [CurrencyUnit.SATOSHI]: sats,
643
+ [CurrencyUnit.MILLISATOSHI]: msats,
644
+ [CurrencyUnit.USD]: usd,
645
+ [CurrencyUnit.MICROBITCOIN]: mibtc,
646
+ [CurrencyUnit.MILLIBITCOIN]: mlbtc,
647
+ [CurrencyUnit.NANOBITCOIN]: nbtc,
648
+ [CurrencyUnit.FUTURE_VALUE]: NaN,
642
649
  formatted: {
643
- ["BITCOIN" /* BITCOIN */]: formatCurrencyStr({
650
+ [CurrencyUnit.BITCOIN]: formatCurrencyStr({
644
651
  value: btc,
645
- unit: "BITCOIN" /* BITCOIN */
652
+ unit: CurrencyUnit.BITCOIN
646
653
  }),
647
- ["SATOSHI" /* SATOSHI */]: formatCurrencyStr({
654
+ [CurrencyUnit.SATOSHI]: formatCurrencyStr({
648
655
  value: sats,
649
- unit: "SATOSHI" /* SATOSHI */
656
+ unit: CurrencyUnit.SATOSHI
650
657
  }),
651
- ["MILLISATOSHI" /* MILLISATOSHI */]: formatCurrencyStr({
658
+ [CurrencyUnit.MILLISATOSHI]: formatCurrencyStr({
652
659
  value: msats,
653
- unit: "MILLISATOSHI" /* MILLISATOSHI */
660
+ unit: CurrencyUnit.MILLISATOSHI
654
661
  }),
655
- ["MICROBITCOIN" /* MICROBITCOIN */]: formatCurrencyStr({
662
+ [CurrencyUnit.MICROBITCOIN]: formatCurrencyStr({
656
663
  value: mibtc,
657
- unit: "MICROBITCOIN" /* MICROBITCOIN */
664
+ unit: CurrencyUnit.MICROBITCOIN
658
665
  }),
659
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: formatCurrencyStr({
666
+ [CurrencyUnit.MILLIBITCOIN]: formatCurrencyStr({
660
667
  value: mlbtc,
661
- unit: "MILLIBITCOIN" /* MILLIBITCOIN */
668
+ unit: CurrencyUnit.MILLIBITCOIN
662
669
  }),
663
- ["NANOBITCOIN" /* NANOBITCOIN */]: formatCurrencyStr({
670
+ [CurrencyUnit.NANOBITCOIN]: formatCurrencyStr({
664
671
  value: nbtc,
665
- unit: "NANOBITCOIN" /* NANOBITCOIN */
672
+ unit: CurrencyUnit.NANOBITCOIN
666
673
  }),
667
- ["USD" /* USD */]: formatCurrencyStr({
674
+ [CurrencyUnit.USD]: formatCurrencyStr({
668
675
  value: usd,
669
- unit: "USD" /* USD */
676
+ unit: CurrencyUnit.USD
670
677
  }),
671
- ["FUTURE_VALUE" /* FUTURE_VALUE */]: "-"
678
+ [CurrencyUnit.FUTURE_VALUE]: "-"
672
679
  }
673
680
  };
674
681
  return {
@@ -706,9 +713,9 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
706
713
  },
707
714
  formatted: {
708
715
  ...mapWithCurrencyUnits.formatted,
709
- btc: mapWithCurrencyUnits.formatted["BITCOIN" /* BITCOIN */],
710
- sats: mapWithCurrencyUnits.formatted["SATOSHI" /* SATOSHI */],
711
- msats: mapWithCurrencyUnits.formatted["MILLISATOSHI" /* MILLISATOSHI */]
716
+ btc: mapWithCurrencyUnits.formatted[CurrencyUnit.BITCOIN],
717
+ sats: mapWithCurrencyUnits.formatted[CurrencyUnit.SATOSHI],
718
+ msats: mapWithCurrencyUnits.formatted[CurrencyUnit.MILLISATOSHI]
712
719
  },
713
720
  type: "CurrencyMap"
714
721
  };
@@ -716,13 +723,13 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
716
723
  var isCurrencyMap = (currencyMap) => typeof currencyMap === "object" && currencyMap !== null && "type" in currencyMap && typeof currencyMap.type === "string" && currencyMap.type === "CurrencyMap";
717
724
  var abbrCurrencyUnit = (unit) => {
718
725
  switch (unit) {
719
- case "BITCOIN" /* BITCOIN */:
726
+ case CurrencyUnit.BITCOIN:
720
727
  return "BTC";
721
- case "SATOSHI" /* SATOSHI */:
728
+ case CurrencyUnit.SATOSHI:
722
729
  return "SAT";
723
- case "MILLISATOSHI" /* MILLISATOSHI */:
730
+ case CurrencyUnit.MILLISATOSHI:
724
731
  return "MSAT";
725
- case "USD" /* USD */:
732
+ case CurrencyUnit.USD:
726
733
  return "USD";
727
734
  }
728
735
  return "Unsupported CurrencyUnit";
@@ -731,33 +738,33 @@ function formatCurrencyStr(amount, maxFractionDigits, compact, showBtcSymbol = f
731
738
  const currencyAmount = getCurrencyAmount(amount);
732
739
  let { value: num } = currencyAmount;
733
740
  const { unit } = currencyAmount;
734
- if (unit === "USD" /* USD */) {
741
+ if (unit === CurrencyUnit.USD) {
735
742
  num = num / 100;
736
743
  }
737
744
  function getDefaultMaxFractionDigits(defaultDigits) {
738
745
  return typeof maxFractionDigits === "undefined" ? compact ? 1 : defaultDigits : maxFractionDigits;
739
746
  }
740
- const symbol = !showBtcSymbol ? "" : unit === "BITCOIN" /* BITCOIN */ ? "\uE903" : unit === "SATOSHI" /* SATOSHI */ ? "\uE902" : "";
747
+ const symbol = !showBtcSymbol ? "" : unit === CurrencyUnit.BITCOIN ? "\uE903" : unit === CurrencyUnit.SATOSHI ? "\uE902" : "";
741
748
  const currentLocale = getCurrentLocale();
742
749
  switch (unit) {
743
- case "BITCOIN" /* BITCOIN */:
750
+ case CurrencyUnit.BITCOIN:
744
751
  return `${symbol}${num.toLocaleString(currentLocale, {
745
752
  notation: compact ? "compact" : void 0,
746
753
  maximumFractionDigits: getDefaultMaxFractionDigits(4),
747
754
  ...options
748
755
  })}`;
749
- case "MILLISATOSHI" /* MILLISATOSHI */:
750
- case "SATOSHI" /* SATOSHI */:
751
- case "MICROBITCOIN" /* MICROBITCOIN */:
752
- case "MILLIBITCOIN" /* MILLIBITCOIN */:
753
- case "NANOBITCOIN" /* NANOBITCOIN */:
756
+ case CurrencyUnit.MILLISATOSHI:
757
+ case CurrencyUnit.SATOSHI:
758
+ case CurrencyUnit.MICROBITCOIN:
759
+ case CurrencyUnit.MILLIBITCOIN:
760
+ case CurrencyUnit.NANOBITCOIN:
754
761
  default:
755
762
  return `${symbol}${num.toLocaleString(currentLocale, {
756
763
  notation: compact ? "compact" : void 0,
757
764
  maximumFractionDigits: getDefaultMaxFractionDigits(0),
758
765
  ...options
759
766
  })}`;
760
- case "USD" /* USD */:
767
+ case CurrencyUnit.USD:
761
768
  return num.toLocaleString(currentLocale, {
762
769
  style: "currency",
763
770
  currency: defaultCurrencyCode,
@@ -1006,7 +1013,6 @@ function notNullUndefined(value) {
1006
1013
  getLocalStorageConfigItem,
1007
1014
  hexToBytes,
1008
1015
  isBrowser,
1009
- isCurrencyAmount,
1010
1016
  isCurrencyAmountObj,
1011
1017
  isCurrencyMap,
1012
1018
  isError,
@@ -1014,6 +1020,7 @@ function notNullUndefined(value) {
1014
1020
  isErrorWithMessage,
1015
1021
  isNode,
1016
1022
  isNumber,
1023
+ isSDKCurrencyAmount,
1017
1024
  isTest,
1018
1025
  isType,
1019
1026
  isUint8Array,
@@ -1 +1 @@
1
- export { Y as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, a4 as notNullUndefined, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-9e41ffe5.js';
1
+ export { Z as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, f as CurrencyUnitType, a0 as DeepPartial, Y as ExpandRecursively, a1 as JSONLiteral, a3 as JSONObject, a2 as JSONType, X as Maybe, a4 as NN, _ as OmitTypename, S as SDKCurrencyAmountType, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, m as isSDKCurrencyAmount, w as isTest, $ as isType, W as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, V as lsidToUUID, n as mapCurrencyAmount, a5 as notNullUndefined, T as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, U as sleep, u as urlsafe_b64decode } from '../index-9ecb1570.js';
@@ -1 +1 @@
1
- export { Y as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, a4 as notNullUndefined, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-9e41ffe5.js';
1
+ export { Z as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, f as CurrencyUnitType, a0 as DeepPartial, Y as ExpandRecursively, a1 as JSONLiteral, a3 as JSONObject, a2 as JSONType, X as Maybe, a4 as NN, _ as OmitTypename, S as SDKCurrencyAmountType, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, m as isSDKCurrencyAmount, w as isTest, $ as isType, W as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, V as lsidToUUID, n as mapCurrencyAmount, a5 as notNullUndefined, T as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, U as sleep, u as urlsafe_b64decode } from '../index-9ecb1570.js';
@@ -19,7 +19,6 @@ import {
19
19
  getLocalStorageConfigItem,
20
20
  hexToBytes,
21
21
  isBrowser,
22
- isCurrencyAmount,
23
22
  isCurrencyAmountObj,
24
23
  isCurrencyMap,
25
24
  isError,
@@ -27,6 +26,7 @@ import {
27
26
  isErrorWithMessage,
28
27
  isNode,
29
28
  isNumber,
29
+ isSDKCurrencyAmount,
30
30
  isTest,
31
31
  isType,
32
32
  isUint8Array,
@@ -42,7 +42,7 @@ import {
42
42
  setLocalStorageBoolean,
43
43
  sleep,
44
44
  urlsafe_b64decode
45
- } from "../chunk-Y3FWNVYS.js";
45
+ } from "../chunk-RC2KOZKZ.js";
46
46
  export {
47
47
  CurrencyUnit,
48
48
  abbrCurrencyUnit,
@@ -64,7 +64,6 @@ export {
64
64
  getLocalStorageConfigItem,
65
65
  hexToBytes,
66
66
  isBrowser,
67
- isCurrencyAmount,
68
67
  isCurrencyAmountObj,
69
68
  isCurrencyMap,
70
69
  isError,
@@ -72,6 +71,7 @@ export {
72
71
  isErrorWithMessage,
73
72
  isNode,
74
73
  isNumber,
74
+ isSDKCurrencyAmount,
75
75
  isTest,
76
76
  isType,
77
77
  isUint8Array,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/core",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [