mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 18:54:47 +00:00
merge fixes
This commit is contained in:
parent
cead157c93
commit
e7fe64ee1f
1 changed files with 40 additions and 127 deletions
|
@ -1,9 +1,6 @@
|
||||||
part of 'bitcoin.dart';
|
part of 'bitcoin.dart';
|
||||||
|
|
||||||
class CWBitcoin extends Bitcoin {
|
class CWBitcoin extends Bitcoin {
|
||||||
@override
|
|
||||||
TransactionPriority getMediumTransactionPriority() => BitcoinTransactionPriority.medium;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
WalletCredentials createBitcoinRestoreWalletFromSeedCredentials({
|
WalletCredentials createBitcoinRestoreWalletFromSeedCredentials({
|
||||||
required String name,
|
required String name,
|
||||||
|
@ -19,113 +16,14 @@ class CWBitcoin extends Bitcoin {
|
||||||
derivationType: derivationType,
|
derivationType: derivationType,
|
||||||
derivationPath: derivationPath);
|
derivationPath: derivationPath);
|
||||||
|
|
||||||
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate) =>
|
|
||||||
(priority as BitcoinTransactionPriority).labelWithRate(rate);
|
|
||||||
|
|
||||||
void updateUnspents(Object wallet) async {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
await bitcoinWallet.updateUnspent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<TransactionPriority> getLitecoinTransactionPriorities()
|
|
||||||
=> LitecoinTransactionPriority.all;
|
|
||||||
|
|
||||||
@override
|
|
||||||
TransactionPriority deserializeBitcoinTransactionPriority(int raw)
|
|
||||||
=> BitcoinTransactionPriority.deserialize(raw: raw);
|
|
||||||
|
|
||||||
@override
|
|
||||||
TransactionPriority deserializeLitecoinTransactionPriority(int raw)
|
|
||||||
=> LitecoinTransactionPriority.deserialize(raw: raw);
|
|
||||||
|
|
||||||
@override
|
|
||||||
int getFeeRate(Object wallet, TransactionPriority priority) {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
return bitcoinWallet.feeRate(priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> generateNewAddress(Object wallet) async {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
await bitcoinWallet.walletAddresses.generateNewAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Object createBitcoinTransactionCredentials(List<Output> outputs, {required TransactionPriority priority, int? feeRate})
|
|
||||||
=> BitcoinTransactionCredentials(
|
|
||||||
outputs.map((out) => OutputInfo(
|
|
||||||
fiatAmount: out.fiatAmount,
|
|
||||||
cryptoAmount: out.cryptoAmount,
|
|
||||||
address: out.address,
|
|
||||||
note: out.note,
|
|
||||||
sendAll: out.sendAll,
|
|
||||||
extractedAddress: out.extractedAddress,
|
|
||||||
isParsedAddress: out.isParsedAddress,
|
|
||||||
formattedCryptoAmount: out.formattedCryptoAmount))
|
|
||||||
.toList(),
|
|
||||||
priority: priority as BitcoinTransactionPriority,
|
|
||||||
feeRate: feeRate);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Object createBitcoinTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate})
|
|
||||||
=> BitcoinTransactionCredentials(
|
|
||||||
outputs,
|
|
||||||
priority: priority != null ? priority as BitcoinTransactionPriority : null,
|
|
||||||
feeRate: feeRate);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<String> getAddresses(Object wallet) {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
return bitcoinWallet.walletAddresses.addresses
|
|
||||||
.map((BitcoinAddressRecord addr) => addr.address)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getAddress(Object wallet) {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
return bitcoinWallet.walletAddresses.address;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String formatterBitcoinAmountToString({required int amount})
|
|
||||||
=> bitcoinAmountToString(amount: amount);
|
|
||||||
|
|
||||||
@override
|
|
||||||
double formatterBitcoinAmountToDouble({required int amount})
|
|
||||||
=> bitcoinAmountToDouble(amount: amount);
|
|
||||||
|
|
||||||
@override
|
|
||||||
int formatterStringDoubleToBitcoinAmount(String amount)
|
|
||||||
=> stringDoubleToBitcoinAmount(amount);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate)
|
WalletCredentials createBitcoinRestoreWalletFromWIFCredentials(
|
||||||
=> (priority as BitcoinTransactionPriority).labelWithRate(rate);
|
{required String name,
|
||||||
|
required String password,
|
||||||
@override
|
required String wif,
|
||||||
List<BitcoinUnspent> getUnspents(Object wallet) {
|
WalletInfo? walletInfo}) =>
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
BitcoinRestoreWalletFromWIFCredentials(
|
||||||
return bitcoinWallet.unspentCoins;
|
name: name, password: password, wif: wif, walletInfo: walletInfo);
|
||||||
}
|
|
||||||
|
|
||||||
void updateUnspents(Object wallet) async {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
await bitcoinWallet.updateUnspent();
|
|
||||||
}
|
|
||||||
|
|
||||||
WalletService createBitcoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) {
|
|
||||||
return BitcoinWalletService(walletInfoSource, unspentCoinSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
WalletService createLitecoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) {
|
|
||||||
return LitecoinWalletService(walletInfoSource, unspentCoinSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TransactionPriority getBitcoinTransactionPriorityMedium()
|
|
||||||
=> BitcoinTransactionPriority.medium;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
WalletCredentials createBitcoinNewWalletCredentials(
|
WalletCredentials createBitcoinNewWalletCredentials(
|
||||||
|
@ -147,19 +45,6 @@ class CWBitcoin extends Bitcoin {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
List<TransactionPriority> getTransactionPriorities() => BitcoinTransactionPriority.all;
|
|
||||||
|
|
||||||
List<TransactionPriority> getLitecoinTransactionPriorities() => LitecoinTransactionPriority.all;
|
|
||||||
|
|
||||||
@override
|
|
||||||
TransactionPriority deserializeBitcoinTransactionPriority(int raw) =>
|
|
||||||
BitcoinTransactionPriority.deserialize(raw: raw);
|
|
||||||
|
|
||||||
@override
|
|
||||||
TransactionPriority deserializeLitecoinTransactionPriority(int raw) =>
|
|
||||||
LitecoinTransactionPriority.deserialize(raw: raw);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int getFeeRate(Object wallet, TransactionPriority priority) {
|
int getFeeRate(Object wallet, TransactionPriority priority) {
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
final bitcoinWallet = wallet as ElectrumWallet;
|
||||||
|
@ -223,12 +108,18 @@ class CWBitcoin extends Bitcoin {
|
||||||
int formatterStringDoubleToBitcoinAmount(String amount) => stringDoubleToBitcoinAmount(amount);
|
int formatterStringDoubleToBitcoinAmount(String amount) => stringDoubleToBitcoinAmount(amount);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Unspent> getUnspents(Object wallet) {
|
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate) =>
|
||||||
|
(priority as BitcoinTransactionPriority).labelWithRate(rate);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<BitcoinUnspent> getUnspents(Object wallet) {
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
final bitcoinWallet = wallet as ElectrumWallet;
|
||||||
return bitcoinWallet.unspentCoins
|
return bitcoinWallet.unspentCoins;
|
||||||
.map((BitcoinUnspent bitcoinUnspent) => Unspent(bitcoinUnspent.address.address,
|
}
|
||||||
bitcoinUnspent.hash, bitcoinUnspent.value, bitcoinUnspent.vout, null))
|
|
||||||
.toList();
|
void updateUnspents(Object wallet) async {
|
||||||
|
final bitcoinWallet = wallet as ElectrumWallet;
|
||||||
|
await bitcoinWallet.updateUnspent();
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletService createBitcoinWalletService(
|
WalletService createBitcoinWalletService(
|
||||||
|
@ -236,6 +127,25 @@ class CWBitcoin extends Bitcoin {
|
||||||
return BitcoinWalletService(walletInfoSource, unspentCoinSource);
|
return BitcoinWalletService(walletInfoSource, unspentCoinSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WalletService createLitecoinWalletService(
|
||||||
|
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) {
|
||||||
|
return LitecoinWalletService(walletInfoSource, unspentCoinSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<TransactionPriority> getTransactionPriorities() => BitcoinTransactionPriority.all;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<TransactionPriority> getLitecoinTransactionPriorities() => LitecoinTransactionPriority.all;
|
||||||
|
|
||||||
|
@override
|
||||||
|
TransactionPriority deserializeBitcoinTransactionPriority(int raw) =>
|
||||||
|
BitcoinTransactionPriority.deserialize(raw: raw);
|
||||||
|
|
||||||
|
@override
|
||||||
|
TransactionPriority deserializeLitecoinTransactionPriority(int raw) =>
|
||||||
|
LitecoinTransactionPriority.deserialize(raw: raw);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TransactionPriority getBitcoinTransactionPriorityMedium() => BitcoinTransactionPriority.medium;
|
TransactionPriority getBitcoinTransactionPriorityMedium() => BitcoinTransactionPriority.medium;
|
||||||
|
|
||||||
|
@ -248,6 +158,9 @@ class CWBitcoin extends Bitcoin {
|
||||||
@override
|
@override
|
||||||
TransactionPriority getLitecoinTransactionPrioritySlow() => LitecoinTransactionPriority.slow;
|
TransactionPriority getLitecoinTransactionPrioritySlow() => LitecoinTransactionPriority.slow;
|
||||||
|
|
||||||
|
@override
|
||||||
|
TransactionPriority getMediumTransactionPriority() => BitcoinTransactionPriority.medium;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<DerivationType>> compareDerivationMethods(
|
Future<List<DerivationType>> compareDerivationMethods(
|
||||||
{required String mnemonic, required Node node}) async {
|
{required String mnemonic, required Node node}) async {
|
||||||
|
|
Loading…
Reference in a new issue