Skip to content

Commit

Permalink
feat(suite): add Optimism
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Oct 8, 2024
1 parent c2fb244 commit f98f570
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/address-validator/src/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,11 @@ var CURRENCIES = [
symbol: 'bnb',
validator: ETHValidator,
},
{
name: 'Optimism',
symbol: 'eth',
validator: ETHValidator,
},
{
name: 'EOS',
symbol: 'eos',
Expand Down
22 changes: 22 additions & 0 deletions packages/blockchain-link/src/ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ export default [
subscribe: '',
},
},
{
blockchain: {
name: 'Optimism',
worker: 'js/blockbook-worker.js',
server: ['https://blockbook-dev.corp.sldev.cz:9302'],
debug: true,
},
data: {
address: '',
accountInfoOptions: {
page: 1,
pageSize: 25,
contractFilter: undefined,
},
estimateFeeOptions: {
blocks: [1, 2, 10],
},
txid: '',
tx: '',
subscribe: '',
},
},
{
blockchain: {
name: 'Ethereum Classic',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const COINS: Record<NetworkSymbol, string> = {
etc: require('../../images/coins/etc.svg'),
eth: require('../../images/coins/eth.svg'),
ltc: require('../../images/coins/ltc.svg'),
op: require('../../images/coins/op.svg'),
pol: require('../../images/coins/pol.svg'),
nmc: require('../../images/coins/nmc.svg'),
regtest: require('../../images/coins/btc_test.svg'),
Expand Down
21 changes: 21 additions & 0 deletions packages/product-components/src/images/coins/op.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2780,6 +2780,10 @@ export default defineMessages({
defaultMessage: 'BNB Smart Chain',
id: 'TR_NETWORK_BNB',
},
TR_NETWORK_OP: {
defaultMessage: 'Optimism',
id: 'TR_NETWORK_OP',
},
TR_NETWORK_LITECOIN: {
defaultMessage: 'Litecoin',
id: 'TR_NETWORK_LITECOIN',
Expand Down Expand Up @@ -4950,7 +4954,7 @@ export default defineMessages({
TR_EXPERIMENTAL_OP_ETHEREUM_DESCRIPTION: {
id: 'TR_EXPERIMENTAL_OP_ETHEREUM_DESCRIPTION',
defaultMessage:
'Enables the Optimism network but without internal transaction data history.',
'Enables the Optimism network but with wrong symbol OP instead of ETH and minimum gas 1 gwei.',
},
TR_EXPERIMENTAL_PASSWORD_MANAGER: {
id: 'TR_EXPERIMENTAL_PASSWORD_MANAGER',
Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/coinsColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const coinsColors: CoinsColors = {
etc: '#60c67e',
eth: '#454a75',
ltc: '#a6a8a9',
op: '#ff0720',
pol: '#7b3fe4',
nmc: '#186c9d',
regtest: '#e75f5f',
Expand Down
21 changes: 21 additions & 0 deletions suite-common/icons-deprecated/assets/cryptoIcons/op.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions suite-common/icons-deprecated/src/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export const cryptoIcons = {
dsol: require('../assets/cryptoIcons/dsol.svg'),
etc: require('../assets/cryptoIcons/etc.svg'),
eth: require('../assets/cryptoIcons/eth.svg'),
op: require('../assets/cryptoIcons/op.svg'),
gnt: require('../assets/cryptoIcons/gnt.svg'),
ltc: require('../assets/cryptoIcons/ltc.svg'),
pol: require('../assets/cryptoIcons/pol.svg'),
Expand Down
29 changes: 28 additions & 1 deletion suite-common/wallet-config/src/networksConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const networks = {
coingeckoId: 'ethereum',
coingeckoNativeId: 'ethereum',
},

pol: {
symbol: 'pol',
name: 'Polygon PoS',
Expand Down Expand Up @@ -136,6 +135,34 @@ export const networks = {
coingeckoId: 'binance-smart-chain',
coingeckoNativeId: 'binancecoin',
},
op: {
symbol: 'op',
name: 'Optimism',
networkType: 'ethereum',
chainId: 10,
bip43Path: "m/44'/60'/0'/0/i",
decimals: 18,
testnet: false,
explorer: {
tx: 'https://blockbook-dev.corp.sldev.cz:9302/tx/',
account: 'https://blockbook-dev.corp.sldev.cz:9302/address/',
nft: 'https://blockbook-dev.corp.sldev.cz:9302/nft/',
address: 'https://blockbook-dev.corp.sldev.cz:9302/address/',
queryString: '',
},
features: ['rbf', 'sign-verify', 'tokens', 'coin-definitions', 'nft-definitions'],
customBackends: ['blockbook'],
accountTypes: {
ledger: {
// ledger (live), #1 acc is same as Trezor, so it is skipped
accountType: 'ledger',
bip43Path: "m/44'/60'/i'/0/0",
isDebugOnlyAccountType: true,
},
},
coingeckoId: 'optimistic-ethereum',
coingeckoNativeId: 'ethereum',
},
sol: {
symbol: 'sol',
name: 'Solana',
Expand Down
1 change: 1 addition & 0 deletions suite-common/wallet-config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type NetworkSymbol =
| 'sol'
| 'pol'
| 'bnb'
| 'op'
| 'test'
| 'regtest'
| 'tsep'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const DEFAULT_ACCOUNT_SYNC_INTERVAL = 60 * 1000;
const CUSTOM_ACCOUNT_SYNC_INTERVALS: Partial<Record<NetworkSymbol, number>> = {
pol: 20 * 1000,
bnb: 20 * 1000,
op: 20 * 1000,
};

const getAccountSyncInterval = (symbol: NetworkSymbol) =>
Expand Down
1 change: 1 addition & 0 deletions suite-common/wallet-utils/src/__fixtures__/accountUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const accountTitleFixture = [
{ symbol: 'zec', title: 'TR_NETWORK_ZCASH' },
{ symbol: 'eth', title: 'TR_NETWORK_ETHEREUM' },
{ symbol: 'bnb', title: 'TR_NETWORK_BNB' },
{ symbol: 'op', title: 'TR_NETWORK_OP' },
{ symbol: 'etc', title: 'TR_NETWORK_ETHEREUM_CLASSIC' },
{ symbol: 'xem', title: 'TR_NETWORK_NEM' },
{ symbol: 'xlm', title: 'TR_NETWORK_STELLAR' },
Expand Down
2 changes: 2 additions & 0 deletions suite-common/wallet-utils/src/accountUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export const getTitleForNetwork = (symbol: NetworkSymbol) => {
return 'TR_NETWORK_ETHEREUM';
case 'bnb':
return 'TR_NETWORK_BNB';
case 'op':
return 'TR_NETWORK_OP';
case 'tsep':
return 'TR_NETWORK_ETHEREUM_SEPOLIA';
case 'thol':
Expand Down
2 changes: 1 addition & 1 deletion suite-native/config/src/supportedNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const orderedAccountTypes: AccountType[] = [
'ledger',
];

const discoveryBlacklist: NetworkSymbol[] = ['sol', 'dsol', 'pol', 'bnb'];
const discoveryBlacklist: NetworkSymbol[] = ['sol', 'dsol', 'pol', 'bnb', 'op'];

// All supported coins for device discovery
export const networkSymbolsWhitelistMap = {
Expand Down

0 comments on commit f98f570

Please sign in to comment.