summaryrefslogtreecommitdiff
path: root/src/client/utils.ts
diff options
context:
space:
mode:
authorPawel Zelawski <pawel@pzelawski.com>2026-05-23 10:33:53 +0200
committerPawel Zelawski <pawel@pzelawski.com>2026-05-23 10:33:53 +0200
commit376feecb280c28504788c9677c6cb3cc455f00b6 (patch)
treeebf3ee7ac5e67560a98f51e3815f9b7a414734df /src/client/utils.ts
parenteafdcd8290700fdeaa6b069c4d52e50a9db6ad94 (diff)
chore: upgrade digiid-ts to v3 and stabilize dev/build scripts
Diffstat (limited to 'src/client/utils.ts')
-rw-r--r--src/client/utils.ts19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/client/utils.ts b/src/client/utils.ts
index 6a95f7b..1677749 100644
--- a/src/client/utils.ts
+++ b/src/client/utils.ts
@@ -1,6 +1,10 @@
// Utility to determine DigiByte address type based on prefix
-export type DigiByteAddressFormat = 'Legacy (P2PKH)' | 'Script (P2SH)' | 'SegWit (Bech32)' | 'Unknown';
+export type DigiByteAddressFormat =
+ | 'Legacy (P2PKH)'
+ | 'Script (P2SH)'
+ | 'SegWit (Bech32)'
+ | 'Unknown';
/**
* Determines the format of a DigiByte address based on its prefix.
@@ -11,21 +15,24 @@ export type DigiByteAddressFormat = 'Legacy (P2PKH)' | 'Script (P2SH)' | 'SegWit
* @param address The DigiByte address string.
* @returns The determined address format.
*/
-export function getDigiByteAddressType(address: string | undefined | null): DigiByteAddressFormat {
+export function getDigiByteAddressType(
+ address: string | undefined | null
+): DigiByteAddressFormat {
if (!address) {
return 'Unknown';
}
if (address.startsWith('dgb1')) {
return 'SegWit (Bech32)';
}
- if (address.startsWith('S')) { // Common prefix for P2SH on DGB
- return 'Script (P2SH)';
+ if (address.startsWith('S')) {
+ // Common prefix for P2SH on DGB
+ return 'Script (P2SH)';
}
if (address.startsWith('D')) {
- return 'Legacy (P2PKH)';
+ return 'Legacy (P2PKH)';
}
// If it doesn't match known prefixes, return Unknown
// Could potentially add DigiAsset checks here if they have distinct prefixes
return 'Unknown';
-} \ No newline at end of file
+}