From cb30308df61c09c741f83e35487bbf309e1ba34b Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 3 Oct 2022 13:59:30 -0300 Subject: [PATCH] [FEAT] Matic support --- assets/img/currencies/matic.svg | 11 + assets/img/currencies/png/MATIC.png | Bin 0 -> 1644 bytes src/constants/SupportedCurrencyOptions.tsx | 121 +++++++- src/constants/config.ts | 6 + src/constants/currencies.ts | 281 +++++++++++++++++- src/constants/tokens.ts | 92 ++++++ .../tabs/contacts/screens/ContactsAdd.tsx | 11 +- .../wallet/screens/CurrencySelection.tsx | 6 +- src/store/wallet/effects/create/create.ts | 3 + src/store/wallet/utils/validations.ts | 1 + 10 files changed, 523 insertions(+), 9 deletions(-) create mode 100644 assets/img/currencies/matic.svg create mode 100644 assets/img/currencies/png/MATIC.png diff --git a/assets/img/currencies/matic.svg b/assets/img/currencies/matic.svg new file mode 100644 index 0000000000..b0f2643756 --- /dev/null +++ b/assets/img/currencies/matic.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/img/currencies/png/MATIC.png b/assets/img/currencies/png/MATIC.png new file mode 100644 index 0000000000000000000000000000000000000000..556fbed3af66d7fd02989af481f921ce704050c7 GIT binary patch literal 1644 zcmV-y29x=TP)&hz(s>`Z5t9d>5fS@x3*!~EIF`_Aw8 ze!t&)Zy00<-_b{231YRJ^C|$Th5>khFcInDh;o2OtA5*aE)V zIgjMd?*OK>;2Tpt_|{h)@XyV{qm40xaR)VYtGSI^Xb~ z2|AF~v%(t8dc|_!&3tJ1un0V84Lx-H=|CyWj6Q?O@1Hs;h+)0gh5HF{K!5C5gWRa; zGY{;o$kWb+S2)byi=YVEAdIYY6UC4yhv3R;q=a&dun6PPlUB;E>Xrg%_@KyeE-ggw%2!bro z-xh@6y{LAs?DZW`iklNKCbiODBDVsYkt)2bpnwJVYc`VfItlycm0h7^m{ zf=z;dt{JRghM7GV?$)$TIrqMG^1V=fy%u2BI6|605|{?y3}7 z-vO3_QTWmS58U}ZERK^!JW8UpQQsm#>41H_M#gcs7aU?{^gpprmN*lkYZY-pX@qMJ zgSAZ$tsDU%qS*ap$)%eEZR3;W~+laUP=}RWAAT zt!pdr21cX9*cS|LgzhoayO=T*ueS!^i=WEH@5%l8+k;>cF5{1B3~WirdZR)j3N@U- zg0bwmDTNW0u10~!10vFgMAY_p=puJT_d~Sqkpt`#aYY`4x&ak%GQa4GAd2_Tj%YH zAZzrf2ZmIL^Qu4N^%lqimGv)(dW!N;D7`_IW(~qnnJJ8QN(#CcgJN(Pn{PjnIlVOq zLn;)ZnDHLSZ8%G^zPKT$ca6N(has&GaujUaS7(RIH>3;Ga?#)L;18TZJqS4jty*=D z>^_w2nrW5ABau4JVG42tb?MFQdg{ecw|i{6EwiP?P(A*}`?wS*by&SWlTd%{9@%p$ z)qR!$=tcW0Nf5L(5DBX;)HgMEBY>;xAoliK@{HVqmK{#Zc z;Eem#RVX`b?K3A5#G@VYWeIPZ&kW#jdw_?deVcXWRAlUJ>OMTfxnx#}lMP-xy-&Mg qeUc-@#UAGg7@JnWHIb , bch: props => , eth: props => , + matic: props => , doge: props => , ltc: props => , xrp: props => , @@ -49,6 +51,13 @@ export const CurrencyListIcons: { shib_e: props => , ape_e: props => , euroc_e: props => , + usdc_m: props => , + busd_m: props => , + dai_m: props => , + wbtc_m: props => , + shib_m: props => , + ape_m: props => , + matic_m: props => , }; export const SupportedUtxoCurrencyOptions: Array = [ @@ -83,7 +92,7 @@ export const SupportedUtxoCurrencyOptions: Array = [ id: Math.random().toString(), img: CurrencyListIcons.ltc, currencyName: 'Litecoin', - priority: 5, + priority: 6, currencyAbbreviation: 'ltc', hasMultisig: true, imgSrc: require('../../assets/img/currencies/png/LTC.png'), @@ -91,7 +100,7 @@ export const SupportedUtxoCurrencyOptions: Array = [ { id: Math.random().toString(), img: CurrencyListIcons.xrp, - priority: 6, + priority: 7, currencyName: 'XRP', currencyAbbreviation: 'xrp', imgSrc: require('../../assets/img/currencies/png/XRP.png'), @@ -108,6 +117,15 @@ export const SupportedEvmCurrencyOptions: Array = [ hasMultisig: false, imgSrc: require('../../assets/img/currencies/png/ETH.png'), }, + { + id: Math.random().toString(), + img: CurrencyListIcons.matic, + priority: 5, + currencyName: 'Matic', + currencyAbbreviation: 'matic', + hasMultisig: false, + imgSrc: require('../../assets/img/currencies/png/MATIC.png'), + }, ]; export const SupportedTokenOptions: Array = [ @@ -210,6 +228,105 @@ export const SupportedTokenOptions: Array = [ badgeSrc: require('../../assets/img/currencies/png/ETH.png'), badgeUri: CurrencyListIcons.eth, }, + { + id: Math.random().toString(), + img: CurrencyListIcons.usdc_m, + currencyName: 'USD Coin (PoS)', + currencyAbbreviation: 'usdc', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/USDC.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.ape_m, + currencyName: 'ApeCoin (PoS)', + currencyAbbreviation: 'ape', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/APE.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.euroc_m, + currencyName: 'Euro Coin', + currencyAbbreviation: 'euroc', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/EUROC.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.shib_m, + currencyName: 'SHIBA INU (PoS)', + currencyAbbreviation: 'shib', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/SHIB.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.gusd_m, + currencyName: 'Gemini Dollar', + currencyAbbreviation: 'gusd', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/GUSD.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.busd_m, + currencyName: 'binance-usd', + currencyAbbreviation: 'busd', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/BUSD.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.dai_m, + currencyName: '(PoS) Dai Stablecoin', + currencyAbbreviation: 'dai', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/DAI.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.wbtc_m, + currencyName: '(PoS) Wrapped BTC', + currencyAbbreviation: 'wbtc', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/WBTC.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, + { + id: Math.random().toString(), + img: CurrencyListIcons.wbtc_m, + currencyName: 'Matic Token', + currencyAbbreviation: 'matic', + chain: 'matic', + isToken: true, + imgSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeSrc: require('../../assets/img/currencies/png/MATIC.png'), + badgeUri: CurrencyListIcons.matic, + }, ]; export const SupportedCoinsOptions: Array = orderBy( diff --git a/src/constants/config.ts b/src/constants/config.ts index fee408a29a..57f96eb219 100644 --- a/src/constants/config.ts +++ b/src/constants/config.ts @@ -45,10 +45,12 @@ export const TWO_FACTOR_EMAIL_POLL_TIMEOUT = 1000 * 60 * 5; export const EVM_BLOCKCHAIN_NETWORK = { eth: 'ethereum', + matic: 'polygon-pos', }; export const EVM_BLOCKCHAIN_ID: {[key in string]: number} = { eth: 1, + matic: 137, }; export const EVM_BLOCKCHAIN_EXPLORERS: {[key in string]: any} = { @@ -56,4 +58,8 @@ export const EVM_BLOCKCHAIN_EXPLORERS: {[key in string]: any} = { [Network.mainnet]: 'etherscan.io/', [Network.testnet]: 'kovan.etherscan.io/', }, + matic: { + [Network.mainnet]: 'polygonscan.com/', + [Network.testnet]: 'mumbai.polygonscan.com/', + }, }; diff --git a/src/constants/currencies.ts b/src/constants/currencies.ts index 4e186ec63e..54a4ff0e2f 100644 --- a/src/constants/currencies.ts +++ b/src/constants/currencies.ts @@ -13,7 +13,7 @@ export type SupportedEthereumTokens = | 'ape_e' | 'euroc_e'; export type SupportedCurrencies = SupportedCoins | SupportedEthereumTokens; -export type EVM_CHAINS = 'eth'; +export type EVM_CHAINS = 'eth' | 'matic'; export type UTXO_CHAINS = 'btc' | 'bch' | 'doge' | 'ltc'; export interface CurrencyOpts { @@ -389,6 +389,236 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = { }, }; +export const BitpaySupportedMaticTokens: {[key in string]: CurrencyOpts} = { + busd_m: { + name: 'Binance USD Coin', + chain: 'matic', + coin: 'busd', + unitInfo: { + unitName: 'BUSD', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'busd', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: true, + singleAddress: true, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/busd_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1e9, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + usdc_m: { + name: 'USD Coin', + chain: 'matic', + coin: 'usdc', + unitInfo: { + unitName: 'USDC', + unitToSatoshi: 1e6, + unitDecimals: 6, + unitCode: 'usdc', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: true, + singleAddress: true, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/usdc_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1e9, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + dai_m: { + name: 'DAI', + chain: 'matic', + coin: 'dai', + unitInfo: { + unitName: 'DAI', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'dai', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: true, + singleAddress: true, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/gusd_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.livenet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1e9, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + wbtc_m: { + name: 'Wrapped Bitcoin', + chain: 'matic', + coin: 'wbtc', + unitInfo: { + unitName: 'WBTC', + unitToSatoshi: 1e8, + unitDecimals: 8, + unitCode: 'wbtc', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: true, + singleAddress: true, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/wbtc_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1e9, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + shib_m: { + name: 'SHIBA INU', + chain: 'matic', + coin: 'shib', + unitInfo: { + unitName: 'SHIB', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'shib', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: false, + singleAddress: true, + isCustom: false, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/shib_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1000000000, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + ape_m: { + name: 'ApeCoin', + chain: 'matic', + coin: 'ape', + unitInfo: { + unitName: 'APE', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'ape', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: false, + singleAddress: true, + isCustom: false, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/ape_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1000000000, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, + matic_m: { + name: 'Matic Token', + chain: 'matic', + coin: 'matic', + unitInfo: { + unitName: 'MATIC', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'matic', + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: false, + singleAddress: true, + isCustom: false, + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/matic_m', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1000000000, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + }, +}; + export const BitpaySupportedUtxoCoins: {[key in string]: CurrencyOpts} = { btc: { name: 'Bitcoin', @@ -599,8 +829,45 @@ export const BitpaySupportedEvmCoins: {[key in string]: CurrencyOpts} = { paymentCode: 'EIP681', protocolPrefix: {livenet: 'ethereum', testnet: 'ethereum'}, ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/eth', - blockExplorerUrls: 'etherscan.io/', - blockExplorerUrlsTestnet: 'kovan.etherscan.io/', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.eth.livenet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.eth.livenet, + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1e9, + blockTime: 0.2, + maxMerchantFee: 'urgent', + }, + theme: { + coinColor: '#6b71d6', + backgroundColor: '#6b71d6', + gradientBackgroundColor: '#6b71d6', + }, + }, + matic: { + name: 'Matic', + chain: 'matic', + coin: 'matic', + unitInfo: { + unitName: 'Matic', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'matic', + }, + properties: { + hasMultiSig: true, + hasMultiSend: false, + isUtxo: false, + isERCToken: false, + isStableCoin: false, + singleAddress: true, + }, + paymentInfo: { + paymentCode: 'EIP681', + protocolPrefix: {livenet: 'matic', testnet: 'matic'}, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/maitc', + blockExplorerUrls: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, + blockExplorerUrlsTestnet: EVM_BLOCKCHAIN_EXPLORERS.matic.testnet, }, feeInfo: { feeUnit: 'Gwei', @@ -618,6 +885,7 @@ export const BitpaySupportedEvmCoins: {[key in string]: CurrencyOpts} = { export const BitpaySupportedTokens: {[key in string]: CurrencyOpts} = { ...BitpaySupportedEthereumTokens, + ...BitpaySupportedMaticTokens, }; export const BitpaySupportedCoins: {[key in string]: CurrencyOpts} = { @@ -634,7 +902,12 @@ export const SUPPORTED_EVM_COINS = Object.keys(BitpaySupportedEvmCoins); export const SUPPORTED_ETHEREUM_TOKENS = Object.keys( BitpaySupportedEthereumTokens, ); -export const SUPPORTED_TOKENS = [...SUPPORTED_ETHEREUM_TOKENS]; + +export const SUPPORTED_MATIC_TOKENS = Object.keys(BitpaySupportedMaticTokens); +export const SUPPORTED_TOKENS = [ + ...SUPPORTED_ETHEREUM_TOKENS, + ...SUPPORTED_MATIC_TOKENS, +]; export const SUPPORTED_COINS = Object.keys(BitpaySupportedCoins); export const SUPPORTED_CURRENCIES = Object.keys(BitpaySupportedCurrencies); diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 970f065af0..9b30d699cb 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -71,8 +71,54 @@ export const BitpaySupportedEthereumTokenOpts: TokenOptsType = { }, }; +export const BitpaySupportedMaticTokenOpts: TokenOptsType = { + usdc_m: { + name: 'USD Coin (PoS)', + symbol: 'USDC', + decimals: 6, + address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + }, + busd_m: { + name: 'binance-usd', + symbol: 'BUSD', + decimals: 18, + address: '0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7', + }, + dai_m: { + name: '(PoS) Dai Stablecoin', + symbol: 'DAI', + decimals: 18, + address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + }, + wbtc_m: { + name: '(PoS) Wrapped BTC', + symbol: 'WBTC', + decimals: 8, + address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', + }, + shib_m: { + name: 'SHIBA INU (PoS)', + symbol: 'SHIB', + decimals: 18, + address: '0x6f8a06447Ff6FcF75d803135a7de15CE88C1d4ec', + }, + ape_m: { + name: 'ApeCoin (PoS)', + symbol: 'APE', + decimals: 18, + address: '0xB7b31a6BC18e48888545CE79e83E06003bE70930', + }, + matic_m: { + name: 'Matic Token', + symbol: 'MATIC', + decimals: 18, + address: '0x0000000000000000000000000000000000001010', + }, +}; + export const BitpaySupportedTokenOpts: TokenOptsType = { ...BitpaySupportedEthereumTokenOpts, + ...BitpaySupportedMaticTokenOpts, }; export const BitpaySupportedEthereumTokenOptsByAddress: TokenOptsType = { @@ -132,6 +178,52 @@ export const BitpaySupportedEthereumTokenOptsByAddress: TokenOptsType = { }, }; +export const BitpaySupportedMaticTokenOptsByAddress: TokenOptsType = { + '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174_m': { + name: 'USD Coin (PoS)', + symbol: 'USDC', + decimals: 6, + address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + }, + '0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7_m': { + name: 'binance-usd', + symbol: 'BUSD', + decimals: 18, + address: '0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7', + }, + '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063_m': { + name: '(PoS) Dai Stablecoin', + symbol: 'DAI', + decimals: 18, + address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + }, + '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6_m': { + name: '(PoS) Wrapped BTC', + symbol: 'WBTC', + decimals: 8, + address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', + }, + '0x6f8a06447Ff6FcF75d803135a7de15CE88C1d4ec_m': { + name: 'SHIBA INU (PoS)', + symbol: 'SHIB', + decimals: 18, + address: '0x6f8a06447Ff6FcF75d803135a7de15CE88C1d4ec', + }, + '0xB7b31a6BC18e48888545CE79e83E06003bE70930_m': { + name: 'ApeCoin (PoS)', + symbol: 'APE', + decimals: 18, + address: '0xB7b31a6BC18e48888545CE79e83E06003bE70930', + }, + '0x0000000000000000000000000000000000001010_m': { + name: 'Matic Token', + symbol: 'MATIC', + decimals: 18, + address: '0x0000000000000000000000000000000000001010', + }, +}; + export const BitpaySupportedTokenOptsByAddress: TokenOptsType = { ...BitpaySupportedEthereumTokenOptsByAddress, + ...BitpaySupportedMaticTokenOptsByAddress, }; diff --git a/src/navigation/tabs/contacts/screens/ContactsAdd.tsx b/src/navigation/tabs/contacts/screens/ContactsAdd.tsx index b5558844c6..460845ddc0 100644 --- a/src/navigation/tabs/contacts/screens/ContactsAdd.tsx +++ b/src/navigation/tabs/contacts/screens/ContactsAdd.tsx @@ -54,7 +54,11 @@ import NetworkSelectionRow, { import {LightBlack, NeutralSlate, Slate} from '../../../../styles/colors'; import {CurrencyImage} from '../../../../components/currency-image/CurrencyImage'; import WalletIcons from '../../../wallet/components/WalletIcons'; -import {SUPPORTED_TOKENS} from '../../../../constants/currencies'; +import { + BitpaySupportedMaticTokens, + SUPPORTED_ETHEREUM_TOKENS, + SUPPORTED_TOKENS, +} from '../../../../constants/currencies'; import {BitpaySupportedTokenOpts} from '../../../../constants/tokens'; import {useAppDispatch, useAppSelector} from '../../../../utils/hooks'; import {TouchableOpacity} from 'react-native-gesture-handler'; @@ -224,7 +228,9 @@ const ContactsAdd = ({ case 'e': return 'eth'; break; - + case 'm': + return 'matic'; + break; default: return 'eth'; break; @@ -319,6 +325,7 @@ const ContactsAdd = ({ switch (chain) { case 'eth': + case 'matic': setEvmValidAddress(true); return; case 'xrp': diff --git a/src/navigation/wallet/screens/CurrencySelection.tsx b/src/navigation/wallet/screens/CurrencySelection.tsx index 1ef6102de4..a2c2888bc6 100644 --- a/src/navigation/wallet/screens/CurrencySelection.tsx +++ b/src/navigation/wallet/screens/CurrencySelection.tsx @@ -18,7 +18,10 @@ import CurrencySelectionRow, { } from '../../../components/list/CurrencySelectionRow'; import Button from '../../../components/button/Button'; -import {BitpaySupportedCurrencies} from '../../../constants/currencies'; +import { + BitpaySupportedCurrencies, + BitpaySupportedTokens, +} from '../../../constants/currencies'; import {startCreateKey} from '../../../store/wallet/effects'; import { FlatList, @@ -122,6 +125,7 @@ const DESCRIPTIONS: Record = { const POPULAR_TOKENS: Record = { eth: ['usdc', 'busd', 'ape'], + matic: ['usdc', 'busd', 'ape'], }; const keyExtractor = (item: CurrencySelectionListItem) => item.currency.id; diff --git a/src/store/wallet/effects/create/create.ts b/src/store/wallet/effects/create/create.ts index 93a6a84c87..56ba107c13 100644 --- a/src/store/wallet/effects/create/create.ts +++ b/src/store/wallet/effects/create/create.ts @@ -1,6 +1,7 @@ import { BitpaySupportedCoins, SupportedCoins, + SUPPORTED_EVM_COINS, } from '../../../../constants/currencies'; import {Effect} from '../../../index'; import {Credentials} from 'bitcore-wallet-client/ts_build/lib/credentials'; @@ -32,6 +33,7 @@ import { import {getCurrencyAbbreviation, sleep} from '../../../../utils/helper-methods'; import {t} from 'i18next'; import {LogActions} from '../../../log'; +import {IsERCToken} from '../../utils/currency'; export interface CreateOptions { network?: Network; @@ -258,6 +260,7 @@ const createMultipleWallets = const wallets: API[] = []; const tokens = currencies.filter(({isToken}) => isToken); const coins = currencies.filter(({isToken}) => !isToken); + for (const coin of coins) { const wallet = (await createWallet({ key, diff --git a/src/store/wallet/utils/validations.ts b/src/store/wallet/utils/validations.ts index f1cd8ac5bf..61358857a2 100644 --- a/src/store/wallet/utils/validations.ts +++ b/src/store/wallet/utils/validations.ts @@ -330,6 +330,7 @@ export const ValidateCoinAddress = ( return !!addressLtc.isValid(str, network); case 'eth': case 'xrp': + case 'matic': const {Validation} = BWC.getCore(); return !!Validation.validateAddress(coin.toUpperCase(), network, str); default: