mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
* 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
48 lines
1.2 KiB
Dart
48 lines
1.2 KiB
Dart
import 'package:cw_evm/clients/evm_chain_client.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:web3dart/web3dart.dart';
|
|
|
|
class BSCClient extends EVMChainClient {
|
|
BSCClient() : super(chainId: 56);
|
|
|
|
@override
|
|
Transaction createTransaction({
|
|
required EthereumAddress from,
|
|
required EthereumAddress to,
|
|
required EtherAmount amount,
|
|
EtherAmount? maxPriorityFeePerGas,
|
|
Uint8List? data,
|
|
int? maxGas,
|
|
EtherAmount? gasPrice,
|
|
EtherAmount? maxFeePerGas,
|
|
int? nonce,
|
|
}) {
|
|
EtherAmount? finalGasPrice = gasPrice;
|
|
|
|
if (gasPrice == null && maxFeePerGas != null) {
|
|
// If we have EIP-1559 parameters but no legacy gasPrice, then use maxFeePerGas as gasPrice
|
|
// BSC RPC nodes may have issues with EIP-1559 transaction encoding
|
|
finalGasPrice = maxFeePerGas;
|
|
}
|
|
|
|
return Transaction(
|
|
from: from,
|
|
to: to,
|
|
value: amount,
|
|
data: data,
|
|
maxGas: maxGas,
|
|
gasPrice: finalGasPrice,
|
|
nonce: nonce,
|
|
// maxFeePerGas: maxFeePerGas,
|
|
// maxPriorityFeePerGas: maxPriorityFeePerGas,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Uint8List prepareSignedTransactionForSending(Uint8List signedTransaction) => signedTransaction;
|
|
|
|
@override
|
|
int get chainId => 56;
|
|
}
|
|
|