From 5171503bbf50e9d9fc266e8fe9f92f9d2b2dc59f Mon Sep 17 00:00:00 2001 From: bretep <717695-bretep@users.noreply.gitlab.com> Date: Thu, 15 Aug 2024 00:52:46 -0700 Subject: [PATCH] Add PulseChain network --- apps/cli/src/live-common-setup-base.ts | 2 + .../live-common-set-supported-currencies.ts | 2 + .../src/live-common-setup.ts | 2 + .../Web3Hub/utils/api/mocks/manifests.ts | 2 + .../screens/AddAccounts/01-SelectCrypto.tsx | 6 ++ .../src/families/evm/config.ts | 32 +++++++ .../src/featureFlags/defaultFeatures.ts | 2 + .../packages/cryptoassets/src/abandonseed.ts | 2 + .../packages/cryptoassets/src/currencies.ts | 83 +++++++++++++++++++ .../src/data/evm/369/erc20-hash.json | 1 + .../data/evm/369/erc20-signatures-hash.json | 1 + .../src/data/evm/369/erc20-signatures.json | 1 + .../cryptoassets/src/data/evm/369/erc20.json | 1 + .../cryptoassets/src/data/evm/369/index.ts | 4 + .../packages/types-cryptoassets/src/index.ts | 3 + .../packages/types-live/src/feature.ts | 2 + libs/ui/packages/crypto-icons/src/svg/PLS.svg | 17 ++++ .../ui/packages/crypto-icons/src/svg/TPLS.svg | 17 ++++ 18 files changed, 180 insertions(+) create mode 100644 libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-hash.json create mode 100644 libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures-hash.json create mode 100644 libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures.json create mode 100644 libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20.json create mode 100644 libs/ledgerjs/packages/cryptoassets/src/data/evm/369/index.ts create mode 100644 libs/ui/packages/crypto-icons/src/svg/PLS.svg create mode 100644 libs/ui/packages/crypto-icons/src/svg/TPLS.svg diff --git a/apps/cli/src/live-common-setup-base.ts b/apps/cli/src/live-common-setup-base.ts index ff2370140a86..9ee15b3767ed 100644 --- a/apps/cli/src/live-common-setup-base.ts +++ b/apps/cli/src/live-common-setup-base.ts @@ -82,6 +82,8 @@ setSupportedCurrencies([ "klaytn", "polygon_zk_evm", "polygon_zk_evm_testnet", + "pulsechain", + "pulsechain_testnet", "base", "base_sepolia", "stacks", diff --git a/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts b/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts index 418f4e80f3d1..42c320505ad9 100644 --- a/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts +++ b/apps/ledger-live-desktop/src/live-common-set-supported-currencies.ts @@ -77,6 +77,8 @@ setSupportedCurrencies([ "klaytn", "polygon_zk_evm", "polygon_zk_evm_testnet", + "pulsechain", + "pulsechain_testnet", "base", "base_sepolia", "stacks", diff --git a/apps/ledger-live-mobile/src/live-common-setup.ts b/apps/ledger-live-mobile/src/live-common-setup.ts index e6e4e721f9ad..e20cdce65002 100644 --- a/apps/ledger-live-mobile/src/live-common-setup.ts +++ b/apps/ledger-live-mobile/src/live-common-setup.ts @@ -110,6 +110,8 @@ setSupportedCurrencies([ "klaytn", "polygon_zk_evm", "polygon_zk_evm_testnet", + "pulsechain", + "pulsechain_testnet", "base", "base_sepolia", "stacks", diff --git a/apps/ledger-live-mobile/src/newArch/features/Web3Hub/utils/api/mocks/manifests.ts b/apps/ledger-live-mobile/src/newArch/features/Web3Hub/utils/api/mocks/manifests.ts index 4d5356930336..ab2f1ad8fe66 100644 --- a/apps/ledger-live-mobile/src/newArch/features/Web3Hub/utils/api/mocks/manifests.ts +++ b/apps/ledger-live-mobile/src/newArch/features/Web3Hub/utils/api/mocks/manifests.ts @@ -129,6 +129,8 @@ export const mocks: AppManifest[] = [ "klaytn", "polygon_zk_evm", "polygon_zk_evm_testnet", + "pulsechain", + "pulsechain_testnet", "base", "base_goerli", "base_sepolia", diff --git a/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx b/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx index a3806464fd17..d4e2060fe363 100644 --- a/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx +++ b/apps/ledger-live-mobile/src/screens/AddAccounts/01-SelectCrypto.tsx @@ -87,6 +87,8 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { const coreum = useFeature("currencyCoreum"); const polygonZkEvm = useFeature("currencyPolygonZkEvm"); const polygonZkEvmTestnet = useFeature("currencyPolygonZkEvmTestnet"); + const pulseChain = useFeature("currencyPulseChain"); + const pulseChainTestnet = useFeature("currencyPulseChainTestnet"); const base = useFeature("currencyBase"); const baseSepolia = useFeature("currencyBaseSepolia"); const klaytn = useFeature("currencyKlaytn"); @@ -136,6 +138,8 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { coreum, polygon_zk_evm: polygonZkEvm, polygon_zk_evm_testnet: polygonZkEvmTestnet, + pulsechain: pulseChain, + pulsechain_testnet: pulseChainTestnet, base, base_sepolia: baseSepolia, klaytn, @@ -184,6 +188,8 @@ export default function AddAccountsSelectCrypto({ navigation, route }: Props) { coreum, polygonZkEvm, polygonZkEvmTestnet, + pulseChain, + pulseChainTestnet, base, baseSepolia, klaytn, diff --git a/libs/ledger-live-common/src/families/evm/config.ts b/libs/ledger-live-common/src/families/evm/config.ts index 25e97982bfbc..6453f90ebe22 100644 --- a/libs/ledger-live-common/src/families/evm/config.ts +++ b/libs/ledger-live-common/src/families/evm/config.ts @@ -555,6 +555,22 @@ const evmConfig: CurrencyLiveConfigDefinition = { }, }, }, + config_currency_pulsechain: { + type: "object", + default: { + status: { + type: "active", + }, + node: { + type: "external", + uri: "https://rpc.pulsechain.com", + }, + explorer: { + type: "blockscout", + uri: "https://api.scan.pulsechain.com/api", + }, + }, + }, config_currency_base: { type: "object", default: { @@ -669,6 +685,22 @@ const evmConfig: CurrencyLiveConfigDefinition = { explorer: { type: "etherscan", uri: "https://api-testnet-zkevm.polygonscan.com/api" }, }, }, + config_currency_pulsechain_testnet: { + type: "object", + default: { + status: { + type: "active", + }, + node: { + type: "external", + uri: "https://rpc.v4.testnet.pulsechain.com", + }, + explorer: { + type: "blockscout", + uri: "https://api.scan.v4.testnet.pulsechain.com/api", + }, + }, + }, config_currency_base_sepolia: { type: "object", default: { diff --git a/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts b/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts index 4e5ebf851286..332f05f8946b 100644 --- a/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts +++ b/libs/ledger-live-common/src/featureFlags/defaultFeatures.ts @@ -57,6 +57,8 @@ export const CURRENCY_DEFAULT_FEATURES = { currencyPersistence: DEFAULT_FEATURE, currencyPolygonZkEvm: DEFAULT_FEATURE, currencyPolygonZkEvmTestnet: DEFAULT_FEATURE, + currencyPulseChain: DEFAULT_FEATURE, + currencyPulseChainTestnet: DEFAULT_FEATURE, currencyQuicksilver: DEFAULT_FEATURE, currencyRsk: DEFAULT_FEATURE, currencySecretNetwork: DEFAULT_FEATURE, diff --git a/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts b/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts index 3e224b5d7b17..a704b21bd2eb 100644 --- a/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts +++ b/libs/ledgerjs/packages/cryptoassets/src/abandonseed.ts @@ -86,6 +86,8 @@ const abandonSeedAddresses: Partial> = { klaytn: EVM_DEAD_ADDRESS, polygon_zk_evm: EVM_DEAD_ADDRESS, polygon_zk_evm_testnet: EVM_DEAD_ADDRESS, + pulsechain: EVM_DEAD_ADDRESS, + pulsechain_testnet: EVM_DEAD_ADDRESS, base: EVM_DEAD_ADDRESS, base_sepolia: EVM_DEAD_ADDRESS, stacks: "SP3KS7VMY2ZNE6SB88PHR4SKRK2EEPHS8N8MCCBR9", diff --git a/libs/ledgerjs/packages/cryptoassets/src/currencies.ts b/libs/ledgerjs/packages/cryptoassets/src/currencies.ts index e649a1ce3265..920a7dca37c2 100644 --- a/libs/ledgerjs/packages/cryptoassets/src/currencies.ts +++ b/libs/ledgerjs/packages/cryptoassets/src/currencies.ts @@ -4003,6 +4003,89 @@ export const cryptocurrenciesById: Record = { }, ], }, + pulsechain: { + type: "CryptoCurrency", + id: "pulsechain", + coinType: CoinType.ETH, + name: "PulseChain", + managerAppName: "Ethereum", + ticker: "PLS", + scheme: "pulsechain", + color: "#a928ff", + family: "evm", + blockAvgTime: 10, + ethereumLikeInfo: { + chainId: 369, + }, + units: [ + { + name: "Pulse", + code: "PLS", + magnitude: 18, + }, + { + name: "beat", + code: "beat", + magnitude: 9, + }, + { + name: "impulse", + code: "impulse", + magnitude: 0, + }, + ], + explorerViews: [ + { + tx: "https://scan.pulsechain.com/tx/$hash", + address: "https://scan.pulsechain.com/address/$address", + token: "https://scan.pulsechain.com/token/$contractAddress", + }, + ], + keywords: ["pulse", "pls", "pulsechain", "pulse chain"], + explorerId: "pls", + }, + pulsechain_testnet: { + type: "CryptoCurrency", + id: "pulsechain_testnet", + coinType: CoinType.ETH, + name: "PulseChain Testnet", + managerAppName: "Ethereum", + ticker: "tPLS", + scheme: "pulsechain_testnet", + color: "#2894ff", + family: "evm", + blockAvgTime: 10, + isTestnetFor: "pulsechain", + ethereumLikeInfo: { + chainId: 943, + }, + units: [ + { + name: "Test Pulse", + code: "tPLS", + magnitude: 18, + }, + { + name: "beat", + code: "beat", + magnitude: 9, + }, + { + name: "impulse", + code: "impulse", + magnitude: 0, + }, + ], + explorerViews: [ + { + tx: "https://scan.v4.testnet.pulsechain.com/#/tx/$hash", + address: "https://scan.v4.testnet.pulsechain.com/#/address/$address", + token: "https://scan.v4.testnet.pulsechain.com/#/token/$contractAddress", + }, + ], + keywords: ["pulse", "pls", "pulsechain", "pulse chain", "tpls", "test pulse"], + explorerId: "pls", + }, base: { type: "CryptoCurrency", id: "base", diff --git a/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-hash.json b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-hash.json new file mode 100644 index 000000000000..3cc762b5501e --- /dev/null +++ b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-hash.json @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures-hash.json b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures-hash.json new file mode 100644 index 000000000000..3cc762b5501e --- /dev/null +++ b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures-hash.json @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures.json b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures.json new file mode 100644 index 000000000000..3cc762b5501e --- /dev/null +++ b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20-signatures.json @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20.json b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/erc20.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/index.ts b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/index.ts new file mode 100644 index 000000000000..9e2e69e7a7a7 --- /dev/null +++ b/libs/ledgerjs/packages/cryptoassets/src/data/evm/369/index.ts @@ -0,0 +1,4 @@ +export { default as tokens } from "./erc20.json"; +export { default as signatures } from "./erc20-signatures.json"; +export { default as hash } from "./erc20-hash.json"; +export { default as signaturesHash } from "./erc20-signatures-hash.json"; diff --git a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts index 680a14b72a40..c1b0ba68553e 100644 --- a/libs/ledgerjs/packages/types-cryptoassets/src/index.ts +++ b/libs/ledgerjs/packages/types-cryptoassets/src/index.ts @@ -86,6 +86,8 @@ export type CryptoCurrencyId = | "polkadot" | "polygon" | "poswallet" + | "pulsechain" + | "pulsechain_testnet" | "qrl" | "qtum" | "quicksilver" @@ -180,6 +182,7 @@ export type LedgerExplorerId = | "ltc" | "pivx" | "posw" + | "pls" | "qtum" | "strat" | "zec" diff --git a/libs/ledgerjs/packages/types-live/src/feature.ts b/libs/ledgerjs/packages/types-live/src/feature.ts index b1ebcd158956..6aa640713523 100644 --- a/libs/ledgerjs/packages/types-live/src/feature.ts +++ b/libs/ledgerjs/packages/types-live/src/feature.ts @@ -105,6 +105,8 @@ export type CurrencyFeatures = { currencyCoreum: DefaultFeature; currencyPolygonZkEvm: DefaultFeature; currencyPolygonZkEvmTestnet: DefaultFeature; + currencyPulseChain: DefaultFeature; + currencyPulseChainTestnet: DefaultFeature; currencyBase: DefaultFeature; currencyBaseSepolia: DefaultFeature; currencyKlaytn: DefaultFeature; diff --git a/libs/ui/packages/crypto-icons/src/svg/PLS.svg b/libs/ui/packages/crypto-icons/src/svg/PLS.svg new file mode 100644 index 000000000000..f02bff417f4b --- /dev/null +++ b/libs/ui/packages/crypto-icons/src/svg/PLS.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/libs/ui/packages/crypto-icons/src/svg/TPLS.svg b/libs/ui/packages/crypto-icons/src/svg/TPLS.svg new file mode 100644 index 000000000000..f02bff417f4b --- /dev/null +++ b/libs/ui/packages/crypto-icons/src/svg/TPLS.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + +