@lightsparkdev/core 1.4.1 → 1.4.3

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.
@@ -27,6 +27,8 @@ declare const CurrencyUnit: {
27
27
  readonly MXN: "MXN";
28
28
  readonly PHP: "PHP";
29
29
  readonly EUR: "EUR";
30
+ readonly GBP: "GBP";
31
+ readonly INR: "INR";
30
32
  readonly Bitcoin: "BITCOIN";
31
33
  readonly Microbitcoin: "MICROBITCOIN";
32
34
  readonly Millibitcoin: "MILLIBITCOIN";
@@ -36,6 +38,8 @@ declare const CurrencyUnit: {
36
38
  readonly Usd: "USD";
37
39
  readonly Mxn: "MXN";
38
40
  readonly Php: "PHP";
41
+ readonly Gbp: "GBP";
42
+ readonly Inr: "INR";
39
43
  };
40
44
  type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
41
45
  type SDKCurrencyAmountType = {
@@ -61,6 +65,8 @@ type CurrencyMap = {
61
65
  [CurrencyUnit.MXN]: number;
62
66
  [CurrencyUnit.PHP]: number;
63
67
  [CurrencyUnit.EUR]: number;
68
+ [CurrencyUnit.GBP]: number;
69
+ [CurrencyUnit.INR]: number;
64
70
  [CurrencyUnit.FUTURE_VALUE]: number;
65
71
  formatted: {
66
72
  sats: string;
@@ -76,6 +82,8 @@ type CurrencyMap = {
76
82
  [CurrencyUnit.MXN]: string;
77
83
  [CurrencyUnit.PHP]: string;
78
84
  [CurrencyUnit.EUR]: string;
85
+ [CurrencyUnit.GBP]: string;
86
+ [CurrencyUnit.INR]: string;
79
87
  [CurrencyUnit.FUTURE_VALUE]: string;
80
88
  };
81
89
  isZero: boolean;
@@ -131,7 +139,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
131
139
  };
132
140
  declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
133
141
  declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
134
- declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "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";
135
143
  type AppendUnitsOptions = {
136
144
  plural?: boolean | undefined;
137
145
  lowercase?: boolean | undefined;
@@ -149,10 +157,21 @@ declare function separateCurrencyStrParts(currencyStr: string): {
149
157
  amount: string;
150
158
  };
151
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;
152
167
 
168
+ declare global {
169
+ const Bare: unknown;
170
+ }
153
171
  declare const isBrowser: boolean;
154
172
  declare const isNode: boolean;
155
173
  declare const isTest: boolean;
174
+ declare const isBare: boolean;
156
175
 
157
176
  type Maybe<T> = T | null | undefined;
158
177
  type ExpandRecursively<T> = T extends object ? T extends infer O ? {
@@ -308,4 +327,13 @@ declare function isUint8Array(value: unknown): value is Uint8Array;
308
327
  declare function isObject(value: unknown): value is object;
309
328
  declare function isRecord(value: unknown): value is Record<string, unknown>;
310
329
 
311
- export { clamp as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, isBrowser as G, isNode as H, isTest as I, isError as J, isErrorWithMessage as K, getErrorMsg as L, isErrorMsg as M, errorToJSON as N, bytesToHex as O, hexToBytes as P, getCurrentLocale as Q, countryCodesToCurrencyCodes as R, type SDKCurrencyAmountType as S, type CurrencyLocales as T, type UmaCurrency as U, type CurrencyCodes as V, localeToCurrencyCode as W, getLocalStorageConfigItem as X, getLocalStorageBoolean as Y, setLocalStorageBoolean as Z, deleteLocalStorageItem as _, b64encode as a, linearInterpolate as a0, round as a1, isNumber as a2, pollUntil as a3, sleep as a4, lsidToUUID as a5, isUint8Array as a6, isObject as a7, isRecord as a8, type Maybe as a9, type ExpandRecursively as aa, type ById as ab, type OmitTypename as ac, isType as ad, type ExtractByTypename as ae, type DeepPartial as af, type JSONLiteral as ag, type JSONType as ah, type JSONObject as ai, type NN as aj, notNullUndefined as ak, type PartialBy as al, type Complete as am, type RequiredKeys as an, 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 };
330
+ type StateCode = "AK" | "AL" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "FL" | "GA" | "HI" | "IA" | "ID" | "IL" | "IN" | "KS" | "KY" | "LA" | "MA" | "MD" | "ME" | "MI" | "MN" | "MO" | "MS" | "MT" | "NC" | "ND" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VA" | "VT" | "WA" | "WI" | "WV" | "WY" | "DC" | "GU" | "PR" | "VI" | "AE" | "AA" | "AP" | "AS" | "PW" | "FM" | "MP" | "MH";
331
+ declare const zipcodeToStateCode: Record<string, StateCode>;
332
+ /**
333
+ * Converts a US zipcode to its corresponding state code
334
+ * @param zipcode The zipcode to convert
335
+ * @returns The state code or null if not found
336
+ */
337
+ declare function zipcodeToState(zipcode: string): StateCode | null;
338
+
339
+ export { setLocalStorageBoolean 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, isError as L, isErrorWithMessage as M, getErrorMsg as N, isErrorMsg as O, errorToJSON as P, bytesToHex as Q, hexToBytes as R, type SDKCurrencyAmountType as S, getCurrentLocale as T, type UmaCurrency as U, countryCodesToCurrencyCodes as V, type CurrencyLocales as W, type CurrencyCodes as X, localeToCurrencyCode as Y, getLocalStorageConfigItem as Z, getLocalStorageBoolean as _, b64encode as a, deleteLocalStorageItem as a0, clamp as a1, linearInterpolate as a2, round as a3, isNumber as a4, pollUntil as a5, sleep as a6, lsidToUUID as a7, isUint8Array as a8, isObject as a9, isRecord as aa, type Maybe as ab, type ExpandRecursively as ac, type ById as ad, type OmitTypename as ae, isType as af, type ExtractByTypename as ag, type DeepPartial as ah, type JSONLiteral as ai, type JSONType as aj, type JSONObject as ak, type NN as al, notNullUndefined as am, type PartialBy as an, type Complete as ao, type RequiredKeys as ap, type StateCode as aq, zipcodeToStateCode as ar, zipcodeToState as as, 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 };
@@ -27,6 +27,8 @@ declare const CurrencyUnit: {
27
27
  readonly MXN: "MXN";
28
28
  readonly PHP: "PHP";
29
29
  readonly EUR: "EUR";
30
+ readonly GBP: "GBP";
31
+ readonly INR: "INR";
30
32
  readonly Bitcoin: "BITCOIN";
31
33
  readonly Microbitcoin: "MICROBITCOIN";
32
34
  readonly Millibitcoin: "MILLIBITCOIN";
@@ -36,6 +38,8 @@ declare const CurrencyUnit: {
36
38
  readonly Usd: "USD";
37
39
  readonly Mxn: "MXN";
38
40
  readonly Php: "PHP";
41
+ readonly Gbp: "GBP";
42
+ readonly Inr: "INR";
39
43
  };
40
44
  type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
41
45
  type SDKCurrencyAmountType = {
@@ -61,6 +65,8 @@ type CurrencyMap = {
61
65
  [CurrencyUnit.MXN]: number;
62
66
  [CurrencyUnit.PHP]: number;
63
67
  [CurrencyUnit.EUR]: number;
68
+ [CurrencyUnit.GBP]: number;
69
+ [CurrencyUnit.INR]: number;
64
70
  [CurrencyUnit.FUTURE_VALUE]: number;
65
71
  formatted: {
66
72
  sats: string;
@@ -76,6 +82,8 @@ type CurrencyMap = {
76
82
  [CurrencyUnit.MXN]: string;
77
83
  [CurrencyUnit.PHP]: string;
78
84
  [CurrencyUnit.EUR]: string;
85
+ [CurrencyUnit.GBP]: string;
86
+ [CurrencyUnit.INR]: string;
79
87
  [CurrencyUnit.FUTURE_VALUE]: string;
80
88
  };
81
89
  isZero: boolean;
@@ -131,7 +139,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
131
139
  };
132
140
  declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
133
141
  declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
134
- declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "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";
135
143
  type AppendUnitsOptions = {
136
144
  plural?: boolean | undefined;
137
145
  lowercase?: boolean | undefined;
@@ -149,10 +157,21 @@ declare function separateCurrencyStrParts(currencyStr: string): {
149
157
  amount: string;
150
158
  };
151
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;
152
167
 
168
+ declare global {
169
+ const Bare: unknown;
170
+ }
153
171
  declare const isBrowser: boolean;
154
172
  declare const isNode: boolean;
155
173
  declare const isTest: boolean;
174
+ declare const isBare: boolean;
156
175
 
157
176
  type Maybe<T> = T | null | undefined;
158
177
  type ExpandRecursively<T> = T extends object ? T extends infer O ? {
@@ -308,4 +327,13 @@ declare function isUint8Array(value: unknown): value is Uint8Array;
308
327
  declare function isObject(value: unknown): value is object;
309
328
  declare function isRecord(value: unknown): value is Record<string, unknown>;
310
329
 
311
- export { clamp as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, isBrowser as G, isNode as H, isTest as I, isError as J, isErrorWithMessage as K, getErrorMsg as L, isErrorMsg as M, errorToJSON as N, bytesToHex as O, hexToBytes as P, getCurrentLocale as Q, countryCodesToCurrencyCodes as R, type SDKCurrencyAmountType as S, type CurrencyLocales as T, type UmaCurrency as U, type CurrencyCodes as V, localeToCurrencyCode as W, getLocalStorageConfigItem as X, getLocalStorageBoolean as Y, setLocalStorageBoolean as Z, deleteLocalStorageItem as _, b64encode as a, linearInterpolate as a0, round as a1, isNumber as a2, pollUntil as a3, sleep as a4, lsidToUUID as a5, isUint8Array as a6, isObject as a7, isRecord as a8, type Maybe as a9, type ExpandRecursively as aa, type ById as ab, type OmitTypename as ac, isType as ad, type ExtractByTypename as ae, type DeepPartial as af, type JSONLiteral as ag, type JSONType as ah, type JSONObject as ai, type NN as aj, notNullUndefined as ak, type PartialBy as al, type Complete as am, type RequiredKeys as an, 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 };
330
+ type StateCode = "AK" | "AL" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "FL" | "GA" | "HI" | "IA" | "ID" | "IL" | "IN" | "KS" | "KY" | "LA" | "MA" | "MD" | "ME" | "MI" | "MN" | "MO" | "MS" | "MT" | "NC" | "ND" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VA" | "VT" | "WA" | "WI" | "WV" | "WY" | "DC" | "GU" | "PR" | "VI" | "AE" | "AA" | "AP" | "AS" | "PW" | "FM" | "MP" | "MH";
331
+ declare const zipcodeToStateCode: Record<string, StateCode>;
332
+ /**
333
+ * Converts a US zipcode to its corresponding state code
334
+ * @param zipcode The zipcode to convert
335
+ * @returns The state code or null if not found
336
+ */
337
+ declare function zipcodeToState(zipcode: string): StateCode | null;
338
+
339
+ export { setLocalStorageBoolean 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, isError as L, isErrorWithMessage as M, getErrorMsg as N, isErrorMsg as O, errorToJSON as P, bytesToHex as Q, hexToBytes as R, type SDKCurrencyAmountType as S, getCurrentLocale as T, type UmaCurrency as U, countryCodesToCurrencyCodes as V, type CurrencyLocales as W, type CurrencyCodes as X, localeToCurrencyCode as Y, getLocalStorageConfigItem as Z, getLocalStorageBoolean as _, b64encode as a, deleteLocalStorageItem as a0, clamp as a1, linearInterpolate as a2, round as a3, isNumber as a4, pollUntil as a5, sleep as a6, lsidToUUID as a7, isUint8Array as a8, isObject as a9, isRecord as aa, type Maybe as ab, type ExpandRecursively as ac, type ById as ad, type OmitTypename as ae, isType as af, type ExtractByTypename as ag, type DeepPartial as ah, type JSONLiteral as ai, type JSONType as aj, type JSONObject as ak, type NN as al, notNullUndefined as am, type PartialBy as an, type Complete as ao, type RequiredKeys as ap, type StateCode as aq, zipcodeToStateCode as ar, zipcodeToState as as, 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 };