mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 08:45:05 +00:00
fix: missing places, fix polygon wallet creation
This commit is contained in:
parent
e8dff0773a
commit
268dc3ca9f
9 changed files with 93 additions and 118 deletions
|
@ -67,6 +67,7 @@ abstract class EthereumWalletBase
|
||||||
walletInfo: walletInfo,
|
walletInfo: walletInfo,
|
||||||
password: password,
|
password: password,
|
||||||
encryptionFileUtils: encryptionFileUtils,
|
encryptionFileUtils: encryptionFileUtils,
|
||||||
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!CakeHive.isAdapterRegistered(Erc20Token.typeId)) {
|
if (!CakeHive.isAdapterRegistered(Erc20Token.typeId)) {
|
||||||
|
@ -407,6 +408,7 @@ abstract class EthereumWalletBase
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
initialBalance: balance,
|
initialBalance: balance,
|
||||||
encryptionFileUtils: encryptionFileUtils,
|
encryptionFileUtils: encryptionFileUtils,
|
||||||
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,15 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.3"
|
version: "8.4.3"
|
||||||
|
cake_backup:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
path: "."
|
||||||
|
ref: main
|
||||||
|
resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38"
|
||||||
|
url: "https://github.com/cake-tech/cake_backup.git"
|
||||||
|
source: git
|
||||||
|
version: "1.0.0+1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -169,6 +178,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.2"
|
||||||
|
cryptography:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cryptography
|
||||||
|
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.0"
|
||||||
|
cupertino_icons:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cupertino_icons
|
||||||
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.6"
|
||||||
cw_core:
|
cw_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -623,6 +648,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -59,6 +59,7 @@ abstract class NanoWalletBase
|
||||||
walletInfo: walletInfo,
|
walletInfo: walletInfo,
|
||||||
password: password,
|
password: password,
|
||||||
encryptionFileUtils: encryptionFileUtils,
|
encryptionFileUtils: encryptionFileUtils,
|
||||||
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
if (!CakeHive.isAdapterRegistered(NanoAccount.typeId)) {
|
if (!CakeHive.isAdapterRegistered(NanoAccount.typeId)) {
|
||||||
CakeHive.registerAdapter(NanoAccountAdapter());
|
CakeHive.registerAdapter(NanoAccountAdapter());
|
||||||
|
@ -410,6 +411,7 @@ abstract class NanoWalletBase
|
||||||
mnemonic: mnemonic,
|
mnemonic: mnemonic,
|
||||||
initialBalance: balance,
|
initialBalance: balance,
|
||||||
encryptionFileUtils: encryptionFileUtils,
|
encryptionFileUtils: encryptionFileUtils,
|
||||||
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
// init() should always be run after this!
|
// init() should always be run after this!
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,15 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.6.1"
|
version: "8.6.1"
|
||||||
|
cake_backup:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
path: "."
|
||||||
|
ref: main
|
||||||
|
resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38"
|
||||||
|
url: "https://github.com/cake-tech/cake_backup.git"
|
||||||
|
source: git
|
||||||
|
version: "1.0.0+1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -193,6 +202,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.3"
|
version: "3.0.3"
|
||||||
|
cryptography:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cryptography
|
||||||
|
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.0"
|
||||||
|
cupertino_icons:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cupertino_icons
|
||||||
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.6"
|
||||||
cw_core:
|
cw_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -773,6 +798,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -11,7 +11,6 @@ import 'package:cw_core/pending_transaction.dart';
|
||||||
import 'package:cw_core/sync_status.dart';
|
import 'package:cw_core/sync_status.dart';
|
||||||
import 'package:cw_core/transaction_direction.dart';
|
import 'package:cw_core/transaction_direction.dart';
|
||||||
import 'package:cw_core/transaction_priority.dart';
|
import 'package:cw_core/transaction_priority.dart';
|
||||||
import 'package:cw_core/utils/file.dart';
|
|
||||||
import 'package:cw_core/wallet_addresses.dart';
|
import 'package:cw_core/wallet_addresses.dart';
|
||||||
import 'package:cw_core/wallet_base.dart';
|
import 'package:cw_core/wallet_base.dart';
|
||||||
import 'package:cw_core/wallet_info.dart';
|
import 'package:cw_core/wallet_info.dart';
|
||||||
|
@ -19,6 +18,7 @@ import 'package:cw_ethereum/erc20_balance.dart';
|
||||||
import 'package:cw_ethereum/ethereum_formatter.dart';
|
import 'package:cw_ethereum/ethereum_formatter.dart';
|
||||||
import 'package:cw_core/erc20_token.dart';
|
import 'package:cw_core/erc20_token.dart';
|
||||||
import 'package:cw_polygon/default_polygon_erc20_tokens.dart';
|
import 'package:cw_polygon/default_polygon_erc20_tokens.dart';
|
||||||
|
import 'package:cw_core/encryption_file_utils.dart';
|
||||||
import 'package:cw_polygon/polygon_client.dart';
|
import 'package:cw_polygon/polygon_client.dart';
|
||||||
import 'package:cw_polygon/polygon_exceptions.dart';
|
import 'package:cw_polygon/polygon_exceptions.dart';
|
||||||
import 'package:cw_polygon/polygon_formatter.dart';
|
import 'package:cw_polygon/polygon_formatter.dart';
|
||||||
|
@ -48,6 +48,7 @@ abstract class PolygonWalletBase
|
||||||
String? mnemonic,
|
String? mnemonic,
|
||||||
String? privateKey,
|
String? privateKey,
|
||||||
required String password,
|
required String password,
|
||||||
|
required EncryptionFileUtils encryptionFileUtils,
|
||||||
ERC20Balance? initialBalance,
|
ERC20Balance? initialBalance,
|
||||||
required this.isFlatpak,
|
required this.isFlatpak,
|
||||||
}) : syncStatus = const NotConnectedSyncStatus(),
|
}) : syncStatus = const NotConnectedSyncStatus(),
|
||||||
|
@ -55,13 +56,15 @@ abstract class PolygonWalletBase
|
||||||
_mnemonic = mnemonic,
|
_mnemonic = mnemonic,
|
||||||
_hexPrivateKey = privateKey,
|
_hexPrivateKey = privateKey,
|
||||||
_isTransactionUpdating = false,
|
_isTransactionUpdating = false,
|
||||||
|
_encryptionFileUtils = encryptionFileUtils,
|
||||||
_client = PolygonClient(),
|
_client = PolygonClient(),
|
||||||
walletAddresses = PolygonWalletAddresses(walletInfo),
|
walletAddresses = PolygonWalletAddresses(walletInfo),
|
||||||
balance = ObservableMap<CryptoCurrency, ERC20Balance>.of(
|
balance = ObservableMap<CryptoCurrency, ERC20Balance>.of(
|
||||||
{CryptoCurrency.maticpoly: initialBalance ?? ERC20Balance(BigInt.zero)}),
|
{CryptoCurrency.maticpoly: initialBalance ?? ERC20Balance(BigInt.zero)}),
|
||||||
super(walletInfo) {
|
super(walletInfo) {
|
||||||
this.walletInfo = walletInfo;
|
this.walletInfo = walletInfo;
|
||||||
transactionHistory = PolygonTransactionHistory(walletInfo: walletInfo, password: password);
|
transactionHistory =
|
||||||
|
PolygonTransactionHistory(walletInfo: walletInfo, password: password, isFlatpak: isFlatpak);
|
||||||
|
|
||||||
if (!CakeHive.isAdapterRegistered(Erc20Token.typeId)) {
|
if (!CakeHive.isAdapterRegistered(Erc20Token.typeId)) {
|
||||||
CakeHive.registerAdapter(Erc20TokenAdapter());
|
CakeHive.registerAdapter(Erc20TokenAdapter());
|
||||||
|
@ -76,6 +79,8 @@ abstract class PolygonWalletBase
|
||||||
final String? _hexPrivateKey;
|
final String? _hexPrivateKey;
|
||||||
final String _password;
|
final String _password;
|
||||||
|
|
||||||
|
final EncryptionFileUtils _encryptionFileUtils;
|
||||||
|
|
||||||
late final Box<Erc20Token> polygonErc20TokensBox;
|
late final Box<Erc20Token> polygonErc20TokensBox;
|
||||||
|
|
||||||
late final EthPrivateKey _polygonPrivateKey;
|
late final EthPrivateKey _polygonPrivateKey;
|
||||||
|
@ -314,7 +319,7 @@ abstract class PolygonWalletBase
|
||||||
Future<void> save() async {
|
Future<void> save() async {
|
||||||
await walletAddresses.updateAddressesInBox();
|
await walletAddresses.updateAddressesInBox();
|
||||||
final path = await makePath();
|
final path = await makePath();
|
||||||
await write(path: path, password: _password, data: toJSON());
|
await _encryptionFileUtils.write(path: path, password: _password, data: toJSON());
|
||||||
await transactionHistory.save();
|
await transactionHistory.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,9 +363,10 @@ abstract class PolygonWalletBase
|
||||||
{required String name,
|
{required String name,
|
||||||
required String password,
|
required String password,
|
||||||
required WalletInfo walletInfo,
|
required WalletInfo walletInfo,
|
||||||
|
required EncryptionFileUtils encryptionFileUtils,
|
||||||
required bool isFlatpak}) async {
|
required bool isFlatpak}) async {
|
||||||
final path = await pathForWallet(name: name, type: walletInfo.type, isFlatpak: isFlatpak);
|
final path = await pathForWallet(name: name, type: walletInfo.type, isFlatpak: isFlatpak);
|
||||||
final jsonSource = await read(path: path, password: password);
|
final jsonSource = await encryptionFileUtils.read(path: path, password: password);
|
||||||
final data = json.decode(jsonSource) as Map;
|
final data = json.decode(jsonSource) as Map;
|
||||||
final mnemonic = data['mnemonic'] as String?;
|
final mnemonic = data['mnemonic'] as String?;
|
||||||
final privateKey = data['private_key'] as String?;
|
final privateKey = data['private_key'] as String?;
|
||||||
|
@ -372,6 +378,8 @@ abstract class PolygonWalletBase
|
||||||
mnemonic: mnemonic,
|
mnemonic: mnemonic,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
initialBalance: balance,
|
initialBalance: balance,
|
||||||
|
encryptionFileUtils: encryptionFileUtils,
|
||||||
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:cw_core/wallet_base.dart';
|
||||||
import 'package:cw_core/wallet_info.dart';
|
import 'package:cw_core/wallet_info.dart';
|
||||||
import 'package:cw_core/wallet_service.dart';
|
import 'package:cw_core/wallet_service.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
|
import 'package:cw_core/encryption_file_utils.dart';
|
||||||
import 'package:cw_ethereum/ethereum_mnemonics.dart';
|
import 'package:cw_ethereum/ethereum_mnemonics.dart';
|
||||||
import 'package:cw_polygon/polygon_wallet.dart';
|
import 'package:cw_polygon/polygon_wallet.dart';
|
||||||
import 'package:bip39/bip39.dart' as bip39;
|
import 'package:bip39/bip39.dart' as bip39;
|
||||||
|
@ -14,9 +15,10 @@ import 'package:collection/collection.dart';
|
||||||
|
|
||||||
class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
PolygonRestoreWalletFromSeedCredentials, PolygonRestoreWalletFromPrivateKey> {
|
PolygonRestoreWalletFromSeedCredentials, PolygonRestoreWalletFromPrivateKey> {
|
||||||
PolygonWalletService(this.walletInfoSource, this.isFlatpak);
|
PolygonWalletService(this.walletInfoSource, this.isDirect, this.isFlatpak);
|
||||||
|
|
||||||
final Box<WalletInfo> walletInfoSource;
|
final Box<WalletInfo> walletInfoSource;
|
||||||
|
final bool isDirect;
|
||||||
final bool isFlatpak;
|
final bool isFlatpak;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -28,6 +30,7 @@ class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
walletInfo: credentials.walletInfo!,
|
walletInfo: credentials.walletInfo!,
|
||||||
mnemonic: mnemonic,
|
mnemonic: mnemonic,
|
||||||
password: credentials.password!,
|
password: credentials.password!,
|
||||||
|
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
|
||||||
isFlatpak: isFlatpak,
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -53,6 +56,7 @@ class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
name: name,
|
name: name,
|
||||||
password: password,
|
password: password,
|
||||||
walletInfo: walletInfo,
|
walletInfo: walletInfo,
|
||||||
|
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
|
||||||
isFlatpak: isFlatpak,
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -77,6 +81,7 @@ class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
password: credentials.password!,
|
password: credentials.password!,
|
||||||
privateKey: credentials.privateKey,
|
privateKey: credentials.privateKey,
|
||||||
walletInfo: credentials.walletInfo!,
|
walletInfo: credentials.walletInfo!,
|
||||||
|
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
|
||||||
isFlatpak: isFlatpak,
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -97,6 +102,7 @@ class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
password: credentials.password!,
|
password: credentials.password!,
|
||||||
mnemonic: credentials.mnemonic,
|
mnemonic: credentials.mnemonic,
|
||||||
walletInfo: credentials.walletInfo!,
|
walletInfo: credentials.walletInfo!,
|
||||||
|
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
|
||||||
isFlatpak: isFlatpak,
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -115,6 +121,7 @@ class PolygonWalletService extends WalletService<PolygonNewWalletCredentials,
|
||||||
password: password,
|
password: password,
|
||||||
name: currentName,
|
name: currentName,
|
||||||
walletInfo: currentWalletInfo,
|
walletInfo: currentWalletInfo,
|
||||||
|
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
|
||||||
isFlatpak: isFlatpak,
|
isFlatpak: isFlatpak,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -137,116 +137,6 @@ class CWBitcoin extends Bitcoin {
|
||||||
@override
|
@override
|
||||||
int formatterStringDoubleToBitcoinAmount(String amount) => stringDoubleToBitcoinAmount(amount);
|
int formatterStringDoubleToBitcoinAmount(String amount) => stringDoubleToBitcoinAmount(amount);
|
||||||
|
|
||||||
@override
|
|
||||||
WalletCredentials createBitcoinRestoreWalletFromSeedCredentials(
|
|
||||||
{required String name, required String mnemonic, required String password}) =>
|
|
||||||
BitcoinRestoreWalletFromSeedCredentials(name: name, mnemonic: mnemonic, password: password);
|
|
||||||
|
|
||||||
@override
|
|
||||||
WalletCredentials createBitcoinRestoreWalletFromWIFCredentials(
|
|
||||||
{required String name,
|
|
||||||
required String password,
|
|
||||||
required String wif,
|
|
||||||
WalletInfo? walletInfo}) =>
|
|
||||||
BitcoinRestoreWalletFromWIFCredentials(
|
|
||||||
name: name, password: password, wif: wif, walletInfo: walletInfo);
|
|
||||||
|
|
||||||
@override
|
|
||||||
WalletCredentials createBitcoinNewWalletCredentials(
|
|
||||||
{required String name, WalletInfo? walletInfo, String? password}) =>
|
|
||||||
BitcoinNewWalletCredentials(name: name, walletInfo: walletInfo, password: password);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<String> getWordList() => wordlist;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, String> getWalletKeys(Object wallet) {
|
|
||||||
final bitcoinWallet = wallet as ElectrumWallet;
|
|
||||||
final keys = bitcoinWallet.keys;
|
|
||||||
|
|
||||||
return <String, String>{
|
|
||||||
'wif': keys.wif,
|
|
||||||
'privateKey': keys.privateKey,
|
|
||||||
'publicKey': keys.publicKey
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@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
|
|
||||||
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) =>
|
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate) =>
|
||||||
(priority as BitcoinTransactionPriority).labelWithRate(rate);
|
(priority as BitcoinTransactionPriority).labelWithRate(rate);
|
||||||
|
|
|
@ -5,8 +5,8 @@ class CWPolygon extends Polygon {
|
||||||
List<String> getPolygonWordList(String language) => EthereumMnemonics.englishWordlist;
|
List<String> getPolygonWordList(String language) => EthereumMnemonics.englishWordlist;
|
||||||
|
|
||||||
WalletService createPolygonWalletService(
|
WalletService createPolygonWalletService(
|
||||||
Box<WalletInfo> walletInfoSource, bool isDirec, bool isFlatpak) =>
|
Box<WalletInfo> walletInfoSource, bool isDirect, bool isFlatpak) =>
|
||||||
PolygonWalletService(walletInfoSource, isFlatpak);
|
PolygonWalletService(walletInfoSource, isDirect, isFlatpak);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
WalletCredentials createPolygonNewWalletCredentials(
|
WalletCredentials createPolygonNewWalletCredentials(
|
||||||
|
|
|
@ -637,7 +637,7 @@ import 'package:cw_ethereum/ethereum_mnemonics.dart';
|
||||||
const polygonContent = """
|
const polygonContent = """
|
||||||
abstract class Polygon {
|
abstract class Polygon {
|
||||||
List<String> getPolygonWordList(String language);
|
List<String> getPolygonWordList(String language);
|
||||||
WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource, bool isDirec, bool isFlatpak);
|
WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource, bool isDirect, bool isFlatpak);
|
||||||
WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password});
|
WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password});
|
||||||
WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
|
||||||
WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
|
WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
|
||||||
|
|
Loading…
Reference in a new issue