@lightsparkdev/core 1.2.2 → 1.2.4
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/CHANGELOG.md +13 -0
- package/dist/{chunk-22DUJXVY.js → chunk-CKJUUY2Z.js} +66 -46
- package/dist/{index-DdZ7x9Ef.d.cts → index-DIJ9IVY1.d.cts} +22 -6
- package/dist/{index-DdZ7x9Ef.d.ts → index-DIJ9IVY1.d.ts} +22 -6
- package/dist/index.cjs +70 -56
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -11
- package/dist/utils/index.cjs +68 -46
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +5 -1
- package/package.json +1 -3
- package/src/requester/Requester.ts +2 -11
- package/src/utils/currency.ts +120 -45
package/dist/index.cjs
CHANGED
|
@@ -69,7 +69,9 @@ __export(src_exports, {
|
|
|
69
69
|
hexToBytes: () => hexToBytes,
|
|
70
70
|
isBrowser: () => isBrowser,
|
|
71
71
|
isCurrencyAmountObj: () => isCurrencyAmountObj,
|
|
72
|
+
isCurrencyAmountPreferenceObj: () => isCurrencyAmountPreferenceObj,
|
|
72
73
|
isCurrencyMap: () => isCurrencyMap,
|
|
74
|
+
isDeprecatedCurrencyAmountObj: () => isDeprecatedCurrencyAmountObj,
|
|
73
75
|
isError: () => isError,
|
|
74
76
|
isErrorMsg: () => isErrorMsg,
|
|
75
77
|
isErrorWithMessage: () => isErrorWithMessage,
|
|
@@ -787,18 +789,37 @@ var CurrencyUnit = {
|
|
|
787
789
|
BITCOIN: "BITCOIN",
|
|
788
790
|
SATOSHI: "SATOSHI",
|
|
789
791
|
MILLISATOSHI: "MILLISATOSHI",
|
|
790
|
-
USD: "USD",
|
|
791
792
|
NANOBITCOIN: "NANOBITCOIN",
|
|
792
793
|
MICROBITCOIN: "MICROBITCOIN",
|
|
793
794
|
MILLIBITCOIN: "MILLIBITCOIN",
|
|
795
|
+
USD: "USD",
|
|
796
|
+
MXN: "MXN",
|
|
794
797
|
Bitcoin: "BITCOIN",
|
|
795
798
|
Microbitcoin: "MICROBITCOIN",
|
|
796
799
|
Millibitcoin: "MILLIBITCOIN",
|
|
797
800
|
Millisatoshi: "MILLISATOSHI",
|
|
798
801
|
Nanobitcoin: "NANOBITCOIN",
|
|
799
802
|
Satoshi: "SATOSHI",
|
|
800
|
-
Usd: "USD"
|
|
803
|
+
Usd: "USD",
|
|
804
|
+
Mxn: "MXN"
|
|
805
|
+
};
|
|
806
|
+
var standardUnitConversionObj = {
|
|
807
|
+
[CurrencyUnit.BITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc,
|
|
808
|
+
[CurrencyUnit.MICROBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e6,
|
|
809
|
+
[CurrencyUnit.MILLIBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e3,
|
|
810
|
+
[CurrencyUnit.MILLISATOSHI]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e11,
|
|
811
|
+
[CurrencyUnit.NANOBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e9,
|
|
812
|
+
[CurrencyUnit.SATOSHI]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e8,
|
|
813
|
+
/* Converting between two different fiat types is not currently supported */
|
|
814
|
+
[CurrencyUnit.USD]: (v) => v,
|
|
815
|
+
[CurrencyUnit.MXN]: (v) => v
|
|
801
816
|
};
|
|
817
|
+
var toBitcoinConversion = (v, unitsPerBtc = 1) => round(v * unitsPerBtc);
|
|
818
|
+
var toMicrobitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e6 * unitsPerBtc);
|
|
819
|
+
var toMillibitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e3 * unitsPerBtc);
|
|
820
|
+
var toMillisatoshiConversion = (v, unitsPerBtc = 1) => round(v / 1e11 * unitsPerBtc);
|
|
821
|
+
var toNanobitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e9 * unitsPerBtc);
|
|
822
|
+
var toSatoshiConversion = (v, unitsPerBtc = 1) => round(v / 1e8 * unitsPerBtc);
|
|
802
823
|
var CONVERSION_MAP = {
|
|
803
824
|
[CurrencyUnit.BITCOIN]: {
|
|
804
825
|
[CurrencyUnit.BITCOIN]: (v) => v,
|
|
@@ -807,10 +828,8 @@ var CONVERSION_MAP = {
|
|
|
807
828
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e11,
|
|
808
829
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
|
|
809
830
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e8,
|
|
810
|
-
[CurrencyUnit.USD]:
|
|
811
|
-
|
|
812
|
-
round(v * centsPerBtc, 2)
|
|
813
|
-
)
|
|
831
|
+
[CurrencyUnit.USD]: toBitcoinConversion,
|
|
832
|
+
[CurrencyUnit.MXN]: toBitcoinConversion
|
|
814
833
|
},
|
|
815
834
|
[CurrencyUnit.MICROBITCOIN]: {
|
|
816
835
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e6,
|
|
@@ -819,10 +838,8 @@ var CONVERSION_MAP = {
|
|
|
819
838
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e5,
|
|
820
839
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
|
|
821
840
|
[CurrencyUnit.SATOSHI]: (v) => v * 100,
|
|
822
|
-
[CurrencyUnit.USD]:
|
|
823
|
-
|
|
824
|
-
round(v / 1e6 * centsPerBtc)
|
|
825
|
-
)
|
|
841
|
+
[CurrencyUnit.USD]: toMicrobitcoinConversion,
|
|
842
|
+
[CurrencyUnit.MXN]: toMicrobitcoinConversion
|
|
826
843
|
},
|
|
827
844
|
[CurrencyUnit.MILLIBITCOIN]: {
|
|
828
845
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e3,
|
|
@@ -831,10 +848,8 @@ var CONVERSION_MAP = {
|
|
|
831
848
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e8,
|
|
832
849
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
|
|
833
850
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e5,
|
|
834
|
-
[CurrencyUnit.USD]:
|
|
835
|
-
|
|
836
|
-
round(v / 1e3 * centsPerBtc)
|
|
837
|
-
)
|
|
851
|
+
[CurrencyUnit.USD]: toMillibitcoinConversion,
|
|
852
|
+
[CurrencyUnit.MXN]: toMillibitcoinConversion
|
|
838
853
|
},
|
|
839
854
|
[CurrencyUnit.MILLISATOSHI]: {
|
|
840
855
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e11,
|
|
@@ -843,10 +858,8 @@ var CONVERSION_MAP = {
|
|
|
843
858
|
[CurrencyUnit.MILLISATOSHI]: (v) => v,
|
|
844
859
|
[CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
|
|
845
860
|
[CurrencyUnit.SATOSHI]: (v) => v / 1e3,
|
|
846
|
-
[CurrencyUnit.USD]:
|
|
847
|
-
|
|
848
|
-
round(v / 1e11 * centsPerBtc)
|
|
849
|
-
)
|
|
861
|
+
[CurrencyUnit.USD]: toMillisatoshiConversion,
|
|
862
|
+
[CurrencyUnit.MXN]: toMillisatoshiConversion
|
|
850
863
|
},
|
|
851
864
|
[CurrencyUnit.NANOBITCOIN]: {
|
|
852
865
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e9,
|
|
@@ -855,10 +868,8 @@ var CONVERSION_MAP = {
|
|
|
855
868
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 100,
|
|
856
869
|
[CurrencyUnit.NANOBITCOIN]: (v) => v,
|
|
857
870
|
[CurrencyUnit.SATOSHI]: (v) => v / 10,
|
|
858
|
-
[CurrencyUnit.USD]:
|
|
859
|
-
|
|
860
|
-
round(v / 1e9 * centsPerBtc)
|
|
861
|
-
)
|
|
871
|
+
[CurrencyUnit.USD]: toNanobitcoinConversion,
|
|
872
|
+
[CurrencyUnit.MXN]: toNanobitcoinConversion
|
|
862
873
|
},
|
|
863
874
|
[CurrencyUnit.SATOSHI]: {
|
|
864
875
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e8,
|
|
@@ -867,22 +878,13 @@ var CONVERSION_MAP = {
|
|
|
867
878
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e3,
|
|
868
879
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
|
|
869
880
|
[CurrencyUnit.SATOSHI]: (v) => v,
|
|
870
|
-
[CurrencyUnit.USD]:
|
|
871
|
-
|
|
872
|
-
round(v / 1e8 * centsPerBtc)
|
|
873
|
-
)
|
|
881
|
+
[CurrencyUnit.USD]: toSatoshiConversion,
|
|
882
|
+
[CurrencyUnit.MXN]: toSatoshiConversion
|
|
874
883
|
},
|
|
875
|
-
[CurrencyUnit.USD]:
|
|
876
|
-
|
|
877
|
-
[CurrencyUnit.MICROBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
|
|
878
|
-
[CurrencyUnit.MILLIBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
|
|
879
|
-
[CurrencyUnit.MILLISATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
|
|
880
|
-
[CurrencyUnit.NANOBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
|
|
881
|
-
[CurrencyUnit.SATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
|
|
882
|
-
[CurrencyUnit.USD]: (v) => v
|
|
883
|
-
}
|
|
884
|
+
[CurrencyUnit.USD]: standardUnitConversionObj,
|
|
885
|
+
[CurrencyUnit.MXN]: standardUnitConversionObj
|
|
884
886
|
};
|
|
885
|
-
function convertCurrencyAmountValue(fromUnit, toUnit, amount,
|
|
887
|
+
function convertCurrencyAmountValue(fromUnit, toUnit, amount, unitsPerBtc = 1) {
|
|
886
888
|
if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
|
|
887
889
|
throw new LightsparkException_default("CurrencyError", `Unsupported CurrencyUnit.`);
|
|
888
890
|
}
|
|
@@ -896,7 +898,7 @@ function convertCurrencyAmountValue(fromUnit, toUnit, amount, centsPerBtc = 1) {
|
|
|
896
898
|
`Cannot convert from ${fromUnit} to ${toUnit}`
|
|
897
899
|
);
|
|
898
900
|
}
|
|
899
|
-
return conversionFn(amount,
|
|
901
|
+
return conversionFn(amount, unitsPerBtc);
|
|
900
902
|
}
|
|
901
903
|
var convertCurrencyAmount = (from, toUnit) => {
|
|
902
904
|
const value = convertCurrencyAmountValue(
|
|
@@ -911,9 +913,15 @@ var convertCurrencyAmount = (from, toUnit) => {
|
|
|
911
913
|
preferredCurrencyValueRounded: value
|
|
912
914
|
};
|
|
913
915
|
};
|
|
914
|
-
function
|
|
916
|
+
function isDeprecatedCurrencyAmountObj(arg) {
|
|
915
917
|
return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
|
|
916
918
|
}
|
|
919
|
+
function isCurrencyAmountObj(arg) {
|
|
920
|
+
return typeof arg === "object" && arg !== null && "original_value" in arg && "original_unit" in arg;
|
|
921
|
+
}
|
|
922
|
+
function isCurrencyAmountPreferenceObj(arg) {
|
|
923
|
+
return typeof arg === "object" && arg !== null && "preferred_currency_unit" in arg && "preferred_currency_value_rounded" in arg;
|
|
924
|
+
}
|
|
917
925
|
function isSDKCurrencyAmount(arg) {
|
|
918
926
|
return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
|
|
919
927
|
"originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
|
|
@@ -930,7 +938,13 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
930
938
|
if (isSDKCurrencyAmount(currencyAmountArg)) {
|
|
931
939
|
value = currencyAmountArg.originalValue;
|
|
932
940
|
unit = currencyAmountArg.originalUnit;
|
|
941
|
+
} else if (isCurrencyAmountPreferenceObj(currencyAmountArg)) {
|
|
942
|
+
value = asNumber(currencyAmountArg.preferred_currency_value_rounded);
|
|
943
|
+
unit = currencyAmountArg.preferred_currency_unit;
|
|
933
944
|
} else if (isCurrencyAmountObj(currencyAmountArg)) {
|
|
945
|
+
value = asNumber(currencyAmountArg.original_value);
|
|
946
|
+
unit = currencyAmountArg.original_unit;
|
|
947
|
+
} else if (isDeprecatedCurrencyAmountObj(currencyAmountArg)) {
|
|
934
948
|
value = asNumber(currencyAmountArg.value);
|
|
935
949
|
unit = currencyAmountArg.unit;
|
|
936
950
|
}
|
|
@@ -939,21 +953,23 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
939
953
|
unit: unit || CurrencyUnit.SATOSHI
|
|
940
954
|
};
|
|
941
955
|
}
|
|
942
|
-
function mapCurrencyAmount(currencyAmountArg,
|
|
956
|
+
function mapCurrencyAmount(currencyAmountArg, unitsPerBtc = 1) {
|
|
943
957
|
const { value, unit } = getCurrencyAmount(currencyAmountArg);
|
|
944
958
|
const convert = convertCurrencyAmountValue;
|
|
945
|
-
const sats = convert(unit, CurrencyUnit.SATOSHI, value,
|
|
946
|
-
const btc = convert(unit, CurrencyUnit.BITCOIN, value,
|
|
947
|
-
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value,
|
|
948
|
-
const usd = convert(unit, CurrencyUnit.USD, value,
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
const
|
|
959
|
+
const sats = convert(unit, CurrencyUnit.SATOSHI, value, unitsPerBtc);
|
|
960
|
+
const btc = convert(unit, CurrencyUnit.BITCOIN, value, unitsPerBtc);
|
|
961
|
+
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, unitsPerBtc);
|
|
962
|
+
const usd = convert(unit, CurrencyUnit.USD, value, unitsPerBtc);
|
|
963
|
+
const mxn = convert(unit, CurrencyUnit.MXN, value, unitsPerBtc);
|
|
964
|
+
const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, unitsPerBtc);
|
|
965
|
+
const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, unitsPerBtc);
|
|
966
|
+
const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, unitsPerBtc);
|
|
952
967
|
const mapWithCurrencyUnits = {
|
|
953
968
|
[CurrencyUnit.BITCOIN]: btc,
|
|
954
969
|
[CurrencyUnit.SATOSHI]: sats,
|
|
955
970
|
[CurrencyUnit.MILLISATOSHI]: msats,
|
|
956
971
|
[CurrencyUnit.USD]: usd,
|
|
972
|
+
[CurrencyUnit.MXN]: mxn,
|
|
957
973
|
[CurrencyUnit.MICROBITCOIN]: mibtc,
|
|
958
974
|
[CurrencyUnit.MILLIBITCOIN]: mlbtc,
|
|
959
975
|
[CurrencyUnit.NANOBITCOIN]: nbtc,
|
|
@@ -987,6 +1003,10 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
|
|
|
987
1003
|
value: usd,
|
|
988
1004
|
unit: CurrencyUnit.USD
|
|
989
1005
|
}),
|
|
1006
|
+
[CurrencyUnit.MXN]: formatCurrencyStr({
|
|
1007
|
+
value: mxn,
|
|
1008
|
+
unit: CurrencyUnit.MXN
|
|
1009
|
+
}),
|
|
990
1010
|
[CurrencyUnit.FUTURE_VALUE]: "-"
|
|
991
1011
|
}
|
|
992
1012
|
};
|
|
@@ -1638,14 +1658,8 @@ var Requester = class {
|
|
|
1638
1658
|
return url.replace(/.*?:\/\//g, "");
|
|
1639
1659
|
}
|
|
1640
1660
|
async addSigningDataIfNeeded(queryPayload, headers, signingNodeId) {
|
|
1641
|
-
let TextEncoderImpl;
|
|
1642
|
-
if (typeof TextEncoder === "undefined") {
|
|
1643
|
-
TextEncoderImpl = (await import("text-encoding")).TextEncoder;
|
|
1644
|
-
} else {
|
|
1645
|
-
TextEncoderImpl = TextEncoder;
|
|
1646
|
-
}
|
|
1647
1661
|
if (!signingNodeId) {
|
|
1648
|
-
return new
|
|
1662
|
+
return new TextEncoder().encode(JSON.stringify(queryPayload));
|
|
1649
1663
|
}
|
|
1650
1664
|
const query = queryPayload.query;
|
|
1651
1665
|
const variables = queryPayload.variables;
|
|
@@ -1665,9 +1679,7 @@ var Requester = class {
|
|
|
1665
1679
|
"Missing node of encrypted_signing_private_key"
|
|
1666
1680
|
);
|
|
1667
1681
|
}
|
|
1668
|
-
const encodedPayload = new
|
|
1669
|
-
JSON.stringify(payload)
|
|
1670
|
-
);
|
|
1682
|
+
const encodedPayload = new TextEncoder().encode(JSON.stringify(payload));
|
|
1671
1683
|
const signedPayload = await key.sign(encodedPayload);
|
|
1672
1684
|
const encodedSignedPayload = b64encode(signedPayload);
|
|
1673
1685
|
headers["X-Lightspark-Signing"] = JSON.stringify({
|
|
@@ -1748,7 +1760,9 @@ var ServerEnvironment_default = ServerEnvironment;
|
|
|
1748
1760
|
hexToBytes,
|
|
1749
1761
|
isBrowser,
|
|
1750
1762
|
isCurrencyAmountObj,
|
|
1763
|
+
isCurrencyAmountPreferenceObj,
|
|
1751
1764
|
isCurrencyMap,
|
|
1765
|
+
isDeprecatedCurrencyAmountObj,
|
|
1752
1766
|
isError,
|
|
1753
1767
|
isErrorMsg,
|
|
1754
1768
|
isErrorWithMessage,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ById, ad as Complete, C as ConfigKeys, m as CurrencyAmountArg, k as CurrencyAmountObj, l as CurrencyAmountPreferenceObj, N as CurrencyCodes, M as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, a6 as DeepPartial, D as DeprecatedCurrencyAmountObj, a2 as ExpandRecursively, a7 as JSONLiteral, a9 as JSONObject, a8 as JSONType, a1 as Maybe, aa as NN, a4 as OmitTypename, ac as PartialBy, S as SDKCurrencyAmountType, t as abbrCurrencyUnit, b as b64decode, a as b64encode, I as bytesToHex, U as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, L as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, T as deleteLocalStorageItem, e as ensureArray, H as errorToJSON, v as formatCurrencyStr, K as getCurrentLocale, F as getErrorMsg, Q as getLocalStorageBoolean, P as getLocalStorageConfigItem, J as hexToBytes, y as isBrowser, o as isCurrencyAmountObj, p as isCurrencyAmountPreferenceObj, s as isCurrencyMap, n as isDeprecatedCurrencyAmountObj, B as isError, G as isErrorMsg, E as isErrorWithMessage, z as isNode, X as isNumber, a0 as isObject, q as isSDKCurrencyAmount, A as isTest, a5 as isType, $ as isUint8Array, V as linearInterpolate, O as localeToCurrencyCode, x as localeToCurrencySymbol, _ as lsidToUUID, r as mapCurrencyAmount, ab as notNullUndefined, Y as pollUntil, W as round, w as separateCurrencyStrParts, R as setLocalStorageBoolean, Z as sleep, u as urlsafe_b64decode } from './index-DIJ9IVY1.cjs';
|
|
2
2
|
import { Observable } from 'zen-observable-ts';
|
|
3
3
|
|
|
4
4
|
type Headers = Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ById, ad as Complete, C as ConfigKeys, m as CurrencyAmountArg, k as CurrencyAmountObj, l as CurrencyAmountPreferenceObj, N as CurrencyCodes, M as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, a6 as DeepPartial, D as DeprecatedCurrencyAmountObj, a2 as ExpandRecursively, a7 as JSONLiteral, a9 as JSONObject, a8 as JSONType, a1 as Maybe, aa as NN, a4 as OmitTypename, ac as PartialBy, S as SDKCurrencyAmountType, t as abbrCurrencyUnit, b as b64decode, a as b64encode, I as bytesToHex, U as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, L as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, T as deleteLocalStorageItem, e as ensureArray, H as errorToJSON, v as formatCurrencyStr, K as getCurrentLocale, F as getErrorMsg, Q as getLocalStorageBoolean, P as getLocalStorageConfigItem, J as hexToBytes, y as isBrowser, o as isCurrencyAmountObj, p as isCurrencyAmountPreferenceObj, s as isCurrencyMap, n as isDeprecatedCurrencyAmountObj, B as isError, G as isErrorMsg, E as isErrorWithMessage, z as isNode, X as isNumber, a0 as isObject, q as isSDKCurrencyAmount, A as isTest, a5 as isType, $ as isUint8Array, V as linearInterpolate, O as localeToCurrencyCode, x as localeToCurrencySymbol, _ as lsidToUUID, r as mapCurrencyAmount, ab as notNullUndefined, Y as pollUntil, W as round, w as separateCurrencyStrParts, R as setLocalStorageBoolean, Z as sleep, u as urlsafe_b64decode } from './index-DIJ9IVY1.js';
|
|
2
2
|
import { Observable } from 'zen-observable-ts';
|
|
3
3
|
|
|
4
4
|
type Headers = Record<string, string>;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
hexToBytes,
|
|
23
23
|
isBrowser,
|
|
24
24
|
isCurrencyAmountObj,
|
|
25
|
+
isCurrencyAmountPreferenceObj,
|
|
25
26
|
isCurrencyMap,
|
|
27
|
+
isDeprecatedCurrencyAmountObj,
|
|
26
28
|
isError,
|
|
27
29
|
isErrorMsg,
|
|
28
30
|
isErrorWithMessage,
|
|
@@ -45,7 +47,7 @@ import {
|
|
|
45
47
|
setLocalStorageBoolean,
|
|
46
48
|
sleep,
|
|
47
49
|
urlsafe_b64decode
|
|
48
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-CKJUUY2Z.js";
|
|
49
51
|
|
|
50
52
|
// src/auth/LightsparkAuthException.ts
|
|
51
53
|
var LightsparkAuthException = class extends LightsparkException_default {
|
|
@@ -643,14 +645,8 @@ var Requester = class {
|
|
|
643
645
|
return url.replace(/.*?:\/\//g, "");
|
|
644
646
|
}
|
|
645
647
|
async addSigningDataIfNeeded(queryPayload, headers, signingNodeId) {
|
|
646
|
-
let TextEncoderImpl;
|
|
647
|
-
if (typeof TextEncoder === "undefined") {
|
|
648
|
-
TextEncoderImpl = (await import("text-encoding")).TextEncoder;
|
|
649
|
-
} else {
|
|
650
|
-
TextEncoderImpl = TextEncoder;
|
|
651
|
-
}
|
|
652
648
|
if (!signingNodeId) {
|
|
653
|
-
return new
|
|
649
|
+
return new TextEncoder().encode(JSON.stringify(queryPayload));
|
|
654
650
|
}
|
|
655
651
|
const query = queryPayload.query;
|
|
656
652
|
const variables = queryPayload.variables;
|
|
@@ -670,9 +666,7 @@ var Requester = class {
|
|
|
670
666
|
"Missing node of encrypted_signing_private_key"
|
|
671
667
|
);
|
|
672
668
|
}
|
|
673
|
-
const encodedPayload = new
|
|
674
|
-
JSON.stringify(payload)
|
|
675
|
-
);
|
|
669
|
+
const encodedPayload = new TextEncoder().encode(JSON.stringify(payload));
|
|
676
670
|
const signedPayload = await key.sign(encodedPayload);
|
|
677
671
|
const encodedSignedPayload = b64encode(signedPayload);
|
|
678
672
|
headers["X-Lightspark-Signing"] = JSON.stringify({
|
|
@@ -752,7 +746,9 @@ export {
|
|
|
752
746
|
hexToBytes,
|
|
753
747
|
isBrowser,
|
|
754
748
|
isCurrencyAmountObj,
|
|
749
|
+
isCurrencyAmountPreferenceObj,
|
|
755
750
|
isCurrencyMap,
|
|
751
|
+
isDeprecatedCurrencyAmountObj,
|
|
756
752
|
isError,
|
|
757
753
|
isErrorMsg,
|
|
758
754
|
isErrorWithMessage,
|
package/dist/utils/index.cjs
CHANGED
|
@@ -52,7 +52,9 @@ __export(utils_exports, {
|
|
|
52
52
|
hexToBytes: () => hexToBytes,
|
|
53
53
|
isBrowser: () => isBrowser,
|
|
54
54
|
isCurrencyAmountObj: () => isCurrencyAmountObj,
|
|
55
|
+
isCurrencyAmountPreferenceObj: () => isCurrencyAmountPreferenceObj,
|
|
55
56
|
isCurrencyMap: () => isCurrencyMap,
|
|
57
|
+
isDeprecatedCurrencyAmountObj: () => isDeprecatedCurrencyAmountObj,
|
|
56
58
|
isError: () => isError,
|
|
57
59
|
isErrorMsg: () => isErrorMsg,
|
|
58
60
|
isErrorWithMessage: () => isErrorWithMessage,
|
|
@@ -482,18 +484,37 @@ var CurrencyUnit = {
|
|
|
482
484
|
BITCOIN: "BITCOIN",
|
|
483
485
|
SATOSHI: "SATOSHI",
|
|
484
486
|
MILLISATOSHI: "MILLISATOSHI",
|
|
485
|
-
USD: "USD",
|
|
486
487
|
NANOBITCOIN: "NANOBITCOIN",
|
|
487
488
|
MICROBITCOIN: "MICROBITCOIN",
|
|
488
489
|
MILLIBITCOIN: "MILLIBITCOIN",
|
|
490
|
+
USD: "USD",
|
|
491
|
+
MXN: "MXN",
|
|
489
492
|
Bitcoin: "BITCOIN",
|
|
490
493
|
Microbitcoin: "MICROBITCOIN",
|
|
491
494
|
Millibitcoin: "MILLIBITCOIN",
|
|
492
495
|
Millisatoshi: "MILLISATOSHI",
|
|
493
496
|
Nanobitcoin: "NANOBITCOIN",
|
|
494
497
|
Satoshi: "SATOSHI",
|
|
495
|
-
Usd: "USD"
|
|
498
|
+
Usd: "USD",
|
|
499
|
+
Mxn: "MXN"
|
|
500
|
+
};
|
|
501
|
+
var standardUnitConversionObj = {
|
|
502
|
+
[CurrencyUnit.BITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc,
|
|
503
|
+
[CurrencyUnit.MICROBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e6,
|
|
504
|
+
[CurrencyUnit.MILLIBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e3,
|
|
505
|
+
[CurrencyUnit.MILLISATOSHI]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e11,
|
|
506
|
+
[CurrencyUnit.NANOBITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e9,
|
|
507
|
+
[CurrencyUnit.SATOSHI]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e8,
|
|
508
|
+
/* Converting between two different fiat types is not currently supported */
|
|
509
|
+
[CurrencyUnit.USD]: (v) => v,
|
|
510
|
+
[CurrencyUnit.MXN]: (v) => v
|
|
496
511
|
};
|
|
512
|
+
var toBitcoinConversion = (v, unitsPerBtc = 1) => round(v * unitsPerBtc);
|
|
513
|
+
var toMicrobitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e6 * unitsPerBtc);
|
|
514
|
+
var toMillibitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e3 * unitsPerBtc);
|
|
515
|
+
var toMillisatoshiConversion = (v, unitsPerBtc = 1) => round(v / 1e11 * unitsPerBtc);
|
|
516
|
+
var toNanobitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e9 * unitsPerBtc);
|
|
517
|
+
var toSatoshiConversion = (v, unitsPerBtc = 1) => round(v / 1e8 * unitsPerBtc);
|
|
497
518
|
var CONVERSION_MAP = {
|
|
498
519
|
[CurrencyUnit.BITCOIN]: {
|
|
499
520
|
[CurrencyUnit.BITCOIN]: (v) => v,
|
|
@@ -502,10 +523,8 @@ var CONVERSION_MAP = {
|
|
|
502
523
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e11,
|
|
503
524
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
|
|
504
525
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e8,
|
|
505
|
-
[CurrencyUnit.USD]:
|
|
506
|
-
|
|
507
|
-
round(v * centsPerBtc, 2)
|
|
508
|
-
)
|
|
526
|
+
[CurrencyUnit.USD]: toBitcoinConversion,
|
|
527
|
+
[CurrencyUnit.MXN]: toBitcoinConversion
|
|
509
528
|
},
|
|
510
529
|
[CurrencyUnit.MICROBITCOIN]: {
|
|
511
530
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e6,
|
|
@@ -514,10 +533,8 @@ var CONVERSION_MAP = {
|
|
|
514
533
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e5,
|
|
515
534
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
|
|
516
535
|
[CurrencyUnit.SATOSHI]: (v) => v * 100,
|
|
517
|
-
[CurrencyUnit.USD]:
|
|
518
|
-
|
|
519
|
-
round(v / 1e6 * centsPerBtc)
|
|
520
|
-
)
|
|
536
|
+
[CurrencyUnit.USD]: toMicrobitcoinConversion,
|
|
537
|
+
[CurrencyUnit.MXN]: toMicrobitcoinConversion
|
|
521
538
|
},
|
|
522
539
|
[CurrencyUnit.MILLIBITCOIN]: {
|
|
523
540
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e3,
|
|
@@ -526,10 +543,8 @@ var CONVERSION_MAP = {
|
|
|
526
543
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e8,
|
|
527
544
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
|
|
528
545
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e5,
|
|
529
|
-
[CurrencyUnit.USD]:
|
|
530
|
-
|
|
531
|
-
round(v / 1e3 * centsPerBtc)
|
|
532
|
-
)
|
|
546
|
+
[CurrencyUnit.USD]: toMillibitcoinConversion,
|
|
547
|
+
[CurrencyUnit.MXN]: toMillibitcoinConversion
|
|
533
548
|
},
|
|
534
549
|
[CurrencyUnit.MILLISATOSHI]: {
|
|
535
550
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e11,
|
|
@@ -538,10 +553,8 @@ var CONVERSION_MAP = {
|
|
|
538
553
|
[CurrencyUnit.MILLISATOSHI]: (v) => v,
|
|
539
554
|
[CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
|
|
540
555
|
[CurrencyUnit.SATOSHI]: (v) => v / 1e3,
|
|
541
|
-
[CurrencyUnit.USD]:
|
|
542
|
-
|
|
543
|
-
round(v / 1e11 * centsPerBtc)
|
|
544
|
-
)
|
|
556
|
+
[CurrencyUnit.USD]: toMillisatoshiConversion,
|
|
557
|
+
[CurrencyUnit.MXN]: toMillisatoshiConversion
|
|
545
558
|
},
|
|
546
559
|
[CurrencyUnit.NANOBITCOIN]: {
|
|
547
560
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e9,
|
|
@@ -550,10 +563,8 @@ var CONVERSION_MAP = {
|
|
|
550
563
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 100,
|
|
551
564
|
[CurrencyUnit.NANOBITCOIN]: (v) => v,
|
|
552
565
|
[CurrencyUnit.SATOSHI]: (v) => v / 10,
|
|
553
|
-
[CurrencyUnit.USD]:
|
|
554
|
-
|
|
555
|
-
round(v / 1e9 * centsPerBtc)
|
|
556
|
-
)
|
|
566
|
+
[CurrencyUnit.USD]: toNanobitcoinConversion,
|
|
567
|
+
[CurrencyUnit.MXN]: toNanobitcoinConversion
|
|
557
568
|
},
|
|
558
569
|
[CurrencyUnit.SATOSHI]: {
|
|
559
570
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e8,
|
|
@@ -562,22 +573,13 @@ var CONVERSION_MAP = {
|
|
|
562
573
|
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e3,
|
|
563
574
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
|
|
564
575
|
[CurrencyUnit.SATOSHI]: (v) => v,
|
|
565
|
-
[CurrencyUnit.USD]:
|
|
566
|
-
|
|
567
|
-
round(v / 1e8 * centsPerBtc)
|
|
568
|
-
)
|
|
576
|
+
[CurrencyUnit.USD]: toSatoshiConversion,
|
|
577
|
+
[CurrencyUnit.MXN]: toSatoshiConversion
|
|
569
578
|
},
|
|
570
|
-
[CurrencyUnit.USD]:
|
|
571
|
-
|
|
572
|
-
[CurrencyUnit.MICROBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
|
|
573
|
-
[CurrencyUnit.MILLIBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
|
|
574
|
-
[CurrencyUnit.MILLISATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
|
|
575
|
-
[CurrencyUnit.NANOBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
|
|
576
|
-
[CurrencyUnit.SATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
|
|
577
|
-
[CurrencyUnit.USD]: (v) => v
|
|
578
|
-
}
|
|
579
|
+
[CurrencyUnit.USD]: standardUnitConversionObj,
|
|
580
|
+
[CurrencyUnit.MXN]: standardUnitConversionObj
|
|
579
581
|
};
|
|
580
|
-
function convertCurrencyAmountValue(fromUnit, toUnit, amount,
|
|
582
|
+
function convertCurrencyAmountValue(fromUnit, toUnit, amount, unitsPerBtc = 1) {
|
|
581
583
|
if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
|
|
582
584
|
throw new LightsparkException_default("CurrencyError", `Unsupported CurrencyUnit.`);
|
|
583
585
|
}
|
|
@@ -591,7 +593,7 @@ function convertCurrencyAmountValue(fromUnit, toUnit, amount, centsPerBtc = 1) {
|
|
|
591
593
|
`Cannot convert from ${fromUnit} to ${toUnit}`
|
|
592
594
|
);
|
|
593
595
|
}
|
|
594
|
-
return conversionFn(amount,
|
|
596
|
+
return conversionFn(amount, unitsPerBtc);
|
|
595
597
|
}
|
|
596
598
|
var convertCurrencyAmount = (from, toUnit) => {
|
|
597
599
|
const value = convertCurrencyAmountValue(
|
|
@@ -606,9 +608,15 @@ var convertCurrencyAmount = (from, toUnit) => {
|
|
|
606
608
|
preferredCurrencyValueRounded: value
|
|
607
609
|
};
|
|
608
610
|
};
|
|
609
|
-
function
|
|
611
|
+
function isDeprecatedCurrencyAmountObj(arg) {
|
|
610
612
|
return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
|
|
611
613
|
}
|
|
614
|
+
function isCurrencyAmountObj(arg) {
|
|
615
|
+
return typeof arg === "object" && arg !== null && "original_value" in arg && "original_unit" in arg;
|
|
616
|
+
}
|
|
617
|
+
function isCurrencyAmountPreferenceObj(arg) {
|
|
618
|
+
return typeof arg === "object" && arg !== null && "preferred_currency_unit" in arg && "preferred_currency_value_rounded" in arg;
|
|
619
|
+
}
|
|
612
620
|
function isSDKCurrencyAmount(arg) {
|
|
613
621
|
return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
|
|
614
622
|
"originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
|
|
@@ -625,7 +633,13 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
625
633
|
if (isSDKCurrencyAmount(currencyAmountArg)) {
|
|
626
634
|
value = currencyAmountArg.originalValue;
|
|
627
635
|
unit = currencyAmountArg.originalUnit;
|
|
636
|
+
} else if (isCurrencyAmountPreferenceObj(currencyAmountArg)) {
|
|
637
|
+
value = asNumber(currencyAmountArg.preferred_currency_value_rounded);
|
|
638
|
+
unit = currencyAmountArg.preferred_currency_unit;
|
|
628
639
|
} else if (isCurrencyAmountObj(currencyAmountArg)) {
|
|
640
|
+
value = asNumber(currencyAmountArg.original_value);
|
|
641
|
+
unit = currencyAmountArg.original_unit;
|
|
642
|
+
} else if (isDeprecatedCurrencyAmountObj(currencyAmountArg)) {
|
|
629
643
|
value = asNumber(currencyAmountArg.value);
|
|
630
644
|
unit = currencyAmountArg.unit;
|
|
631
645
|
}
|
|
@@ -634,21 +648,23 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
634
648
|
unit: unit || CurrencyUnit.SATOSHI
|
|
635
649
|
};
|
|
636
650
|
}
|
|
637
|
-
function mapCurrencyAmount(currencyAmountArg,
|
|
651
|
+
function mapCurrencyAmount(currencyAmountArg, unitsPerBtc = 1) {
|
|
638
652
|
const { value, unit } = getCurrencyAmount(currencyAmountArg);
|
|
639
653
|
const convert = convertCurrencyAmountValue;
|
|
640
|
-
const sats = convert(unit, CurrencyUnit.SATOSHI, value,
|
|
641
|
-
const btc = convert(unit, CurrencyUnit.BITCOIN, value,
|
|
642
|
-
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value,
|
|
643
|
-
const usd = convert(unit, CurrencyUnit.USD, value,
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
const
|
|
654
|
+
const sats = convert(unit, CurrencyUnit.SATOSHI, value, unitsPerBtc);
|
|
655
|
+
const btc = convert(unit, CurrencyUnit.BITCOIN, value, unitsPerBtc);
|
|
656
|
+
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, unitsPerBtc);
|
|
657
|
+
const usd = convert(unit, CurrencyUnit.USD, value, unitsPerBtc);
|
|
658
|
+
const mxn = convert(unit, CurrencyUnit.MXN, value, unitsPerBtc);
|
|
659
|
+
const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, unitsPerBtc);
|
|
660
|
+
const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, unitsPerBtc);
|
|
661
|
+
const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, unitsPerBtc);
|
|
647
662
|
const mapWithCurrencyUnits = {
|
|
648
663
|
[CurrencyUnit.BITCOIN]: btc,
|
|
649
664
|
[CurrencyUnit.SATOSHI]: sats,
|
|
650
665
|
[CurrencyUnit.MILLISATOSHI]: msats,
|
|
651
666
|
[CurrencyUnit.USD]: usd,
|
|
667
|
+
[CurrencyUnit.MXN]: mxn,
|
|
652
668
|
[CurrencyUnit.MICROBITCOIN]: mibtc,
|
|
653
669
|
[CurrencyUnit.MILLIBITCOIN]: mlbtc,
|
|
654
670
|
[CurrencyUnit.NANOBITCOIN]: nbtc,
|
|
@@ -682,6 +698,10 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
|
|
|
682
698
|
value: usd,
|
|
683
699
|
unit: CurrencyUnit.USD
|
|
684
700
|
}),
|
|
701
|
+
[CurrencyUnit.MXN]: formatCurrencyStr({
|
|
702
|
+
value: mxn,
|
|
703
|
+
unit: CurrencyUnit.MXN
|
|
704
|
+
}),
|
|
685
705
|
[CurrencyUnit.FUTURE_VALUE]: "-"
|
|
686
706
|
}
|
|
687
707
|
};
|
|
@@ -1045,7 +1065,9 @@ function notNullUndefined(value) {
|
|
|
1045
1065
|
hexToBytes,
|
|
1046
1066
|
isBrowser,
|
|
1047
1067
|
isCurrencyAmountObj,
|
|
1068
|
+
isCurrencyAmountPreferenceObj,
|
|
1048
1069
|
isCurrencyMap,
|
|
1070
|
+
isDeprecatedCurrencyAmountObj,
|
|
1049
1071
|
isError,
|
|
1050
1072
|
isErrorMsg,
|
|
1051
1073
|
isErrorWithMessage,
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ById, ad as Complete, m as CurrencyAmountArg, k as CurrencyAmountObj, l as CurrencyAmountPreferenceObj, N as CurrencyCodes, M as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, a6 as DeepPartial, D as DeprecatedCurrencyAmountObj, a2 as ExpandRecursively, a7 as JSONLiteral, a9 as JSONObject, a8 as JSONType, a1 as Maybe, aa as NN, a4 as OmitTypename, ac as PartialBy, S as SDKCurrencyAmountType, t as abbrCurrencyUnit, b as b64decode, a as b64encode, I as bytesToHex, U as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, L as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, T as deleteLocalStorageItem, e as ensureArray, H as errorToJSON, v as formatCurrencyStr, K as getCurrentLocale, F as getErrorMsg, Q as getLocalStorageBoolean, P as getLocalStorageConfigItem, J as hexToBytes, y as isBrowser, o as isCurrencyAmountObj, p as isCurrencyAmountPreferenceObj, s as isCurrencyMap, n as isDeprecatedCurrencyAmountObj, B as isError, G as isErrorMsg, E as isErrorWithMessage, z as isNode, X as isNumber, a0 as isObject, q as isSDKCurrencyAmount, A as isTest, a5 as isType, $ as isUint8Array, V as linearInterpolate, O as localeToCurrencyCode, x as localeToCurrencySymbol, _ as lsidToUUID, r as mapCurrencyAmount, ab as notNullUndefined, Y as pollUntil, W as round, w as separateCurrencyStrParts, R as setLocalStorageBoolean, Z as sleep, u as urlsafe_b64decode } from '../index-DIJ9IVY1.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ById, ad as Complete, m as CurrencyAmountArg, k as CurrencyAmountObj, l as CurrencyAmountPreferenceObj, N as CurrencyCodes, M as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, a6 as DeepPartial, D as DeprecatedCurrencyAmountObj, a2 as ExpandRecursively, a7 as JSONLiteral, a9 as JSONObject, a8 as JSONType, a1 as Maybe, aa as NN, a4 as OmitTypename, ac as PartialBy, S as SDKCurrencyAmountType, t as abbrCurrencyUnit, b as b64decode, a as b64encode, I as bytesToHex, U as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, L as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, T as deleteLocalStorageItem, e as ensureArray, H as errorToJSON, v as formatCurrencyStr, K as getCurrentLocale, F as getErrorMsg, Q as getLocalStorageBoolean, P as getLocalStorageConfigItem, J as hexToBytes, y as isBrowser, o as isCurrencyAmountObj, p as isCurrencyAmountPreferenceObj, s as isCurrencyMap, n as isDeprecatedCurrencyAmountObj, B as isError, G as isErrorMsg, E as isErrorWithMessage, z as isNode, X as isNumber, a0 as isObject, q as isSDKCurrencyAmount, A as isTest, a5 as isType, $ as isUint8Array, V as linearInterpolate, O as localeToCurrencyCode, x as localeToCurrencySymbol, _ as lsidToUUID, r as mapCurrencyAmount, ab as notNullUndefined, Y as pollUntil, W as round, w as separateCurrencyStrParts, R as setLocalStorageBoolean, Z as sleep, u as urlsafe_b64decode } from '../index-DIJ9IVY1.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
hexToBytes,
|
|
22
22
|
isBrowser,
|
|
23
23
|
isCurrencyAmountObj,
|
|
24
|
+
isCurrencyAmountPreferenceObj,
|
|
24
25
|
isCurrencyMap,
|
|
26
|
+
isDeprecatedCurrencyAmountObj,
|
|
25
27
|
isError,
|
|
26
28
|
isErrorMsg,
|
|
27
29
|
isErrorWithMessage,
|
|
@@ -44,7 +46,7 @@ import {
|
|
|
44
46
|
setLocalStorageBoolean,
|
|
45
47
|
sleep,
|
|
46
48
|
urlsafe_b64decode
|
|
47
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-CKJUUY2Z.js";
|
|
48
50
|
export {
|
|
49
51
|
CurrencyUnit,
|
|
50
52
|
abbrCurrencyUnit,
|
|
@@ -68,7 +70,9 @@ export {
|
|
|
68
70
|
hexToBytes,
|
|
69
71
|
isBrowser,
|
|
70
72
|
isCurrencyAmountObj,
|
|
73
|
+
isCurrencyAmountPreferenceObj,
|
|
71
74
|
isCurrencyMap,
|
|
75
|
+
isDeprecatedCurrencyAmountObj,
|
|
72
76
|
isError,
|
|
73
77
|
isErrorMsg,
|
|
74
78
|
isErrorWithMessage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"graphql": "^16.6.0",
|
|
78
78
|
"graphql-ws": "^5.11.3",
|
|
79
79
|
"secp256k1": "^5.0.0",
|
|
80
|
-
"text-encoding": "^0.7.0",
|
|
81
80
|
"ws": "^8.12.1",
|
|
82
81
|
"zen-observable-ts": "^1.1.0"
|
|
83
82
|
},
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
"@types/jest": "^29.5.3",
|
|
89
88
|
"@types/lodash-es": "^4.17.6",
|
|
90
89
|
"@types/secp256k1": "^4.0.3",
|
|
91
|
-
"@types/text-encoding": "^0.0.36",
|
|
92
90
|
"@types/ws": "^8.5.4",
|
|
93
91
|
"auto-bind": "^5.0.1",
|
|
94
92
|
"eslint": "^8.3.0",
|