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 15, 2024
1 parent bb8e764 commit 3c73e3a
Show file tree
Hide file tree
Showing 40 changed files with 1,240 additions and 95 deletions.
10 changes: 10 additions & 0 deletions assets/img/currencies/arb.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/img/currencies/base.svg
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/op.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/currencies/png/ARB.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/currencies/png/BASE.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/currencies/png/OP.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.35",
"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
10 changes: 8 additions & 2 deletions src/components/list/CurrencySelectionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ import {BaseText, H6, H7} from '../styled/Text';

export type CurrencySelectionItem = Pick<
SupportedCurrencyOption,
'id' | 'currencyAbbreviation' | 'currencyName' | 'img' | 'isToken'
| 'id'
| 'currencyAbbreviation'
| 'currencyName'
| 'img'
| 'isToken'
| 'badgeUri'
> & {
chain: string;
tokenAddress?: string;
Expand Down Expand Up @@ -123,6 +128,7 @@ export const ChainSelectionRow: React.VFC<ChainSelectionRowProps> = memo(
currencyName,
img,
imgSrc,
badgeUri,
selected,
disabled,
} = currency;
Expand All @@ -139,7 +145,7 @@ export const ChainSelectionRow: React.VFC<ChainSelectionRowProps> = memo(
: null
}>
<CurrencyColumn>
<CurrencyImage img={img} imgSrc={imgSrc} />
<CurrencyImage img={img} imgSrc={imgSrc} badgeUri={badgeUri} />
</CurrencyColumn>

<CurrencyTitleColumn style={{flexGrow: 1}}>
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
175 changes: 175 additions & 0 deletions src/constants/SupportedCurrencyOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import ShibIcon from '../../assets/img/currencies/shib.svg';
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 OpIcon from '../../assets/img/currencies/op.svg';
import BaseIcon from '../../assets/img/currencies/base.svg';
import ArbIcon from '../../assets/img/currencies/arb.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 +46,12 @@ export const CurrencyListIcons: {
bch: props => <BchIcon {...props} />,
eth: props => <EthIcon {...props} />,
matic: props => <MaticIcon {...props} />,
eth_arb: props => <EthIcon {...props} />,
eth_base: props => <EthIcon {...props} />,
eth_op: props => <EthIcon {...props} />,
arb: props => <ArbIcon {...props} />,
base: props => <BaseIcon {...props} />,
op: props => <OpIcon {...props} />,
doge: props => <DogeIcon {...props} />,
ltc: props => <LtcIcon {...props} />,
xrp: props => <XrpIcon {...props} />,
Expand All @@ -65,6 +75,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 +165,39 @@ export const SupportedEvmCurrencyOptions: Array<SupportedCurrencyOption> = [
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/MATIC.png'),
},
{
id: Math.random().toString(),
img: CurrencyListIcons.eth,
priority: 5,
currencyName: 'Ethreum Arbitrum',
currencyAbbreviation: 'eth',
chain: 'arb',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.arb,
},
{
id: Math.random().toString(),
img: CurrencyListIcons.eth,
priority: 5,
currencyName: 'Ethereum Base',
currencyAbbreviation: 'eth',
chain: 'base',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.base,
},
{
id: Math.random().toString(),
img: CurrencyListIcons.eth,
priority: 5,
currencyName: 'Ethereum Optimism',
currencyAbbreviation: 'eth',
chain: 'op',
hasMultisig: false,
imgSrc: require('../../assets/img/currencies/png/ETH.png'),
badgeUri: CurrencyListIcons.op,
},
];

export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
Expand Down Expand Up @@ -374,6 +429,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/USDC.png'),
badgeSrc: require('../../assets/img/currencies/png/ARB.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.wbtc_arb,
currencyName: 'Wrapped Bitcoin',
currencyAbbreviation: 'wbtc',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/WBTC.png'),
badgeSrc: require('../../assets/img/currencies/png/ARB.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdt_arb,
currencyName: 'Tether USD',
currencyAbbreviation: 'USDT',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/USDT.png'),
badgeSrc: require('../../assets/img/currencies/png/ARB.png'),
badgeUri: CurrencyListIcons.arb,
tokenAddress: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.weth_arb,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'arb',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/WETH.png'),
badgeSrc: require('../../assets/img/currencies/png/ARB.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/USDC.png'),
badgeSrc: require('../../assets/img/currencies/png/BASE.png'),
badgeUri: CurrencyListIcons.base,
tokenAddress: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.weth_base,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'base',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/WETH.png'),
badgeSrc: require('../../assets/img/currencies/png/BASE.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/USDC.png'),
badgeSrc: require('../../assets/img/currencies/png/OP.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.wbtc_op,
currencyName: 'Wrapped Bitcoin',
currencyAbbreviation: 'wbtc',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/WBTC.png'),
badgeSrc: require('../../assets/img/currencies/png/OP.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x68f180fcce6836688e9084f035309e29bf0a2095',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdt_op,
currencyName: 'Tether USD',
currencyAbbreviation: 'USDT',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/USDT.png'),
badgeSrc: require('../../assets/img/currencies/png/OP.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',
},
{
id: Math.random().toString(),
img: CurrencyListIcons.weth_op,
currencyName: 'Wrapped Ether',
currencyAbbreviation: 'WETH',
chain: 'op',
isToken: true,
imgSrc: require('../../assets/img/currencies/png/WETH.png'),
badgeSrc: require('../../assets/img/currencies/png/OP.png'),
badgeUri: CurrencyListIcons.op,
tokenAddress: '0x4200000000000000000000000000000000000006',
},
];

export const SupportedCoinsOptions: Array<SupportedCurrencyOption> = orderBy(
Expand Down

0 comments on commit 3c73e3a

Please sign in to comment.