mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-11 08:44:02 +01:00
CW-1368: Add Binance Smart Chain (#2836)
* feat: Add Binance Smart Chain support to wallet types and EVM chain registry * feat: Add BSC node list and support in wallet type and chain ID mappings * feat: Add BSC default tokens and update evm utility functions * feat: Integrate BSC support in node settings and management * feat: Add BSC support to config scripts and wallet type generation * feat: Add BSC support to EVM chain ID and switcher * feat: Extend BSC support in wallet utilities and chain type checks * feat: Add BSC support to different wallet functions * feat: Add BSCURI class and implement for uri handling * feat: Update Android and iOS configurations to support BSC URL schemes * feat: Add BSC support to different functionalities and settings * refactor: Update wallet type name from'Binance Smart Chain' to BNB Smart Chain * feat: Add switcher icon and updates token utils * Review fixes * More changes to BSC name, wallet listing and images * Add more default tokens
This commit is contained in:
@@ -14,52 +14,26 @@ class EvmSwitcherDataItem {
|
||||
required this.svgPath,
|
||||
required this.chainId,
|
||||
});
|
||||
|
||||
static const ethereum = EvmSwitcherDataItem(
|
||||
name: 'Ethereum',
|
||||
svgPath: 'assets/images/evm_switcher_icons/ethereum.svg',
|
||||
chainId: 1,
|
||||
);
|
||||
|
||||
static const polygon = EvmSwitcherDataItem(
|
||||
name: 'Polygon',
|
||||
svgPath: 'assets/images/evm_switcher_icons/polygon.svg',
|
||||
chainId: 137,
|
||||
);
|
||||
|
||||
static const arbitrum = EvmSwitcherDataItem(
|
||||
name: 'Arbitrum',
|
||||
svgPath: 'assets/images/evm_switcher_icons/arbitrum.svg',
|
||||
chainId: 42161,
|
||||
);
|
||||
|
||||
static const base = EvmSwitcherDataItem(
|
||||
name: 'Base',
|
||||
svgPath: 'assets/images/evm_switcher_icons/base.svg',
|
||||
chainId: 8453,
|
||||
);
|
||||
|
||||
static const items = [
|
||||
ethereum,
|
||||
polygon,
|
||||
arbitrum,
|
||||
base,
|
||||
];
|
||||
}
|
||||
|
||||
String _getSvgPathForChain(String chainName) {
|
||||
final name = chainName.toLowerCase();
|
||||
if (name.contains('ethereum')) {
|
||||
return 'assets/images/evm_switcher_icons/ethereum.svg';
|
||||
} else if (name.contains('polygon')) {
|
||||
return 'assets/images/evm_switcher_icons/polygon.svg';
|
||||
} else if (name.contains('arbitrum')) {
|
||||
return 'assets/images/evm_switcher_icons/arbitrum.svg';
|
||||
} else if (name.contains('base')) {
|
||||
return 'assets/images/evm_switcher_icons/base.svg';
|
||||
|
||||
switch (name) {
|
||||
case 'ethereum':
|
||||
return 'assets/images/crypto/ethereum.webp';
|
||||
case 'polygon':
|
||||
return 'assets/images/crypto/polygon.webp';
|
||||
case 'arbitrum':
|
||||
return 'assets/images/crypto/arbitrum.webp';
|
||||
case 'base':
|
||||
return 'assets/images/crypto/base_icon.webp';
|
||||
case 'bnb':
|
||||
case 'bsc':
|
||||
return 'assets/images/crypto/BNB.webp';
|
||||
default:
|
||||
return 'assets/images/crypto/ethereum.webp';
|
||||
}
|
||||
// Default to ethereum if unknown
|
||||
return 'assets/images/evm_switcher_icons/ethereum.svg';
|
||||
}
|
||||
|
||||
class EvmSwitcher extends StatefulWidget {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/evm_switcher.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_switch.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class EvmSwitcherRow extends StatelessWidget {
|
||||
const EvmSwitcherRow({
|
||||
@@ -45,23 +45,24 @@ class EvmSwitcherRow extends StatelessWidget {
|
||||
Row(
|
||||
spacing: 8.0,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
data.svgPath,
|
||||
CakeImageWidget(
|
||||
imageUrl: data.svgPath,
|
||||
width: 16,
|
||||
height: 16,
|
||||
colorFilter: ColorFilter.mode(
|
||||
resolvedForegroundColor, BlendMode.srcIn),
|
||||
),
|
||||
Text(data.name,
|
||||
style: TextStyle(
|
||||
color: resolvedForegroundColor, fontSize: 14)),
|
||||
Text(
|
||||
data.name,
|
||||
style: TextStyle(color: resolvedForegroundColor, fontSize: 14),
|
||||
),
|
||||
if (selected && !editMode)
|
||||
SvgPicture.asset("assets/images/evm_switcher_checkmark.svg",
|
||||
width: 18, height: 18),
|
||||
CakeImageWidget(
|
||||
imageUrl: "assets/images/evm_switcher_checkmark.svg",
|
||||
width: 18,
|
||||
height: 18,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (editMode)
|
||||
StandardSwitch(value: editSwitchValue, onTapped: onTap)
|
||||
if (editMode) StandardSwitch(value: editSwitchValue, onTapped: onTap)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user