continue formatting

This commit is contained in:
Omar
2026-07-15 05:14:40 +03:00
parent 16ddc0837a
commit b1922fc663
29 changed files with 1115 additions and 723 deletions
+6 -8
View File
@@ -37,8 +37,8 @@ class DecredWallet = DecredWalletBase with _$DecredWallet;
abstract class DecredWalletBase
extends WalletBase<DecredBalance, DecredTransactionHistory, DecredTransactionInfo> with Store {
DecredWalletBase(WalletInfo walletInfo, DerivationInfo derivationInfo, String password, Box<UnspentCoinsInfo> unspentCoinsInfo,
Libwallet libwallet, Function() closeLibwallet)
DecredWalletBase(WalletInfo walletInfo, DerivationInfo derivationInfo, String password,
Box<UnspentCoinsInfo> unspentCoinsInfo, Libwallet libwallet, Function() closeLibwallet)
: _password = password,
_libwallet = libwallet,
_closeLibwallet = closeLibwallet,
@@ -46,13 +46,11 @@ abstract class DecredWalletBase
this.unspentCoinsInfo = unspentCoinsInfo,
this.watchingOnly =
derivationInfo.derivationPath == DecredWalletService.pubkeyRestorePath ||
derivationInfo.derivationPath ==
DecredWalletService.pubkeyRestorePathTestnet,
derivationInfo.derivationPath == DecredWalletService.pubkeyRestorePathTestnet,
this.balance = ObservableMap.of({CryptoCurrency.dcr: DecredBalance.zero()}),
this.isTestnet = derivationInfo.derivationPath ==
DecredWalletService.seedRestorePathTestnet ||
derivationInfo.derivationPath ==
DecredWalletService.pubkeyRestorePathTestnet,
this.isTestnet =
derivationInfo.derivationPath == DecredWalletService.seedRestorePathTestnet ||
derivationInfo.derivationPath == DecredWalletService.pubkeyRestorePathTestnet,
super(walletInfo, derivationInfo) {
walletAddresses = DecredWalletAddresses(walletInfo, libwallet, isTestnet);
transactionHistory = DecredTransactionHistory();
+6 -6
View File
@@ -151,8 +151,8 @@ class DecredWalletService extends WalletService<
"unsyncedaddrs": true,
};
await libwallet!.loadWallet(jsonEncode(config));
final wallet =
DecredWallet(walletInfo, di, password, this.unspentCoinsInfoSource, libwallet!, closeLibwallet);
final wallet = DecredWallet(
walletInfo, di, password, this.unspentCoinsInfoSource, libwallet!, closeLibwallet);
await wallet.init();
return wallet;
}
@@ -174,10 +174,10 @@ class DecredWalletService extends WalletService<
throw Exception('Wallet not found');
}
final di = await currentWalletInfo.getDerivationInfo();
final network = di.derivationPath == seedRestorePathTestnet ||
di.derivationPath == pubkeyRestorePathTestnet
? testnet
: mainnet;
final network =
di.derivationPath == seedRestorePathTestnet || di.derivationPath == pubkeyRestorePathTestnet
? testnet
: mainnet;
currentWalletInfo.network = network;
currentWalletInfo.save();
if (libwallet == null) {
+9 -5
View File
@@ -18,7 +18,6 @@ class CwMweb {
static Timer? logTimer;
static String? nodeUriOverride;
static Future<void> setNodeUriOverride(String uri) async {
nodeUriOverride = uri;
if (_rpcClient != null) {
@@ -232,13 +231,16 @@ class CwMweb {
static Future<PsbtResponse> psbtAddRecipient(PsbtAddRecipientRequest request) async {
log("mweb.psbtAddRecipient() called");
_rpcClient = await stub();
return await _rpcClient!.psbtAddRecipient(request, options: CallOptions(timeout: TIMEOUT_DURATION));
return await _rpcClient!
.psbtAddRecipient(request, options: CallOptions(timeout: TIMEOUT_DURATION));
}
static Future<PsbtGetRecipientsResponse> psbtGetRecipients(PsbtGetRecipientsRequest request) async {
static Future<PsbtGetRecipientsResponse> psbtGetRecipients(
PsbtGetRecipientsRequest request) async {
log("mweb.psbtGetRecipients() called");
_rpcClient = await stub();
return await _rpcClient!.psbtGetRecipients(request, options: CallOptions(timeout: TIMEOUT_DURATION));
return await _rpcClient!
.psbtGetRecipients(request, options: CallOptions(timeout: TIMEOUT_DURATION));
}
static Future<CreateResponse> psbtExtract(PsbtExtractRequest request) async {
@@ -246,6 +248,7 @@ class CwMweb {
_rpcClient = await stub();
return await _rpcClient!.psbtExtract(request, options: CallOptions(timeout: TIMEOUT_DURATION));
}
static Future<PsbtResponse> psbtSign(PsbtSignRequest request) async {
printV("mweb.psbtSign() called");
_rpcClient = await stub();
@@ -255,6 +258,7 @@ class CwMweb {
static Future<PsbtResponse> psbtSignNonMweb(PsbtSignNonMwebRequest request) async {
printV("mweb.psbtSignNonMweb() called");
_rpcClient = await stub();
return await _rpcClient!.psbtSignNonMweb(request, options: CallOptions(timeout: TIMEOUT_DURATION));
return await _rpcClient!
.psbtSignNonMweb(request, options: CallOptions(timeout: TIMEOUT_DURATION));
}
}
+1 -2
View File
@@ -44,8 +44,7 @@ class MWebFfi {
void stop() => lib.StopServer();
String addresses(
Uint8List scanSecret, Uint8List spendPub, int fromIndex, int toIndex) {
String addresses(Uint8List scanSecret, Uint8List spendPub, int fromIndex, int toIndex) {
final scanSecretPtr = malloc.allocate<Uint8>(scanSecret.length);
for (int k = 0; k < scanSecret.length; k++) {
scanSecretPtr[k] = scanSecret[k];
+915 -483
View File
File diff suppressed because it is too large Load Diff
+88 -127
View File
@@ -14,87 +14,70 @@ import 'mwebd.pb.dart' as $0;
export 'mwebd.pb.dart';
class RpcClient extends $grpc.Client {
static final _$status =
$grpc.ClientMethod<$0.StatusRequest, $0.StatusResponse>(
'/Rpc/Status',
($0.StatusRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.StatusResponse.fromBuffer(value));
static final _$status = $grpc.ClientMethod<$0.StatusRequest, $0.StatusResponse>(
'/Rpc/Status',
($0.StatusRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.StatusResponse.fromBuffer(value));
static final _$utxos = $grpc.ClientMethod<$0.UtxosRequest, $0.Utxo>(
'/Rpc/Utxos',
($0.UtxosRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Utxo.fromBuffer(value));
static final _$addresses =
$grpc.ClientMethod<$0.AddressRequest, $0.AddressResponse>(
'/Rpc/Addresses',
($0.AddressRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.AddressResponse.fromBuffer(value));
static final _$addresses = $grpc.ClientMethod<$0.AddressRequest, $0.AddressResponse>(
'/Rpc/Addresses',
($0.AddressRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.AddressResponse.fromBuffer(value));
static final _$spent = $grpc.ClientMethod<$0.SpentRequest, $0.SpentResponse>(
'/Rpc/Spent',
($0.SpentRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.SpentResponse.fromBuffer(value));
static final _$create =
$grpc.ClientMethod<$0.CreateRequest, $0.CreateResponse>(
'/Rpc/Create',
($0.CreateRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.CreateResponse.fromBuffer(value));
static final _$psbtCreate =
$grpc.ClientMethod<$0.PsbtCreateRequest, $0.PsbtResponse>(
'/Rpc/PsbtCreate',
($0.PsbtCreateRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtAddInput =
$grpc.ClientMethod<$0.PsbtAddInputRequest, $0.PsbtResponse>(
'/Rpc/PsbtAddInput',
($0.PsbtAddInputRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtAddRecipient =
$grpc.ClientMethod<$0.PsbtAddRecipientRequest, $0.PsbtResponse>(
'/Rpc/PsbtAddRecipient',
($0.PsbtAddRecipientRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtGetRecipients = $grpc.ClientMethod<
$0.PsbtGetRecipientsRequest, $0.PsbtGetRecipientsResponse>(
'/Rpc/PsbtGetRecipients',
($0.PsbtGetRecipientsRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.PsbtGetRecipientsResponse.fromBuffer(value));
static final _$psbtSign =
$grpc.ClientMethod<$0.PsbtSignRequest, $0.PsbtResponse>(
'/Rpc/PsbtSign',
($0.PsbtSignRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtSignNonMweb =
$grpc.ClientMethod<$0.PsbtSignNonMwebRequest, $0.PsbtResponse>(
'/Rpc/PsbtSignNonMweb',
($0.PsbtSignNonMwebRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtExtract =
$grpc.ClientMethod<$0.PsbtExtractRequest, $0.CreateResponse>(
'/Rpc/PsbtExtract',
($0.PsbtExtractRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.CreateResponse.fromBuffer(value));
static final _$ledgerExchange =
$grpc.ClientMethod<$0.LedgerApdu, $0.LedgerApdu>(
'/Rpc/LedgerExchange',
($0.LedgerApdu value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.LedgerApdu.fromBuffer(value));
static final _$broadcast =
$grpc.ClientMethod<$0.BroadcastRequest, $0.BroadcastResponse>(
'/Rpc/Broadcast',
($0.BroadcastRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.BroadcastResponse.fromBuffer(value));
static final _$coinswap =
$grpc.ClientMethod<$0.CoinswapRequest, $0.CoinswapResponse>(
'/Rpc/Coinswap',
($0.CoinswapRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.CoinswapResponse.fromBuffer(value));
static final _$create = $grpc.ClientMethod<$0.CreateRequest, $0.CreateResponse>(
'/Rpc/Create',
($0.CreateRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.CreateResponse.fromBuffer(value));
static final _$psbtCreate = $grpc.ClientMethod<$0.PsbtCreateRequest, $0.PsbtResponse>(
'/Rpc/PsbtCreate',
($0.PsbtCreateRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtAddInput = $grpc.ClientMethod<$0.PsbtAddInputRequest, $0.PsbtResponse>(
'/Rpc/PsbtAddInput',
($0.PsbtAddInputRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtAddRecipient = $grpc.ClientMethod<$0.PsbtAddRecipientRequest, $0.PsbtResponse>(
'/Rpc/PsbtAddRecipient',
($0.PsbtAddRecipientRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtGetRecipients =
$grpc.ClientMethod<$0.PsbtGetRecipientsRequest, $0.PsbtGetRecipientsResponse>(
'/Rpc/PsbtGetRecipients',
($0.PsbtGetRecipientsRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtGetRecipientsResponse.fromBuffer(value));
static final _$psbtSign = $grpc.ClientMethod<$0.PsbtSignRequest, $0.PsbtResponse>(
'/Rpc/PsbtSign',
($0.PsbtSignRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtSignNonMweb = $grpc.ClientMethod<$0.PsbtSignNonMwebRequest, $0.PsbtResponse>(
'/Rpc/PsbtSignNonMweb',
($0.PsbtSignNonMwebRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PsbtResponse.fromBuffer(value));
static final _$psbtExtract = $grpc.ClientMethod<$0.PsbtExtractRequest, $0.CreateResponse>(
'/Rpc/PsbtExtract',
($0.PsbtExtractRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.CreateResponse.fromBuffer(value));
static final _$ledgerExchange = $grpc.ClientMethod<$0.LedgerApdu, $0.LedgerApdu>(
'/Rpc/LedgerExchange',
($0.LedgerApdu value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.LedgerApdu.fromBuffer(value));
static final _$broadcast = $grpc.ClientMethod<$0.BroadcastRequest, $0.BroadcastResponse>(
'/Rpc/Broadcast',
($0.BroadcastRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.BroadcastResponse.fromBuffer(value));
static final _$coinswap = $grpc.ClientMethod<$0.CoinswapRequest, $0.CoinswapResponse>(
'/Rpc/Coinswap',
($0.CoinswapRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.CoinswapResponse.fromBuffer(value));
RpcClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
{$grpc.CallOptions? options, $core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
$grpc.ResponseFuture<$0.StatusResponse> status($0.StatusRequest request,
@@ -102,10 +85,8 @@ class RpcClient extends $grpc.Client {
return $createUnaryCall(_$status, request, options: options);
}
$grpc.ResponseStream<$0.Utxo> utxos($0.UtxosRequest request,
{$grpc.CallOptions? options}) {
return $createStreamingCall(_$utxos, $async.Stream.fromIterable([request]),
options: options);
$grpc.ResponseStream<$0.Utxo> utxos($0.UtxosRequest request, {$grpc.CallOptions? options}) {
return $createStreamingCall(_$utxos, $async.Stream.fromIterable([request]), options: options);
}
$grpc.ResponseFuture<$0.AddressResponse> addresses($0.AddressRequest request,
@@ -128,14 +109,12 @@ class RpcClient extends $grpc.Client {
return $createUnaryCall(_$psbtCreate, request, options: options);
}
$grpc.ResponseFuture<$0.PsbtResponse> psbtAddInput(
$0.PsbtAddInputRequest request,
$grpc.ResponseFuture<$0.PsbtResponse> psbtAddInput($0.PsbtAddInputRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$psbtAddInput, request, options: options);
}
$grpc.ResponseFuture<$0.PsbtResponse> psbtAddRecipient(
$0.PsbtAddRecipientRequest request,
$grpc.ResponseFuture<$0.PsbtResponse> psbtAddRecipient($0.PsbtAddRecipientRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$psbtAddRecipient, request, options: options);
}
@@ -151,14 +130,12 @@ class RpcClient extends $grpc.Client {
return $createUnaryCall(_$psbtSign, request, options: options);
}
$grpc.ResponseFuture<$0.PsbtResponse> psbtSignNonMweb(
$0.PsbtSignNonMwebRequest request,
$grpc.ResponseFuture<$0.PsbtResponse> psbtSignNonMweb($0.PsbtSignNonMwebRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$psbtSignNonMweb, request, options: options);
}
$grpc.ResponseFuture<$0.CreateResponse> psbtExtract(
$0.PsbtExtractRequest request,
$grpc.ResponseFuture<$0.CreateResponse> psbtExtract($0.PsbtExtractRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$psbtExtract, request, options: options);
}
@@ -168,8 +145,7 @@ class RpcClient extends $grpc.Client {
return $createUnaryCall(_$ledgerExchange, request, options: options);
}
$grpc.ResponseFuture<$0.BroadcastResponse> broadcast(
$0.BroadcastRequest request,
$grpc.ResponseFuture<$0.BroadcastResponse> broadcast($0.BroadcastRequest request,
{$grpc.CallOptions? options}) {
return $createUnaryCall(_$broadcast, request, options: options);
}
@@ -231,25 +207,21 @@ abstract class RpcServiceBase extends $grpc.Service {
psbtAddInput_Pre,
false,
false,
($core.List<$core.int> value) =>
$0.PsbtAddInputRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.PsbtAddInputRequest.fromBuffer(value),
($0.PsbtResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PsbtAddRecipientRequest, $0.PsbtResponse>(
'PsbtAddRecipient',
psbtAddRecipient_Pre,
false,
false,
($core.List<$core.int> value) =>
$0.PsbtAddRecipientRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.PsbtAddRecipientRequest.fromBuffer(value),
($0.PsbtResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PsbtGetRecipientsRequest,
$0.PsbtGetRecipientsResponse>(
$addMethod($grpc.ServiceMethod<$0.PsbtGetRecipientsRequest, $0.PsbtGetRecipientsResponse>(
'PsbtGetRecipients',
psbtGetRecipients_Pre,
false,
false,
($core.List<$core.int> value) =>
$0.PsbtGetRecipientsRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.PsbtGetRecipientsRequest.fromBuffer(value),
($0.PsbtGetRecipientsResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PsbtSignRequest, $0.PsbtResponse>(
'PsbtSign',
@@ -263,16 +235,14 @@ abstract class RpcServiceBase extends $grpc.Service {
psbtSignNonMweb_Pre,
false,
false,
($core.List<$core.int> value) =>
$0.PsbtSignNonMwebRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.PsbtSignNonMwebRequest.fromBuffer(value),
($0.PsbtResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PsbtExtractRequest, $0.CreateResponse>(
'PsbtExtract',
psbtExtract_Pre,
false,
false,
($core.List<$core.int> value) =>
$0.PsbtExtractRequest.fromBuffer(value),
($core.List<$core.int> value) => $0.PsbtExtractRequest.fromBuffer(value),
($0.CreateResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.LedgerApdu, $0.LedgerApdu>(
'LedgerExchange',
@@ -322,24 +292,23 @@ abstract class RpcServiceBase extends $grpc.Service {
return create(call, await request);
}
$async.Future<$0.PsbtResponse> psbtCreate_Pre($grpc.ServiceCall call,
$async.Future<$0.PsbtCreateRequest> request) async {
$async.Future<$0.PsbtResponse> psbtCreate_Pre(
$grpc.ServiceCall call, $async.Future<$0.PsbtCreateRequest> request) async {
return psbtCreate(call, await request);
}
$async.Future<$0.PsbtResponse> psbtAddInput_Pre($grpc.ServiceCall call,
$async.Future<$0.PsbtAddInputRequest> request) async {
$async.Future<$0.PsbtResponse> psbtAddInput_Pre(
$grpc.ServiceCall call, $async.Future<$0.PsbtAddInputRequest> request) async {
return psbtAddInput(call, await request);
}
$async.Future<$0.PsbtResponse> psbtAddRecipient_Pre($grpc.ServiceCall call,
$async.Future<$0.PsbtAddRecipientRequest> request) async {
$async.Future<$0.PsbtResponse> psbtAddRecipient_Pre(
$grpc.ServiceCall call, $async.Future<$0.PsbtAddRecipientRequest> request) async {
return psbtAddRecipient(call, await request);
}
$async.Future<$0.PsbtGetRecipientsResponse> psbtGetRecipients_Pre(
$grpc.ServiceCall call,
$async.Future<$0.PsbtGetRecipientsRequest> request) async {
$grpc.ServiceCall call, $async.Future<$0.PsbtGetRecipientsRequest> request) async {
return psbtGetRecipients(call, await request);
}
@@ -348,13 +317,13 @@ abstract class RpcServiceBase extends $grpc.Service {
return psbtSign(call, await request);
}
$async.Future<$0.PsbtResponse> psbtSignNonMweb_Pre($grpc.ServiceCall call,
$async.Future<$0.PsbtSignNonMwebRequest> request) async {
$async.Future<$0.PsbtResponse> psbtSignNonMweb_Pre(
$grpc.ServiceCall call, $async.Future<$0.PsbtSignNonMwebRequest> request) async {
return psbtSignNonMweb(call, await request);
}
$async.Future<$0.CreateResponse> psbtExtract_Pre($grpc.ServiceCall call,
$async.Future<$0.PsbtExtractRequest> request) async {
$async.Future<$0.CreateResponse> psbtExtract_Pre(
$grpc.ServiceCall call, $async.Future<$0.PsbtExtractRequest> request) async {
return psbtExtract(call, await request);
}
@@ -363,8 +332,8 @@ abstract class RpcServiceBase extends $grpc.Service {
return ledgerExchange(call, await request);
}
$async.Future<$0.BroadcastResponse> broadcast_Pre($grpc.ServiceCall call,
$async.Future<$0.BroadcastRequest> request) async {
$async.Future<$0.BroadcastResponse> broadcast_Pre(
$grpc.ServiceCall call, $async.Future<$0.BroadcastRequest> request) async {
return broadcast(call, await request);
}
@@ -373,33 +342,25 @@ abstract class RpcServiceBase extends $grpc.Service {
return coinswap(call, await request);
}
$async.Future<$0.StatusResponse> status(
$grpc.ServiceCall call, $0.StatusRequest request);
$async.Future<$0.StatusResponse> status($grpc.ServiceCall call, $0.StatusRequest request);
$async.Stream<$0.Utxo> utxos($grpc.ServiceCall call, $0.UtxosRequest request);
$async.Future<$0.AddressResponse> addresses(
$grpc.ServiceCall call, $0.AddressRequest request);
$async.Future<$0.SpentResponse> spent(
$grpc.ServiceCall call, $0.SpentRequest request);
$async.Future<$0.CreateResponse> create(
$grpc.ServiceCall call, $0.CreateRequest request);
$async.Future<$0.PsbtResponse> psbtCreate(
$grpc.ServiceCall call, $0.PsbtCreateRequest request);
$async.Future<$0.AddressResponse> addresses($grpc.ServiceCall call, $0.AddressRequest request);
$async.Future<$0.SpentResponse> spent($grpc.ServiceCall call, $0.SpentRequest request);
$async.Future<$0.CreateResponse> create($grpc.ServiceCall call, $0.CreateRequest request);
$async.Future<$0.PsbtResponse> psbtCreate($grpc.ServiceCall call, $0.PsbtCreateRequest request);
$async.Future<$0.PsbtResponse> psbtAddInput(
$grpc.ServiceCall call, $0.PsbtAddInputRequest request);
$async.Future<$0.PsbtResponse> psbtAddRecipient(
$grpc.ServiceCall call, $0.PsbtAddRecipientRequest request);
$async.Future<$0.PsbtGetRecipientsResponse> psbtGetRecipients(
$grpc.ServiceCall call, $0.PsbtGetRecipientsRequest request);
$async.Future<$0.PsbtResponse> psbtSign(
$grpc.ServiceCall call, $0.PsbtSignRequest request);
$async.Future<$0.PsbtResponse> psbtSign($grpc.ServiceCall call, $0.PsbtSignRequest request);
$async.Future<$0.PsbtResponse> psbtSignNonMweb(
$grpc.ServiceCall call, $0.PsbtSignNonMwebRequest request);
$async.Future<$0.CreateResponse> psbtExtract(
$grpc.ServiceCall call, $0.PsbtExtractRequest request);
$async.Future<$0.LedgerApdu> ledgerExchange(
$grpc.ServiceCall call, $0.LedgerApdu request);
$async.Future<$0.LedgerApdu> ledgerExchange($grpc.ServiceCall call, $0.LedgerApdu request);
$async.Future<$0.BroadcastResponse> broadcast(
$grpc.ServiceCall call, $0.BroadcastRequest request);
$async.Future<$0.CoinswapResponse> coinswap(
$grpc.ServiceCall call, $0.CoinswapRequest request);
$async.Future<$0.CoinswapResponse> coinswap($grpc.ServiceCall call, $0.CoinswapRequest request);
}
+9 -7
View File
@@ -8,18 +8,20 @@ import 'package:cake_wallet/view_model/link_view_model.dart';
import 'package:hive/hive.dart';
import 'package:mocktail/mocktail.dart';
class MockAppStore extends Mock implements AppStore{}
class MockAuthService extends Mock implements AuthService{}
class MockSettingsStore extends Mock implements SettingsStore {}
class MockAuthenticationStore extends Mock implements AuthenticationStore{}
class MockWalletListStore extends Mock implements WalletListStore{}
class MockAppStore extends Mock implements AppStore {}
class MockAuthService extends Mock implements AuthService {}
class MockSettingsStore extends Mock implements SettingsStore {}
class MockLinkViewModel extends Mock implements LinkViewModel {}
class MockAuthenticationStore extends Mock implements AuthenticationStore {}
class MockWalletListStore extends Mock implements WalletListStore {}
class MockLinkViewModel extends Mock implements LinkViewModel {}
class MockHiveInterface extends Mock implements HiveInterface {}
class MockHiveBox extends Mock implements Box<dynamic> {}
class MockSecureStorage extends Mock implements SecureStorage{}
class MockSecureStorage extends Mock implements SecureStorage {}
@@ -34,7 +34,7 @@ class DisclaimerPageRobot {
Future<void> tapAcceptButton() async {
await commonTestCases.tapItemByKey('disclaimer_accept_button_key');
await commonTestCases.defaultSleepTime();
}
}
@@ -66,7 +66,7 @@ class RestoreFromSeedOrKeysPageRobot {
Future<void> enterSeedPhraseForWalletRestore(String text) async {
ValidatableAnnotatedEditableTextState seedTextState =
await tester.state(find.byType(ValidatableAnnotatedEditableText));
await tester.state(find.byType(ValidatableAnnotatedEditableText));
seedTextState.widget.controller.text = text;
await tester.pumpAndSettle();
@@ -21,7 +21,7 @@ class SecurityAndBackupPageRobot {
Future<void> navigateToShowKeysPage() async {
await tester.pumpAndSettle(Duration(milliseconds: 1000));
await commonTestCases.tapItemByKey('security_backup_page_show_keys_button_key');
await tester.pumpAndSettle(Duration(milliseconds: 1000));
}
@@ -26,7 +26,7 @@ void main() {
(tester) async {
// Store the original FlutterError.onError handler
final originalOnError = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails details) {
debugPrint('FlutterError caught: ${details.exception}');
};
@@ -25,7 +25,7 @@ void main() {
FlutterError.onError = (FlutterErrorDetails details) {
debugPrint('FlutterError caught: ${details.exception}');
};
commonTestFlows = CommonTestFlows(tester);
exchangePageRobot = ExchangePageRobot(tester);
dashboardPageRobot = DashboardPageRobot(tester);
+6 -3
View File
@@ -48,7 +48,8 @@ void main() {
group("getCanonicalCryptoAmount", () {
test("Amount should not change for Bitcoin", () {
final amount = amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btc);
final amount =
amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btc);
expect(amount, "0.000001");
});
@@ -58,7 +59,8 @@ void main() {
});
test("Amount should not change for Bitcoin", () {
final amount = amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btcln);
final amount =
amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btcln);
expect(amount, "0.000001");
});
@@ -118,7 +120,8 @@ void main() {
});
test("Amount should be formated to Satoshi for Bitcoin Lightning", () {
final amount = amountParsingProxy.getDisplayCryptoAmount("0.000001", CryptoCurrency.btcln);
final amount =
amountParsingProxy.getDisplayCryptoAmount("0.000001", CryptoCurrency.btcln);
expect(amount, "100");
});
@@ -48,7 +48,8 @@ void main() {
});
test('detects Lightning invoice', () {
const invoice = 'lnbc1u1p3zj7j8pp5vkwxc4vxfzgzxcjzk5ksp0l7jgrgzmqxqmexxp8e8gfqk6s0knnqdlc35hsggzypnxw7xxxnrvd3hscqzpgxqrrsssp5txs5g8vkdmdtnm8g5v9m3u094nnxkl0jjf38jj5xn2pptxlqkwn7gpgfkt7q6z0frcj7vjy4mv7659hccln2e0gzt4ufnsukxcnknh7e58kwnr8pk6kgv6vrghcpld2z5n';
const invoice =
'lnbc1u1p3zj7j8pp5vkwxc4vxfzgzxcjzk5ksp0l7jgrgzmqxqmexxp8e8gfqk6s0knnqdlc35hsggzypnxw7xxxnrvd3hscqzpgxqrrsssp5txs5g8vkdmdtnm8g5v9m3u094nnxkl0jjf38jj5xn2pptxlqkwn7gpgfkt7q6z0frcj7vjy4mv7659hccln2e0gzt4ufnsukxcnknh7e58kwnr8pk6kgv6vrghcpld2z5n';
final result = UniversalAddressDetector.detectAddress(invoice);
expect(result.isValid, true);
@@ -39,8 +39,7 @@ void main() {
});
test('extracts Ethereum address correctly', () {
final raw =
'Send ETH to 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 thanks';
final raw = 'Send ETH to 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 thanks';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.eth,
@@ -60,25 +59,21 @@ void main() {
});
test('extracts Bitcoin Cash address correctly', () {
final raw =
'BCH: bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj';
final raw = 'BCH: bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.bch,
);
expect(
result, 'bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj');
expect(result, 'bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj');
});
test('extracts Nano address correctly', () {
final raw =
'NANO: nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd';
final raw = 'NANO: nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.nano,
);
expect(result,
'nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd');
expect(result, 'nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd');
});
test('returns null for unsupported currency', () {
@@ -101,9 +96,7 @@ void main() {
final raw =
'monero_wallet:467iotZU5tvG26k2xdZWkJ7gwATFVhfbuV3yDoWx5jHoPwxEi4f5BuJQwkP6GpCb1sZvUVB7nbSkgEuW8NKrh9KKRRga5qz?spend_key=029c559cd7669f14e91fd835144916009f8697ab5ac5c7f7c06e1ff869c17b0b&view_key=afaf646edbff3d3bcee8efd3383ffe5d20c947040f74e1110b70ca0fbb0ef90d';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.xmr,
requireSurroundingWhitespaces: false);
raw: raw, type: CryptoCurrency.xmr, requireSurroundingWhitespaces: false);
expect(result,
'467iotZU5tvG26k2xdZWkJ7gwATFVhfbuV3yDoWx5jHoPwxEi4f5BuJQwkP6GpCb1sZvUVB7nbSkgEuW8NKrh9KKRRga5qz');
});
@@ -119,16 +112,16 @@ sp1qq0avpawwjg4l66p6lqafj0vlvm6rlhdc6qt0r6dfual835vhs3gvkq63pechaqezvn7j7uj2jucw
#LTC MWEB
ltcmweb1qq0at62jjucmawxp78qutn0cqwkwahcfx7fxls0r2ma5llg5w6wyy2qe20gxa3rku2658j88zg9d2j4ttpw35k0a5nrg93h5nq3wyvkcgwc3q4dgc
''';
final resultXmr = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.xmr);
final resultXmr =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.xmr);
expect(resultXmr,
'89bH6i3ftaWSWuPJJYSQuuApWJ8xzinCEbbnAXN1Z3mGGUuAFdpBUg82R9MvJDSheJ6kW2dyMQEFUGM4tsZqRb2Q75UXqvc');
final resultBtc = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.btc);
final resultBtc =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.btc);
expect(resultBtc,
'sp1qq0avpawwjg4l66p6lqafj0vlvm6rlhdc6qt0r6dfual835vhs3gvkq63pechaqezvn7j7uj2jucwj5k7nenpw2r86wf42xv6wqdvxuk5rggrul45');
final resultLtc = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.ltc);
final resultLtc =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.ltc);
expect(resultLtc,
'ltcmweb1qq0at62jjucmawxp78qutn0cqwkwahcfx7fxls0r2ma5llg5w6wyy2qe20gxa3rku2658j88zg9d2j4ttpw35k0a5nrg93h5nq3wyvkcgwc3q4dgc');
});
+1 -2
View File
@@ -23,8 +23,7 @@ void main() {
});
test("extract address and amount from Cake Style Uri", () {
final uri =
Uri.parse("ethereum:0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41@1?amount=2.00");
final uri = Uri.parse("ethereum:0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41@1?amount=2.00");
final paymentRequest = PaymentRequest.fromUri(uri);
expect(paymentRequest.address, "0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41");
+2 -2
View File
@@ -26,11 +26,11 @@ void main(List<String> args) async {
}
print('Alphabetizing all files...');
for (var lang in langs) {
final fileName = getArbFileName(lang);
alphabetizeArbFile(fileName);
}
print('Done!');
}
}
+6 -8
View File
@@ -7,7 +7,7 @@ import 'package:archive/archive_io.dart';
final _dio = Dio();
final List<String> triplets = [
"x86_64-linux-gnu", // linux desktop - majority of users onlinux
"x86_64-linux-gnu", // linux desktop - majority of users onlinux
// "i686-linux-gnu", // not supported by cake
// "i686-meego-linux-gnu", // sailfishos (emulator)- not supported by cake
// "aarch64-linux-gnu", // not (yet) supported by cake - (mostly) mobile linux
@@ -18,7 +18,7 @@ final List<String> triplets = [
"armv7a-linux-androideabi",
// "i686-w64-mingw32", // 32bit windows - not supported by monero_c
"x86_64-w64-mingw32",
// "x86_64-apple-darwin11", // Intel macbooks (contrib) - not used by cake
// "x86_64-apple-darwin11", // Intel macbooks (contrib) - not used by cake
// "aarch64-apple-darwin11", // apple silicon macbooks (contrib) - not used by cake
// "x86_64-host-apple-darwin", // not available on CI (yet)
"aarch64-apple-darwin", // apple silicon macbooks
@@ -55,10 +55,8 @@ Future<void> main() async {
}
if (Platform.isMacOS) {
print("Generating ios framework");
final result = Process.runSync("bash", [
"-c",
"cd scripts/ios && ./gen_framework.sh && cd ../.."
]);
print((result.stdout+result.stderr).toString().trim());
final result =
Process.runSync("bash", ["-c", "cd scripts/ios && ./gen_framework.sh && cd ../.."]);
print((result.stdout + result.stderr).toString().trim());
}
}
}
+19 -21
View File
@@ -13,21 +13,21 @@ const srcDir = 'srcDir';
const defaultLocale = 'en';
Future<void> main(List<String> args) async {
final extraInfo = args.isNotEmpty ?
args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
final parts = arg.split('=');
var key = normalizeKeyName(parts[0]);
if (key.contains('--')) {
key = key.substring(2);
}
acc[key] = parts.length > 1
? parts[1].isNotEmpty
? parts[1]
: inputPath
: inputPath;
return acc;
})
: <String, dynamic> {srcDir : inputPath};
final extraInfo = args.isNotEmpty
? args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
final parts = arg.split('=');
var key = normalizeKeyName(parts[0]);
if (key.contains('--')) {
key = key.substring(2);
}
acc[key] = parts.length > 1
? parts[1].isNotEmpty
? parts[1]
: inputPath
: inputPath;
return acc;
})
: <String, dynamic>{srcDir: inputPath};
final outputDir = Directory(outputPath);
@@ -59,10 +59,10 @@ Future<void> main(List<String> args) async {
return;
}
final parts =
fileName.substring('strings_'.length, fileName.length - '.arb'.length).split('_');
fileName.substring('strings_'.length, fileName.length - '.arb'.length).split('_');
final locale = parts.length > 1
? '${parts.first.toLowerCase()}_${parts.sublist(1).join('_').toUpperCase()}'
: parts.first.toLowerCase();
? '${parts.first.toLowerCase()}_${parts.sublist(1).join('_').toUpperCase()}'
: parts.first.toLowerCase();
localePath[locale] = element.path;
});
@@ -78,8 +78,7 @@ Future<void> main(List<String> args) async {
output += part1;
output += textDirectionDeclaration;
var inputContent =
File(localePath[defaultLocale].toString()).readAsStringSync();
var inputContent = File(localePath[defaultLocale].toString()).readAsStringSync();
var config = json.decode(inputContent) as Map<String, dynamic>;
output += localizedStrings(config: config, hasOverride: false);
@@ -161,4 +160,3 @@ String localizedStrings({required Map<String, dynamic> config, required bool has
return output;
}
+1 -1
View File
@@ -9,4 +9,4 @@ Future<void> main(List<String> args) async => generateSecrets(args);
Future<void> generateSecrets(List<String> args) async {
await generateSecretsConfig(args);
await importSecretsConfig();
}
}
+2 -2
View File
@@ -9,12 +9,12 @@ Future<void> main(List<String> args) async {
final pubspecDescription = File(pubspecDescriptionPath);
if (!pubspecBase.existsSync() || !pubspecDescription.existsSync()) {
throw("$pubspecBasePath or $pubspecDescriptionPath doesn't exists");
throw ("$pubspecBasePath or $pubspecDescriptionPath doesn't exists");
}
final pubspecBaseContent = await pubspecBase.readAsString();
final pubspecDescriptionContent = await pubspecDescription.readAsString();
final pubSpecContent = pubspecDescriptionContent + '\n\n' + pubspecBaseContent;
final pubSpecContent = pubspecDescriptionContent + '\n\n' + pubspecBaseContent;
final outputPubspec = File(outputPubspecPath);
if (outputPubspec.existsSync()) {
+2 -2
View File
@@ -61,9 +61,9 @@ Future<void> generateSecretsConfig(List<String> args) async {
return;
}
}
await writeConfig(baseConfigFile, SecretKey.base, existingSecrets: secrets);
await writeConfig(evmChainsConfigFile, SecretKey.evmChainsSecrets);
await writeConfig(solanaConfigFile, SecretKey.solanaSecrets);
await writeConfig(nanoConfigFile, SecretKey.nanoSecrets);
@@ -157,4 +157,4 @@ String getLang(Locale l) => l == null
: l.countryCode != null && l.countryCode!.isEmpty
? l.languageCode
: l.toString();
""";
""";
+1
View File
@@ -0,0 +1 @@
+4 -5
View File
@@ -8,9 +8,9 @@ import 'utils/translation/translation_utils.dart';
const changelogsFilePath = "./assets/new-ui/changelog/text";
void main() async {
final List<dynamic> defaultLangChangelog = jsonDecode(
await File("$changelogsFilePath/changelog_$defaultLang.json").readAsString())
as List<dynamic>;
final List<dynamic> defaultLangChangelog =
jsonDecode(await File("$changelogsFilePath/changelog_$defaultLang.json").readAsString())
as List<dynamic>;
int currentLang = 0;
for (final lang in langs) {
@@ -50,7 +50,6 @@ void main() async {
"\r$currentLang/${langs.length} langs done, $currentItem/${defaultLangChangelog.length} items done");
}
currentLang++;
await File("$changelogsFilePath/changelog_$lang.json")
.writeAsString(jsonEncode(out));
await File("$changelogsFilePath/changelog_$lang.json").writeAsString(jsonEncode(out));
}
}
+13 -5
View File
@@ -217,11 +217,20 @@ IMPORTANT: Respond with a JSON object in the exact format, you must think about
void main(List<String> args) async {
final parser = ArgParser()
..addOption('source', abbr: 's', help: 'Path to source ARB file (e.g., ./res/values/strings_en.arb)', mandatory: true)
..addOption('destination', abbr: 'd', help: 'Path to destination ARB file (e.g., ./res/values/strings_pl.arb)', mandatory: true)
..addOption('source',
abbr: 's',
help: 'Path to source ARB file (e.g., ./res/values/strings_en.arb)',
mandatory: true)
..addOption('destination',
abbr: 'd',
help: 'Path to destination ARB file (e.g., ./res/values/strings_pl.arb)',
mandatory: true)
..addOption('key', abbr: 'k', help: 'Translate only this specific key (optional)')
..addOption('ollama-url', help: 'Ollama server URL (default: http://localhost:11434)', defaultsTo: 'http://localhost:11434')
..addOption('model', help: 'Ollama model name (default: gpt-oss:120b)', defaultsTo: 'gpt-oss:120b')
..addOption('ollama-url',
help: 'Ollama server URL (default: http://localhost:11434)',
defaultsTo: 'http://localhost:11434')
..addOption('model',
help: 'Ollama model name (default: gpt-oss:120b)', defaultsTo: 'gpt-oss:120b')
..addFlag('help', abbr: 'h', help: 'Show this help message', negatable: false);
try {
@@ -268,7 +277,6 @@ void main(List<String> args) async {
destinationArbPath: destinationPath,
specificKey: specificKey,
);
} catch (e) {
print('Error: $e');
print('Run with --help for more information.');
+1 -2
View File
@@ -8,8 +8,7 @@ import 'utils/translation/translation_utils.dart';
void main(List<String> args) async {
if (args.length != 1) {
throw Exception(
'Insufficient arguments!\n\nTry to run `./translation_add_lang.dart langCode`');
throw Exception('Insufficient arguments!\n\nTry to run `./translation_add_lang.dart langCode`');
}
final targetLang = args.first;
+1 -2
View File
@@ -28,8 +28,7 @@ void main(List<String> args) async {
missingKeys.forEach((key) {
print('Missing in "$lang": "$key"');
if (doFix)
missingDefaults[key] = arbObj[key] as String;
if (doFix) missingDefaults[key] = arbObj[key] as String;
});
if (missingDefaults.isNotEmpty) {
+2 -4
View File
@@ -12,8 +12,7 @@ Future<void> main(List<String> args) async {
}
Future<void> updateSecretsConfig(List<String> args) async {
final extraInfo =
args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
final extraInfo = args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
final parts = arg.split('=');
final key = normalizeKeyName(parts[0]);
acc[key] = parts.length > 1 ? parts[1] : 1;
@@ -32,8 +31,7 @@ Future<void> updateSecretsConfig(List<String> args) async {
return false;
});
final fileConfig =
json.decode(configFile.readAsStringSync()) as Map<String, dynamic>;
final fileConfig = json.decode(configFile.readAsStringSync()) as Map<String, dynamic>;
fileConfig.forEach((key, dynamic value) {
if (secrets[key] == null) {
secrets[key] = value;