Merge branch 'staging' into firo

This commit is contained in:
sneurlax 2024-02-28 14:40:47 -06:00
commit 9eaa9391d3
8 changed files with 73 additions and 73 deletions
crypto_plugins
lib
pages
add_wallet_views/restore_wallet_view
wallet_view/transaction_views/tx_v2
utilities
wallets
crypto_currency/coins
wallet/impl
pubspec.lockpubspec.yaml

@ -1 +1 @@
Subproject commit 9eb24dd00cd0e1df08624ece1ca47090c158c08c Subproject commit 396d519a4c3ae1c47c8406e5506b0966f1f7098f

View file

@ -728,7 +728,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: ConditionalParent( child: ConditionalParent(
condition: !isDesktop, condition: isDesktop,
builder: (child) => Expanded( builder: (child) => Expanded(
child: child, child: child,
), ),

View file

@ -1048,7 +1048,7 @@ class _TransactionV2DetailsViewState
pTransactionNote( pTransactionNote(
( (
txid: (coin == Coin.epicCash) ? txid: (coin == Coin.epicCash) ?
_transaction.slateId as String _transaction.slateId.toString()
: _transaction.txid, : _transaction.txid,
walletId: walletId walletId: walletId
), ),

View file

@ -17,7 +17,7 @@ abstract class DefaultEpicBoxes {
static List<String> get defaultIds => ['americas', 'asia', 'europe']; static List<String> get defaultIds => ['americas', 'asia', 'europe'];
static EpicBoxServerModel get americas => EpicBoxServerModel( static EpicBoxServerModel get americas => EpicBoxServerModel(
host: 'stackwallet.epicbox.com', host: 'epicbox.stackwallet.com',
port: 443, port: 443,
name: 'Americas', name: 'Americas',
id: 'americas', id: 'americas',

View file

@ -185,7 +185,8 @@ class Ecash extends Bip39HDCurrency {
addr = cashAddr.split(":").last; addr = cashAddr.split(":").last;
} }
return addr.startsWith("q") || addr.startsWith("p"); return addr.startsWith("q") /*|| addr.startsWith("p")*/;
// Do not validate "p" (P2SH) addresses.
} }
@override @override

View file

@ -103,46 +103,30 @@ class EpiccashWallet extends Bip39Wallet {
} }
Future<EpicBoxConfigModel> getEpicBoxConfig() async { Future<EpicBoxConfigModel> getEpicBoxConfig() async {
EpicBoxConfigModel? _epicBoxConfig; EpicBoxConfigModel? _epicBoxConfig =
// read epicbox config from secure store EpicBoxConfigModel.fromServer(DefaultEpicBoxes.defaultEpicBoxServer);
String? storedConfig =
await secureStorageInterface.read(key: '${walletId}_epicboxConfig');
// we should move to storing the primary server model like we do with nodes, and build the config from that (see epic-mobile) //Get the default Epicbox server and check if it's conected
// EpicBoxServerModel? _epicBox = epicBox ?? // bool isEpicboxConnected = await _testEpicboxServer(
// DB.instance.get<EpicBoxServerModel>( // DefaultEpicBoxes.defaultEpicBoxServer.host, DefaultEpicBoxes.defaultEpicBoxServer.port ?? 443);
// boxName: DB.boxNamePrimaryEpicBox, key: 'primary');
// Logging.instance.log(
// "Read primary Epic Box config: ${jsonEncode(_epicBox)}",
// level: LogLevel.Info);
if (storedConfig == null) { // if (isEpicboxConnected) {
// if no config stored, use the default epicbox server as config //Use default server for as Epicbox config
_epicBoxConfig =
EpicBoxConfigModel.fromServer(DefaultEpicBoxes.defaultEpicBoxServer);
} else {
// if a config is stored, test it
_epicBoxConfig = EpicBoxConfigModel.fromString( // }
storedConfig); // fromString handles checking old config formats // else {
} // //Use Europe config
// _epicBoxConfig = EpicBoxConfigModel.fromServer(DefaultEpicBoxes.europe);
bool isEpicboxConnected = await _testEpicboxServer( // }
_epicBoxConfig.host, _epicBoxConfig.port ?? 443); // // example of selecting another random server from the default list
// // alternative servers: copy list of all default EB servers but remove the default default
if (!isEpicboxConnected) { // // List<EpicBoxServerModel> alternativeServers = DefaultEpicBoxes.all;
// default Epicbox is not connected, default to Europe // // alternativeServers.removeWhere((opt) => opt.name == DefaultEpicBoxes.defaultEpicBoxServer.name);
_epicBoxConfig = EpicBoxConfigModel.fromServer(DefaultEpicBoxes.europe); // // alternativeServers.shuffle(); // randomize which server is used
// // _epicBoxConfig = EpicBoxConfigModel.fromServer(alternativeServers.first);
// example of selecting another random server from the default list //
// alternative servers: copy list of all default EB servers but remove the default default // // TODO test this connection before returning it
// List<EpicBoxServerModel> alternativeServers = DefaultEpicBoxes.all; // }
// alternativeServers.removeWhere((opt) => opt.name == DefaultEpicBoxes.defaultEpicBoxServer.name);
// alternativeServers.shuffle(); // randomize which server is used
// _epicBoxConfig = EpicBoxConfigModel.fromServer(alternativeServers.first);
// TODO test this connection before returning it
}
return _epicBoxConfig; return _epicBoxConfig;
} }
@ -334,36 +318,50 @@ class EpiccashWallet extends Bip39Wallet {
int index, int index,
) async { ) async {
Address? address = await getCurrentReceivingAddress(); Address? address = await getCurrentReceivingAddress();
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
if (address == null) { if (address != null) {
final wallet = final splitted = address.value.split('@');
await secureStorageInterface.read(key: '${walletId}_wallet'); //Check if the address is the same as the current epicbox domain
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig(); //Since we're only using one epicbpox now this doesn't apply but will be
// useful in the future
final walletAddress = await epiccash.LibEpiccash.getAddressInfo( if (splitted[1] != epicboxConfig.host) {
wallet: wallet!, //Update the address
index: index, address = await thisWalletAddress(index, epicboxConfig);
epicboxConfig: epicboxConfig.toString(), }
); } else {
address = await thisWalletAddress(index, epicboxConfig);
Logging.instance.log(
"WALLET_ADDRESS_IS $walletAddress",
level: LogLevel.Info,
);
address = Address(
walletId: walletId,
value: walletAddress,
derivationIndex: index,
derivationPath: null,
type: AddressType.mimbleWimble,
subType: AddressSubType.receiving,
publicKey: [], // ??
);
await mainDB.updateOrPutAddresses([address]);
} }
return address;
}
Future<Address> thisWalletAddress(int index, EpicBoxConfigModel epicboxConfig) async {
final wallet =
await secureStorageInterface.read(key: '${walletId}_wallet');
// EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
final walletAddress = await epiccash.LibEpiccash.getAddressInfo(
wallet: wallet!,
index: index,
epicboxConfig: epicboxConfig.toString(),
);
Logging.instance.log(
"WALLET_ADDRESS_IS $walletAddress",
level: LogLevel.Info,
);
final address = Address(
walletId: walletId,
value: walletAddress,
derivationIndex: index,
derivationPath: null,
type: AddressType.mimbleWimble,
subType: AddressSubType.receiving,
publicKey: [], // ??
);
await mainDB.updateOrPutAddresses([address]);
return address; return address;
} }
@ -936,6 +934,7 @@ class EpiccashWallet extends Bip39Wallet {
.findAll(); .findAll();
final myAddressesSet = myAddresses.toSet(); final myAddressesSet = myAddresses.toSet();
final transactions = await epiccash.LibEpiccash.getTransactions( final transactions = await epiccash.LibEpiccash.getTransactions(
wallet: wallet!, wallet: wallet!,
refreshFromNode: refreshFromNode, refreshFromNode: refreshFromNode,

View file

@ -528,8 +528,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "0a34f7f48d921fb33f551cb11dfc9b2930522240" ref: "2897c6448e131241d4d91fe23fdab83305134225"
resolved-ref: "0a34f7f48d921fb33f551cb11dfc9b2930522240" resolved-ref: "2897c6448e131241d4d91fe23fdab83305134225"
url: "https://github.com/cypherstack/electrum_adapter.git" url: "https://github.com/cypherstack/electrum_adapter.git"
source: git source: git
version: "3.0.0" version: "3.0.0"

View file

@ -11,7 +11,7 @@ description: Stack Wallet
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.10.1+211 version: 1.10.1+212
environment: environment:
sdk: ">=3.0.2 <4.0.0" sdk: ">=3.0.2 <4.0.0"
@ -176,7 +176,7 @@ dependencies:
electrum_adapter: electrum_adapter:
git: git:
url: https://github.com/cypherstack/electrum_adapter.git url: https://github.com/cypherstack/electrum_adapter.git
ref: 0a34f7f48d921fb33f551cb11dfc9b2930522240 ref: 2897c6448e131241d4d91fe23fdab83305134225
stream_channel: ^2.1.0 stream_channel: ^2.1.0
dev_dependencies: dev_dependencies: