diff --git a/web/cashtab/src/utils/__tests__/cashMethods.test.js b/web/cashtab/src/utils/__tests__/cashMethods.test.js --- a/web/cashtab/src/utils/__tests__/cashMethods.test.js +++ b/web/cashtab/src/utils/__tests__/cashMethods.test.js @@ -8,7 +8,6 @@ convertToEcashPrefix, isLegacyMigrationRequired, toLegacyCash, - toLegacyToken, toLegacyCashArray, convertEtokenToEcashAddr, parseOpReturn, @@ -1259,16 +1258,6 @@ ), ).toBe('ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035'); }); - it(`toLegacyToken returns an etoken: prefix address as simpleledger:`, () => { - expect( - toLegacyToken('etoken:qz2708636snqhsxu8wnlka78h6fdp77ar5tv2tzg4r'), - ).toBe('simpleledger:qz2708636snqhsxu8wnlka78h6fdp77ar5syue64fa'); - }); - it(`toLegacyToken returns an prefixless valid etoken address in simpleledger: format with prefix`, () => { - expect( - toLegacyToken('qz2708636snqhsxu8wnlka78h6fdp77ar5tv2tzg4r'), - ).toBe('simpleledger:qz2708636snqhsxu8wnlka78h6fdp77ar5syue64fa'); - }); it(`Recognizes a wallet with missing Path1889 is a Legacy Wallet and requires migration`, () => { expect(isLegacyMigrationRequired(missingPath1899Wallet)).toBe(true); }); diff --git a/web/cashtab/src/utils/cashMethods.js b/web/cashtab/src/utils/cashMethods.js --- a/web/cashtab/src/utils/cashMethods.js +++ b/web/cashtab/src/utils/cashMethods.js @@ -1079,29 +1079,6 @@ return cleanArray; } -export function toLegacyToken(addr) { - // Confirm input is a valid ecash address - const isValidInput = isValidEtokenAddress(addr); - if (!isValidInput) { - return new Error(`${addr} is not a valid etoken address`); - } - - // Check for ecash: prefix - const isPrefixedEtokenAddress = addr.slice(0, 7) === 'etoken:'; - - // If no prefix, assume it is checksummed for an ecash: prefix - const testedEtokenAddr = isPrefixedEtokenAddress ? addr : `etoken:${addr}`; - - let legacyTokenAddress; - try { - const { type, hash } = cashaddr.decode(testedEtokenAddr); - legacyTokenAddress = cashaddr.encode('simpleledger', type, hash); - } catch (err) { - return err; - } - return legacyTokenAddress; -} - /* Converts a serialized buffer containing encrypted data into an object * that can be interpreted by the ecies-lite library. *