From 16d8d4ba401b6aa3442140067e9a113f3efbc215 Mon Sep 17 00:00:00 2001 From: bretep <717695-bretep@users.noreply.gitlab.com> Date: Thu, 15 Aug 2024 13:58:22 -0700 Subject: [PATCH] Add tests for the PulseChain network --- .../formatCurrencyUnit.test.ts.snap | 44 +++ .../getFormattedFeeFields.test.ts.snap | 360 ++++++++++++++++++ libs/ledger-live-common/src/apps/polyfill.ts | 1 + .../ledger-live-common/src/apps/react.test.ts | 15 +- .../sortByMarketcap.test.ts.snap | 1 + .../cryptoassets/src/currencies.test.ts | 13 +- 6 files changed, 427 insertions(+), 7 deletions(-) diff --git a/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap b/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap index f0e049bd042b..702243d6b2e4 100644 --- a/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap +++ b/libs/coin-framework/src/currencies/__snapshots__/formatCurrencyUnit.test.ts.snap @@ -238,6 +238,10 @@ exports[`formatCurrencyUnit with custom options with locale de-DE should correct exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format PosW unit (posw) 1`] = `"123.456.789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format QRL unit (QRL) 1`] = `"123.456.789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Qtum unit (qtum) 1`] = `"123.456.789,00000000- -QTUM"`; @@ -564,6 +568,10 @@ exports[`formatCurrencyUnit with custom options with locale en-US should correct exports[`formatCurrencyUnit with custom options with locale en-US should correctly format PosW unit (posw) 1`] = `"123,456,789.00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale en-US should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0.012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale en-US should correctly format PulseChain unit (Pulse) 1`] = `"0.012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale en-US should correctly format QRL unit (QRL) 1`] = `"123,456,789.00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Qtum unit (qtum) 1`] = `"123,456,789.00000000- -QTUM"`; @@ -890,6 +898,10 @@ exports[`formatCurrencyUnit with custom options with locale es-ES should correct exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format PosW unit (posw) 1`] = `"123.456.789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format QRL unit (QRL) 1`] = `"123.456.789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Qtum unit (qtum) 1`] = `"123.456.789,00000000- -QTUM"`; @@ -1216,6 +1228,10 @@ exports[`formatCurrencyUnit with custom options with locale fr-FR should correct exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format PosW unit (posw) 1`] = `"123 456 789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format QRL unit (QRL) 1`] = `"123 456 789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Qtum unit (qtum) 1`] = `"123 456 789,00000000- -QTUM"`; @@ -1542,6 +1558,10 @@ exports[`formatCurrencyUnit with custom options with locale ja-JP should correct exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format PosW unit (posw) 1`] = `"123,456,789.00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0.012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format PulseChain unit (Pulse) 1`] = `"0.012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format QRL unit (QRL) 1`] = `"123,456,789.00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Qtum unit (qtum) 1`] = `"123,456,789.00000000- -QTUM"`; @@ -1868,6 +1888,10 @@ exports[`formatCurrencyUnit with custom options with locale ko-KR should correct exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format PosW unit (posw) 1`] = `"123,456,789.00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0.012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format PulseChain unit (Pulse) 1`] = `"0.012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format QRL unit (QRL) 1`] = `"123,456,789.00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Qtum unit (qtum) 1`] = `"123,456,789.00000000- -QTUM"`; @@ -2194,6 +2218,10 @@ exports[`formatCurrencyUnit with custom options with locale pt-BR should correct exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format PosW unit (posw) 1`] = `"123.456.789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format QRL unit (QRL) 1`] = `"123.456.789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Qtum unit (qtum) 1`] = `"123.456.789,00000000- -QTUM"`; @@ -2520,6 +2548,10 @@ exports[`formatCurrencyUnit with custom options with locale ru-RU should correct exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format PosW unit (posw) 1`] = `"123 456 789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format QRL unit (QRL) 1`] = `"123 456 789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Qtum unit (qtum) 1`] = `"123 456 789,00000000- -QTUM"`; @@ -2846,6 +2878,10 @@ exports[`formatCurrencyUnit with custom options with locale tr-TR should correct exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format PosW unit (posw) 1`] = `"123.456.789,00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0,012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format PulseChain unit (Pulse) 1`] = `"0,012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format QRL unit (QRL) 1`] = `"123.456.789,00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Qtum unit (qtum) 1`] = `"123.456.789,00000000- -QTUM"`; @@ -3172,6 +3208,10 @@ exports[`formatCurrencyUnit with custom options with locale zh-CN should correct exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format PosW unit (posw) 1`] = `"123,456,789.00000000- -POSW"`; +exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0.012345678900000000- -tPLS"`; + +exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format PulseChain unit (Pulse) 1`] = `"0.012345678900000000- -PLS"`; + exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format QRL unit (QRL) 1`] = `"123,456,789.00000000- -QRL"`; exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Qtum unit (qtum) 1`] = `"123,456,789.00000000- -QTUM"`; @@ -3498,6 +3538,10 @@ exports[`formatCurrencyUnit with default options should correctly format Polygon exports[`formatCurrencyUnit with default options should correctly format PosW unit (posw) 1`] = `"123,456,789"`; +exports[`formatCurrencyUnit with default options should correctly format PulseChain Testnet unit (Test Pulse) 1`] = `"0.0123456"`; + +exports[`formatCurrencyUnit with default options should correctly format PulseChain unit (Pulse) 1`] = `"0.0123456"`; + exports[`formatCurrencyUnit with default options should correctly format QRL unit (QRL) 1`] = `"123,456,789"`; exports[`formatCurrencyUnit with default options should correctly format Qtum unit (qtum) 1`] = `"123,456,789"`; diff --git a/libs/coin-modules/coin-evm/src/__tests__/unit/editTransaction/__snapshots__/getFormattedFeeFields.test.ts.snap b/libs/coin-modules/coin-evm/src/__tests__/unit/editTransaction/__snapshots__/getFormattedFeeFields.test.ts.snap index 2b59c5c6e0ff..911869faa3ca 100644 --- a/libs/coin-modules/coin-evm/src/__tests__/unit/editTransaction/__snapshots__/getFormattedFeeFields.test.ts.snap +++ b/libs/coin-modules/coin-evm/src/__tests__/unit/editTransaction/__snapshots__/getFormattedFeeFields.test.ts.snap @@ -423,6 +423,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale de-DE should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale de-DE should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale de-DE should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale de-DE should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -954,6 +972,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale en-US should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale en-US should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale en-US should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale en-US should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0105 REOSC", @@ -1485,6 +1521,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale es-ES should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale es-ES should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale es-ES should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale es-ES should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -2016,6 +2070,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale fr-FR should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale fr-FR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale fr-FR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale fr-FR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -2547,6 +2619,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale ja-JP should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale ja-JP should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale ja-JP should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale ja-JP should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0105 REOSC", @@ -3078,6 +3168,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale ko-KR should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale ko-KR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale ko-KR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale ko-KR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0105 REOSC", @@ -3609,6 +3717,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale pt-BR should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale pt-BR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale pt-BR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale pt-BR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -4140,6 +4266,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale ru-RU should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale ru-RU should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale ru-RU should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale ru-RU should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -4671,6 +4815,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale tr-TR should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale tr-TR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale tr-TR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale tr-TR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0105 REOSC", @@ -5202,6 +5364,24 @@ exports[`getFormattedFeeFields with tx type 0 with locale zh-CN should correctly } `; +exports[`getFormattedFeeFields with tx type 0 with locale zh-CN should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000105 tPLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 0 with locale zh-CN should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000105 PLS", + "formattedGasPrice": "5 beat", + "formattedMaxFeePerGas": "0 beat", + "formattedMaxPriorityFeePerGas": "0 beat", +} +`; + exports[`getFormattedFeeFields with tx type 0 with locale zh-CN should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0105 REOSC", @@ -5733,6 +5913,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale de-DE should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale de-DE should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale de-DE should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale de-DE should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -6264,6 +6462,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale en-US should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale en-US should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale en-US should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale en-US should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0042 REOSC", @@ -6795,6 +7011,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale es-ES should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale es-ES should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale es-ES should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale es-ES should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -7326,6 +7560,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale fr-FR should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale fr-FR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale fr-FR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale fr-FR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -7857,6 +8109,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale ja-JP should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale ja-JP should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale ja-JP should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale ja-JP should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0042 REOSC", @@ -8388,6 +8658,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale ko-KR should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale ko-KR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale ko-KR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale ko-KR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0042 REOSC", @@ -8919,6 +9207,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale pt-BR should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale pt-BR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale pt-BR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale pt-BR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -9450,6 +9756,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale ru-RU should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale ru-RU should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale ru-RU should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale ru-RU should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -9981,6 +10305,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale tr-TR should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale tr-TR should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0,000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale tr-TR should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0,000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale tr-TR should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0,0042 REOSC", @@ -10512,6 +10854,24 @@ exports[`getFormattedFeeFields with tx type 2 with locale zh-CN should correctly } `; +exports[`getFormattedFeeFields with tx type 2 with locale zh-CN should correctly format fee fields for PulseChain Testnet unit 1`] = ` +{ + "formattedFeeValue": "0.000042 tPLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + +exports[`getFormattedFeeFields with tx type 2 with locale zh-CN should correctly format fee fields for PulseChain unit 1`] = ` +{ + "formattedFeeValue": "0.000042 PLS", + "formattedGasPrice": "0 beat", + "formattedMaxFeePerGas": "2 beat", + "formattedMaxPriorityFeePerGas": "1 beat", +} +`; + exports[`getFormattedFeeFields with tx type 2 with locale zh-CN should correctly format fee fields for REOSC unit 1`] = ` { "formattedFeeValue": "0.0042 REOSC", diff --git a/libs/ledger-live-common/src/apps/polyfill.ts b/libs/ledger-live-common/src/apps/polyfill.ts index f509c82ed908..7446b14e2571 100644 --- a/libs/ledger-live-common/src/apps/polyfill.ts +++ b/libs/ledger-live-common/src/apps/polyfill.ts @@ -62,6 +62,7 @@ function declareDep(name: string, dep: string): void { ["Paraswap", "Ethereum"], ["POAP", "Ethereum"], ["Polygon", "Ethereum"], + ["PulseChain", "Ethereum"], ["Rarible", "Ethereum"], ["Ricochet", "Ethereum"], ["RocketPool", "Ethereum"], diff --git a/libs/ledger-live-common/src/apps/react.test.ts b/libs/ledger-live-common/src/apps/react.test.ts index 485c66484ea3..cfea2befdce9 100644 --- a/libs/ledger-live-common/src/apps/react.test.ts +++ b/libs/ledger-live-common/src/apps/react.test.ts @@ -19,8 +19,8 @@ calculateDependencies(); const mockedState = initState( mockListAppsResult( - "Bitcoin, Bitcoin Legacy, Ethereum, Litecoin, Dogecoin, Ethereum Classic, XRP, Bitcoin Cash, Decred, Aave, Polygon, Binance Smart Chain", - "Litecoin (outdated), Ethereum, Ethereum Classic, Aave, Polygon, Binance Smart Chain", + "Bitcoin, Bitcoin Legacy, Ethereum, Litecoin, Dogecoin, Ethereum Classic, XRP, Bitcoin Cash, Decred, Aave, Polygon, Binance Smart Chain, PulseChain", + "Litecoin (outdated), Ethereum, Ethereum Classic, Aave, Polygon, Binance Smart Chain, PulseChain", deviceInfo155, ), ); @@ -57,6 +57,7 @@ test("Apps hooks - useAppUninstallNeedsDeps - Expect dep apps", () => { "Aave", "Polygon", "Binance Smart Chain", + "PulseChain", ]); }); test("Apps hooks - useAppUninstallNeedsDeps - Expect no dep apps", () => { @@ -139,7 +140,7 @@ test("Apps hooks - useAppsSections - Correct number of installed apps", () => { }, }), ); - expect(result.current.device.length).toBe(6); + expect(result.current.device.length).toBe(7); }); test("Apps hooks - useAppsSections - Correct number of catalog apps", () => { const { result } = renderHook(() => @@ -152,7 +153,7 @@ test("Apps hooks - useAppsSections - Correct number of catalog apps", () => { }, }), ); - expect(result.current.catalog.length).toBe(12); + expect(result.current.catalog.length).toBe(13); }); test("Apps hooks - useAppsSections - Correct number of catalog apps with query", () => { const { result } = renderHook(() => @@ -184,8 +185,8 @@ test("Apps hooks - useAppsSections - Correct number of installed apps with query const mockedStateWithInstallQueue = { ...initState( mockListAppsResult( - "Bitcoin, Bitcoin Legacy, Ethereum, Litecoin, Dogecoin, Ethereum Classic, XRP, Bitcoin Cash, Decred, Aave, Polygon, Binance Smart Chain", - "Litecoin (outdated), Ethereum, Ethereum Classic, Aave, Polygon, Binance Smart Chain", + "Bitcoin, Bitcoin Legacy, Ethereum, Litecoin, Dogecoin, Ethereum Classic, XRP, Bitcoin Cash, Decred, Aave, Polygon, Binance Smart Chain, PulseChain", + "Litecoin (outdated), Ethereum, Ethereum Classic, Aave, Polygon, Binance Smart Chain, PulseChain", deviceInfo155, ), ), @@ -214,6 +215,7 @@ test('Apps hooks - useAppsSections - Sort "device" category apps with installing "Aave", "Polygon", "Binance Smart Chain", + "PulseChain", ]); expect(installQueueResult.current.device.map(elt => elt.name)).toMatchObject([ // Apps being installed @@ -226,5 +228,6 @@ test('Apps hooks - useAppsSections - Sort "device" category apps with installing "Aave", "Polygon", "Binance Smart Chain", + "PulseChain", ]); }); diff --git a/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap b/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap index 3f656eff656b..dd1f36a11f6d 100644 --- a/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +++ b/libs/ledger-live-common/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap @@ -1589,6 +1589,7 @@ exports[`sortCurrenciesByIds snapshot 1`] = ` "boba", "moonriver", "polygon_zk_evm", + "pulsechain", "base", "neon_evm", "lukso", diff --git a/libs/ledgerjs/packages/cryptoassets/src/currencies.test.ts b/libs/ledgerjs/packages/cryptoassets/src/currencies.test.ts index 508af68c9b39..93dc9dfff3e5 100644 --- a/libs/ledgerjs/packages/cryptoassets/src/currencies.test.ts +++ b/libs/ledgerjs/packages/cryptoassets/src/currencies.test.ts @@ -63,7 +63,18 @@ currencies.forEach(c => { c.keywords?.forEach(k => { test(`should find ${c.name} with keyword ${k}`, () => { - expect(findCryptoCurrencyByKeyword(k)).toEqual(c); + const result = findCryptoCurrencyByKeyword(k); + // Check if the result matches the current currency or its mainnet/testnet counterpart + if (result === c) { + expect(result).toEqual(c); + } else if (c.isTestnetFor && result?.id === c.isTestnetFor) { + expect(result.id).toEqual(c.isTestnetFor); + } else if (result?.isTestnetFor === c.id) { + expect(result.isTestnetFor).toEqual(c.id); + } else { + // If none of the above conditions are met, the test should fail + expect(result).toEqual(c); + } }); }); });