@lightsparkdev/core 1.4.2 → 1.4.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 +14 -0
- package/README.md +0 -2
- package/dist/{chunk-CP4LQTTD.js → chunk-ADHQHZNM.js} +50 -18
- package/dist/chunk-VY7NND44.js +713 -0
- package/dist/{index-BCTAeaWD.d.cts → index-CFQtMxrx.d.cts} +18 -2
- package/dist/{index-BCTAeaWD.d.ts → index-CFQtMxrx.d.ts} +18 -2
- package/dist/index.cjs +2586 -2532
- package/dist/index.d.cts +8 -171
- package/dist/index.d.ts +8 -171
- package/dist/index.js +34 -674
- package/dist/react-native/index.cjs +3111 -0
- package/dist/react-native/index.d.cts +175 -0
- package/dist/react-native/index.d.ts +175 -0
- package/dist/react-native/index.js +154 -0
- package/dist/utils/index.cjs +45 -10
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +7 -1
- package/package.json +15 -1
- package/src/Logger.ts +2 -1
- package/src/crypto/SigningKey.ts +4 -2
- package/src/index.ts +3 -11
- package/src/react-native/index.ts +2 -0
- package/src/requester/DefaultRequester.ts +46 -0
- package/src/requester/Requester.ts +21 -37
- package/src/requester/tests/DefaultRequester.test.ts +129 -0
- package/src/requester/tests/Requester.test.ts +23 -32
- package/src/shared.ts +10 -0
- package/src/utils/currency.ts +42 -1
- package/src/utils/environment.ts +10 -0
|
@@ -28,6 +28,7 @@ declare const CurrencyUnit: {
|
|
|
28
28
|
readonly PHP: "PHP";
|
|
29
29
|
readonly EUR: "EUR";
|
|
30
30
|
readonly GBP: "GBP";
|
|
31
|
+
readonly INR: "INR";
|
|
31
32
|
readonly Bitcoin: "BITCOIN";
|
|
32
33
|
readonly Microbitcoin: "MICROBITCOIN";
|
|
33
34
|
readonly Millibitcoin: "MILLIBITCOIN";
|
|
@@ -38,6 +39,7 @@ declare const CurrencyUnit: {
|
|
|
38
39
|
readonly Mxn: "MXN";
|
|
39
40
|
readonly Php: "PHP";
|
|
40
41
|
readonly Gbp: "GBP";
|
|
42
|
+
readonly Inr: "INR";
|
|
41
43
|
};
|
|
42
44
|
type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
|
|
43
45
|
type SDKCurrencyAmountType = {
|
|
@@ -64,6 +66,7 @@ type CurrencyMap = {
|
|
|
64
66
|
[CurrencyUnit.PHP]: number;
|
|
65
67
|
[CurrencyUnit.EUR]: number;
|
|
66
68
|
[CurrencyUnit.GBP]: number;
|
|
69
|
+
[CurrencyUnit.INR]: number;
|
|
67
70
|
[CurrencyUnit.FUTURE_VALUE]: number;
|
|
68
71
|
formatted: {
|
|
69
72
|
sats: string;
|
|
@@ -80,6 +83,7 @@ type CurrencyMap = {
|
|
|
80
83
|
[CurrencyUnit.PHP]: string;
|
|
81
84
|
[CurrencyUnit.EUR]: string;
|
|
82
85
|
[CurrencyUnit.GBP]: string;
|
|
86
|
+
[CurrencyUnit.INR]: string;
|
|
83
87
|
[CurrencyUnit.FUTURE_VALUE]: string;
|
|
84
88
|
};
|
|
85
89
|
isZero: boolean;
|
|
@@ -135,7 +139,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
|
|
|
135
139
|
};
|
|
136
140
|
declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
|
|
137
141
|
declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
|
|
138
|
-
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
142
|
+
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "INR" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
139
143
|
type AppendUnitsOptions = {
|
|
140
144
|
plural?: boolean | undefined;
|
|
141
145
|
lowercase?: boolean | undefined;
|
|
@@ -153,10 +157,22 @@ declare function separateCurrencyStrParts(currencyStr: string): {
|
|
|
153
157
|
amount: string;
|
|
154
158
|
};
|
|
155
159
|
declare function localeToCurrencySymbol(locale: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Formats an amount from the smallest currency unit to a display string
|
|
162
|
+
* @param amount - The amount in the smallest currency unit (No decimals)
|
|
163
|
+
* @param currency - The currency object with code and decimals
|
|
164
|
+
* @returns Formatted string like "12.50 USD" or empty string if invalid
|
|
165
|
+
*/
|
|
166
|
+
declare function formatInviteAmount(amount: number | null | undefined, currency: UmaCurrency | null | undefined): string;
|
|
156
167
|
|
|
168
|
+
declare global {
|
|
169
|
+
const Bare: unknown;
|
|
170
|
+
}
|
|
157
171
|
declare const isBrowser: boolean;
|
|
158
172
|
declare const isNode: boolean;
|
|
159
173
|
declare const isTest: boolean;
|
|
174
|
+
declare const isBare: boolean;
|
|
175
|
+
declare const isReactNative: boolean;
|
|
160
176
|
|
|
161
177
|
type Maybe<T> = T | null | undefined;
|
|
162
178
|
type ExpandRecursively<T> = T extends object ? T extends infer O ? {
|
|
@@ -321,4 +337,4 @@ declare const zipcodeToStateCode: Record<string, StateCode>;
|
|
|
321
337
|
*/
|
|
322
338
|
declare function zipcodeToState(zipcode: string): StateCode | null;
|
|
323
339
|
|
|
324
|
-
export {
|
|
340
|
+
export { getLocalStorageBoolean as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, formatInviteAmount as G, isBrowser as H, isNode as I, isTest as J, isBare as K, isReactNative as L, isError as M, isErrorWithMessage as N, getErrorMsg as O, isErrorMsg as P, errorToJSON as Q, bytesToHex as R, type SDKCurrencyAmountType as S, hexToBytes as T, type UmaCurrency as U, getCurrentLocale as V, countryCodesToCurrencyCodes as W, type CurrencyLocales as X, type CurrencyCodes as Y, localeToCurrencyCode as Z, getLocalStorageConfigItem as _, b64encode as a, setLocalStorageBoolean as a0, deleteLocalStorageItem as a1, clamp as a2, linearInterpolate as a3, round as a4, isNumber as a5, pollUntil as a6, sleep as a7, lsidToUUID as a8, isUint8Array as a9, isObject as aa, isRecord as ab, type Maybe as ac, type ExpandRecursively as ad, type ById as ae, type OmitTypename as af, isType as ag, type ExtractByTypename as ah, type DeepPartial as ai, type JSONLiteral as aj, type JSONType as ak, type JSONObject as al, type NN as am, notNullUndefined as an, type PartialBy as ao, type Complete as ap, type RequiredKeys as aq, type StateCode as ar, zipcodeToStateCode as as, zipcodeToState as at, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, ensureArray as e, CurrencyUnit as f, type CurrencyUnitType as g, convertCurrencyAmountValue as h, convertCurrencyAmount as i, type CurrencyMap as j, type CurrencyAmountInputObj as k, type UmaCurrencyAmount as l, type CurrencyAmountObj as m, type CurrencyAmountPreferenceObj as n, type CurrencyAmountArg as o, isCurrencyAmountInputObj as p, isUmaCurrencyAmount as q, isDeprecatedCurrencyAmountObj as r, isCurrencyAmountObj as s, isCurrencyAmountPreferenceObj as t, urlsafe_b64decode as u, isSDKCurrencyAmount as v, getCurrencyAmount as w, mapCurrencyAmount as x, isCurrencyMap as y, abbrCurrencyUnit as z };
|
|
@@ -28,6 +28,7 @@ declare const CurrencyUnit: {
|
|
|
28
28
|
readonly PHP: "PHP";
|
|
29
29
|
readonly EUR: "EUR";
|
|
30
30
|
readonly GBP: "GBP";
|
|
31
|
+
readonly INR: "INR";
|
|
31
32
|
readonly Bitcoin: "BITCOIN";
|
|
32
33
|
readonly Microbitcoin: "MICROBITCOIN";
|
|
33
34
|
readonly Millibitcoin: "MILLIBITCOIN";
|
|
@@ -38,6 +39,7 @@ declare const CurrencyUnit: {
|
|
|
38
39
|
readonly Mxn: "MXN";
|
|
39
40
|
readonly Php: "PHP";
|
|
40
41
|
readonly Gbp: "GBP";
|
|
42
|
+
readonly Inr: "INR";
|
|
41
43
|
};
|
|
42
44
|
type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
|
|
43
45
|
type SDKCurrencyAmountType = {
|
|
@@ -64,6 +66,7 @@ type CurrencyMap = {
|
|
|
64
66
|
[CurrencyUnit.PHP]: number;
|
|
65
67
|
[CurrencyUnit.EUR]: number;
|
|
66
68
|
[CurrencyUnit.GBP]: number;
|
|
69
|
+
[CurrencyUnit.INR]: number;
|
|
67
70
|
[CurrencyUnit.FUTURE_VALUE]: number;
|
|
68
71
|
formatted: {
|
|
69
72
|
sats: string;
|
|
@@ -80,6 +83,7 @@ type CurrencyMap = {
|
|
|
80
83
|
[CurrencyUnit.PHP]: string;
|
|
81
84
|
[CurrencyUnit.EUR]: string;
|
|
82
85
|
[CurrencyUnit.GBP]: string;
|
|
86
|
+
[CurrencyUnit.INR]: string;
|
|
83
87
|
[CurrencyUnit.FUTURE_VALUE]: string;
|
|
84
88
|
};
|
|
85
89
|
isZero: boolean;
|
|
@@ -135,7 +139,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
|
|
|
135
139
|
};
|
|
136
140
|
declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
|
|
137
141
|
declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
|
|
138
|
-
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
142
|
+
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "INR" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
139
143
|
type AppendUnitsOptions = {
|
|
140
144
|
plural?: boolean | undefined;
|
|
141
145
|
lowercase?: boolean | undefined;
|
|
@@ -153,10 +157,22 @@ declare function separateCurrencyStrParts(currencyStr: string): {
|
|
|
153
157
|
amount: string;
|
|
154
158
|
};
|
|
155
159
|
declare function localeToCurrencySymbol(locale: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Formats an amount from the smallest currency unit to a display string
|
|
162
|
+
* @param amount - The amount in the smallest currency unit (No decimals)
|
|
163
|
+
* @param currency - The currency object with code and decimals
|
|
164
|
+
* @returns Formatted string like "12.50 USD" or empty string if invalid
|
|
165
|
+
*/
|
|
166
|
+
declare function formatInviteAmount(amount: number | null | undefined, currency: UmaCurrency | null | undefined): string;
|
|
156
167
|
|
|
168
|
+
declare global {
|
|
169
|
+
const Bare: unknown;
|
|
170
|
+
}
|
|
157
171
|
declare const isBrowser: boolean;
|
|
158
172
|
declare const isNode: boolean;
|
|
159
173
|
declare const isTest: boolean;
|
|
174
|
+
declare const isBare: boolean;
|
|
175
|
+
declare const isReactNative: boolean;
|
|
160
176
|
|
|
161
177
|
type Maybe<T> = T | null | undefined;
|
|
162
178
|
type ExpandRecursively<T> = T extends object ? T extends infer O ? {
|
|
@@ -321,4 +337,4 @@ declare const zipcodeToStateCode: Record<string, StateCode>;
|
|
|
321
337
|
*/
|
|
322
338
|
declare function zipcodeToState(zipcode: string): StateCode | null;
|
|
323
339
|
|
|
324
|
-
export {
|
|
340
|
+
export { getLocalStorageBoolean as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, formatInviteAmount as G, isBrowser as H, isNode as I, isTest as J, isBare as K, isReactNative as L, isError as M, isErrorWithMessage as N, getErrorMsg as O, isErrorMsg as P, errorToJSON as Q, bytesToHex as R, type SDKCurrencyAmountType as S, hexToBytes as T, type UmaCurrency as U, getCurrentLocale as V, countryCodesToCurrencyCodes as W, type CurrencyLocales as X, type CurrencyCodes as Y, localeToCurrencyCode as Z, getLocalStorageConfigItem as _, b64encode as a, setLocalStorageBoolean as a0, deleteLocalStorageItem as a1, clamp as a2, linearInterpolate as a3, round as a4, isNumber as a5, pollUntil as a6, sleep as a7, lsidToUUID as a8, isUint8Array as a9, isObject as aa, isRecord as ab, type Maybe as ac, type ExpandRecursively as ad, type ById as ae, type OmitTypename as af, isType as ag, type ExtractByTypename as ah, type DeepPartial as ai, type JSONLiteral as aj, type JSONType as ak, type JSONObject as al, type NN as am, notNullUndefined as an, type PartialBy as ao, type Complete as ap, type RequiredKeys as aq, type StateCode as ar, zipcodeToStateCode as as, zipcodeToState as at, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, ensureArray as e, CurrencyUnit as f, type CurrencyUnitType as g, convertCurrencyAmountValue as h, convertCurrencyAmount as i, type CurrencyMap as j, type CurrencyAmountInputObj as k, type UmaCurrencyAmount as l, type CurrencyAmountObj as m, type CurrencyAmountPreferenceObj as n, type CurrencyAmountArg as o, isCurrencyAmountInputObj as p, isUmaCurrencyAmount as q, isDeprecatedCurrencyAmountObj as r, isCurrencyAmountObj as s, isCurrencyAmountPreferenceObj as t, urlsafe_b64decode as u, isSDKCurrencyAmount as v, getCurrencyAmount as w, mapCurrencyAmount as x, isCurrencyMap as y, abbrCurrencyUnit as z };
|