mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-25 13:09:32 +00:00
68926c0a33
Some checks are pending
Cache Dependencies / test (push) Waiting to run
* Add Litecoin Hardware Wallet Creation * Add Litecoin Hardware Wallet Creation * Fix Bitcoin not sending on Ledger * Fixes to sending LTC using Ledger * CW-679 Fix merge conflicts * CW-679 Fix merge conflicts * CW-679 Minor fixes * CW-679 Add derivation Path of change address * ledger flutter plus refactoring * ledger flutter plus refactoring * ledger flutter plus refactoring * Ups :| * Ups :| I forgot USB * Handle BT Off * Fix Issue with A14 and USB * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Small Ledger Quality of life improvements * Pls work * Pls work * Pls work * Pls work * Fix overpopulation * Fix ble device detection and support for Stax and Flex * clean up pubspec * clean up * MWeb merge fix * MWeb merge fix * Fix Merge conflicts * Fix Requested changes
44 lines
1.6 KiB
Dart
44 lines
1.6 KiB
Dart
import 'package:bitcoin_base/bitcoin_base.dart';
|
|
import 'package:blockchain_utils/bip/bip/bip32/bip32.dart';
|
|
import 'package:cw_bitcoin/electrum_wallet_addresses.dart';
|
|
import 'package:cw_bitcoin/utils.dart';
|
|
import 'package:cw_core/wallet_info.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
part 'bitcoin_wallet_addresses.g.dart';
|
|
|
|
class BitcoinWalletAddresses = BitcoinWalletAddressesBase with _$BitcoinWalletAddresses;
|
|
|
|
abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with Store {
|
|
BitcoinWalletAddressesBase(
|
|
WalletInfo walletInfo, {
|
|
required super.mainHd,
|
|
required super.sideHd,
|
|
required super.network,
|
|
required super.isHardwareWallet,
|
|
super.initialAddresses,
|
|
super.initialRegularAddressIndex,
|
|
super.initialChangeAddressIndex,
|
|
super.initialSilentAddresses,
|
|
super.initialSilentAddressIndex = 0,
|
|
super.masterHd,
|
|
}) : super(walletInfo);
|
|
|
|
@override
|
|
String getAddress(
|
|
{required int index, required Bip32Slip10Secp256k1 hd, BitcoinAddressType? addressType}) {
|
|
if (addressType == P2pkhAddressType.p2pkh)
|
|
return generateP2PKHAddress(hd: hd, index: index, network: network);
|
|
|
|
if (addressType == SegwitAddresType.p2tr)
|
|
return generateP2TRAddress(hd: hd, index: index, network: network);
|
|
|
|
if (addressType == SegwitAddresType.p2wsh)
|
|
return generateP2WSHAddress(hd: hd, index: index, network: network);
|
|
|
|
if (addressType == P2shAddressType.p2wpkhInP2sh)
|
|
return generateP2SHAddress(hd: hd, index: index, network: network);
|
|
|
|
return generateP2WPKHAddress(hd: hd, index: index, network: network);
|
|
}
|
|
}
|