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:
David Adegoke
2026-02-05 13:48:26 +01:00
committed by GitHub
parent d05a7a91d6
commit 308de0389d
103 changed files with 609 additions and 157 deletions
+14 -10
View File
@@ -34,8 +34,9 @@ Future<void> main(List<String> args) async {
final hasDogecoin = args.contains('${prefix}dogecoin');
final hasBase = args.contains('${prefix}base');
final hasArbitrum = args.contains('${prefix}arbitrum');
final hasBsc = args.contains('${prefix}bsc');
final hasZcash = args.contains('${prefix}zcash');
final hasEVM = hasEthereum || hasPolygon || hasBase || hasArbitrum;
final hasEVM = hasEthereum || hasPolygon || hasBase || hasArbitrum || hasBsc;
final excludeFlutterSecureStorage = args.contains('${prefix}excludeFlutterSecureStorage');
await generateBitcoin(hasBitcoin);
@@ -69,6 +70,7 @@ Future<void> main(List<String> args) async {
hasDogecoin: hasDogecoin,
hasBase: hasBase,
hasArbitrum: hasArbitrum,
hasBsc: hasBsc,
hasZcash: hasZcash,
);
await generateWalletTypes(
@@ -87,6 +89,7 @@ Future<void> main(List<String> args) async {
hasDogecoin: hasDogecoin,
hasBase: hasBase,
hasArbitrum: hasArbitrum,
hasBsc: hasBsc,
hasZcash: hasZcash,
);
await injectSecureStorage(!excludeFlutterSecureStorage);
@@ -740,15 +743,12 @@ abstract class BitcoinCash {
""";
const bitcoinCashEmptyDefinition = 'BitcoinCash? bitcoinCash;\n';
const bitcoinCashCWDefinition =
'BitcoinCash? bitcoinCash = CWBitcoinCash();\n';
const bitcoinCashCWDefinition = 'BitcoinCash? bitcoinCash = CWBitcoinCash();\n';
final output = '$bitcoinCashCommonHeaders\n' +
(hasImplementation ? '$bitcoinCashCWHeaders\n' : '\n') +
(hasImplementation ? '$bitcoinCashCwPart\n\n' : '\n') +
(hasImplementation
? bitcoinCashCWDefinition
: bitcoinCashEmptyDefinition) +
(hasImplementation ? bitcoinCashCWDefinition : bitcoinCashEmptyDefinition) +
'\n' +
bitcoinCashContent;
@@ -883,8 +883,7 @@ abstract class NanoUtil {
""";
const nanoEmptyDefinition = 'Nano? nano;\nNanoUtil? nanoUtil;\n';
const nanoCWDefinition =
'Nano? nano = CWNano();\nNanoUtil? nanoUtil = CWNanoUtil();\n';
const nanoCWDefinition = 'Nano? nano = CWNano();\nNanoUtil? nanoUtil = CWNanoUtil();\n';
final output = '$nanoCommonHeaders\n' +
(hasImplementation ? '$nanoCWHeaders\n' : '\n') +
@@ -1674,6 +1673,7 @@ Future<void> generatePubspec({
required bool hasDogecoin,
required bool hasBase,
required bool hasArbitrum,
required bool hasBsc,
required bool hasZcash,
}) async {
const cwCore = """
@@ -1745,8 +1745,7 @@ Future<void> generatePubspec({
final inputLines = inputText.split('\n');
final dependenciesIndex = inputLines.indexWhere((line) => Platform.isWindows
// On Windows it could contains `\r` (Carriage Return). It could be fixed in newer dart versions.
? line.toLowerCase() == 'dependencies:\r' ||
line.toLowerCase() == 'dependencies:'
? line.toLowerCase() == 'dependencies:\r' || line.toLowerCase() == 'dependencies:'
: line.toLowerCase() == 'dependencies:');
var output = cwCore;
@@ -1834,6 +1833,7 @@ Future<void> generateWalletTypes({
required bool hasDogecoin,
required bool hasBase,
required bool hasArbitrum,
required bool hasBsc,
required bool hasZcash,
}) async {
final walletTypesFile = File(walletTypesPath);
@@ -1858,6 +1858,10 @@ Future<void> generateWalletTypes({
outputContent += '\tWalletType.ethereum,\n';
}
if (hasBsc) {
outputContent += '\tWalletType.bsc,\n';
}
if (hasSolana) {
outputContent += '\tWalletType.solana,\n';
}
+2
View File
@@ -57,6 +57,7 @@ class SecretKey {
SecretKey('polygonTestWalletSeeds', () => ''),
SecretKey('baseTestWalletSeeds', () => ''),
SecretKey('arbitrumTestWalletSeeds', () => ''),
SecretKey('bscTestWalletSeeds', () => ''),
SecretKey('solanaTestWalletSeeds', () => ''),
SecretKey('tronTestWalletSeeds', () => ''),
SecretKey('nanoTestWalletSeeds', () => ''),
@@ -69,6 +70,7 @@ class SecretKey {
SecretKey('polygonTestWalletReceiveAddress', () => ''),
SecretKey('baseTestWalletReceiveAddress', () => ''),
SecretKey('arbitrumTestWalletReceiveAddress', () => ''),
SecretKey('bscTestWalletReceiveAddress', () => ''),
SecretKey('solanaTestWalletReceiveAddress', () => ''),
SecretKey('tronTestWalletReceiveAddress', () => ''),
SecretKey('nanoTestWalletReceiveAddress', () => ''),