Skip to content

Commit 3d1d58c

Browse files
Merge pull request #5571 from BitGo/manas/WIN-4658-remove-deadalus-support-from-ada
feat: remove Daedalus address support from ADA wallets
2 parents e723c26 + 9175976 commit 3d1d58c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

modules/sdk-coin-ada/src/lib/utils.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ export class Utils implements BaseUtils {
180180

181181
//Check for Byron-era address
182182
try {
183+
// Reject Daedalus wallet addresses (Byron-era addresses starting with "DdzFF")
184+
if (address.startsWith('DdzFF')) {
185+
console.log(`Rejecting Daedalus wallet address: ${address}`);
186+
return false;
187+
}
188+
183189
const decoded = bs58.decode(address);
184190
const cborData = cbor.decodeFirstSync(decoded);
185191
return Array.isArray(cborData) && cborData.length >= 2;
@@ -270,6 +276,11 @@ export class Utils implements BaseUtils {
270276

271277
// Try decoding as a Byron (base58) address later
272278
try {
279+
// Reject Daedalus wallet addresses (Byron-era addresses starting with "DdzFF")
280+
if (address.startsWith('DdzFF')) {
281+
throw new InvalidAddressError('Provided string is a Daedalus address');
282+
}
283+
273284
return ByronAddress.from_base58(address).to_address();
274285
} catch (e) {
275286
console.error(`Could not decode byron address from string '${address}'`);
@@ -295,9 +306,12 @@ export class Utils implements BaseUtils {
295306
return address.to_bech32();
296307
}
297308

298-
// If not Shelley, try Byron
299309
const byronAddress = ByronAddress.from_address(address);
310+
// Reject Daedalus wallet addresses (Byron-era addresses starting with "DdzFF")
300311
if (byronAddress) {
312+
if (byronAddress.to_base58().startsWith('DdzFF')) {
313+
throw new InvalidAddressError('Provided address is a Daedalus address');
314+
}
301315
return byronAddress.to_base58();
302316
}
303317

modules/sdk-coin-ada/test/resources/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const address = {
2323
byron3:
2424
'37btjrVyb4KEB2STADSsj3MYSAdj52X5FrFWpw2r7Wmj2GDzXjFRsHWuZqrw7zSkwopv8Ci3VWeg6bisU9dgJxW5hb2MZYeduNKbQJrqz3zVBsu9nT', // Valid Byron testnet
2525
byron4: 'Ae2tdPwUPE_invalid_address', // Invalid Byron (malformed Base58)
26-
byron5: 'DdzFFzCqr_invalid_base58', // Invalid Byron (malformed Base58)
26+
byron5: 'DdzFFzCqrhsfZHjaBunVySZBU8i9Zom7Gujham6Jz8scCcAdkDmEbD9XSdXKdBiPoa1fjgL4ksGjQXD8ZkSNHGJfT25ieA9rWNCSA5qc', // Invalid Daedalus type)
2727
byron6: '37btjrVyb4KDX_invalid_CBOR', // Invalid CBOR structure
2828
};
2929

0 commit comments

Comments
 (0)