@cranberry-money/shared-utils 8.23.415 → 8.23.417
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/assets.d.ts +1 -32
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +16 -66
- package/dist/assets.js.map +1 -1
- package/dist/date.d.ts +0 -52
- package/dist/date.d.ts.map +1 -1
- package/dist/date.js +5 -123
- package/dist/date.js.map +1 -1
- package/dist/filters.d.ts +0 -4
- package/dist/filters.d.ts.map +1 -1
- package/dist/filters.js +6 -16
- package/dist/filters.js.map +1 -1
- package/dist/phoneFormatting.d.ts +6 -1
- package/dist/phoneFormatting.d.ts.map +1 -1
- package/dist/phoneFormatting.js +8 -4
- package/dist/phoneFormatting.js.map +1 -1
- package/dist/validation/wallets.d.ts +0 -15
- package/dist/validation/wallets.d.ts.map +1 -1
- package/dist/validation/wallets.js +12 -81
- package/dist/validation/wallets.js.map +1 -1
- package/package.json +3 -3
package/dist/assets.d.ts
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import type { Asset } from '@cranberry-money/shared-types';
|
|
2
|
-
|
|
3
|
-
* Phase 7 Asset type display labels
|
|
4
|
-
*/
|
|
5
|
-
export declare const ASSET_TYPE_NATIVE_CRYPTO = "Crypto";
|
|
6
|
-
export declare const ASSET_TYPE_STABLECOIN = "Stablecoin";
|
|
7
|
-
export declare const ASSET_TYPE_TOKENIZED_SECURITY = "Tokenized Security";
|
|
8
|
-
export declare const ASSET_TYPE_TOKENIZED_RWA = "Real-World Asset";
|
|
9
|
-
export declare const ASSET_TYPE_SYNTHETIC = "Synthetic";
|
|
10
|
-
export type AllAssetTypes = typeof ASSET_TYPE_NATIVE_CRYPTO | typeof ASSET_TYPE_STABLECOIN | typeof ASSET_TYPE_TOKENIZED_SECURITY | typeof ASSET_TYPE_TOKENIZED_RWA | typeof ASSET_TYPE_SYNTHETIC;
|
|
11
|
-
/**
|
|
12
|
-
* Get the type label for any asset (Phase 7)
|
|
13
|
-
* Maps backend AssetType enum to display labels
|
|
14
|
-
*
|
|
15
|
-
* @param asset - Any asset object
|
|
16
|
-
* @returns The asset type display label
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* const type = getAssetType(asset);
|
|
20
|
-
* // Returns: 'Crypto' | 'Stablecoin' | 'Tokenized Security' | 'Real-World Asset' | 'Synthetic'
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAssetType(asset: Asset): AllAssetTypes;
|
|
23
|
-
/**
|
|
24
|
-
* Get the color variant for any asset type (Phase 7)
|
|
25
|
-
* Useful for badge components and visual differentiation
|
|
26
|
-
*
|
|
27
|
-
* @param asset - Any asset object
|
|
28
|
-
* @returns A color variant identifier
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* const variant = getAssetTypeVariant(asset);
|
|
32
|
-
* // Returns: 'primary' | 'warning' | 'success' | 'info' | 'neutral'
|
|
33
|
-
*/
|
|
2
|
+
export declare function getAssetType(asset: Asset): string;
|
|
34
3
|
export declare function getAssetTypeVariant(asset: Asset): 'primary' | 'warning' | 'success' | 'info' | 'neutral';
|
|
35
4
|
//# sourceMappingURL=assets.d.ts.map
|
package/dist/assets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAU3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASxG"}
|
package/dist/assets.js
CHANGED
|
@@ -1,71 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const ASSET_TYPE_SYNTHETIC = 'Synthetic';
|
|
9
|
-
/**
|
|
10
|
-
* Get the type label for any asset (Phase 7)
|
|
11
|
-
* Maps backend AssetType enum to display labels
|
|
12
|
-
*
|
|
13
|
-
* @param asset - Any asset object
|
|
14
|
-
* @returns The asset type display label
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* const type = getAssetType(asset);
|
|
18
|
-
* // Returns: 'Crypto' | 'Stablecoin' | 'Tokenized Security' | 'Real-World Asset' | 'Synthetic'
|
|
19
|
-
*/
|
|
1
|
+
const ASSET_TYPE_LABELS = {
|
|
2
|
+
native_crypto: 'Crypto',
|
|
3
|
+
stablecoin: 'Stablecoin',
|
|
4
|
+
tokenized_security: 'Tokenized Security',
|
|
5
|
+
tokenized_rwa: 'Real-World Asset',
|
|
6
|
+
synthetic: 'Synthetic',
|
|
7
|
+
};
|
|
20
8
|
export function getAssetType(asset) {
|
|
21
|
-
|
|
22
|
-
const assetType = asset.assetType;
|
|
23
|
-
switch (assetType) {
|
|
24
|
-
case 'native_crypto':
|
|
25
|
-
return ASSET_TYPE_NATIVE_CRYPTO;
|
|
26
|
-
case 'stablecoin':
|
|
27
|
-
return ASSET_TYPE_STABLECOIN;
|
|
28
|
-
case 'tokenized_security':
|
|
29
|
-
return ASSET_TYPE_TOKENIZED_SECURITY;
|
|
30
|
-
case 'tokenized_rwa':
|
|
31
|
-
return ASSET_TYPE_TOKENIZED_RWA;
|
|
32
|
-
case 'synthetic':
|
|
33
|
-
return ASSET_TYPE_SYNTHETIC;
|
|
34
|
-
default:
|
|
35
|
-
return ASSET_TYPE_SYNTHETIC; // fallback
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return ASSET_TYPE_SYNTHETIC; // fallback
|
|
9
|
+
return ASSET_TYPE_LABELS[asset.assetType] || 'Synthetic';
|
|
39
10
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Get the color variant for any asset type (Phase 7)
|
|
42
|
-
* Useful for badge components and visual differentiation
|
|
43
|
-
*
|
|
44
|
-
* @param asset - Any asset object
|
|
45
|
-
* @returns A color variant identifier
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* const variant = getAssetTypeVariant(asset);
|
|
49
|
-
* // Returns: 'primary' | 'warning' | 'success' | 'info' | 'neutral'
|
|
50
|
-
*/
|
|
51
11
|
export function getAssetTypeVariant(asset) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return 'primary'; // Blue for tokenized securities (AAPL.t)
|
|
61
|
-
case 'tokenized_rwa':
|
|
62
|
-
return 'warning'; // Orange for real-world assets (treasuries)
|
|
63
|
-
case 'synthetic':
|
|
64
|
-
return 'neutral'; // Gray for synthetic assets
|
|
65
|
-
default:
|
|
66
|
-
return 'neutral';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return 'neutral';
|
|
12
|
+
const variants = {
|
|
13
|
+
native_crypto: 'success',
|
|
14
|
+
stablecoin: 'info',
|
|
15
|
+
tokenized_security: 'primary',
|
|
16
|
+
tokenized_rwa: 'warning',
|
|
17
|
+
synthetic: 'neutral',
|
|
18
|
+
};
|
|
19
|
+
return variants[asset.assetType] || 'neutral';
|
|
70
20
|
}
|
|
71
21
|
//# sourceMappingURL=assets.js.map
|
package/dist/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG;IACxB,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,YAAY;IACxB,kBAAkB,EAAE,oBAAoB;IACxC,aAAa,EAAE,kBAAkB;IACjC,SAAS,EAAE,WAAW;CACd,CAAC;AAEX,MAAM,UAAU,YAAY,CAAC,KAAY;IACvC,OAAO,iBAAiB,CAAC,KAAK,CAAC,SAA2C,CAAC,IAAI,WAAW,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,MAAM,QAAQ,GAA2E;QACvF,aAAa,EAAE,SAAS;QACxB,UAAU,EAAE,MAAM;QAClB,kBAAkB,EAAE,SAAS;QAC7B,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,SAAS;KACrB,CAAC;IACF,OAAO,QAAQ,CAAC,KAAK,CAAC,SAAmB,CAAC,IAAI,SAAS,CAAC;AAC1D,CAAC"}
|
package/dist/date.d.ts
CHANGED
|
@@ -1,60 +1,8 @@
|
|
|
1
1
|
import type { TimeRange } from '@cranberry-money/shared-constants';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a date string with a fallback
|
|
4
|
-
* @param dateString - ISO date string or null
|
|
5
|
-
* @param fallback - Fallback string if date is null (default: 'No expiry')
|
|
6
|
-
* @returns Formatted date string or fallback
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatDate(dateString: string | null, fallback?: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Formats a date string to a full date format (e.g., "15 January 2025")
|
|
11
|
-
* @param dateString - ISO date string or null
|
|
12
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
13
|
-
* @returns Formatted date string or fallback message
|
|
14
|
-
*/
|
|
15
2
|
export declare function formatFullDate(dateString: string | null, locale?: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Formats a date string to short format with month and day only (e.g., "Jan 15")
|
|
18
|
-
* @param dateString - ISO date string
|
|
19
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
20
|
-
* @returns Formatted short date string
|
|
21
|
-
*/
|
|
22
3
|
export declare function formatShortDate(dateString: string, locale?: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Formats a date string to numeric short format (e.g., "15/01/2025")
|
|
25
|
-
* @param dateString - ISO date string or null
|
|
26
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
27
|
-
* @returns Formatted numeric date string or fallback message
|
|
28
|
-
*/
|
|
29
|
-
export declare function formatNumericDate(dateString: string | null, locale?: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Formats a time string (e.g., "14:30")
|
|
32
|
-
* @param dateString - ISO date string
|
|
33
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
34
|
-
* @returns Formatted time string
|
|
35
|
-
*/
|
|
36
4
|
export declare function formatTime(dateString: string, locale?: string): string;
|
|
37
|
-
/**
|
|
38
|
-
* Formats a date and time string (e.g., "Jan 15 14:30")
|
|
39
|
-
* @param dateString - ISO date string
|
|
40
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
41
|
-
* @returns Formatted date and time string
|
|
42
|
-
*/
|
|
43
|
-
export declare function formatDateTime(dateString: string, locale?: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Formats a date and time string with year (e.g., "15 Jan 2025, 14:30")
|
|
46
|
-
* @param dateString - ISO date string or null
|
|
47
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
48
|
-
* @returns Formatted date and time string or fallback message
|
|
49
|
-
*/
|
|
50
5
|
export declare function formatFullDateTime(dateString: string | null, locale?: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Formats a date string for member since display (e.g., "January 2025")
|
|
53
|
-
* @param dateString - ISO date string or null
|
|
54
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
55
|
-
* @returns Formatted month and year string
|
|
56
|
-
*/
|
|
57
|
-
export declare function formatMemberSince(dateString: string | null, locale?: string): string;
|
|
58
6
|
export interface DateRange {
|
|
59
7
|
start_date: string | undefined;
|
|
60
8
|
end_date: string | undefined;
|
package/dist/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGnE
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGnE,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAO1F;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAEpF;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAE/E;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAO9F;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAQ5D"}
|
package/dist/date.js
CHANGED
|
@@ -1,140 +1,25 @@
|
|
|
1
1
|
import { TIME_RANGES } from '@cranberry-money/shared-constants';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a date string with a fallback
|
|
4
|
-
* @param dateString - ISO date string or null
|
|
5
|
-
* @param fallback - Fallback string if date is null (default: 'No expiry')
|
|
6
|
-
* @returns Formatted date string or fallback
|
|
7
|
-
*/
|
|
8
|
-
export function formatDate(dateString, fallback = 'No expiry') {
|
|
9
|
-
if (!dateString)
|
|
10
|
-
return fallback;
|
|
11
|
-
return new Date(dateString).toLocaleDateString();
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Formats a date string to a full date format (e.g., "15 January 2025")
|
|
15
|
-
* @param dateString - ISO date string or null
|
|
16
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
17
|
-
* @returns Formatted date string or fallback message
|
|
18
|
-
*/
|
|
19
2
|
export function formatFullDate(dateString, locale = 'en-AU') {
|
|
20
3
|
if (!dateString)
|
|
21
4
|
return 'Not available';
|
|
22
5
|
try {
|
|
23
|
-
|
|
24
|
-
return date.toLocaleDateString(locale, {
|
|
25
|
-
year: 'numeric',
|
|
26
|
-
month: 'long',
|
|
27
|
-
day: 'numeric',
|
|
28
|
-
});
|
|
6
|
+
return new Date(dateString).toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' });
|
|
29
7
|
}
|
|
30
8
|
catch {
|
|
31
9
|
return dateString;
|
|
32
10
|
}
|
|
33
11
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Formats a date string to short format with month and day only (e.g., "Jan 15")
|
|
36
|
-
* @param dateString - ISO date string
|
|
37
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
38
|
-
* @returns Formatted short date string
|
|
39
|
-
*/
|
|
40
12
|
export function formatShortDate(dateString, locale = 'en-AU') {
|
|
41
|
-
|
|
42
|
-
return date.toLocaleDateString(locale, {
|
|
43
|
-
month: 'short',
|
|
44
|
-
day: 'numeric',
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Formats a date string to numeric short format (e.g., "15/01/2025")
|
|
49
|
-
* @param dateString - ISO date string or null
|
|
50
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
51
|
-
* @returns Formatted numeric date string or fallback message
|
|
52
|
-
*/
|
|
53
|
-
export function formatNumericDate(dateString, locale = 'en-AU') {
|
|
54
|
-
if (!dateString)
|
|
55
|
-
return 'Not available';
|
|
56
|
-
try {
|
|
57
|
-
const date = new Date(dateString);
|
|
58
|
-
return date.toLocaleDateString(locale, {
|
|
59
|
-
year: 'numeric',
|
|
60
|
-
month: '2-digit',
|
|
61
|
-
day: '2-digit',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return dateString;
|
|
66
|
-
}
|
|
13
|
+
return new Date(dateString).toLocaleDateString(locale, { month: 'short', day: 'numeric' });
|
|
67
14
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Formats a time string (e.g., "14:30")
|
|
70
|
-
* @param dateString - ISO date string
|
|
71
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
72
|
-
* @returns Formatted time string
|
|
73
|
-
*/
|
|
74
15
|
export function formatTime(dateString, locale = 'en-AU') {
|
|
75
|
-
return new Date(dateString).toLocaleTimeString(locale, {
|
|
76
|
-
hour: '2-digit',
|
|
77
|
-
minute: '2-digit',
|
|
78
|
-
hour12: false,
|
|
79
|
-
});
|
|
16
|
+
return new Date(dateString).toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: false });
|
|
80
17
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Formats a date and time string (e.g., "Jan 15 14:30")
|
|
83
|
-
* @param dateString - ISO date string
|
|
84
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
85
|
-
* @returns Formatted date and time string
|
|
86
|
-
*/
|
|
87
|
-
export function formatDateTime(dateString, locale = 'en-AU') {
|
|
88
|
-
const date = new Date(dateString);
|
|
89
|
-
const shortDate = date.toLocaleDateString(locale, {
|
|
90
|
-
month: 'short',
|
|
91
|
-
day: 'numeric',
|
|
92
|
-
});
|
|
93
|
-
const time = date.toLocaleTimeString(locale, {
|
|
94
|
-
hour: '2-digit',
|
|
95
|
-
minute: '2-digit',
|
|
96
|
-
hour12: false,
|
|
97
|
-
});
|
|
98
|
-
return `${shortDate} ${time}`;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Formats a date and time string with year (e.g., "15 Jan 2025, 14:30")
|
|
102
|
-
* @param dateString - ISO date string or null
|
|
103
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
104
|
-
* @returns Formatted date and time string or fallback message
|
|
105
|
-
*/
|
|
106
18
|
export function formatFullDateTime(dateString, locale = 'en-AU') {
|
|
107
19
|
if (!dateString)
|
|
108
20
|
return 'Never';
|
|
109
21
|
try {
|
|
110
|
-
|
|
111
|
-
return date.toLocaleDateString(locale, {
|
|
112
|
-
year: 'numeric',
|
|
113
|
-
month: 'short',
|
|
114
|
-
day: 'numeric',
|
|
115
|
-
hour: '2-digit',
|
|
116
|
-
minute: '2-digit',
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
return dateString;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Formats a date string for member since display (e.g., "January 2025")
|
|
125
|
-
* @param dateString - ISO date string or null
|
|
126
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
127
|
-
* @returns Formatted month and year string
|
|
128
|
-
*/
|
|
129
|
-
export function formatMemberSince(dateString, locale = 'en-AU') {
|
|
130
|
-
if (!dateString)
|
|
131
|
-
return 'Not available';
|
|
132
|
-
try {
|
|
133
|
-
const date = new Date(dateString);
|
|
134
|
-
return date.toLocaleDateString(locale, {
|
|
135
|
-
year: 'numeric',
|
|
136
|
-
month: 'long',
|
|
137
|
-
});
|
|
22
|
+
return new Date(dateString).toLocaleDateString(locale, { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
138
23
|
}
|
|
139
24
|
catch {
|
|
140
25
|
return dateString;
|
|
@@ -149,9 +34,6 @@ export function getDateRange(timeRange) {
|
|
|
149
34
|
const endDate = new Date();
|
|
150
35
|
const startDate = new Date();
|
|
151
36
|
startDate.setMonth(startDate.getMonth() - range.months);
|
|
152
|
-
return {
|
|
153
|
-
start_date: startDate.toISOString().split('T')[0],
|
|
154
|
-
end_date: endDate.toISOString().split('T')[0],
|
|
155
|
-
};
|
|
37
|
+
return { start_date: startDate.toISOString().split('T')[0], end_date: endDate.toISOString().split('T')[0] };
|
|
156
38
|
}
|
|
157
39
|
//# sourceMappingURL=date.js.map
|
package/dist/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,MAAM,UAAU,cAAc,CAAC,UAAyB,EAAE,SAAiB,OAAO;IAChF,IAAI,CAAC,UAAU;QAAE,OAAO,eAAe,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB,OAAO;IAC1E,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,UAAkB,EAAE,SAAiB,OAAO;IACrE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAChH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAyB,EAAE,SAAiB,OAAO;IACpF,IAAI,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAClJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAOD,MAAM,UAAU,YAAY,CAAC,SAAoB;IAC/C,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC/E,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IAC7D,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACxD,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9G,CAAC"}
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
export declare function hasActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): boolean;
|
|
2
2
|
export declare function countActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): number;
|
|
3
|
-
export declare function hasActiveAssetFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
4
|
-
export declare function countActiveAssetFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
5
|
-
export declare function hasActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
6
|
-
export declare function countActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
7
3
|
//# sourceMappingURL=filters.d.ts.map
|
package/dist/filters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,GAAE,CAAC,MAAM,CAAC,CAAC,EAA+B,GAAG,OAAO,CAIhJ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,GAAE,CAAC,MAAM,CAAC,CAAC,EAA+B,GAAG,MAAM,CAIjJ"}
|
package/dist/filters.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
export function hasActiveFilters(filters, excludeFields = ['searchQuery']) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
return Object.entries(filters)
|
|
3
|
+
.filter(([key]) => !excludeFields.includes(key))
|
|
4
|
+
.some(([, value]) => value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && value.length === 0));
|
|
4
5
|
}
|
|
5
6
|
export function countActiveFilters(filters, excludeFields = ['searchQuery']) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function hasActiveAssetFilters(filters) {
|
|
10
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
11
|
-
}
|
|
12
|
-
export function countActiveAssetFilters(filters) {
|
|
13
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
14
|
-
}
|
|
15
|
-
export function hasActiveTransactionFilters(filters) {
|
|
16
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
17
|
-
}
|
|
18
|
-
export function countActiveTransactionFilters(filters) {
|
|
19
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
7
|
+
return Object.entries(filters)
|
|
8
|
+
.filter(([key]) => !excludeFields.includes(key))
|
|
9
|
+
.filter(([, value]) => value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && value.length === 0)).length;
|
|
20
10
|
}
|
|
21
11
|
//# sourceMappingURL=filters.js.map
|
package/dist/filters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAoC,OAAU,EAAE,gBAA6B,CAAC,aAAwB,CAAC;IACrI,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAc,CAAC,CAAC;SAC1D,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;AACjI,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAoC,OAAU,EAAE,gBAA6B,CAAC,aAAwB,CAAC;IACvI,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAc,CAAC,CAAC;SAC1D,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1I,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
interface CountryInfo {
|
|
2
|
+
phoneCode: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function formatPhoneForDisplay(phoneNumber: string, country?: CountryInfo): string;
|
|
2
6
|
export declare function cleanPhoneNumber(phoneNumber: string): string;
|
|
7
|
+
export {};
|
|
3
8
|
//# sourceMappingURL=phoneFormatting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoneFormatting.d.ts","sourceRoot":"","sources":["../src/phoneFormatting.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"phoneFormatting.d.ts","sourceRoot":"","sources":["../src/phoneFormatting.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAaxF;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
package/dist/phoneFormatting.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export function formatPhoneForDisplay(phoneNumber) {
|
|
1
|
+
export function formatPhoneForDisplay(phoneNumber, country) {
|
|
2
2
|
if (!phoneNumber)
|
|
3
3
|
return '';
|
|
4
4
|
const cleaned = phoneNumber.replace(/\D/g, '');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const phoneCode = country?.phoneCode?.replace('+', '') || '61';
|
|
6
|
+
if (phoneCode === '61' && cleaned.length >= 9) {
|
|
7
|
+
const digits = cleaned.slice(0, 10);
|
|
8
|
+
return `${digits.slice(0, 4)} ${digits.slice(4, 7)} ${digits.slice(7)}`;
|
|
9
|
+
}
|
|
10
|
+
if (phoneCode === '1' && cleaned.length >= 10) {
|
|
11
|
+
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6, 10)}`;
|
|
8
12
|
}
|
|
9
13
|
return phoneNumber.trim();
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoneFormatting.js","sourceRoot":"","sources":["../src/phoneFormatting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phoneFormatting.js","sourceRoot":"","sources":["../src/phoneFormatting.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,OAAqB;IAC9E,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC;IAE/D,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC;IACD,IAAI,SAAS,KAAK,GAAG,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAC9C,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IACnF,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wallet validation utilities
|
|
3
|
-
*/
|
|
4
|
-
export declare const isValidEthereumAddress: (address: string) => boolean;
|
|
5
|
-
export declare const isValidBitcoinAddress: (address: string) => boolean;
|
|
6
1
|
export declare const validateWalletAddress: (address: string, chainType: string) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Auto-detect blockchain chain from wallet address format
|
|
9
|
-
* Returns 'BTC' or 'ETH' based on address pattern, or null if unrecognized
|
|
10
|
-
*/
|
|
11
2
|
export declare const detectChainFromAddress: (address: string) => "BTC" | "ETH" | null;
|
|
12
|
-
export declare const formatWalletAddress: (address: string, maxLength?: number) => string;
|
|
13
3
|
export declare const formatWalletAddressShort: (address: string) => string;
|
|
14
4
|
export declare const formatWalletAddressMedium: (address: string) => string;
|
|
15
|
-
export declare const formatWalletAddressLong: (address: string) => string;
|
|
16
|
-
export declare const getBlockchainExplorerUrl: (address: string, chainType: string) => string;
|
|
17
|
-
export declare const getTransactionExplorerUrl: (txHash: string, chainType: string) => string;
|
|
18
|
-
export declare const isEVMCompatible: (chainType: string) => boolean;
|
|
19
|
-
export declare const isBitcoinBased: (chainType: string) => boolean;
|
|
20
5
|
//# sourceMappingURL=wallets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/validation/wallets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/validation/wallets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,OAK1E,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,KAAK,GAAG,KAAK,GAAG,IAMxE,CAAC;AASF,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAA0C,CAAC;AACtG,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,KAAG,MAA0C,CAAC"}
|
|
@@ -1,100 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wallet validation utilities
|
|
3
|
-
*/
|
|
4
1
|
import { WALLET_ADDRESS_PATTERNS } from '@cranberry-money/shared-constants';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// ============================================
|
|
8
|
-
export const isValidEthereumAddress = (address) => {
|
|
9
|
-
return WALLET_ADDRESS_PATTERNS.ETHEREUM.test(address);
|
|
10
|
-
};
|
|
11
|
-
export const isValidBitcoinAddress = (address) => {
|
|
12
|
-
return WALLET_ADDRESS_PATTERNS.BITCOIN.test(address);
|
|
13
|
-
};
|
|
2
|
+
const isValidEthereumAddress = (address) => WALLET_ADDRESS_PATTERNS.ETHEREUM.test(address);
|
|
3
|
+
const isValidBitcoinAddress = (address) => WALLET_ADDRESS_PATTERNS.BITCOIN.test(address);
|
|
14
4
|
export const validateWalletAddress = (address, chainType) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
if (['ethereum', 'eth', 'polygon', 'matic', 'arbitrum', 'optimism', 'base'].includes(normalizedChain)) {
|
|
5
|
+
const chain = chainType.toLowerCase();
|
|
6
|
+
if (['ethereum', 'eth', 'polygon', 'matic', 'arbitrum', 'optimism', 'base'].includes(chain))
|
|
18
7
|
return isValidEthereumAddress(address);
|
|
19
|
-
|
|
20
|
-
// Bitcoin-based chains
|
|
21
|
-
if (['bitcoin', 'btc'].includes(normalizedChain)) {
|
|
8
|
+
if (['bitcoin', 'btc'].includes(chain))
|
|
22
9
|
return isValidBitcoinAddress(address);
|
|
23
|
-
}
|
|
24
10
|
return false;
|
|
25
11
|
};
|
|
26
|
-
/**
|
|
27
|
-
* Auto-detect blockchain chain from wallet address format
|
|
28
|
-
* Returns 'BTC' or 'ETH' based on address pattern, or null if unrecognized
|
|
29
|
-
*/
|
|
30
12
|
export const detectChainFromAddress = (address) => {
|
|
31
|
-
if (!address || typeof address !== 'string')
|
|
13
|
+
if (!address || typeof address !== 'string')
|
|
32
14
|
return null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Check Ethereum format (0x + 40 hex chars)
|
|
36
|
-
if (isValidEthereumAddress(trimmedAddress)) {
|
|
15
|
+
const trimmed = address.trim();
|
|
16
|
+
if (isValidEthereumAddress(trimmed))
|
|
37
17
|
return 'ETH';
|
|
38
|
-
|
|
39
|
-
// Check Bitcoin format
|
|
40
|
-
if (isValidBitcoinAddress(trimmedAddress)) {
|
|
18
|
+
if (isValidBitcoinAddress(trimmed))
|
|
41
19
|
return 'BTC';
|
|
42
|
-
}
|
|
43
20
|
return null;
|
|
44
21
|
};
|
|
45
|
-
|
|
46
|
-
// Address Formatting
|
|
47
|
-
// ============================================
|
|
48
|
-
export const formatWalletAddress = (address, maxLength = 16) => {
|
|
22
|
+
const formatWalletAddress = (address, maxLength = 16) => {
|
|
49
23
|
if (address.length <= maxLength)
|
|
50
24
|
return address;
|
|
51
25
|
const prefixLength = Math.floor(maxLength / 2) - 2;
|
|
52
26
|
const suffixLength = maxLength - prefixLength - 3;
|
|
53
27
|
return `${address.slice(0, prefixLength)}...${address.slice(-suffixLength)}`;
|
|
54
28
|
};
|
|
55
|
-
export const formatWalletAddressShort = (address) =>
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
export const formatWalletAddressMedium = (address) => {
|
|
59
|
-
return formatWalletAddress(address, 16);
|
|
60
|
-
};
|
|
61
|
-
export const formatWalletAddressLong = (address) => {
|
|
62
|
-
return formatWalletAddress(address, 24);
|
|
63
|
-
};
|
|
64
|
-
// ============================================
|
|
65
|
-
// Blockchain Explorer URLs
|
|
66
|
-
// ============================================
|
|
67
|
-
export const getBlockchainExplorerUrl = (address, chainType) => {
|
|
68
|
-
const explorers = {
|
|
69
|
-
ethereum: `https://etherscan.io/address/${address}`,
|
|
70
|
-
polygon: `https://polygonscan.com/address/${address}`,
|
|
71
|
-
bitcoin: `https://blockchain.com/btc/address/${address}`,
|
|
72
|
-
arbitrum: `https://arbiscan.io/address/${address}`,
|
|
73
|
-
optimism: `https://optimistic.etherscan.io/address/${address}`,
|
|
74
|
-
base: `https://basescan.org/address/${address}`,
|
|
75
|
-
};
|
|
76
|
-
return explorers[chainType.toLowerCase()] || '';
|
|
77
|
-
};
|
|
78
|
-
export const getTransactionExplorerUrl = (txHash, chainType) => {
|
|
79
|
-
const explorers = {
|
|
80
|
-
ethereum: `https://etherscan.io/tx/${txHash}`,
|
|
81
|
-
polygon: `https://polygonscan.com/tx/${txHash}`,
|
|
82
|
-
bitcoin: `https://blockchain.com/btc/tx/${txHash}`,
|
|
83
|
-
arbitrum: `https://arbiscan.io/tx/${txHash}`,
|
|
84
|
-
optimism: `https://optimistic.etherscan.io/tx/${txHash}`,
|
|
85
|
-
base: `https://basescan.org/tx/${txHash}`,
|
|
86
|
-
};
|
|
87
|
-
return explorers[chainType.toLowerCase()] || '';
|
|
88
|
-
};
|
|
89
|
-
// ============================================
|
|
90
|
-
// Chain Helpers
|
|
91
|
-
// ============================================
|
|
92
|
-
export const isEVMCompatible = (chainType) => {
|
|
93
|
-
const normalizedChain = chainType.toLowerCase();
|
|
94
|
-
return ['ethereum', 'eth', 'polygon', 'matic', 'arbitrum', 'optimism', 'base'].includes(normalizedChain);
|
|
95
|
-
};
|
|
96
|
-
export const isBitcoinBased = (chainType) => {
|
|
97
|
-
const normalizedChain = chainType.toLowerCase();
|
|
98
|
-
return ['bitcoin', 'btc'].includes(normalizedChain);
|
|
99
|
-
};
|
|
29
|
+
export const formatWalletAddressShort = (address) => formatWalletAddress(address, 12);
|
|
30
|
+
export const formatWalletAddressMedium = (address) => formatWalletAddress(address, 16);
|
|
100
31
|
//# sourceMappingURL=wallets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../src/validation/wallets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../src/validation/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5G,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAW,EAAE;IACnF,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IACtC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACpI,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAwB,EAAE;IAC9E,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,sBAAsB,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,qBAAqB,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IACjD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,YAAoB,EAAE,EAAU,EAAE;IAC9E,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC;IAClD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cranberry-money/shared-utils",
|
|
3
|
-
"version": "8.23.
|
|
3
|
+
"version": "8.23.417",
|
|
4
4
|
"description": "Shared utility functions for Blueberry platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"prepublishOnly": "npm run clean && npm run typecheck && npm test && npm run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cranberry-money/shared-constants": "^8.15.
|
|
33
|
-
"@cranberry-money/shared-types": "^8.22.
|
|
32
|
+
"@cranberry-money/shared-constants": "^8.15.442",
|
|
33
|
+
"@cranberry-money/shared-types": "^8.22.417"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "^30.0.0",
|