Skip to content

Commit

Permalink
[FEAT] Support Arb, Base, and Op Chains
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbazan7 committed May 3, 2024
1 parent c857f9a commit a3b5c53
Show file tree
Hide file tree
Showing 27 changed files with 1,141 additions and 46 deletions.
Binary file added assets/img/currencies/png/USDT.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/img/currencies/usdt.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ios/BitPayApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<string>bitcoincash</string>
<string>ethereum</string>
<string>matic</string>
<string>arb</string>
<string>base</string>
<string>op</string>
<string>dogecoin</string>
<string>litecoin</string>
</array>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"babel-plugin-module-resolver": "4.1.0",
"big-integer": "1.6.51",
"bitauth": "0.4.1",
"bitcore-wallet-client": "10.0.28",
"bitcore-wallet-client": "10.0.33",
"buffer": "4.9.2",
"countries-list": "2.6.1",
"eth-sig-util": "3.0.1",
Expand Down
7 changes: 7 additions & 0 deletions scripts/allowed-url-prefixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ const allowedUrlPrefixes = [
'https://api.bitcore.io/api',
'https://api-eth.bitcore.io/api',
'https://api-matic.bitcore.io/api',
'https://api-arb.bitcore.io/api',
'https://api-base.bitcore.io/api',
'https://api-op.bitcore.io/api',
'https://api-xrp.bitcore.io/api',
'https://portal.polygon.technology/bridge',
'https://bridge.arbitrum.io/',
'https://bridge.base.org/',
'https://app.optimism.io/bridge/',
].concat(developmentOnlyAllowedUrlPrefixes);

const allowedUrlPrefixString = allowedUrlPrefixes.join(',');
Expand Down
24 changes: 24 additions & 0 deletions src/constants/BWCError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ const _getErrorMessage = (err: Error) => {
return t(
'Insufficient funds in your linked MATIC wallet to cover the transaction fee.',
);
case 'INSUFFICIENT_ARB_FEE':
return t(
'Insufficient funds in your linked ARB wallet to cover the transaction fee.',
);
case 'INSUFFICIENT_BASE_FEE':
return t(
'Insufficient funds in your linked BASE wallet to cover the transaction fee.',
);
case 'INSUFFICIENT_OP_FEE':
return t(
'Insufficient funds in your linked OP wallet to cover the transaction fee.',
);
case 'LOCKED_FUNDS':
return t('Funds are locked by pending spend proposals');
case 'LOCKED_ETH_FEE':
Expand All @@ -108,6 +120,18 @@ const _getErrorMessage = (err: Error) => {
return t(
'Your POLYGON linked wallet funds are locked by pending spend proposals',
);
case 'LOCKED_ARB_FEE':
return t(
'Your ARB linked wallet funds are locked by pending spend proposals',
);
case 'LOCKED_BASE_FEE':
return t(
'Your BASE linked wallet funds are locked by pending spend proposals',
);
case 'LOCKED_OP_FEE':
return t(
'Your OP linked wallet funds are locked by pending spend proposals',
);
case 'COPAYER_VOTED':
return t('Copayer already voted on this spend proposal');
case 'NOT_AUTHORIZED':
Expand Down
166 changes: 166 additions & 0 deletions src/constants/SupportedCurrencyOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ApeIcon from '../../assets/img/currencies/ape.svg';
import EurocIcon from '../../assets/img/currencies/euroc.svg';
import MaticIcon from '../../assets/img/currencies/matic.svg';
import PyusdIcon from '../../assets/img/currencies/pyusd.svg';
import UsdtIcon from '../../assets/img/currencies/usdt.svg';
import {ImageSourcePropType} from 'react-native';
import {orderBy} from 'lodash';

Expand All @@ -42,6 +43,9 @@ export const CurrencyListIcons: {
bch: props => <BchIcon {...props} />,
eth: props => <EthIcon {...props} />,
matic: props => <MaticIcon {...props} />,
arb: props => <MaticIcon {...props} />,
base: props => <MaticIcon {...props} />,
op: props => <MaticIcon {...props} />,
doge: props => <DogeIcon {...props} />,
ltc: props => <LtcIcon {...props} />,
xrp: props => <XrpIcon {...props} />,
Expand All @@ -65,6 +69,18 @@ export const CurrencyListIcons: {
shib_m: props => <ShibIcon {...props} />,
ape_m: props => <ApeIcon {...props} />,
euroc_m: props => <EurocIcon {...props} />,
usdc_arb: props => <UsdcIcon {...props} />,
usdc_base: props => <UsdcIcon {...props} />,
usdc_op: props => <UsdcIcon {...props} />,
wbtc_arb: props => <WbtcIcon {...props} />,
wbtc_base: props => <WbtcIcon {...props} />,
wbtc_op: props => <WbtcIcon {...props} />,
weth_arb: props => <WethIcon {...props} />,
weth_base: props => <WethIcon {...props} />,
weth_op: props => <WethIcon {...props} />,
usdt_arb: props => <UsdtIcon {...props} />,
usdt_base: props => <UsdtIcon {...props} />,
usdt_op: props => <UsdtIcon {...props} />,
};

export const SupportedUtxoCurrencyOptions: Array<SupportedCurrencyOption> = [
Expand Down Expand Up @@ -143,6 +159,36 @@ export const SupportedEvmCurrencyOptions: Array<SupportedCurrencyOption> = [
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
},
{
id: Math.random().toString(),
img: CurrencyListIcons.arb,
priority: 5,
currencyName: 'Arbitrum',
currencyAbbreviation: 'arb',
chain: 'arb',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
},
{
id: Math.random().toString(),
img: CurrencyListIcons.base,
priority: 5,
currencyName: 'Base',
currencyAbbreviation: 'base',
chain: 'base',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
},
{
id: Math.random().toString(),
img: CurrencyListIcons.op,
priority: 5,
currencyName: 'Optimism',
currencyAbbreviation: 'op',
chain: 'op',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
},
];

export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
Expand Down Expand Up @@ -374,6 +420,126 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
badgeUri: CurrencyListIcons.matic,
tokenAddress: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_arb,
currencyName: 'USD Coin',
currencyAbbreviation: 'USDC',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_arb,
currencyName: 'Wrapped Bitcoin',
currencyAbbreviation: 'WBTC',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_arb,
currencyName: 'Tether USD',
currencyAbbreviation: 'USDT',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_arb,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_base,
currencyName: 'USD Coin',
currencyAbbreviation: 'USDC',
chain: 'base',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.base,
tokenAddress: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_base,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'base',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.base,
tokenAddress: '0x4200000000000000000000000000000000000006',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_op,
currencyName: 'USD Coin',
currencyAbbreviation: 'USDC',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_op,
currencyName: 'Wrapped Bitcoin',
currencyAbbreviation: 'WBTC',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_op,
currencyName: 'Tether USD',
currencyAbbreviation: 'USDT',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc_op,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
badgeSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
},
];

export const SupportedCoinsOptions: Array<SupportedCurrencyOption> = orderBy(
Expand Down
35 changes: 30 additions & 5 deletions src/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const APP_CRYPTO_PREFIX = [
'bitcoincash',
'ethereum',
'matic',
'arb',
'base',
'op',
'dogecoin',
'litecoin',
];
Expand All @@ -54,14 +57,12 @@ export const DOWNLOAD_BITPAY_URL = 'https://bitpay.com/wallet';
export const TWO_FACTOR_EMAIL_POLL_INTERVAL = 1000 * 3;
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,
arb: 42161,
base: 8453,
op: 10,
};

export const EVM_BLOCKCHAIN_EXPLORERS: {[key in string]: any} = {
Expand All @@ -73,6 +74,18 @@ export const EVM_BLOCKCHAIN_EXPLORERS: {[key in string]: any} = {
[Network.mainnet]: 'polygonscan.com/',
[Network.testnet]: 'mumbai.polygonscan.com/',
},
arb: {
[Network.mainnet]: 'arbiscan.io/',
[Network.testnet]: 'sepolia.arbiscan.io/',
},
base: {
[Network.mainnet]: 'basescan.org/',
[Network.testnet]: 'sepolia.basescan.org/',
},
op: {
[Network.mainnet]: 'optimistic.etherscan.io/',
[Network.testnet]: 'sepolia-optimism.etherscan.io/',
},
};

export const METHOD_ENVS = {
Expand All @@ -89,6 +102,18 @@ export const PROTOCOL_NAME: {[key in string]: any} = {
[Network.mainnet]: 'Polygon',
[Network.testnet]: 'Mumbai',
},
arb: {
[Network.mainnet]: 'Arbitrum',
[Network.testnet]: 'Sepolia',
},
base: {
[Network.mainnet]: 'Base',
[Network.testnet]: 'Sepolia',
},
op: {
[Network.mainnet]: 'Optimism',
[Network.testnet]: 'Sepolia',
},
default: {
[Network.mainnet]: 'Mainnet',
[Network.testnet]: 'Testnet',
Expand Down

0 comments on commit a3b5c53

Please sign in to comment.