@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.
package/dist/index.cjs CHANGED
@@ -67,7 +67,6 @@ __export(src_exports, {
67
67
  getLocalStorageConfigItem: () => getLocalStorageConfigItem,
68
68
  hexToBytes: () => hexToBytes,
69
69
  isBrowser: () => isBrowser,
70
- isCurrencyAmount: () => isCurrencyAmount,
71
70
  isCurrencyAmountObj: () => isCurrencyAmountObj,
72
71
  isCurrencyMap: () => isCurrencyMap,
73
72
  isError: () => isError,
@@ -75,6 +74,7 @@ __export(src_exports, {
75
74
  isErrorWithMessage: () => isErrorWithMessage,
76
75
  isNode: () => isNode,
77
76
  isNumber: () => isNumber,
77
+ isSDKCurrencyAmount: () => isSDKCurrencyAmount,
78
78
  isTest: () => isTest,
79
79
  isType: () => isType,
80
80
  isUint8Array: () => isUint8Array,
@@ -836,102 +836,108 @@ function isNumber(value) {
836
836
 
837
837
  // src/utils/currency.ts
838
838
  var defaultCurrencyCode = "USD";
839
- var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
840
- CurrencyUnit2["FUTURE_VALUE"] = "FUTURE_VALUE";
841
- CurrencyUnit2["BITCOIN"] = "BITCOIN";
842
- CurrencyUnit2["SATOSHI"] = "SATOSHI";
843
- CurrencyUnit2["MILLISATOSHI"] = "MILLISATOSHI";
844
- CurrencyUnit2["USD"] = "USD";
845
- CurrencyUnit2["NANOBITCOIN"] = "NANOBITCOIN";
846
- CurrencyUnit2["MICROBITCOIN"] = "MICROBITCOIN";
847
- CurrencyUnit2["MILLIBITCOIN"] = "MILLIBITCOIN";
848
- return CurrencyUnit2;
849
- })(CurrencyUnit || {});
839
+ var CurrencyUnit = {
840
+ FUTURE_VALUE: "FUTURE_VALUE",
841
+ BITCOIN: "BITCOIN",
842
+ SATOSHI: "SATOSHI",
843
+ MILLISATOSHI: "MILLISATOSHI",
844
+ USD: "USD",
845
+ NANOBITCOIN: "NANOBITCOIN",
846
+ MICROBITCOIN: "MICROBITCOIN",
847
+ MILLIBITCOIN: "MILLIBITCOIN",
848
+ Bitcoin: "BITCOIN",
849
+ Microbitcoin: "MICROBITCOIN",
850
+ Millibitcoin: "MILLIBITCOIN",
851
+ Millisatoshi: "MILLISATOSHI",
852
+ Nanobitcoin: "NANOBITCOIN",
853
+ Satoshi: "SATOSHI",
854
+ Usd: "USD"
855
+ };
850
856
  var CONVERSION_MAP = {
851
- ["BITCOIN" /* BITCOIN */]: {
852
- ["BITCOIN" /* BITCOIN */]: (v) => v,
853
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v * 1e6,
854
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v * 1e3,
855
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e11,
856
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e9,
857
- ["SATOSHI" /* SATOSHI */]: (v) => v * 1e8,
858
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
857
+ [CurrencyUnit.BITCOIN]: {
858
+ [CurrencyUnit.BITCOIN]: (v) => v,
859
+ [CurrencyUnit.MICROBITCOIN]: (v) => v * 1e6,
860
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v * 1e3,
861
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e11,
862
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
863
+ [CurrencyUnit.SATOSHI]: (v) => v * 1e8,
864
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
859
865
  /* Round without decimals since we're returning cents: */
860
866
  round(v * centsPerBtc, 2)
861
867
  )
862
868
  },
863
- ["MICROBITCOIN" /* MICROBITCOIN */]: {
864
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e6,
865
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v,
866
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e3,
867
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e5,
868
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e3,
869
- ["SATOSHI" /* SATOSHI */]: (v) => v * 100,
870
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
869
+ [CurrencyUnit.MICROBITCOIN]: {
870
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e6,
871
+ [CurrencyUnit.MICROBITCOIN]: (v) => v,
872
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e3,
873
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e5,
874
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
875
+ [CurrencyUnit.SATOSHI]: (v) => v * 100,
876
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
871
877
  /* Round without decimals since we're returning cents: */
872
878
  round(v / 1e6 * centsPerBtc)
873
879
  )
874
880
  },
875
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: {
876
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e3,
877
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v * 1e3,
878
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v,
879
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e8,
880
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 1e6,
881
- ["SATOSHI" /* SATOSHI */]: (v) => v * 1e5,
882
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
881
+ [CurrencyUnit.MILLIBITCOIN]: {
882
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e3,
883
+ [CurrencyUnit.MICROBITCOIN]: (v) => v * 1e3,
884
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v,
885
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e8,
886
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
887
+ [CurrencyUnit.SATOSHI]: (v) => v * 1e5,
888
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
883
889
  /* Round without decimals since we're returning cents: */
884
890
  round(v / 1e3 * centsPerBtc)
885
891
  )
886
892
  },
887
- ["MILLISATOSHI" /* MILLISATOSHI */]: {
888
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e11,
889
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 1e5,
890
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e8,
891
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v,
892
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v / 100,
893
- ["SATOSHI" /* SATOSHI */]: (v) => v / 1e3,
894
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
893
+ [CurrencyUnit.MILLISATOSHI]: {
894
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e11,
895
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 1e5,
896
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e8,
897
+ [CurrencyUnit.MILLISATOSHI]: (v) => v,
898
+ [CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
899
+ [CurrencyUnit.SATOSHI]: (v) => v / 1e3,
900
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
895
901
  /* Round without decimals since we're returning cents: */
896
902
  round(v / 1e11 * centsPerBtc)
897
903
  )
898
904
  },
899
- ["NANOBITCOIN" /* NANOBITCOIN */]: {
900
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e9,
901
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 1e3,
902
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e6,
903
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 100,
904
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v,
905
- ["SATOSHI" /* SATOSHI */]: (v) => v / 10,
906
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
905
+ [CurrencyUnit.NANOBITCOIN]: {
906
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e9,
907
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 1e3,
908
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e6,
909
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 100,
910
+ [CurrencyUnit.NANOBITCOIN]: (v) => v,
911
+ [CurrencyUnit.SATOSHI]: (v) => v / 10,
912
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
907
913
  /* Round without decimals since we're returning cents: */
908
914
  round(v / 1e9 * centsPerBtc)
909
915
  )
910
916
  },
911
- ["SATOSHI" /* SATOSHI */]: {
912
- ["BITCOIN" /* BITCOIN */]: (v) => v / 1e8,
913
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v) => v / 100,
914
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v) => v / 1e5,
915
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v) => v * 1e3,
916
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v) => v * 10,
917
- ["SATOSHI" /* SATOSHI */]: (v) => v,
918
- ["USD" /* USD */]: (v, centsPerBtc = 1) => (
917
+ [CurrencyUnit.SATOSHI]: {
918
+ [CurrencyUnit.BITCOIN]: (v) => v / 1e8,
919
+ [CurrencyUnit.MICROBITCOIN]: (v) => v / 100,
920
+ [CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e5,
921
+ [CurrencyUnit.MILLISATOSHI]: (v) => v * 1e3,
922
+ [CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
923
+ [CurrencyUnit.SATOSHI]: (v) => v,
924
+ [CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
919
925
  /* Round without decimals since we're returning cents: */
920
926
  round(v / 1e8 * centsPerBtc)
921
927
  )
922
928
  },
923
- ["USD" /* USD */]: {
924
- ["BITCOIN" /* BITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc,
925
- ["MICROBITCOIN" /* MICROBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
926
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
927
- ["MILLISATOSHI" /* MILLISATOSHI */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
928
- ["NANOBITCOIN" /* NANOBITCOIN */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
929
- ["SATOSHI" /* SATOSHI */]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
930
- ["USD" /* USD */]: (v) => v
929
+ [CurrencyUnit.USD]: {
930
+ [CurrencyUnit.BITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc,
931
+ [CurrencyUnit.MICROBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
932
+ [CurrencyUnit.MILLIBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
933
+ [CurrencyUnit.MILLISATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
934
+ [CurrencyUnit.NANOBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
935
+ [CurrencyUnit.SATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
936
+ [CurrencyUnit.USD]: (v) => v
931
937
  }
932
938
  };
933
939
  function convertCurrencyAmountValue(fromUnit, toUnit, amount, centsPerBtc = 1) {
934
- if (fromUnit === "FUTURE_VALUE" /* FUTURE_VALUE */ || toUnit === "FUTURE_VALUE" /* FUTURE_VALUE */) {
940
+ if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
935
941
  throw new LightsparkException_default("CurrencyError", `Unsupported CurrencyUnit.`);
936
942
  }
937
943
  if (fromUnit === toUnit) {
@@ -962,8 +968,9 @@ var convertCurrencyAmount = (from, toUnit) => {
962
968
  function isCurrencyAmountObj(arg) {
963
969
  return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
964
970
  }
965
- function isCurrencyAmount(arg) {
966
- return typeof arg === "object" && arg !== null && "originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
971
+ function isSDKCurrencyAmount(arg) {
972
+ return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
973
+ "originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
967
974
  }
968
975
  function asNumber(value) {
969
976
  if (typeof value === "string") {
@@ -974,67 +981,67 @@ function asNumber(value) {
974
981
  function getCurrencyAmount(currencyAmountArg) {
975
982
  let value = 0;
976
983
  let unit = void 0;
977
- if (isCurrencyAmountObj(currencyAmountArg)) {
978
- value = asNumber(currencyAmountArg.value);
979
- unit = currencyAmountArg.unit;
980
- } else if (isCurrencyAmount(currencyAmountArg)) {
984
+ if (isSDKCurrencyAmount(currencyAmountArg)) {
981
985
  value = currencyAmountArg.originalValue;
982
986
  unit = currencyAmountArg.originalUnit;
987
+ } else if (isCurrencyAmountObj(currencyAmountArg)) {
988
+ value = asNumber(currencyAmountArg.value);
989
+ unit = currencyAmountArg.unit;
983
990
  }
984
991
  return {
985
992
  value: asNumber(value),
986
- unit: unit || "SATOSHI" /* SATOSHI */
993
+ unit: unit || CurrencyUnit.SATOSHI
987
994
  };
988
995
  }
989
996
  function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
990
997
  const { value, unit } = getCurrencyAmount(currencyAmountArg);
991
998
  const convert = convertCurrencyAmountValue;
992
- const sats = convert(unit, "SATOSHI" /* SATOSHI */, value, centsPerBtc);
993
- const btc = convert(unit, "BITCOIN" /* BITCOIN */, value, centsPerBtc);
994
- const msats = convert(unit, "MILLISATOSHI" /* MILLISATOSHI */, value, centsPerBtc);
995
- const usd = convert(unit, "USD" /* USD */, value, centsPerBtc);
996
- const mibtc = convert(unit, "MICROBITCOIN" /* MICROBITCOIN */, value, centsPerBtc);
997
- const mlbtc = convert(unit, "MILLIBITCOIN" /* MILLIBITCOIN */, value, centsPerBtc);
998
- const nbtc = convert(unit, "NANOBITCOIN" /* NANOBITCOIN */, value, centsPerBtc);
999
+ const sats = convert(unit, CurrencyUnit.SATOSHI, value, centsPerBtc);
1000
+ const btc = convert(unit, CurrencyUnit.BITCOIN, value, centsPerBtc);
1001
+ const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, centsPerBtc);
1002
+ const usd = convert(unit, CurrencyUnit.USD, value, centsPerBtc);
1003
+ const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, centsPerBtc);
1004
+ const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, centsPerBtc);
1005
+ const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, centsPerBtc);
999
1006
  const mapWithCurrencyUnits = {
1000
- ["BITCOIN" /* BITCOIN */]: btc,
1001
- ["SATOSHI" /* SATOSHI */]: sats,
1002
- ["MILLISATOSHI" /* MILLISATOSHI */]: msats,
1003
- ["USD" /* USD */]: usd,
1004
- ["MICROBITCOIN" /* MICROBITCOIN */]: mibtc,
1005
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: mlbtc,
1006
- ["NANOBITCOIN" /* NANOBITCOIN */]: nbtc,
1007
- ["FUTURE_VALUE" /* FUTURE_VALUE */]: NaN,
1007
+ [CurrencyUnit.BITCOIN]: btc,
1008
+ [CurrencyUnit.SATOSHI]: sats,
1009
+ [CurrencyUnit.MILLISATOSHI]: msats,
1010
+ [CurrencyUnit.USD]: usd,
1011
+ [CurrencyUnit.MICROBITCOIN]: mibtc,
1012
+ [CurrencyUnit.MILLIBITCOIN]: mlbtc,
1013
+ [CurrencyUnit.NANOBITCOIN]: nbtc,
1014
+ [CurrencyUnit.FUTURE_VALUE]: NaN,
1008
1015
  formatted: {
1009
- ["BITCOIN" /* BITCOIN */]: formatCurrencyStr({
1016
+ [CurrencyUnit.BITCOIN]: formatCurrencyStr({
1010
1017
  value: btc,
1011
- unit: "BITCOIN" /* BITCOIN */
1018
+ unit: CurrencyUnit.BITCOIN
1012
1019
  }),
1013
- ["SATOSHI" /* SATOSHI */]: formatCurrencyStr({
1020
+ [CurrencyUnit.SATOSHI]: formatCurrencyStr({
1014
1021
  value: sats,
1015
- unit: "SATOSHI" /* SATOSHI */
1022
+ unit: CurrencyUnit.SATOSHI
1016
1023
  }),
1017
- ["MILLISATOSHI" /* MILLISATOSHI */]: formatCurrencyStr({
1024
+ [CurrencyUnit.MILLISATOSHI]: formatCurrencyStr({
1018
1025
  value: msats,
1019
- unit: "MILLISATOSHI" /* MILLISATOSHI */
1026
+ unit: CurrencyUnit.MILLISATOSHI
1020
1027
  }),
1021
- ["MICROBITCOIN" /* MICROBITCOIN */]: formatCurrencyStr({
1028
+ [CurrencyUnit.MICROBITCOIN]: formatCurrencyStr({
1022
1029
  value: mibtc,
1023
- unit: "MICROBITCOIN" /* MICROBITCOIN */
1030
+ unit: CurrencyUnit.MICROBITCOIN
1024
1031
  }),
1025
- ["MILLIBITCOIN" /* MILLIBITCOIN */]: formatCurrencyStr({
1032
+ [CurrencyUnit.MILLIBITCOIN]: formatCurrencyStr({
1026
1033
  value: mlbtc,
1027
- unit: "MILLIBITCOIN" /* MILLIBITCOIN */
1034
+ unit: CurrencyUnit.MILLIBITCOIN
1028
1035
  }),
1029
- ["NANOBITCOIN" /* NANOBITCOIN */]: formatCurrencyStr({
1036
+ [CurrencyUnit.NANOBITCOIN]: formatCurrencyStr({
1030
1037
  value: nbtc,
1031
- unit: "NANOBITCOIN" /* NANOBITCOIN */
1038
+ unit: CurrencyUnit.NANOBITCOIN
1032
1039
  }),
1033
- ["USD" /* USD */]: formatCurrencyStr({
1040
+ [CurrencyUnit.USD]: formatCurrencyStr({
1034
1041
  value: usd,
1035
- unit: "USD" /* USD */
1042
+ unit: CurrencyUnit.USD
1036
1043
  }),
1037
- ["FUTURE_VALUE" /* FUTURE_VALUE */]: "-"
1044
+ [CurrencyUnit.FUTURE_VALUE]: "-"
1038
1045
  }
1039
1046
  };
1040
1047
  return {
@@ -1072,9 +1079,9 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
1072
1079
  },
1073
1080
  formatted: {
1074
1081
  ...mapWithCurrencyUnits.formatted,
1075
- btc: mapWithCurrencyUnits.formatted["BITCOIN" /* BITCOIN */],
1076
- sats: mapWithCurrencyUnits.formatted["SATOSHI" /* SATOSHI */],
1077
- msats: mapWithCurrencyUnits.formatted["MILLISATOSHI" /* MILLISATOSHI */]
1082
+ btc: mapWithCurrencyUnits.formatted[CurrencyUnit.BITCOIN],
1083
+ sats: mapWithCurrencyUnits.formatted[CurrencyUnit.SATOSHI],
1084
+ msats: mapWithCurrencyUnits.formatted[CurrencyUnit.MILLISATOSHI]
1078
1085
  },
1079
1086
  type: "CurrencyMap"
1080
1087
  };
@@ -1082,13 +1089,13 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
1082
1089
  var isCurrencyMap = (currencyMap) => typeof currencyMap === "object" && currencyMap !== null && "type" in currencyMap && typeof currencyMap.type === "string" && currencyMap.type === "CurrencyMap";
1083
1090
  var abbrCurrencyUnit = (unit) => {
1084
1091
  switch (unit) {
1085
- case "BITCOIN" /* BITCOIN */:
1092
+ case CurrencyUnit.BITCOIN:
1086
1093
  return "BTC";
1087
- case "SATOSHI" /* SATOSHI */:
1094
+ case CurrencyUnit.SATOSHI:
1088
1095
  return "SAT";
1089
- case "MILLISATOSHI" /* MILLISATOSHI */:
1096
+ case CurrencyUnit.MILLISATOSHI:
1090
1097
  return "MSAT";
1091
- case "USD" /* USD */:
1098
+ case CurrencyUnit.USD:
1092
1099
  return "USD";
1093
1100
  }
1094
1101
  return "Unsupported CurrencyUnit";
@@ -1097,33 +1104,33 @@ function formatCurrencyStr(amount, maxFractionDigits, compact, showBtcSymbol = f
1097
1104
  const currencyAmount = getCurrencyAmount(amount);
1098
1105
  let { value: num } = currencyAmount;
1099
1106
  const { unit } = currencyAmount;
1100
- if (unit === "USD" /* USD */) {
1107
+ if (unit === CurrencyUnit.USD) {
1101
1108
  num = num / 100;
1102
1109
  }
1103
1110
  function getDefaultMaxFractionDigits(defaultDigits) {
1104
1111
  return typeof maxFractionDigits === "undefined" ? compact ? 1 : defaultDigits : maxFractionDigits;
1105
1112
  }
1106
- const symbol = !showBtcSymbol ? "" : unit === "BITCOIN" /* BITCOIN */ ? "\uE903" : unit === "SATOSHI" /* SATOSHI */ ? "\uE902" : "";
1113
+ const symbol = !showBtcSymbol ? "" : unit === CurrencyUnit.BITCOIN ? "\uE903" : unit === CurrencyUnit.SATOSHI ? "\uE902" : "";
1107
1114
  const currentLocale = getCurrentLocale();
1108
1115
  switch (unit) {
1109
- case "BITCOIN" /* BITCOIN */:
1116
+ case CurrencyUnit.BITCOIN:
1110
1117
  return `${symbol}${num.toLocaleString(currentLocale, {
1111
1118
  notation: compact ? "compact" : void 0,
1112
1119
  maximumFractionDigits: getDefaultMaxFractionDigits(4),
1113
1120
  ...options
1114
1121
  })}`;
1115
- case "MILLISATOSHI" /* MILLISATOSHI */:
1116
- case "SATOSHI" /* SATOSHI */:
1117
- case "MICROBITCOIN" /* MICROBITCOIN */:
1118
- case "MILLIBITCOIN" /* MILLIBITCOIN */:
1119
- case "NANOBITCOIN" /* NANOBITCOIN */:
1122
+ case CurrencyUnit.MILLISATOSHI:
1123
+ case CurrencyUnit.SATOSHI:
1124
+ case CurrencyUnit.MICROBITCOIN:
1125
+ case CurrencyUnit.MILLIBITCOIN:
1126
+ case CurrencyUnit.NANOBITCOIN:
1120
1127
  default:
1121
1128
  return `${symbol}${num.toLocaleString(currentLocale, {
1122
1129
  notation: compact ? "compact" : void 0,
1123
1130
  maximumFractionDigits: getDefaultMaxFractionDigits(0),
1124
1131
  ...options
1125
1132
  })}`;
1126
- case "USD" /* USD */:
1133
+ case CurrencyUnit.USD:
1127
1134
  return num.toLocaleString(currentLocale, {
1128
1135
  style: "currency",
1129
1136
  currency: defaultCurrencyCode,
@@ -1678,7 +1685,6 @@ var Requester_default = Requester;
1678
1685
  getLocalStorageConfigItem,
1679
1686
  hexToBytes,
1680
1687
  isBrowser,
1681
- isCurrencyAmount,
1682
1688
  isCurrencyAmountObj,
1683
1689
  isCurrencyMap,
1684
1690
  isError,
@@ -1686,6 +1692,7 @@ var Requester_default = Requester;
1686
1692
  isErrorWithMessage,
1687
1693
  isNode,
1688
1694
  isNumber,
1695
+ isSDKCurrencyAmount,
1689
1696
  isTest,
1690
1697
  isType,
1691
1698
  isUint8Array,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { Y as ById, C as ConfigKeys, 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, C as ConfigKeys, 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';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  declare class LightsparkException extends Error {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Y as ById, C as ConfigKeys, 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, C as ConfigKeys, 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';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  declare class LightsparkException extends Error {
package/dist/index.js CHANGED
@@ -20,7 +20,6 @@ import {
20
20
  getLocalStorageConfigItem,
21
21
  hexToBytes,
22
22
  isBrowser,
23
- isCurrencyAmount,
24
23
  isCurrencyAmountObj,
25
24
  isCurrencyMap,
26
25
  isError,
@@ -28,6 +27,7 @@ import {
28
27
  isErrorWithMessage,
29
28
  isNode,
30
29
  isNumber,
30
+ isSDKCurrencyAmount,
31
31
  isTest,
32
32
  isType,
33
33
  isUint8Array,
@@ -43,7 +43,7 @@ import {
43
43
  setLocalStorageBoolean,
44
44
  sleep,
45
45
  urlsafe_b64decode
46
- } from "./chunk-Y3FWNVYS.js";
46
+ } from "./chunk-RC2KOZKZ.js";
47
47
 
48
48
  // src/Logger.ts
49
49
  var LoggingLevel = /* @__PURE__ */ ((LoggingLevel2) => {
@@ -718,7 +718,6 @@ export {
718
718
  getLocalStorageConfigItem,
719
719
  hexToBytes,
720
720
  isBrowser,
721
- isCurrencyAmount,
722
721
  isCurrencyAmountObj,
723
722
  isCurrencyMap,
724
723
  isError,
@@ -726,6 +725,7 @@ export {
726
725
  isErrorWithMessage,
727
726
  isNode,
728
727
  isNumber,
728
+ isSDKCurrencyAmount,
729
729
  isTest,
730
730
  isType,
731
731
  isUint8Array,