cake_wallet/lib/lightning/cw_lightning.dart

69 lines
2.6 KiB
Dart
Raw Normal View History

2024-02-08 19:45:21 +00:00
part of 'lightning.dart';
class CWLightning extends Lightning {
2024-03-01 17:55:44 +00:00
@override
WalletCredentials createLightningRestoreWalletFromSeedCredentials(
{required String name, required String mnemonic, required String password}) =>
BitcoinRestoreWalletFromSeedCredentials(name: name, mnemonic: mnemonic, password: password);
@override
WalletCredentials createLightningRestoreWalletFromWIFCredentials(
{required String name,
required String password,
required String wif,
WalletInfo? walletInfo}) =>
BitcoinRestoreWalletFromWIFCredentials(
name: name, password: password, wif: wif, walletInfo: walletInfo);
@override
WalletCredentials createLightningNewWalletCredentials(
{required String name, WalletInfo? walletInfo}) =>
BitcoinNewWalletCredentials(name: name, walletInfo: walletInfo);
@override
Object createLightningTransactionCredentials(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 createLightningTransactionCredentialsRaw(List<OutputInfo> outputs,
{TransactionPriority? priority, required int feeRate}) =>
BitcoinTransactionCredentials(outputs,
priority: priority != null ? priority as BitcoinTransactionPriority : null,
feeRate: feeRate);
2024-02-08 19:45:21 +00:00
2024-03-01 17:55:44 +00:00
@override
String formatterLightningAmountToString({required int amount}) =>
bitcoinAmountToString(amount: amount * 100000000);
2024-02-08 19:45:21 +00:00
2024-03-01 17:55:44 +00:00
@override
double formatterLightningAmountToDouble({required int amount}) =>
bitcoinAmountToDouble(amount: amount * 100000000);
2024-02-08 19:45:21 +00:00
2024-03-01 17:55:44 +00:00
@override
2024-03-05 07:21:06 +00:00
int formatterStringDoubleToLightningAmount(String amount) =>
stringDoubleToBitcoinAmount(amount * 100000000);
2024-02-08 19:45:21 +00:00
2024-03-01 17:55:44 +00:00
WalletService createLightningWalletService(
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) {
return LightningWalletService(walletInfoSource, unspentCoinSource);
}
2024-02-23 17:29:11 +00:00
@override
2024-03-01 17:55:44 +00:00
List<LightningReceivePageOption> getLightningReceivePageOptions() =>
LightningReceivePageOption.all;
}